@bitrise/bitkit-v2 0.3.475 → 0.3.476
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 +5 -6
- package/dist/atoms/DatePicker/DatePicker.js.map +1 -1
- package/dist/atoms/ImageCropper/ImageCropper.js.map +1 -1
- package/dist/components/BitkitActionMenu/BitkitActionMenu.js.map +1 -1
- package/dist/components/BitkitAvatar/BitkitAvatar.js.map +1 -1
- package/dist/components/BitkitButton/BitkitButton.js.map +1 -1
- package/dist/components/BitkitCollapsible/BitkitCollapsible.js.map +1 -1
- package/dist/components/BitkitColorButton/BitkitColorButton.js.map +1 -1
- package/dist/components/BitkitDialog/BitkitStepsDialog.js.map +1 -1
- package/dist/components/BitkitDialog/BitkitStepsDialogStep.js.map +1 -1
- package/dist/components/BitkitDialog/DialogBodyContext.js.map +1 -1
- package/dist/components/BitkitExpandableCard/BitkitExpandableCard.js.map +1 -1
- package/dist/components/BitkitFileInput/BitkitFileInput.js.map +1 -1
- package/dist/components/BitkitIconButton/BitkitIconButton.js.map +1 -1
- package/dist/components/BitkitLabeledData/BitkitLabeledData.js.map +1 -1
- package/dist/components/BitkitList/BitkitList.js.map +1 -1
- package/dist/components/BitkitMarkdown/BitkitMarkdown.js.map +1 -1
- package/dist/components/BitkitMarkdownCard/BitkitMarkdownCard.js.map +1 -1
- package/dist/components/BitkitMultiselect/BitkitMultiselect.js.map +1 -1
- package/dist/components/BitkitNoteCard/BitkitNoteCard.js.map +1 -1
- package/dist/components/BitkitOverflowContent/BitkitOverflowContent.js.map +1 -1
- package/dist/components/BitkitPageSidebar/BitkitPageSidebar.js.map +1 -1
- package/dist/components/BitkitPagination/BitkitPagination.js.map +1 -1
- package/dist/components/BitkitPaginationLoadMore/BitkitPaginationLoadMore.js.map +1 -1
- package/dist/components/BitkitPopover/BitkitPopover.js.map +1 -1
- package/dist/components/BitkitPromoBanner/BitkitPromoBanner.js.map +1 -1
- package/dist/components/BitkitSegmentedControl/BitkitSegmentedControl.js.map +1 -1
- package/dist/components/BitkitSelectMenu/BitkitSelectMenuAction.js.map +1 -1
- package/dist/components/BitkitSettingsCard/BitkitSettingsCard.js.map +1 -1
- package/dist/components/BitkitSplitButton/BitkitSplitButton.js.map +1 -1
- package/dist/components/BitkitStat/BitkitStat.js.map +1 -1
- package/dist/components/BitkitStepsCard/BitkitStepsCard.js.map +1 -1
- package/dist/components/BitkitTable/BitkitExpandableRow.js.map +1 -1
- package/dist/components/BitkitTable/BitkitRowActionsCell.js.map +1 -1
- package/dist/components/BitkitTable/BitkitSortableColumnHeader.js.map +1 -1
- package/dist/components/BitkitTabs/BitkitTabs.js.map +1 -1
- package/dist/components/BitkitToggletip/BitkitToggletip.js.map +1 -1
- package/dist/components/BitkitTour/BitkitTour.js.map +1 -1
- package/dist/components/BitkitTreeView/BitkitTreeView.js.map +1 -1
- package/dist/components/BitkitUISideNav/UISideNavLink.js.map +1 -1
- package/dist/components/common/NotificationContent.js.map +1 -1
- package/dist/icons/IconAbortCircle.js.map +1 -1
- package/dist/icons/IconAbortCircleFilled.js.map +1 -1
- package/dist/icons/IconAddons.js.map +1 -1
- package/dist/icons/IconAgent.js.map +1 -1
- package/dist/icons/IconAnchor.js.map +1 -1
- package/dist/icons/IconAndroid.js.map +1 -1
- package/dist/icons/IconApp.js.map +1 -1
- package/dist/icons/IconAppSettings.js.map +1 -1
- package/dist/icons/IconAppStore.js.map +1 -1
- package/dist/icons/IconAppStoreColor.js.map +1 -1
- package/dist/icons/IconApple.js.map +1 -1
- package/dist/icons/IconArchive.js.map +1 -1
- package/dist/icons/IconArchiveDelete.js.map +1 -1
- package/dist/icons/IconArchiveRestore.js.map +1 -1
- package/dist/icons/IconArrowBackAndDown.js.map +1 -1
- package/dist/icons/IconArrowBackAndUp.js.map +1 -1
- package/dist/icons/IconArrowDown.js.map +1 -1
- package/dist/icons/IconArrowForwardAndDown.js.map +1 -1
- package/dist/icons/IconArrowForwardAndUp.js.map +1 -1
- package/dist/icons/IconArrowLeft.js.map +1 -1
- package/dist/icons/IconArrowNortheast.js.map +1 -1
- package/dist/icons/IconArrowNorthwest.js.map +1 -1
- package/dist/icons/IconArrowRight.js.map +1 -1
- package/dist/icons/IconArrowUp.js.map +1 -1
- package/dist/icons/IconArrowsHorizontal.js.map +1 -1
- package/dist/icons/IconArrowsVertical.js.map +1 -1
- package/dist/icons/IconAutomation.js.map +1 -1
- package/dist/icons/IconAws.js.map +1 -1
- package/dist/icons/IconAwsColor.js.map +1 -1
- package/dist/icons/IconBadge3RdParty.js.map +1 -1
- package/dist/icons/IconBadgeBitrise.js.map +1 -1
- package/dist/icons/IconBadgeUpgrade.js.map +1 -1
- package/dist/icons/IconBadgeVersionOk.js.map +1 -1
- package/dist/icons/IconBazel.js.map +1 -1
- package/dist/icons/IconBell.js.map +1 -1
- package/dist/icons/IconBitbot.js.map +1 -1
- package/dist/icons/IconBitbotError.js.map +1 -1
- package/dist/icons/IconBitbucket.js.map +1 -1
- package/dist/icons/IconBitbucketColor.js.map +1 -1
- package/dist/icons/IconBitbucketNeutral.js.map +1 -1
- package/dist/icons/IconBitbucketWhite.js.map +1 -1
- package/dist/icons/IconBlockCircle.js.map +1 -1
- package/dist/icons/IconBook.js.map +1 -1
- package/dist/icons/IconBoxArrowDown.js.map +1 -1
- package/dist/icons/IconBoxDot.js.map +1 -1
- package/dist/icons/IconBoxLinesOverflow.js.map +1 -1
- package/dist/icons/IconBoxLinesWrap.js.map +1 -1
- package/dist/icons/IconBranch.js.map +1 -1
- package/dist/icons/IconBrowserstackColor.js.map +1 -1
- package/dist/icons/IconBug.js.map +1 -1
- package/dist/icons/IconBuild.js.map +1 -1
- package/dist/icons/IconBuildCache.js.map +1 -1
- package/dist/icons/IconBuildCacheFilled.js.map +1 -1
- package/dist/icons/IconBuildEnvSetup.js.map +1 -1
- package/dist/icons/IconBuildHub.js.map +1 -1
- package/dist/icons/IconBuildHubFilled.js.map +1 -1
- package/dist/icons/IconCalendar.js.map +1 -1
- package/dist/icons/IconChangePlan.js.map +1 -1
- package/dist/icons/IconChat.js.map +1 -1
- package/dist/icons/IconCheck.js.map +1 -1
- package/dist/icons/IconCheckCircle.js.map +1 -1
- package/dist/icons/IconCheckCircleFilled.js.map +1 -1
- package/dist/icons/IconChevronDown.js.map +1 -1
- package/dist/icons/IconChevronLeft.js.map +1 -1
- package/dist/icons/IconChevronRight.js.map +1 -1
- package/dist/icons/IconChevronUp.js.map +1 -1
- package/dist/icons/IconCi.js.map +1 -1
- package/dist/icons/IconCiFilled.js.map +1 -1
- package/dist/icons/IconCircle.js.map +1 -1
- package/dist/icons/IconCircleDashed.js.map +1 -1
- package/dist/icons/IconCircleHalfFilled.js.map +1 -1
- package/dist/icons/IconClaude.js.map +1 -1
- package/dist/icons/IconClaudeColor.js.map +1 -1
- package/dist/icons/IconClock.js.map +1 -1
- package/dist/icons/IconCode.js.map +1 -1
- package/dist/icons/IconCodePush.js.map +1 -1
- package/dist/icons/IconCodeSigning.js.map +1 -1
- package/dist/icons/IconCoffee.js.map +1 -1
- package/dist/icons/IconCommit.js.map +1 -1
- package/dist/icons/IconConfigure.js.map +1 -1
- package/dist/icons/IconConnectedAccounts.js.map +1 -1
- package/dist/icons/IconContainer.js.map +1 -1
- package/dist/icons/IconCopilot.js.map +1 -1
- package/dist/icons/IconCopy.js.map +1 -1
- package/dist/icons/IconCordova.js.map +1 -1
- package/dist/icons/IconCpu.js.map +1 -1
- package/dist/icons/IconCreditcard.js.map +1 -1
- package/dist/icons/IconCredits.js.map +1 -1
- package/dist/icons/IconCross.js.map +1 -1
- package/dist/icons/IconCrossCircle.js.map +1 -1
- package/dist/icons/IconCrossCircleFilled.js.map +1 -1
- package/dist/icons/IconCrown.js.map +1 -1
- package/dist/icons/IconCursor.js.map +1 -1
- package/dist/icons/IconCycle.js.map +1 -1
- package/dist/icons/IconDashboard.js.map +1 -1
- package/dist/icons/IconDashboardFilled.js.map +1 -1
- package/dist/icons/IconDeployment.js.map +1 -1
- package/dist/icons/IconDetails.js.map +1 -1
- package/dist/icons/IconDoc.js.map +1 -1
- package/dist/icons/IconDollar.js.map +1 -1
- package/dist/icons/IconDot.js.map +1 -1
- package/dist/icons/IconDotnet.js.map +1 -1
- package/dist/icons/IconDotnetColor.js.map +1 -1
- package/dist/icons/IconDotnetText.js.map +1 -1
- package/dist/icons/IconDotnetTextColor.js.map +1 -1
- package/dist/icons/IconDoubleCircle.js.map +1 -1
- package/dist/icons/IconDownload.js.map +1 -1
- package/dist/icons/IconDragHandle.js.map +1 -1
- package/dist/icons/IconEc2Ami.js.map +1 -1
- package/dist/icons/IconEnterprise.js.map +1 -1
- package/dist/icons/IconErrorCircle.js.map +1 -1
- package/dist/icons/IconErrorCircleFilled.js.map +1 -1
- package/dist/icons/IconExpand.js.map +1 -1
- package/dist/icons/IconExtraBuildCapacity.js.map +1 -1
- package/dist/icons/IconEye.js.map +1 -1
- package/dist/icons/IconEyeSlash.js.map +1 -1
- package/dist/icons/IconFastlane.js.map +1 -1
- package/dist/icons/IconFile.js.map +1 -1
- package/dist/icons/IconFileDoc.js.map +1 -1
- package/dist/icons/IconFilePdf.js.map +1 -1
- package/dist/icons/IconFilePlist.js.map +1 -1
- package/dist/icons/IconFileYml.js.map +1 -1
- package/dist/icons/IconFileZip.js.map +1 -1
- package/dist/icons/IconFilter.js.map +1 -1
- package/dist/icons/IconFlag.js.map +1 -1
- package/dist/icons/IconFlutter.js.map +1 -1
- package/dist/icons/IconFolder.js.map +1 -1
- package/dist/icons/IconFullscreen.js.map +1 -1
- package/dist/icons/IconFullscreenExit.js.map +1 -1
- package/dist/icons/IconGauge.js.map +1 -1
- package/dist/icons/IconGit.js.map +1 -1
- package/dist/icons/IconGithub.js.map +1 -1
- package/dist/icons/IconGitlab.js.map +1 -1
- package/dist/icons/IconGitlabColor.js.map +1 -1
- package/dist/icons/IconGitlabWhite.js.map +1 -1
- package/dist/icons/IconGlobe.js.map +1 -1
- package/dist/icons/IconGo.js.map +1 -1
- package/dist/icons/IconGoogleColor.js.map +1 -1
- package/dist/icons/IconGooglePlay.js.map +1 -1
- package/dist/icons/IconGooglePlayColor.js.map +1 -1
- package/dist/icons/IconGradle.js.map +1 -1
- package/dist/icons/IconGroup.js.map +1 -1
- package/dist/icons/IconHashtag.js.map +1 -1
- package/dist/icons/IconHeadset.js.map +1 -1
- package/dist/icons/IconHeart.js.map +1 -1
- package/dist/icons/IconHistory.js.map +1 -1
- package/dist/icons/IconHourglass.js.map +1 -1
- package/dist/icons/IconImage.js.map +1 -1
- package/dist/icons/IconInfoCircle.js.map +1 -1
- package/dist/icons/IconInfoCircleFilled.js.map +1 -1
- package/dist/icons/IconInsights.js.map +1 -1
- package/dist/icons/IconInsightsFilled.js.map +1 -1
- package/dist/icons/IconInstall.js.map +1 -1
- package/dist/icons/IconInteraction.js.map +1 -1
- package/dist/icons/IconInvoice.js.map +1 -1
- package/dist/icons/IconIonic.js.map +1 -1
- package/dist/icons/IconJapanese.js.map +1 -1
- package/dist/icons/IconJava.js.map +1 -1
- package/dist/icons/IconJavaColor.js.map +1 -1
- package/dist/icons/IconJavaDuke.js.map +1 -1
- package/dist/icons/IconJavaDukeColor.js.map +1 -1
- package/dist/icons/IconKey.js.map +1 -1
- package/dist/icons/IconKiroColor.js.map +1 -1
- package/dist/icons/IconKotlin.js.map +1 -1
- package/dist/icons/IconKotlinColor.js.map +1 -1
- package/dist/icons/IconKotlinWhite.js.map +1 -1
- package/dist/icons/IconLaptop.js.map +1 -1
- package/dist/icons/IconLaunchdarkly.js.map +1 -1
- package/dist/icons/IconLegacyApp.js.map +1 -1
- package/dist/icons/IconLightbulb.js.map +1 -1
- package/dist/icons/IconLink.js.map +1 -1
- package/dist/icons/IconLinux.js.map +1 -1
- package/dist/icons/IconLock.js.map +1 -1
- package/dist/icons/IconLockOpen.js.map +1 -1
- package/dist/icons/IconLogin.js.map +1 -1
- package/dist/icons/IconLogout.js.map +1 -1
- package/dist/icons/IconMacos.js.map +1 -1
- package/dist/icons/IconMagicWand.js.map +1 -1
- package/dist/icons/IconMagnifier.js.map +1 -1
- package/dist/icons/IconMail.js.map +1 -1
- package/dist/icons/IconMcp.js.map +1 -1
- package/dist/icons/IconMedal.js.map +1 -1
- package/dist/icons/IconMemory.js.map +1 -1
- package/dist/icons/IconMenuGrid.js.map +1 -1
- package/dist/icons/IconMenuHamburger.js.map +1 -1
- package/dist/icons/IconMessage.js.map +1 -1
- package/dist/icons/IconMessageAlert.js.map +1 -1
- package/dist/icons/IconMessageQuestion.js.map +1 -1
- package/dist/icons/IconMicrophone.js.map +1 -1
- package/dist/icons/IconMinus.js.map +1 -1
- package/dist/icons/IconMinusCircle.js.map +1 -1
- package/dist/icons/IconMinusCircleFilled.js.map +1 -1
- package/dist/icons/IconMobile.js.map +1 -1
- package/dist/icons/IconMobileLandscape.js.map +1 -1
- package/dist/icons/IconMonitorChart.js.map +1 -1
- package/dist/icons/IconMoreHorizontal.js.map +1 -1
- package/dist/icons/IconMoreVertical.js.map +1 -1
- package/dist/icons/IconNews.js.map +1 -1
- package/dist/icons/IconNextjs.js.map +1 -1
- package/dist/icons/IconNodejs.js.map +1 -1
- package/dist/icons/IconOpenInNew.js.map +1 -1
- package/dist/icons/IconOther.js.map +1 -1
- package/dist/icons/IconOutsideContributor.js.map +1 -1
- package/dist/icons/IconOverview.js.map +1 -1
- package/dist/icons/IconPause.js.map +1 -1
- package/dist/icons/IconPencil.js.map +1 -1
- package/dist/icons/IconPeople.js.map +1 -1
- package/dist/icons/IconPercent.js.map +1 -1
- package/dist/icons/IconPerson.js.map +1 -1
- package/dist/icons/IconPersonWithDesk.js.map +1 -1
- package/dist/icons/IconPin.js.map +1 -1
- package/dist/icons/IconPlay.js.map +1 -1
- package/dist/icons/IconPlus.js.map +1 -1
- package/dist/icons/IconPlusCircle.js.map +1 -1
- package/dist/icons/IconPlusCircleFilled.js.map +1 -1
- package/dist/icons/IconPower.js.map +1 -1
- package/dist/icons/IconProject.js.map +1 -1
- package/dist/icons/IconProjectSettings.js.map +1 -1
- package/dist/icons/IconPull.js.map +1 -1
- package/dist/icons/IconPush.js.map +1 -1
- package/dist/icons/IconPuzzle.js.map +1 -1
- package/dist/icons/IconPython.js.map +1 -1
- package/dist/icons/IconPythonColor.js.map +1 -1
- package/dist/icons/IconQuestionCircle.js.map +1 -1
- package/dist/icons/IconQuestionCircleFilled.js.map +1 -1
- package/dist/icons/IconReact.js.map +1 -1
- package/dist/icons/IconRefresh.js.map +1 -1
- package/dist/icons/IconRegex.js.map +1 -1
- package/dist/icons/IconRelease.js.map +1 -1
- package/dist/icons/IconReleaseFilled.js.map +1 -1
- package/dist/icons/IconRemoteAccess.js.map +1 -1
- package/dist/icons/IconReplace.js.map +1 -1
- package/dist/icons/IconResponsiveness.js.map +1 -1
- package/dist/icons/IconReviewerApproved.js.map +1 -1
- package/dist/icons/IconReviewerAssigned.js.map +1 -1
- package/dist/icons/IconReviewerRejected.js.map +1 -1
- package/dist/icons/IconRuby.js.map +1 -1
- package/dist/icons/IconRubyColor.js.map +1 -1
- package/dist/icons/IconSave.js.map +1 -1
- package/dist/icons/IconSecurityShield.js.map +1 -1
- package/dist/icons/IconSettings.js.map +1 -1
- package/dist/icons/IconSettingsFilled.js.map +1 -1
- package/dist/icons/IconShuffle.js.map +1 -1
- package/dist/icons/IconSiren.js.map +1 -1
- package/dist/icons/IconSkip.js.map +1 -1
- package/dist/icons/IconSkipCircle.js.map +1 -1
- package/dist/icons/IconSkipCircleFilled.js.map +1 -1
- package/dist/icons/IconSlack.js.map +1 -1
- package/dist/icons/IconSlackColor.js.map +1 -1
- package/dist/icons/IconSparkle.js.map +1 -1
- package/dist/icons/IconSparkleFilled.js.map +1 -1
- package/dist/icons/IconSpinnerOnDisabled.js.map +1 -1
- package/dist/icons/IconSpinnerPurple.js.map +1 -1
- package/dist/icons/IconSpinnerPurpleDouble.js.map +1 -1
- package/dist/icons/IconSpinnerWhite.js.map +1 -1
- package/dist/icons/IconStability.js.map +1 -1
- package/dist/icons/IconStack.js.map +1 -1
- package/dist/icons/IconStar.js.map +1 -1
- package/dist/icons/IconStep.js.map +1 -1
- package/dist/icons/IconStop.js.map +1 -1
- package/dist/icons/IconStopwatch.js.map +1 -1
- package/dist/icons/IconTabPlus.js.map +1 -1
- package/dist/icons/IconTag.js.map +1 -1
- package/dist/icons/IconTasks.js.map +1 -1
- package/dist/icons/IconTeams.js.map +1 -1
- package/dist/icons/IconTeamsColor.js.map +1 -1
- package/dist/icons/IconTemplateCode.js.map +1 -1
- package/dist/icons/IconTerminal.js.map +1 -1
- package/dist/icons/IconTerminalFilled.js.map +1 -1
- package/dist/icons/IconTestQuarantine.js.map +1 -1
- package/dist/icons/IconThemeDarkToggle.js.map +1 -1
- package/dist/icons/IconThumbDown.js.map +1 -1
- package/dist/icons/IconThumbUp.js.map +1 -1
- package/dist/icons/IconTools.js.map +1 -1
- package/dist/icons/IconTrash.js.map +1 -1
- package/dist/icons/IconTrigger.js.map +1 -1
- package/dist/icons/IconUbuntu.js.map +1 -1
- package/dist/icons/IconUbuntuColor.js.map +1 -1
- package/dist/icons/IconUnity3D.js.map +1 -1
- package/dist/icons/IconUnpin.js.map +1 -1
- package/dist/icons/IconUpload.js.map +1 -1
- package/dist/icons/IconValidateShield.js.map +1 -1
- package/dist/icons/IconVideo.js.map +1 -1
- package/dist/icons/IconVsCode.js.map +1 -1
- package/dist/icons/IconWarning.js.map +1 -1
- package/dist/icons/IconWarningYellow.js.map +1 -1
- package/dist/icons/IconWebUi.js.map +1 -1
- package/dist/icons/IconWebhooks.js.map +1 -1
- package/dist/icons/IconWindsurf.js.map +1 -1
- package/dist/icons/IconWorkflow.js.map +1 -1
- package/dist/icons/IconWorkflowFlow.js.map +1 -1
- package/dist/icons/IconXTwitter.js.map +1 -1
- package/dist/icons/IconXamarin.js.map +1 -1
- package/dist/icons/IconXcode.js.map +1 -1
- package/dist/theme/slot-recipes/Combobox.recipe.js.map +1 -1
- package/dist/theme/slot-recipes/TextInput.recipe.js.map +1 -1
- package/dist/theme/slot-recipes/index.js.map +1 -1
- package/dist/theme/tokens/sizes.js.map +1 -1
- package/dist/theme/tokens/spacing.js.map +1 -1
- package/package.json +10 -12
package/README.md
CHANGED
|
@@ -43,13 +43,13 @@ The hosted Storybook itself is browsable at <https://storybook.services.bitrise.
|
|
|
43
43
|
|
|
44
44
|
```bash
|
|
45
45
|
# Runtime peers — required for Bitkit to render
|
|
46
|
-
npm install @bitrise/bitkit-v2 @chakra-ui/react@3.
|
|
46
|
+
npm install @bitrise/bitkit-v2 @chakra-ui/react@3.37.0 @emotion/react@11.14.0
|
|
47
47
|
|
|
48
48
|
# Build-time peer — required so the bundled postinstall hook can generate bitkit-specific theme typings
|
|
49
|
-
npm install --save-dev @chakra-ui/cli@3.
|
|
49
|
+
npm install --save-dev @chakra-ui/cli@3.37.0
|
|
50
50
|
```
|
|
51
51
|
|
|
52
|
-
Chakra UI and Emotion are declared as peer dependencies so the host app owns the single copy of Chakra in the tree. Install them at the exact versions Bitkit pins — any other version (including patch bumps like `3.
|
|
52
|
+
Chakra UI and Emotion are declared as peer dependencies so the host app owns the single copy of Chakra in the tree. Install them at the exact versions Bitkit pins — any other version (including patch bumps like `3.37.1`) triggers a peer mismatch warning, and a different minor/major may also cause runtime API incompatibility against Bitkit's compiled output. Duplicate Chakra installs only show up if some other transitive dependency drags in a different Chakra version on top of the drift, but when they do they silently break `BitkitProvider`'s theme context, which is exactly the failure mode pinned peers protect against.
|
|
53
53
|
|
|
54
54
|
`@chakra-ui/cli` is a peer too — Bitkit's `postinstall` hook uses it to generate Chakra theme typings into your project's `node_modules`. Install it as a devDependency in the host app so the hook can find it.
|
|
55
55
|
|
|
@@ -59,10 +59,9 @@ Chakra UI and Emotion are declared as peer dependencies so the host app owns the
|
|
|
59
59
|
|
|
60
60
|
- React 18+ (peer dependency)
|
|
61
61
|
- React DOM 18+ (peer dependency)
|
|
62
|
-
- `@chakra-ui/react` 3.
|
|
62
|
+
- `@chakra-ui/react` 3.37.0 (peer dependency, pinned)
|
|
63
63
|
- `@emotion/react` 11.14.0 (peer dependency, pinned)
|
|
64
|
-
- `@
|
|
65
|
-
- `@chakra-ui/cli` 3.35.0 (peer dependency, pinned — used by the bundled `postinstall` typegen hook; install as a devDependency in the host app)
|
|
64
|
+
- `@chakra-ui/cli` 3.37.0 (peer dependency, pinned — used by the bundled `postinstall` typegen hook; install as a devDependency in the host app)
|
|
66
65
|
|
|
67
66
|
### Theme typings
|
|
68
67
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DatePicker.js","names":[],"sources":["../../../lib/atoms/DatePicker/DatePicker.tsx"],"sourcesContent":["import { DatePicker as ArkDatePicker } from '@ark-ui/react/date-picker';\nimport { createSlotRecipeContext, type HTMLChakraProps, type UnstyledProp } from '@chakra-ui/react/styled-system';\n\nconst { withProvider, withContext, useStyles } = createSlotRecipeContext({ key: 'datePicker' });\n\nexport interface DatePickerRootProps extends HTMLChakraProps<'div', ArkDatePicker.RootProps>, UnstyledProp {}\n\nexport const DatePickerRoot = withProvider<HTMLDivElement, DatePickerProps>(\n withContext<HTMLDivElement, DatePickerRootProps>(ArkDatePicker.Root, 'root', {\n forwardAsChild: true,\n }),\n 'root',\n);\n\nexport interface DatePickerControlProps extends HTMLChakraProps<'div', ArkDatePicker.ControlProps>, UnstyledProp {}\n\nexport const DatePickerControl = withContext<HTMLDivElement, DatePickerControlProps>(ArkDatePicker.Control, 'control', {\n forwardAsChild: true,\n});\n\nexport interface DatePickerLabelProps extends HTMLChakraProps<'label', ArkDatePicker.LabelProps>, UnstyledProp {}\n\nexport const DatePickerLabel = withContext<HTMLLabelElement, DatePickerLabelProps>(ArkDatePicker.Label, 'label', {\n forwardAsChild: true,\n});\n\nexport interface DatePickerInputProps extends HTMLChakraProps<'input', ArkDatePicker.InputProps>, UnstyledProp {}\n\nexport const DatePickerInput = withContext<HTMLInputElement, DatePickerInputProps>(ArkDatePicker.Input, 'input', {\n forwardAsChild: true,\n});\n\nexport interface DatePickerTriggerProps extends HTMLChakraProps<'button', ArkDatePicker.TriggerProps>, UnstyledProp {}\n\nexport const DatePickerTrigger = withContext<HTMLButtonElement, DatePickerTriggerProps>(\n ArkDatePicker.Trigger,\n 'trigger',\n {\n forwardAsChild: true,\n },\n);\n\nexport interface DatePickerClearTriggerProps\n extends HTMLChakraProps<'button', ArkDatePicker.ClearTriggerProps>, UnstyledProp {}\n\nexport const DatePickerClearTrigger = withContext<HTMLButtonElement, DatePickerClearTriggerProps>(\n ArkDatePicker.ClearTrigger,\n 'clearTrigger',\n {\n forwardAsChild: true,\n },\n);\n\nexport interface DatePickerPositionerProps\n extends HTMLChakraProps<'div', ArkDatePicker.PositionerProps>, UnstyledProp {}\n\nexport const DatePickerPositioner = withContext<HTMLDivElement, DatePickerPositionerProps>(\n ArkDatePicker.Positioner,\n 'positioner',\n {\n forwardAsChild: true,\n },\n);\n\nexport interface DatePickerContentProps extends HTMLChakraProps<'div', ArkDatePicker.ContentProps>, UnstyledProp {}\n\nexport const DatePickerContent = withContext<HTMLDivElement, DatePickerContentProps>(ArkDatePicker.Content, 'content', {\n forwardAsChild: true,\n});\n\nexport interface DatePickerMonthsProps extends HTMLChakraProps<'div'>, UnstyledProp {}\n\nexport const DatePickerMonths = withContext<HTMLDivElement, DatePickerMonthsProps>('div', 'months', {\n forwardAsChild: true,\n});\n\nexport interface DatePickerViewProps extends HTMLChakraProps<'div', ArkDatePicker.ViewProps>, UnstyledProp {}\n\nexport const DatePickerView = withContext<HTMLDivElement, DatePickerViewProps>(ArkDatePicker.View, 'view', {\n forwardAsChild: true,\n});\n\nexport interface DatePickerViewControlProps\n extends HTMLChakraProps<'div', ArkDatePicker.ViewControlProps>, UnstyledProp {}\n\nexport const DatePickerViewControl = withContext<HTMLDivElement, DatePickerViewControlProps>(\n ArkDatePicker.ViewControl,\n 'viewControl',\n {\n forwardAsChild: true,\n },\n);\n\nexport interface DatePickerTableProps extends HTMLChakraProps<'table', ArkDatePicker.TableProps>, UnstyledProp {}\n\nexport const DatePickerTable = withContext<HTMLTableElement, DatePickerTableProps>(ArkDatePicker.Table, 'table', {\n forwardAsChild: true,\n});\n\nexport interface DatePickerTableHeadProps\n extends HTMLChakraProps<'thead', ArkDatePicker.TableHeadProps>, UnstyledProp {}\n\nexport const DatePickerTableHead = withContext<HTMLTableSectionElement, DatePickerTableHeadProps>(\n ArkDatePicker.TableHead,\n 'tableHead',\n {\n forwardAsChild: true,\n },\n);\n\nexport interface DatePickerTableBodyProps\n extends HTMLChakraProps<'tbody', ArkDatePicker.TableBodyProps>, UnstyledProp {}\n\nexport const DatePickerTableBody = withContext<HTMLTableSectionElement, DatePickerTableBodyProps>(\n ArkDatePicker.TableBody,\n 'tableBody',\n {\n forwardAsChild: true,\n },\n);\n\nexport interface DatePickerTableRowProps extends HTMLChakraProps<'tr', ArkDatePicker.TableRowProps>, UnstyledProp {}\n\nexport const DatePickerTableRow = withContext<HTMLTableRowElement, DatePickerTableRowProps>(\n ArkDatePicker.TableRow,\n 'tableRow',\n {\n forwardAsChild: true,\n },\n);\n\nexport interface DatePickerTableHeaderProps\n extends HTMLChakraProps<'th', ArkDatePicker.TableHeaderProps>, UnstyledProp {}\n\nexport const DatePickerTableHeader = withContext<HTMLTableCellElement, DatePickerTableHeaderProps>(\n ArkDatePicker.TableHeader,\n 'tableHeader',\n {\n forwardAsChild: true,\n },\n);\n\nexport interface DatePickerTableCellProps extends HTMLChakraProps<'td', ArkDatePicker.TableCellProps>, UnstyledProp {}\n\nexport const DatePickerTableCell = withContext<HTMLTableCellElement, DatePickerTableCellProps>(\n ArkDatePicker.TableCell,\n 'tableCell',\n {\n forwardAsChild: true,\n },\n);\n\nexport interface DatePickerTableCellTriggerProps\n extends HTMLChakraProps<'span', ArkDatePicker.TableCellTriggerProps>, UnstyledProp {}\n\nexport const DatePickerTableCellTrigger = withContext<HTMLButtonElement, DatePickerTableCellTriggerProps>(\n ArkDatePicker.TableCellTrigger,\n 'tableCellTrigger',\n {\n forwardAsChild: true,\n },\n);\n\nexport const DatePickerContext = ArkDatePicker.Context;\n\nexport interface DatePickerProps extends DatePickerRootProps {\n // these do not come from ArkUI, so maybe find a better place\n device: 'desktop' | 'mobile';\n layout?: '1-month' | '2-month';\n showOutsideDays?: boolean;\n}\n\nexport const DatePicker = {\n Root: DatePickerRoot,\n Control: DatePickerControl,\n Label: DatePickerLabel,\n Input: DatePickerInput,\n Trigger: DatePickerTrigger,\n ClearTrigger: DatePickerClearTrigger,\n Positioner: DatePickerPositioner,\n Content: DatePickerContent,\n Months: DatePickerMonths,\n View: DatePickerView,\n ViewControl: DatePickerViewControl,\n Table: DatePickerTable,\n TableHead: DatePickerTableHead,\n TableBody: DatePickerTableBody,\n TableRow: DatePickerTableRow,\n TableHeader: DatePickerTableHeader,\n TableCell: DatePickerTableCell,\n TableCellTrigger: DatePickerTableCellTrigger,\n};\n\nexport { useStyles as useCalendarStyles };\n\nexport type { DatePickerOpenChangeDetails, DatePickerValueChangeDetails } from '@ark-ui/react/date-picker';\nexport { useDatePickerContext } from '@ark-ui/react/date-picker';\n"],"mappings":";;;AAGA,IAAM,EAAE,cAAc,aAAa,cAAc,wBAAwB,EAAE,KAAK,aAAa,CAAC;AAI9F,IAAa,iBAAiB,aAC5B,
|
|
1
|
+
{"version":3,"file":"DatePicker.js","names":["ArkDatePicker","DatePicker"],"sources":["../../../lib/atoms/DatePicker/DatePicker.tsx"],"sourcesContent":["import { DatePicker as ArkDatePicker } from '@ark-ui/react/date-picker';\nimport { createSlotRecipeContext, type HTMLChakraProps, type UnstyledProp } from '@chakra-ui/react/styled-system';\n\nconst { withProvider, withContext, useStyles } = createSlotRecipeContext({ key: 'datePicker' });\n\nexport interface DatePickerRootProps extends HTMLChakraProps<'div', ArkDatePicker.RootProps>, UnstyledProp {}\n\nexport const DatePickerRoot = withProvider<HTMLDivElement, DatePickerProps>(\n withContext<HTMLDivElement, DatePickerRootProps>(ArkDatePicker.Root, 'root', {\n forwardAsChild: true,\n }),\n 'root',\n);\n\nexport interface DatePickerControlProps extends HTMLChakraProps<'div', ArkDatePicker.ControlProps>, UnstyledProp {}\n\nexport const DatePickerControl = withContext<HTMLDivElement, DatePickerControlProps>(ArkDatePicker.Control, 'control', {\n forwardAsChild: true,\n});\n\nexport interface DatePickerLabelProps extends HTMLChakraProps<'label', ArkDatePicker.LabelProps>, UnstyledProp {}\n\nexport const DatePickerLabel = withContext<HTMLLabelElement, DatePickerLabelProps>(ArkDatePicker.Label, 'label', {\n forwardAsChild: true,\n});\n\nexport interface DatePickerInputProps extends HTMLChakraProps<'input', ArkDatePicker.InputProps>, UnstyledProp {}\n\nexport const DatePickerInput = withContext<HTMLInputElement, DatePickerInputProps>(ArkDatePicker.Input, 'input', {\n forwardAsChild: true,\n});\n\nexport interface DatePickerTriggerProps extends HTMLChakraProps<'button', ArkDatePicker.TriggerProps>, UnstyledProp {}\n\nexport const DatePickerTrigger = withContext<HTMLButtonElement, DatePickerTriggerProps>(\n ArkDatePicker.Trigger,\n 'trigger',\n {\n forwardAsChild: true,\n },\n);\n\nexport interface DatePickerClearTriggerProps\n extends HTMLChakraProps<'button', ArkDatePicker.ClearTriggerProps>, UnstyledProp {}\n\nexport const DatePickerClearTrigger = withContext<HTMLButtonElement, DatePickerClearTriggerProps>(\n ArkDatePicker.ClearTrigger,\n 'clearTrigger',\n {\n forwardAsChild: true,\n },\n);\n\nexport interface DatePickerPositionerProps\n extends HTMLChakraProps<'div', ArkDatePicker.PositionerProps>, UnstyledProp {}\n\nexport const DatePickerPositioner = withContext<HTMLDivElement, DatePickerPositionerProps>(\n ArkDatePicker.Positioner,\n 'positioner',\n {\n forwardAsChild: true,\n },\n);\n\nexport interface DatePickerContentProps extends HTMLChakraProps<'div', ArkDatePicker.ContentProps>, UnstyledProp {}\n\nexport const DatePickerContent = withContext<HTMLDivElement, DatePickerContentProps>(ArkDatePicker.Content, 'content', {\n forwardAsChild: true,\n});\n\nexport interface DatePickerMonthsProps extends HTMLChakraProps<'div'>, UnstyledProp {}\n\nexport const DatePickerMonths = withContext<HTMLDivElement, DatePickerMonthsProps>('div', 'months', {\n forwardAsChild: true,\n});\n\nexport interface DatePickerViewProps extends HTMLChakraProps<'div', ArkDatePicker.ViewProps>, UnstyledProp {}\n\nexport const DatePickerView = withContext<HTMLDivElement, DatePickerViewProps>(ArkDatePicker.View, 'view', {\n forwardAsChild: true,\n});\n\nexport interface DatePickerViewControlProps\n extends HTMLChakraProps<'div', ArkDatePicker.ViewControlProps>, UnstyledProp {}\n\nexport const DatePickerViewControl = withContext<HTMLDivElement, DatePickerViewControlProps>(\n ArkDatePicker.ViewControl,\n 'viewControl',\n {\n forwardAsChild: true,\n },\n);\n\nexport interface DatePickerTableProps extends HTMLChakraProps<'table', ArkDatePicker.TableProps>, UnstyledProp {}\n\nexport const DatePickerTable = withContext<HTMLTableElement, DatePickerTableProps>(ArkDatePicker.Table, 'table', {\n forwardAsChild: true,\n});\n\nexport interface DatePickerTableHeadProps\n extends HTMLChakraProps<'thead', ArkDatePicker.TableHeadProps>, UnstyledProp {}\n\nexport const DatePickerTableHead = withContext<HTMLTableSectionElement, DatePickerTableHeadProps>(\n ArkDatePicker.TableHead,\n 'tableHead',\n {\n forwardAsChild: true,\n },\n);\n\nexport interface DatePickerTableBodyProps\n extends HTMLChakraProps<'tbody', ArkDatePicker.TableBodyProps>, UnstyledProp {}\n\nexport const DatePickerTableBody = withContext<HTMLTableSectionElement, DatePickerTableBodyProps>(\n ArkDatePicker.TableBody,\n 'tableBody',\n {\n forwardAsChild: true,\n },\n);\n\nexport interface DatePickerTableRowProps extends HTMLChakraProps<'tr', ArkDatePicker.TableRowProps>, UnstyledProp {}\n\nexport const DatePickerTableRow = withContext<HTMLTableRowElement, DatePickerTableRowProps>(\n ArkDatePicker.TableRow,\n 'tableRow',\n {\n forwardAsChild: true,\n },\n);\n\nexport interface DatePickerTableHeaderProps\n extends HTMLChakraProps<'th', ArkDatePicker.TableHeaderProps>, UnstyledProp {}\n\nexport const DatePickerTableHeader = withContext<HTMLTableCellElement, DatePickerTableHeaderProps>(\n ArkDatePicker.TableHeader,\n 'tableHeader',\n {\n forwardAsChild: true,\n },\n);\n\nexport interface DatePickerTableCellProps extends HTMLChakraProps<'td', ArkDatePicker.TableCellProps>, UnstyledProp {}\n\nexport const DatePickerTableCell = withContext<HTMLTableCellElement, DatePickerTableCellProps>(\n ArkDatePicker.TableCell,\n 'tableCell',\n {\n forwardAsChild: true,\n },\n);\n\nexport interface DatePickerTableCellTriggerProps\n extends HTMLChakraProps<'span', ArkDatePicker.TableCellTriggerProps>, UnstyledProp {}\n\nexport const DatePickerTableCellTrigger = withContext<HTMLButtonElement, DatePickerTableCellTriggerProps>(\n ArkDatePicker.TableCellTrigger,\n 'tableCellTrigger',\n {\n forwardAsChild: true,\n },\n);\n\nexport const DatePickerContext = ArkDatePicker.Context;\n\nexport interface DatePickerProps extends DatePickerRootProps {\n // these do not come from ArkUI, so maybe find a better place\n device: 'desktop' | 'mobile';\n layout?: '1-month' | '2-month';\n showOutsideDays?: boolean;\n}\n\nexport const DatePicker = {\n Root: DatePickerRoot,\n Control: DatePickerControl,\n Label: DatePickerLabel,\n Input: DatePickerInput,\n Trigger: DatePickerTrigger,\n ClearTrigger: DatePickerClearTrigger,\n Positioner: DatePickerPositioner,\n Content: DatePickerContent,\n Months: DatePickerMonths,\n View: DatePickerView,\n ViewControl: DatePickerViewControl,\n Table: DatePickerTable,\n TableHead: DatePickerTableHead,\n TableBody: DatePickerTableBody,\n TableRow: DatePickerTableRow,\n TableHeader: DatePickerTableHeader,\n TableCell: DatePickerTableCell,\n TableCellTrigger: DatePickerTableCellTrigger,\n};\n\nexport { useStyles as useCalendarStyles };\n\nexport type { DatePickerOpenChangeDetails, DatePickerValueChangeDetails } from '@ark-ui/react/date-picker';\nexport { useDatePickerContext } from '@ark-ui/react/date-picker';\n"],"mappings":";;;AAGA,IAAM,EAAE,cAAc,aAAa,cAAc,wBAAwB,EAAE,KAAK,aAAa,CAAC;AAI9F,IAAa,iBAA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ACA,EACE,gBAAgB,KAClB,CACF;AAEA,IAAa,oBAAoBA,WAAc;AAS/C,IAAaC,eAAa;CACxB,MAAM;CACN,SAAS;CACT,OAAO;CACP,OAAO;CACP,SAAS;CACT,cAAc;CACd,YAAY;CACZ,SAAS;CACT,QAAQ;CACR,MAAM;CACN,aAAa;CACb,OAAO;CACP,WAAW;CACX,WAAW;CACX,UAAU;CACV,aAAa;CACb,WAAW;CACX,kBAAkB;AACpB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ImageCropper.js","names":[],"sources":["../../../lib/atoms/ImageCropper/ImageCropper.tsx"],"sourcesContent":["import { ImageCropper as ArkImageCropper } from '@ark-ui/react/image-cropper';\nimport { createSlotRecipeContext, type HTMLChakraProps, type UnstyledProp } from '@chakra-ui/react/styled-system';\n\nconst { withProvider, withContext, useStyles } = createSlotRecipeContext({ key: 'imageCropper' });\n\nexport interface ImageCropperRootProps extends HTMLChakraProps<'div', ArkImageCropper.RootProps>, UnstyledProp {}\n\nexport const ImageCropperRoot = withProvider<HTMLDivElement, ImageCropperRootProps>(\n withContext<HTMLDivElement, ImageCropperRootProps>(ArkImageCropper.Root, 'root', {\n forwardAsChild: true,\n forwardProps: ['aspectRatio', 'minWidth', 'minHeight', 'maxWidth', 'maxHeight'],\n }),\n 'root',\n {\n forwardProps: ['aspectRatio', 'minWidth', 'minHeight', 'maxWidth', 'maxHeight'],\n },\n);\n\nexport const ImageCropperViewport = withContext<HTMLDivElement, HTMLChakraProps<'div'>>(\n ArkImageCropper.Viewport,\n 'viewport',\n {\n forwardAsChild: true,\n },\n);\n\nexport const ImageCropperImage = withContext<HTMLImageElement, HTMLChakraProps<'img'>>(ArkImageCropper.Image, 'image', {\n forwardAsChild: true,\n});\n\nexport const ImageCropperSelection = withContext<HTMLDivElement, HTMLChakraProps<'div'>>(\n ArkImageCropper.Selection,\n 'selection',\n {\n forwardAsChild: true,\n },\n);\n\nexport const ImageCropperHandle = withContext<HTMLDivElement, HTMLChakraProps<'div', ArkImageCropper.HandleProps>>(\n ArkImageCropper.Handle,\n 'handle',\n {\n forwardAsChild: true,\n forwardProps: ['position'],\n },\n);\n\nexport const ImageCropperGrid = withContext<HTMLDivElement, HTMLChakraProps<'div'>>(ArkImageCropper.Grid, 'grid', {\n forwardAsChild: true,\n});\n\nexport default {\n handles: ArkImageCropper.handles,\n Root: ImageCropperRoot,\n Viewport: ImageCropperViewport,\n Image: ImageCropperImage,\n Selection: ImageCropperSelection,\n Handle: ImageCropperHandle,\n Grid: ImageCropperGrid,\n};\n\nexport { useStyles as useImageCropperStyles };\n\nexport { useImageCropper, useImageCropperContext } from '@ark-ui/react/image-cropper';\n"],"mappings":";;;AAGA,IAAM,EAAE,cAAc,aAAa,cAAc,wBAAwB,EAAE,KAAK,eAAe,CAAC;AAIhG,IAAa,mBAAmB,aAC9B,
|
|
1
|
+
{"version":3,"file":"ImageCropper.js","names":["ArkImageCropper"],"sources":["../../../lib/atoms/ImageCropper/ImageCropper.tsx"],"sourcesContent":["import { ImageCropper as ArkImageCropper } from '@ark-ui/react/image-cropper';\nimport { createSlotRecipeContext, type HTMLChakraProps, type UnstyledProp } from '@chakra-ui/react/styled-system';\n\nconst { withProvider, withContext, useStyles } = createSlotRecipeContext({ key: 'imageCropper' });\n\nexport interface ImageCropperRootProps extends HTMLChakraProps<'div', ArkImageCropper.RootProps>, UnstyledProp {}\n\nexport const ImageCropperRoot = withProvider<HTMLDivElement, ImageCropperRootProps>(\n withContext<HTMLDivElement, ImageCropperRootProps>(ArkImageCropper.Root, 'root', {\n forwardAsChild: true,\n forwardProps: ['aspectRatio', 'minWidth', 'minHeight', 'maxWidth', 'maxHeight'],\n }),\n 'root',\n {\n forwardProps: ['aspectRatio', 'minWidth', 'minHeight', 'maxWidth', 'maxHeight'],\n },\n);\n\nexport const ImageCropperViewport = withContext<HTMLDivElement, HTMLChakraProps<'div'>>(\n ArkImageCropper.Viewport,\n 'viewport',\n {\n forwardAsChild: true,\n },\n);\n\nexport const ImageCropperImage = withContext<HTMLImageElement, HTMLChakraProps<'img'>>(ArkImageCropper.Image, 'image', {\n forwardAsChild: true,\n});\n\nexport const ImageCropperSelection = withContext<HTMLDivElement, HTMLChakraProps<'div'>>(\n ArkImageCropper.Selection,\n 'selection',\n {\n forwardAsChild: true,\n },\n);\n\nexport const ImageCropperHandle = withContext<HTMLDivElement, HTMLChakraProps<'div', ArkImageCropper.HandleProps>>(\n ArkImageCropper.Handle,\n 'handle',\n {\n forwardAsChild: true,\n forwardProps: ['position'],\n },\n);\n\nexport const ImageCropperGrid = withContext<HTMLDivElement, HTMLChakraProps<'div'>>(ArkImageCropper.Grid, 'grid', {\n forwardAsChild: true,\n});\n\nexport default {\n handles: ArkImageCropper.handles,\n Root: ImageCropperRoot,\n Viewport: ImageCropperViewport,\n Image: ImageCropperImage,\n Selection: ImageCropperSelection,\n Handle: ImageCropperHandle,\n Grid: ImageCropperGrid,\n};\n\nexport { useStyles as useImageCropperStyles };\n\nexport { useImageCropper, useImageCropperContext } from '@ark-ui/react/image-cropper';\n"],"mappings":";;;AAGA,IAAM,EAAE,cAAc,aAAa,cAAc,wBAAwB,EAAE,KAAK,eAAe,CAAC;AAIhG,IAAa,mBAAmB,aAC9B,YAAmDA,aAAgB,MAAM,QAAQ;CAC/E,gBAAgB;CAChB,cAAc;EAAC;EAAe;EAAY;EAAa;EAAY;CAAW;AAChF,CAAC,GACD,QACA,EACE,cAAc;CAAC;CAAe;CAAY;CAAa;CAAY;AAAW,EAChF,CACF;AAEA,IAAa,uBAAuB,YAClCA,aAAgB,UAChB,YACA,EACE,gBAAgB,KAClB,CACF;AAEA,IAAa,oBAAoB,YAAsDA,aAAgB,OAAO,SAAS,EACrH,gBAAgB,KAClB,CAAC;AAED,IAAa,wBAAwB,YACnCA,aAAgB,WAChB,aACA,EACE,gBAAgB,KAClB,CACF;AAEA,IAAa,qBAAqB,YAChCA,aAAgB,QAChB,UACA;CACE,gBAAgB;CAChB,cAAc,CAAC,UAAU;AAC3B,CACF;AAEA,IAAa,mBAAmB,YAAoDA,aAAgB,MAAM,QAAQ,EAChH,gBAAgB,KAClB,CAAC;AAED,IAAA,uBAAe;CACb,SAASA,aAAgB;CACzB,MAAM;CACN,UAAU;CACV,OAAO;CACP,WAAW;CACX,QAAQ;CACR,MAAM;AACR"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BitkitActionMenu.js","names":[],"sources":["../../../lib/components/BitkitActionMenu/BitkitActionMenu.tsx"],"sourcesContent":["import { Box } from '@chakra-ui/react/box';\nimport {\n Menu,\n type MenuItemGroupProps,\n type MenuItemProps,\n type MenuRootProps,\n type MenuSeparatorProps,\n useMenuStyles,\n} from '@chakra-ui/react/menu';\nimport { Portal } from '@chakra-ui/react/portal';\nimport { Separator as ChakraSeparator } from '@chakra-ui/react/separator';\nimport { Text } from '@chakra-ui/react/text';\nimport { createContext, forwardRef, type MouseEvent, type ReactNode, type Ref, useContext, useId } from 'react';\n\nimport { type BitkitIconComponent, IconArrowNortheast } from '../../icons';\nimport { type BitkitDataAttributes, splitDataAttributes } from '../../utilities/dataAttributes';\nimport { withSubComponents } from '../../utilities/withSubComponents';\n\nconst BitkitActionMenuContext = createContext<MenuRootProps['size']>('lg');\n\n/**\n * `data-*` attributes are forwarded to the element carrying `role=\"menu\"` (the menu content), and\n * nothing else is — the same contract the dialogs have. The menu portals out, so this is the only\n * way to address the rendered list, e.g. from a test.\n */\nexport interface BitkitActionMenuProps extends Omit<MenuRootProps, 'children'>, BitkitDataAttributes {\n /** The menu's items — `BitkitActionMenu.Item`, `.Group` and `.Separator`. */\n children?: ReactNode;\n /**\n * Row density, inherited by every item. `lg` (default) is the standalone action menu; `md` is for\n * menus attached to dense UI, such as an overflow menu in a toolbar or a tab bar.\n */\n size?: MenuRootProps['size'];\n /**\n * The element the menu is anchored to — usually a `BitkitIconButton` or `BitkitButton`. Rendered\n * via `asChild`, so it must accept a ref.\n */\n trigger: ReactNode;\n}\n\nconst BitkitActionMenu = ({ trigger, children, size = 'lg', ...props }: BitkitActionMenuProps) => {\n // `Menu.Root` is a provider, not an element, so it drops the `data-*` attributes — they belong on\n // the content, which is the element carrying `role=\"menu\"`.\n const { dataAttributes, rest: rootProps } = splitDataAttributes(props);\n\n return (\n <Menu.Root size={size} {...rootProps}>\n <Menu.Trigger asChild>{trigger}</Menu.Trigger>\n <Portal>\n <Menu.Positioner>\n <BitkitActionMenuContext.Provider value={size}>\n <Menu.Content {...dataAttributes}>{children}</Menu.Content>\n </BitkitActionMenuContext.Provider>\n </Menu.Positioner>\n </Portal>\n </Menu.Root>\n );\n};\nBitkitActionMenu.displayName = 'BitkitActionMenu';\n\ninterface BitkitActionMenuItemCommonProps extends Omit<MenuItemProps, 'value'> {\n /** The item's label. */\n children?: ReactNode;\n /** Leading icon, sized from the menu's `size` (24 on `lg`, 16 on `md`). */\n icon?: BitkitIconComponent;\n /** Style the item as destructive — red label and icon. Use it for delete and similar actions. */\n isDanger?: boolean;\n /** Inert and marked `aria-disabled`: no selection, no `onClick`, and no navigation on an `href` item. */\n disabled?: boolean;\n /** A second, quieter line under the label. Adding it makes the row taller and top-aligns the icon. */\n secondaryText?: ReactNode;\n /**\n * Identifies the item to the menu machine. Omit it for a command item that does its own work in\n * `onClick` — a generated id is used, and typeahead matches the label either way. Pass one when\n * you read `onSelect` on the menu itself and need to tell the items apart.\n */\n value?: string;\n}\n\ninterface BitkitActionMenuItemAsButtonProps extends BitkitActionMenuItemCommonProps {\n href?: undefined;\n isExternal?: undefined;\n rel?: undefined;\n target?: undefined;\n}\n\ninterface BitkitActionMenuItemAsAnchorProps extends BitkitActionMenuItemCommonProps {\n /** Renders the item as an `<a>` instead of a menu button. */\n href: string;\n /**\n * Shorthand for `target=\"_blank\"` plus `rel=\"noreferrer noopener\"`. Also puts an\n * `IconArrowNortheast` at the end of the row — the design system's \"leaves this page\" marker.\n */\n isExternal?: boolean;\n /** Extra `rel` tokens. With `isExternal` the safety tokens are appended to these. */\n rel?: string;\n /** Anchor target. Ignored when `isExternal` is set. */\n target?: string;\n}\n\nexport type BitkitActionMenuItemProps = BitkitActionMenuItemAsButtonProps | BitkitActionMenuItemAsAnchorProps;\n\nconst BitkitActionMenuItem = forwardRef<HTMLElement, BitkitActionMenuItemProps>((props, ref) => {\n const { children, disabled, icon: Icon, isDanger, secondaryText } = props;\n const style = useMenuStyles();\n const menuCtx = useContext(BitkitActionMenuContext);\n const iconSize = menuCtx === 'lg' ? '24' : '16';\n const hasHelper = secondaryText ? true : undefined;\n const fallbackValue = useId();\n\n // Ark composes the consumer's `onClick` with its own, and only its own bails on `disabled` — so\n // without this a disabled item still runs the handler (and, as an anchor, still navigates).\n const handleClick = (onClick: MenuItemProps['onClick']) => (event: MouseEvent<HTMLDivElement>) => {\n if (disabled) {\n event.preventDefault();\n return;\n }\n onClick?.(event);\n };\n\n const content = (\n <>\n {Icon && <Icon size={iconSize} />}\n <Box flex=\"1\">\n <Text>{children}</Text>\n {secondaryText && <Text css={style.itemHelper}>{secondaryText}</Text>}\n </Box>\n {props.isExternal && <IconArrowNortheast data-suffix-icon size={iconSize} />}\n </>\n );\n\n if (props.href !== undefined) {\n const {\n children: _children,\n href,\n icon: _icon,\n isDanger: _isDanger,\n isExternal,\n rel,\n onClick,\n secondaryText: _secondaryText,\n target,\n value,\n ...rest\n } = props;\n const effectiveTarget = isExternal ? '_blank' : target;\n const effectiveRel = isExternal ? (rel ? `${rel} noreferrer noopener` : 'noreferrer noopener') : rel;\n return (\n <Menu.Item\n asChild\n data-danger={isDanger}\n data-helper={hasHelper}\n onClick={handleClick(onClick)}\n value={value ?? fallbackValue}\n {...rest}\n >\n <a ref={ref as Ref<HTMLAnchorElement>} href={href} rel={effectiveRel} target={effectiveTarget}>\n {content}\n </a>\n </Menu.Item>\n );\n }\n\n const {\n children: _children,\n icon: _icon,\n isDanger: _isDanger,\n onClick,\n secondaryText: _secondaryText,\n value,\n ...rest\n } = props;\n return (\n <Menu.Item\n data-danger={isDanger}\n data-helper={hasHelper}\n onClick={handleClick(onClick)}\n ref={ref as Ref<HTMLDivElement>}\n value={value ?? fallbackValue}\n {...rest}\n >\n {content}\n </Menu.Item>\n );\n});\nBitkitActionMenuItem.displayName = 'BitkitActionMenu.Item';\n\nexport interface BitkitActionMenuGroupProps extends MenuItemGroupProps {\n /** The group's items. */\n children?: ReactNode;\n /** The group's heading, rendered uppercase with a rule filling the rest of the row. */\n label: ReactNode;\n}\n\nconst BitkitActionMenuGroup = forwardRef<HTMLDivElement, BitkitActionMenuGroupProps>(\n ({ label, children, ...props }, ref) => {\n return (\n <Menu.ItemGroup ref={ref} {...props}>\n <Menu.ItemGroupLabel>\n <Text>{label}</Text>\n <ChakraSeparator flex=\"1\" />\n </Menu.ItemGroupLabel>\n {children}\n </Menu.ItemGroup>\n );\n },\n);\nBitkitActionMenuGroup.displayName = 'BitkitActionMenu.Group';\n\nexport type BitkitActionMenuSeparatorProps = MenuSeparatorProps;\n\nconst BitkitActionMenuSeparator = forwardRef<HTMLHRElement, BitkitActionMenuSeparatorProps>((props, ref) => {\n return <Menu.Separator ref={ref} {...props} />;\n});\nBitkitActionMenuSeparator.displayName = 'BitkitActionMenu.Separator';\n\nexport default withSubComponents(BitkitActionMenu, {\n Group: BitkitActionMenuGroup,\n Item: BitkitActionMenuItem,\n Separator: BitkitActionMenuSeparator,\n});\n"],"mappings":";;;;;;;;;;;AAkBA,IAAM,0BAA0B,cAAqC,IAAI;AAsBzE,IAAM,oBAAoB,EAAE,SAAS,UAAU,OAAO,MAAM,GAAG,YAAmC;CAGhG,MAAM,EAAE,gBAAgB,MAAM,cAAc,oBAAoB,KAAK;CAErE,OACE,qBAAC,KAAK,MAAN;EAAiB;EAAM,GAAI;EAA3B,UAAA,CACE,oBAAC,KAAK,SAAN;GAAc,SAAA;GAAS,UAAA;EAAsB,CAAA,GAC7C,oBAAC,QAAD,EAAA,UACE,oBAAC,KAAK,YAAN,EAAA,UACE,oBAAC,wBAAwB,UAAzB;GAAkC,OAA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;IAC3E,UAAA;GACA,CAAA;EACM,CAAA;CAEf;CAEA,MAAM,EACJ,UAAU,WACV,MAAM,OACN,UAAU,WACV,SACA,eAAe,gBACf,OACA,GAAG,SACD;CACJ,OACE,oBAAC,KAAK,MAAN;EACE,eAAa;EACb,eAAa;EACb,SAAS,YAAY,OAAO;EACvB;EACL,OAAO,SAAS;EAChB,GAAI;EAEH,UAAA;CACQ,CAAA;AAEf,CAAC;AACD,qBAAqB,cAAc;AASnC,IAAM,wBAAwB,YAC3B,EAAE,OAAO,UAAU,GAAG,SAAS,QAAQ;CACtC,OACE,qBAAC,KAAK,WAAN;EAAqB;EAAK,GAAI;EAA9B,UAAA,CACE,qBAAC,KAAK,gBAAN,EAAA,UAAA,CACE,oBAAC,MAAD,EAAA,UAAO,MAAY,CAAA,GACnB,oBAAC,WAAD,EAAiB,MAAK,IAAK,CAAA,CACR,EAAA,CAAA,GACpB,QACa;;AAEpB,CACF;AACA,sBAAsB,cAAc;AAIpC,IAAM,4BAA4B,YAA2D,OAAO,QAAQ;CAC1G,OAAO,oBAAC,KAAK,WAAN;EAAqB;EAAK,GAAI;CAAQ,CAAA;AAC/C,CAAC;AACD,0BAA0B,cAAc;AAExC,IAAA,2BAAe,kBAAkB,kBAAkB;CACjD,OAAO;CACP,MAAM;CACN,WAAW;AACb,CAAC"}
|
|
1
|
+
{"version":3,"file":"BitkitActionMenu.js","names":["_Fragment","ChakraSeparator"],"sources":["../../../lib/components/BitkitActionMenu/BitkitActionMenu.tsx"],"sourcesContent":["import { Box } from '@chakra-ui/react/box';\nimport {\n Menu,\n type MenuItemGroupProps,\n type MenuItemProps,\n type MenuRootProps,\n type MenuSeparatorProps,\n useMenuStyles,\n} from '@chakra-ui/react/menu';\nimport { Portal } from '@chakra-ui/react/portal';\nimport { Separator as ChakraSeparator } from '@chakra-ui/react/separator';\nimport { Text } from '@chakra-ui/react/text';\nimport { createContext, forwardRef, type MouseEvent, type ReactNode, type Ref, useContext, useId } from 'react';\n\nimport { type BitkitIconComponent, IconArrowNortheast } from '../../icons';\nimport { type BitkitDataAttributes, splitDataAttributes } from '../../utilities/dataAttributes';\nimport { withSubComponents } from '../../utilities/withSubComponents';\n\nconst BitkitActionMenuContext = createContext<MenuRootProps['size']>('lg');\n\n/**\n * `data-*` attributes are forwarded to the element carrying `role=\"menu\"` (the menu content), and\n * nothing else is — the same contract the dialogs have. The menu portals out, so this is the only\n * way to address the rendered list, e.g. from a test.\n */\nexport interface BitkitActionMenuProps extends Omit<MenuRootProps, 'children'>, BitkitDataAttributes {\n /** The menu's items — `BitkitActionMenu.Item`, `.Group` and `.Separator`. */\n children?: ReactNode;\n /**\n * Row density, inherited by every item. `lg` (default) is the standalone action menu; `md` is for\n * menus attached to dense UI, such as an overflow menu in a toolbar or a tab bar.\n */\n size?: MenuRootProps['size'];\n /**\n * The element the menu is anchored to — usually a `BitkitIconButton` or `BitkitButton`. Rendered\n * via `asChild`, so it must accept a ref.\n */\n trigger: ReactNode;\n}\n\nconst BitkitActionMenu = ({ trigger, children, size = 'lg', ...props }: BitkitActionMenuProps) => {\n // `Menu.Root` is a provider, not an element, so it drops the `data-*` attributes — they belong on\n // the content, which is the element carrying `role=\"menu\"`.\n const { dataAttributes, rest: rootProps } = splitDataAttributes(props);\n\n return (\n <Menu.Root size={size} {...rootProps}>\n <Menu.Trigger asChild>{trigger}</Menu.Trigger>\n <Portal>\n <Menu.Positioner>\n <BitkitActionMenuContext.Provider value={size}>\n <Menu.Content {...dataAttributes}>{children}</Menu.Content>\n </BitkitActionMenuContext.Provider>\n </Menu.Positioner>\n </Portal>\n </Menu.Root>\n );\n};\nBitkitActionMenu.displayName = 'BitkitActionMenu';\n\ninterface BitkitActionMenuItemCommonProps extends Omit<MenuItemProps, 'value'> {\n /** The item's label. */\n children?: ReactNode;\n /** Leading icon, sized from the menu's `size` (24 on `lg`, 16 on `md`). */\n icon?: BitkitIconComponent;\n /** Style the item as destructive — red label and icon. Use it for delete and similar actions. */\n isDanger?: boolean;\n /** Inert and marked `aria-disabled`: no selection, no `onClick`, and no navigation on an `href` item. */\n disabled?: boolean;\n /** A second, quieter line under the label. Adding it makes the row taller and top-aligns the icon. */\n secondaryText?: ReactNode;\n /**\n * Identifies the item to the menu machine. Omit it for a command item that does its own work in\n * `onClick` — a generated id is used, and typeahead matches the label either way. Pass one when\n * you read `onSelect` on the menu itself and need to tell the items apart.\n */\n value?: string;\n}\n\ninterface BitkitActionMenuItemAsButtonProps extends BitkitActionMenuItemCommonProps {\n href?: undefined;\n isExternal?: undefined;\n rel?: undefined;\n target?: undefined;\n}\n\ninterface BitkitActionMenuItemAsAnchorProps extends BitkitActionMenuItemCommonProps {\n /** Renders the item as an `<a>` instead of a menu button. */\n href: string;\n /**\n * Shorthand for `target=\"_blank\"` plus `rel=\"noreferrer noopener\"`. Also puts an\n * `IconArrowNortheast` at the end of the row — the design system's \"leaves this page\" marker.\n */\n isExternal?: boolean;\n /** Extra `rel` tokens. With `isExternal` the safety tokens are appended to these. */\n rel?: string;\n /** Anchor target. Ignored when `isExternal` is set. */\n target?: string;\n}\n\nexport type BitkitActionMenuItemProps = BitkitActionMenuItemAsButtonProps | BitkitActionMenuItemAsAnchorProps;\n\nconst BitkitActionMenuItem = forwardRef<HTMLElement, BitkitActionMenuItemProps>((props, ref) => {\n const { children, disabled, icon: Icon, isDanger, secondaryText } = props;\n const style = useMenuStyles();\n const menuCtx = useContext(BitkitActionMenuContext);\n const iconSize = menuCtx === 'lg' ? '24' : '16';\n const hasHelper = secondaryText ? true : undefined;\n const fallbackValue = useId();\n\n // Ark composes the consumer's `onClick` with its own, and only its own bails on `disabled` — so\n // without this a disabled item still runs the handler (and, as an anchor, still navigates).\n const handleClick = (onClick: MenuItemProps['onClick']) => (event: MouseEvent<HTMLDivElement>) => {\n if (disabled) {\n event.preventDefault();\n return;\n }\n onClick?.(event);\n };\n\n const content = (\n <>\n {Icon && <Icon size={iconSize} />}\n <Box flex=\"1\">\n <Text>{children}</Text>\n {secondaryText && <Text css={style.itemHelper}>{secondaryText}</Text>}\n </Box>\n {props.isExternal && <IconArrowNortheast data-suffix-icon size={iconSize} />}\n </>\n );\n\n if (props.href !== undefined) {\n const {\n children: _children,\n href,\n icon: _icon,\n isDanger: _isDanger,\n isExternal,\n rel,\n onClick,\n secondaryText: _secondaryText,\n target,\n value,\n ...rest\n } = props;\n const effectiveTarget = isExternal ? '_blank' : target;\n const effectiveRel = isExternal ? (rel ? `${rel} noreferrer noopener` : 'noreferrer noopener') : rel;\n return (\n <Menu.Item\n asChild\n data-danger={isDanger}\n data-helper={hasHelper}\n onClick={handleClick(onClick)}\n value={value ?? fallbackValue}\n {...rest}\n >\n <a ref={ref as Ref<HTMLAnchorElement>} href={href} rel={effectiveRel} target={effectiveTarget}>\n {content}\n </a>\n </Menu.Item>\n );\n }\n\n const {\n children: _children,\n icon: _icon,\n isDanger: _isDanger,\n onClick,\n secondaryText: _secondaryText,\n value,\n ...rest\n } = props;\n return (\n <Menu.Item\n data-danger={isDanger}\n data-helper={hasHelper}\n onClick={handleClick(onClick)}\n ref={ref as Ref<HTMLDivElement>}\n value={value ?? fallbackValue}\n {...rest}\n >\n {content}\n </Menu.Item>\n );\n});\nBitkitActionMenuItem.displayName = 'BitkitActionMenu.Item';\n\nexport interface BitkitActionMenuGroupProps extends MenuItemGroupProps {\n /** The group's items. */\n children?: ReactNode;\n /** The group's heading, rendered uppercase with a rule filling the rest of the row. */\n label: ReactNode;\n}\n\nconst BitkitActionMenuGroup = forwardRef<HTMLDivElement, BitkitActionMenuGroupProps>(\n ({ label, children, ...props }, ref) => {\n return (\n <Menu.ItemGroup ref={ref} {...props}>\n <Menu.ItemGroupLabel>\n <Text>{label}</Text>\n <ChakraSeparator flex=\"1\" />\n </Menu.ItemGroupLabel>\n {children}\n </Menu.ItemGroup>\n );\n },\n);\nBitkitActionMenuGroup.displayName = 'BitkitActionMenu.Group';\n\nexport type BitkitActionMenuSeparatorProps = MenuSeparatorProps;\n\nconst BitkitActionMenuSeparator = forwardRef<HTMLHRElement, BitkitActionMenuSeparatorProps>((props, ref) => {\n return <Menu.Separator ref={ref} {...props} />;\n});\nBitkitActionMenuSeparator.displayName = 'BitkitActionMenu.Separator';\n\nexport default withSubComponents(BitkitActionMenu, {\n Group: BitkitActionMenuGroup,\n Item: BitkitActionMenuItem,\n Separator: BitkitActionMenuSeparator,\n});\n"],"mappings":";;;;;;;;;;;AAkBA,IAAM,0BAA0B,cAAqC,IAAI;AAsBzE,IAAM,oBAAoB,EAAE,SAAS,UAAU,OAAO,MAAM,GAAG,YAAmC;CAGhG,MAAM,EAAE,gBAAgB,MAAM,cAAc,oBAAoB,KAAK;CAErE,OACE,qBAAC,KAAK,MAAN;EAAiB;EAAM,GAAI;EAA3B,UAAA,CACE,oBAAC,KAAK,SAAN;GAAc,SAAA;GAAS,UAAA;EAAsB,CAAA,GAC7C,oBAAC,QAAD,EAAA,UACE,oBAAC,KAAK,YAAN,EAAA,UACE,oBAAC,wBAAwB,UAAzB;GAAkC,OAAO;GACvC,UAAA,oBAAC,KAAK,SAAN;IAAc,GAAI;IAAiB;GAAuB,CAAA;EAC1B,CAAA,EACnB,CAAA,EACX,CAAA,CACC;;AAEf;AACA,iBAAiB,cAAc;AA4C/B,IAAM,uBAAuB,YAAoD,OAAO,QAAQ;CAC9F,MAAM,EAAE,UAAU,UAAU,MAAM,MAAM,UAAU,kBAAkB;CACpE,MAAM,QAAQ,cAAc;CAE5B,MAAM,WADU,WAAW,uBACV,MAAY,OAAO,OAAO;CAC3C,MAAM,YAAY,gBAAgB,OAAO,KAAA;CACzC,MAAM,gBAAgB,MAAM;CAI5B,MAAM,eAAe,aAAuC,UAAsC;EAChG,IAAI,UAAU;GACZ,MAAM,eAAe;GACrB;EACF;EACA,UAAU,KAAK;CACjB;CAEA,MAAM,UACJ,qBAAAA,YAAA,EAAA,UAAA;EACG,QAAQ,oBAAC,MAAD,EAAM,MAAM,SAAW,CAAA;EAChC,qBAAC,KAAD;GAAK,MAAK;GAAV,UA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IAAM,4BAA4B,YAA2D,OAAO,QAAQ;CAC1G,OAAO,oBAAC,KAAK,WAAN;EAAqB;EAAK,GAAI;CAAQ,CAAA;AAC/C,CAAC;AACD,0BAA0B,cAAc;AAExC,IAAA,2BAAe,kBAAkB,kBAAkB;CACjD,OAAO;CACP,MAAM;CACN,WAAW;AACb,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BitkitAvatar.js","names":[],"sources":["../../../lib/components/BitkitAvatar/BitkitAvatar.tsx"],"sourcesContent":["import { Avatar, type AvatarRootProps } from '@chakra-ui/react/avatar';\nimport { Box } from '@chakra-ui/react/box';\nimport { useSlotRecipe } from '@chakra-ui/react/styled-system';\nimport { forwardRef } from 'react';\n\nimport { type BitkitIconComponent } from '../../icons';\nimport avatarSlotRecipe from '../../theme/slot-recipes/Avatar.recipe';\n\nexport type BitkitAvatarProps = Omit<\n AvatarRootProps,\n 'variant' | 'backgroundColor' | 'background' | 'bg' | 'colorPalette'\n> &\n (\n | {\n variant: 'image';\n src: string;\n name: string;\n icon?: never;\n iconColor?: never;\n backgroundColor?: never;\n }\n | {\n variant: 'image+icon';\n src: string;\n name: string;\n icon: BitkitIconComponent;\n iconColor?: never;\n backgroundColor?: never;\n }\n | {\n variant: 'icon';\n src?: never;\n name?: never;\n icon: BitkitIconComponent;\n iconColor?: AvatarRootProps['color'];\n backgroundColor?: AvatarRootProps['color'];\n }\n | {\n variant: 'letters';\n src?: never;\n name: string;\n icon?: never;\n iconColor?: never;\n backgroundColor?: never;\n }\n | {\n variant: 'user';\n src: string;\n name: string;\n icon?: never;\n iconColor?: never;\n backgroundColor?: never;\n }\n );\n\ntype AvatarColorVariant =\n
|
|
1
|
+
{"version":3,"file":"BitkitAvatar.js","names":[],"sources":["../../../lib/components/BitkitAvatar/BitkitAvatar.tsx"],"sourcesContent":["import { Avatar, type AvatarRootProps } from '@chakra-ui/react/avatar';\nimport { Box } from '@chakra-ui/react/box';\nimport { useSlotRecipe } from '@chakra-ui/react/styled-system';\nimport { forwardRef } from 'react';\n\nimport { type BitkitIconComponent } from '../../icons';\nimport avatarSlotRecipe from '../../theme/slot-recipes/Avatar.recipe';\n\nexport type BitkitAvatarProps = Omit<\n AvatarRootProps,\n 'variant' | 'backgroundColor' | 'background' | 'bg' | 'colorPalette'\n> &\n (\n | {\n variant: 'image';\n src: string;\n name: string;\n icon?: never;\n iconColor?: never;\n backgroundColor?: never;\n }\n | {\n variant: 'image+icon';\n src: string;\n name: string;\n icon: BitkitIconComponent;\n iconColor?: never;\n backgroundColor?: never;\n }\n | {\n variant: 'icon';\n src?: never;\n name?: never;\n icon: BitkitIconComponent;\n iconColor?: AvatarRootProps['color'];\n backgroundColor?: AvatarRootProps['color'];\n }\n | {\n variant: 'letters';\n src?: never;\n name: string;\n icon?: never;\n iconColor?: never;\n backgroundColor?: never;\n }\n | {\n variant: 'user';\n src: string;\n name: string;\n icon?: never;\n iconColor?: never;\n backgroundColor?: never;\n }\n );\n\ntype AvatarColorVariant =\n 'neutral' | 'purple' | 'indigo' | 'blue' | 'green' | 'yellow' | 'red' | 'orange' | 'turquoise';\n\nconst COLORS = Object.keys(avatarSlotRecipe.variants?.colorVariant || {}) as AvatarColorVariant[];\n\nconst pickPalette = (name?: string): AvatarColorVariant => {\n if (!name || name.length === 0) return 'neutral';\n const str = name.trim();\n return COLORS[(str.charCodeAt(0) + str.charCodeAt(str.length - 1)) % COLORS.length];\n};\n\nconst processFallbackName = (name?: string) => {\n const str = name?.trim() || '';\n return str && str.length >= 2 ? `${str[0]} ${str[str.length - 1]}` : str;\n};\n\nconst BitkitAvatar = forwardRef<HTMLDivElement, BitkitAvatarProps>((props, ref) => {\n const {\n size,\n variant,\n src,\n name,\n icon: Icon,\n colorVariant = pickPalette(name),\n iconColor,\n backgroundColor,\n ...rest\n } = props;\n\n const recipe = useSlotRecipe({ key: 'avatar' });\n const styleVariant = variant === 'user' && ['24', '32', '40', '48'].includes(size as string) ? 'circle' : 'rounded';\n const styles = recipe({ size, variant: styleVariant });\n const fallbackName = processFallbackName(name);\n\n return (\n <Avatar.Root\n ref={ref}\n size={size}\n variant={styleVariant}\n colorVariant={colorVariant}\n backgroundColor={backgroundColor}\n {...rest}\n >\n {!!fallbackName && <Avatar.Fallback name={fallbackName} />}\n {!!src && <Avatar.Image src={src} />}\n {!!Icon && variant === 'icon' && <Icon css={styles.icon} color={iconColor} size=\"24\" />}\n {!!Icon && variant === 'image+icon' && (\n <Box css={styles.badgeContainer}>\n <Icon css={styles.badge} size=\"16\" />\n </Box>\n )}\n </Avatar.Root>\n );\n});\n\nBitkitAvatar.displayName = 'BitkitAvatar';\n\nexport default BitkitAvatar;\n"],"mappings":";;;;;;;AA0DA,IAAM,SAAS,OAAO,KAAK,iBAAiB,UAAU,gBAAgB,CAAC,CAAC;AAExE,IAAM,eAAe,SAAsC;CACzD,IAAI,CAAC,QAAQ,KAAK,WAAW,GAAG,OAAO;CACvC,MAAM,MAAM,KAAK,KAAK;CACtB,OAAO,QAAQ,IAAI,WAAW,CAAC,IAAI,IAAI,WAAW,IAAI,SAAS,CAAC,KAAK,OAAO;AAC9E;AAEA,IAAM,uBAAuB,SAAkB;CAC7C,MAAM,MAAM,MAAM,KAAK,KAAK;CAC5B,OAAO,OAAO,IAAI,UAAU,IAAI,GAAG,IAAI,GAAG,GAAG,IAAI,IAAI,SAAS,OAAO;AACvE;AAEA,IAAM,eAAe,YAA+C,OAAO,QAAQ;CACjF,MAAM,EACJ,MACA,SACA,KACA,MACA,MAAM,MACN,eAAe,YAAY,IAAI,GAC/B,WACA,iBACA,GAAG,SACD;CAEJ,MAAM,SAAS,cAAc,EAAE,KAAK,SAAS,CAAC;CAC9C,MAAM,eAAe,YAAY,UAAU;EAAC;EAAM;EAAM;EAAM;CAAI,CAAC,CAAC,SAAS,IAAc,IAAI,WAAW;CAC1G,MAAM,SAAS,OAAO;EAAE;EAAM,SAAS;CAAa,CAAC;CACrD,MAAM,eAAe,oBAAoB,IAAI;CAE7C,OACE,qBAAC,OAAO,MAAR;EACO;EACC;EACN,SAAS;EACK;EACG;EACjB,GAAI;EANN,UAAA;GAQG,CAAC,CAAC,gBAAgB,oBAAC,OAAO,UAAR,EAAiB,MAAM,aAAe,CAAA;GACxD,CAAC,CAAC,OAAO,oBAAC,OAAO,OAAR,EAAmB,IAAM,CAAA;GAClC,CAAC,CAAC,QAAQ,YAAY,UAAU,oBAAC,MAAD;IAAM,KAAK,OAAO;IAAM,OAAO;IAAW,MAAK;GAAM,CAAA;GACrF,CAAC,CAAC,QAAQ,YAAY,gBACrB,oBAAC,KAAD;IAAK,KAAK,OAAO;IACf,UAAA,oBAAC,MAAD;KAAM,KAAK,OAAO;KAAO,MAAK;IAAM,CAAA;GACjC,CAAA;EAEI;;AAEjB,CAAC;AAED,aAAa,cAAc"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BitkitButton.js","names":[],"sources":["../../../lib/components/BitkitButton/BitkitButton.tsx"],"sourcesContent":["import { Button, type ButtonProps } from '@chakra-ui/react/button';\nimport { Skeleton } from '@chakra-ui/react/skeleton';\nimport { chakra, type HTMLChakraProps, type RecipeProps, useRecipe } from '@chakra-ui/react/styled-system';\nimport {\n Children,\n cloneElement,\n forwardRef,\n type KeyboardEvent,\n type MouseEvent,\n type ReactElement,\n type ReactNode,\n type Ref,\n} from 'react';\n\nimport { type BitkitIconComponent } from '../../icons';\n\ntype BitkitButtonOmittedFromButton =\n
|
|
1
|
+
{"version":3,"file":"BitkitButton.js","names":["_Fragment"],"sources":["../../../lib/components/BitkitButton/BitkitButton.tsx"],"sourcesContent":["import { Button, type ButtonProps } from '@chakra-ui/react/button';\nimport { Skeleton } from '@chakra-ui/react/skeleton';\nimport { chakra, type HTMLChakraProps, type RecipeProps, useRecipe } from '@chakra-ui/react/styled-system';\nimport {\n Children,\n cloneElement,\n forwardRef,\n type KeyboardEvent,\n type MouseEvent,\n type ReactElement,\n type ReactNode,\n type Ref,\n} from 'react';\n\nimport { type BitkitIconComponent } from '../../icons';\n\ntype BitkitButtonOmittedFromButton =\n 'asChild' | 'children' | 'colorPalette' | 'disabled' | 'loading' | 'loadingText' | 'spinner' | 'spinnerPlacement';\n\ninterface BitkitButtonCommonProps {\n icon?: BitkitIconComponent;\n suffixIcon?: BitkitIconComponent;\n}\n\nexport interface BitkitButtonAsButtonProps\n extends BitkitButtonCommonProps, Omit<ButtonProps, BitkitButtonOmittedFromButton> {\n asChild?: false;\n children: string;\n href?: undefined;\n isExternal?: undefined;\n state?: 'disabled' | 'loading' | 'skeleton';\n}\n\nexport interface BitkitButtonAsAnchorProps\n extends BitkitButtonCommonProps, Omit<HTMLChakraProps<'a'>, 'children' | 'colorPalette'>, RecipeProps<'button'> {\n asChild?: false;\n children: string;\n href: string;\n isExternal?: boolean;\n state?: 'disabled' | 'skeleton';\n}\n\ninterface BitkitButtonAsChildProps extends BitkitButtonCommonProps, Omit<ButtonProps, BitkitButtonOmittedFromButton> {\n asChild: true;\n children: ReactElement;\n href?: undefined;\n isExternal?: undefined;\n state?: 'disabled' | 'loading' | 'skeleton';\n}\n\nexport type BitkitButtonProps = BitkitButtonAsButtonProps | BitkitButtonAsAnchorProps | BitkitButtonAsChildProps;\n\n// The forwarded ref is typed as HTMLElement to cover all three modes (button, anchor, slot/asChild),\n// since asChild can render any element (router Link, custom wrappers, etc.). Inner narrow casts\n// satisfy the wrapped Chakra components without affecting the consumer-visible ref shape.\nconst BitkitButton = forwardRef<HTMLElement, BitkitButtonProps>((props, ref) => {\n const buttonRecipe = useRecipe({ key: 'button' });\n const Icon = props.icon;\n const SuffixIcon = props.suffixIcon;\n // Resolve the size the recipe would apply before branching on it: an unset `size` reaches us as\n // `undefined` because the recipe's default lives in CSS, not on the prop. Keep the fallback equal\n // to `defaultVariants.size` in Button.recipe.ts.\n const iconSize = (props.size ?? 'lg') === 'lg' ? '24' : '16';\n const isDisabled = props.state === 'disabled';\n const isSkeleton = props.state === 'skeleton';\n\n // --- Slot mode (asChild) ---\n if (props.asChild) {\n const { asChild: _asChild, children, icon: _icon, state, suffixIcon: _suffixIcon, ...buttonRest } = props;\n const onlyChild = Children.only(children) as ReactElement<{ children?: ReactNode }>;\n const buttonElement = (\n <Button\n asChild\n disabled={isDisabled}\n loading={state === 'loading'}\n ref={ref as Ref<HTMLButtonElement>}\n {...buttonRest}\n >\n {cloneElement(\n onlyChild,\n undefined,\n <>\n {Icon && <Icon marginInlineStart=\"-4\" size={iconSize} />}\n {onlyChild.props.children}\n {SuffixIcon && <SuffixIcon marginInlineEnd=\"-4\" size={iconSize} />}\n </>,\n )}\n </Button>\n );\n return isSkeleton ? (\n <Skeleton asChild loading>\n {buttonElement}\n </Skeleton>\n ) : (\n buttonElement\n );\n }\n\n // --- Anchor mode (href) ---\n if (props.href !== undefined) {\n const {\n children,\n css,\n href,\n icon: _icon,\n isExternal,\n onClick,\n onKeyDown,\n rel,\n size,\n state: _state,\n suffixIcon: _suffixIcon,\n target,\n variant,\n ...anchorRest\n } = props;\n const effectiveTarget = isExternal ? '_blank' : target;\n const effectiveRel = isExternal ? (rel ? `${rel} noreferrer noopener` : 'noreferrer noopener') : rel;\n const handleClick = isDisabled\n ? (e: MouseEvent<HTMLAnchorElement>) => {\n e.preventDefault();\n e.stopPropagation();\n }\n : onClick;\n const handleKeyDown = isDisabled\n ? (e: KeyboardEvent<HTMLAnchorElement>) => {\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault();\n e.stopPropagation();\n }\n }\n : onKeyDown;\n const anchorElement = (\n <chakra.a\n ref={ref as Ref<HTMLAnchorElement>}\n {...anchorRest}\n aria-disabled={isDisabled || undefined}\n // A native <a> can't be `:disabled`, so mark `data-disabled` too: it's the styling/interaction hook the\n // recipe's `_hover`/`_active` conditions exclude (`:not(…, [data-disabled])`), while `aria-disabled` stays\n // for a11y. Without it, hover/active would still match a disabled anchor and override the disabled colors.\n css={[buttonRecipe({ size, variant }), css]}\n data-disabled={isDisabled || undefined}\n href={isDisabled ? undefined : href}\n onClick={handleClick}\n onKeyDown={handleKeyDown}\n rel={effectiveRel}\n target={effectiveTarget}\n >\n {Icon && <Icon marginInlineStart=\"-4\" size={iconSize} />}\n {children}\n {SuffixIcon && <SuffixIcon marginInlineEnd=\"-4\" size={iconSize} />}\n </chakra.a>\n );\n return isSkeleton ? (\n <Skeleton asChild loading>\n {anchorElement}\n </Skeleton>\n ) : (\n anchorElement\n );\n }\n\n // --- Button mode (default) ---\n const { children, icon: _icon, state, suffixIcon: _suffixIcon, ...buttonRest } = props;\n return (\n <Skeleton asChild loading={isSkeleton}>\n <Button disabled={isDisabled} loading={state === 'loading'} ref={ref as Ref<HTMLButtonElement>} {...buttonRest}>\n {Icon && <Icon marginInlineStart=\"-4\" size={iconSize} />}\n {children}\n {SuffixIcon && <SuffixIcon marginInlineEnd=\"-4\" size={iconSize} />}\n </Button>\n </Skeleton>\n );\n});\n\nBitkitButton.displayName = 'BitkitButton';\n\nexport default BitkitButton;\n"],"mappings":";;;;;;AAuDA,IAAM,eAAe,YAA4C,OAAO,QAAQ;CAC9E,MAAM,eAAe,UAAU,EAAE,KAAK,SAAS,CAAC;CAChD,MAAM,OAAO,MAAM;CACnB,MAAM,aAAa,MAAM;CAIzB,MAAM,YAAY,MAAM,QAAQ,UAAU,OAAO,OAAO;CACxD,MAAM,aAAa,MAAM,UAAU;CACnC,MAAM,aAAa,MAAM,UAAU;CAGnC,IAAI,MAAM,SAAS;EACjB,MAAM,EAAE,SAAS,UAAU,UAAU,MAAM,OAAO,OAAO,YAAY,aAAa,GAAG,eAAe;EACpG,MAAM,YAAY,SAAS,KAAK,QAAQ;EACxC,MAAM,gBACJ,oBAAC,QAAD;GACE,SAAA;GACA,UAAU;GACV,SAAS,UAAU;GACd;GACL,GAAI;GAEH,UAAA,aACC,WACA,KAAA,GACA,qBAAAA,YAAA,EAAA,UAAA;IACG,QAAQ,oBAAC,MAAD;KAAM,mBAAkB;KAAK,MAAM;IAAW,CAAA;IACtD,UAAU,MAAM;IAChB,cAAc,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,SAAS;EACzB,UAAA,qBAAC,QAAD;GAAQ,UAAU;GAAY,SAAS,UAAU;GAAgB;GAA+B,GAAI;GAApG,UAAA;IACG,QAAQ,oBAAC,MAAD;KAAM,mBAAkB;KAAK,MAAM;IAAW,CAAA;IACtD;IACA,cAAc,oBAAC,YAAD;KAAY,iBAAgB;KAAK,MAAM;IAAW,CAAA;GAC3D;;CACA,CAAA;AAEd,CAAC;AAED,aAAa,cAAc"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BitkitCollapsible.js","names":[],"sources":["../../../lib/components/BitkitCollapsible/BitkitCollapsible.tsx"],"sourcesContent":["import { Box } from '@chakra-ui/react/box';\nimport { Collapsible, type CollapsibleRootProps } from '@chakra-ui/react/collapsible';\nimport { useSafeLayoutEffect } from '@chakra-ui/react/hooks';\nimport { useSlotRecipe } from '@chakra-ui/react/styled-system';\nimport { forwardRef, type ReactNode, useRef, useState } from 'react';\n\n// TODO: Investigate using AssetSelectChevron instead of IconChevronDown/IconChevronUp\nimport { IconChevronDown, IconChevronUp } from '../../icons';\nimport BitkitLabel, { type BitkitLabelProps } from '../BitkitLabel/BitkitLabel';\n\ntype UncontrolledProps = {\n defaultOpen?: boolean;\n open?: never;\n onOpenChange?: never;\n};\n\ntype ControlledProps = {\n defaultOpen?: never;\n onOpenChange: (open: boolean) => void;\n open: boolean;\n};\n\nexport type BitkitCollapsibleProps = Omit<\n CollapsibleRootProps,\n 'collapsedHeight' | 'defaultOpen' | 'onOpenChange' | 'open'\n> & {\n children: ReactNode;\n closedLabel?: string;\n collapsedHeight?: string;\n label?: string;\n labelProps?: Omit<BitkitLabelProps, 'children'>;\n openLabel?: string;\n} & (UncontrolledProps | ControlledProps);\n\n// contentRef sits on an unclamped wrapper *inside* Collapsible.Content, not on Content itself: when\n// closed, Content's own box is pinned to collapsedHeight (max-height + overflow), so a ResizeObserver\n// on Content can't see content that grows without changing Content's own (clamped) box - e.g. an image\n// or async child rendering more after mount. scrollHeight still reports the wrapper's true height\n// either way, clamped or not, so the read doesn't change - only where we watch for changes does.\n// isOverflowing and collapsedHeight are the effect's only dependencies. isOverflowing: BitkitCollapsible\n// renders a different tree depending on it (see below), moving contentRef to a different DOM node each\n// time it flips, so the effect must re-attach then. children is deliberately not a dependency: the\n// wrapper being unclamped means the observer already sees every content-driven size change on its own.\nconst useIsContentOverflowing = (collapsedHeight: string) => {\n const contentRef = useRef<HTMLDivElement>(null);\n const [isOverflowing, setIsOverflowing] = useState(true);\n\n useSafeLayoutEffect(() => {\n const contentEl = contentRef.current;\n const measureScope = contentEl?.parentElement;\n if (!contentEl || !measureScope) {\n return undefined;\n }\n\n // Appended as a sibling of contentEl (not document.body) so it inherits the same font-size and\n // CSS custom properties contentEl actually sees, resolving em/var(...) heights correctly - not\n // just px/rem, which don't depend on where in the tree they're resolved.\n const probe = document.createElement('div');\n probe.style.cssText = `position: absolute; visibility: hidden; pointer-events: none; height: ${collapsedHeight};`;\n measureScope.appendChild(probe);\n const collapsedHeightPx = probe.getBoundingClientRect().height;\n measureScope.removeChild(probe);\n\n const checkOverflow = () => setIsOverflowing(contentEl.scrollHeight > collapsedHeightPx);\n checkOverflow();\n\n if (typeof ResizeObserver === 'undefined') {\n return undefined;\n }\n\n const resizeObserver = new ResizeObserver(checkOverflow);\n resizeObserver.observe(contentEl);\n return () => resizeObserver.disconnect();\n }, [collapsedHeight, isOverflowing]);\n\n return { contentRef, isOverflowing };\n};\n\nconst BitkitCollapsible = forwardRef<HTMLDivElement, BitkitCollapsibleProps>((props, ref) => {\n const {\n children,\n closedLabel = 'Show less',\n collapsedHeight = '48px',\n collapsedWidth,\n css,\n defaultOpen,\n disabled,\n hideMode,\n ids,\n label,\n labelProps,\n lazyMount,\n onExitComplete,\n onOpenChange,\n open,\n openLabel = 'Show more',\n unmountOnExit,\n ...rest\n } = props;\n\n const recipe = useSlotRecipe({ key: 'collapsible' });\n const styles = recipe();\n\n const { contentRef, isOverflowing } = useIsContentOverflowing(collapsedHeight);\n\n const handleOpenChange = onOpenChange ? (details: { open: boolean }) => onOpenChange(details.open) : undefined;\n\n // zag's closed-state styling (min/max-height clamp, the fade-out pseudo-element) is driven purely by\n // Collapsible.Root defaulting to \"closed\" - it doesn't know or care whether collapsedHeight would\n // ever actually clip anything. Passing collapsedHeight and hiding only the trigger still leaves\n // content that fits pinned to that height and faded, so when it doesn't overflow we skip\n // Collapsible.Root/Content entirely and render plain markup instead of fighting the closed-state\n // styling with overrides. Only styles.root applies here - it carries the inherited color/textStyle,\n // which is all a non-collapsing block needs; styles.content's overflow/position/fade rules are\n // collapse-only and would clip content (a focus ring, an absolutely-positioned child) that isn't\n // meant to be clipped. contentRef sits directly under styles.root rather than under a styles.content\n // box, so measureScope (its parent) is styles.root in this branch and styles.content in the\n // overflowing one below - both carry the same inherited font-size, since textStyle now lives on\n // root and cascades down, so collapsedHeight's em/var(...) units resolve the same way in either\n // branch. disabled/ids/collapsedWidth/onExitComplete/lazyMount/unmountOnExit/hideMode\n // are zag/Ark machine props with no meaning on plain markup, so they're destructured out above and\n // only forwarded to Collapsible.Root below - otherwise they'd reach the DOM as unknown attributes.\n //\n // isOverflowing starts true, so every mount (even of content that turns out to fit) renders through\n // this Collapsible.Root tree first and flips to the plain tree below once measured - a real\n // remount of children, since the two trees don't share a component type at that position. Same\n // going the other way on a runtime resize. Accepted tradeoff: measuring requires a real layout\n // pass, and we don't have the content's size before that first render.\n if (!isOverflowing) {\n return (\n <Box ref={ref} css={[styles.root, css]} {...rest}>\n {label && <BitkitLabel {...labelProps}>{label}</BitkitLabel>}\n <Box ref={contentRef}>{children}</Box>\n </Box>\n );\n }\n\n return (\n <Collapsible.Root\n ref={ref}\n collapsedHeight={collapsedHeight}\n collapsedWidth={collapsedWidth}\n css={[styles.root, css]}\n defaultOpen={defaultOpen}\n disabled={disabled}\n hideMode={hideMode}\n ids={ids}\n lazyMount={lazyMount}\n onExitComplete={onExitComplete}\n onOpenChange={handleOpenChange}\n open={open}\n unmountOnExit={unmountOnExit}\n {...rest}\n >\n {label && <BitkitLabel {...labelProps}>{label}</BitkitLabel>}\n <Collapsible.Content css={styles.content}>\n <Box ref={contentRef}>{children}</Box>\n </Collapsible.Content>\n <Collapsible.Trigger css={styles.trigger}>\n <Collapsible.Context>\n {(api) => (\n <>\n {api.open ? closedLabel : openLabel}\n {api.open ? <IconChevronUp size=\"16\" /> : <IconChevronDown size=\"16\" />}\n </>\n )}\n </Collapsible.Context>\n </Collapsible.Trigger>\n </Collapsible.Root>\n );\n});\n\nBitkitCollapsible.displayName = 'BitkitCollapsible';\n\nexport default BitkitCollapsible;\n"],"mappings":";;;;;;;;;;AA2CA,IAAM,2BAA2B,oBAA4B;CAC3D,MAAM,aAAa,OAAuB,IAAI;CAC9C,MAAM,CAAC,eAAe,oBAAoB,SAAS,IAAI;CAEvD,0BAA0B;EACxB,MAAM,YAAY,WAAW;EAC7B,MAAM,eAAe,WAAW;EAChC,IAAI,CAAC,aAAa,CAAC,cACjB;EAMF,MAAM,QAAQ,SAAS,cAAc,KAAK;EAC1C,MAAM,MAAM,UAAU,yEAAyE,gBAAgB;EAC/G,aAAa,YAAY,KAAK;EAC9B,MAAM,oBAAoB,MAAM,sBAAsB,CAAC,CAAC;EACxD,aAAa,YAAY,KAAK;EAE9B,MAAM,sBAAsB,iBAAiB,UAAU,eAAe,iBAAiB;EACvF,cAAc;EAEd,IAAI,OAAO,mBAAmB,aAC5B;EAGF,MAAM,iBAAiB,IAAI,eAAe,aAAa;EACvD,eAAe,QAAQ,SAAS;EAChC,aAAa,eAAe,WAAW;CACzC,GAAG,CAAC,iBAAiB,aAAa,CAAC;CAEnC,OAAO;EAAE;EAAY;CAAc;AACrC;AAEA,IAAM,oBAAoB,YAAoD,OAAO,QAAQ;CAC3F,MAAM,EACJ,UACA,cAAc,aACd,kBAAkB,QAClB,gBACA,KACA,aACA,UACA,UACA,KACA,OACA,YACA,WACA,gBACA,cACA,MACA,YAAY,aACZ,eACA,GAAG,SACD;CAGJ,MAAM,SADS,cAAc,EAAE,KAAK,cAAc,CACnC,CAAA,CAAO;CAEtB,MAAM,EAAE,YAAY,kBAAkB,wBAAwB,eAAe;CAE7E,MAAM,mBAAmB,gBAAgB,YAA+B,aAAa,QAAQ,IAAI,IAAI,KAAA;CAuBrG,IAAI,CAAC,eACH,OACE,qBAAC,KAAD;EAAU;EAAK,KAAK,CAAC,OAAO,MAAM,GAAG;EAAG,GAAI;EAA5C,UAAA,CACG,SAAS,oBAAC,aAAD;GAAa,GAAI;GAAa,UAAA;EAAmB,CAAA,GAC3D,oBAAC,KAAD;GAAK,KAAK;GAAa;EAAc,CAAA,CAClC;;CAIT,OACE,qBAAC,YAAY,MAAb;EACO;EACY;EACD;EAChB,KAAK,CAAC,OAAO,MAAM,GAAG;EACT;EACH;EACA;EACL;EACM;EACK;EAChB,cAAc;EACR;EACS;EACf,GAAI;EAdN,UAAA;GAgBG,SAAS,oBAAC,aAAD;IAAa,GAAI;IAAa,UAAA;GAAmB,CAAA;GAC3D,oBAAC,YAAY,SAAb;IAAqB,KAAK,OAAO;IAC/B,UAAA,oBAAC,KAAD;KAAK,KAAK;KAAa;IAAc,CAAA;GAClB,CAAA;GACrB,oBAAC,YAAY,SAAb;IAAqB,KAAK,OAAO;IAC/B,UAAA,oBAAC,YAAY,SAAb,EAAA,WACI,QACA,
|
|
1
|
+
{"version":3,"file":"BitkitCollapsible.js","names":["_Fragment"],"sources":["../../../lib/components/BitkitCollapsible/BitkitCollapsible.tsx"],"sourcesContent":["import { Box } from '@chakra-ui/react/box';\nimport { Collapsible, type CollapsibleRootProps } from '@chakra-ui/react/collapsible';\nimport { useSafeLayoutEffect } from '@chakra-ui/react/hooks';\nimport { useSlotRecipe } from '@chakra-ui/react/styled-system';\nimport { forwardRef, type ReactNode, useRef, useState } from 'react';\n\n// TODO: Investigate using AssetSelectChevron instead of IconChevronDown/IconChevronUp\nimport { IconChevronDown, IconChevronUp } from '../../icons';\nimport BitkitLabel, { type BitkitLabelProps } from '../BitkitLabel/BitkitLabel';\n\ntype UncontrolledProps = {\n defaultOpen?: boolean;\n open?: never;\n onOpenChange?: never;\n};\n\ntype ControlledProps = {\n defaultOpen?: never;\n onOpenChange: (open: boolean) => void;\n open: boolean;\n};\n\nexport type BitkitCollapsibleProps = Omit<\n CollapsibleRootProps,\n 'collapsedHeight' | 'defaultOpen' | 'onOpenChange' | 'open'\n> & {\n children: ReactNode;\n closedLabel?: string;\n collapsedHeight?: string;\n label?: string;\n labelProps?: Omit<BitkitLabelProps, 'children'>;\n openLabel?: string;\n} & (UncontrolledProps | ControlledProps);\n\n// contentRef sits on an unclamped wrapper *inside* Collapsible.Content, not on Content itself: when\n// closed, Content's own box is pinned to collapsedHeight (max-height + overflow), so a ResizeObserver\n// on Content can't see content that grows without changing Content's own (clamped) box - e.g. an image\n// or async child rendering more after mount. scrollHeight still reports the wrapper's true height\n// either way, clamped or not, so the read doesn't change - only where we watch for changes does.\n// isOverflowing and collapsedHeight are the effect's only dependencies. isOverflowing: BitkitCollapsible\n// renders a different tree depending on it (see below), moving contentRef to a different DOM node each\n// time it flips, so the effect must re-attach then. children is deliberately not a dependency: the\n// wrapper being unclamped means the observer already sees every content-driven size change on its own.\nconst useIsContentOverflowing = (collapsedHeight: string) => {\n const contentRef = useRef<HTMLDivElement>(null);\n const [isOverflowing, setIsOverflowing] = useState(true);\n\n useSafeLayoutEffect(() => {\n const contentEl = contentRef.current;\n const measureScope = contentEl?.parentElement;\n if (!contentEl || !measureScope) {\n return undefined;\n }\n\n // Appended as a sibling of contentEl (not document.body) so it inherits the same font-size and\n // CSS custom properties contentEl actually sees, resolving em/var(...) heights correctly - not\n // just px/rem, which don't depend on where in the tree they're resolved.\n const probe = document.createElement('div');\n probe.style.cssText = `position: absolute; visibility: hidden; pointer-events: none; height: ${collapsedHeight};`;\n measureScope.appendChild(probe);\n const collapsedHeightPx = probe.getBoundingClientRect().height;\n measureScope.removeChild(probe);\n\n const checkOverflow = () => setIsOverflowing(contentEl.scrollHeight > collapsedHeightPx);\n checkOverflow();\n\n if (typeof ResizeObserver === 'undefined') {\n return undefined;\n }\n\n const resizeObserver = new ResizeObserver(checkOverflow);\n resizeObserver.observe(contentEl);\n return () => resizeObserver.disconnect();\n }, [collapsedHeight, isOverflowing]);\n\n return { contentRef, isOverflowing };\n};\n\nconst BitkitCollapsible = forwardRef<HTMLDivElement, BitkitCollapsibleProps>((props, ref) => {\n const {\n children,\n closedLabel = 'Show less',\n collapsedHeight = '48px',\n collapsedWidth,\n css,\n defaultOpen,\n disabled,\n hideMode,\n ids,\n label,\n labelProps,\n lazyMount,\n onExitComplete,\n onOpenChange,\n open,\n openLabel = 'Show more',\n unmountOnExit,\n ...rest\n } = props;\n\n const recipe = useSlotRecipe({ key: 'collapsible' });\n const styles = recipe();\n\n const { contentRef, isOverflowing } = useIsContentOverflowing(collapsedHeight);\n\n const handleOpenChange = onOpenChange ? (details: { open: boolean }) => onOpenChange(details.open) : undefined;\n\n // zag's closed-state styling (min/max-height clamp, the fade-out pseudo-element) is driven purely by\n // Collapsible.Root defaulting to \"closed\" - it doesn't know or care whether collapsedHeight would\n // ever actually clip anything. Passing collapsedHeight and hiding only the trigger still leaves\n // content that fits pinned to that height and faded, so when it doesn't overflow we skip\n // Collapsible.Root/Content entirely and render plain markup instead of fighting the closed-state\n // styling with overrides. Only styles.root applies here - it carries the inherited color/textStyle,\n // which is all a non-collapsing block needs; styles.content's overflow/position/fade rules are\n // collapse-only and would clip content (a focus ring, an absolutely-positioned child) that isn't\n // meant to be clipped. contentRef sits directly under styles.root rather than under a styles.content\n // box, so measureScope (its parent) is styles.root in this branch and styles.content in the\n // overflowing one below - both carry the same inherited font-size, since textStyle now lives on\n // root and cascades down, so collapsedHeight's em/var(...) units resolve the same way in either\n // branch. disabled/ids/collapsedWidth/onExitComplete/lazyMount/unmountOnExit/hideMode\n // are zag/Ark machine props with no meaning on plain markup, so they're destructured out above and\n // only forwarded to Collapsible.Root below - otherwise they'd reach the DOM as unknown attributes.\n //\n // isOverflowing starts true, so every mount (even of content that turns out to fit) renders through\n // this Collapsible.Root tree first and flips to the plain tree below once measured - a real\n // remount of children, since the two trees don't share a component type at that position. Same\n // going the other way on a runtime resize. Accepted tradeoff: measuring requires a real layout\n // pass, and we don't have the content's size before that first render.\n if (!isOverflowing) {\n return (\n <Box ref={ref} css={[styles.root, css]} {...rest}>\n {label && <BitkitLabel {...labelProps}>{label}</BitkitLabel>}\n <Box ref={contentRef}>{children}</Box>\n </Box>\n );\n }\n\n return (\n <Collapsible.Root\n ref={ref}\n collapsedHeight={collapsedHeight}\n collapsedWidth={collapsedWidth}\n css={[styles.root, css]}\n defaultOpen={defaultOpen}\n disabled={disabled}\n hideMode={hideMode}\n ids={ids}\n lazyMount={lazyMount}\n onExitComplete={onExitComplete}\n onOpenChange={handleOpenChange}\n open={open}\n unmountOnExit={unmountOnExit}\n {...rest}\n >\n {label && <BitkitLabel {...labelProps}>{label}</BitkitLabel>}\n <Collapsible.Content css={styles.content}>\n <Box ref={contentRef}>{children}</Box>\n </Collapsible.Content>\n <Collapsible.Trigger css={styles.trigger}>\n <Collapsible.Context>\n {(api) => (\n <>\n {api.open ? closedLabel : openLabel}\n {api.open ? <IconChevronUp size=\"16\" /> : <IconChevronDown size=\"16\" />}\n </>\n )}\n </Collapsible.Context>\n </Collapsible.Trigger>\n </Collapsible.Root>\n );\n});\n\nBitkitCollapsible.displayName = 'BitkitCollapsible';\n\nexport default BitkitCollapsible;\n"],"mappings":";;;;;;;;;;AA2CA,IAAM,2BAA2B,oBAA4B;CAC3D,MAAM,aAAa,OAAuB,IAAI;CAC9C,MAAM,CAAC,eAAe,oBAAoB,SAAS,IAAI;CAEvD,0BAA0B;EACxB,MAAM,YAAY,WAAW;EAC7B,MAAM,eAAe,WAAW;EAChC,IAAI,CAAC,aAAa,CAAC,cACjB;EAMF,MAAM,QAAQ,SAAS,cAAc,KAAK;EAC1C,MAAM,MAAM,UAAU,yEAAyE,gBAAgB;EAC/G,aAAa,YAAY,KA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c,CAAA;GAClB,CAAA;GACrB,oBAAC,YAAY,SAAb;IAAqB,KAAK,OAAO;IAC/B,UAAA,oBAAC,YAAY,SAAb,EAAA,WACI,QACA,qBAAAA,YAAA,EAAA,UAAA,CACG,IAAI,OAAO,cAAc,WACzB,IAAI,OAAO,oBAAC,eAAD,EAAe,MAAK,KAAM,CAAA,IAAI,oBAAC,iBAAD,EAAiB,MAAK,KAAM,CAAA,CACtE,EAAA,CAAA,EAEe,CAAA;GACF,CAAA;EACL;;AAEtB,CAAC;AAED,kBAAkB,cAAc"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BitkitColorButton.js","names":[],"sources":["../../../lib/components/BitkitColorButton/BitkitColorButton.tsx"],"sourcesContent":["import { Spinner } from '@chakra-ui/react/spinner';\nimport { createRecipeContext, type HTMLChakraProps, type RecipeProps } from '@chakra-ui/react/styled-system';\nimport { Text } from '@chakra-ui/react/text';\nimport { forwardRef, type KeyboardEvent, type MouseEvent, type Ref } from 'react';\n\nimport { type BitkitIconComponent } from '../../icons';\nimport colorButtonRecipe from '../../theme/recipes/ColorButton.recipe';\n\ntype ColorButtonOmitted = 'as' | 'colorPalette' | 'size' | 'type';\n\ntype StyledButtonProps = Omit<HTMLChakraProps<'button'>, 'colorPalette' | 'size'> & RecipeProps<'colorButton'>;\ntype StyledAnchorProps = Omit<HTMLChakraProps<'a'>, 'colorPalette' | 'size'> & RecipeProps<'colorButton'>;\n\ninterface BitkitColorButtonCommonProps extends RecipeProps<'colorButton'> {\n /**\n * Disabled or loading state of the control. Both are honoured in anchor mode too.\n *\n * Note that `'loading'` behaves differently here than on `BitkitButton`, which delegates to\n * Chakra's `Button loading` and therefore also *disables* and dims the control. This one stays\n * focusable and undimmed: the label keeps its width, a spinner is overlaid on top of it, and\n * activation is blocked by a click guard — so a keyboard or screen reader user doesn't lose the\n * element they were on the moment they press it.\n */\n state?: 'disabled' | 'loading';\n suffixIcon?: BitkitIconComponent;\n}\n\nexport interface BitkitColorButtonAsButtonProps\n extends BitkitColorButtonCommonProps, Omit<HTMLChakraProps<'button'>, ColorButtonOmitted | 'disabled'> {\n href?: undefined;\n isExternal?: undefined;\n}\n\nexport interface BitkitColorButtonAsAnchorProps\n extends BitkitColorButtonCommonProps, Omit<HTMLChakraProps<'a'>, ColorButtonOmitted> {\n href: string;\n isExternal?: boolean;\n}\n\nexport type BitkitColorButtonProps = BitkitColorButtonAsButtonProps | BitkitColorButtonAsAnchorProps;\n\nconst { withContext } = createRecipeContext({ recipe: colorButtonRecipe });\n\nconst StyledButton = withContext<HTMLButtonElement, StyledButtonProps>('button');\n\nconst StyledAnchor = withContext<HTMLAnchorElement, StyledAnchorProps>('a');\n\nconst BitkitColorButton = forwardRef<HTMLButtonElement | HTMLAnchorElement, BitkitColorButtonProps>((props, ref) => {\n const { children, size, state, suffixIcon: SuffixIcon } = props;\n const isDisabled = state === 'disabled';\n const isLoading = state === 'loading';\n const isInactive = isDisabled || isLoading;\n const spinnerSize = size === 'lg' ? '20' : '16';\n // Keep the fallback equal to `defaultVariants.size` in ColorButton.recipe.ts.\n const iconSize = (size ?? 'sm') === 'lg' ? '24' : '16';\n\n const content = (\n <>\n {isLoading ? (\n // `opacity: 0` rather than `visibility: hidden`: both reserve the label's width so the\n // button doesn't collapse, but `visibility: hidden` also drops it from the accessibility\n // tree — leaving a focusable control with no accessible name.\n <Text as=\"span\" opacity=\"0\" userSelect=\"none\">\n {children}\n </Text>\n ) : (\n children\n )}\n {SuffixIcon && (\n <SuffixIcon marginInlineEnd=\"-4\" marginInlineStart=\"8\" opacity={isLoading ? 0 : undefined} size={iconSize} />\n )}\n {isLoading && (\n <Spinner\n position=\"absolute\"\n insetBlock=\"0\"\n insetInline=\"0\"\n margin=\"auto\"\n height={spinnerSize}\n width={spinnerSize}\n />\n )}\n </>\n );\n\n // --- Anchor mode (href) ---\n if (props.href !== undefined) {\n const {\n children: _children,\n href,\n isExternal,\n onClick,\n onKeyDown,\n rel,\n state: _state,\n suffixIcon: _suffixIcon,\n target,\n ...anchorRest\n } = props;\n const effectiveTarget = isExternal ? '_blank' : target;\n const effectiveRel = isExternal ? (rel ? `${rel} noreferrer noopener` : 'noreferrer noopener') : rel;\n const handleClick = isInactive\n ? (e: MouseEvent<HTMLAnchorElement>) => {\n e.preventDefault();\n e.stopPropagation();\n }\n : onClick;\n // What actually blocks keyboard activation in both states is `handleClick`: neither state\n // removes the anchor from the tab order (`loading` never sets `disabled`, and a disabled anchor\n // is only `aria-disabled`), and Enter/Space dispatch a click, which the guard above swallows.\n // The keydown guard is the extra layer an anchor needs, since it never gets the native\n // `disabled` treatment a button does.\n const handleKeyDown = isInactive\n ? (e: KeyboardEvent<HTMLAnchorElement>) => {\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault();\n e.stopPropagation();\n }\n }\n : onKeyDown;\n\n return (\n <StyledAnchor\n ref={ref as Ref<HTMLAnchorElement>}\n {...anchorRest}\n aria-disabled={isDisabled || undefined}\n data-disabled={isDisabled || undefined}\n // `data-loading` (not `aria-busy`) — it's the styling hook the recipe's `_loading` condition\n // reads, without claiming ARIA semantics that aren't announced anyway. Announcing the state\n // change to assistive tech needs a live region inside the component; that's its own change.\n data-loading={isLoading || undefined}\n // The `href` is kept while loading — so the link stays focusable and keeps its accessible\n // name, with activation still blocked by the guards above — and dropped only when disabled,\n // to take the anchor out of the tab order and make it fully inert.\n href={isDisabled ? undefined : href}\n onClick={handleClick}\n onKeyDown={handleKeyDown}\n rel={effectiveRel}\n target={effectiveTarget}\n >\n {content}\n </StyledAnchor>\n );\n }\n\n // --- Button mode (default) ---\n const { children: _children, onClick, state: _state, suffixIcon: _suffixIcon, ...buttonRest } = props;\n const handleClick = isInactive\n ? (e: MouseEvent<HTMLButtonElement>) => {\n e.preventDefault();\n e.stopPropagation();\n }\n : onClick;\n\n return (\n <StyledButton\n ref={ref as Ref<HTMLButtonElement>}\n {...buttonRest}\n data-loading={isLoading || undefined}\n disabled={isDisabled}\n onClick={handleClick}\n type=\"button\"\n >\n {content}\n </StyledButton>\n );\n});\n\nBitkitColorButton.displayName = 'BitkitColorButton';\n\nexport default BitkitColorButton;\n"],"mappings":";;;;;;;AAyCA,IAAM,EAAE,gBAAgB,oBAAoB,EAAE,QAAQ,kBAAkB,CAAC;AAEzE,IAAM,eAAe,YAAkD,QAAQ;AAE/E,IAAM,eAAe,YAAkD,GAAG;AAE1E,IAAM,oBAAoB,YAA2E,OAAO,QAAQ;CAClH,MAAM,EAAE,UAAU,MAAM,OAAO,YAAY,eAAe;CAC1D,MAAM,aAAa,UAAU;CAC7B,MAAM,YAAY,UAAU;CAC5B,MAAM,aAAa,cAAc;CACjC,MAAM,cAAc,SAAS,OAAO,OAAO;CAI3C,MAAM,UACJ,
|
|
1
|
+
{"version":3,"file":"BitkitColorButton.js","names":["_Fragment"],"sources":["../../../lib/components/BitkitColorButton/BitkitColorButton.tsx"],"sourcesContent":["import { Spinner } from '@chakra-ui/react/spinner';\nimport { createRecipeContext, type HTMLChakraProps, type RecipeProps } from '@chakra-ui/react/styled-system';\nimport { Text } from '@chakra-ui/react/text';\nimport { forwardRef, type KeyboardEvent, type MouseEvent, type Ref } from 'react';\n\nimport { type BitkitIconComponent } from '../../icons';\nimport colorButtonRecipe from '../../theme/recipes/ColorButton.recipe';\n\ntype ColorButtonOmitted = 'as' | 'colorPalette' | 'size' | 'type';\n\ntype StyledButtonProps = Omit<HTMLChakraProps<'button'>, 'colorPalette' | 'size'> & RecipeProps<'colorButton'>;\ntype StyledAnchorProps = Omit<HTMLChakraProps<'a'>, 'colorPalette' | 'size'> & RecipeProps<'colorButton'>;\n\ninterface BitkitColorButtonCommonProps extends RecipeProps<'colorButton'> {\n /**\n * Disabled or loading state of the control. Both are honoured in anchor mode too.\n *\n * Note that `'loading'` behaves differently here than on `BitkitButton`, which delegates to\n * Chakra's `Button loading` and therefore also *disables* and dims the control. This one stays\n * focusable and undimmed: the label keeps its width, a spinner is overlaid on top of it, and\n * activation is blocked by a click guard — so a keyboard or screen reader user doesn't lose the\n * element they were on the moment they press it.\n */\n state?: 'disabled' | 'loading';\n suffixIcon?: BitkitIconComponent;\n}\n\nexport interface BitkitColorButtonAsButtonProps\n extends BitkitColorButtonCommonProps, Omit<HTMLChakraProps<'button'>, ColorButtonOmitted | 'disabled'> {\n href?: undefined;\n isExternal?: undefined;\n}\n\nexport interface BitkitColorButtonAsAnchorProps\n extends BitkitColorButtonCommonProps, Omit<HTMLChakraProps<'a'>, ColorButtonOmitted> {\n href: string;\n isExternal?: boolean;\n}\n\nexport type BitkitColorButtonProps = BitkitColorButtonAsButtonProps | BitkitColorButtonAsAnchorProps;\n\nconst { withContext } = createRecipeContext({ recipe: colorButtonRecipe });\n\nconst StyledButton = withContext<HTMLButtonElement, StyledButtonProps>('button');\n\nconst StyledAnchor = withContext<HTMLAnchorElement, StyledAnchorProps>('a');\n\nconst BitkitColorButton = forwardRef<HTMLButtonElement | HTMLAnchorElement, BitkitColorButtonProps>((props, ref) => {\n const { children, size, state, suffixIcon: SuffixIcon } = props;\n const isDisabled = state === 'disabled';\n const isLoading = state === 'loading';\n const isInactive = isDisabled || isLoading;\n const spinnerSize = size === 'lg' ? '20' : '16';\n // Keep the fallback equal to `defaultVariants.size` in ColorButton.recipe.ts.\n const iconSize = (size ?? 'sm') === 'lg' ? '24' : '16';\n\n const content = (\n <>\n {isLoading ? (\n // `opacity: 0` rather than `visibility: hidden`: both reserve the label's width so the\n // button doesn't collapse, but `visibility: hidden` also drops it from the accessibility\n // tree — leaving a focusable control with no accessible name.\n <Text as=\"span\" opacity=\"0\" userSelect=\"none\">\n {children}\n </Text>\n ) : (\n children\n )}\n {SuffixIcon && (\n <SuffixIcon marginInlineEnd=\"-4\" marginInlineStart=\"8\" opacity={isLoading ? 0 : undefined} size={iconSize} />\n )}\n {isLoading && (\n <Spinner\n position=\"absolute\"\n insetBlock=\"0\"\n insetInline=\"0\"\n margin=\"auto\"\n height={spinnerSize}\n width={spinnerSize}\n />\n )}\n </>\n );\n\n // --- Anchor mode (href) ---\n if (props.href !== undefined) {\n const {\n children: _children,\n href,\n isExternal,\n onClick,\n onKeyDown,\n rel,\n state: _state,\n suffixIcon: _suffixIcon,\n target,\n ...anchorRest\n } = props;\n const effectiveTarget = isExternal ? '_blank' : target;\n const effectiveRel = isExternal ? (rel ? `${rel} noreferrer noopener` : 'noreferrer noopener') : rel;\n const handleClick = isInactive\n ? (e: MouseEvent<HTMLAnchorElement>) => {\n e.preventDefault();\n e.stopPropagation();\n }\n : onClick;\n // What actually blocks keyboard activation in both states is `handleClick`: neither state\n // removes the anchor from the tab order (`loading` never sets `disabled`, and a disabled anchor\n // is only `aria-disabled`), and Enter/Space dispatch a click, which the guard above swallows.\n // The keydown guard is the extra layer an anchor needs, since it never gets the native\n // `disabled` treatment a button does.\n const handleKeyDown = isInactive\n ? (e: KeyboardEvent<HTMLAnchorElement>) => {\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault();\n e.stopPropagation();\n }\n }\n : onKeyDown;\n\n return (\n <StyledAnchor\n ref={ref as Ref<HTMLAnchorElement>}\n {...anchorRest}\n aria-disabled={isDisabled || undefined}\n data-disabled={isDisabled || undefined}\n // `data-loading` (not `aria-busy`) — it's the styling hook the recipe's `_loading` condition\n // reads, without claiming ARIA semantics that aren't announced anyway. Announcing the state\n // change to assistive tech needs a live region inside the component; that's its own change.\n data-loading={isLoading || undefined}\n // The `href` is kept while loading — so the link stays focusable and keeps its accessible\n // name, with activation still blocked by the guards above — and dropped only when disabled,\n // to take the anchor out of the tab order and make it fully inert.\n href={isDisabled ? undefined : href}\n onClick={handleClick}\n onKeyDown={handleKeyDown}\n rel={effectiveRel}\n target={effectiveTarget}\n >\n {content}\n </StyledAnchor>\n );\n }\n\n // --- Button mode (default) ---\n const { children: _children, onClick, state: _state, suffixIcon: _suffixIcon, ...buttonRest } = props;\n const handleClick = isInactive\n ? (e: MouseEvent<HTMLButtonElement>) => {\n e.preventDefault();\n e.stopPropagation();\n }\n : onClick;\n\n return (\n <StyledButton\n ref={ref as Ref<HTMLButtonElement>}\n {...buttonRest}\n data-loading={isLoading || undefined}\n disabled={isDisabled}\n onClick={handleClick}\n type=\"button\"\n >\n {content}\n </StyledButton>\n );\n});\n\nBitkitColorButton.displayName = 'BitkitColorButton';\n\nexport default BitkitColorButton;\n"],"mappings":";;;;;;;AAyCA,IAAM,EAAE,gBAAgB,oBAAoB,EAAE,QAAQ,kBAAkB,CAAC;AAEzE,IAAM,eAAe,YAAkD,QAAQ;AAE/E,IAAM,eAAe,YAAkD,GAAG;AAE1E,IAAM,oBAAoB,YAA2E,OAAO,QAAQ;CAClH,MAAM,EAAE,UAAU,MAAM,OAAO,YAAY,eAAe;CAC1D,MAAM,aAAa,UAAU;CAC7B,MAAM,YAAY,UAAU;CAC5B,MAAM,aAAa,cAAc;CACjC,MAAM,cAAc,SAAS,OAAO,OAAO;CAI3C,MAAM,UACJ,qBAAAA,YAAA,EAAA,UAAA;EACG,YAIC,oBAAC,MAAD;GAAM,IAAG;GAAO,SAAQ;GAAI,YAAW;GACpC;EACG,CAAA,IAEN;EAED,cACC,oBAAC,YAAD;GAAY,iBAAgB;GAAK,mBAAkB;GAAI,SAAS,YAAY,IAAI,KAAA;GAAW,OAf/E,QAAQ,UAAU,OAAO,OAAO;EAegE,CAAA;EAE7G,aACC,oBAAC,SAAD;GACE,UAAS;GACT,YAAW;GACX,aAAY;GACZ,QAAO;GACP,QAAQ;GACR,OAAO;EACR,CAAA;CAEH,EAAA,CAAA;CAIJ,IAAI,MAAM,SAAS,KAAA,GAAW;EAC5B,MAAM,EACJ,UAAU,WACV,MACA,YACA,SACA,WACA,KACA,OAAO,QACP,YAAY,aACZ,QACA,GAAG,eACD;EACJ,MAAM,kBAAkB,aAAa,WAAW;EAChD,MAAM,eAAe,aAAc,MAAM,GAAG,IAAI,wBAAwB,wBAAyB;EACjG,MAAM,cAAc,cACf,MAAqC;GACpC,EAAE,eAAe;GACjB,EAAE,gBAAgB;EACpB,IACA;EAMJ,MAAM,gBAAgB,cACjB,MAAwC;GACvC,IAAI,EAAE,QAAQ,WAAW,EAAE,QAAQ,KAAK;IACtC,EAAE,eAAe;IACjB,EAAE,gBAAgB;GACpB;EACF,IACA;EAEJ,OACE,oBAAC,cAAD;GACO;GACL,GAAI;GACJ,iBAAe,cAAc,KAAA;GAC7B,iBAAe,cAAc,KAAA;GAI7B,gBAAc,aAAa,KAAA;GAI3B,MAAM,aAAa,KAAA,IAAY;GAC/B,SAAS;GACT,WAAW;GACX,KAAK;GACL,QAAQ;GAEP,UAAA;EACW,CAAA;CAElB;CAGA,MAAM,EAAE,UAAU,WAAW,SAAS,OAAO,QAAQ,YAAY,aAAa,GAAG,eAAe;CAChG,MAAM,cAAc,cACf,MAAqC;EACpC,EAAE,eAAe;EACjB,EAAE,gBAAgB;CACpB,IACA;CAEJ,OACE,oBAAC,cAAD;EACO;EACL,GAAI;EACJ,gBAAc,aAAa,KAAA;EAC3B,UAAU;EACV,SAAS;EACT,MAAK;EAEJ,UAAA;CACW,CAAA;AAElB,CAAC;AAED,kBAAkB,cAAc"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BitkitStepsDialog.js","names":[],"sources":["../../../lib/components/BitkitDialog/BitkitStepsDialog.tsx"],"sourcesContent":["import { Box } from '@chakra-ui/react/box';\nimport { Dialog } from '@chakra-ui/react/dialog';\nimport { type ReactElement, type ReactNode, useCallback, useMemo, useState } from 'react';\n\nimport { type BitkitDataAttributes } from '../../utilities/dataAttributes';\nimport { flattenChildren } from '../../utilities/flattenChildren';\nimport { withSubComponents } from '../../utilities/withSubComponents';\nimport BitkitSteps from '../BitkitSteps/BitkitSteps';\nimport BitkitStepsDialogStep, { type BitkitStepsDialogStepProps } from './BitkitStepsDialogStep';\nimport DialogInner from './DialogInner';\nimport DialogShell, { type DialogShellProps } from './DialogShell';\nimport { StepsDialogProvider } from './StepsDialogContext';\n\nexport { useStepsDialog } from './StepsDialogContext';\n\nexport type BitkitStepsDialogProps = {\n /** `BitkitStepsDialog.Step` children, one per step. */\n children: ReactNode;\n /** Initial step when uncontrolled. Resets to this when the dialog closes. */\n defaultStep?: number;\n /** Set to `false` to remove every dismiss route that skips a decision: no close button, no ESC. */\n dismissible?: boolean;\n /** Element to focus when the dialog opens, instead of the first focusable one. */\n initialFocusEl?: DialogShellProps['initialFocusEl'];\n /**\n * The step navigation, built with `useStepsDialog()`. Pass the buttons themselves: the dialog lays\n * them out the way the design asks for, leading action on the left, the step navigation opposite.\n * A footer with no leading action passes a single group, which stays on the right.\n */\n footerButtons?: ReactNode;\n /** Arbitrary content rendered raw inside the footer, above `footerButtons` (e.g. a `BitkitAlert`). */\n footerContent?: ReactNode;\n headerLabel?: string;\n maxHeight?: string;\n onExitComplete?: () => void;\n onOpenChange?: (details: { open: boolean }) => void;\n /** Called whenever the active step changes (controlled or uncontrolled). */\n onStepChange?: (step: number) => void;\n open?: boolean;\n preventScroll?: boolean;\n scrollBehavior?: 'inside' | 'outside';\n showScrollGradient?: boolean;\n size?: 'sm' | 'md' | 'lg' | 'full';\n /**\n * `loading` locks the dialog while a background action runs: the close button stays in place but\n * disabled, and ESC is blocked. Use it alongside the footer button's own `state=\"loading\"`.\n */\n state?: 'loading';\n /** Controlled active step. Omit for uncontrolled (see `defaultStep`). */\n step?: number;\n title: ReactNode;\n trigger?: ReactNode;\n variant?: 'overflowContent';\n // Data attributes are forwarded to the element carrying `role=\"dialog\"`, and nothing else is —\n // style props, `className` and `id` don't pass through.\n} & BitkitDataAttributes;\n\n/**\n * A dialog that walks through a sequence of `BitkitStepsDialog.Step` children. It owns the step\n * state, auto-renders the steps header, and shows only the active step's body. The consumer builds\n * the step navigation with the `useStepsDialog()` hook and passes it in as `footerButtons`.\n */\nconst BitkitStepsDialog = ({\n children,\n defaultStep = 0,\n dismissible = true,\n initialFocusEl,\n footerButtons,\n footerContent,\n headerLabel,\n maxHeight,\n onExitComplete,\n onOpenChange,\n onStepChange,\n open,\n preventScroll,\n scrollBehavior,\n showScrollGradient,\n size,\n state,\n step: stepProp,\n title,\n trigger,\n variant,\n ...dataAttributes\n}: BitkitStepsDialogProps) => {\n const [internalStep, setInternalStep] = useState(defaultStep);\n const isControlled = stepProp !== undefined;\n const rawStep = (isControlled ? stepProp : internalStep) ?? 0;\n const steps = flattenChildren(children).filter(\n (child): child is ReactElement<BitkitStepsDialogStepProps> => child.type === BitkitStepsDialogStep,\n );\n const totalSteps = steps.length;\n const step = Math.max(0, Math.min(rawStep, Math.max(0, totalSteps - 1)));\n\n const setStep = useCallback(\n (next: number) => {\n const clamped = Math.max(0, Math.min(next, totalSteps - 1));\n if (!isControlled) setInternalStep(clamped);\n onStepChange?.(clamped);\n },\n [isControlled, onStepChange, totalSteps],\n );\n\n const ctx = useMemo(\n () => ({\n goTo: setStep,\n isFirst: step === 0,\n isLast: step === totalSteps - 1,\n next: () => setStep(step + 1),\n prev: () => setStep(step - 1),\n setStep,\n step,\n totalSteps,\n }),\n [setStep, step, totalSteps],\n );\n\n const handleOpenChange = (details: { open: boolean }) => {\n if (!details.open && !isControlled) setInternalStep(defaultStep);\n onOpenChange?.(details);\n };\n\n // The design splits this row: the leading action sits opposite the step navigation. Laying it out\n // here rather than in `DialogInner` keeps the shared action block right-aligned for every other\n // dialog, and keeps the split off every call site. A footer with no leading action passes a single\n // group, which `space-between` would park at the start, so that case is pushed back to the end. It\n // has to be a selector rather than a prop: `footerButtons` is one element rendering a fragment, so\n // the component cannot count what it will produce.\n const footerNav = footerButtons && (\n <Box\n css={{ '& > :only-child': { marginInlineStart: 'auto' } }}\n display=\"flex\"\n justifyContent=\"space-between\"\n width=\"100%\"\n >\n {footerButtons}\n </Box>\n );\n\n const stepsHeader = (\n <BitkitSteps step={step}>\n {steps.map((child, index) => (\n <BitkitSteps.Item key={index} label={child.props.label} />\n ))}\n </BitkitSteps>\n );\n\n return (\n <StepsDialogProvider value={ctx}>\n <DialogShell\n dismissible={dismissible}\n initialFocusEl={initialFocusEl}\n onExitComplete={onExitComplete}\n onOpenChange={handleOpenChange}\n open={open}\n preventScroll={preventScroll}\n scrollBehavior={scrollBehavior}\n size={size}\n state={state}\n trigger={trigger}\n variant={variant}\n >\n <Dialog.Content aria-busy={state === 'loading' || undefined} maxHeight={maxHeight} {...dataAttributes}>\n <DialogInner\n dismissible={dismissible}\n footerButtons={footerNav}\n footerContent={footerContent}\n headerExtra={stepsHeader}\n headerLabel={headerLabel}\n scrollBehavior={scrollBehavior}\n showScrollGradient={showScrollGradient}\n state={state}\n title={title}\n variant={variant}\n >\n {steps[step]}\n </DialogInner>\n </Dialog.Content>\n </DialogShell>\n </StepsDialogProvider>\n );\n};\n\nBitkitStepsDialog.displayName = 'BitkitStepsDialog';\n\nexport default withSubComponents(BitkitStepsDialog, {\n ActionTrigger: Dialog.ActionTrigger,\n Step: BitkitStepsDialogStep,\n});\n"],"mappings":";;;;;;;;;;;;;;;;;AA8DA,IAAM,qBAAqB,EACzB,UACA,cAAc,GACd,cAAc,MACd,gBACA,eACA,eACA,aACA,WACA,gBACA,cACA,cACA,MACA,eACA,gBACA,oBACA,MACA,OACA,MAAM,UACN,OACA,SACA,SACA,GAAG,qBACyB;CAC5B,MAAM,CAAC,cAAc,mBAAmB,SAAS,WAAW;CAC5D,MAAM,eAAe,aAAa,KAAA;CAClC,MAAM,WAAW,eAAe,WAAW,iBAAiB;CAC5D,MAAM,QAAQ,gBAAgB,QAAQ,CAAC,CAAC,QACrC,UAA6D,MAAM,SAAS,qBAC/E;CACA,MAAM,aAAa,MAAM;CACzB,MAAM,OAAO,KAAK,IAAI,GAAG,KAAK,IAAI,SAAS,KAAK,IAAI,GAAG,aAAa,CAAC,CAAC,CAAC;CAEvE,MAAM,UAAU,aACb,SAAiB;EAChB,MAAM,UAAU,KAAK,IAAI,GAAG,KAAK,IAAI,MAAM,aAAa,CAAC,CAAC;EAC1D,IAAI,CAAC,cAAc,gBAAgB,OAAO;EAC1C,eAAe,OAAO;CACxB,GACA;EAAC;EAAc;EAAc;CAAU,CACzC;CAEA,MAAM,MAAM,eACH;EACL,MAAM;EACN,SAAS,SAAS;EAClB,QAAQ,SAAS,aAAa;EAC9B,YAAY,QAAQ,OAAO,CAAC;EAC5B,YAAY,QAAQ,OAAO,CAAC;EAC5B;EACA;EACA;CACF,IACA;EAAC;EAAS;EAAM;CAAU,CAC5B;CAEA,MAAM,oBAAoB,YAA+B;EACvD,IAAI,CAAC,QAAQ,QAAQ,CAAC,cAAc,gBAAgB,WAAW;EAC/D,eAAe,OAAO;CACxB;CAQA,MAAM,YAAY,iBAChB,oBAAC,KAAD;EACE,KAAK,EAAE,mBAAmB,EAAE,mBAAmB,OAAO,EAAE;EACxD,SAAQ;EACR,gBAAe;EACf,OAAM;EAEL,UAAA;CACE,CAAA;CAGP,MAAM,cACJ,
|
|
1
|
+
{"version":3,"file":"BitkitStepsDialog.js","names":["BitkitSteps"],"sources":["../../../lib/components/BitkitDialog/BitkitStepsDialog.tsx"],"sourcesContent":["import { Box } from '@chakra-ui/react/box';\nimport { Dialog } from '@chakra-ui/react/dialog';\nimport { type ReactElement, type ReactNode, useCallback, useMemo, useState } from 'react';\n\nimport { type BitkitDataAttributes } from '../../utilities/dataAttributes';\nimport { flattenChildren } from '../../utilities/flattenChildren';\nimport { withSubComponents } from '../../utilities/withSubComponents';\nimport BitkitSteps from '../BitkitSteps/BitkitSteps';\nimport BitkitStepsDialogStep, { type BitkitStepsDialogStepProps } from './BitkitStepsDialogStep';\nimport DialogInner from './DialogInner';\nimport DialogShell, { type DialogShellProps } from './DialogShell';\nimport { StepsDialogProvider } from './StepsDialogContext';\n\nexport { useStepsDialog } from './StepsDialogContext';\n\nexport type BitkitStepsDialogProps = {\n /** `BitkitStepsDialog.Step` children, one per step. */\n children: ReactNode;\n /** Initial step when uncontrolled. Resets to this when the dialog closes. */\n defaultStep?: number;\n /** Set to `false` to remove every dismiss route that skips a decision: no close button, no ESC. */\n dismissible?: boolean;\n /** Element to focus when the dialog opens, instead of the first focusable one. */\n initialFocusEl?: DialogShellProps['initialFocusEl'];\n /**\n * The step navigation, built with `useStepsDialog()`. Pass the buttons themselves: the dialog lays\n * them out the way the design asks for, leading action on the left, the step navigation opposite.\n * A footer with no leading action passes a single group, which stays on the right.\n */\n footerButtons?: ReactNode;\n /** Arbitrary content rendered raw inside the footer, above `footerButtons` (e.g. a `BitkitAlert`). */\n footerContent?: ReactNode;\n headerLabel?: string;\n maxHeight?: string;\n onExitComplete?: () => void;\n onOpenChange?: (details: { open: boolean }) => void;\n /** Called whenever the active step changes (controlled or uncontrolled). */\n onStepChange?: (step: number) => void;\n open?: boolean;\n preventScroll?: boolean;\n scrollBehavior?: 'inside' | 'outside';\n showScrollGradient?: boolean;\n size?: 'sm' | 'md' | 'lg' | 'full';\n /**\n * `loading` locks the dialog while a background action runs: the close button stays in place but\n * disabled, and ESC is blocked. Use it alongside the footer button's own `state=\"loading\"`.\n */\n state?: 'loading';\n /** Controlled active step. Omit for uncontrolled (see `defaultStep`). */\n step?: number;\n title: ReactNode;\n trigger?: ReactNode;\n variant?: 'overflowContent';\n // Data attributes are forwarded to the element carrying `role=\"dialog\"`, and nothing else is —\n // style props, `className` and `id` don't pass through.\n} & BitkitDataAttributes;\n\n/**\n * A dialog that walks through a sequence of `BitkitStepsDialog.Step` children. It owns the step\n * state, auto-renders the steps header, and shows only the active step's body. The consumer builds\n * the step navigation with the `useStepsDialog()` hook and passes it in as `footerButtons`.\n */\nconst BitkitStepsDialog = ({\n children,\n defaultStep = 0,\n dismissible = true,\n initialFocusEl,\n footerButtons,\n footerContent,\n headerLabel,\n maxHeight,\n onExitComplete,\n onOpenChange,\n onStepChange,\n open,\n preventScroll,\n scrollBehavior,\n showScrollGradient,\n size,\n state,\n step: stepProp,\n title,\n trigger,\n variant,\n ...dataAttributes\n}: BitkitStepsDialogProps) => {\n const [internalStep, setInternalStep] = useState(defaultStep);\n const isControlled = stepProp !== undefined;\n const rawStep = (isControlled ? stepProp : internalStep) ?? 0;\n const steps = flattenChildren(children).filter(\n (child): child is ReactElement<BitkitStepsDialogStepProps> => child.type === BitkitStepsDialogStep,\n );\n const totalSteps = steps.length;\n const step = Math.max(0, Math.min(rawStep, Math.max(0, totalSteps - 1)));\n\n const setStep = useCallback(\n (next: number) => {\n const clamped = Math.max(0, Math.min(next, totalSteps - 1));\n if (!isControlled) setInternalStep(clamped);\n onStepChange?.(clamped);\n },\n [isControlled, onStepChange, totalSteps],\n );\n\n const ctx = useMemo(\n () => ({\n goTo: setStep,\n isFirst: step === 0,\n isLast: step === totalSteps - 1,\n next: () => setStep(step + 1),\n prev: () => setStep(step - 1),\n setStep,\n step,\n totalSteps,\n }),\n [setStep, step, totalSteps],\n );\n\n const handleOpenChange = (details: { open: boolean }) => {\n if (!details.open && !isControlled) setInternalStep(defaultStep);\n onOpenChange?.(details);\n };\n\n // The design splits this row: the leading action sits opposite the step navigation. Laying it out\n // here rather than in `DialogInner` keeps the shared action block right-aligned for every other\n // dialog, and keeps the split off every call site. A footer with no leading action passes a single\n // group, which `space-between` would park at the start, so that case is pushed back to the end. It\n // has to be a selector rather than a prop: `footerButtons` is one element rendering a fragment, so\n // the component cannot count what it will produce.\n const footerNav = footerButtons && (\n <Box\n css={{ '& > :only-child': { marginInlineStart: 'auto' } }}\n display=\"flex\"\n justifyContent=\"space-between\"\n width=\"100%\"\n >\n {footerButtons}\n </Box>\n );\n\n const stepsHeader = (\n <BitkitSteps step={step}>\n {steps.map((child, index) => (\n <BitkitSteps.Item key={index} label={child.props.label} />\n ))}\n </BitkitSteps>\n );\n\n return (\n <StepsDialogProvider value={ctx}>\n <DialogShell\n dismissible={dismissible}\n initialFocusEl={initialFocusEl}\n onExitComplete={onExitComplete}\n onOpenChange={handleOpenChange}\n open={open}\n preventScroll={preventScroll}\n scrollBehavior={scrollBehavior}\n size={size}\n state={state}\n trigger={trigger}\n variant={variant}\n >\n <Dialog.Content aria-busy={state === 'loading' || undefined} maxHeight={maxHeight} {...dataAttributes}>\n <DialogInner\n dismissible={dismissible}\n footerButtons={footerNav}\n footerContent={footerContent}\n headerExtra={stepsHeader}\n headerLabel={headerLabel}\n scrollBehavior={scrollBehavior}\n showScrollGradient={showScrollGradient}\n state={state}\n title={title}\n variant={variant}\n >\n {steps[step]}\n </DialogInner>\n </Dialog.Content>\n </DialogShell>\n </StepsDialogProvider>\n );\n};\n\nBitkitStepsDialog.displayName = 'BitkitStepsDialog';\n\nexport default withSubComponents(BitkitStepsDialog, {\n ActionTrigger: Dialog.ActionTrigger,\n Step: BitkitStepsDialogStep,\n});\n"],"mappings":";;;;;;;;;;;;;;;;;AA8DA,IAAM,qBAAqB,EACzB,UACA,cAAc,GACd,cAAc,MACd,gBACA,eACA,eACA,aACA,WACA,gBACA,cACA,cACA,MACA,eACA,gBACA,oBACA,MACA,OACA,MAAM,UACN,OACA,SACA,SACA,GAAG,qBACyB;CAC5B,MAAM,CAAC,cAAc,mBAAmB,SAAS,WAAW;CAC5D,MAAM,eAAe,aAAa,KAAA;CAClC,MAAM,WAAW,eAAe,WAAW,iBAAiB;CAC5D,MAAM,QAAQ,gBAAgB,QAAQ,CAAC,CAAC,QACrC,UAA6D,MAAM,SAAS,qBAC/E;CACA,MAAM,aAAa,MAAM;CACzB,MAAM,OAAO,KAAK,IAAI,GAAG,KAAK,IAAI,SAAS,KAAK,IAAI,GAAG,aAAa,CAAC,CAAC,CAAC;CAEvE,MAAM,UAAU,aACb,SAAiB;EAChB,MAAM,UAAU,KAAK,IAAI,GAAG,KAAK,IAAI,MAAM,aAAa,CAAC,CAAC;EAC1D,IAAI,CAAC,cAAc,gBAAgB,OAAO;EAC1C,eAAe,OAAO;CACxB,GACA;EAAC;EAAc;EAAc;CAAU,CACzC;CAEA,MAAM,MAAM,eACH;EACL,MAAM;EACN,SAAS,SAAS;EAClB,QAAQ,SAAS,aAAa;EAC9B,YAAY,QAAQ,OAAO,CAAC;EAC5B,YAAY,QAAQ,OAAO,CAAC;EAC5B;EACA;EACA;CACF,IACA;EAAC;EAAS;EAAM;CAAU,CAC5B;CAEA,MAAM,oBAAoB,YAA+B;EACvD,IAAI,CAAC,QAAQ,QAAQ,CAAC,cAAc,gBAAgB,WAAW;EAC/D,eAAe,OAAO;CACxB;CAQA,MAAM,YAAY,iBAChB,oBAAC,KAAD;EACE,KAAK,EAAE,mBAAmB,EAAE,mBAAmB,OAAO,EAAE;EACxD,SAAQ;EACR,gBAAe;EACf,OAAM;EAEL,UAAA;CACE,CAAA;CAGP,MAAM,cACJ,oBAACA,qBAAD;EAAmB;EAChB,UAAA,MAAM,KAAK,OAAO,UACjB,oBAACA,oBAAY,MAAb,EAA8B,OAAO,MAAM,MAAM,MAAQ,GAAlC,KAAkC,CAC1D;CACU,CAAA;CAGf,OACE,oBAAC,qBAAD;EAAqB,OAAO;EAC1B,UAAA,oBAAC,aAAD;GACe;GACG;GACA;GAChB,cAAc;GACR;GACS;GACC;GACV;GACC;GACE;GACA;GAET,UAAA,oBAAC,OAAO,SAAR;IAAgB,aAAW,UAAU,aAAa,KAAA;IAAsB;IAAW,GAAI;IACrF,UAAA,oBAAC,aAAD;KACe;KACb,eAAe;KACA;KACf,aAAa;KACA;KACG;KACI;KACb;KACA;KACE;KAER,UAAA,MAAM;IACI,CAAA;GACC,CAAA;EACL,CAAA;CACM,CAAA;AAEzB;AAEA,kBAAkB,cAAc;AAEhC,IAAA,4BAAe,kBAAkB,mBAAmB;CAClD,eAAe,OAAO;CACtB,MAAM;AACR,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BitkitStepsDialogStep.js","names":[],"sources":["../../../lib/components/BitkitDialog/BitkitStepsDialogStep.tsx"],"sourcesContent":["import { useDialogStyles } from '@chakra-ui/react/dialog';\nimport { chakra } from '@chakra-ui/react/styled-system';\nimport { type ReactNode } from 'react';\n\nexport interface BitkitStepsDialogStepProps {\n /** Body content for this step. */\n children?: ReactNode;\n /** Optional subtitle shown under the step's body title. */\n description?: string;\n /** Short label shown in the steps header. */\n label: string;\n /** Heading shown at the top of the step's body. */\n title: string;\n}\n\n/**\n * A single step of a {@link BitkitStepsDialog}. Renders its `title`/`description` typography\n * followed by `children`. The parent only mounts the active step, so this never self-gates.\n */\nconst BitkitStepsDialogStep = ({ children, description, title }: BitkitStepsDialogStepProps) => {\n const styles = useDialogStyles();\n\n return (\n <>\n <chakra.div css={styles.stepTitleGroup}>\n <chakra.p css={styles.stepTitle}>{title}</chakra.p>\n {description && <chakra.p css={styles.stepDescription}>{description}</chakra.p>}\n </chakra.div>\n {children}\n </>\n );\n};\n\nBitkitStepsDialogStep.displayName = 'BitkitStepsDialogStep';\n\nexport default BitkitStepsDialogStep;\n"],"mappings":";;;;;;;;AAmBA,IAAM,yBAAyB,EAAE,UAAU,aAAa,YAAwC;CAC9F,MAAM,SAAS,gBAAgB;CAE/B,OACE,
|
|
1
|
+
{"version":3,"file":"BitkitStepsDialogStep.js","names":["_Fragment"],"sources":["../../../lib/components/BitkitDialog/BitkitStepsDialogStep.tsx"],"sourcesContent":["import { useDialogStyles } from '@chakra-ui/react/dialog';\nimport { chakra } from '@chakra-ui/react/styled-system';\nimport { type ReactNode } from 'react';\n\nexport interface BitkitStepsDialogStepProps {\n /** Body content for this step. */\n children?: ReactNode;\n /** Optional subtitle shown under the step's body title. */\n description?: string;\n /** Short label shown in the steps header. */\n label: string;\n /** Heading shown at the top of the step's body. */\n title: string;\n}\n\n/**\n * A single step of a {@link BitkitStepsDialog}. Renders its `title`/`description` typography\n * followed by `children`. The parent only mounts the active step, so this never self-gates.\n */\nconst BitkitStepsDialogStep = ({ children, description, title }: BitkitStepsDialogStepProps) => {\n const styles = useDialogStyles();\n\n return (\n <>\n <chakra.div css={styles.stepTitleGroup}>\n <chakra.p css={styles.stepTitle}>{title}</chakra.p>\n {description && <chakra.p css={styles.stepDescription}>{description}</chakra.p>}\n </chakra.div>\n {children}\n </>\n );\n};\n\nBitkitStepsDialogStep.displayName = 'BitkitStepsDialogStep';\n\nexport default BitkitStepsDialogStep;\n"],"mappings":";;;;;;;;AAmBA,IAAM,yBAAyB,EAAE,UAAU,aAAa,YAAwC;CAC9F,MAAM,SAAS,gBAAgB;CAE/B,OACE,qBAAAA,UAAA,EAAA,UAAA,CACE,qBAAC,OAAO,KAAR;EAAY,KAAK,OAAO;EAAxB,UAAA,CACE,oBAAC,OAAO,GAAR;GAAU,KAAK,OAAO;GAAY,UAAA;EAAgB,CAAA,GACjD,eAAe,oBAAC,OAAO,GAAR;GAAU,KAAK,OAAO;GAAkB,UAAA;EAAsB,CAAA,CACpE;CACX,CAAA,GAAA,QACD,EAAA,CAAA;AAEN;AAEA,sBAAsB,cAAc"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DialogBodyContext.js","names":[],"sources":["../../../lib/components/BitkitDialog/DialogBodyContext.tsx"],"sourcesContent":["import { Box } from '@chakra-ui/react/box';\nimport { Dialog, useDialogContext, useDialogStyles } from '@chakra-ui/react/dialog';\nimport { chakra } from '@chakra-ui/react/styled-system';\nimport { createContext, useCallback, useContext, useEffect, useRef, useState } from 'react';\n\nimport { IconArrowDown } from '../../icons';\n\ninterface DialogBodyContextValue {\n scrollBehavior: 'inside' | 'outside';\n showScrollGradient: boolean;\n}\n\nexport const DialogBodyContext = createContext<DialogBodyContextValue>({\n scrollBehavior: 'outside',\n showScrollGradient: true,\n});\n\nexport const resolveScrollBehavior = (\n variant: 'overflowContent' | undefined,\n scrollBehavior: 'inside' | 'outside' | undefined,\n): 'inside' | 'outside' | undefined => (variant === 'overflowContent' ? 'inside' : scrollBehavior);\n\nconst ScrollableDialogBody = ({ children, ...props }: Dialog.BodyProps) => {\n const { showScrollGradient } = useContext(DialogBodyContext);\n const styles = useDialogStyles();\n const { open } = useDialogContext();\n const contentRef = useRef<HTMLDivElement>(null);\n const [isScrollButtonVisible, setIsScrollButtonVisible] = useState(false);\n\n const updateScrollButtonVisibility = useCallback(() => {\n const content = contentRef.current;\n if (!content) {\n setIsScrollButtonVisible(false);\n return;\n }\n const didScrollToBottom = content.scrollTop >= content.scrollHeight - content.offsetHeight - 1;\n setIsScrollButtonVisible(!didScrollToBottom);\n }, []);\n\n useEffect(() => {\n const content = contentRef.current;\n if (!open || !content) return;\n\n content.addEventListener('scroll', updateScrollButtonVisibility);\n const resizeObserver = new ResizeObserver(updateScrollButtonVisibility);\n resizeObserver.observe(content);\n\n return () => {\n content.removeEventListener('scroll', updateScrollButtonVisibility);\n resizeObserver.disconnect();\n };\n }, [open, updateScrollButtonVisibility]);\n\n return (\n <Box css={styles.scrollBody}>\n <Box css={styles.scrollArea}>\n <Dialog.Body ref={contentRef} {...props}>\n {children}\n </Dialog.Body>\n {isScrollButtonVisible && (\n <>\n {showScrollGradient && <Box css={styles.scrollGradient} />}\n <chakra.button\n aria-label=\"Scroll to bottom\"\n css={styles.scrollButton}\n type=\"button\"\n onClick={() => {\n contentRef.current?.scrollTo({ top: contentRef.current.scrollHeight, behavior: 'smooth' });\n }}\n >\n <IconArrowDown color=\"icon/tertiary\" size=\"16\" />\n </chakra.button>\n </>\n )}\n </Box>\n </Box>\n );\n};\n\n/**\n * Scroll-aware dialog body. Reads {@link DialogBodyContext} to decide whether the body scrolls\n * internally (`inside` → scroll button + optional gradient) or the whole dialog scrolls (`outside`).\n */\nconst DialogBody = ({ children, ...rest }: Dialog.BodyProps) => {\n const { scrollBehavior } = useContext(DialogBodyContext);\n\n if (scrollBehavior === 'inside') {\n return <ScrollableDialogBody {...rest}>{children}</ScrollableDialogBody>;\n }\n return <Dialog.Body {...rest}>{children}</Dialog.Body>;\n};\n\nexport default DialogBody;\n"],"mappings":";;;;;;;AAYA,IAAa,oBAAoB,cAAsC;CACrE,gBAAgB;CAChB,oBAAoB;AACtB,CAAC;AAED,IAAa,yBACX,SACA,mBACsC,YAAY,oBAAoB,WAAW;AAEnF,IAAM,wBAAwB,EAAE,UAAU,GAAG,YAA8B;CACzE,MAAM,EAAE,uBAAuB,WAAW,iBAAiB;CAC3D,MAAM,SAAS,gBAAgB;CAC/B,MAAM,EAAE,SAAS,iBAAiB;CAClC,MAAM,aAAa,OAAuB,IAAI;CAC9C,MAAM,CAAC,uBAAuB,4BAA4B,SAAS,KAAK;CAExE,MAAM,+BAA+B,kBAAkB;EACrD,MAAM,UAAU,WAAW;EAC3B,IAAI,CAAC,SAAS;GACZ,yBAAyB,KAAK;GAC9B;EACF;EACA,MAAM,oBAAoB,QAAQ,aAAa,QAAQ,eAAe,QAAQ,eAAe;EAC7F,yBAAyB,CAAC,iBAAiB;CAC7C,GAAG,CAAC,CAAC;CAEL,gBAAgB;EACd,MAAM,UAAU,WAAW;EAC3B,IAAI,CAAC,QAAQ,CAAC,SAAS;EAEvB,QAAQ,iBAAiB,UAAU,4BAA4B;EAC/D,MAAM,iBAAiB,IAAI,eAAe,4BAA4B;EACtE,eAAe,QAAQ,OAAO;EAE9B,aAAa;GACX,QAAQ,oBAAoB,UAAU,4BAA4B;GAClE,eAAe,WAAW;EAC5B;CACF,GAAG,CAAC,MAAM,4BAA4B,CAAC;CAEvC,OACE,oBAAC,KAAD;EAAK,KAAK,OAAO;EACf,UAAA,qBAAC,KAAD;GAAK,KAAK,OAAO;GAAjB,UAAA,CACE,oBAAC,OAAO,MAAR;IAAa,KAAK;IAAY,GAAI;IAC/B;GACU,CAAA,GACZ,yBACC,
|
|
1
|
+
{"version":3,"file":"DialogBodyContext.js","names":["_Fragment"],"sources":["../../../lib/components/BitkitDialog/DialogBodyContext.tsx"],"sourcesContent":["import { Box } from '@chakra-ui/react/box';\nimport { Dialog, useDialogContext, useDialogStyles } from '@chakra-ui/react/dialog';\nimport { chakra } from '@chakra-ui/react/styled-system';\nimport { createContext, useCallback, useContext, useEffect, useRef, useState } from 'react';\n\nimport { IconArrowDown } from '../../icons';\n\ninterface DialogBodyContextValue {\n scrollBehavior: 'inside' | 'outside';\n showScrollGradient: boolean;\n}\n\nexport const DialogBodyContext = createContext<DialogBodyContextValue>({\n scrollBehavior: 'outside',\n showScrollGradient: true,\n});\n\nexport const resolveScrollBehavior = (\n variant: 'overflowContent' | undefined,\n scrollBehavior: 'inside' | 'outside' | undefined,\n): 'inside' | 'outside' | undefined => (variant === 'overflowContent' ? 'inside' : scrollBehavior);\n\nconst ScrollableDialogBody = ({ children, ...props }: Dialog.BodyProps) => {\n const { showScrollGradient } = useContext(DialogBodyContext);\n const styles = useDialogStyles();\n const { open } = useDialogContext();\n const contentRef = useRef<HTMLDivElement>(null);\n const [isScrollButtonVisible, setIsScrollButtonVisible] = useState(false);\n\n const updateScrollButtonVisibility = useCallback(() => {\n const content = contentRef.current;\n if (!content) {\n setIsScrollButtonVisible(false);\n return;\n }\n const didScrollToBottom = content.scrollTop >= content.scrollHeight - content.offsetHeight - 1;\n setIsScrollButtonVisible(!didScrollToBottom);\n }, []);\n\n useEffect(() => {\n const content = contentRef.current;\n if (!open || !content) return;\n\n content.addEventListener('scroll', updateScrollButtonVisibility);\n const resizeObserver = new ResizeObserver(updateScrollButtonVisibility);\n resizeObserver.observe(content);\n\n return () => {\n content.removeEventListener('scroll', updateScrollButtonVisibility);\n resizeObserver.disconnect();\n };\n }, [open, updateScrollButtonVisibility]);\n\n return (\n <Box css={styles.scrollBody}>\n <Box css={styles.scrollArea}>\n <Dialog.Body ref={contentRef} {...props}>\n {children}\n </Dialog.Body>\n {isScrollButtonVisible && (\n <>\n {showScrollGradient && <Box css={styles.scrollGradient} />}\n <chakra.button\n aria-label=\"Scroll to bottom\"\n css={styles.scrollButton}\n type=\"button\"\n onClick={() => {\n contentRef.current?.scrollTo({ top: contentRef.current.scrollHeight, behavior: 'smooth' });\n }}\n >\n <IconArrowDown color=\"icon/tertiary\" size=\"16\" />\n </chakra.button>\n </>\n )}\n </Box>\n </Box>\n );\n};\n\n/**\n * Scroll-aware dialog body. Reads {@link DialogBodyContext} to decide whether the body scrolls\n * internally (`inside` → scroll button + optional gradient) or the whole dialog scrolls (`outside`).\n */\nconst DialogBody = ({ children, ...rest }: Dialog.BodyProps) => {\n const { scrollBehavior } = useContext(DialogBodyContext);\n\n if (scrollBehavior === 'inside') {\n return <ScrollableDialogBody {...rest}>{children}</ScrollableDialogBody>;\n }\n return <Dialog.Body {...rest}>{children}</Dialog.Body>;\n};\n\nexport default DialogBody;\n"],"mappings":";;;;;;;AAYA,IAAa,oBAAoB,cAAsC;CACrE,gBAAgB;CAChB,oBAAoB;AACtB,CAAC;AAED,IAAa,yBACX,SACA,mBACsC,YAAY,oBAAoB,WAAW;AAEnF,IAAM,wBAAwB,EAAE,UAAU,GAAG,YAA8B;CACzE,MAAM,EAAE,uBAAuB,WAAW,iBAAiB;CAC3D,MAAM,SAAS,gBAAgB;CAC/B,MAAM,EAAE,SAAS,iBAAiB;CAClC,MAAM,aAAa,OAAuB,IAAI;CAC9C,MAAM,CAAC,uBAAuB,4BAA4B,SAAS,KAAK;CAExE,MAAM,+BAA+B,kBAAkB;EACrD,MAAM,UAAU,WAAW;EAC3B,IAAI,CAAC,SAAS;GACZ,yBAAyB,KAAK;GAC9B;EACF;EACA,MAAM,oBAAoB,QAAQ,aAAa,QAAQ,eAAe,QAAQ,eAAe;EAC7F,yBAAyB,CAAC,iBAAiB;CAC7C,GAAG,CAAC,CAAC;CAEL,gBAAgB;EACd,MAAM,UAAU,WAAW;EAC3B,IAAI,CAAC,QAAQ,CAAC,SAAS;EAEvB,QAAQ,iBAAiB,UAAU,4BAA4B;EAC/D,MAAM,iBAAiB,IAAI,eAAe,4BAA4B;EACtE,eAAe,QAAQ,OAAO;EAE9B,aAAa;GACX,QAAQ,oBAAoB,UAAU,4BAA4B;GAClE,eAAe,WAAW;EAC5B;CACF,GAAG,CAAC,MAAM,4BAA4B,CAAC;CAEvC,OACE,oBAAC,KAAD;EAAK,KAAK,OAAO;EACf,UAAA,qBAAC,KAAD;GAAK,KAAK,OAAO;GAAjB,UAAA,CACE,oBAAC,OAAO,MAAR;IAAa,KAAK;IAAY,GAAI;IAC/B;GACU,CAAA,GACZ,yBACC,qBAAAA,YAAA,EAAA,UAAA,CACG,sBAAsB,oBAAC,KAAD,EAAK,KAAK,OAAO,eAAiB,CAAA,GACzD,oBAAC,OAAO,QAAR;IACE,cAAW;IACX,KAAK,OAAO;IACZ,MAAK;IACL,eAAe;KACb,WAAW,SAAS,SAAS;MAAE,KAAK,WAAW,QAAQ;MAAc,UAAU;KAAS,CAAC;IAC3F;IAEA,UAAA,oBAAC,eAAD;KAAe,OAAM;KAAgB,MAAK;IAAM,CAAA;GACnC,CAAA,CACf,EAAA,CAAA,CAED;;CACF,CAAA;AAET;;;;;AAMA,IAAM,cAAc,EAAE,UAAU,GAAG,WAA6B;CAC9D,MAAM,EAAE,mBAAmB,WAAW,iBAAiB;CAEvD,IAAI,mBAAmB,UACrB,OAAO,oBAAC,sBAAD;EAAsB,GAAI;EAAO;CAA+B,CAAA;CAEzE,OAAO,oBAAC,OAAO,MAAR;EAAa,GAAI;EAAO;CAAsB,CAAA;AACvD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BitkitExpandableCard.js","names":[],"sources":["../../../lib/components/BitkitExpandableCard/BitkitExpandableCard.tsx"],"sourcesContent":["import { Box, type BoxProps } from '@chakra-ui/react/box';\nimport { Card } from '@chakra-ui/react/card';\nimport { Collapsible, type CollapsibleRootProps } from '@chakra-ui/react/collapsible';\nimport { useSlotRecipe } from '@chakra-ui/react/styled-system';\nimport { Text } from '@chakra-ui/react/text';\nimport { cloneElement, forwardRef, isValidElement, type ReactElement, type ReactNode } from 'react';\n\nimport { type BitkitIconComponent } from '../../icons';\nimport AssetSelectChevron from '../../utilities/AssetSelectChevron';\nimport { type BitkitAvatarProps } from '../BitkitAvatar/BitkitAvatar';\nimport BitkitBadge, { type BitkitBadgeProps } from '../BitkitBadge/BitkitBadge';\n\ntype UncontrolledProps = {\n defaultExpanded?: boolean;\n expanded?: never;\n onChange?: never;\n};\n\ntype ControlledProps = {\n defaultExpanded?: never;\n expanded: boolean;\n onChange: (expanded: boolean) => void;\n};\n\n/**\n * Zag/Ark machine props. They drive the inner `Collapsible.Root` and mean nothing on the card\n * element, so they're forwarded by name rather than left in `...rest` — which belongs to the\n * rendered root (`Card.Root`) so consumer style props reach the card itself.\n */\ntype CollapsibleMachineProps = Pick<\n CollapsibleRootProps,\n | 'collapsedHeight'\n | 'collapsedWidth'\n | 'disabled'\n | 'hideMode'\n | 'ids'\n | 'lazyMount'\n | 'onExitComplete'\n | 'unmountOnExit'\n>;\n\nexport type BitkitExpandableCardProps = Omit<BoxProps, 'asChild' | 'children' | 'onChange' | 'title'> &\n CollapsibleMachineProps & {\n children: ReactNode;\n elevation?: boolean;\n footer?: ReactNode;\n icon?: BitkitIconComponent | ReactElement<BitkitAvatarProps>;\n iconColor?: string;\n noPadding?: boolean;\n size?: 'md' | 'lg';\n subtitle?: ReactNode;\n suffix?: ReactNode;\n title: ReactNode;\n } & (UncontrolledProps | ControlledProps);\n\nconst BitkitExpandableCard = forwardRef<HTMLDivElement, BitkitExpandableCardProps>((props, ref) => {\n const {\n children,\n collapsedHeight,\n collapsedWidth,\n css,\n defaultExpanded,\n disabled,\n elevation = true,\n expanded,\n footer,\n hideMode,\n icon,\n iconColor,\n ids,\n lazyMount,\n noPadding = false,\n onChange,\n onExitComplete,\n size = 'lg',\n subtitle,\n suffix,\n title,\n unmountOnExit,\n ...rest\n } = props;\n\n const recipe = useSlotRecipe({ key: 'expandableCard' });\n const styles = recipe({ noPadding, size });\n\n const handleOpenChange = onChange ? (details: { open: boolean }) => onChange(details.open) : undefined;\n\n // `md` is the tested branch so the default size ('lg') stays on the fallback.\n const iconSize = size === 'md' ? '16' : '24';\n\n // Figma sizes the header badge with the card: xs on md, sm (the badge default) on lg.\n let renderedSuffix: ReactNode = suffix;\n if (isValidElement<BitkitBadgeProps>(suffix) && suffix.type === BitkitBadge) {\n renderedSuffix = cloneElement(suffix, { size: size === 'md' ? 'xs' : 'sm' });\n }\n\n let renderedIcon: ReactNode = null;\n if (isValidElement<BitkitAvatarProps>(icon)) {\n // BitkitAvatar has no '16' size, so avatars stay at '24' even on the md card.\n renderedIcon = cloneElement(icon, { size: '24' });\n } else if (icon) {\n const Icon = icon;\n renderedIcon = <Icon color={iconColor} size={iconSize} />;\n }\n\n return (\n <Card.Root ref={ref} elevation={elevation} paddingSize=\"sm\" css={[styles.root, css]} {...rest}>\n <Collapsible.Root\n collapsedHeight={collapsedHeight}\n collapsedWidth={collapsedWidth}\n defaultOpen={defaultExpanded}\n disabled={disabled}\n hideMode={hideMode}\n ids={ids}\n lazyMount={lazyMount}\n onExitComplete={onExitComplete}\n onOpenChange={handleOpenChange}\n open={expanded}\n unmountOnExit={unmountOnExit}\n >\n <Collapsible.Trigger css={styles.header}>\n <Box display=\"flex\" alignItems=\"center\" flex=\"1\" gap=\"8\" minWidth=\"0\">\n {!!renderedIcon && <Box css={styles.icon}>{renderedIcon}</Box>}\n <Box css={styles.title}>\n {title}\n {!!subtitle && (\n <Text as=\"span\" css={styles.subtitle}>\n {subtitle}\n </Text>\n )}\n </Box>\n </Box>\n <Box display=\"flex\" alignItems=\"center\" flexShrink=\"0\">\n {!!renderedSuffix && (\n <Text as=\"span\" css={styles.suffix}>\n {renderedSuffix}\n </Text>\n )}\n <Collapsible.Indicator asChild>\n <AssetSelectChevron />\n </Collapsible.Indicator>\n </Box>\n </Collapsible.Trigger>\n <Collapsible.Content css={styles.collapsible}>\n <Card.Body css={styles.body}>{children}</Card.Body>\n {!!footer && <Card.Footer css={styles.footer}>{footer}</Card.Footer>}\n </Collapsible.Content>\n </Collapsible.Root>\n </Card.Root>\n );\n});\n\nBitkitExpandableCard.displayName = 'BitkitExpandableCard';\n\nexport default BitkitExpandableCard;\n"],"mappings":";;;;;;;;;;AAuDA,IAAM,uBAAuB,YAAuD,OAAO,QAAQ;CACjG,MAAM,EACJ,UACA,iBACA,gBACA,KACA,iBACA,UACA,YAAY,MACZ,UACA,QACA,UACA,MACA,WACA,KACA,WACA,YAAY,OACZ,UACA,gBACA,OAAO,MACP,UACA,QACA,OACA,eACA,GAAG,SACD;CAGJ,MAAM,SADS,cAAc,EAAE,KAAK,iBAAiB,CACtC,CAAA,CAAO;EAAE;EAAW;CAAK,CAAC;CAEzC,MAAM,mBAAmB,YAAY,YAA+B,SAAS,QAAQ,IAAI,IAAI,KAAA;CAG7F,MAAM,WAAW,SAAS,OAAO,OAAO;CAGxC,IAAI,iBAA4B;CAChC,IAAI,eAAiC,MAAM,KAAK,OAAO,SAAS,aAC9D,iBAAiB,aAAa,QAAQ,EAAE,MAAM,SAAS,OAAO,OAAO,KAAK,CAAC;CAG7E,IAAI,eAA0B;CAC9B,IAAI,eAAkC,IAAI,GAExC,eAAe,aAAa,MAAM,EAAE,MAAM,KAAK,CAAC;MAC3C,IAAI,MAET,eAAe,
|
|
1
|
+
{"version":3,"file":"BitkitExpandableCard.js","names":["Icon"],"sources":["../../../lib/components/BitkitExpandableCard/BitkitExpandableCard.tsx"],"sourcesContent":["import { Box, type BoxProps } from '@chakra-ui/react/box';\nimport { Card } from '@chakra-ui/react/card';\nimport { Collapsible, type CollapsibleRootProps } from '@chakra-ui/react/collapsible';\nimport { useSlotRecipe } from '@chakra-ui/react/styled-system';\nimport { Text } from '@chakra-ui/react/text';\nimport { cloneElement, forwardRef, isValidElement, type ReactElement, type ReactNode } from 'react';\n\nimport { type BitkitIconComponent } from '../../icons';\nimport AssetSelectChevron from '../../utilities/AssetSelectChevron';\nimport { type BitkitAvatarProps } from '../BitkitAvatar/BitkitAvatar';\nimport BitkitBadge, { type BitkitBadgeProps } from '../BitkitBadge/BitkitBadge';\n\ntype UncontrolledProps = {\n defaultExpanded?: boolean;\n expanded?: never;\n onChange?: never;\n};\n\ntype ControlledProps = {\n defaultExpanded?: never;\n expanded: boolean;\n onChange: (expanded: boolean) => void;\n};\n\n/**\n * Zag/Ark machine props. They drive the inner `Collapsible.Root` and mean nothing on the card\n * element, so they're forwarded by name rather than left in `...rest` — which belongs to the\n * rendered root (`Card.Root`) so consumer style props reach the card itself.\n */\ntype CollapsibleMachineProps = Pick<\n CollapsibleRootProps,\n | 'collapsedHeight'\n | 'collapsedWidth'\n | 'disabled'\n | 'hideMode'\n | 'ids'\n | 'lazyMount'\n | 'onExitComplete'\n | 'unmountOnExit'\n>;\n\nexport type BitkitExpandableCardProps = Omit<BoxProps, 'asChild' | 'children' | 'onChange' | 'title'> &\n CollapsibleMachineProps & {\n children: ReactNode;\n elevation?: boolean;\n footer?: ReactNode;\n icon?: BitkitIconComponent | ReactElement<BitkitAvatarProps>;\n iconColor?: string;\n noPadding?: boolean;\n size?: 'md' | 'lg';\n subtitle?: ReactNode;\n suffix?: ReactNode;\n title: ReactNode;\n } & (UncontrolledProps | ControlledProps);\n\nconst BitkitExpandableCard = forwardRef<HTMLDivElement, BitkitExpandableCardProps>((props, ref) => {\n const {\n children,\n collapsedHeight,\n collapsedWidth,\n css,\n defaultExpanded,\n disabled,\n elevation = true,\n expanded,\n footer,\n hideMode,\n icon,\n iconColor,\n ids,\n lazyMount,\n noPadding = false,\n onChange,\n onExitComplete,\n size = 'lg',\n subtitle,\n suffix,\n title,\n unmountOnExit,\n ...rest\n } = props;\n\n const recipe = useSlotRecipe({ key: 'expandableCard' });\n const styles = recipe({ noPadding, size });\n\n const handleOpenChange = onChange ? (details: { open: boolean }) => onChange(details.open) : undefined;\n\n // `md` is the tested branch so the default size ('lg') stays on the fallback.\n const iconSize = size === 'md' ? '16' : '24';\n\n // Figma sizes the header badge with the card: xs on md, sm (the badge default) on lg.\n let renderedSuffix: ReactNode = suffix;\n if (isValidElement<BitkitBadgeProps>(suffix) && suffix.type === BitkitBadge) {\n renderedSuffix = cloneElement(suffix, { size: size === 'md' ? 'xs' : 'sm' });\n }\n\n let renderedIcon: ReactNode = null;\n if (isValidElement<BitkitAvatarProps>(icon)) {\n // BitkitAvatar has no '16' size, so avatars stay at '24' even on the md card.\n renderedIcon = cloneElement(icon, { size: '24' });\n } else if (icon) {\n const Icon = icon;\n renderedIcon = <Icon color={iconColor} size={iconSize} />;\n }\n\n return (\n <Card.Root ref={ref} elevation={elevation} paddingSize=\"sm\" css={[styles.root, css]} {...rest}>\n <Collapsible.Root\n collapsedHeight={collapsedHeight}\n collapsedWidth={collapsedWidth}\n defaultOpen={defaultExpanded}\n disabled={disabled}\n hideMode={hideMode}\n ids={ids}\n lazyMount={lazyMount}\n onExitComplete={onExitComplete}\n onOpenChange={handleOpenChange}\n open={expanded}\n unmountOnExit={unmountOnExit}\n >\n <Collapsible.Trigger css={styles.header}>\n <Box display=\"flex\" alignItems=\"center\" flex=\"1\" gap=\"8\" minWidth=\"0\">\n {!!renderedIcon && <Box css={styles.icon}>{renderedIcon}</Box>}\n <Box css={styles.title}>\n {title}\n {!!subtitle && (\n <Text as=\"span\" css={styles.subtitle}>\n {subtitle}\n </Text>\n )}\n </Box>\n </Box>\n <Box display=\"flex\" alignItems=\"center\" flexShrink=\"0\">\n {!!renderedSuffix && (\n <Text as=\"span\" css={styles.suffix}>\n {renderedSuffix}\n </Text>\n )}\n <Collapsible.Indicator asChild>\n <AssetSelectChevron />\n </Collapsible.Indicator>\n </Box>\n </Collapsible.Trigger>\n <Collapsible.Content css={styles.collapsible}>\n <Card.Body css={styles.body}>{children}</Card.Body>\n {!!footer && <Card.Footer css={styles.footer}>{footer}</Card.Footer>}\n </Collapsible.Content>\n </Collapsible.Root>\n </Card.Root>\n );\n});\n\nBitkitExpandableCard.displayName = 'BitkitExpandableCard';\n\nexport default BitkitExpandableCard;\n"],"mappings":";;;;;;;;;;AAuDA,IAAM,uBAAuB,YAAuD,OAAO,QAAQ;CACjG,MAAM,EACJ,UACA,iBACA,gBACA,KACA,iBACA,UACA,YAAY,MACZ,UACA,QACA,UACA,MACA,WACA,KACA,WACA,YAAY,OACZ,UACA,gBACA,OAAO,MACP,UACA,QACA,OACA,eACA,GAAG,SACD;CAGJ,MAAM,SADS,cAAc,EAAE,KAAK,iBAAiB,CACtC,CAAA,CAAO;EAAE;EAAW;CAAK,CAAC;CAEzC,MAAM,mBAAmB,YAAY,YAA+B,SAAS,QAAQ,IAAI,IAAI,KAAA;CAG7F,MAAM,WA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ACrB,CAAA,GAAA,qBAAC,YAAY,SAAb;IAAqB,KAAK,OAAO;IAAjC,UAAA,CACE,oBAAC,KAAK,MAAN;KAAW,KAAK,OAAO;KAAO;IAAoB,CAAA,GACjD,CAAC,CAAC,UAAU,oBAAC,KAAK,QAAN;KAAa,KAAK,OAAO;KAAS,UAAA;IAAoB,CAAA,CAChD;GACL,CAAA,CAAA;;CACT,CAAA;AAEf,CAAC;AAED,qBAAqB,cAAc"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BitkitFileInput.js","names":[],"sources":["../../../lib/components/BitkitFileInput/BitkitFileInput.tsx"],"sourcesContent":["import { Card } from '@chakra-ui/react/card';\nimport { useFieldContext } from '@chakra-ui/react/field';\nimport {\n FileUpload,\n type FileUploadFileAcceptDetails,\n type FileUploadRootProps,\n useFileUploadContext,\n} from '@chakra-ui/react/file-upload';\nimport { VStack } from '@chakra-ui/react/stack';\nimport { Text } from '@chakra-ui/react/text';\nimport { splitProps as splitFileUploadProps } from '@zag-js/file-upload';\nimport { forwardRef, useEffect, useId, useMemo } from 'react';\n\nimport ImageCropper, { useImageCropperContext } from '../../atoms/ImageCropper/ImageCropper';\nimport { IconMinusCircle, IconUpload } from '../../icons';\nimport BitkitButton from '../BitkitButton/BitkitButton';\nimport BitkitField, { type BitkitFieldProps } from '../BitkitField/BitkitField';\n\nexport type BitkitFileInputProps = Omit<BitkitFieldProps, 'children' | 'state'> &\n Omit<FileUploadRootProps, 'disabled' | 'invalid'> & {\n aspectRatio?: number;\n /**\n * Max width/height (px) of the cropped output. The Ark cropper emits at the\n * selection's natural resolution with no size cap, so a large source image\n * can produce an oversized file; set this to downscale the output to fit.\n */\n maxCroppedSize?: number;\n onCropChange?: (file: File) => void;\n /**\n * Called when a file is accepted. Only ever fires with a file — clearing the\n * selection calls `onFileRemoved` instead.\n */\n onFileAccepted?: (file: File) => void;\n /**\n * Called when the accepted file is cleared — via the \"Remove\" button or a\n * programmatic `clearFiles()`.\n */\n onFileRemoved?: () => void;\n state?: 'error' | 'disabled';\n };\n\n// Ark's getCroppedImage() emits at the selection's natural resolution and only\n// controls format/quality (no size cap), so downscale here when a max is set —\n// this keeps a large source image from producing an oversized upload. Preserves\n// the blob's MIME type; falls back to the original blob if it can't be decoded.\nconst downscaleBlob = (blob: Blob, maxSize: number): Promise<Blob> => {\n // A non-positive or non-finite max would produce a 0×0 / NaN canvas and corrupt\n // the output, so treat it as \"no cap\" and pass the blob through untouched.\n if (!Number.isFinite(maxSize) || maxSize <= 0) {\n return Promise.resolve(blob);\n }\n\n return new Promise((resolve) => {\n const url = URL.createObjectURL(blob);\n const image = new Image();\n\n image.onload = () => {\n URL.revokeObjectURL(url);\n const largestSide = Math.max(image.naturalWidth, image.naturalHeight);\n if (largestSide <= maxSize) {\n resolve(blob);\n return;\n }\n const scale = maxSize / largestSide;\n const canvas = document.createElement('canvas');\n canvas.width = Math.round(image.naturalWidth * scale);\n canvas.height = Math.round(image.naturalHeight * scale);\n const context = canvas.getContext('2d');\n if (!context) {\n resolve(blob);\n return;\n }\n context.drawImage(image, 0, 0, canvas.width, canvas.height);\n canvas.toBlob((result) => resolve(result ?? blob), blob.type);\n };\n\n image.onerror = () => {\n URL.revokeObjectURL(url);\n resolve(blob);\n };\n\n image.src = url;\n });\n};\n\nconst Dropzone = (props: Pick<BitkitFileInputProps, 'label'>) => {\n const { label } = props;\n const { disabled } = useFileUploadContext();\n const field = useFieldContext();\n const instructionId = useId();\n const dropzoneLabel = disabled ? 'Cannot upload file' : 'Drag and drop file here or click to select';\n const fieldControlProps = field?.getInputProps();\n const fieldLabelId = label ? field?.ids.label : undefined;\n\n return (\n <FileUpload.Dropzone\n aria-describedby={fieldControlProps?.['aria-describedby']}\n aria-errormessage={fieldControlProps?.['aria-errormessage']}\n aria-invalid={fieldControlProps?.['aria-invalid']}\n aria-labelledby={fieldLabelId ? `${fieldLabelId} ${instructionId}` : instructionId}\n >\n <FileUpload.DropzoneContent>\n <IconUpload />\n <Text as=\"span\" id={instructionId}>\n {dropzoneLabel}\n </Text>\n </FileUpload.DropzoneContent>\n </FileUpload.Dropzone>\n );\n};\n\nconst ImagePreviewContent = (props: Pick<BitkitFileInputProps, 'onCropChange' | 'maxCroppedSize'>) => {\n const { onCropChange, maxCroppedSize } = props;\n\n const { acceptedFiles } = useFileUploadContext();\n const { dragging, getCroppedImage } = useImageCropperContext();\n\n const acceptedFile = acceptedFiles[0];\n const objectUrl = useMemo(() => (acceptedFile ? URL.createObjectURL(acceptedFile) : undefined), [acceptedFile]);\n\n useEffect(() => {\n return () => {\n if (objectUrl) {\n URL.revokeObjectURL(objectUrl);\n }\n };\n }, [objectUrl]);\n\n useEffect(() => {\n if (!onCropChange || dragging) {\n return;\n }\n\n if (!acceptedFile) {\n return;\n }\n\n let cancelled = false;\n // Preserve the source MIME type — the Ark cropper defaults to image/png, which\n // would mismatch a .jpg name and bloat the file.\n getCroppedImage({ type: acceptedFile.type || undefined })\n .then((result) => {\n if (!(result instanceof Blob)) {\n return result;\n }\n return maxCroppedSize ? downscaleBlob(result, maxCroppedSize) : result;\n })\n .then((result) => {\n if (!cancelled && result instanceof Blob) {\n onCropChange(new File([result], acceptedFile.name, { type: result.type }));\n }\n });\n\n return () => {\n cancelled = true;\n };\n }, [getCroppedImage, acceptedFile, onCropChange, dragging, maxCroppedSize]);\n\n return (\n <ImageCropper.Viewport>\n <ImageCropper.Image src={objectUrl} />\n <ImageCropper.Selection>\n {ImageCropper.handles.map((position) => (\n <ImageCropper.Handle key={position} position={position}>\n <div />\n </ImageCropper.Handle>\n ))}\n </ImageCropper.Selection>\n </ImageCropper.Viewport>\n );\n};\n\nconst ImagePreview = (props: Pick<BitkitFileInputProps, 'aspectRatio' | 'onCropChange' | 'maxCroppedSize'>) => {\n const { aspectRatio, onCropChange, maxCroppedSize } = props;\n\n return (\n <ImageCropper.Root aspectRatio={aspectRatio} height=\"100%\">\n <ImagePreviewContent onCropChange={onCropChange} maxCroppedSize={maxCroppedSize} />\n </ImageCropper.Root>\n );\n};\n\nconst NonImagePreview = () => {\n const fileUpload = useFileUploadContext();\n const acceptedFile = fileUpload.acceptedFiles[0];\n\n return (\n <Card.Root asChild elevation={false}>\n <Card.Body display=\"flex\" paddingBlock=\"20\" paddingInline=\"24\" alignItems=\"center\" flex=\"1\">\n <VStack gap=\"4\" alignItems=\"flex-start\" flex=\"1\" minWidth=\"0\">\n <Text textStyle=\"comp/input/label\">Selected file</Text>\n <Text whiteSpace=\"nowrap\" textOverflow=\"ellipsis\" overflow=\"hidden\" maxWidth=\"100%\">\n {acceptedFile.name}\n </Text>\n </VStack>\n <BitkitButton icon={IconMinusCircle} variant=\"secondary\" size=\"md\" onClick={fileUpload.clearFiles}>\n Remove\n </BitkitButton>\n </Card.Body>\n </Card.Root>\n );\n};\n\nconst BitkitFileInputContent = (\n props: Pick<BitkitFileInputProps, 'variant' | 'aspectRatio' | 'label' | 'onCropChange' | 'maxCroppedSize'>,\n) => {\n const { variant, aspectRatio, label, onCropChange, maxCroppedSize } = props;\n const acceptedFile = useFileUploadContext().acceptedFiles[0];\n\n return (\n <>\n {!acceptedFile && <Dropzone label={label} />}\n {acceptedFile && variant === 'image' && (\n <ImagePreview aspectRatio={aspectRatio} onCropChange={onCropChange} maxCroppedSize={maxCroppedSize} />\n )}\n {acceptedFile && variant !== 'image' && <NonImagePreview />}\n </>\n );\n};\n\nconst BitkitFileInput = forwardRef<HTMLDivElement, BitkitFileInputProps>((props, ref) => {\n const {\n aspectRatio,\n maxCroppedSize,\n onCropChange,\n onFileAccept,\n onFileAccepted,\n onFileRemoved,\n state,\n variant,\n ...rest\n } = props;\n const [fileUploadProps, fieldProps] = splitFileUploadProps(rest as never);\n\n const handleFileAccept = (details: FileUploadFileAcceptDetails) => {\n onFileAccept?.(details);\n\n const acceptedFile = details.files[0];\n if (acceptedFile) {\n onFileAccepted?.(acceptedFile);\n } else {\n onFileRemoved?.();\n }\n };\n\n const contentProps = {\n aspectRatio,\n label: props.label,\n maxCroppedSize,\n onCropChange,\n variant,\n };\n\n return (\n <BitkitField ref={ref} state={state} {...fieldProps}>\n <FileUpload.Root variant={variant} onFileAccept={handleFileAccept} {...fileUploadProps}>\n <FileUpload.HiddenInput />\n <BitkitFileInputContent {...contentProps} />\n </FileUpload.Root>\n </BitkitField>\n );\n});\n\nBitkitFileInput.displayName = 'BitkitFileInput';\n\nexport default BitkitFileInput;\n"],"mappings":";;;;;;;;;;;;;;AA6CA,IAAM,iBAAiB,MAAY,YAAmC;CAGpE,IAAI,CAAC,OAAO,SAAS,OAAO,KAAK,WAAW,GAC1C,OAAO,QAAQ,QAAQ,IAAI;CAG7B,OAAO,IAAI,SAAS,YAAY;EAC9B,MAAM,MAAM,IAAI,gBAAgB,IAAI;EACpC,MAAM,QAAQ,IAAI,MAAM;EAExB,MAAM,eAAe;GACnB,IAAI,gBAAgB,GAAG;GACvB,MAAM,cAAc,KAAK,IAAI,MAAM,cAAc,MAAM,aAAa;GACpE,IAAI,eAAe,SAAS;IAC1B,QAAQ,IAAI;IACZ;GACF;GACA,MAAM,QAAQ,UAAU;GACxB,MAAM,SAAS,SAAS,cAAc,QAAQ;GAC9C,OAAO,QAAQ,KAAK,MAAM,MAAM,eAAe,KAAK;GACpD,OAAO,SAAS,KAAK,MAAM,MAAM,gBAAgB,KAAK;GACtD,MAAM,UAAU,OAAO,WAAW,IAAI;GACtC,IAAI,CAAC,SAAS;IACZ,QAAQ,IAAI;IACZ;GACF;GACA,QAAQ,UAAU,OAAO,GAAG,GAAG,OAAO,OAAO,OAAO,MAAM;GAC1D,OAAO,QAAQ,WAAW,QAAQ,UAAU,IAAI,GAAG,KAAK,IAAI;EAC9D;EAEA,MAAM,gBAAgB;GACpB,IAAI,gBAAgB,GAAG;GACvB,QAAQ,IAAI;EACd;EAEA,MAAM,MAAM;CACd,CAAC;AACH;AAEA,IAAM,YAAY,UAA+C;CAC/D,MAAM,EAAE,UAAU;CAClB,MAAM,EAAE,aAAa,qBAAqB;CAC1C,MAAM,Q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,EAAE,SAAS,aAAa,OAAO,cAAc,mBAAmB;CACtE,MAAM,eAAe,qBAAqB,CAAC,CAAC,cAAc;CAE1D,OACE,qBAAA,YAAA,EAAA,UAAA;EACG,CAAC,gBAAgB,oBAAC,UAAD,EAAiB,MAAQ,CAAA;EAC1C,gBAAgB,YAAY,WAC3B,oBAAC,cAAD;GAA2B;GAA2B;GAA8B;EAAiB,CAAA;EAEtG,gBAAgB,YAAY,WAAW,oBAAC,iBAAD,CAAkB,CAAA;CAC1D,EAAA,CAAA;AAEN;AAEA,IAAM,kBAAkB,YAAkD,OAAO,QAAQ;CACvF,MAAM,EACJ,aACA,gBACA,cACA,cACA,gBACA,eACA,OACA,SACA,GAAG,SACD;CACJ,MAAM,CAAC,iBAAiB,cAAc,WAAqB,IAAa;CAExE,MAAM,oBAAoB,YAAyC;EACjE,eAAe,OAAO;EAEtB,MAAM,eAAe,QAAQ,MAAM;EACnC,IAAI,cACF,iBAAiB,YAAY;OAE7B,gBAAgB;CAEpB;CAEA,MAAM,eAAe;EACnB;EACA,OAAO,MAAM;EACb;EACA;EACA;CACF;CAEA,OACE,oBAAC,aAAD;EAAkB;EAAY;EAAO,GAAI;EACvC,UAAA,qBAAC,WAAW,MAAZ;GAA0B;GAAS,cAAc;GAAkB,GAAI;GAAvE,UAAA,CACE,oBAAC,WAAW,aAAZ,CAAyB,CAAA,GACzB,oBAAC,wBAAD,EAAwB,GAAI,aAAe,CAAA,CAC5B;;CACN,CAAA;AAEjB,CAAC;AAED,gBAAgB,cAAc"}
|
|
1
|
+
{"version":3,"file":"BitkitFileInput.js","names":["ImageCropper","_Fragment","splitFileUploadProps"],"sources":["../../../lib/components/BitkitFileInput/BitkitFileInput.tsx"],"sourcesContent":["import { Card } from '@chakra-ui/react/card';\nimport { useFieldContext } from '@chakra-ui/react/field';\nimport {\n FileUpload,\n type FileUploadFileAcceptDetails,\n type FileUploadRootProps,\n useFileUploadContext,\n} from '@chakra-ui/react/file-upload';\nimport { VStack } from '@chakra-ui/react/stack';\nimport { Text } from '@chakra-ui/react/text';\nimport { splitProps as splitFileUploadProps } from '@zag-js/file-upload';\nimport { forwardRef, useEffect, useId, useMemo } from 'react';\n\nimport ImageCropper, { useImageCropperContext } from '../../atoms/ImageCropper/ImageCropper';\nimport { IconMinusCircle, IconUpload } from '../../icons';\nimport BitkitButton from '../BitkitButton/BitkitButton';\nimport BitkitField, { type BitkitFieldProps } from '../BitkitField/BitkitField';\n\nexport type BitkitFileInputProps = Omit<BitkitFieldProps, 'children' | 'state'> &\n Omit<FileUploadRootProps, 'disabled' | 'invalid'> & {\n aspectRatio?: number;\n /**\n * Max width/height (px) of the cropped output. The Ark cropper emits at the\n * selection's natural resolution with no size cap, so a large source image\n * can produce an oversized file; set this to downscale the output to fit.\n */\n maxCroppedSize?: number;\n onCropChange?: (file: File) => void;\n /**\n * Called when a file is accepted. Only ever fires with a file — clearing the\n * selection calls `onFileRemoved` instead.\n */\n onFileAccepted?: (file: File) => void;\n /**\n * Called when the accepted file is cleared — via the \"Remove\" button or a\n * programmatic `clearFiles()`.\n */\n onFileRemoved?: () => void;\n state?: 'error' | 'disabled';\n };\n\n// Ark's getCroppedImage() emits at the selection's natural resolution and only\n// controls format/quality (no size cap), so downscale here when a max is set —\n// this keeps a large source image from producing an oversized upload. Preserves\n// the blob's MIME type; falls back to the original blob if it can't be decoded.\nconst downscaleBlob = (blob: Blob, maxSize: number): Promise<Blob> => {\n // A non-positive or non-finite max would produce a 0×0 / NaN canvas and corrupt\n // the output, so treat it as \"no cap\" and pass the blob through untouched.\n if (!Number.isFinite(maxSize) || maxSize <= 0) {\n return Promise.resolve(blob);\n }\n\n return new Promise((resolve) => {\n const url = URL.createObjectURL(blob);\n const image = new Image();\n\n image.onload = () => {\n URL.revokeObjectURL(url);\n const largestSide = Math.max(image.naturalWidth, image.naturalHeight);\n if (largestSide <= maxSize) {\n resolve(blob);\n return;\n }\n const scale = maxSize / largestSide;\n const canvas = document.createElement('canvas');\n canvas.width = Math.round(image.naturalWidth * scale);\n canvas.height = Math.round(image.naturalHeight * scale);\n const context = canvas.getContext('2d');\n if (!context) {\n resolve(blob);\n return;\n }\n context.drawImage(image, 0, 0, canvas.width, canvas.height);\n canvas.toBlob((result) => resolve(result ?? blob), blob.type);\n };\n\n image.onerror = () => {\n URL.revokeObjectURL(url);\n resolve(blob);\n };\n\n image.src = url;\n });\n};\n\nconst Dropzone = (props: Pick<BitkitFileInputProps, 'label'>) => {\n const { label } = props;\n const { disabled } = useFileUploadContext();\n const field = useFieldContext();\n const instructionId = useId();\n const dropzoneLabel = disabled ? 'Cannot upload file' : 'Drag and drop file here or click to select';\n const fieldControlProps = field?.getInputProps();\n const fieldLabelId = label ? field?.ids.label : undefined;\n\n return (\n <FileUpload.Dropzone\n aria-describedby={fieldControlProps?.['aria-describedby']}\n aria-errormessage={fieldControlProps?.['aria-errormessage']}\n aria-invalid={fieldControlProps?.['aria-invalid']}\n aria-labelledby={fieldLabelId ? `${fieldLabelId} ${instructionId}` : instructionId}\n >\n <FileUpload.DropzoneContent>\n <IconUpload />\n <Text as=\"span\" id={instructionId}>\n {dropzoneLabel}\n </Text>\n </FileUpload.DropzoneContent>\n </FileUpload.Dropzone>\n );\n};\n\nconst ImagePreviewContent = (props: Pick<BitkitFileInputProps, 'onCropChange' | 'maxCroppedSize'>) => {\n const { onCropChange, maxCroppedSize } = props;\n\n const { acceptedFiles } = useFileUploadContext();\n const { dragging, getCroppedImage } = useImageCropperContext();\n\n const acceptedFile = acceptedFiles[0];\n const objectUrl = useMemo(() => (acceptedFile ? URL.createObjectURL(acceptedFile) : undefined), [acceptedFile]);\n\n useEffect(() => {\n return () => {\n if (objectUrl) {\n URL.revokeObjectURL(objectUrl);\n }\n };\n }, [objectUrl]);\n\n useEffect(() => {\n if (!onCropChange || dragging) {\n return;\n }\n\n if (!acceptedFile) {\n return;\n }\n\n let cancelled = false;\n // Preserve the source MIME type — the Ark cropper defaults to image/png, which\n // would mismatch a .jpg name and bloat the file.\n getCroppedImage({ type: acceptedFile.type || undefined })\n .then((result) => {\n if (!(result instanceof Blob)) {\n return result;\n }\n return maxCroppedSize ? downscaleBlob(result, maxCroppedSize) : result;\n })\n .then((result) => {\n if (!cancelled && result instanceof Blob) {\n onCropChange(new File([result], acceptedFile.name, { type: result.type }));\n }\n });\n\n return () => {\n cancelled = true;\n };\n }, [getCroppedImage, acceptedFile, onCropChange, dragging, maxCroppedSize]);\n\n return (\n <ImageCropper.Viewport>\n <ImageCropper.Image src={objectUrl} />\n <ImageCropper.Selection>\n {ImageCropper.handles.map((position) => (\n <ImageCropper.Handle key={position} position={position}>\n <div />\n </ImageCropper.Handle>\n ))}\n </ImageCropper.Selection>\n </ImageCropper.Viewport>\n );\n};\n\nconst ImagePreview = (props: Pick<BitkitFileInputProps, 'aspectRatio' | 'onCropChange' | 'maxCroppedSize'>) => {\n const { aspectRatio, onCropChange, maxCroppedSize } = props;\n\n return (\n <ImageCropper.Root aspectRatio={aspectRatio} height=\"100%\">\n <ImagePreviewContent onCropChange={onCropChange} maxCroppedSize={maxCroppedSize} />\n </ImageCropper.Root>\n );\n};\n\nconst NonImagePreview = () => {\n const fileUpload = useFileUploadContext();\n const acceptedFile = fileUpload.acceptedFiles[0];\n\n return (\n <Card.Root asChild elevation={false}>\n <Card.Body display=\"flex\" paddingBlock=\"20\" paddingInline=\"24\" alignItems=\"center\" flex=\"1\">\n <VStack gap=\"4\" alignItems=\"flex-start\" flex=\"1\" minWidth=\"0\">\n <Text textStyle=\"comp/input/label\">Selected file</Text>\n <Text whiteSpace=\"nowrap\" textOverflow=\"ellipsis\" overflow=\"hidden\" maxWidth=\"100%\">\n {acceptedFile.name}\n </Text>\n </VStack>\n <BitkitButton icon={IconMinusCircle} variant=\"secondary\" size=\"md\" onClick={fileUpload.clearFiles}>\n Remove\n </BitkitButton>\n </Card.Body>\n </Card.Root>\n );\n};\n\nconst BitkitFileInputContent = (\n props: Pick<BitkitFileInputProps, 'variant' | 'aspectRatio' | 'label' | 'onCropChange' | 'maxCroppedSize'>,\n) => {\n const { variant, aspectRatio, label, onCropChange, maxCroppedSize } = props;\n const acceptedFile = useFileUploadContext().acceptedFiles[0];\n\n return (\n <>\n {!acceptedFile && <Dropzone label={label} />}\n {acceptedFile && variant === 'image' && (\n <ImagePreview aspectRatio={aspectRatio} onCropChange={onCropChange} maxCroppedSize={maxCroppedSize} />\n )}\n {acceptedFile && variant !== 'image' && <NonImagePreview />}\n </>\n );\n};\n\nconst BitkitFileInput = forwardRef<HTMLDivElement, BitkitFileInputProps>((props, ref) => {\n const {\n aspectRatio,\n maxCroppedSize,\n onCropChange,\n onFileAccept,\n onFileAccepted,\n onFileRemoved,\n state,\n variant,\n ...rest\n } = props;\n const [fileUploadProps, fieldProps] = splitFileUploadProps(rest as never);\n\n const handleFileAccept = (details: FileUploadFileAcceptDetails) => {\n onFileAccept?.(details);\n\n const acceptedFile = details.files[0];\n if (acceptedFile) {\n onFileAccepted?.(acceptedFile);\n } else {\n onFileRemoved?.();\n }\n };\n\n const contentProps = {\n aspectRatio,\n label: props.label,\n maxCroppedSize,\n onCropChange,\n variant,\n };\n\n return (\n <BitkitField ref={ref} state={state} {...fieldProps}>\n <FileUpload.Root variant={variant} onFileAccept={handleFileAccept} {...fileUploadProps}>\n <FileUpload.HiddenInput />\n <BitkitFileInputContent {...contentProps} />\n </FileUpload.Root>\n </BitkitField>\n );\n});\n\nBitkitFileInput.displayName = 'BitkitFileInput';\n\nexport default BitkitFileInput;\n"],"mappings":";;;;;;;;;;;;;;AA6CA,IAAM,iBAAiB,MAAY,YAAmC;CAGpE,IAAI,CAAC,OAAO,SAAS,OAAO,KAAK,WAAW,GAC1C,OAAO,QAAQ,QAAQ,IAAI;CAG7B,OAAO,IAAI,SAAS,YAAY;EAC9B,MAAM,MAAM,IAAI,gBAAgB,IAAI;EACpC,MAAM,QAAQ,IAAI,MAAM;EAExB,MAAM,eAAe;GACnB,IAAI,gBAAgB,GAAG;GACvB,MAAM,cAAc,KAAK,IAA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MAAM;EACnC,IAAI,cACF,iBAAiB,YAAY;OAE7B,gBAAgB;CAEpB;CAEA,MAAM,eAAe;EACnB;EACA,OAAO,MAAM;EACb;EACA;EACA;CACF;CAEA,OACE,oBAAC,aAAD;EAAkB;EAAY;EAAO,GAAI;EACvC,UAAA,qBAAC,WAAW,MAAZ;GAA0B;GAAS,cAAc;GAAkB,GAAI;GAAvE,UAAA,CACE,oBAAC,WAAW,aAAZ,CAAyB,CAAA,GACzB,oBAAC,wBAAD,EAAwB,GAAI,aAAe,CAAA,CAC5B;;CACN,CAAA;AAEjB,CAAC;AAED,gBAAgB,cAAc"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BitkitIconButton.js","names":[],"sources":["../../../lib/components/BitkitIconButton/BitkitIconButton.tsx"],"sourcesContent":["import { IconButton, type IconButtonProps } from '@chakra-ui/react/button';\nimport { Skeleton } from '@chakra-ui/react/skeleton';\nimport { chakra, type HTMLChakraProps, type RecipeProps, useRecipe } from '@chakra-ui/react/styled-system';\nimport {\n Children,\n cloneElement,\n forwardRef,\n type KeyboardEvent,\n type MouseEvent,\n type ReactElement,\n type Ref,\n} from 'react';\n\nimport { type BitkitIconComponent } from '../../icons';\nimport opensPopup from '../../utilities/opensPopup';\nimport BitkitLabelTooltip, { type BitkitLabelTooltipProps } from '../BitkitLabelTooltip/BitkitLabelTooltip';\n\ntype BitkitIconButtonOmittedFromButton =\n | 'aria-label'\n | 'asChild'\n | 'children'\n | 'colorPalette'\n | 'disabled'\n | 'loading'\n | 'loadingText'\n | 'spinner'\n | 'spinnerPlacement';\n\ninterface BitkitIconButtonCommonProps {\n icon: BitkitIconComponent;\n label: string;\n /**\n * Overrides for the label tooltip. It is off by default when this control opens a popup — a menu,\n * select or popover trigger — where the panel is the affordance and a tooltip would hover over it.\n * Pass `{ disabled: false }` to bring it back. The accessible name comes from `label` either way.\n */\n tooltipProps?: Partial<Omit<BitkitLabelTooltipProps, 'children' | 'text'>>;\n}\n\ninterface BitkitIconButtonAsButtonProps\n extends BitkitIconButtonCommonProps, Omit<IconButtonProps, BitkitIconButtonOmittedFromButton> {\n asChild?: false;\n href?: undefined;\n isExternal?: undefined;\n state?: 'disabled' | 'loading' | 'skeleton';\n}\n\ninterface BitkitIconButtonAsAnchorProps\n extends\n BitkitIconButtonCommonProps,\n Omit<HTMLChakraProps<'a'>, 'aria-label' | 'children' | 'colorPalette'>,\n RecipeProps<'button'> {\n asChild?: false;\n href: string;\n isExternal?: boolean;\n state?: 'disabled' | 'skeleton';\n}\n\ninterface BitkitIconButtonAsChildProps\n extends BitkitIconButtonCommonProps, Omit<IconButtonProps, BitkitIconButtonOmittedFromButton> {\n asChild: true;\n children: ReactElement;\n href?: undefined;\n isExternal?: undefined;\n state?: 'disabled' | 'loading' | 'skeleton';\n}\n\nexport type BitkitIconButtonProps =\n
|
|
1
|
+
{"version":3,"file":"BitkitIconButton.js","names":[],"sources":["../../../lib/components/BitkitIconButton/BitkitIconButton.tsx"],"sourcesContent":["import { IconButton, type IconButtonProps } from '@chakra-ui/react/button';\nimport { Skeleton } from '@chakra-ui/react/skeleton';\nimport { chakra, type HTMLChakraProps, type RecipeProps, useRecipe } from '@chakra-ui/react/styled-system';\nimport {\n Children,\n cloneElement,\n forwardRef,\n type KeyboardEvent,\n type MouseEvent,\n type ReactElement,\n type Ref,\n} from 'react';\n\nimport { type BitkitIconComponent } from '../../icons';\nimport opensPopup from '../../utilities/opensPopup';\nimport BitkitLabelTooltip, { type BitkitLabelTooltipProps } from '../BitkitLabelTooltip/BitkitLabelTooltip';\n\ntype BitkitIconButtonOmittedFromButton =\n | 'aria-label'\n | 'asChild'\n | 'children'\n | 'colorPalette'\n | 'disabled'\n | 'loading'\n | 'loadingText'\n | 'spinner'\n | 'spinnerPlacement';\n\ninterface BitkitIconButtonCommonProps {\n icon: BitkitIconComponent;\n label: string;\n /**\n * Overrides for the label tooltip. It is off by default when this control opens a popup — a menu,\n * select or popover trigger — where the panel is the affordance and a tooltip would hover over it.\n * Pass `{ disabled: false }` to bring it back. The accessible name comes from `label` either way.\n */\n tooltipProps?: Partial<Omit<BitkitLabelTooltipProps, 'children' | 'text'>>;\n}\n\ninterface BitkitIconButtonAsButtonProps\n extends BitkitIconButtonCommonProps, Omit<IconButtonProps, BitkitIconButtonOmittedFromButton> {\n asChild?: false;\n href?: undefined;\n isExternal?: undefined;\n state?: 'disabled' | 'loading' | 'skeleton';\n}\n\ninterface BitkitIconButtonAsAnchorProps\n extends\n BitkitIconButtonCommonProps,\n Omit<HTMLChakraProps<'a'>, 'aria-label' | 'children' | 'colorPalette'>,\n RecipeProps<'button'> {\n asChild?: false;\n href: string;\n isExternal?: boolean;\n state?: 'disabled' | 'skeleton';\n}\n\ninterface BitkitIconButtonAsChildProps\n extends BitkitIconButtonCommonProps, Omit<IconButtonProps, BitkitIconButtonOmittedFromButton> {\n asChild: true;\n children: ReactElement;\n href?: undefined;\n isExternal?: undefined;\n state?: 'disabled' | 'loading' | 'skeleton';\n}\n\nexport type BitkitIconButtonProps =\n BitkitIconButtonAsButtonProps | BitkitIconButtonAsAnchorProps | BitkitIconButtonAsChildProps;\n\n// The forwarded ref is typed as HTMLElement to cover all three modes (button, anchor, slot/asChild),\n// since asChild can render any element (router Link, custom wrappers, etc.). Inner narrow casts\n// satisfy the wrapped Chakra components without affecting the consumer-visible ref shape.\nconst BitkitIconButton = forwardRef<HTMLElement, BitkitIconButtonProps>((props, ref) => {\n const buttonRecipe = useRecipe({ key: 'button' });\n const Icon = props.icon;\n // An unset `size` reaches us as `undefined` — the `button` recipe's `lg` default lives in CSS,\n // not on the prop — so resolve it here rather than letting it fall to the 16px branch.\n const iconSize = (props.size ?? 'lg') === 'lg' ? '24' : '16';\n const isDisabled = props.state === 'disabled';\n const isSkeleton = props.state === 'skeleton';\n const isPopupTrigger = opensPopup(props);\n\n // --- Slot mode (asChild) ---\n if (props.asChild) {\n const { asChild: _asChild, children, icon: _icon, label, state, tooltipProps, ...buttonRest } = props;\n const onlyChild = Children.only(children) as ReactElement<{ 'aria-label'?: string }>;\n const iconButtonElement = (\n <IconButton\n asChild\n aria-label={label}\n disabled={isDisabled}\n loading={state === 'loading'}\n ref={ref as Ref<HTMLButtonElement>}\n {...buttonRest}\n >\n {cloneElement(onlyChild, { 'aria-label': onlyChild.props['aria-label'] ?? label }, <Icon size={iconSize} />)}\n </IconButton>\n );\n return (\n <BitkitLabelTooltip text={label} disabled={isPopupTrigger} {...tooltipProps}>\n {isSkeleton ? (\n <Skeleton asChild loading>\n {iconButtonElement}\n </Skeleton>\n ) : (\n iconButtonElement\n )}\n </BitkitLabelTooltip>\n );\n }\n\n // --- Anchor mode (href) ---\n if (props.href !== undefined) {\n const {\n css,\n href,\n icon: _icon,\n isExternal,\n label,\n onClick,\n onKeyDown,\n rel,\n size,\n state: _state,\n target,\n tooltipProps,\n variant,\n ...anchorRest\n } = props;\n const effectiveTarget = isExternal ? '_blank' : target;\n const effectiveRel = isExternal ? (rel ? `${rel} noreferrer noopener` : 'noreferrer noopener') : rel;\n const handleClick = isDisabled\n ? (e: MouseEvent<HTMLAnchorElement>) => {\n e.preventDefault();\n e.stopPropagation();\n }\n : onClick;\n const handleKeyDown = isDisabled\n ? (e: KeyboardEvent<HTMLAnchorElement>) => {\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault();\n e.stopPropagation();\n }\n }\n : onKeyDown;\n const anchorElement = (\n <chakra.a\n ref={ref as Ref<HTMLAnchorElement>}\n {...anchorRest}\n aria-disabled={isDisabled || undefined}\n aria-label={label}\n css={[buttonRecipe({ size, variant }), { paddingBlock: 0, paddingInline: 0 }, css]}\n href={isDisabled ? undefined : href}\n onClick={handleClick}\n onKeyDown={handleKeyDown}\n rel={effectiveRel}\n target={effectiveTarget}\n >\n <Icon size={iconSize} />\n </chakra.a>\n );\n return (\n <BitkitLabelTooltip text={label} disabled={isPopupTrigger} {...tooltipProps}>\n {isSkeleton ? (\n <Skeleton asChild loading>\n {anchorElement}\n </Skeleton>\n ) : (\n anchorElement\n )}\n </BitkitLabelTooltip>\n );\n }\n\n // --- Button mode (default) ---\n const { icon: _icon, label, state, tooltipProps, ...buttonRest } = props;\n return (\n <BitkitLabelTooltip text={label} disabled={isPopupTrigger} {...tooltipProps}>\n <Skeleton asChild loading={isSkeleton}>\n <IconButton\n aria-label={label}\n disabled={isDisabled}\n loading={state === 'loading'}\n ref={ref as Ref<HTMLButtonElement>}\n {...buttonRest}\n >\n <Icon size={iconSize} />\n </IconButton>\n </Skeleton>\n </BitkitLabelTooltip>\n );\n});\n\nBitkitIconButton.displayName = 'BitkitIconButton';\n\nexport default BitkitIconButton;\n"],"mappings":";;;;;;;;AAyEA,IAAM,mBAAmB,YAAgD,OAAO,QAAQ;CACtF,MAAM,eAAe,UAAU,EAAE,KAAK,SAAS,CAAC;CAChD,MAAM,OAAO,MAAM;CAGnB,MAAM,YAAY,MAAM,QAAQ,UAAU,OAAO,OAAO;CACxD,MAAM,aAAa,MAAM,UAAU;CACnC,MAAM,aAAa,MAAM,UAAU;CACnC,MAAM,iBAAiB,WAAW,KAAK;CAGvC,IAAI,MAAM,SAAS;EACjB,MAAM,EAAE,SAAS,UAAU,UAAU,MAAM,OAAO,OAAO,OAAO,cAAc,GAAG,eAAe;EAChG,MAAM,YAAY,SAAS,KAAK,QAAQ;EACxC,MAAM,oBACJ,oBAAC,YAAD;GACE,SAAA;GACA,cAAY;GACZ,UAAU;GACV,SAAS,UAAU;GACd;GACL,GAAI;GAEH,UAAA,aAAa,WAAW,EAAE,cAAc,UAAU,MAAM,iBAAiB,MAAM,GAAG,oBAAC,MAAD,EAAM,MAAM,SAAW,CAAA,CAAC;EACjG,CAAA;EAEd,OACE,oBAAC,oBAAD;GAAoB,MAAM;GAAO,UAAU;GAAgB,GAAI;GAC5D,UAAA,aACC,oBAAC,UAAD;IAAU,SAAA;IAAQ,SAAA;IACf,UAAA;GACO,CAAA,IAEV;EAEgB,CAAA;CAExB;CAGA,IAAI,MAAM,SAAS,KAAA,GAAW;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