@shapio/cms 0.0.0-stage → 0.3.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/README.md +27 -2
- package/dist/admin/apple-touch-icon.png +0 -0
- package/dist/admin/assets/AssistError-BITJ_tpg.js +2 -0
- package/dist/admin/assets/AssistError-BITJ_tpg.js.map +1 -0
- package/dist/admin/assets/BlockMenuItems-CcluK965.js +6 -0
- package/dist/admin/assets/BlockMenuItems-CcluK965.js.map +1 -0
- package/dist/admin/assets/Body-BXa9DhtH.js +2 -0
- package/dist/admin/assets/Body-BXa9DhtH.js.map +1 -0
- package/dist/admin/assets/Builder-DcpRfXuc.js +2 -0
- package/dist/admin/assets/Builder-DcpRfXuc.js.map +1 -0
- package/dist/admin/assets/ConfirmDialog-B9nWhIIz.js +2 -0
- package/dist/admin/assets/ConfirmDialog-B9nWhIIz.js.map +1 -0
- package/dist/admin/assets/CopyButton-BoWb-xi1.js +2 -0
- package/dist/admin/assets/CopyButton-BoWb-xi1.js.map +1 -0
- package/dist/admin/assets/CursorPager-BnxmTk47.js +2 -0
- package/dist/admin/assets/CursorPager-BnxmTk47.js.map +1 -0
- package/dist/admin/assets/ExternalLink-Eeb9mONJ.js +2 -0
- package/dist/admin/assets/ExternalLink-Eeb9mONJ.js.map +1 -0
- package/dist/admin/assets/Form-DZRLD3vH.js +2 -0
- package/dist/admin/assets/Form-DZRLD3vH.js.map +1 -0
- package/dist/admin/assets/FormCheckboxGroup-uIC2XQIL.js +2 -0
- package/dist/admin/assets/FormCheckboxGroup-uIC2XQIL.js.map +1 -0
- package/dist/admin/assets/FormRadioGroup-hd95vPOu.js +2 -0
- package/dist/admin/assets/FormRadioGroup-hd95vPOu.js.map +1 -0
- package/dist/admin/assets/FormSelectField-D7VHmnx5.js +2 -0
- package/dist/admin/assets/FormSelectField-D7VHmnx5.js.map +1 -0
- package/dist/admin/assets/FormSwitchField-ft8Jbe6E.js +2 -0
- package/dist/admin/assets/FormSwitchField-ft8Jbe6E.js.map +1 -0
- package/dist/admin/assets/FormTextareaField-DzyOzfZb.js +2 -0
- package/dist/admin/assets/FormTextareaField-DzyOzfZb.js.map +1 -0
- package/dist/admin/assets/HintedLabel-CvC46uy_.js +2 -0
- package/dist/admin/assets/HintedLabel-CvC46uy_.js.map +1 -0
- package/dist/admin/assets/InfoHint-GJLRVumb.js +2 -0
- package/dist/admin/assets/InfoHint-GJLRVumb.js.map +1 -0
- package/dist/admin/assets/InsertMenuItem-D976G0Rj.js +2 -0
- package/dist/admin/assets/InsertMenuItem-D976G0Rj.js.map +1 -0
- package/dist/admin/assets/LinkTabs-BZSlA57U.js +2 -0
- package/dist/admin/assets/LinkTabs-BZSlA57U.js.map +1 -0
- package/dist/admin/assets/Match-DdxTHHM4.js +2 -0
- package/dist/admin/assets/Match-DdxTHHM4.js.map +1 -0
- package/dist/admin/assets/Panel-iIKjEURi.js +2 -0
- package/dist/admin/assets/Panel-iIKjEURi.js.map +1 -0
- package/dist/admin/assets/QueryView-D6aZQJRN.js +2 -0
- package/dist/admin/assets/QueryView-D6aZQJRN.js.map +1 -0
- package/dist/admin/assets/RadioTile-BpB79rIK.js +2 -0
- package/dist/admin/assets/RadioTile-BpB79rIK.js.map +1 -0
- package/dist/admin/assets/RichTextField-BuHCONPu.js +144 -0
- package/dist/admin/assets/RichTextField-BuHCONPu.js.map +1 -0
- package/dist/admin/assets/RowTitle--uFCpx8n.js +2 -0
- package/dist/admin/assets/RowTitle--uFCpx8n.js.map +1 -0
- package/dist/admin/assets/SecretReveal-DFpzeNE0.js +2 -0
- package/dist/admin/assets/SecretReveal-DFpzeNE0.js.map +1 -0
- package/dist/admin/assets/SharedGlyph-Cqkx30tn.js +2 -0
- package/dist/admin/assets/SharedGlyph-Cqkx30tn.js.map +1 -0
- package/dist/admin/assets/StepList-BY5MuJPJ.js +2 -0
- package/dist/admin/assets/StepList-BY5MuJPJ.js.map +1 -0
- package/dist/admin/assets/Structure-CqRa2t7z.js +2 -0
- package/dist/admin/assets/Structure-CqRa2t7z.js.map +1 -0
- package/dist/admin/assets/SubNavLink-B2o4kSZ9.js +2 -0
- package/dist/admin/assets/SubNavLink-B2o4kSZ9.js.map +1 -0
- package/dist/admin/assets/SuggestAltButton-4rf2xhEJ.js +2 -0
- package/dist/admin/assets/SuggestAltButton-4rf2xhEJ.js.map +1 -0
- package/dist/admin/assets/TextLink-D15oyXlc.js +2 -0
- package/dist/admin/assets/TextLink-D15oyXlc.js.map +1 -0
- package/dist/admin/assets/Thumbnail-CP5mfgNY.js +2 -0
- package/dist/admin/assets/Thumbnail-CP5mfgNY.js.map +1 -0
- package/dist/admin/assets/UnsavedChangesGuard-DgOASh0p.js +2 -0
- package/dist/admin/assets/UnsavedChangesGuard-DgOASh0p.js.map +1 -0
- package/dist/admin/assets/UserAvatar-BocvNVL-.js +2 -0
- package/dist/admin/assets/UserAvatar-BocvNVL-.js.map +1 -0
- package/dist/admin/assets/View-BLsQYPow.js +11 -0
- package/dist/admin/assets/View-BLsQYPow.js.map +1 -0
- package/dist/admin/assets/arrow-up-gf_j6SVQ.js +2 -0
- package/dist/admin/assets/arrow-up-gf_j6SVQ.js.map +1 -0
- package/dist/admin/assets/auth-pcS9CCXu.js +2 -0
- package/dist/admin/assets/auth-pcS9CCXu.js.map +1 -0
- package/dist/admin/assets/badge-DD0mE96i.js +2 -0
- package/dist/admin/assets/badge-DD0mE96i.js.map +1 -0
- package/dist/admin/assets/boxes-DcK-kaSa.js +2 -0
- package/dist/admin/assets/boxes-DcK-kaSa.js.map +1 -0
- package/dist/admin/assets/calendar-clock-DEwACe0M.js +2 -0
- package/dist/admin/assets/calendar-clock-DEwACe0M.js.map +1 -0
- package/dist/admin/assets/changeSets-BjUEfYbj.js +2 -0
- package/dist/admin/assets/changeSets-BjUEfYbj.js.map +1 -0
- package/dist/admin/assets/chevron-left-BsQYDUEC.js +2 -0
- package/dist/admin/assets/chevron-left-BsQYDUEC.js.map +1 -0
- package/dist/admin/assets/circle-check-Dq1owihe.js +2 -0
- package/dist/admin/assets/circle-check-Dq1owihe.js.map +1 -0
- package/dist/admin/assets/circle-x-Dx6zIZko.js +2 -0
- package/dist/admin/assets/circle-x-Dx6zIZko.js.map +1 -0
- package/dist/admin/assets/client-C8vMCv-p.js +10 -0
- package/dist/admin/assets/client-C8vMCv-p.js.map +1 -0
- package/dist/admin/assets/clock-DQvkffqQ.js +2 -0
- package/dist/admin/assets/clock-DQvkffqQ.js.map +1 -0
- package/dist/admin/assets/cn-BQ3voEft.js +2 -0
- package/dist/admin/assets/cn-BQ3voEft.js.map +1 -0
- package/dist/admin/assets/coerce-OsqQRj19.js +2 -0
- package/dist/admin/assets/coerce-OsqQRj19.js.map +1 -0
- package/dist/admin/assets/constants-DCtq_UOe.js +2 -0
- package/dist/admin/assets/constants-DCtq_UOe.js.map +1 -0
- package/dist/admin/assets/constants-DUBUgzpU.js +2 -0
- package/dist/admin/assets/constants-DUBUgzpU.js.map +1 -0
- package/dist/admin/assets/constants-SrImR6C3.js +2 -0
- package/dist/admin/assets/constants-SrImR6C3.js.map +1 -0
- package/dist/admin/assets/content-_SLbbnfX.js +3 -0
- package/dist/admin/assets/content-_SLbbnfX.js.map +1 -0
- package/dist/admin/assets/contentCounts-Ch3uMXVU.js +2 -0
- package/dist/admin/assets/contentCounts-Ch3uMXVU.js.map +1 -0
- package/dist/admin/assets/contentTypes-BCOdUK_Z.js +2 -0
- package/dist/admin/assets/contentTypes-BCOdUK_Z.js.map +1 -0
- package/dist/admin/assets/copy-BDc3r0fO.js +2 -0
- package/dist/admin/assets/copy-BDc3r0fO.js.map +1 -0
- package/dist/admin/assets/dateTimeLocal-C92tyKwz.js +2 -0
- package/dist/admin/assets/dateTimeLocal-C92tyKwz.js.map +1 -0
- package/dist/admin/assets/defineEditor-CiJc766Y.js +2 -0
- package/dist/admin/assets/defineEditor-CiJc766Y.js.map +1 -0
- package/dist/admin/assets/develop-DS9TlDmv.js +11 -0
- package/dist/admin/assets/develop-DS9TlDmv.js.map +1 -0
- package/dist/admin/assets/dropdown-menu-gmP2Rp3n.js +2 -0
- package/dist/admin/assets/dropdown-menu-gmP2Rp3n.js.map +1 -0
- package/dist/admin/assets/ellipsis-NK0pWgqU.js +2 -0
- package/dist/admin/assets/ellipsis-NK0pWgqU.js.map +1 -0
- package/dist/admin/assets/external-link-D3Aoi2yX.js +2 -0
- package/dist/admin/assets/external-link-D3Aoi2yX.js.map +1 -0
- package/dist/admin/assets/file-text-DxXAmmxL.js +2 -0
- package/dist/admin/assets/file-text-DxXAmmxL.js.map +1 -0
- package/dist/admin/assets/fileRoute-C2tOrKhO.js +2 -0
- package/dist/admin/assets/fileRoute-C2tOrKhO.js.map +1 -0
- package/dist/admin/assets/followPlural-CN6cQfNk.js +2 -0
- package/dist/admin/assets/followPlural-CN6cQfNk.js.map +1 -0
- package/dist/admin/assets/globe-CuElSilX.js +2 -0
- package/dist/admin/assets/globe-CuElSilX.js.map +1 -0
- package/dist/admin/assets/image-CsH8dZve.js +2 -0
- package/dist/admin/assets/image-CsH8dZve.js.map +1 -0
- package/dist/admin/assets/image-off-B_uBCsYu.js +2 -0
- package/dist/admin/assets/image-off-B_uBCsYu.js.map +1 -0
- package/dist/admin/assets/inbox-3iAHL3pC.js +2 -0
- package/dist/admin/assets/inbox-3iAHL3pC.js.map +1 -0
- package/dist/admin/assets/inbox-DsuXNaKE.js +2 -0
- package/dist/admin/assets/inbox-DsuXNaKE.js.map +1 -0
- package/dist/admin/assets/index-BLYOgCKc.css +2 -0
- package/dist/admin/assets/index-BSzXA60W.js +4 -0
- package/dist/admin/assets/index-BSzXA60W.js.map +1 -0
- package/dist/admin/assets/jsx-runtime-DREnUpxT.js +2 -0
- package/dist/admin/assets/jsx-runtime-DREnUpxT.js.map +1 -0
- package/dist/admin/assets/key-round-B17HiT3K.js +2 -0
- package/dist/admin/assets/key-round-B17HiT3K.js.map +1 -0
- package/dist/admin/assets/link-2-off-hWGS8LW6.js +2 -0
- package/dist/admin/assets/link-2-off-hWGS8LW6.js.map +1 -0
- package/dist/admin/assets/link-bhHmG4Tc.js +2 -0
- package/dist/admin/assets/link-bhHmG4Tc.js.map +1 -0
- package/dist/admin/assets/list-DRtRdjBC.js +2 -0
- package/dist/admin/assets/list-DRtRdjBC.js.map +1 -0
- package/dist/admin/assets/locales-BzPbz8FF.js +2 -0
- package/dist/admin/assets/locales-BzPbz8FF.js.map +1 -0
- package/dist/admin/assets/media-WLnWaL7U.js +2 -0
- package/dist/admin/assets/media-WLnWaL7U.js.map +1 -0
- package/dist/admin/assets/media-Xzot1ueY.js +2 -0
- package/dist/admin/assets/media-Xzot1ueY.js.map +1 -0
- package/dist/admin/assets/modelPermissions-DZ1lWfQZ.js +2 -0
- package/dist/admin/assets/modelPermissions-DZ1lWfQZ.js.map +1 -0
- package/dist/admin/assets/network-DHGqLwji.js +2 -0
- package/dist/admin/assets/network-DHGqLwji.js.map +1 -0
- package/dist/admin/assets/pencil-Bdp2z9D_.js +2 -0
- package/dist/admin/assets/pencil-Bdp2z9D_.js.map +1 -0
- package/dist/admin/assets/plus-BN_iSsnp.js +2 -0
- package/dist/admin/assets/plus-BN_iSsnp.js.map +1 -0
- package/dist/admin/assets/preload-helper-DAbCfXID.js +2 -0
- package/dist/admin/assets/preload-helper-DAbCfXID.js.map +1 -0
- package/dist/admin/assets/publishing-B7zv1e7j.js +2 -0
- package/dist/admin/assets/publishing-B7zv1e7j.js.map +1 -0
- package/dist/admin/assets/publishing-d9yhMwgA.js +2 -0
- package/dist/admin/assets/publishing-d9yhMwgA.js.map +1 -0
- package/dist/admin/assets/radio-group-DHIxK-IU.js +2 -0
- package/dist/admin/assets/radio-group-DHIxK-IU.js.map +1 -0
- package/dist/admin/assets/react-CQOZoUwg.js +2 -0
- package/dist/admin/assets/react-CQOZoUwg.js.map +1 -0
- package/dist/admin/assets/react-dom-pEVw9mjF.js +2 -0
- package/dist/admin/assets/react-dom-pEVw9mjF.js.map +1 -0
- package/dist/admin/assets/rolldown-runtime-Dd_uD5pT.js +1 -0
- package/dist/admin/assets/root-CDpNo7ef.js +2 -0
- package/dist/admin/assets/root-CDpNo7ef.js.map +1 -0
- package/dist/admin/assets/rotate-ccw-CBoZle-b.js +2 -0
- package/dist/admin/assets/rotate-ccw-CBoZle-b.js.map +1 -0
- package/dist/admin/assets/schedules-Dy89Nm6P.js +2 -0
- package/dist/admin/assets/schedules-Dy89Nm6P.js.map +1 -0
- package/dist/admin/assets/schema-B4smPFcR.js +2 -0
- package/dist/admin/assets/schema-B4smPFcR.js.map +1 -0
- package/dist/admin/assets/scroll-text-UbyzpWh-.js +2 -0
- package/dist/admin/assets/scroll-text-UbyzpWh-.js.map +1 -0
- package/dist/admin/assets/search-_YlNpPvU.js +2 -0
- package/dist/admin/assets/search-_YlNpPvU.js.map +1 -0
- package/dist/admin/assets/searchSchema-CvOhn4FV.js +2 -0
- package/dist/admin/assets/searchSchema-CvOhn4FV.js.map +1 -0
- package/dist/admin/assets/searchSchemas-BxRnxenn.js +2 -0
- package/dist/admin/assets/searchSchemas-BxRnxenn.js.map +1 -0
- package/dist/admin/assets/sections-Bb3Q4bcY.js +2 -0
- package/dist/admin/assets/sections-Bb3Q4bcY.js.map +1 -0
- package/dist/admin/assets/sections-DiySZZHb.js +2 -0
- package/dist/admin/assets/sections-DiySZZHb.js.map +1 -0
- package/dist/admin/assets/select-tHVWX85X.js +2 -0
- package/dist/admin/assets/select-tHVWX85X.js.map +1 -0
- package/dist/admin/assets/send-BqECHYi6.js +2 -0
- package/dist/admin/assets/send-BqECHYi6.js.map +1 -0
- package/dist/admin/assets/settings-D-v8gL8F.js +2 -0
- package/dist/admin/assets/settings-D-v8gL8F.js.map +1 -0
- package/dist/admin/assets/settle-LRKtTN_e.js +2 -0
- package/dist/admin/assets/settle-LRKtTN_e.js.map +1 -0
- package/dist/admin/assets/shared-react-KADNSNpb.js +1 -0
- package/dist/admin/assets/shared-react-dom-BpneAejY.js +1 -0
- package/dist/admin/assets/shared-react-dom-client-CnpZTXxo.js +1 -0
- package/dist/admin/assets/shared-react-jsx-runtime-CU_Fm1m8.js +1 -0
- package/dist/admin/assets/shared-shapio-editor-sdk-9ANIbEN0.js +1 -0
- package/dist/admin/assets/sites-C6_THCVK.js +2 -0
- package/dist/admin/assets/sites-C6_THCVK.js.map +1 -0
- package/dist/admin/assets/skeleton-C3QLIh7W.js +42 -0
- package/dist/admin/assets/skeleton-C3QLIh7W.js.map +1 -0
- package/dist/admin/assets/snapshots-BQrhsCmC.js +2 -0
- package/dist/admin/assets/snapshots-BQrhsCmC.js.map +1 -0
- package/dist/admin/assets/sparkles-BW4CbD6W.js +2 -0
- package/dist/admin/assets/sparkles-BW4CbD6W.js.map +1 -0
- package/dist/admin/assets/src-XaU0N8C-.js +4 -0
- package/dist/admin/assets/src-XaU0N8C-.js.map +1 -0
- package/dist/admin/assets/stableId-C9Yq5iUw.js +2 -0
- package/dist/admin/assets/stableId-C9Yq5iUw.js.map +1 -0
- package/dist/admin/assets/store-BphwUzV5.js +2 -0
- package/dist/admin/assets/store-BphwUzV5.js.map +1 -0
- package/dist/admin/assets/switch-BVy02Vc8.js +2 -0
- package/dist/admin/assets/switch-BVy02Vc8.js.map +1 -0
- package/dist/admin/assets/table-CZYtdoHn.js +56 -0
- package/dist/admin/assets/table-CZYtdoHn.js.map +1 -0
- package/dist/admin/assets/tabs-quHbeVxA.js +5 -0
- package/dist/admin/assets/tabs-quHbeVxA.js.map +1 -0
- package/dist/admin/assets/textarea-B8Vl5gJ1.js +2 -0
- package/dist/admin/assets/textarea-B8Vl5gJ1.js.map +1 -0
- package/dist/admin/assets/titles-B2z5ckxG.js +2 -0
- package/dist/admin/assets/titles-B2z5ckxG.js.map +1 -0
- package/dist/admin/assets/tokens-Fh_OeIlf.js +2 -0
- package/dist/admin/assets/tokens-Fh_OeIlf.js.map +1 -0
- package/dist/admin/assets/tooltip-DwqM3opE.js +2 -0
- package/dist/admin/assets/tooltip-DwqM3opE.js.map +1 -0
- package/dist/admin/assets/undo-2-D4Fz4JMZ.js +2 -0
- package/dist/admin/assets/undo-2-D4Fz4JMZ.js.map +1 -0
- package/dist/admin/assets/useAuditLabels-DKrsrciQ.js +2 -0
- package/dist/admin/assets/useAuditLabels-DKrsrciQ.js.map +1 -0
- package/dist/admin/assets/useConfirmTarget-Dp8mCulm.js +2 -0
- package/dist/admin/assets/useConfirmTarget-Dp8mCulm.js.map +1 -0
- package/dist/admin/assets/useContentSchema-Bv4_6VJR.js +2 -0
- package/dist/admin/assets/useContentSchema-Bv4_6VJR.js.map +1 -0
- package/dist/admin/assets/useCursorPager-B1upg5EU.js +2 -0
- package/dist/admin/assets/useCursorPager-B1upg5EU.js.map +1 -0
- package/dist/admin/assets/useDebouncedValue-Dqs3wwhn.js +2 -0
- package/dist/admin/assets/useDebouncedValue-Dqs3wwhn.js.map +1 -0
- package/dist/admin/assets/useDiscardGuard-34ynGJIk.js +2 -0
- package/dist/admin/assets/useDiscardGuard-34ynGJIk.js.map +1 -0
- package/dist/admin/assets/useMediaUploader-QXSjZStv.js +2 -0
- package/dist/admin/assets/useMediaUploader-QXSjZStv.js.map +1 -0
- package/dist/admin/assets/usePaletteItems-62-TZhy7.js +2 -0
- package/dist/admin/assets/usePaletteItems-62-TZhy7.js.map +1 -0
- package/dist/admin/assets/usePlaces-CY6f2DmI.js +2 -0
- package/dist/admin/assets/usePlaces-CY6f2DmI.js.map +1 -0
- package/dist/admin/assets/useQueries-BuKJBA0M.js +2 -0
- package/dist/admin/assets/useQueries-BuKJBA0M.js.map +1 -0
- package/dist/admin/assets/useSaveShortcut-rKtp1qK7.js +2 -0
- package/dist/admin/assets/useSaveShortcut-rKtp1qK7.js.map +1 -0
- package/dist/admin/assets/useSchemaScopeAccess-DUBeS9kU.js +2 -0
- package/dist/admin/assets/useSchemaScopeAccess-DUBeS9kU.js.map +1 -0
- package/dist/admin/assets/useSearchInput-1fDoEtXe.js +2 -0
- package/dist/admin/assets/useSearchInput-1fDoEtXe.js.map +1 -0
- package/dist/admin/assets/users-BOn2ohJQ.js +2 -0
- package/dist/admin/assets/users-BOn2ohJQ.js.map +1 -0
- package/dist/admin/assets/users-BkKc4MNB.js +2 -0
- package/dist/admin/assets/users-BkKc4MNB.js.map +1 -0
- package/dist/admin/assets/w3c-keyname-BOAvb0qz.js +2 -0
- package/dist/admin/assets/w3c-keyname-BOAvb0qz.js.map +1 -0
- package/dist/admin/assets/zod-BHAd1wTC.js +2 -0
- package/dist/admin/assets/zod-BHAd1wTC.js.map +1 -0
- package/dist/admin/favicon-32.png +0 -0
- package/dist/admin/favicon.svg +5 -0
- package/dist/admin/fonts/OFL-SourceSerif4.txt +93 -0
- package/dist/admin/fonts/OFL.txt +93 -0
- package/dist/admin/fonts/manrope-latin-ext-wght-normal.woff2 +0 -0
- package/dist/admin/fonts/manrope-latin-wght-normal.woff2 +0 -0
- package/dist/admin/fonts/source-serif-4-latin-ext-wght-italic.woff2 +0 -0
- package/dist/admin/fonts/source-serif-4-latin-ext-wght-normal.woff2 +0 -0
- package/dist/admin/fonts/source-serif-4-latin-wght-italic.woff2 +0 -0
- package/dist/admin/fonts/source-serif-4-latin-wght-normal.woff2 +0 -0
- package/dist/admin/index.html +90 -0
- package/dist/admin/theme-init.js +18 -0
- package/dist/cli.js +5383 -0
- package/dist/cli.js.map +1 -0
- package/dist/config.d.ts +2 -0
- package/dist/config.js +39 -0
- package/dist/config.js.map +1 -0
- package/dist/index.d.ts +1056 -0
- package/dist/index.js +3 -0
- package/dist/public-CGO8RBn3.d.ts +1185 -0
- package/dist/worker-BLXy8aRW.js +47532 -0
- package/dist/worker-BLXy8aRW.js.map +1 -0
- package/package.json +97 -3
- package/vendor/graphiql/LICENSE.graphiql +21 -0
- package/vendor/graphiql/LICENSE.react +21 -0
- package/vendor/graphiql/LICENSE.react-dom +21 -0
- package/vendor/graphiql/graphiql.min.css +1 -0
- package/vendor/graphiql/graphiql.min.js +46 -0
- package/vendor/graphiql/react-dom.production.min.js +267 -0
- package/vendor/graphiql/react.production.min.js +31 -0
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{t}from"./react-CQOZoUwg.js";import{t as n}from"./jsx-runtime-DREnUpxT.js";import{i as r,j as i,r as a,t as o}from"./cn-BQ3voEft.js";import{C as s,D as c,E as l,S as u,T as d,b as f,g as p,w as m,x as h,y as g}from"./badge-DD0mE96i.js";import{N as _,a as v,d as y,i as b,n as x,o as S,r as C,z as w}from"./InfoHint-GJLRVumb.js";import{E as T,O as E,T as D,a as O,b as k,g as A,h as j,i as M,k as N,v as P,y as F}from"./skeleton-C3QLIh7W.js";var I={name:`circle-alert`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`12`,x2:`12`,y1:`8`,y2:`12`,key:`1pkeuh`}],[`line`,{x1:`12`,x2:`12.01`,y1:`16`,y2:`16`,key:`4dfq90`}]],aliases:[`alert-circle`]};I.node;var L=r(I),R=e(t(),1),z=e(n(),1),ee=Object.defineProperty,B=(e,t)=>ee(e,`name`,{value:t,configurable:!0}),[te,ne]=F(`AlertDialog`,[c]),V=c(),re=B(e=>{let{__scopeAlertDialog:t,...n}=e,r=V(t);return(0,z.jsx)(g,{...r,...n,modal:!0})},`AlertDialog`);R.forwardRef(B(function(e,t){let{__scopeAlertDialog:n,...r}=e,i=V(n);return(0,z.jsx)(l,{...i,...r,ref:t})},`AlertDialogTrigger`));var ie=B(e=>{let{__scopeAlertDialog:t,...n}=e,r=V(t);return(0,z.jsx)(m,{...r,...n})},`AlertDialogPortal`),ae=R.forwardRef(B(function(e,t){let{__scopeAlertDialog:n,...r}=e,i=V(n);return(0,z.jsx)(s,{...i,...r,ref:t})},`AlertDialogOverlay`)),[oe,se]=te(`AlertDialogContent`),ce=R.forwardRef(B(function(e,t){let{__scopeAlertDialog:n,children:r,...i}=e,a=V(n),o=R.useRef(null),s=D(t,o),c=R.useRef(null);return(0,z.jsx)(oe,{scope:n,cancelRef:c,children:(0,z.jsx)(h,{role:`alertdialog`,...a,...i,ref:s,onOpenAutoFocus:P(i.onOpenAutoFocus,e=>{e.preventDefault(),c.current?.focus({preventScroll:!0})}),onPointerDownOutside:e=>e.preventDefault(),onInteractOutside:e=>e.preventDefault(),children:r})})},`AlertDialogContent`)),le=R.forwardRef(B(function(e,t){let{__scopeAlertDialog:n,...r}=e,i=V(n);return(0,z.jsx)(d,{...i,...r,ref:t})},`AlertDialogTitle`)),ue=R.forwardRef(B(function(e,t){let{__scopeAlertDialog:n,...r}=e,i=V(n);return(0,z.jsx)(u,{...i,...r,ref:t})},`AlertDialogDescription`)),de=R.forwardRef(B(function(e,t){let{__scopeAlertDialog:n,...r}=e,i=V(n);return(0,z.jsx)(f,{...i,...r,ref:t})},`AlertDialogAction`)),fe=`AlertDialogCancel`,pe=R.forwardRef(B(function(e,t){let{__scopeAlertDialog:n,...r}=e,{cancelRef:i}=se(fe,n),a=V(n),o=D(t,i);return(0,z.jsx)(f,{...a,...r,ref:o})},`AlertDialogCancel`)),me=re,he=ie,ge=ae,_e=ce,ve=de,ye=pe,be=le,xe=ue,Se=Object.defineProperty,H=(e,t)=>Se(e,`name`,{value:t,configurable:!0}),U=`Checkbox`,[Ce,we]=F(U),[Te,W]=Ce(U);function G(e){let{__scopeCheckbox:t,checked:n,children:r,defaultChecked:i,disabled:a,form:o,name:s,onCheckedChange:c,required:l,value:u=`on`,internal_do_not_use_render:d}=e,[f,p]=A({prop:n,defaultProp:i??!1,onChange:c,caller:U}),[m,h]=R.useState(null),[g,_]=R.useState(null),v=R.useRef(!1),[y,b]=R.useReducer(e=>e+1,0),x=!m||!!o||!!m.closest(`form`),S={checked:f,disabled:a,setChecked:p,control:m,setControl:h,name:s,form:o,value:u,hasConsumerStoppedPropagationRef:v,userInteractionCount:y,onUserInteraction:b,required:l,defaultChecked:!q(i)&&i,isFormControl:x,bubbleInput:g,setBubbleInput:_};return(0,z.jsx)(Te,{scope:t,...S,children:K(d)?d(S):r})}H(G,`CheckboxProvider`);var Ee=`CheckboxTrigger`,De=R.forwardRef(H(function({__scopeCheckbox:e,onKeyDown:t,onClick:n,...r},i){let{control:a,value:o,disabled:s,checked:c,required:l,setControl:u,setChecked:d,hasConsumerStoppedPropagationRef:f,onUserInteraction:p,isFormControl:m,bubbleInput:h}=W(Ee,e),g=D(i,u),_=R.useRef(c);return R.useEffect(()=>{let e=a?.form;if(e){let t=H(()=>d(_.current),`reset`);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[a,d]),(0,z.jsx)(k.button,{type:`button`,role:`checkbox`,"aria-checked":q(c)?`mixed`:c,"aria-required":l,"data-state":J(c),"data-disabled":s?``:void 0,disabled:s,value:o,...r,ref:g,onKeyDown:P(t,e=>{e.key===`Enter`&&e.preventDefault()}),onClick:P(n,e=>{p(),d(e=>q(e)?!0:!e),h&&m&&(f.current=e.isPropagationStopped(),f.current||e.stopPropagation())})})},`CheckboxTrigger`)),Oe=R.forwardRef(H(function(e,t){let{__scopeCheckbox:n,name:r,checked:i,defaultChecked:a,required:o,disabled:s,value:c,onCheckedChange:l,form:u,...d}=e;return(0,z.jsx)(G,{__scopeCheckbox:n,checked:i,defaultChecked:a,disabled:s,required:o,onCheckedChange:l,name:r,form:u,value:c,internal_do_not_use_render:({isFormControl:e})=>(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(De,{...d,ref:t,__scopeCheckbox:n}),e&&(0,z.jsx)(Me,{__scopeCheckbox:n})]})})},`Checkbox`)),ke=`CheckboxIndicator`,Ae=R.forwardRef(H(function(e,t){let{__scopeCheckbox:n,forceMount:r,...i}=e,a=W(ke,n);return(0,z.jsx)(j,{present:r||q(a.checked)||a.checked===!0,children:(0,z.jsx)(k.span,{"data-state":J(a.checked),"data-disabled":a.disabled?``:void 0,...i,ref:t,style:{pointerEvents:`none`,...e.style}})})},`CheckboxIndicator`)),je=`CheckboxBubbleInput`,Me=R.forwardRef(H(function({__scopeCheckbox:e,onClick:t,...n},r){let{control:i,hasConsumerStoppedPropagationRef:a,userInteractionCount:o,checked:s,defaultChecked:c,required:l,disabled:u,name:d,value:f,form:p,bubbleInput:m,setBubbleInput:h}=W(je,e),g=D(r,h),v=_(i),y=R.useRef(!1),b=R.useRef(s),x=R.useRef(o);R.useEffect(()=>{let e=m;if(!e)return;let t=window.HTMLInputElement.prototype,n=Object.getOwnPropertyDescriptor(t,`checked`).set,r=o!==x.current;x.current=o;let i=b.current!==s;b.current=s;let c=!(r&&a.current);if(i&&n){y.current=!r;let t=new Event(`click`,{bubbles:c});e.indeterminate=q(s),n.call(e,!q(s)&&s),e.dispatchEvent(t),y.current=!1}},[m,s,a,o]);let S=R.useRef(!q(s)&&s);return(0,z.jsx)(k.input,{type:`checkbox`,"aria-hidden":!0,defaultChecked:c??S.current,required:l,disabled:u,name:d,value:f,form:p,...n,tabIndex:-1,ref:g,onClick:P(t,e=>{y.current&&e.stopPropagation()}),style:{...n.style,...v,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0,transform:`translateX(-100%)`}})},`CheckboxBubbleInput`));function K(e){return typeof e==`function`}H(K,`isFunction`);function q(e){return e===`indeterminate`}H(q,`isIndeterminate`);function J(e){return q(e)?`indeterminate`:e?`checked`:`unchecked`}H(J,`getState`);var Ne=T(`relative grid w-full grid-cols-[0_1fr] items-start gap-y-0.5 rounded-lg border px-4 py-3 text-sm has-[>svg]:grid-cols-[calc(var(--spacing)*4)_1fr] has-[>svg]:gap-x-3 [&>svg]:size-4 [&>svg]:translate-y-0.5 [&>svg]:text-current`,{variants:{variant:{default:`bg-card text-card-foreground`,destructive:`border-destructive/30 bg-destructive-muted text-destructive *:data-[slot=alert-description]:text-destructive [&>svg]:text-current`,warning:`border-warning/30 bg-warning-muted text-warning *:data-[slot=alert-description]:text-warning [&>svg]:text-current`,info:`border-border bg-muted text-foreground *:data-[slot=alert-description]:text-muted-foreground dark:border-info/30 dark:bg-info-muted dark:text-info dark:*:data-[slot=alert-description]:text-info [&>svg]:text-info`,success:`border-success/30 bg-success-muted text-success *:data-[slot=alert-description]:text-success [&>svg]:text-current`}},defaultVariants:{variant:`default`}});function Y({className:e,variant:t,...n}){return(0,z.jsx)(`div`,{"data-slot":`alert`,role:`alert`,className:o(Ne({variant:t}),e),...n})}function Pe({className:e,...t}){return(0,z.jsx)(`div`,{"data-slot":`alert-title`,className:o(`col-start-2 line-clamp-1 min-h-4 font-medium tracking-tight`,e),...t})}function X({className:e,...t}){return(0,z.jsx)(`div`,{"data-slot":`alert-description`,className:o(`col-start-2 grid justify-items-start gap-1 text-sm text-muted-foreground [&_p]:leading-relaxed`,e),...t})}var Z=({error:e})=>e?(0,z.jsxs)(Y,{variant:`destructive`,children:[(0,z.jsx)(L,{"aria-hidden":`true`}),(0,z.jsx)(X,{children:N(e)})]}):null,Fe=e=>{let{title:t,description:n,confirmLabel:r,cancelLabel:o,pendingLabel:s,tone:c,onConfirm:l,align:u=`end`,side:d=`bottom`,onCloseAutoFocus:f}=e,{t:m}=i(),h=(0,R.useId)(),g=(0,R.useId)(),_=(0,R.useRef)(null),y=(0,R.useRef)(null),[S,w]=(0,R.useState)(!1),[T,E]=(0,R.useState)(!1),[D,O]=(0,R.useState)(null),k=e.trigger===void 0?e.open:S,A=t=>{t&&O(null),e.trigger===void 0?e.onOpenChange(t):w(t)},j=e=>T&&!e?void 0:A(e),N=()=>{let e=l();if(!(e instanceof Promise)){A(!1);return}E(!0),O(null),e.then(()=>{E(!1),A(!1)},e=>{E(!1),O(e)})},P=p(e=>{e.preventDefault(),(c===`danger`?_:y).current?.focus()},f);return(0,z.jsxs)(x,{open:k,onOpenChange:j,modal:!0,children:[e.trigger===void 0?(0,z.jsx)(C,{asChild:!0,children:e.children}):(0,z.jsx)(v,{asChild:!0,children:e.trigger}),(0,z.jsxs)(b,{role:`alertdialog`,"aria-modal":`true`,"aria-labelledby":h,"aria-describedby":n?g:void 0,align:u,side:d,className:`w-80 space-y-4`,...P,children:[(0,z.jsxs)(`div`,{className:`space-y-1`,children:[(0,z.jsx)(`p`,{id:h,className:`text-sm font-semibold`,children:t}),n?(0,z.jsx)(`p`,{id:g,className:`text-meta text-muted-foreground`,children:n}):null]}),(0,z.jsx)(Z,{error:D}),(0,z.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,z.jsx)(M,{ref:_,type:`button`,size:`sm`,variant:`outline`,disabled:T,onClick:()=>A(!1),children:o??m(`common.cancel`)}),(0,z.jsx)(M,{ref:y,type:`button`,size:`sm`,variant:c===`danger`?`destructive`:`default`,disabled:T,"aria-busy":T||void 0,onClick:N,children:T?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(a,{className:`animate-spin`,"aria-hidden":`true`}),s??r]}):r})]})]})]})};function Q({className:e,...t}){return(0,z.jsx)(Oe,{"data-slot":`checkbox`,className:o(`peer size-4 shrink-0 rounded-[4px] border border-input shadow-xs transition-shadow outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 data-[state=checked]:border-primary data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground data-[state=indeterminate]:border-primary data-[state=indeterminate]:bg-primary data-[state=indeterminate]:text-primary-foreground dark:bg-input/30 dark:aria-invalid:ring-destructive/40 dark:data-[state=checked]:bg-primary dark:data-[state=indeterminate]:bg-primary`,e),...t,children:(0,z.jsx)(Ae,{"data-slot":`checkbox-indicator`,className:`grid place-content-center text-current transition-none`,children:t.checked===`indeterminate`?(0,z.jsx)(w,{className:`size-3.5`}):(0,z.jsx)(E,{className:`size-3.5`})})})}function Ie({...e}){return(0,z.jsx)(me,{"data-slot":`alert-dialog`,...e})}function Le({...e}){return(0,z.jsx)(he,{"data-slot":`alert-dialog-portal`,...e})}function $({className:e,...t}){return(0,z.jsx)(ge,{"data-slot":`alert-dialog-overlay`,className:o(`fixed inset-0 z-50 bg-overlay/50 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:animate-in data-[state=open]:fade-in-0`,e),...t})}function Re({className:e,size:t=`default`,onOpenAutoFocus:n,onCloseAutoFocus:r,...i}){let a=p(n,r);return(0,z.jsxs)(Le,{children:[(0,z.jsx)($,{}),(0,z.jsx)(_e,{"data-slot":`alert-dialog-content`,"data-size":t,className:o(`group/alert-dialog-content fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-xl border bg-card p-6 shadow-lg duration-200 data-[size=sm]:max-w-xs data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 data-[size=default]:sm:max-w-lg`,e),...i,...a})]})}function ze({className:e,...t}){return(0,z.jsx)(`div`,{"data-slot":`alert-dialog-header`,className:o(`grid grid-rows-[auto_1fr] place-items-center gap-1.5 text-center has-data-[slot=alert-dialog-media]:grid-rows-[auto_auto_1fr] has-data-[slot=alert-dialog-media]:gap-x-6 sm:group-data-[size=default]/alert-dialog-content:place-items-start sm:group-data-[size=default]/alert-dialog-content:text-left sm:group-data-[size=default]/alert-dialog-content:has-data-[slot=alert-dialog-media]:grid-rows-[auto_1fr]`,e),...t})}function Be({className:e,...t}){return(0,z.jsx)(`div`,{"data-slot":`alert-dialog-footer`,className:o(`flex flex-col-reverse gap-2 group-data-[size=sm]/alert-dialog-content:grid group-data-[size=sm]/alert-dialog-content:grid-cols-2 sm:flex-row sm:justify-end`,e),...t})}function Ve({className:e,...t}){return(0,z.jsx)(be,{"data-slot":`alert-dialog-title`,className:o(`text-lg font-semibold sm:group-data-[size=default]/alert-dialog-content:group-has-data-[slot=alert-dialog-media]/alert-dialog-content:col-start-2`,e),...t})}function He({className:e,...t}){return(0,z.jsx)(xe,{"data-slot":`alert-dialog-description`,className:o(`text-sm text-muted-foreground`,e),...t})}function Ue({className:e,variant:t=`default`,size:n=`default`,...r}){return(0,z.jsx)(M,{variant:t,size:n,asChild:!0,children:(0,z.jsx)(ve,{"data-slot":`alert-dialog-action`,className:o(e),...r})})}function We({className:e,variant:t=`outline`,size:n=`default`,...r}){return(0,z.jsx)(M,{variant:t,size:n,asChild:!0,children:(0,z.jsx)(ye,{"data-slot":`alert-dialog-cancel`,className:o(e),...r})})}var Ge=({open:e,onOpenChange:t,title:n,description:r,confirmLabel:o,cancelLabel:s,destructive:c=!1,onConfirm:l,acknowledgement:u,pending:d,pendingLabel:f,error:p})=>{let{t:m}=i(),h=(0,R.useId)(),[g,_]=(0,R.useState)(!1),[v,b]=(0,R.useState)(e);e!==v&&(b(e),e&&_(!1));let x=d!==void 0,C=d===!0,w=u!==void 0&&!g,T=O({variant:c?`destructive`:`default`});return(0,z.jsx)(Ie,{open:e,onOpenChange:e=>C&&!e?void 0:t(e),children:(0,z.jsxs)(Re,{children:[(0,z.jsxs)(ze,{children:[(0,z.jsx)(Ve,{children:n}),(0,z.jsx)(He,{children:r})]}),u?(0,z.jsxs)(S,{orientation:`horizontal`,children:[(0,z.jsx)(Q,{id:h,checked:g,disabled:C,onCheckedChange:e=>_(e===!0)}),(0,z.jsx)(y,{htmlFor:h,className:`font-normal`,children:u})]}):null,x?(0,z.jsx)(Z,{error:p}):null,(0,z.jsxs)(Be,{children:[(0,z.jsx)(We,{disabled:C,children:s??m(`common.cancel`)}),x?(0,z.jsx)(M,{type:`button`,variant:c?`destructive`:`default`,disabled:C||w,"aria-busy":C||void 0,onClick:l,children:C?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(a,{className:`animate-spin`,"aria-hidden":`true`}),f??o]}):o}):(0,z.jsx)(Ue,{className:T,disabled:w,onClick:l,children:o})]})]})})};export{Y as a,L as c,Z as i,Q as n,X as o,Fe as r,Pe as s,Ge as t};
|
|
2
|
+
//# sourceMappingURL=ConfirmDialog-B9nWhIIz.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ConfirmDialog-B9nWhIIz.js","names":["__defProp","__name","AlertDialog","DialogPrimitive.Root","DialogPrimitive.Trigger","AlertDialogPortal","DialogPrimitive.Portal","AlertDialogOverlay","DialogPrimitive.Overlay","AlertDialogContent","DialogPrimitive.Content","AlertDialogTitle","DialogPrimitive.Title","AlertDialogDescription","DialogPrimitive.Description","AlertDialogAction","DialogPrimitive.Close","AlertDialogCancel","Checkbox","Fragment","AlertCircle","useId","useRef","useState","_Fragment","Loader2","CheckboxPrimitive.Root","CheckboxPrimitive.Indicator","MinusIcon","CheckIcon","AlertDialogPrimitive.Root","AlertDialogPrimitive.Portal","AlertDialogPrimitive.Overlay","AlertDialogPrimitive.Content","AlertDialogPrimitive.Title","AlertDialogPrimitive.Description","AlertDialogPrimitive.Action","AlertDialogPrimitive.Cancel","useId","useState","_Fragment","Loader2","__toESM","require_jsx_runtime","createLucideIcon","useTranslation","LoaderCircle","cn","DialogOverlay","createDialogScope","DialogTrigger","DialogDescription","DialogTitle","DialogClose","useReturnFocus","DialogPortal","DialogContent","Dialog","useSize","PopoverTrigger","FieldLabel","PopoverContent","Popover","Field","PopoverAnchor","Minus","cva","Check","useComposedRefs","buttonVariants","Primitive","useControllableState","Presence","Button","describeError","composeEventHandlers","createContextScope","__iconData","CircleAlert","import_react","require_react","import_jsx_runtime","__defProp$1","__name$1","target","createAlertDialogContext","createAlertDialogScope","useDialogScope","AlertDialog$1","alertDialogProps","props","dialogScope","__scopeAlertDialog","triggerProps","forwardedRef","AlertDialogPortal$1","portalProps","AlertDialogOverlay$1","overlayProps","AlertDialogContentProvider","useAlertDialogContentContext","AlertDialogContent$1","contentProps","contentRef","composedRefs","cancelRef","event","AlertDialogTitle$1","titleProps","AlertDialogDescription$1","descriptionProps","AlertDialogAction$1","actionProps","CANCEL_NAME","AlertDialogCancel$1","cancelProps","ref","Root2","Portal2","Overlay2","Content2","Action","Cancel","Title2","Description2","__defProp","__name","CHECKBOX_NAME","createCheckboxContext","createCheckboxScope","CheckboxProviderImpl","useCheckboxContext","CheckboxProvider","checkedProp","checked","setChecked","defaultChecked","onCheckedChange","control","setControl","bubbleInput","setBubbleInput","hasConsumerStoppedPropagationRef","userInteractionCount","onUserInteraction","count","isFormControl","form","context","__scopeCheckbox","isFunction","internal_do_not_use_render","children","TRIGGER_NAME","CheckboxTrigger","checkboxProps","initialCheckedStateRef","reset","isIndeterminate","required","getState","disabled","onKeyDown","onClick","prevChecked","Checkbox$1","CheckboxBubbleInput","INDICATOR_NAME","CheckboxIndicator","indicatorProps","forceMount","BUBBLE_INPUT_NAME","controlSize","shouldStopClickPropagationRef","prevCheckedRef","prevUserInteractionCountRef","input","inputProto","isUserInteraction","checkedChanged","bubbles","defaultCheckedRef","value","alertVariants","Alert","className","AlertTitle","AlertDescription","FormError","error","InlineConfirm","titleId","descriptionId","confirmRef","uncontrolledOpen","setUncontrolledOpen","pending","setPending","setError","open","changeOpen","next","requestOpenChange","confirm","result","onConfirm","reason","returnFocus","tone","onCloseAutoFocus","description","title","cancelLabel","t","pendingLabel","confirmLabel","Checkbox","AlertDialog","AlertDialogPortal","AlertDialogOverlay","AlertDialogContent","onOpenAutoFocus","size","AlertDialogHeader","AlertDialogFooter","AlertDialogTitle","AlertDialogDescription","AlertDialogAction","AlertDialogCancel","ConfirmDialog","acknowledgementId","acknowledged","setAcknowledged","wasOpen","setWasOpen","isAsync","busy","blocked","acknowledgement","confirmClassName","destructive","onOpenChange"],"sources":["../../../../node_modules/.pnpm/lucide-react@1.49.0_@types+react@19.3.0_react@19.3.0/node_modules/lucide-react/dist/esm/icons/circle-alert.mjs","../../../../node_modules/.pnpm/@radix-ui+react-alert-dialog@1.1.23_@types+react-dom@19.3.0_@types+react@19.3.0__@types_490aa920fbab0adbc2c4344386ab6831/node_modules/@radix-ui/react-alert-dialog/dist/index.mjs","../../../../node_modules/.pnpm/@radix-ui+react-checkbox@1.3.11_@types+react-dom@19.3.0_@types+react@19.3.0__@types+rea_c6d869b9fcc94d95bd12a12175a8f53a/node_modules/@radix-ui/react-checkbox/dist/index.mjs","../../src/components/ui/alert.tsx","../../src/components/FormError/index.tsx","../../src/components/InlineConfirm/index.tsx","../../src/components/ui/checkbox.tsx","../../src/components/ui/alert-dialog.tsx","../../src/components/ConfirmDialog/index.tsx"],"sourcesContent":["/**\n * @license lucide-react v1.49.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconData = {\n name: \"circle-alert\",\n size: 24,\n node: [\n [\"circle\", { cx: \"12\", cy: \"12\", r: \"10\", key: \"1mglay\" }],\n [\"line\", { x1: \"12\", x2: \"12\", y1: \"8\", y2: \"12\", key: \"1pkeuh\" }],\n [\"line\", { x1: \"12\", x2: \"12.01\", y1: \"16\", y2: \"16\", key: \"4dfq90\" }]\n ],\n aliases: [\"alert-circle\"]\n};\n__iconData.node;\nconst CircleAlert = createLucideIcon(__iconData);\n\nexport { __iconData, CircleAlert as default };\n//# sourceMappingURL=circle-alert.mjs.map\n","\"use client\";\nvar __defProp = Object.defineProperty;\nvar __name = (target, value) => __defProp(target, \"name\", { value, configurable: true });\n\n// src/alert-dialog.tsx\nimport * as React from \"react\";\nimport { createContextScope } from \"@radix-ui/react-context\";\nimport { useComposedRefs } from \"@radix-ui/react-compose-refs\";\nimport * as DialogPrimitive from \"@radix-ui/react-dialog\";\nimport { createDialogScope } from \"@radix-ui/react-dialog\";\nimport { composeEventHandlers } from \"@radix-ui/primitive\";\nimport { jsx } from \"react/jsx-runtime\";\nvar ROOT_NAME = \"AlertDialog\";\nvar [createAlertDialogContext, createAlertDialogScope] = createContextScope(ROOT_NAME, [\n createDialogScope\n]);\nvar useDialogScope = createDialogScope();\nvar AlertDialog = /* @__PURE__ */ __name((props) => {\n const { __scopeAlertDialog, ...alertDialogProps } = props;\n const dialogScope = useDialogScope(__scopeAlertDialog);\n return /* @__PURE__ */ jsx(DialogPrimitive.Root, { ...dialogScope, ...alertDialogProps, modal: true });\n}, \"AlertDialog\");\nvar AlertDialogTrigger = React.forwardRef(\n /* @__PURE__ */ __name(function AlertDialogTrigger2(props, forwardedRef) {\n const { __scopeAlertDialog, ...triggerProps } = props;\n const dialogScope = useDialogScope(__scopeAlertDialog);\n return /* @__PURE__ */ jsx(DialogPrimitive.Trigger, { ...dialogScope, ...triggerProps, ref: forwardedRef });\n }, \"AlertDialogTrigger\")\n);\nvar AlertDialogPortal = /* @__PURE__ */ __name((props) => {\n const { __scopeAlertDialog, ...portalProps } = props;\n const dialogScope = useDialogScope(__scopeAlertDialog);\n return /* @__PURE__ */ jsx(DialogPrimitive.Portal, { ...dialogScope, ...portalProps });\n}, \"AlertDialogPortal\");\nvar AlertDialogOverlay = React.forwardRef(\n /* @__PURE__ */ __name(function AlertDialogOverlay2(props, forwardedRef) {\n const { __scopeAlertDialog, ...overlayProps } = props;\n const dialogScope = useDialogScope(__scopeAlertDialog);\n return /* @__PURE__ */ jsx(DialogPrimitive.Overlay, { ...dialogScope, ...overlayProps, ref: forwardedRef });\n }, \"AlertDialogOverlay\")\n);\nvar CONTENT_NAME = \"AlertDialogContent\";\nvar [AlertDialogContentProvider, useAlertDialogContentContext] = createAlertDialogContext(CONTENT_NAME);\nvar AlertDialogContent = React.forwardRef(\n /* @__PURE__ */ __name(function AlertDialogContent2(props, forwardedRef) {\n const { __scopeAlertDialog, children, ...contentProps } = props;\n const dialogScope = useDialogScope(__scopeAlertDialog);\n const contentRef = React.useRef(null);\n const composedRefs = useComposedRefs(forwardedRef, contentRef);\n const cancelRef = React.useRef(null);\n return /* @__PURE__ */ jsx(AlertDialogContentProvider, { scope: __scopeAlertDialog, cancelRef, children: /* @__PURE__ */ jsx(\n DialogPrimitive.Content,\n {\n role: \"alertdialog\",\n ...dialogScope,\n ...contentProps,\n ref: composedRefs,\n onOpenAutoFocus: composeEventHandlers(contentProps.onOpenAutoFocus, (event) => {\n event.preventDefault();\n cancelRef.current?.focus({ preventScroll: true });\n }),\n onPointerDownOutside: (event) => event.preventDefault(),\n onInteractOutside: (event) => event.preventDefault(),\n children\n }\n ) });\n }, \"AlertDialogContent\")\n);\nvar AlertDialogTitle = React.forwardRef(\n /* @__PURE__ */ __name(function AlertDialogTitle2(props, forwardedRef) {\n const { __scopeAlertDialog, ...titleProps } = props;\n const dialogScope = useDialogScope(__scopeAlertDialog);\n return /* @__PURE__ */ jsx(DialogPrimitive.Title, { ...dialogScope, ...titleProps, ref: forwardedRef });\n }, \"AlertDialogTitle\")\n);\nvar AlertDialogDescription = React.forwardRef(/* @__PURE__ */ __name(function AlertDialogDescription2(props, forwardedRef) {\n const { __scopeAlertDialog, ...descriptionProps } = props;\n const dialogScope = useDialogScope(__scopeAlertDialog);\n return /* @__PURE__ */ jsx(DialogPrimitive.Description, { ...dialogScope, ...descriptionProps, ref: forwardedRef });\n}, \"AlertDialogDescription\"));\nvar AlertDialogAction = React.forwardRef(\n /* @__PURE__ */ __name(function AlertDialogAction2(props, forwardedRef) {\n const { __scopeAlertDialog, ...actionProps } = props;\n const dialogScope = useDialogScope(__scopeAlertDialog);\n return /* @__PURE__ */ jsx(DialogPrimitive.Close, { ...dialogScope, ...actionProps, ref: forwardedRef });\n }, \"AlertDialogAction\")\n);\nvar CANCEL_NAME = \"AlertDialogCancel\";\nvar AlertDialogCancel = React.forwardRef(\n /* @__PURE__ */ __name(function AlertDialogCancel2(props, forwardedRef) {\n const { __scopeAlertDialog, ...cancelProps } = props;\n const { cancelRef } = useAlertDialogContentContext(CANCEL_NAME, __scopeAlertDialog);\n const dialogScope = useDialogScope(__scopeAlertDialog);\n const ref = useComposedRefs(forwardedRef, cancelRef);\n return /* @__PURE__ */ jsx(DialogPrimitive.Close, { ...dialogScope, ...cancelProps, ref });\n }, \"AlertDialogCancel\")\n);\nvar Root2 = AlertDialog;\nvar Trigger2 = AlertDialogTrigger;\nvar Portal2 = AlertDialogPortal;\nvar Overlay2 = AlertDialogOverlay;\nvar Content2 = AlertDialogContent;\nvar Action = AlertDialogAction;\nvar Cancel = AlertDialogCancel;\nvar Title2 = AlertDialogTitle;\nvar Description2 = AlertDialogDescription;\nexport {\n Action,\n AlertDialog,\n AlertDialogAction,\n AlertDialogCancel,\n AlertDialogContent,\n AlertDialogDescription,\n AlertDialogOverlay,\n AlertDialogPortal,\n AlertDialogTitle,\n AlertDialogTrigger,\n Cancel,\n Content2 as Content,\n Description2 as Description,\n Overlay2 as Overlay,\n Portal2 as Portal,\n Root2 as Root,\n Title2 as Title,\n Trigger2 as Trigger,\n createAlertDialogScope\n};\n//# sourceMappingURL=index.mjs.map\n","\"use client\";\nvar __defProp = Object.defineProperty;\nvar __name = (target, value) => __defProp(target, \"name\", { value, configurable: true });\n\n// src/checkbox.tsx\nimport * as React from \"react\";\nimport { useComposedRefs } from \"@radix-ui/react-compose-refs\";\nimport { createContextScope } from \"@radix-ui/react-context\";\nimport { composeEventHandlers } from \"@radix-ui/primitive\";\nimport { useControllableState } from \"@radix-ui/react-use-controllable-state\";\nimport { useSize } from \"@radix-ui/react-use-size\";\nimport { Presence } from \"@radix-ui/react-presence\";\nimport { Primitive } from \"@radix-ui/react-primitive\";\nimport { Fragment, jsx, jsxs } from \"react/jsx-runtime\";\nvar CHECKBOX_NAME = \"Checkbox\";\nvar [createCheckboxContext, createCheckboxScope] = createContextScope(CHECKBOX_NAME);\nvar [CheckboxProviderImpl, useCheckboxContext] = createCheckboxContext(CHECKBOX_NAME);\nfunction CheckboxProvider(props) {\n const {\n __scopeCheckbox,\n checked: checkedProp,\n children,\n defaultChecked,\n disabled,\n form,\n name,\n onCheckedChange,\n required,\n value = \"on\",\n // @ts-expect-error\n internal_do_not_use_render\n } = props;\n const [checked, setChecked] = useControllableState({\n prop: checkedProp,\n defaultProp: defaultChecked ?? false,\n onChange: onCheckedChange,\n caller: CHECKBOX_NAME\n });\n const [control, setControl] = React.useState(null);\n const [bubbleInput, setBubbleInput] = React.useState(null);\n const hasConsumerStoppedPropagationRef = React.useRef(false);\n const [userInteractionCount, onUserInteraction] = React.useReducer(\n (count) => count + 1,\n 0\n );\n const isFormControl = control ? !!form || !!control.closest(\"form\") : (\n // We set this to true by default so that events bubble to forms without JS (SSR)\n true\n );\n const context = {\n checked,\n disabled,\n setChecked,\n control,\n setControl,\n name,\n form,\n value,\n hasConsumerStoppedPropagationRef,\n userInteractionCount,\n onUserInteraction,\n required,\n defaultChecked: isIndeterminate(defaultChecked) ? false : defaultChecked,\n isFormControl,\n bubbleInput,\n setBubbleInput\n };\n return /* @__PURE__ */ jsx(\n CheckboxProviderImpl,\n {\n scope: __scopeCheckbox,\n ...context,\n children: isFunction(internal_do_not_use_render) ? internal_do_not_use_render(context) : children\n }\n );\n}\n__name(CheckboxProvider, \"CheckboxProvider\");\nvar TRIGGER_NAME = \"CheckboxTrigger\";\nvar CheckboxTrigger = /* @__PURE__ */ React.forwardRef(\n /* @__PURE__ */ __name(function CheckboxTrigger2({ __scopeCheckbox, onKeyDown, onClick, ...checkboxProps }, forwardedRef) {\n const {\n control,\n value,\n disabled,\n checked,\n required,\n setControl,\n setChecked,\n hasConsumerStoppedPropagationRef,\n onUserInteraction,\n isFormControl,\n bubbleInput\n } = useCheckboxContext(TRIGGER_NAME, __scopeCheckbox);\n const composedRefs = useComposedRefs(forwardedRef, setControl);\n const initialCheckedStateRef = React.useRef(checked);\n React.useEffect(() => {\n const form = control?.form;\n if (form) {\n const reset = /* @__PURE__ */ __name(() => setChecked(initialCheckedStateRef.current), \"reset\");\n form.addEventListener(\"reset\", reset);\n return () => form.removeEventListener(\"reset\", reset);\n }\n }, [control, setChecked]);\n return /* @__PURE__ */ jsx(\n Primitive.button,\n {\n type: \"button\",\n role: \"checkbox\",\n \"aria-checked\": isIndeterminate(checked) ? \"mixed\" : checked,\n \"aria-required\": required,\n \"data-state\": getState(checked),\n \"data-disabled\": disabled ? \"\" : void 0,\n disabled,\n value,\n ...checkboxProps,\n ref: composedRefs,\n onKeyDown: composeEventHandlers(onKeyDown, (event) => {\n if (event.key === \"Enter\") event.preventDefault();\n }),\n onClick: composeEventHandlers(onClick, (event) => {\n onUserInteraction();\n setChecked((prevChecked) => isIndeterminate(prevChecked) ? true : !prevChecked);\n if (bubbleInput && isFormControl) {\n hasConsumerStoppedPropagationRef.current = event.isPropagationStopped();\n if (!hasConsumerStoppedPropagationRef.current) event.stopPropagation();\n }\n })\n }\n );\n }, \"CheckboxTrigger\")\n);\nvar Checkbox = /* @__PURE__ */ React.forwardRef(\n // blank line to reduce diff noise\n /* @__PURE__ */ __name(function Checkbox2(props, forwardedRef) {\n const {\n __scopeCheckbox,\n name,\n checked,\n defaultChecked,\n required,\n disabled,\n value,\n onCheckedChange,\n form,\n ...checkboxProps\n } = props;\n return /* @__PURE__ */ jsx(\n CheckboxProvider,\n {\n __scopeCheckbox,\n checked,\n defaultChecked,\n disabled,\n required,\n onCheckedChange,\n name,\n form,\n value,\n internal_do_not_use_render: ({ isFormControl }) => /* @__PURE__ */ jsxs(Fragment, { children: [\n /* @__PURE__ */ jsx(\n CheckboxTrigger,\n {\n ...checkboxProps,\n ref: forwardedRef,\n __scopeCheckbox\n }\n ),\n isFormControl && /* @__PURE__ */ jsx(\n CheckboxBubbleInput,\n {\n __scopeCheckbox\n }\n )\n ] })\n }\n );\n }, \"Checkbox\")\n);\nvar INDICATOR_NAME = \"CheckboxIndicator\";\nvar CheckboxIndicator = /* @__PURE__ */ React.forwardRef(\n // blank line to reduce diff noise\n /* @__PURE__ */ __name(function CheckboxIndicator2(props, forwardedRef) {\n const { __scopeCheckbox, forceMount, ...indicatorProps } = props;\n const context = useCheckboxContext(INDICATOR_NAME, __scopeCheckbox);\n return /* @__PURE__ */ jsx(\n Presence,\n {\n present: forceMount || isIndeterminate(context.checked) || context.checked === true,\n children: /* @__PURE__ */ jsx(\n Primitive.span,\n {\n \"data-state\": getState(context.checked),\n \"data-disabled\": context.disabled ? \"\" : void 0,\n ...indicatorProps,\n ref: forwardedRef,\n style: { pointerEvents: \"none\", ...props.style }\n }\n )\n }\n );\n }, \"CheckboxIndicator\")\n);\nvar BUBBLE_INPUT_NAME = \"CheckboxBubbleInput\";\nvar CheckboxBubbleInput = /* @__PURE__ */ React.forwardRef(\n // blank line to reduce diff noise\n /* @__PURE__ */ __name(function CheckboxBubbleInput2({ __scopeCheckbox, onClick, ...props }, forwardedRef) {\n const {\n control,\n hasConsumerStoppedPropagationRef,\n userInteractionCount,\n checked,\n defaultChecked,\n required,\n disabled,\n name,\n value,\n form,\n bubbleInput,\n setBubbleInput\n } = useCheckboxContext(BUBBLE_INPUT_NAME, __scopeCheckbox);\n const composedRefs = useComposedRefs(forwardedRef, setBubbleInput);\n const controlSize = useSize(control);\n const shouldStopClickPropagationRef = React.useRef(false);\n const prevCheckedRef = React.useRef(checked);\n const prevUserInteractionCountRef = React.useRef(userInteractionCount);\n React.useEffect(() => {\n const input = bubbleInput;\n if (!input) return;\n const inputProto = window.HTMLInputElement.prototype;\n const descriptor = Object.getOwnPropertyDescriptor(\n inputProto,\n \"checked\"\n );\n const setChecked = descriptor.set;\n const isUserInteraction = userInteractionCount !== prevUserInteractionCountRef.current;\n prevUserInteractionCountRef.current = userInteractionCount;\n const checkedChanged = prevCheckedRef.current !== checked;\n prevCheckedRef.current = checked;\n const bubbles = !(isUserInteraction && hasConsumerStoppedPropagationRef.current);\n if (checkedChanged && setChecked) {\n shouldStopClickPropagationRef.current = !isUserInteraction;\n const event = new Event(\"click\", { bubbles });\n input.indeterminate = isIndeterminate(checked);\n setChecked.call(input, isIndeterminate(checked) ? false : checked);\n input.dispatchEvent(event);\n shouldStopClickPropagationRef.current = false;\n }\n }, [bubbleInput, checked, hasConsumerStoppedPropagationRef, userInteractionCount]);\n const defaultCheckedRef = React.useRef(isIndeterminate(checked) ? false : checked);\n return /* @__PURE__ */ jsx(\n Primitive.input,\n {\n type: \"checkbox\",\n \"aria-hidden\": true,\n defaultChecked: defaultChecked ?? defaultCheckedRef.current,\n required,\n disabled,\n name,\n value,\n form,\n ...props,\n tabIndex: -1,\n ref: composedRefs,\n onClick: composeEventHandlers(onClick, (event) => {\n if (shouldStopClickPropagationRef.current) {\n event.stopPropagation();\n }\n }),\n style: {\n ...props.style,\n ...controlSize,\n position: \"absolute\",\n pointerEvents: \"none\",\n opacity: 0,\n margin: 0,\n // We transform because the input is absolutely positioned but we have\n // rendered it **after** the button. This pulls it back to sit on top\n // of the button.\n transform: \"translateX(-100%)\"\n }\n }\n );\n }, \"CheckboxBubbleInput\")\n);\nfunction isFunction(value) {\n return typeof value === \"function\";\n}\n__name(isFunction, \"isFunction\");\nfunction isIndeterminate(checked) {\n return checked === \"indeterminate\";\n}\n__name(isIndeterminate, \"isIndeterminate\");\nfunction getState(checked) {\n return isIndeterminate(checked) ? \"indeterminate\" : checked ? \"checked\" : \"unchecked\";\n}\n__name(getState, \"getState\");\nexport {\n Checkbox,\n CheckboxIndicator,\n CheckboxIndicator as Indicator,\n Checkbox as Root,\n createCheckboxScope,\n CheckboxBubbleInput as unstable_BubbleInput,\n CheckboxBubbleInput as unstable_CheckboxBubbleInput,\n CheckboxProvider as unstable_CheckboxProvider,\n CheckboxTrigger as unstable_CheckboxTrigger,\n CheckboxProvider as unstable_Provider,\n CheckboxTrigger as unstable_Trigger\n};\n//# sourceMappingURL=index.mjs.map\n","import { cva, type VariantProps } from 'class-variance-authority';\nimport * as React from 'react';\nimport { cn } from '@/helpers/cn';\n\nconst alertVariants = cva(\n 'relative grid w-full grid-cols-[0_1fr] items-start gap-y-0.5 rounded-lg border px-4 py-3 text-sm has-[>svg]:grid-cols-[calc(var(--spacing)*4)_1fr] has-[>svg]:gap-x-3 [&>svg]:size-4 [&>svg]:translate-y-0.5 [&>svg]:text-current',\n {\n variants: {\n variant: {\n default: 'bg-card text-card-foreground',\n destructive:\n 'border-destructive/30 bg-destructive-muted text-destructive *:data-[slot=alert-description]:text-destructive [&>svg]:text-current',\n // Shapio: status alerts on the status tokens (DESIGN.md).\n warning:\n 'border-warning/30 bg-warning-muted text-warning *:data-[slot=alert-description]:text-warning [&>svg]:text-current',\n // Light: a neutral note with a cobalt icon (no blue surfaces outside the info chip); dark keeps the tint.\n info: 'border-border bg-muted text-foreground *:data-[slot=alert-description]:text-muted-foreground dark:border-info/30 dark:bg-info-muted dark:text-info dark:*:data-[slot=alert-description]:text-info [&>svg]:text-info',\n success:\n 'border-success/30 bg-success-muted text-success *:data-[slot=alert-description]:text-success [&>svg]:text-current',\n },\n },\n defaultVariants: {\n variant: 'default',\n },\n },\n);\n\nfunction Alert({\n className,\n variant,\n ...props\n}: React.ComponentProps<'div'> & VariantProps<typeof alertVariants>) {\n return (\n <div data-slot=\"alert\" role=\"alert\" className={cn(alertVariants({ variant }), className)} {...props} />\n );\n}\n\nfunction AlertTitle({ className, ...props }: React.ComponentProps<'div'>) {\n return (\n <div\n data-slot=\"alert-title\"\n className={cn('col-start-2 line-clamp-1 min-h-4 font-medium tracking-tight', className)}\n {...props}\n />\n );\n}\n\nfunction AlertDescription({ className, ...props }: React.ComponentProps<'div'>) {\n return (\n <div\n data-slot=\"alert-description\"\n className={cn(\n 'col-start-2 grid justify-items-start gap-1 text-sm text-muted-foreground [&_p]:leading-relaxed',\n className,\n )}\n {...props}\n />\n );\n}\n\nexport { Alert, AlertTitle, AlertDescription };\n","import { AlertCircle } from 'lucide-react';\nimport { Alert, AlertDescription } from '@/components/ui/alert';\nimport { describeError } from '@/helpers/describeError';\n\ntype FormErrorProps = { error: unknown };\n\n/** The server's answer to a failed form submission, shown above the submit button and announced. */\nexport const FormError = ({ error }: FormErrorProps) => {\n if (!error) {\n return null;\n }\n return (\n <Alert variant=\"destructive\">\n <AlertCircle aria-hidden=\"true\" />\n <AlertDescription>{describeError(error)}</AlertDescription>\n </Alert>\n );\n};\n","import { Loader2 } from 'lucide-react';\nimport { useId, useRef, useState, type ReactElement } from 'react';\nimport { useTranslation } from 'react-i18next';\nimport { Button } from '@/components/ui/button';\nimport { Popover, PopoverAnchor, PopoverContent, PopoverTrigger } from '@/components/ui/popover';\nimport { useReturnFocus } from '@/hooks/useReturnFocus';\nimport { FormError } from '../FormError';\n\ntype InlineConfirmCommonProps = {\n /** The question, and the popover's accessible name (\"Delete “Hero”?\"). */\n title: string;\n /** The consequence, in one line. */\n description?: string;\n confirmLabel: string;\n cancelLabel?: string;\n /** Shown on Confirm while an async `onConfirm` runs. */\n pendingLabel?: string;\n /** `danger`: red Confirm, focus starts on Cancel. `default`: primary Confirm, focus starts on it. */\n tone: 'danger' | 'default';\n /**\n * Runs on Confirm. Return nothing to close at once; return a promise (`mutateAsync`) to keep the popover\n * open with a spinner until it settles: it closes when it resolves and shows the error when it rejects.\n */\n onConfirm: () => void | Promise<unknown>;\n align?: 'start' | 'center' | 'end';\n side?: 'top' | 'right' | 'bottom' | 'left';\n /**\n * Runs as the popover closes, before focus returns to the opener. Call `event.preventDefault()` to keep\n * focus where it is (e.g. on a `SecretReveal` that a confirmed rotate just showed).\n */\n onCloseAutoFocus?: (event: Event) => void;\n};\n\n/** Trigger mode: the popover opens from this button (it gets `aria-expanded` and returns focus to it). */\ntype TriggerModeProps = InlineConfirmCommonProps & {\n trigger: ReactElement;\n open?: never;\n onOpenChange?: never;\n children?: never;\n};\n\n/**\n * Anchored mode, for actions in a menu (a menu item disappears with its menu): the caller opens it (from\n * the item's `onSelect`) and the popover points at `children`, usually the menu's own trigger button.\n */\ntype AnchoredModeProps = InlineConfirmCommonProps & {\n trigger?: never;\n open: boolean;\n onOpenChange: (open: boolean) => void;\n children: ReactElement;\n};\n\ntype InlineConfirmProps = TriggerModeProps | AnchoredModeProps;\n\n/**\n * Confirms a routine destructive or consequential action where it was asked for (DESIGN.md \"Dialogs\"): a\n * modal popover with role `alertdialog`, the question, one line of consequence and Cancel / Confirm. Escape\n * or a click outside cancels, Enter activates the focused button, focus returns to the opener.\n */\nexport const InlineConfirm = (props: InlineConfirmProps) => {\n const {\n title,\n description,\n confirmLabel,\n cancelLabel,\n pendingLabel,\n tone,\n onConfirm,\n align = 'end',\n side = 'bottom',\n onCloseAutoFocus,\n } = props;\n const { t } = useTranslation();\n const titleId = useId();\n const descriptionId = useId();\n const cancelRef = useRef<HTMLButtonElement>(null);\n const confirmRef = useRef<HTMLButtonElement>(null);\n const [uncontrolledOpen, setUncontrolledOpen] = useState(false);\n const [pending, setPending] = useState(false);\n const [error, setError] = useState<unknown>(null);\n const open = props.trigger === undefined ? props.open : uncontrolledOpen;\n\n const changeOpen = (next: boolean) => {\n if (next) {\n setError(null);\n }\n if (props.trigger === undefined) {\n props.onOpenChange(next);\n } else {\n setUncontrolledOpen(next);\n }\n };\n // Nothing dismisses it while the action runs.\n const requestOpenChange = (next: boolean) => (pending && !next ? undefined : changeOpen(next));\n\n const confirm = () => {\n const result = onConfirm();\n if (!(result instanceof Promise)) {\n changeOpen(false);\n return;\n }\n setPending(true);\n setError(null);\n result.then(\n () => {\n setPending(false);\n changeOpen(false);\n },\n (reason: unknown) => {\n // Already logged and toasted by the mutation cache; shown here too, beside the action that failed.\n setPending(false);\n setError(reason);\n },\n );\n };\n\n const returnFocus = useReturnFocus((event) => {\n event.preventDefault();\n (tone === 'danger' ? cancelRef : confirmRef).current?.focus();\n }, onCloseAutoFocus);\n\n return (\n <Popover open={open} onOpenChange={requestOpenChange} modal>\n {props.trigger === undefined ? (\n <PopoverAnchor asChild>{props.children}</PopoverAnchor>\n ) : (\n <PopoverTrigger asChild>{props.trigger}</PopoverTrigger>\n )}\n <PopoverContent\n role=\"alertdialog\"\n // Modal like Radix's own dialogs: focus is trapped and the rest of the page is aria-hidden. Declaring\n // it lets assistive technology (and axe's aria-hidden-focus rule) know the hidden page is inert.\n aria-modal=\"true\"\n aria-labelledby={titleId}\n aria-describedby={description ? descriptionId : undefined}\n align={align}\n side={side}\n className=\"w-80 space-y-4\"\n {...returnFocus}\n >\n <div className=\"space-y-1\">\n <p id={titleId} className=\"text-sm font-semibold\">\n {title}\n </p>\n {description ? (\n <p id={descriptionId} className=\"text-meta text-muted-foreground\">\n {description}\n </p>\n ) : null}\n </div>\n <FormError error={error} />\n <div className=\"flex justify-end gap-2\">\n <Button\n ref={cancelRef}\n type=\"button\"\n size=\"sm\"\n variant=\"outline\"\n disabled={pending}\n onClick={() => changeOpen(false)}\n >\n {cancelLabel ?? t('common.cancel')}\n </Button>\n <Button\n ref={confirmRef}\n type=\"button\"\n size=\"sm\"\n variant={tone === 'danger' ? 'destructive' : 'default'}\n disabled={pending}\n aria-busy={pending || undefined}\n onClick={confirm}\n >\n {pending ? (\n <>\n <Loader2 className=\"animate-spin\" aria-hidden=\"true\" />\n {pendingLabel ?? confirmLabel}\n </>\n ) : (\n confirmLabel\n )}\n </Button>\n </div>\n </PopoverContent>\n </Popover>\n );\n};\n","import { CheckIcon, MinusIcon } from 'lucide-react';\nimport { Checkbox as CheckboxPrimitive } from 'radix-ui';\nimport * as React from 'react';\nimport { cn } from '@/helpers/cn';\n\nfunction Checkbox({ className, ...props }: React.ComponentProps<typeof CheckboxPrimitive.Root>) {\n return (\n <CheckboxPrimitive.Root\n data-slot=\"checkbox\"\n className={cn(\n 'peer size-4 shrink-0 rounded-[4px] border border-input shadow-xs transition-shadow outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 data-[state=checked]:border-primary data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground data-[state=indeterminate]:border-primary data-[state=indeterminate]:bg-primary data-[state=indeterminate]:text-primary-foreground dark:bg-input/30 dark:aria-invalid:ring-destructive/40 dark:data-[state=checked]:bg-primary dark:data-[state=indeterminate]:bg-primary',\n className,\n )}\n {...props}\n >\n <CheckboxPrimitive.Indicator\n data-slot=\"checkbox-indicator\"\n className=\"grid place-content-center text-current transition-none\"\n >\n {props.checked === 'indeterminate' ? (\n <MinusIcon className=\"size-3.5\" />\n ) : (\n <CheckIcon className=\"size-3.5\" />\n )}\n </CheckboxPrimitive.Indicator>\n </CheckboxPrimitive.Root>\n );\n}\n\nexport { Checkbox };\n","'use client';\n\nimport { AlertDialog as AlertDialogPrimitive } from 'radix-ui';\nimport * as React from 'react';\nimport { Button } from '@/components/ui/button';\nimport { cn } from '@/helpers/cn';\nimport { useReturnFocus } from '@/hooks/useReturnFocus';\n\nfunction AlertDialog({ ...props }: React.ComponentProps<typeof AlertDialogPrimitive.Root>) {\n return <AlertDialogPrimitive.Root data-slot=\"alert-dialog\" {...props} />;\n}\n\nfunction AlertDialogTrigger({ ...props }: React.ComponentProps<typeof AlertDialogPrimitive.Trigger>) {\n return <AlertDialogPrimitive.Trigger data-slot=\"alert-dialog-trigger\" {...props} />;\n}\n\nfunction AlertDialogPortal({ ...props }: React.ComponentProps<typeof AlertDialogPrimitive.Portal>) {\n return <AlertDialogPrimitive.Portal data-slot=\"alert-dialog-portal\" {...props} />;\n}\n\nfunction AlertDialogOverlay({\n className,\n ...props\n}: React.ComponentProps<typeof AlertDialogPrimitive.Overlay>) {\n return (\n <AlertDialogPrimitive.Overlay\n data-slot=\"alert-dialog-overlay\"\n className={cn(\n 'fixed inset-0 z-50 bg-overlay/50 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:animate-in data-[state=open]:fade-in-0',\n className,\n )}\n {...props}\n />\n );\n}\n\nfunction AlertDialogContent({\n className,\n size = 'default',\n onOpenAutoFocus,\n onCloseAutoFocus,\n ...props\n}: React.ComponentProps<typeof AlertDialogPrimitive.Content> & {\n size?: 'default' | 'sm';\n}) {\n const returnFocus = useReturnFocus(onOpenAutoFocus, onCloseAutoFocus);\n return (\n <AlertDialogPortal>\n <AlertDialogOverlay />\n <AlertDialogPrimitive.Content\n data-slot=\"alert-dialog-content\"\n data-size={size}\n className={cn(\n 'group/alert-dialog-content fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-xl border bg-card p-6 shadow-lg duration-200 data-[size=sm]:max-w-xs data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 data-[size=default]:sm:max-w-lg',\n className,\n )}\n {...props}\n {...returnFocus}\n />\n </AlertDialogPortal>\n );\n}\n\nfunction AlertDialogHeader({ className, ...props }: React.ComponentProps<'div'>) {\n return (\n <div\n data-slot=\"alert-dialog-header\"\n className={cn(\n 'grid grid-rows-[auto_1fr] place-items-center gap-1.5 text-center has-data-[slot=alert-dialog-media]:grid-rows-[auto_auto_1fr] has-data-[slot=alert-dialog-media]:gap-x-6 sm:group-data-[size=default]/alert-dialog-content:place-items-start sm:group-data-[size=default]/alert-dialog-content:text-left sm:group-data-[size=default]/alert-dialog-content:has-data-[slot=alert-dialog-media]:grid-rows-[auto_1fr]',\n className,\n )}\n {...props}\n />\n );\n}\n\nfunction AlertDialogFooter({ className, ...props }: React.ComponentProps<'div'>) {\n return (\n <div\n data-slot=\"alert-dialog-footer\"\n className={cn(\n 'flex flex-col-reverse gap-2 group-data-[size=sm]/alert-dialog-content:grid group-data-[size=sm]/alert-dialog-content:grid-cols-2 sm:flex-row sm:justify-end',\n className,\n )}\n {...props}\n />\n );\n}\n\nfunction AlertDialogTitle({ className, ...props }: React.ComponentProps<typeof AlertDialogPrimitive.Title>) {\n return (\n <AlertDialogPrimitive.Title\n data-slot=\"alert-dialog-title\"\n className={cn(\n 'text-lg font-semibold sm:group-data-[size=default]/alert-dialog-content:group-has-data-[slot=alert-dialog-media]/alert-dialog-content:col-start-2',\n className,\n )}\n {...props}\n />\n );\n}\n\nfunction AlertDialogDescription({\n className,\n ...props\n}: React.ComponentProps<typeof AlertDialogPrimitive.Description>) {\n return (\n <AlertDialogPrimitive.Description\n data-slot=\"alert-dialog-description\"\n className={cn('text-sm text-muted-foreground', className)}\n {...props}\n />\n );\n}\n\nfunction AlertDialogMedia({ className, ...props }: React.ComponentProps<'div'>) {\n return (\n <div\n data-slot=\"alert-dialog-media\"\n className={cn(\n \"mb-2 inline-flex size-16 items-center justify-center rounded-md bg-muted sm:group-data-[size=default]/alert-dialog-content:row-span-2 *:[svg:not([class*='size-'])]:size-8\",\n className,\n )}\n {...props}\n />\n );\n}\n\nfunction AlertDialogAction({\n className,\n variant = 'default',\n size = 'default',\n ...props\n}: React.ComponentProps<typeof AlertDialogPrimitive.Action> &\n Pick<React.ComponentProps<typeof Button>, 'variant' | 'size'>) {\n return (\n <Button variant={variant} size={size} asChild>\n <AlertDialogPrimitive.Action data-slot=\"alert-dialog-action\" className={cn(className)} {...props} />\n </Button>\n );\n}\n\nfunction AlertDialogCancel({\n className,\n variant = 'outline',\n size = 'default',\n ...props\n}: React.ComponentProps<typeof AlertDialogPrimitive.Cancel> &\n Pick<React.ComponentProps<typeof Button>, 'variant' | 'size'>) {\n return (\n <Button variant={variant} size={size} asChild>\n <AlertDialogPrimitive.Cancel data-slot=\"alert-dialog-cancel\" className={cn(className)} {...props} />\n </Button>\n );\n}\n\nexport {\n AlertDialog,\n AlertDialogAction,\n AlertDialogCancel,\n AlertDialogContent,\n AlertDialogDescription,\n AlertDialogFooter,\n AlertDialogHeader,\n AlertDialogMedia,\n AlertDialogOverlay,\n AlertDialogPortal,\n AlertDialogTitle,\n AlertDialogTrigger,\n};\n","import { Loader2 } from 'lucide-react';\nimport { useId, useState } from 'react';\nimport { useTranslation } from 'react-i18next';\nimport {\n AlertDialog,\n AlertDialogAction,\n AlertDialogCancel,\n AlertDialogContent,\n AlertDialogDescription,\n AlertDialogFooter,\n AlertDialogHeader,\n AlertDialogTitle,\n} from '@/components/ui/alert-dialog';\nimport { Button, buttonVariants } from '@/components/ui/button';\nimport { Checkbox } from '@/components/ui/checkbox';\nimport { Field, FieldLabel } from '@/components/ui/field';\nimport { FormError } from '../FormError';\n\ntype ConfirmDialogProps = {\n open: boolean;\n onOpenChange: (open: boolean) => void;\n title: string;\n description: string;\n confirmLabel: string;\n cancelLabel?: string;\n destructive?: boolean;\n onConfirm: () => void;\n /** When set, Confirm stays disabled until this statement is checked (unticked on every open). */\n acknowledgement?: string;\n /**\n * Async mode: pass the mutation's pending state. Confirm then doesn't close the dialog; the caller closes\n * it on success. While pending, Confirm shows `pendingLabel` and the dialog can't be dismissed.\n */\n pending?: boolean;\n pendingLabel?: string;\n /** The failed attempt's error, shown above the buttons (async mode). */\n error?: unknown;\n};\n\n/**\n * A blocking yes/no question, kept only for irreversible acknowledgements (DESIGN.md \"Dialogs\"). Focus starts\n * on Cancel (Radix default).\n */\nexport const ConfirmDialog = ({\n open,\n onOpenChange,\n title,\n description,\n confirmLabel,\n cancelLabel,\n destructive = false,\n onConfirm,\n acknowledgement,\n pending,\n pendingLabel,\n error,\n}: ConfirmDialogProps) => {\n const { t } = useTranslation();\n const acknowledgementId = useId();\n const [acknowledged, setAcknowledged] = useState(false);\n const [wasOpen, setWasOpen] = useState(open);\n if (open !== wasOpen) {\n setWasOpen(open);\n if (open) {\n setAcknowledged(false);\n }\n }\n const isAsync = pending !== undefined;\n const busy = pending === true;\n const blocked = acknowledgement !== undefined && !acknowledged;\n const confirmClassName = buttonVariants({ variant: destructive ? 'destructive' : 'default' });\n return (\n <AlertDialog open={open} onOpenChange={(next) => (busy && !next ? undefined : onOpenChange(next))}>\n <AlertDialogContent>\n <AlertDialogHeader>\n <AlertDialogTitle>{title}</AlertDialogTitle>\n <AlertDialogDescription>{description}</AlertDialogDescription>\n </AlertDialogHeader>\n {acknowledgement ? (\n <Field orientation=\"horizontal\">\n <Checkbox\n id={acknowledgementId}\n checked={acknowledged}\n disabled={busy}\n onCheckedChange={(checked) => setAcknowledged(checked === true)}\n />\n <FieldLabel htmlFor={acknowledgementId} className=\"font-normal\">\n {acknowledgement}\n </FieldLabel>\n </Field>\n ) : null}\n {isAsync ? <FormError error={error} /> : null}\n <AlertDialogFooter>\n <AlertDialogCancel disabled={busy}>{cancelLabel ?? t('common.cancel')}</AlertDialogCancel>\n {isAsync ? (\n <Button\n type=\"button\"\n variant={destructive ? 'destructive' : 'default'}\n disabled={busy || blocked}\n aria-busy={busy || undefined}\n onClick={onConfirm}\n >\n {busy ? (\n <>\n <Loader2 className=\"animate-spin\" aria-hidden=\"true\" />\n {pendingLabel ?? confirmLabel}\n </>\n ) : (\n confirmLabel\n )}\n </Button>\n ) : (\n <AlertDialogAction className={confirmClassName} disabled={blocked} onClick={onConfirm}>\n {confirmLabel}\n </AlertDialogAction>\n )}\n </AlertDialogFooter>\n </AlertDialogContent>\n </AlertDialog>\n );\n};\n"],"ignoreList":[0,1,2],"mappings":"kfASA,IAAM6E,EAAa,CACjB,KAAM,eACN,KAAM,GACN,KAAM,CACJ,CAAC,SAAU,CAAE,GAAI,KAAM,GAAI,KAAM,EAAG,KAAM,IAAK,QAAS,CAAC,EACzD,CAAC,OAAQ,CAAE,GAAI,KAAM,GAAI,KAAM,GAAI,IAAK,GAAI,KAAM,IAAK,QAAS,CAAC,EACjE,CAAC,OAAQ,CAAE,GAAI,KAAM,GAAI,QAAS,GAAI,KAAM,GAAI,KAAM,IAAK,QAAS,CAAC,CACvE,EACA,QAAS,CAAC,cAAc,CAC1B,EACAA,EAAW,KACX,IAAMC,EAAclC,EAAiBiC,CAAU,wBCnB3C7E,GAAY,OAAO,eACnBC,GAAU,EAAQ,IAAUD,GAAUoF,EAAQ,OAAQ,CAAE,QAAO,aAAc,EAAK,CAAC,EAWnF,CAACC,GAA0BC,IAA0BV,EAAmB,cAAW,CACrF3B,CACF,CAAC,EACGsC,EAAiBtC,EAAkB,EACnC/C,GAA8BiF,EAAQ,GAAU,CAClD,GAAM,CAAE,qBAAoB,GAAGM,GAAqBC,EAC9CC,EAAcJ,EAAeK,CAAkB,EACrD,OAAuB,EAAAX,EAAA,IAAA,CAAI9E,EAAsB,CAAE,GAAGwF,EAAa,GAAGF,EAAkB,MAAO,EAAK,CAAC,CACvG,EAAG,aAAa,EACZV,EAA2B,WACbI,EAAO,SAA6B,EAAO,EAAc,CACvE,GAAM,CAAE,qBAAoB,GAAGU,GAAiBH,EAC1CC,EAAcJ,EAAeK,CAAkB,EACrD,OAAuB,EAAAX,EAAA,IAAA,CAAI7E,EAAyB,CAAE,GAAG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mB,SAAUQ,EAAO,SAAAxB,GAAeC,EAAE,eAAe,CAAqB,CAAA,EACxFsB,GACC,EAAA1J,EAAA,IAAA,CAACR,EAAD,CACE,KAAK,SACL,QAASuK,EAAc,cAAgB,UACvC,SAAUJ,GAAQC,EAClB,YAAWD,GAAQ,IAAA,GACnB,QAAS/B,EAER,SAAA+B,GACC,EAAA3J,EAAA,KAAA,CAAAzC,EAAAA,SAAA,CAAA,SAAA,EACE,EAAAyC,EAAA,IAAA,CAACxC,EAAD,CAAS,UAAU,eAAe,cAAY,MAAQ,CAAA,EACrD6K,GAAgBC,CACjB,CAAA,CAAA,EAEFA,CAEI,CAAA,GAER,EAAAtI,EAAA,IAAA,CAACkJ,GAAD,CAAmB,UAAWY,EAAkB,SAAUF,EAAS,QAAShC,EACzE,SAAAU,CACgB,CAAA,CAEJ,CAAA,CAAA,CACD,CAAA,CAAA,CACT,CAAA,CAEjB"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{t}from"./react-CQOZoUwg.js";import{t as n}from"./jsx-runtime-DREnUpxT.js";import{j as r}from"./cn-BQ3voEft.js";import{U as i}from"./InfoHint-GJLRVumb.js";import{O as a,i as o}from"./skeleton-C3QLIh7W.js";import{t as s}from"./copy-BDc3r0fO.js";var c=e(t(),1),l=e(n(),1),u=2e3,d=({value:e,ref:t})=>{let{t:n}=r(),[d,f]=(0,c.useState)(!1),p=async()=>{try{await navigator.clipboard.writeText(e),f(!0),setTimeout(()=>f(!1),u)}catch(e){i(e,`copy to clipboard`)}};return(0,l.jsxs)(o,{ref:t,type:`button`,variant:`outline`,onClick:()=>void p(),children:[d?(0,l.jsx)(a,{"aria-hidden":`true`}):(0,l.jsx)(s,{"aria-hidden":`true`}),(0,l.jsx)(`span`,{"aria-live":`polite`,children:n(d?`common.copied`:`common.copy`)})]})};export{d as t};
|
|
2
|
+
//# sourceMappingURL=CopyButton-BoWb-xi1.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CopyButton-BoWb-xi1.js","names":["useState","__toESM","require_jsx_runtime","useTranslation","reportError","Check","Button","Copy","import_react","require_react","import_jsx_runtime","COPIED_RESET_MS","CopyButton","copied","setCopied","copy","value","error","t"],"sources":["../../src/components/CopyButton/index.tsx"],"sourcesContent":["import { Check, Copy } from 'lucide-react';\nimport { useState, type Ref } from 'react';\nimport { useTranslation } from 'react-i18next';\nimport { Button } from '@/components/ui/button';\nimport { reportError } from '@/helpers/reportError';\n\ntype CopyButtonProps = {\n value: string;\n /** For a caller that moves focus to the button (SecretReveal on mount). */\n ref?: Ref<HTMLButtonElement>;\n};\n\nconst COPIED_RESET_MS = 2000;\n\nexport const CopyButton = ({ value, ref }: CopyButtonProps) => {\n const { t } = useTranslation();\n const [copied, setCopied] = useState(false);\n const copy = async () => {\n try {\n await navigator.clipboard.writeText(value);\n setCopied(true);\n setTimeout(() => setCopied(false), COPIED_RESET_MS);\n } catch (error) {\n reportError(error, 'copy to clipboard');\n }\n };\n return (\n <Button ref={ref} type=\"button\" variant=\"outline\" onClick={() => void copy()}>\n {copied ? <Check aria-hidden=\"true\" /> : <Copy aria-hidden=\"true\" />}\n <span aria-live=\"polite\">{copied ? t('common.copied') : t('common.copy')}</span>\n </Button>\n );\n};\n"],"mappings":"uUAYMW,EAAkB,IAEXC,GAAc,CAAE,QAAO,SAA2B,CAC7D,GAAM,CAAE,KAAMT,EAAe,EACvB,CAACU,EAAQC,IAAA,EAAad,EAAAA,SAAAA,CAAS,EAAK,EACpCe,EAAO,SAAY,CACvB,GAAI,CACF,MAAM,UAAU,UAAU,UAAUC,CAAK,EACzCF,EAAU,EAAI,EACd,eAAiBA,EAAU,EAAK,EAAGH,CAAe,CACpD,OAASM,EAAO,CACdb,EAAYa,EAAO,mBAAmB,CACxC,CACF,EACA,OACE,EAAAP,EAAA,KAAA,CAACJ,EAAD,CAAa,MAAK,KAAK,SAAS,QAAQ,UAAU,YAAe,KAAKS,EAAK,EAA3E,SAAA,CACGF,GAAS,EAAAH,EAAA,IAAA,CAACL,EAAD,CAAO,cAAY,MAAQ,CAAA,GAAI,EAAAK,EAAA,IAAA,CAACH,EAAD,CAAM,cAAY,MAAQ,CAAA,GACnE,EAAAG,EAAA,IAAA,CAAC,OAAD,CAAM,YAAU,SAAU,SAASQ,EAATL,EAAW,gBAAqB,aAAa,CAAQ,CAAA,CACzE,GAEZ"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{t}from"./jsx-runtime-DREnUpxT.js";import{i as n,j as r,t as i}from"./cn-BQ3voEft.js";import{D as a,i as o}from"./skeleton-C3QLIh7W.js";import{t as s}from"./chevron-left-BsQYDUEC.js";var c={name:`chevrons-left`,size:24,node:[[`path`,{d:`m11 17-5-5 5-5`,key:`13zhaf`}],[`path`,{d:`m18 17-5-5 5-5`,key:`h8a8et`}]]};c.node;var l=n(c),u=e(t(),1),d=({onFirst:e,onPrevious:t,onNext:n,className:c})=>{let{t:d}=r();return(0,u.jsxs)(`nav`,{"aria-label":d(`common.pagination`),className:i(`flex items-center justify-end gap-2`,c),children:[(0,u.jsx)(o,{variant:`outline`,size:`icon-sm`,"aria-label":d(`common.first`),disabled:!e,onClick:e,children:(0,u.jsx)(l,{"aria-hidden":`true`})}),(0,u.jsx)(o,{variant:`outline`,size:`icon-sm`,"aria-label":d(`common.previous`),disabled:!t,onClick:t,children:(0,u.jsx)(s,{"aria-hidden":`true`})}),(0,u.jsx)(o,{variant:`outline`,size:`icon-sm`,"aria-label":d(`common.next`),disabled:!n,onClick:n,children:(0,u.jsx)(a,{"aria-hidden":`true`})})]})};export{d as t};
|
|
2
|
+
//# sourceMappingURL=CursorPager-BnxmTk47.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CursorPager-BnxmTk47.js","names":["__toESM","createLucideIcon","useTranslation","cn","ChevronRight","Button","ChevronLeft","__iconData","ChevronsLeft","import_jsx_runtime","require_jsx_runtime","CursorPager","t","className","onFirst","onPrevious","onNext"],"sources":["../../../../node_modules/.pnpm/lucide-react@1.49.0_@types+react@19.3.0_react@19.3.0/node_modules/lucide-react/dist/esm/icons/chevrons-left.mjs","../../src/components/CursorPager/index.tsx"],"sourcesContent":["/**\n * @license lucide-react v1.49.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconData = {\n name: \"chevrons-left\",\n size: 24,\n node: [\n [\"path\", { d: \"m11 17-5-5 5-5\", key: \"13zhaf\" }],\n [\"path\", { d: \"m18 17-5-5 5-5\", key: \"h8a8et\" }]\n ]\n};\n__iconData.node;\nconst ChevronsLeft = createLucideIcon(__iconData);\n\nexport { __iconData, ChevronsLeft as default };\n//# sourceMappingURL=chevrons-left.mjs.map\n","import { ChevronLeft, ChevronRight, ChevronsLeft } from 'lucide-react';\nimport { useTranslation } from 'react-i18next';\nimport { Button } from '@/components/ui/button';\nimport { cn } from '@/helpers/cn';\n\ntype CursorPagerProps = {\n /** Undefined when already on the first page. */\n onFirst: (() => void) | undefined;\n onPrevious: (() => void) | undefined;\n /** Undefined when there is no further page. */\n onNext: (() => void) | undefined;\n className?: string;\n};\n\n/** Paging for cursor-paginated lists (newest first, no total): Newest, Previous, Next as icon buttons. */\nexport const CursorPager = ({ onFirst, onPrevious, onNext, className }: CursorPagerProps) => {\n const { t } = useTranslation();\n return (\n <nav aria-label={t('common.pagination')} className={cn('flex items-center justify-end gap-2', className)}>\n <Button\n variant=\"outline\"\n size=\"icon-sm\"\n aria-label={t('common.first')}\n disabled={!onFirst}\n onClick={onFirst}\n >\n <ChevronsLeft aria-hidden=\"true\" />\n </Button>\n <Button\n variant=\"outline\"\n size=\"icon-sm\"\n aria-label={t('common.previous')}\n disabled={!onPrevious}\n onClick={onPrevious}\n >\n <ChevronLeft aria-hidden=\"true\" />\n </Button>\n <Button\n variant=\"outline\"\n size=\"icon-sm\"\n aria-label={t('common.next')}\n disabled={!onNext}\n onClick={onNext}\n >\n <ChevronRight aria-hidden=\"true\" />\n </Button>\n </nav>\n );\n};\n"],"ignoreList":[0],"mappings":"gPASA,IAAMO,EAAa,CACjB,KAAM,gBACN,KAAM,GACN,KAAM,CACJ,CAAC,OAAQ,CAAE,EAAG,iBAAkB,IAAK,QAAS,CAAC,EAC/C,CAAC,OAAQ,CAAE,EAAG,iBAAkB,IAAK,QAAS,CAAC,CACjD,CACF,EACAA,EAAW,KACX,IAAMC,EAAeP,EAAiBM,CAAU,aCHnCI,GAAe,CAAE,UAAS,aAAY,SAAQ,eAAkC,CAC3F,GAAM,CAAE,KAAMT,EAAe,EAC7B,OACE,EAAAO,EAAA,KAAA,CAAC,MAAD,CAAK,aAAYG,EAAE,mBAAmB,EAAG,UAAWT,EAAG,sCAAuCU,CAAS,EAAvG,SAAA,EACE,EAAAJ,EAAA,IAAA,CAACJ,EAAD,CACE,QAAQ,UACR,KAAK,UACL,aAAYO,EAAE,cAAc,EAC5B,SAAU,CAACE,EACX,QAASA,EAET,UAAA,EAAAL,EAAA,IAAA,CAACD,EAAD,CAAc,cAAY,MAAQ,CAAA,CAC5B,CAAA,GACR,EAAAC,EAAA,IAAA,CAACJ,EAAD,CACE,QAAQ,UACR,KAAK,UACL,aAAYO,EAAE,iBAAiB,EAC/B,SAAU,CAACG,EACX,QAASA,EAET,UAAA,EAAAN,EAAA,IAAA,CAACH,EAAD,CAAa,cAAY,MAAQ,CAAA,CAC3B,CAAA,GACR,EAAAG,EAAA,IAAA,CAACJ,EAAD,CACE,QAAQ,UACR,KAAK,UACL,aAAYO,EAAE,aAAa,EAC3B,SAAU,CAACI,EACX,QAASA,EAET,UAAA,EAAAP,EAAA,IAAA,CAACL,EAAD,CAAc,cAAY,MAAQ,CAAA,CAC5B,CAAA,CACL,GAET"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{t}from"./jsx-runtime-DREnUpxT.js";import{j as n}from"./cn-BQ3voEft.js";import{t as r}from"./external-link-D3Aoi2yX.js";var i=e(t(),1),a=({href:e,children:t})=>{let{t:a}=n();return(0,i.jsxs)(`a`,{href:e,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center gap-1 rounded-sm font-medium break-all text-link underline-offset-4 outline-none hover:underline focus-visible:ring-[3px] focus-visible:ring-ring/50`,children:[t,(0,i.jsx)(r,{className:`size-3.5 shrink-0`,"aria-hidden":`true`}),(0,i.jsx)(`span`,{className:`sr-only`,children:a(`publishing.opensInNewTab`)})]})};export{a as t};
|
|
2
|
+
//# sourceMappingURL=ExternalLink-Eeb9mONJ.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ExternalLink-Eeb9mONJ.js","names":["ExternalLinkIcon","__toESM","useTranslation","ExternalLink$1","import_jsx_runtime","require_jsx_runtime","ExternalLink","children","t"],"sources":["../../src/features/Publishing/ExternalLink/index.tsx"],"sourcesContent":["import { ExternalLink as ExternalLinkIcon } from 'lucide-react';\nimport type { ReactNode } from 'react';\nimport { useTranslation } from 'react-i18next';\n\ntype ExternalLinkProps = { href: string; children: ReactNode };\n\n/** A link that leaves the admin in a new tab, without giving the other site access to this window. */\nexport const ExternalLink = ({ href, children }: ExternalLinkProps) => {\n const { t } = useTranslation();\n return (\n <a\n href={href}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className=\"inline-flex items-center gap-1 rounded-sm font-medium break-all text-link underline-offset-4 outline-none hover:underline focus-visible:ring-[3px] focus-visible:ring-ring/50\"\n >\n {children}\n <ExternalLinkIcon className=\"size-3.5 shrink-0\" aria-hidden=\"true\" />\n <span className=\"sr-only\">{t('publishing.opensInNewTab')}</span>\n </a>\n );\n};\n"],"mappings":"gMAOaM,GAAgB,CAAE,OAAM,cAAkC,CACrE,GAAM,CAAE,KAAMJ,EAAe,EAC7B,OACE,EAAAE,EAAA,KAAA,CAAC,IAAD,CACQ,OACN,OAAO,SACP,IAAI,sBACJ,UAAU,gLAJZ,SAAA,CAMGG,GACD,EAAAH,EAAA,IAAA,CAACJ,EAAD,CAAkB,UAAU,oBAAoB,cAAY,MAAQ,CAAA,GACpE,EAAAI,EAAA,IAAA,CAAC,OAAD,CAAM,UAAU,UAAW,SAAAI,EAAE,0BAA0B,CAAQ,CAAA,CAC9D,GAEP"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{t}from"./react-CQOZoUwg.js";import{t as n}from"./jsx-runtime-DREnUpxT.js";import{P as r,bt as i,i as a,j as o,t as s}from"./cn-BQ3voEft.js";import{T as c,b as l,u,x as d}from"./auth-pcS9CCXu.js";import{_ as ee,a as te,i as ne,n as f}from"./badge-DD0mE96i.js";import{i as p,n as m,t as h}from"./RowTitle--uFCpx8n.js";import{t as re}from"./UnsavedChangesGuard-DgOASh0p.js";import{G as g,f as _,p as v,t as y,u as ie}from"./InfoHint-GJLRVumb.js";import{N as b,i as ae}from"./skeleton-C3QLIh7W.js";import{a as x,i as S,l as C,r as w,u as T}from"./constants-SrImR6C3.js";import{t as E}from"./useSchemaScopeAccess-DUBeS9kU.js";import{i as oe}from"./ConfirmDialog-B9nWhIIz.js";import{t as D}from"./radio-group-DHIxK-IU.js";import{c as O,f as k,n as A,o as se,t as ce,u as le}from"./zod-BHAd1wTC.js";import{t as ue}from"./settle-LRKtTN_e.js";import{_ as j,a as M,d as N,g as P,i as F,l as I,n as L,o as R,r as z,s as B,t as V}from"./table-CZYtdoHn.js";import{t as H}from"./SharedGlyph-Cqkx30tn.js";import{a as U,h as de,r as fe,u as pe}from"./schema-B4smPFcR.js";import{H as me,_ as W,f as G,g as he,h as ge}from"./src-XaU0N8C-.js";import{t as _e}from"./Panel-iIKjEURi.js";import{a as ve,i as ye,n as K,r as be,t as xe}from"./followPlural-CN6cQfNk.js";import{t as q}from"./RadioTile-BpB79rIK.js";import{t as Se}from"./FormSwitchField-ft8Jbe6E.js";import{t as Ce}from"./FormTextareaField-DzyOzfZb.js";var J={name:`app-window`,size:24,node:[[`rect`,{x:`2`,y:`4`,width:`20`,height:`16`,rx:`2`,key:`izxlao`}],[`path`,{d:`M10 4v4`,key:`pp8u80`}],[`path`,{d:`M2 8h20`,key:`d11cs7`}],[`path`,{d:`M6 4v4`,key:`1svtjw`}]]};J.node;var we=a(J),Y=e(n(),1),Te=({definition:e})=>(0,Y.jsx)(h,{asChild:!0,children:e.kind===`component`?(0,Y.jsx)(d,{to:`/models/components/$componentId`,params:{componentId:e.id},children:e.label}):(0,Y.jsx)(d,{to:`/models/$modelId`,params:{modelId:e.id},children:e.label})}),X=e(t(),1),Ee=({changeId:e})=>{let{t}=o(),n=pe(e),a=i(),s=n.data?.status,c=s!==void 0&&de.has(s);return(0,X.useEffect)(()=>{c&&a.invalidateQueries({queryKey:r.schema.all})},[c,a]),c||n.isError?null:(0,Y.jsx)(f,{tone:`progress`,size:`sm`,label:t(`models.pendingChange`)})},De=e=>e.kind===`collection`?`${e.apiKey} · ${G(e)}`:e.apiKey,Oe=({items:e,showKind:t=!1,markShared:n=!0})=>{let{t:r}=o(),{multiSite:i}=E(),a=n&&i;return(0,Y.jsx)(B,{children:(0,Y.jsxs)(V,{children:[(0,Y.jsx)(M,{children:(0,Y.jsxs)(R,{children:[(0,Y.jsx)(F,{children:r(`models.columns.label`)}),t?(0,Y.jsx)(F,{children:r(`models.columns.kind`)}):null,(0,Y.jsx)(F,{children:r(`models.columns.apiKey`)}),(0,Y.jsx)(F,{className:`text-right`,children:r(`models.columns.fields`)}),(0,Y.jsx)(F,{className:`text-right`,children:r(`models.columns.version`)}),(0,Y.jsx)(F,{children:r(`models.columns.activated`)})]})}),(0,Y.jsx)(L,{children:e.map(({definition:e,scope:n,version:i,activatedAt:o,pendingChange:s})=>(0,Y.jsxs)(R,{children:[(0,Y.jsx)(z,{children:(0,Y.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(Te,{definition:e}),a&&n===`network`?(0,Y.jsx)(H,{}):null,s?(0,Y.jsx)(Ee,{changeId:s.id}):null]})}),t?(0,Y.jsx)(z,{className:`text-muted-foreground`,children:r(x[e.kind])}):null,(0,Y.jsx)(z,{className:`font-mono text-meta text-muted-foreground`,children:De(e)}),(0,Y.jsx)(z,{className:`text-right tabular-nums`,children:e.fields.length}),(0,Y.jsx)(z,{className:`text-right text-muted-foreground tabular-nums`,children:r(`models.versionNumber`,{version:i})}),(0,Y.jsx)(z,{className:`text-muted-foreground`,title:m(o),children:p(o)})]},e.id))})]})})},ke={API_KEY_INVALID:`validation.apiKeyInvalid`,API_KEY_TOO_LONG:`validation.apiKeyTooLong`,API_KEY_RESERVED_PREFIX:`validation.apiKeyReservedPrefix`},Z=e=>{let t=he(e);return t?ke[t.code]??`validation.apiKeyInvalid`:null},Ae=()=>j().trim().min(1,`validation.required`).superRefine((e,t)=>{let n=Z(e);n&&t.addIssue({code:`custom`,message:n})}),je=(e,t)=>Z(e)?null:t===``?`validation.required`:W(t)===W(e)?`validation.pluralApiKeySameAsSingular`:Z(t),Me=(e,t,n)=>{let r=(0,X.useRef)(e);(0,X.useEffect)(()=>{let i=t();(i===``||i===K(r.current))&&n(K(e)),r.current=e},[e,t,n])},Ne=(e,t,n)=>{let r=(0,X.useRef)(e);(0,X.useEffect)(()=>{let i=t(),a=xe(r.current,e,i);a!==i&&n(a),r.current=e},[e,t,n])},Pe=P({kind:I([`collection`,`singleton`,`component`]),label:se(),apiKey:Ae(),pluralApiKey:j().trim(),description:j().trim(),localized:N(),scope:I([`site`,`network`])}).superRefine((e,t)=>{let n=e.kind===`collection`?je(e.apiKey,e.pluralApiKey):null;n&&t.addIssue({code:`custom`,path:[`pluralApiKey`],message:n})}),Fe=(e,t)=>({kind:e,label:``,apiKey:``,pluralApiKey:``,description:``,localized:!1,scope:t}),Q=({kind:e,label:t,apiKey:n,pluralApiKey:r,description:i,localized:a})=>e===`component`?{kind:e,label:t,apiKey:n,description:i,fields:[]}:e===`collection`?{kind:e,label:t,apiKey:n,pluralApiKey:r,description:i,localized:a,fields:[]}:{kind:e,label:t,apiKey:n,description:i,localized:a,fields:[]},Ie=e=>new Set((e??[]).flatMap(({definition:e})=>[e.apiKey,...me(e)?[G(e)]:[]].map(W))),Le=[`apiKey`,`pluralApiKey`],Re=(e,t=`site`)=>{let n=U(),{definitions:r}=fe(),i=c(),a=le({resolver:ce(Pe),defaultValues:Fe(e,t)}),{setValue:o,setError:s,getValues:u}=a;return Me(k({control:a.control,name:`label`}),(0,X.useCallback)(()=>u(`apiKey`),[u]),(0,X.useCallback)(e=>o(`apiKey`,e,{shouldValidate:!1}),[o])),Ne(k({control:a.control,name:`apiKey`}),(0,X.useCallback)(()=>u(`pluralApiKey`),[u]),(0,X.useCallback)(e=>o(`pluralApiKey`,e,{shouldValidate:!1}),[o])),{form:a,onSubmit:a.handleSubmit(async e=>{let t=Ie(r);if(t.has(W(e.apiKey))){s(`apiKey`,{message:`validation.apiKeyTaken`});return}if(e.kind===`collection`&&t.has(W(e.pluralApiKey))){s(`pluralApiKey`,{message:`validation.apiKeyTaken`});return}let a=C(e.kind),o=await ue(n.mutateAsync({category:a,input:{definition:Q(e),scope:e.scope}}));if(!o.ok){let e=l(n.error);for(let t of Le){let n=e.find(e=>e.path===`/${t}`);n&&s(t,{message:be(n)})}return}g.success(b.t(`models.created`));let c=o.value.definitionId;await i(a===`component`?{to:`/models/components/$componentId`,params:{componentId:c},ignoreBlocker:!0}:{to:`/models/$modelId`,params:{modelId:c},ignoreBlocker:!0})}),pending:n.isPending,error:n.error}},$=({label:e,names:t})=>(0,Y.jsxs)(`div`,{className:`flex min-w-0 items-baseline gap-2`,children:[(0,Y.jsx)(`dt`,{className:`w-14 shrink-0`,children:e}),(0,Y.jsx)(`dd`,{className:`flex min-w-0 flex-wrap gap-1.5`,children:t.map(e=>(0,Y.jsx)(`code`,{className:`max-w-full truncate rounded bg-muted px-1.5 py-0.5 font-mono text-foreground/80`,children:e},e))})]}),ze=({apiKey:e,pluralApiKey:t,kind:n})=>{let{t:r}=o(),i=e.trim();if(i===``||n===`component`)return null;let a=t.trim()||ge(i),s=n===`collection`?a:i,c=n===`collection`?[i,a]:[i];return(0,Y.jsxs)(`dl`,{className:`flex flex-col gap-1 text-xs text-muted-foreground`,children:[(0,Y.jsx)($,{label:r(`models.restLabel`),names:[r(`models.endpointPath`,{routeKey:s})]}),(0,Y.jsx)($,{label:r(`models.graphqlLabel`),names:c})]})},Be=({control:e,kinds:t})=>{let{t:n}=o(),{field:{ref:r,value:i,onChange:a}}=O({control:e,name:`kind`});return(0,Y.jsxs)(v,{className:`gap-3`,children:[(0,Y.jsx)(_,{variant:`label`,className:`mb-0`,children:n(`models.kind`)}),(0,Y.jsx)(D,{ref:r,value:i,onValueChange:a,className:s(`gap-3 sm:grid-cols-2`,t.length>2&&`sm:grid-cols-3`),children:t.map(e=>(0,Y.jsx)(q,{value:e,icon:S[e],label:n(x[e]),description:n(w[e])},e))})]})},Ve=({control:e,canShare:t})=>{let{t:n}=o(),r=u().data?.site,{field:{ref:i,value:a,onChange:s}}=O({control:e,name:`scope`});return(0,Y.jsxs)(v,{className:`gap-3`,children:[(0,Y.jsxs)(_,{variant:`label`,className:`mb-0 flex items-center gap-1`,children:[n(`contentTypes.availableOn`),t?null:(0,Y.jsx)(y,{about:n(`contentTypes.allSites`),children:n(`contentTypes.allSitesNeedsNetwork`)})]}),(0,Y.jsxs)(D,{ref:i,value:a,onValueChange:s,className:`gap-3 sm:grid-cols-2`,children:[(0,Y.jsx)(q,{value:`site`,icon:we,label:n(`contentTypes.thisSite`),description:n(`contentTypes.thisSiteDescription`,{site:r?.name??``})}),(0,Y.jsx)(q,{value:`network`,icon:T,label:n(`contentTypes.allSites`),description:n(`contentTypes.allSitesDescription`),disabled:!t})]})]})},He=({title:e,kinds:t,back:n,backLabel:r,intro:i,scope:a})=>{let{t:c}=o(),{locked:l,reason:u}=ve(),{multiSite:f,canShare:p}=E(),{form:m,onSubmit:h,pending:g,error:_}=Re(t[0],a),[v,y,b]=k({control:m.control,name:[`kind`,`apiKey`,`pluralApiKey`]}),x=v===`collection`;return(0,Y.jsxs)(te,{width:`narrow`,children:[(0,Y.jsx)(re,{when:m.formState.isDirty}),(0,Y.jsx)(ne,{breadcrumb:[{label:r,link:n}],title:e}),l?(0,Y.jsx)(ye,{reason:u}):null,i,(0,Y.jsx)(_e,{children:(0,Y.jsx)(`form`,{noValidate:!0,onSubmit:e=>void h(e),children:(0,Y.jsxs)(ie,{className:`gap-5`,children:[t.length>1?(0,Y.jsx)(Be,{control:m.control,kinds:t}):null,a===void 0&&f?(0,Y.jsx)(Ve,{control:m.control,canShare:p}):null,(0,Y.jsx)(A,{control:m.control,name:`label`,label:c(`models.label`),autoComplete:`off`}),(0,Y.jsxs)(`div`,{className:s(`grid items-start gap-5`,x&&`sm:grid-cols-2`),children:[(0,Y.jsx)(A,{control:m.control,name:`apiKey`,label:c(`models.apiKey`),hint:c(`models.apiKeyHint`),autoComplete:`off`,spellCheck:!1,className:`font-mono`}),x?(0,Y.jsx)(A,{control:m.control,name:`pluralApiKey`,label:c(`models.pluralApiKey`),hint:c(`models.pluralApiKeyHint`),autoComplete:`off`,spellCheck:!1,className:`font-mono`}):null]}),(0,Y.jsx)(ze,{apiKey:y,pluralApiKey:b,kind:v}),(0,Y.jsx)(Ce,{control:m.control,name:`description`,label:c(`common.optionalLabel`,{label:c(`models.descriptionLabel`)}),rows:2}),v===`component`?null:(0,Y.jsx)(Se,{control:m.control,name:`localized`,label:c(`models.localized`),hint:c(`models.localizedHint`),variant:`bordered`}),(0,Y.jsx)(oe,{error:_}),(0,Y.jsxs)(`div`,{className:`flex flex-wrap justify-end gap-2`,children:[(0,Y.jsx)(ae,{variant:`outline`,asChild:!0,children:(0,Y.jsx)(d,{...n,children:c(`common.cancel`)})}),(0,Y.jsx)(ee,{pending:g,pendingLabel:c(`models.creating`),disabled:l,children:c(`common.create`)})]})]})})})]})};export{Oe as n,He as t};
|
|
2
|
+
//# sourceMappingURL=Form-DZRLD3vH.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Form-DZRLD3vH.js","names":["TableRoot","z.string","useRef","useRef","z.object","z.enum","z.string","z.boolean","zodResolver","useCallback","i18next","Globe2","__toESM","require_jsx_runtime","queryKeys","useQueryClient","createLucideIcon","useTranslation","cn","useNavigate","schemaIssuesOf","Link","SubmitButton","Page","PageHeader","StatusChip","formatRelativeTime","formatDateTime","RowTitle","UnsavedChangesGuard","toast","FieldLegend","FieldSet","InfoHint","FieldGroup","instance","Button","KIND_LABEL_KEYS","KIND_ICONS","categoryOfKind","KIND_DESCRIPTION_KEYS","Earth","useSchemaScopeAccess","FormError","RadioGroup","useController","useWatch","FormTextField","requiredText","u","useForm","settle","string","TableHeader","boolean","object","TableHead","_enum","TableBody","TableRow","TableCell","TableCard","Table","SharedGlyph","useCreateDefinition","FINAL_CHANGE_STATUSES","useAllDefinitions","useSchemaChange","isModelDefinition","foldApiKey","routeKeyOf","checkApiKeySyntax","suggestPlural","Panel","useSchemaLock","LockNotice","deriveApiKey","describeIssue","followPlural","RadioTile","FormSwitchField","FormTextareaField","__iconData","AppWindow","import_jsx_runtime","DefinitionLink","definition","import_react","require_react","PendingChip","change","changeId","queryClient","status","finished","apiIdsOf","List","showShared","markShared","multiSite","t","showKind","items","scope","pendingChange","activatedAt","API_KEY_MESSAGES","syntaxMessage","problem","value","apiKeyField","message","context","pluralApiKeyMessage","apiKey","plural","useApiKeyFromLabel","previousLabel","label","current","getApiKey","setApiKey","usePluralFromApiKey","previousApiKey","getPlural","next","setPlural","createSchema","values","blank","toDefinition","kind","takenKeys","definitions","ISSUE_FIELDS","useCreateDefinitionForm","createDefinition","navigate","form","initialKind","initialScope","getValues","setValue","taken","setError","category","created","issues","name","found","candidate","id","PreviewRow","names","EndpointPreview","pluralApiKey","routeKey","graphqlNames","KindPicker","onChange","kinds","ScopePicker","site","useMe","canShare","Form","isCollection","backLabel","back","locked","intro","onSubmit","event"],"sources":["../../../../node_modules/.pnpm/lucide-react@1.49.0_@types+react@19.3.0_react@19.3.0/node_modules/lucide-react/dist/esm/icons/app-window.mjs","../../src/features/Models/DefinitionLink/index.tsx","../../src/features/Models/PendingChip/index.tsx","../../src/features/Models/List/index.tsx","../../src/features/Models/helpers/apiKeyField.ts","../../src/features/Models/hooks/useApiKeyFromLabel.ts","../../src/features/Models/hooks/usePluralFromApiKey.ts","../../src/features/Models/hooks/useCreateDefinitionForm.ts","../../src/features/Content/New/EndpointPreview/index.tsx","../../src/features/Content/New/KindPicker/index.tsx","../../src/features/Content/New/ScopePicker/index.tsx","../../src/features/Content/New/Form/index.tsx"],"sourcesContent":["/**\n * @license lucide-react v1.49.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconData = {\n name: \"app-window\",\n size: 24,\n node: [\n [\"rect\", { x: \"2\", y: \"4\", width: \"20\", height: \"16\", rx: \"2\", key: \"izxlao\" }],\n [\"path\", { d: \"M10 4v4\", key: \"pp8u80\" }],\n [\"path\", { d: \"M2 8h20\", key: \"d11cs7\" }],\n [\"path\", { d: \"M6 4v4\", key: \"1svtjw\" }]\n ]\n};\n__iconData.node;\nconst AppWindow = createLucideIcon(__iconData);\n\nexport { __iconData, AppWindow as default };\n//# sourceMappingURL=app-window.mjs.map\n","import type { SchemaDefinition } from '@shapio/schema';\nimport { Link } from '@tanstack/react-router';\nimport { RowTitle } from '@/components/RowTitle';\n\ntype DefinitionLinkProps = { definition: Pick<SchemaDefinition, 'id' | 'kind' | 'label'> };\n\n/** A definition's name as a list row title, linking to its builder (models and components differ). */\nexport const DefinitionLink = ({ definition }: DefinitionLinkProps) => (\n <RowTitle asChild>\n {definition.kind === 'component' ? (\n <Link to=\"/models/components/$componentId\" params={{ componentId: definition.id }}>\n {definition.label}\n </Link>\n ) : (\n <Link to=\"/models/$modelId\" params={{ modelId: definition.id }}>\n {definition.label}\n </Link>\n )}\n </RowTitle>\n);\n","import { useQueryClient } from '@tanstack/react-query';\nimport { useEffect } from 'react';\nimport { useTranslation } from 'react-i18next';\nimport { queryKeys } from '@/api/queryKeys';\nimport { useSchemaChange } from '@/api/schema';\nimport { StatusChip } from '@/components/StatusChip';\nimport { FINAL_CHANGE_STATUSES } from '@/constants/schema';\n\ntype PendingChipProps = { changeId: string };\n\n/** \"Change in progress\" while a planned change runs; refreshes the schema and disappears when it ends. */\nexport const PendingChip = ({ changeId }: PendingChipProps) => {\n const { t } = useTranslation();\n const change = useSchemaChange(changeId);\n const queryClient = useQueryClient();\n const status = change.data?.status;\n const finished = status !== undefined && FINAL_CHANGE_STATUSES.has(status);\n useEffect(() => {\n if (finished) {\n void queryClient.invalidateQueries({ queryKey: queryKeys.schema.all });\n }\n }, [finished, queryClient]);\n if (finished || change.isError) {\n return null;\n }\n return <StatusChip tone=\"progress\" size=\"sm\" label={t('models.pendingChange')} />;\n};\n","import type { DefinitionListItem } from '@shapio/client';\nimport { routeKeyOf } from '@shapio/schema';\nimport { useTranslation } from 'react-i18next';\nimport { SharedGlyph } from '@/components/SharedGlyph';\nimport { TableCard } from '@/components/TableCard';\nimport {\n Table as TableRoot,\n TableBody,\n TableCell,\n TableHead,\n TableHeader,\n TableRow,\n} from '@/components/ui/table';\nimport { formatDateTime, formatRelativeTime } from '@/helpers/formatDate';\nimport { useSchemaScopeAccess } from '@/hooks/useSchemaScopeAccess';\nimport { KIND_LABEL_KEYS } from '../constants';\nimport { DefinitionLink } from '../DefinitionLink';\nimport { PendingChip } from '../PendingChip';\n\ntype ListProps = {\n items: DefinitionListItem[];\n /** A Kind column, for lists that mix content types and components. */\n showKind?: boolean;\n /** Mark shared definitions with a globe (where there is more than one site); off where all are shared. */\n markShared?: boolean;\n};\n\n/** \"article · articles\" for a collection (singular and list names), the API ID alone otherwise. */\nconst apiIdsOf = (definition: DefinitionListItem['definition']) =>\n definition.kind === 'collection' ? `${definition.apiKey} · ${routeKeyOf(definition)}` : definition.apiKey;\n\nexport const List = ({ items, showKind = false, markShared = true }: ListProps) => {\n const { t } = useTranslation();\n const { multiSite } = useSchemaScopeAccess();\n const showShared = markShared && multiSite;\n return (\n <TableCard>\n <TableRoot>\n <TableHeader>\n <TableRow>\n <TableHead>{t('models.columns.label')}</TableHead>\n {showKind ? <TableHead>{t('models.columns.kind')}</TableHead> : null}\n <TableHead>{t('models.columns.apiKey')}</TableHead>\n <TableHead className=\"text-right\">{t('models.columns.fields')}</TableHead>\n <TableHead className=\"text-right\">{t('models.columns.version')}</TableHead>\n <TableHead>{t('models.columns.activated')}</TableHead>\n </TableRow>\n </TableHeader>\n <TableBody>\n {items.map(({ definition, scope, version, activatedAt, pendingChange }) => (\n <TableRow key={definition.id}>\n <TableCell>\n <span className=\"flex items-center gap-2\">\n <DefinitionLink definition={definition} />\n {showShared && scope === 'network' ? <SharedGlyph /> : null}\n {pendingChange ? <PendingChip changeId={pendingChange.id} /> : null}\n </span>\n </TableCell>\n {showKind ? (\n <TableCell className=\"text-muted-foreground\">{t(KIND_LABEL_KEYS[definition.kind])}</TableCell>\n ) : null}\n <TableCell className=\"font-mono text-meta text-muted-foreground\">\n {apiIdsOf(definition)}\n </TableCell>\n <TableCell className=\"text-right tabular-nums\">{definition.fields.length}</TableCell>\n <TableCell className=\"text-right text-muted-foreground tabular-nums\">\n {t('models.versionNumber', { version })}\n </TableCell>\n <TableCell className=\"text-muted-foreground\" title={formatDateTime(activatedAt)}>\n {formatRelativeTime(activatedAt)}\n </TableCell>\n </TableRow>\n ))}\n </TableBody>\n </TableRoot>\n </TableCard>\n );\n};\n","import { checkApiKeySyntax, foldApiKey } from '@shapio/schema';\nimport { z } from 'zod';\nimport type { ValidationMessageKey } from '@/helpers/validation';\n\nconst API_KEY_MESSAGES: Readonly<Record<string, ValidationMessageKey>> = {\n API_KEY_INVALID: 'validation.apiKeyInvalid',\n API_KEY_TOO_LONG: 'validation.apiKeyTooLong',\n API_KEY_RESERVED_PREFIX: 'validation.apiKeyReservedPrefix',\n};\n\n/** The message for an API key's syntax problem (`checkApiKeySyntax`), or null when it is valid. */\nconst syntaxMessage = (value: string): ValidationMessageKey | null => {\n const problem = checkApiKeySyntax(value);\n return problem ? (API_KEY_MESSAGES[problem.code] ?? 'validation.apiKeyInvalid') : null;\n};\n\n/** An API key: GraphQL-name syntax, checked by @shapio/schema's own `checkApiKeySyntax`. */\nexport const apiKeyField = () =>\n z\n .string()\n .trim()\n .min(1, 'validation.required')\n .superRefine((value, context) => {\n const message = syntaxMessage(value);\n if (message) {\n context.addIssue({ code: 'custom', message });\n }\n });\n\n/**\n * What is wrong with a collection's plural API ID, or null: required, API-key syntax, not the singular.\n * Nothing while the singular itself is invalid (same rule as the server's validator).\n */\nexport const pluralApiKeyMessage = (apiKey: string, plural: string): ValidationMessageKey | null => {\n // A plural derived from an invalid API ID is invalid too; the API ID's own message says it once.\n if (syntaxMessage(apiKey)) {\n return null;\n }\n if (plural === '') {\n return 'validation.required';\n }\n if (foldApiKey(plural) === foldApiKey(apiKey)) {\n return 'validation.pluralApiKeySameAsSingular';\n }\n return syntaxMessage(plural);\n};\n","import { useEffect, useRef } from 'react';\nimport { deriveApiKey } from '../helpers/deriveApiKey';\n\n/**\n * The API key follows the label until the user types a key of their own: it is replaced only while it is\n * empty or still the key derived from the previous label. (React Hook Form's dirty state cannot tell: it\n * marks the derived key dirty as soon as the label changes again, so typing a label key by key stopped\n * the key after its first letter.)\n */\nexport const useApiKeyFromLabel = (\n label: string,\n getApiKey: () => string,\n setApiKey: (apiKey: string) => void,\n) => {\n const previousLabel = useRef(label);\n useEffect(() => {\n const current = getApiKey();\n if (current === '' || current === deriveApiKey(previousLabel.current)) {\n setApiKey(deriveApiKey(label));\n }\n previousLabel.current = label;\n }, [label, getApiKey, setApiKey]);\n};\n","import { useEffect, useRef } from 'react';\nimport { followPlural } from '../helpers/followPlural';\n\n/**\n * The plural API ID follows the singular API ID until the user types one of their own (same rule as the\n * API ID following the label, see `useApiKeyFromLabel`).\n */\nexport const usePluralFromApiKey = (\n apiKey: string,\n getPlural: () => string,\n setPlural: (plural: string) => void,\n) => {\n const previousApiKey = useRef(apiKey);\n useEffect(() => {\n const current = getPlural();\n const next = followPlural(previousApiKey.current, apiKey, current);\n if (next !== current) {\n setPlural(next);\n }\n previousApiKey.current = apiKey;\n }, [apiKey, getPlural, setPlural]);\n};\n","import { zodResolver } from '@hookform/resolvers/zod';\nimport type { DefinitionScope } from '@shapio/client';\nimport {\n foldApiKey,\n isModelDefinition,\n routeKeyOf,\n type DefinitionInput,\n type SchemaDefinition,\n} from '@shapio/schema';\nimport { useNavigate } from '@tanstack/react-router';\nimport { useCallback } from 'react';\nimport { useForm, useWatch } from 'react-hook-form';\nimport { toast } from 'sonner';\nimport { z } from 'zod';\nimport { schemaIssuesOf } from '@/api/errors';\nimport { useAllDefinitions, useCreateDefinition } from '@/api/schema';\nimport { i18next } from '@/app/i18n';\nimport { settle } from '@/helpers/settle';\nimport { requiredText } from '@/helpers/validation';\nimport { categoryOfKind } from '../constants';\nimport { apiKeyField, pluralApiKeyMessage } from '../helpers/apiKeyField';\nimport { describeIssue } from '../helpers/describeIssue';\nimport { useApiKeyFromLabel } from './useApiKeyFromLabel';\nimport { usePluralFromApiKey } from './usePluralFromApiKey';\n\nconst createSchema = z\n .object({\n kind: z.enum(['collection', 'singleton', 'component']),\n label: requiredText(),\n apiKey: apiKeyField(),\n /** Collections only (hidden and ignored for the other kinds). */\n pluralApiKey: z.string().trim(),\n description: z.string().trim(),\n localized: z.boolean(),\n /** Where it lives: this site (the default) or shared with all sites. */\n scope: z.enum(['site', 'network']),\n })\n .superRefine((values, context) => {\n const message =\n values.kind === 'collection' ? pluralApiKeyMessage(values.apiKey, values.pluralApiKey) : null;\n if (message) {\n context.addIssue({ code: 'custom', path: ['pluralApiKey'], message });\n }\n });\n\nexport type CreateDefinitionValues = z.infer<typeof createSchema>;\n\nconst blank = (kind: CreateDefinitionValues['kind'], scope: DefinitionScope): CreateDefinitionValues => ({\n kind,\n label: '',\n apiKey: '',\n pluralApiKey: '',\n description: '',\n localized: false,\n scope,\n});\n\nconst toDefinition = ({\n kind,\n label,\n apiKey,\n pluralApiKey,\n description,\n localized,\n}: CreateDefinitionValues): DefinitionInput => {\n if (kind === 'component') {\n return { kind, label, apiKey, description, fields: [] };\n }\n return kind === 'collection'\n ? { kind, label, apiKey, pluralApiKey, description, localized, fields: [] }\n : { kind, label, apiKey, description, localized, fields: [] };\n};\n\n/** API IDs already claimed (case-folded): every definition's API ID and every collection's plural. */\nconst takenKeys = (definitions: ReadonlyArray<{ definition: SchemaDefinition }> | undefined) =>\n new Set(\n (definitions ?? []).flatMap(({ definition }) =>\n [definition.apiKey, ...(isModelDefinition(definition) ? [routeKeyOf(definition)] : [])].map(foldApiKey),\n ),\n );\n\n/** Server issues shown on a form field, by the definition property they point at. */\nconst ISSUE_FIELDS = ['apiKey', 'pluralApiKey'] as const;\n\n/**\n * Creates an empty model or component, live (a new definition has no content, so it activates at once),\n * then opens it in the builder. The API key follows the label, and a collection's plural API ID follows\n * the API key, until the user edits them. It belongs to this site unless `scope` says otherwise (the\n * network view creates shared definitions only).\n */\nexport const useCreateDefinitionForm = (\n initialKind: CreateDefinitionValues['kind'],\n initialScope: DefinitionScope = 'site',\n) => {\n const createDefinition = useCreateDefinition();\n const { definitions } = useAllDefinitions();\n const navigate = useNavigate();\n const form = useForm<CreateDefinitionValues>({\n resolver: zodResolver(createSchema),\n defaultValues: blank(initialKind, initialScope),\n });\n const { setValue, setError, getValues } = form;\n const label = useWatch({ control: form.control, name: 'label' });\n useApiKeyFromLabel(\n label,\n useCallback(() => getValues('apiKey'), [getValues]),\n useCallback((apiKey: string) => setValue('apiKey', apiKey, { shouldValidate: false }), [setValue]),\n );\n const apiKey = useWatch({ control: form.control, name: 'apiKey' });\n usePluralFromApiKey(\n apiKey,\n useCallback(() => getValues('pluralApiKey'), [getValues]),\n useCallback((plural: string) => setValue('pluralApiKey', plural, { shouldValidate: false }), [setValue]),\n );\n\n const onSubmit = form.handleSubmit(async (values) => {\n const taken = takenKeys(definitions);\n if (taken.has(foldApiKey(values.apiKey))) {\n setError('apiKey', { message: 'validation.apiKeyTaken' });\n return;\n }\n if (values.kind === 'collection' && taken.has(foldApiKey(values.pluralApiKey))) {\n setError('pluralApiKey', { message: 'validation.apiKeyTaken' });\n return;\n }\n const category = categoryOfKind(values.kind);\n const created = await settle(\n createDefinition.mutateAsync({\n category,\n input: { definition: toDefinition(values), scope: values.scope },\n }),\n );\n if (!created.ok) {\n const issues = schemaIssuesOf(createDefinition.error);\n for (const name of ISSUE_FIELDS) {\n const found = issues.find((candidate) => candidate.path === `/${name}`);\n if (found) {\n setError(name, { message: describeIssue(found) });\n }\n }\n return;\n }\n toast.success(i18next.t('models.created'));\n const id = created.value.definitionId;\n // The form is still dirty: the unsaved-changes guard must not ask about what was just created.\n await (category === 'component'\n ? navigate({ to: '/models/components/$componentId', params: { componentId: id }, ignoreBlocker: true })\n : navigate({ to: '/models/$modelId', params: { modelId: id }, ignoreBlocker: true }));\n });\n return { form, onSubmit, pending: createDefinition.isPending, error: createDefinition.error };\n};\n","import { suggestPlural, type DefinitionKind } from '@shapio/schema';\nimport { useTranslation } from 'react-i18next';\n\ntype EndpointPreviewProps = { apiKey: string; pluralApiKey: string; kind: DefinitionKind };\n\ntype PreviewRowProps = { label: string; names: string[] };\n\nconst PreviewRow = ({ label, names }: PreviewRowProps) => (\n <div className=\"flex min-w-0 items-baseline gap-2\">\n <dt className=\"w-14 shrink-0\">{label}</dt>\n <dd className=\"flex min-w-0 flex-wrap gap-1.5\">\n {names.map((name) => (\n <code\n key={name}\n className=\"max-w-full truncate rounded bg-muted px-1.5 py-0.5 font-mono text-foreground/80\"\n >\n {name}\n </code>\n ))}\n </dd>\n </div>\n);\n\n/**\n * Every API name a model's API IDs produce (REST path, GraphQL queries), updated as they are typed, so it\n * is clear there is nothing else to configure. A collection is listed under its plural API ID\n * (`/api/content/articles`, `articles`) and read one by one under the singular (`article`). Nothing for\n * components or while the ID is empty.\n */\nexport const EndpointPreview = ({ apiKey, pluralApiKey, kind }: EndpointPreviewProps) => {\n const { t } = useTranslation();\n const id = apiKey.trim();\n if (id === '' || kind === 'component') {\n return null;\n }\n const plural = pluralApiKey.trim() || suggestPlural(id);\n const routeKey = kind === 'collection' ? plural : id;\n const graphqlNames = kind === 'collection' ? [id, plural] : [id];\n return (\n <dl className=\"flex flex-col gap-1 text-xs text-muted-foreground\">\n <PreviewRow label={t('models.restLabel')} names={[t('models.endpointPath', { routeKey })]} />\n <PreviewRow label={t('models.graphqlLabel')} names={graphqlNames} />\n </dl>\n );\n};\n","import type { DefinitionKind } from '@shapio/schema';\nimport { useController, type Control } from 'react-hook-form';\nimport { useTranslation } from 'react-i18next';\nimport { RadioTile } from '@/components/RadioTile';\nimport { FieldLegend, FieldSet } from '@/components/ui/field';\nimport { RadioGroup } from '@/components/ui/radio-group';\nimport { KIND_DESCRIPTION_KEYS, KIND_ICONS, KIND_LABEL_KEYS } from '@/features/Models/constants';\nimport type { CreateDefinitionValues } from '@/features/Models/hooks/useCreateDefinitionForm';\nimport { cn } from '@/helpers/cn';\n\ntype KindPickerProps = { control: Control<CreateDefinitionValues>; kinds: readonly DefinitionKind[] };\n\n/** The kinds offered here as cards (a radio group: arrow keys move between them). */\nexport const KindPicker = ({ control, kinds }: KindPickerProps) => {\n const { t } = useTranslation();\n const {\n field: { ref, value, onChange },\n } = useController({ control, name: 'kind' });\n return (\n <FieldSet className=\"gap-3\">\n <FieldLegend variant=\"label\" className=\"mb-0\">\n {t('models.kind')}\n </FieldLegend>\n <RadioGroup\n ref={ref}\n value={value}\n onValueChange={onChange}\n className={cn('gap-3 sm:grid-cols-2', kinds.length > 2 && 'sm:grid-cols-3')}\n >\n {kinds.map((kind) => (\n <RadioTile\n key={kind}\n value={kind}\n icon={KIND_ICONS[kind]}\n label={t(KIND_LABEL_KEYS[kind])}\n description={t(KIND_DESCRIPTION_KEYS[kind])}\n />\n ))}\n </RadioGroup>\n </FieldSet>\n );\n};\n","import { AppWindow, Globe2 } from 'lucide-react';\nimport { useController, type Control } from 'react-hook-form';\nimport { useTranslation } from 'react-i18next';\nimport { useMe } from '@/api/auth';\nimport { InfoHint } from '@/components/InfoHint';\nimport { RadioTile } from '@/components/RadioTile';\nimport { FieldLegend, FieldSet } from '@/components/ui/field';\nimport { RadioGroup } from '@/components/ui/radio-group';\nimport type { CreateDefinitionValues } from '@/features/Models/hooks/useCreateDefinitionForm';\n\ntype ScopePickerProps = {\n control: Control<CreateDefinitionValues>;\n /** The admin may create shared definitions (`schema.create` on every site); otherwise \"All sites\" is off. */\n canShare: boolean;\n};\n\n/** \"Available on\": this site (the default) or all sites, as cards (a radio group). */\nexport const ScopePicker = ({ control, canShare }: ScopePickerProps) => {\n const { t } = useTranslation();\n const site = useMe().data?.site;\n const {\n field: { ref, value, onChange },\n } = useController({ control, name: 'scope' });\n return (\n <FieldSet className=\"gap-3\">\n <FieldLegend variant=\"label\" className=\"mb-0 flex items-center gap-1\">\n {t('contentTypes.availableOn')}\n {canShare ? null : (\n <InfoHint about={t('contentTypes.allSites')}>{t('contentTypes.allSitesNeedsNetwork')}</InfoHint>\n )}\n </FieldLegend>\n <RadioGroup ref={ref} value={value} onValueChange={onChange} className=\"gap-3 sm:grid-cols-2\">\n <RadioTile\n value=\"site\"\n icon={AppWindow}\n label={t('contentTypes.thisSite')}\n description={t('contentTypes.thisSiteDescription', { site: site?.name ?? '' })}\n />\n <RadioTile\n value=\"network\"\n icon={Globe2}\n label={t('contentTypes.allSites')}\n description={t('contentTypes.allSitesDescription')}\n disabled={!canShare}\n />\n </RadioGroup>\n </FieldSet>\n );\n};\n","import type { DefinitionScope } from '@shapio/client';\nimport type { DefinitionKind } from '@shapio/schema';\nimport { Link, type LinkOptions } from '@tanstack/react-router';\nimport type { ReactNode } from 'react';\nimport { useWatch } from 'react-hook-form';\nimport { useTranslation } from 'react-i18next';\nimport { FormError } from '@/components/FormError';\nimport { FormSwitchField } from '@/components/FormSwitchField';\nimport { FormTextareaField } from '@/components/FormTextareaField';\nimport { FormTextField } from '@/components/FormTextField';\nimport { Page } from '@/components/Page';\nimport { PageHeader } from '@/components/PageHeader';\nimport { Panel } from '@/components/Panel';\nimport { SubmitButton } from '@/components/SubmitButton';\nimport { Button } from '@/components/ui/button';\nimport { FieldGroup } from '@/components/ui/field';\nimport { UnsavedChangesGuard } from '@/components/UnsavedChangesGuard';\nimport { useCreateDefinitionForm } from '@/features/Models/hooks/useCreateDefinitionForm';\nimport { useSchemaLock } from '@/features/Models/hooks/useSchemaLock';\nimport { LockNotice } from '@/features/Models/LockNotice';\nimport { cn } from '@/helpers/cn';\nimport { useSchemaScopeAccess } from '@/hooks/useSchemaScopeAccess';\nimport { EndpointPreview } from '../EndpointPreview';\nimport { KindPicker } from '../KindPicker';\nimport { ScopePicker } from '../ScopePicker';\n\ntype FormProps = {\n title: string;\n /** The kinds offered; the picker is hidden when there is only one. */\n kinds: readonly [DefinitionKind, ...DefinitionKind[]];\n /** Where Cancel and the breadcrumb go. */\n back: LinkOptions;\n backLabel: string;\n /** Shown above the form (content types: \"Describe it\", when assist is on). */\n intro?: ReactNode;\n /** A fixed scope hides the \"Available on\" control (the network view creates shared definitions). */\n scope?: DefinitionScope;\n};\n\n/**\n * Creates a content type (collection or single type) or a component, live, then opens it for editing.\n * Shared by `/content/new`, `/develop/components/new` and `/network/content-types/new`. Where there is more\n * than one site, it asks where the definition is available (this site unless \"All sites\" is chosen).\n */\nexport const Form = ({ title, kinds, back, backLabel, intro, scope }: FormProps) => {\n const { t } = useTranslation();\n const { locked, reason } = useSchemaLock();\n const { multiSite, canShare } = useSchemaScopeAccess();\n const { form, onSubmit, pending, error } = useCreateDefinitionForm(kinds[0], scope);\n const [kind, apiKey, pluralApiKey] = useWatch({\n control: form.control,\n name: ['kind', 'apiKey', 'pluralApiKey'],\n });\n const isCollection = kind === 'collection';\n return (\n <Page width=\"narrow\">\n <UnsavedChangesGuard when={form.formState.isDirty} />\n <PageHeader breadcrumb={[{ label: backLabel, link: back }]} title={title} />\n {locked ? <LockNotice reason={reason} /> : null}\n {intro}\n <Panel>\n <form noValidate onSubmit={(event) => void onSubmit(event)}>\n <FieldGroup className=\"gap-5\">\n {kinds.length > 1 ? <KindPicker control={form.control} kinds={kinds} /> : null}\n {scope === undefined && multiSite ? (\n <ScopePicker control={form.control} canShare={canShare} />\n ) : null}\n <FormTextField control={form.control} name=\"label\" label={t('models.label')} autoComplete=\"off\" />\n {/* A collection's two API IDs sit side by side, with the names they produce below both. */}\n <div className={cn('grid items-start gap-5', isCollection && 'sm:grid-cols-2')}>\n <FormTextField\n control={form.control}\n name=\"apiKey\"\n label={t('models.apiKey')}\n hint={t('models.apiKeyHint')}\n autoComplete=\"off\"\n spellCheck={false}\n className=\"font-mono\"\n />\n {isCollection ? (\n <FormTextField\n control={form.control}\n name=\"pluralApiKey\"\n label={t('models.pluralApiKey')}\n hint={t('models.pluralApiKeyHint')}\n autoComplete=\"off\"\n spellCheck={false}\n className=\"font-mono\"\n />\n ) : null}\n </div>\n <EndpointPreview apiKey={apiKey} pluralApiKey={pluralApiKey} kind={kind} />\n <FormTextareaField\n control={form.control}\n name=\"description\"\n label={t('common.optionalLabel', { label: t('models.descriptionLabel') })}\n rows={2}\n />\n {kind === 'component' ? null : (\n <FormSwitchField\n control={form.control}\n name=\"localized\"\n label={t('models.localized')}\n hint={t('models.localizedHint')}\n variant=\"bordered\"\n />\n )}\n <FormError error={error} />\n <div className=\"flex flex-wrap justify-end gap-2\">\n <Button variant=\"outline\" asChild>\n <Link {...back}>{t('common.cancel')}</Link>\n </Button>\n <SubmitButton pending={pending} pendingLabel={t('models.creating')} disabled={locked}>\n {t('common.create')}\n </SubmitButton>\n </div>\n </FieldGroup>\n </form>\n </Panel>\n </Page>\n );\n};\n"],"ignoreList":[0],"mappings":"06CASA,IAAMkF,EAAa,C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CAAM,GAAImJ,EAAO,SAAApE,EAAE,eAAe,CAAQ,CAAA,CACpC,CAAA,GACR,EAAAhB,EAAA,IAAA,CAAC9D,GAAD,CAAuB,UAAS,aAAc8E,EAAE,iBAAiB,EAAG,SAAUqE,EAC3E,SAAArE,EAAE,eAAe,CACN,CAAA,CACX,GACK,GACR,CAAA,CACD,CAAA,CACH,GAEV"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{t}from"./jsx-runtime-DREnUpxT.js";import{c as n,d as r,f as i,o as a,p as o}from"./InfoHint-GJLRVumb.js";import{n as s}from"./ConfirmDialog-B9nWhIIz.js";import{c,r as l}from"./zod-BHAd1wTC.js";var u=[`publish`,`unpublish`],d=[`scheduled`,`done`,`failed`,`cancelled`],f=[`generic_webhook`,`cloudflare_pages`,`vercel`,`netlify`,`github`],p=[`publish`,`change_set`,`schema`,`manual`],m=e(t(),1),h=({control:e,name:t,legend:u,description:d,options:f,disabled:p})=>{let{field:h,fieldState:g}=c({control:e,name:t}),_=h.value??[],v=(e,t)=>h.onChange(t?[..._,e]:_.filter(t=>t!==e)),y=g.error?.message;return(0,m.jsxs)(o,{"data-invalid":g.invalid||void 0,children:[(0,m.jsx)(i,{variant:`label`,children:u}),d?(0,m.jsx)(n,{children:d}):null,(0,m.jsx)(`div`,{"data-slot":`checkbox-group`,className:`grid gap-3 sm:grid-cols-2`,children:f.map(e=>{let n=`field-${t}-${e.value}`;return(0,m.jsxs)(a,{orientation:`horizontal`,children:[(0,m.jsx)(s,{id:n,checked:_.includes(e.value),onCheckedChange:t=>v(e.value,t===!0),onBlur:h.onBlur,disabled:p}),(0,m.jsx)(r,{htmlFor:n,className:`font-normal`,children:e.label})]},e.value)})}),(0,m.jsx)(l,{message:y})]})};export{d as a,u as i,f as n,p as r,h as t};
|
|
2
|
+
//# sourceMappingURL=FormCheckboxGroup-uIC2XQIL.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FormCheckboxGroup-uIC2XQIL.js","names":["__toESM","FieldDescription","FieldLabel","FieldLegend","Field","FieldSet","Checkbox","FormFieldError","PUBLICATION_ACTIONS","SCHEDULE_STATUSES","DEPLOYMENT_PROVIDERS","DEPLOYMENT_TRIGGERS","import_jsx_runtime","require_jsx_runtime","FormCheckboxGroup","useController","selected","field","toggle","checked","value","item","errorMessage","fieldState","legend","description","options","id","name","option"],"sources":["../../../../packages/client/src/admin/publishingTypes.ts","../../src/components/FormCheckboxGroup/index.tsx"],"sourcesContent":["/**\n * Publishing types (package H, `apps/api/src/routes/admin/{jobs,publishing,webhooks,deployments,preview}`).\n * Dates are ISO-8601 strings.\n */\nimport type { SiteRef } from './sitesTypes.js';\n\nexport type Page<T> = { items: T[]; nextCursor: string | null };\n\n// Jobs ---------------------------------------------------------------------------------------------\n\nexport const JOB_STATUSES = ['pending', 'running', 'succeeded', 'dead'] as const;\nexport type JobStatus = (typeof JOB_STATUSES)[number];\n\nexport type Job = {\n id: string;\n type: string;\n status: JobStatus;\n attempts: number;\n maxAttempts: number;\n /** When it runs next (pending) or ran last. */\n runAt: string;\n idempotencyKey: string | null;\n lockedBy: string | null;\n lockedUntil: string | null;\n /** Payload and result with secret-looking values replaced by `[redacted]`. */\n payload: unknown;\n result: unknown;\n /** Progress a long job saved (e.g. an import's phase and counts); null when it saved none. */\n progress: unknown;\n lastError: string | null;\n createdAt: string;\n updatedAt: string;\n finishedAt: string | null;\n};\n\nexport type JobQuery = { status?: JobStatus; type?: string; cursor?: string; limit?: number };\n\nexport type JobSummary = { counts: Record<JobStatus, number>; types: string[] };\n\n// Scheduled publications ---------------------------------------------------------------------------\n\nexport const PUBLICATION_ACTIONS = ['publish', 'unpublish'] as const;\nexport type PublicationAction = (typeof PUBLICATION_ACTIONS)[number];\n\nexport const SCHEDULE_STATUSES = ['scheduled', 'done', 'failed', 'cancelled'] as const;\nexport type ScheduleStatus = (typeof SCHEDULE_STATUSES)[number];\n\nexport type ScheduledPublication = {\n id: string;\n entryId: string;\n modelId: string;\n /** Null when the model no longer exists. */\n modelKey: string | null;\n locale: string;\n action: PublicationAction;\n runAt: string;\n status: ScheduleStatus;\n error: string | null;\n /** Publication sequence the change was published at (once done). */\n snapshot: number | null;\n createdBy: string | null;\n createdAt: string;\n executedAt: string | null;\n};\n\nexport type ScheduleQuery = { status?: ScheduleStatus; entryId?: string; cursor?: string; limit?: number };\n\nexport type CreateScheduleInput = {\n modelKey: string;\n entryId: string;\n /** Omit for non-localized models (and for the default locale). */\n locale?: string;\n action: PublicationAction;\n runAt: string;\n};\n\n// Webhooks -----------------------------------------------------------------------------------------\n\nexport type WebhookEventType = { type: string; group: string };\n\nexport type WebhookDeliveryStatus = 'pending' | 'retrying' | 'succeeded' | 'dead';\n\nexport type Webhook = {\n id: string;\n name: string;\n url: string;\n /** Event types or `group.*` patterns. */\n events: string[];\n enabled: boolean;\n allowPrivateNetwork: boolean;\n maxAttempts: number;\n /** The site whose events it receives; null for a network-wide webhook (every site's events). */\n site: SiteRef | null;\n lastDelivery: { status: WebhookDeliveryStatus; at: string } | null;\n createdBy: string | null;\n createdAt: string;\n updatedAt: string;\n version: number;\n};\n\nexport type CreateWebhookInput = {\n name: string;\n url: string;\n events: string[];\n enabled?: boolean;\n allowPrivateNetwork?: boolean;\n maxAttempts?: number;\n /** A network-wide webhook (every site's events); otherwise it belongs to the request's site. */\n network?: boolean;\n};\n\n/** A webhook's site is fixed once created. */\nexport type UpdateWebhookInput = Partial<Omit<CreateWebhookInput, 'network'>> & { expectedVersion: number };\n\n/** The JSON body every webhook delivery sends (signed; verify it with `verifyWebhookSignature`). */\nexport type WebhookEventBody = {\n id: string;\n type: string;\n createdAt: string;\n /** The site the event is about; null for events about no site (network-wide). */\n site: SiteRef | null;\n data: unknown;\n};\n\n/** `secret` is shown once: on creation and after rotation. */\nexport type WebhookWithSecret = { webhook: Webhook; secret: string };\n\nexport type WebhookAttempt = {\n attempt: number;\n at: string;\n durationMs: number;\n request: { method: string; url: string; headers: Record<string, string> };\n /** Null when no response arrived (refused, timeout, blocked by the network policy). */\n response: { status: number; headers: Record<string, string>; body: string; truncated: boolean } | null;\n error: string | null;\n};\n\nexport type WebhookDelivery = {\n id: string;\n webhookId: string;\n eventId: string | null;\n eventType: string;\n isTest: boolean;\n status: WebhookDeliveryStatus;\n attempts: number;\n lastResponseStatus: number | null;\n lastError: string | null;\n payload: unknown;\n attemptLog: WebhookAttempt[];\n createdAt: string;\n updatedAt: string;\n deliveredAt: string | null;\n};\n\n// Deployments --------------------------------------------------------------------------------------\n\nexport const DEPLOYMENT_PROVIDERS = [\n 'generic_webhook',\n 'cloudflare_pages',\n 'vercel',\n 'netlify',\n 'github',\n] as const;\nexport type DeploymentProvider = (typeof DEPLOYMENT_PROVIDERS)[number];\n\nexport const DEPLOYMENT_TRIGGERS = ['publish', 'change_set', 'schema', 'manual'] as const;\nexport type DeploymentTriggerPolicy = (typeof DEPLOYMENT_TRIGGERS)[number];\n\nexport const DEPLOYMENT_RUN_STATUSES = [\n 'queued',\n 'triggered',\n 'building',\n 'deployed',\n 'failed',\n 'unknown',\n] as const;\nexport type DeploymentRunStatus = (typeof DEPLOYMENT_RUN_STATUSES)[number];\n\nexport type DeploymentRunTrigger = 'publish' | 'change_set' | 'schema' | 'manual' | 'retry';\n\n/**\n * Provider settings (not secret). Generic: `{ url }`. Cloudflare Pages: `{ accountId, projectName }`.\n * GitHub: `{ owner, repo, branch, mode: 'commit' | 'pull_request', directory }`.\n */\nexport type DeploymentSettings = Record<string, string>;\n\n/**\n * Secret names per provider. Generic: `signingSecret` (generated when omitted). Cloudflare Pages:\n * `deployHookUrl`, `apiToken`. GitHub: `token`. Values are write-only. A value of `${ENV:VAR_NAME}`\n * makes the server read the secret from that environment variable instead of storing it.\n */\nexport type DeploymentSecretsInput = Record<string, string>;\n\n/** Which secrets are set; values never leave the server. `envVar`: read from this environment variable. */\nexport type DeploymentSecretState = Record<string, { set: boolean; envVar: string | null }>;\n\nexport type DeploymentTimelineEvent = {\n status: DeploymentRunStatus;\n at: string;\n source: 'shapio' | 'callback' | 'provider';\n message: string | null;\n};\n\nexport type DeploymentRun = {\n id: string;\n connectionId: string;\n connectionName: string;\n provider: DeploymentProvider;\n status: DeploymentRunStatus;\n trigger: DeploymentRunTrigger;\n /** Publication sequence the run was triggered at (`?snapshot=` on delivery). */\n snapshot: number | null;\n schemaVersion: number | null;\n retryOf: string | null;\n providerRef: string | null;\n logUrl: string | null;\n siteUrl: string | null;\n error: string | null;\n /** False for providers that cannot report completion without callbacks (shown as \"completion unknown\"). */\n completionReported: boolean;\n timeline: DeploymentTimelineEvent[];\n triggeredAt: string | null;\n finishedAt: string | null;\n createdAt: string;\n updatedAt: string;\n};\n\nexport type DeploymentConnection = {\n id: string;\n name: string;\n provider: DeploymentProvider;\n settings: DeploymentSettings;\n secrets: DeploymentSecretState;\n previewUrlTemplate: string | null;\n /** Preview tokens issued for this connection show exactly what this delivery role reads. */\n deliveryRoleId: string | null;\n triggerPolicy: DeploymentTriggerPolicy[];\n debounceSeconds: number;\n allowPrivateNetwork: boolean;\n enabled: boolean;\n /** Where the site posts signed build callbacks (generic webhook connections). */\n callbackUrl: string;\n latestRun: DeploymentRun | null;\n /** The newest deployed run by snapshot: what the site is serving, as far as Shapio knows. */\n currentRun: DeploymentRun | null;\n createdBy: string | null;\n createdAt: string;\n updatedAt: string;\n version: number;\n};\n\nexport type CreateDeploymentConnectionInput = {\n name: string;\n provider: DeploymentProvider;\n settings: DeploymentSettings;\n secrets: DeploymentSecretsInput;\n previewUrlTemplate?: string | null;\n triggerPolicy: DeploymentTriggerPolicy[];\n debounceSeconds?: number;\n allowPrivateNetwork?: boolean;\n enabled?: boolean;\n deliveryRoleId?: string | null;\n};\n\nexport type UpdateDeploymentConnectionInput = Partial<Omit<CreateDeploymentConnectionInput, 'provider'>> & {\n expectedVersion: number;\n};\n\n/** `generatedSecrets` holds secrets Shapio generated (the generic signing secret), shown once. */\nexport type DeploymentConnectionCreated = {\n connection: DeploymentConnection;\n generatedSecrets: Record<string, string>;\n};\n\nexport type ConnectionTestResult = {\n ok: boolean;\n checks: Array<{ name: string; ok: boolean; message: string }>;\n};\n\nexport type DeploymentRunQuery = { connectionId?: string; cursor?: string; limit?: number };\n\n// Preview ------------------------------------------------------------------------------------------\n\nexport type PreviewToken = {\n id: string;\n tokenPrefix: string;\n modelId: string;\n modelKey: string | null;\n entryId: string | null;\n locale: string | null;\n connectionId: string | null;\n /** Fields follow this delivery role (within the creator's access); null = the public fields. */\n deliveryRoleId: string | null;\n createdBy: string;\n expiresAt: string;\n revokedAt: string | null;\n lastUsedAt: string | null;\n createdAt: string;\n};\n\nexport type CreatePreviewTokenInput = {\n modelKey: string;\n entryId?: string;\n locale?: string;\n /** Default 1 hour, at most 30 days. */\n ttlSeconds?: number;\n connectionId?: string;\n /** Defaults to the connection's delivery role. */\n deliveryRoleId?: string;\n};\n\n/** `token` is shown once. `url` is rendered from the connection's preview URL template (null without one). */\nexport type PreviewTokenCreated = { token: string; previewToken: PreviewToken; url: string | null };\n\nexport type OpenPreviewInput = {\n modelKey: string;\n entryId: string;\n locale?: string;\n /** Defaults to the first enabled connection with a preview URL template. */\n connectionId?: string;\n};\n\n/** What the entry form's Preview button opens. `apiUrl` is the preview read endpoint for this entry. */\nexport type OpenPreviewResult = {\n /** The token's ID (revoke it when the preview closes). */\n id: string;\n url: string | null;\n apiUrl: string;\n token: string;\n expiresAt: string;\n connectionId: string | null;\n};\n\n/** A connection the site's previews open on (names and origins only). */\nexport type PreviewTarget = {\n connectionId: string;\n name: string;\n /** null when the preview URL template's origin depends on a variable. */\n origin: string | null;\n /** Whether the admin can show it in its preview frame. */\n framable: boolean;\n};\n","import { useController, type Control, type FieldPath, type FieldValues } from 'react-hook-form';\nimport { Checkbox } from '@/components/ui/checkbox';\nimport { Field, FieldDescription, FieldLabel, FieldLegend, FieldSet } from '@/components/ui/field';\nimport { FormFieldError } from '../FormFieldError';\n\nexport type CheckboxOption = { value: string; label: string; description?: string };\n\ntype FormCheckboxGroupProps<TValues extends FieldValues> = {\n control: Control<TValues>;\n name: FieldPath<TValues>;\n legend: string;\n description?: string;\n options: readonly CheckboxOption[];\n disabled?: boolean;\n};\n\n/** A fieldset of checkboxes bound to a `string[]` form value. */\nexport const FormCheckboxGroup = <TValues extends FieldValues>({\n control,\n name,\n legend,\n description,\n options,\n disabled,\n}: FormCheckboxGroupProps<TValues>) => {\n const { field, fieldState } = useController({ control, name });\n const selected = (field.value as string[] | undefined) ?? [];\n const toggle = (value: string, checked: boolean) =>\n field.onChange(checked ? [...selected, value] : selected.filter((item) => item !== value));\n const errorMessage = fieldState.error?.message;\n return (\n <FieldSet data-invalid={fieldState.invalid || undefined}>\n <FieldLegend variant=\"label\">{legend}</FieldLegend>\n {description ? <FieldDescription>{description}</FieldDescription> : null}\n <div data-slot=\"checkbox-group\" className=\"grid gap-3 sm:grid-cols-2\">\n {options.map((option) => {\n const id = `field-${name}-${option.value}`;\n return (\n <Field key={option.value} orientation=\"horizontal\">\n <Checkbox\n id={id}\n checked={selected.includes(option.value)}\n onCheckedChange={(checked) => toggle(option.value, checked === true)}\n onBlur={field.onBlur}\n disabled={disabled}\n />\n <FieldLabel htmlFor={id} className=\"font-normal\">\n {option.label}\n </FieldLabel>\n </Field>\n );\n })}\n </div>\n <FormFieldError message={errorMessage} />\n </FieldSet>\n );\n};\n"],"mappings":"2PAyCA,IAAaQ,EAAsB,CAAC,UAAW,WAAW,EAG7CC,EAAoB,CAAC,YAAa,OAAQ,SAAU,WAAW,EAgH/DC,EAAuB,CAClC,kBACA,mBACA,SACA,UACA,QACF,EAGaC,EAAsB,CAAC,UAAW,aAAc,SAAU,QAAQ,aCpJlEG,GAAkD,CAC7D,UACA,OACA,SACA,cACA,UACA,cACqC,CACrC,GAAM,CAAE,QAAO,cAAeC,EAAc,CAAE,UAAS,MAAK,CAAC,EACvDC,EAAYC,EAAM,OAAkC,CAAC,EACrDC,GAAU,EAAe,IAC7BD,EAAM,SAASE,EAAU,CAAC,GAAGH,EAAUI,CAAK,EAAIJ,EAAS,OAAQ,GAASK,IAASD,CAAK,CAAC,EACrFE,EAAeC,EAAW,OAAO,QACvC,OACE,EAAAX,EAAA,KAAA,CAACP,EAAD,CAAU,eAAckB,EAAW,SAAW,IAAA,GAA9C,SAAA,EACE,EAAAX,EAAA,IAAA,CAACT,EAAD,CAAa,QAAQ,QAAS,SAAAqB,CAAoB,CAAA,EACjDC,GAAc,EAAAb,EAAA,IAAA,CAACX,EAAD,CAAA,SAAmBwB,CAA8B,CAAA,EAAI,MACpE,EAAAb,EAAA,IAAA,CAAC,MAAD,CAAK,YAAU,iBAAiB,UAAU,4BACvC,SAAAc,EAAQ,IAAK,GAAW,CACvB,IAAMC,EAAK,SAASC,EAAK,GAAGC,EAAO,QACnC,OACE,EAAAjB,EAAA,KAAA,CAACR,EAAD,CAA0B,YAAY,aAAtC,SAAA,EACE,EAAAQ,EAAA,IAAA,CAACN,EAAD,CACM,KACJ,QAASU,EAAS,SAASa,EAAO,KAAK,EACvC,gBAAkB,GAAYX,EAAOW,EAAO,MAAOV,IAAY,EAAI,EACnE,OAAQF,EAAM,OACJ,UACX,CAAA,GACD,EAAAL,EAAA,IAAA,CAACV,EAAD,CAAY,QAASyB,EAAI,UAAU,cAChC,SAAAE,EAAO,KACE,CAAA,CACP,CAXK,EAAAA,EAAO,KAWZ,CAEX,CAAC,CACE,CAAA,GACL,EAAAjB,EAAA,IAAA,CAACL,EAAD,CAAgB,QAASe,CAAe,CAAA,CAChC,GAEd"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{t}from"./jsx-runtime-DREnUpxT.js";import{c as n,d as r,f as i,o as a,p as o,s}from"./InfoHint-GJLRVumb.js";import{n as c,t as l}from"./radio-group-DHIxK-IU.js";import{c as u,r as d}from"./zod-BHAd1wTC.js";var f=e(t(),1),p=({control:e,name:t,legend:p,options:m,disabled:h})=>{let{field:g,fieldState:_}=u({control:e,name:t}),v=`field-${t}-legend`,y=`field-${t}-error`,b=_.error?.message;return(0,f.jsxs)(o,{"data-invalid":_.invalid||void 0,children:[(0,f.jsx)(i,{id:v,variant:`label`,children:p}),(0,f.jsx)(l,{"aria-labelledby":v,"aria-describedby":b?y:void 0,"aria-invalid":_.invalid||void 0,value:g.value??``,onValueChange:g.onChange,onBlur:g.onBlur,disabled:h,children:m.map(e=>{let i=`field-${t}-${e.value}`,o=e.description?`${i}-description`:void 0;return(0,f.jsxs)(a,{orientation:`horizontal`,children:[(0,f.jsx)(c,{id:i,value:e.value,"aria-describedby":o}),(0,f.jsxs)(s,{children:[(0,f.jsx)(r,{htmlFor:i,className:`font-normal`,children:e.label}),e.description?(0,f.jsx)(n,{id:o,children:e.description}):null]})]},e.value)})}),(0,f.jsx)(d,{id:y,message:b})]})};export{p as t};
|
|
2
|
+
//# sourceMappingURL=FormRadioGroup-hd95vPOu.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FormRadioGroup-hd95vPOu.js","names":["__toESM","FieldDescription","FieldLabel","FieldLegend","Field","FieldSet","RadioGroupItem","RadioGroup","useController","FormFieldError","import_jsx_runtime","require_jsx_runtime","FormRadioGroup","legendId","name","errorId","errorMessage","fieldState","legend","field","options","id","option","descriptionId","FieldContent"],"sources":["../../src/components/FormRadioGroup/index.tsx"],"sourcesContent":["import { useController, type Control, type FieldPath, type FieldValues } from 'react-hook-form';\nimport {\n Field,\n FieldContent,\n FieldDescription,\n FieldLabel,\n FieldLegend,\n FieldSet,\n} from '@/components/ui/field';\nimport { RadioGroup, RadioGroupItem } from '@/components/ui/radio-group';\nimport { FormFieldError } from '../FormFieldError';\n\nexport type RadioOption = { value: string; label: string; description?: string };\n\ntype FormRadioGroupProps<TValues extends FieldValues> = {\n control: Control<TValues>;\n name: FieldPath<TValues>;\n legend: string;\n options: readonly RadioOption[];\n disabled?: boolean;\n};\n\n/**\n * A fieldset of radio buttons bound to a `string` form value: exactly one choice. Arrow keys move between\n * options and Tab enters at the checked one; each option's description is linked to its radio.\n */\nexport const FormRadioGroup = <TValues extends FieldValues>({\n control,\n name,\n legend,\n options,\n disabled,\n}: FormRadioGroupProps<TValues>) => {\n const { field, fieldState } = useController({ control, name });\n const legendId = `field-${name}-legend`;\n const errorId = `field-${name}-error`;\n const errorMessage = fieldState.error?.message;\n return (\n <FieldSet data-invalid={fieldState.invalid || undefined}>\n <FieldLegend id={legendId} variant=\"label\">\n {legend}\n </FieldLegend>\n <RadioGroup\n aria-labelledby={legendId}\n aria-describedby={errorMessage ? errorId : undefined}\n aria-invalid={fieldState.invalid || undefined}\n value={field.value ?? ''}\n onValueChange={field.onChange}\n onBlur={field.onBlur}\n disabled={disabled}\n >\n {options.map((option) => {\n const id = `field-${name}-${option.value}`;\n const descriptionId = option.description ? `${id}-description` : undefined;\n return (\n <Field key={option.value} orientation=\"horizontal\">\n <RadioGroupItem id={id} value={option.value} aria-describedby={descriptionId} />\n <FieldContent>\n <FieldLabel htmlFor={id} className=\"font-normal\">\n {option.label}\n </FieldLabel>\n {option.description ? (\n <FieldDescription id={descriptionId}>{option.description}</FieldDescription>\n ) : null}\n </FieldContent>\n </Field>\n );\n })}\n </RadioGroup>\n <FormFieldError id={errorId} message={errorMessage} />\n </FieldSet>\n );\n};\n"],"mappings":"sRA0BaY,GAA+C,CAC1D,UACA,OACA,SACA,UACA,cACkC,CAClC,GAAM,CAAE,QAAO,cAAeJ,EAAc,CAAE,UAAS,MAAK,CAAC,EACvDK,EAAW,SAASC,EAAK,SACzBC,EAAU,SAASD,EAAK,QACxBE,EAAeC,EAAW,OAAO,QACvC,OACE,EAAAP,EAAA,KAAA,CAACL,EAAD,CAAU,eAAcY,EAAW,SAAW,IAAA,GAA9C,SAAA,EACE,EAAAP,EAAA,IAAA,CAACP,EAAD,CAAa,GAAIU,EAAU,QAAQ,QAChC,SAAAK,CACU,CAAA,GACb,EAAAR,EAAA,IAAA,CAACH,EAAD,CACE,kBAAiBM,EACjB,mBAAkBG,EAAeD,EAAU,IAAA,GAC3C,eAAcE,EAAW,SAAW,IAAA,GACpC,MAAOE,EAAM,OAAS,GACtB,cAAeA,EAAM,SACrB,OAAQA,EAAM,OACJ,WAET,SAAAC,EAAQ,IAAK,GAAW,CACvB,IAAMC,EAAK,SAASP,EAAK,GAAGQ,EAAO,QAC7BC,EAAgBD,EAAO,YAAc,GAAGD,EAAG,cAAgB,IAAA,GACjE,OACE,EAAAX,EAAA,KAAA,CAACN,EAAD,CAA0B,YAAY,aAAtC,SAAA,EACE,EAAAM,EAAA,IAAA,CAACJ,EAAD,CAAoB,KAAI,MAAOgB,EAAO,MAAO,mBAAkBC,CAAgB,CAAA,GAC/E,EAAAb,EAAA,KAAA,CAACc,EAAD,CAAA,SAAA,EACE,EAAAd,EAAA,IAAA,CAACR,EAAD,CAAY,QAASmB,EAAI,UAAU,cAChC,SAAAC,EAAO,KACE,CAAA,EACXA,EAAO,aACN,EAAAZ,EAAA,IAAA,CAACT,EAAD,CAAkB,GAAIsB,EAAgB,SAAAD,EAAO,WAA8B,CAAA,EACzE,IACQ,CAAA,CAAA,CACT,CAVK,EAAAA,EAAO,KAUZ,CAEX,CAAC,CACS,CAAA,GACZ,EAAAZ,EAAA,IAAA,CAACD,EAAD,CAAgB,GAAIM,EAAS,QAASC,CAAe,CAAA,CAC7C,GAEd"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{t}from"./jsx-runtime-DREnUpxT.js";import{j as n,t as r}from"./cn-BQ3voEft.js";import{_ as i,c as a,d as o,f as s,m as c,p as l,u}from"./badge-DD0mE96i.js";import{c as d,o as f,u as p}from"./InfoHint-GJLRVumb.js";import{i as m}from"./skeleton-C3QLIh7W.js";import{a as h,i as g,n as _,r as v,t as y}from"./select-tHVWX85X.js";import{c as b,r as x}from"./zod-BHAd1wTC.js";import{n as S}from"./settle-LRKtTN_e.js";import{t as C}from"./HintedLabel-CvC46uy_.js";import{t as w}from"./useDiscardGuard-34ynGJIk.js";var T=e(t(),1),E=({open:e,onOpenChange:t,title:d,description:f,dirty:h,pending:g,submitLabel:_,pendingLabel:v,onSubmit:y,size:b,bodyClassName:x,onCloseAutoFocus:S,children:C})=>{let{t:E}=n(),{requestOpenChange:D,discardPrompt:O}=w({dirty:h,pending:g,onOpenChange:t});return(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(a,{open:e,onOpenChange:D,children:(0,T.jsxs)(u,{size:b,...f?{}:{"aria-describedby":void 0},...S?{onCloseAutoFocus:S}:{},children:[(0,T.jsxs)(l,{className:`pr-14`,children:[(0,T.jsx)(c,{children:d}),f?(0,T.jsx)(o,{children:f}):null]}),(0,T.jsxs)(`form`,{noValidate:!0,onSubmit:y,className:`flex min-h-0 flex-1 flex-col`,children:[(0,T.jsx)(p,{className:r(`relative min-h-0 flex-1 gap-5 overflow-y-auto px-6 pt-1 pb-6`,x),children:C}),(0,T.jsxs)(s,{children:[(0,T.jsx)(m,{type:`button`,variant:`outline`,onClick:()=>D(!1),children:E(`common.cancel`)}),(0,T.jsx)(i,{pending:g,pendingLabel:v,children:_})]})]})]})}),O]})},D=({control:e,name:t,label:n,hint:r,description:i,placeholder:a,options:o,disabled:s})=>{let{field:{ref:c,onBlur:l,onChange:u,value:p,name:m},fieldState:w}=b({control:e,name:t}),E=`field-${t}`,D=w.error?.message,O=r?`${E}-hint`:void 0;return(0,T.jsxs)(f,{"data-invalid":w.invalid||void 0,children:[(0,T.jsx)(C,{htmlFor:E,label:n,hint:r,hintId:O}),(0,T.jsxs)(y,{name:m,value:typeof p==`string`?p:``,onValueChange:u,disabled:s,children:[(0,T.jsx)(g,{id:E,ref:c,onBlur:l,"aria-invalid":w.invalid||void 0,"aria-describedby":S(O,i&&`${E}-description`,D&&`${E}-error`),className:`w-full`,children:(0,T.jsx)(h,{placeholder:a})}),(0,T.jsx)(_,{children:o.map(e=>(0,T.jsx)(v,{value:e.value,children:e.label},e.value))})]}),i?(0,T.jsx)(d,{id:`${E}-description`,children:i}):null,(0,T.jsx)(x,{id:`${E}-error`,message:D})]})};export{E as n,D as t};
|
|
2
|
+
//# sourceMappingURL=FormSelectField-D7VHmnx5.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FormSelectField-D7VHmnx5.js","names":["_Fragment","__toESM","useTranslation","cn","SubmitButton","Sheet","SheetDescription","SheetFooter","SheetTitle","SheetHeader","FieldDescription","Field","FieldGroup","Button","SelectValue","SelectTrigger","SelectContent","SelectItem","Select","useController","FormFieldError","describedBy","HintedLabel","useDiscardGuard","import_jsx_runtime","require_jsx_runtime","FormSheet","requestOpenChange","SheetContent","description","onCloseAutoFocus","title","bodyClassName","t","submitLabel","discardPrompt","FormSelectField","fieldName","id","name","errorMessage","fieldState","hintId","hint","value","onChange","options","option"],"sources":["../../src/components/FormSheet/index.tsx","../../src/components/FormSelectField/index.tsx"],"sourcesContent":["import type { FormEventHandler, ReactNode } from 'react';\nimport { useTranslation } from 'react-i18next';\nimport { Button } from '@/components/ui/button';\nimport { FieldGroup } from '@/components/ui/field';\nimport {\n Sheet,\n SheetContent,\n SheetDescription,\n SheetFooter,\n SheetHeader,\n SheetTitle,\n} from '@/components/ui/sheet';\nimport { cn } from '@/helpers/cn';\nimport { useDiscardGuard } from '@/hooks/useDiscardGuard';\nimport { SubmitButton } from '../SubmitButton';\n\ntype FormSheetProps = {\n open: boolean;\n onOpenChange: (open: boolean) => void;\n title: string;\n description?: string;\n /** Unsaved edits: closing asks before discarding them. */\n dirty: boolean;\n pending: boolean;\n submitLabel: string;\n pendingLabel: string;\n onSubmit: FormEventHandler<HTMLFormElement>;\n /** sm 400px (default), md 560px, lg 720px from the sm breakpoint; full width on phones. */\n size?: 'sm' | 'md' | 'lg';\n /** Layout overrides for the scrolling body (e.g. a split layout whose panes scroll on their own). */\n bodyClassName?: string;\n /**\n * Runs as the sheet finishes closing, before focus returns to the opener. Call `event.preventDefault()` to\n * keep focus where it is (e.g. on a `SecretReveal` that took it).\n */\n onCloseAutoFocus?: (event: Event) => void;\n children: ReactNode;\n};\n\n/**\n * A form in a right-hand sheet: create or edit a record while the list stays in view. Labelled,\n * keyboard-closable and protected against losing unsaved edits; the header and the footer (Cancel, then the\n * primary action) stay put while a long body scrolls.\n */\nexport const FormSheet = ({\n open,\n onOpenChange,\n title,\n description,\n dirty,\n pending,\n submitLabel,\n pendingLabel,\n onSubmit,\n size,\n bodyClassName,\n onCloseAutoFocus,\n children,\n}: FormSheetProps) => {\n const { t } = useTranslation();\n const { requestOpenChange, discardPrompt } = useDiscardGuard({ dirty, pending, onOpenChange });\n return (\n <>\n <Sheet open={open} onOpenChange={requestOpenChange}>\n <SheetContent\n size={size}\n {...(description ? {} : { 'aria-describedby': undefined })}\n {...(onCloseAutoFocus ? { onCloseAutoFocus } : {})}\n >\n <SheetHeader className=\"pr-14\">\n <SheetTitle>{title}</SheetTitle>\n {description ? <SheetDescription>{description}</SheetDescription> : null}\n </SheetHeader>\n <form noValidate onSubmit={onSubmit} className=\"flex min-h-0 flex-1 flex-col\">\n {/* The scrolling body is the field group itself, so `bodyClassName` lays out the fields. */}\n <FieldGroup\n className={cn('relative min-h-0 flex-1 gap-5 overflow-y-auto px-6 pt-1 pb-6', bodyClassName)}\n >\n {children}\n </FieldGroup>\n <SheetFooter>\n <Button type=\"button\" variant=\"outline\" onClick={() => requestOpenChange(false)}>\n {t('common.cancel')}\n </Button>\n <SubmitButton pending={pending} pendingLabel={pendingLabel}>\n {submitLabel}\n </SubmitButton>\n </SheetFooter>\n </form>\n </SheetContent>\n </Sheet>\n {discardPrompt}\n </>\n );\n};\n","import { useController, type Control, type FieldPath, type FieldValues } from 'react-hook-form';\nimport { Field, FieldDescription } from '@/components/ui/field';\nimport { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@/components/ui/select';\nimport { describedBy } from '@/helpers/describedBy';\nimport { FormFieldError } from '../FormFieldError';\nimport { HintedLabel } from '../HintedLabel';\n\nexport type SelectOption = { value: string; label: string };\n\ntype FormSelectFieldProps<TValues extends FieldValues> = {\n control: Control<TValues>;\n name: FieldPath<TValues>;\n label: string;\n /** Explanation behind an info icon next to the label (DESIGN.md, helper-text rule). */\n hint?: string;\n description?: string;\n placeholder?: string;\n options: readonly SelectOption[];\n disabled?: boolean;\n};\n\nexport const FormSelectField = <TValues extends FieldValues>({\n control,\n name,\n label,\n hint,\n description,\n placeholder,\n options,\n disabled,\n}: FormSelectFieldProps<TValues>) => {\n const {\n field: { ref, onBlur, onChange, value, name: fieldName },\n fieldState,\n } = useController({ control, name });\n const id = `field-${name}`;\n const errorMessage = fieldState.error?.message;\n const hintId = hint ? `${id}-hint` : undefined;\n return (\n <Field data-invalid={fieldState.invalid || undefined}>\n <HintedLabel htmlFor={id} label={label} hint={hint} hintId={hintId} />\n <Select\n name={fieldName}\n value={typeof value === 'string' ? value : ''}\n onValueChange={onChange}\n disabled={disabled}\n >\n <SelectTrigger\n id={id}\n ref={ref}\n onBlur={onBlur}\n aria-invalid={fieldState.invalid || undefined}\n aria-describedby={describedBy(\n hintId,\n description && `${id}-description`,\n errorMessage && `${id}-error`,\n )}\n className=\"w-full\"\n >\n <SelectValue placeholder={placeholder} />\n </SelectTrigger>\n <SelectContent>\n {options.map((option) => (\n <SelectItem key={option.value} value={option.value}>\n {option.label}\n </SelectItem>\n ))}\n </SelectContent>\n </Select>\n {description ? <FieldDescription id={`${id}-description`}>{description}</FieldDescription> : null}\n <FormFieldError id={`${id}-error`} message={errorMessage} />\n </Field>\n );\n};\n"],"mappings":"mkBA4Ca0B,GAAa,CACxB,OACA,eACA,QACA,cACA,QACA,UACA,cACA,eACA,WACA,OACA,gBACA,mBACA,cACoB,CACpB,GAAM,CAAE,KAAMxB,EAAe,EACvB,CAAE,oBAAmB,iBAAkBqB,EAAgB,CAAE,QAAO,UAAS,cAAa,CAAC,EAC7F,OACE,EAAAC,EAAA,KAAA,CAAAxB,EAAAA,SAA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A,GACrC,OACE,EAAAd,EAAA,KAAA,CAACb,EAAD,CAAO,eAAc8B,EAAW,SAAW,IAAA,GAA3C,SAAA,EACE,EAAAjB,EAAA,IAAA,CAACF,EAAD,CAAa,QAASgB,EAAW,QAAa,OAAc,QAAS,CAAA,GACrE,EAAAd,EAAA,KAAA,CAACN,EAAD,CACE,KAAMmB,EACN,MAAO,OAAOO,GAAU,SAAWA,EAAQ,GAC3C,cAAeC,EACL,WAJZ,SAAA,EAME,EAAArB,EAAA,IAAA,CAACT,EAAD,CACM,KACC,MACG,SACR,eAAc0B,EAAW,SAAW,IAAA,GACpC,mBAAkBpB,EAChBqB,EACAb,GAAe,GAAGS,EAAG,cACrBE,GAAgB,GAAGF,EAAG,OACxB,EACA,UAAU,SAEV,UAAA,EAAAd,EAAA,IAAA,CAACV,EAAD,CAA0B,aAAc,CAAA,CAC3B,CAAA,GACf,EAAAU,EAAA,IAAA,CAACR,EAAD,CAAA,SACG8B,EAAQ,IAAK,IACZ,EAAAtB,EAAA,IAAA,CAACP,EAAD,CAA+B,MAAO8B,EAAO,MAC1C,SAAAA,EAAO,KACE,EAFKA,EAAO,KAEZ,CACb,CACY,CAAA,CACT,IACPlB,GAAc,EAAAL,EAAA,IAAA,CAACd,EAAD,CAAkB,GAAI,GAAG4B,EAAG,cAAgB,SAAAT,CAA8B,CAAA,EAAI,MAC7F,EAAAL,EAAA,IAAA,CAACJ,EAAD,CAAgB,GAAI,GAAGkB,EAAG,QAAS,QAASE,CAAe,CAAA,CACtD,GAEX"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{t}from"./jsx-runtime-DREnUpxT.js";import{c as n,o as r,s as i}from"./InfoHint-GJLRVumb.js";import{E as a}from"./skeleton-C3QLIh7W.js";import{t as o}from"./switch-BVy02Vc8.js";import{c as s,r as c}from"./zod-BHAd1wTC.js";import{n as l}from"./settle-LRKtTN_e.js";import{t as u}from"./HintedLabel-CvC46uy_.js";var d=e(t(),1),f=a(``,{variants:{variant:{plain:``,bordered:`gap-4 rounded-lg border bg-card p-4`}},defaultVariants:{variant:`plain`}}),p=({control:e,name:t,label:a,hint:p,description:m,disabled:h,variant:g})=>{let{field:{ref:_,onBlur:v,onChange:y,value:b,name:x},fieldState:S}=s({control:e,name:t}),C=`field-${t}`,w=p?`${C}-hint`:void 0,T=m?`${C}-description`:void 0;return(0,d.jsxs)(r,{orientation:`horizontal`,className:f({variant:g}),"data-invalid":S.invalid||void 0,children:[(0,d.jsxs)(i,{children:[(0,d.jsx)(u,{htmlFor:C,label:a,hint:p,hintId:w}),m?(0,d.jsx)(n,{id:T,children:m}):null,(0,d.jsx)(c,{id:`${C}-error`,message:S.error?.message})]}),(0,d.jsx)(o,{id:C,ref:_,name:x,checked:b===!0,onCheckedChange:y,onBlur:v,disabled:h,"aria-describedby":l(w,T)})]})};export{p as t};
|
|
2
|
+
//# sourceMappingURL=FormSwitchField-ft8Jbe6E.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FormSwitchField-ft8Jbe6E.js","names":["__toESM","FieldDescription","Field","FieldContent","cva","Switch","useController","FormFieldError","describedBy","HintedLabel","import_jsx_runtime","require_jsx_runtime","switchFieldVariants","FormSwitchField","fieldName","id","name","hintId","hint","descriptionId","description","fieldState","value","onChange"],"sources":["../../src/components/FormSwitchField/index.tsx"],"sourcesContent":["import { cva } from 'class-variance-authority';\nimport { useController, type Control, type FieldPath, type FieldValues } from 'react-hook-form';\nimport { Field, FieldContent, FieldDescription } from '@/components/ui/field';\nimport { Switch } from '@/components/ui/switch';\nimport { describedBy } from '@/helpers/describedBy';\nimport { FormFieldError } from '../FormFieldError';\nimport { HintedLabel } from '../HintedLabel';\n\nconst switchFieldVariants = cva('', {\n variants: {\n variant: {\n plain: '',\n /** A bordered row: label and hint on the left, the switch on the right. */\n bordered: 'gap-4 rounded-lg border bg-card p-4',\n },\n },\n defaultVariants: { variant: 'plain' },\n});\n\ntype FormSwitchFieldProps<TValues extends FieldValues> = {\n control: Control<TValues>;\n name: FieldPath<TValues>;\n label: string;\n /** Explanation behind an info icon next to the label (DESIGN.md, helper-text rule). */\n hint?: string;\n description?: string;\n disabled?: boolean;\n variant?: 'plain' | 'bordered';\n};\n\n/** An on/off setting bound to a boolean form value, with its label and hint beside the switch. */\nexport const FormSwitchField = <TValues extends FieldValues>({\n control,\n name,\n label,\n hint,\n description,\n disabled,\n variant,\n}: FormSwitchFieldProps<TValues>) => {\n const {\n field: { ref, onBlur, onChange, value, name: fieldName },\n fieldState,\n } = useController({ control, name });\n const id = `field-${name}`;\n const hintId = hint ? `${id}-hint` : undefined;\n const descriptionId = description ? `${id}-description` : undefined;\n return (\n <Field\n orientation=\"horizontal\"\n className={switchFieldVariants({ variant })}\n data-invalid={fieldState.invalid || undefined}\n >\n <FieldContent>\n <HintedLabel htmlFor={id} label={label} hint={hint} hintId={hintId} />\n {description ? <FieldDescription id={descriptionId}>{description}</FieldDescription> : null}\n <FormFieldError id={`${id}-error`} message={fieldState.error?.message} />\n </FieldContent>\n <Switch\n id={id}\n ref={ref}\n name={fieldName}\n checked={value === true}\n onCheckedChange={onChange}\n onBlur={onBlur}\n disabled={disabled}\n aria-describedby={describedBy(hintId, descriptionId)}\n />\n </Field>\n );\n};\n"],"mappings":"4XAQMY,EAAsBR,EAAI,GAAI,CAClC,SAAU,CACR,QAAS,CACP,MAAO,GAEP,SAAU,qCACZ,CACF,EACA,gBAAiB,CAAE,QAAS,OAAQ,CACtC,CAAC,EAcYS,GAAgD,CAC3D,UACA,OACA,QACA,OACA,cACA,WACA,aACmC,CACnC,GAAM,CACJ,MAAO,CAAE,MAAK,SAAQ,WAAU,QAAO,KAAMC,GAC7C,cACER,EAAc,CAAE,UAAS,MAAK,CAAC,EAC7BS,EAAK,SAASC,IACdC,EAASC,EAAO,GAAGH,EAAG,OAAS,IAAA,GAC/BI,EAAgBC,EAAc,GAAGL,EAAG,cAAgB,IAAA,GAC1D,OACE,EAAAL,EAAA,KAAA,CAACR,EAAD,CACE,YAAY,aACZ,UAAWU,EAAoB,CAAE,SAAQ,CAAC,EAC1C,eAAcS,EAAW,SAAW,IAAA,GAHtC,SAAA,EAKE,EAAAX,EAAA,KAAA,CAACP,EAAD,CAAA,SAAA,EACE,EAAAO,EAAA,IAAA,CAACD,EAAD,CAAa,QAASM,EAAW,QAAa,OAAc,QAAS,CAAA,EACpEK,GAAc,EAAAV,EAAA,IAAA,CAACT,EAAD,CAAkB,GAAIkB,EAAgB,SAAAC,CAA8B,CAAA,EAAI,MACvF,EAAAV,EAAA,IAAA,CAACH,EAAD,CAAgB,GAAI,GAAGQ,EAAG,QAAS,QAASM,EAAW,OAAO,OAAU,CAAA,CAC5D,CAAA,CAAA,GACd,EAAAX,EAAA,IAAA,CAACL,EAAD,CACM,KACC,MACL,KAAMS,EACN,QAASQ,IAAU,GACnB,gBAAiBC,EACT,SACE,WACV,mBAAkBf,EAAYS,EAAQE,CAAa,CACpD,CAAA,CACI,GAEX"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{t}from"./jsx-runtime-DREnUpxT.js";import{o as n}from"./InfoHint-GJLRVumb.js";import{c as r,r as i}from"./zod-BHAd1wTC.js";import{n as a}from"./settle-LRKtTN_e.js";import{t as o}from"./HintedLabel-CvC46uy_.js";import{t as s}from"./textarea-B8Vl5gJ1.js";var c=e(t(),1),l=({control:e,name:t,label:l,hint:u,...d})=>{let{field:f,fieldState:p}=r({control:e,name:t}),m=`field-${t}`,h=p.error?.message,g=u?`${m}-hint`:void 0;return(0,c.jsxs)(n,{"data-invalid":p.invalid||void 0,children:[(0,c.jsx)(o,{htmlFor:m,label:l,hint:u,hintId:g}),(0,c.jsx)(s,{...d,...f,value:f.value??``,id:m,"aria-invalid":p.invalid||void 0,"aria-describedby":a(g,h&&`${m}-error`)}),(0,c.jsx)(i,{id:`${m}-error`,message:h})]})};export{l as t};
|
|
2
|
+
//# sourceMappingURL=FormTextareaField-DzyOzfZb.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FormTextareaField-DzyOzfZb.js","names":["__toESM","Field","useController","FormFieldError","describedBy","HintedLabel","Textarea","import_jsx_runtime","require_jsx_runtime","FormTextareaField","textareaProps","id","name","errorMessage","fieldState","hintId","hint","field"],"sources":["../../src/components/FormTextareaField/index.tsx"],"sourcesContent":["import type { ComponentProps } from 'react';\nimport { useController, type Control, type FieldPath, type FieldValues } from 'react-hook-form';\nimport { Field } from '@/components/ui/field';\nimport { Textarea } from '@/components/ui/textarea';\nimport { describedBy } from '@/helpers/describedBy';\nimport { FormFieldError } from '../FormFieldError';\nimport { HintedLabel } from '../HintedLabel';\n\ntype TextareaProps = Omit<ComponentProps<typeof Textarea>, 'name' | 'value' | 'onChange' | 'onBlur' | 'id'>;\n\ntype FormTextareaFieldProps<TValues extends FieldValues> = TextareaProps & {\n control: Control<TValues>;\n name: FieldPath<TValues>;\n label: string;\n /** Explanation behind an info icon next to the label (DESIGN.md, helper-text rule). */\n hint?: string;\n};\n\nexport const FormTextareaField = <TValues extends FieldValues>({\n control,\n name,\n label,\n hint,\n ...textareaProps\n}: FormTextareaFieldProps<TValues>) => {\n const { field, fieldState } = useController({ control, name });\n const id = `field-${name}`;\n const errorMessage = fieldState.error?.message;\n const hintId = hint ? `${id}-hint` : undefined;\n return (\n <Field data-invalid={fieldState.invalid || undefined}>\n <HintedLabel htmlFor={id} label={label} hint={hint} hintId={hintId} />\n <Textarea\n {...textareaProps}\n {...field}\n value={field.value ?? ''}\n id={id}\n aria-invalid={fieldState.invalid || undefined}\n aria-describedby={describedBy(hintId, errorMessage && `${id}-error`)}\n />\n <FormFieldError id={`${id}-error`} message={errorMessage} />\n </Field>\n );\n};\n"],"mappings":"qUAkBaS,GAAkD,CAC7D,UACA,OACA,QACA,OACA,GAAGC,KACkC,CACrC,GAAM,CAAE,QAAO,cAAeR,EAAc,CAAE,UAAS,MAAK,CAAC,EACvDS,EAAK,SAASC,IACdC,EAAeC,EAAW,OAAO,QACjCC,EAASC,EAAO,GAAGL,EAAG,OAAS,IAAA,GACrC,OACE,EAAAJ,EAAA,KAAA,CAACN,EAAD,CAAO,eAAca,EAAW,SAAW,IAAA,GAA3C,SAAA,EACE,EAAAP,EAAA,IAAA,CAACF,EAAD,CAAa,QAASM,EAAW,QAAa,OAAc,QAAS,CAAA,GACrE,EAAAJ,EAAA,IAAA,CAACD,EAAD,CACE,GAAII,EACJ,GAAIO,EACJ,MAAOA,EAAM,OAAS,GAClB,KACJ,eAAcH,EAAW,SAAW,IAAA,GACpC,mBAAkBV,EAAYW,EAAQF,GAAgB,GAAGF,EAAG,OAAO,CACpE,CAAA,GACD,EAAAJ,EAAA,IAAA,CAACJ,EAAD,CAAgB,GAAI,GAAGQ,EAAG,QAAS,QAASE,CAAe,CAAA,CACtD,GAEX"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{t}from"./jsx-runtime-DREnUpxT.js";import{t as n}from"./cn-BQ3voEft.js";import{d as r,t as i}from"./InfoHint-GJLRVumb.js";var a=e(t(),1),o=({htmlFor:e,label:t,hint:o,hintId:s,className:c})=>(0,a.jsxs)(`div`,{className:n(`flex items-center gap-1`,c),children:[(0,a.jsx)(r,{htmlFor:e,children:t}),o?(0,a.jsx)(i,{about:t,id:s,children:o}):null]});export{o as t};
|
|
2
|
+
//# sourceMappingURL=HintedLabel-CvC46uy_.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HintedLabel-CvC46uy_.js","names":["__toESM","cn","FieldLabel","InfoHint","import_jsx_runtime","require_jsx_runtime","HintedLabel","className","label","hint","hintId"],"sources":["../../src/components/HintedLabel/index.tsx"],"sourcesContent":["import { FieldLabel } from '@/components/ui/field';\nimport { cn } from '@/helpers/cn';\nimport { InfoHint } from '../InfoHint';\n\ntype HintedLabelProps = {\n htmlFor: string;\n label: string;\n /** Optional explanation behind an info icon (see InfoHint). */\n hint?: string;\n /** Id of the hidden hint text; put it in the control's `aria-describedby`. */\n hintId?: string;\n className?: string;\n};\n\n/** A field label with an optional info-icon hint beside it (the label stays the click target). */\nexport const HintedLabel = ({ htmlFor, label, hint, hintId, className }: HintedLabelProps) => (\n <div className={cn('flex items-center gap-1', className)}>\n <FieldLabel htmlFor={htmlFor}>{label}</FieldLabel>\n {hint ? (\n <InfoHint about={label} id={hintId}>\n {hint}\n </InfoHint>\n ) : null}\n </div>\n);\n"],"mappings":"kMAeaM,GAAe,CAAE,UAAS,QAAO,OAAM,SAAQ,gBAC1D,EAAAF,EAAA,KAAA,CAAC,MAAD,CAAK,UAAWH,EAAG,0BAA2BM,CAAS,EAAvD,SAAA,EACE,EAAAH,EAAA,IAAA,CAACF,EAAD,CAAqB,UAAU,SAAAM,CAAkB,CAAA,EAChDC,GACC,EAAAL,EAAA,IAAA,CAACD,EAAD,CAAU,MAAOK,EAAO,GAAIE,EACzB,SAAAD,CACO,CAAA,EACR,IACD"}
|