@dynamic-framework/ui-react 2.9.0 → 2.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/DPortalStack-6zJm6JoD.js +14 -0
- package/dist/DPortalStack-6zJm6JoD.js.map +1 -0
- package/dist/DPortalStack-D1-GGU4C.js +12 -0
- package/dist/DPortalStack-D1-GGU4C.js.map +1 -0
- package/dist/api.json +7429 -0
- package/dist/css/dynamic-ui.css +95 -26
- package/dist/css/dynamic-ui.min.css +2 -2
- package/dist/esm/components/DAlert/DAlert.js +16 -0
- package/dist/esm/components/DAlert/DAlert.js.map +1 -0
- package/dist/esm/components/DAlert/index.js +6 -0
- package/dist/esm/components/DAlert/index.js.map +1 -0
- package/dist/esm/components/DAvatar/DAvatar.js +23 -0
- package/dist/esm/components/DAvatar/DAvatar.js.map +1 -0
- package/dist/esm/components/DAvatar/index.js +6 -0
- package/dist/esm/components/DAvatar/index.js.map +1 -0
- package/dist/esm/components/DBadge/DBadge.js +31 -0
- package/dist/esm/components/DBadge/DBadge.js.map +1 -0
- package/dist/esm/components/DBadge/index.js +6 -0
- package/dist/esm/components/DBadge/index.js.map +1 -0
- package/dist/esm/components/DBox/DBox.js +9 -0
- package/dist/esm/components/DBox/DBox.js.map +1 -0
- package/dist/esm/components/DBox/index.js +6 -0
- package/dist/esm/components/DBox/index.js.map +1 -0
- package/dist/esm/components/DBoxFile/DBoxFile.js +26 -0
- package/dist/esm/components/DBoxFile/DBoxFile.js.map +1 -0
- package/dist/esm/components/DBoxFile/index.js +6 -0
- package/dist/esm/components/DBoxFile/index.js.map +1 -0
- package/dist/esm/components/DBoxFile/useDBoxFile.js +236 -0
- package/dist/esm/components/DBoxFile/useDBoxFile.js.map +1 -0
- package/dist/esm/components/DBoxFile/utils.js +127 -0
- package/dist/esm/components/DBoxFile/utils.js.map +1 -0
- package/dist/esm/components/DButton/DButton.js +84 -0
- package/dist/esm/components/DButton/DButton.js.map +1 -0
- package/dist/esm/components/DButton/index.js +6 -0
- package/dist/esm/components/DButton/index.js.map +1 -0
- package/dist/esm/components/DButtonIcon/DButtonIcon.js +55 -0
- package/dist/esm/components/DButtonIcon/DButtonIcon.js.map +1 -0
- package/dist/esm/components/DButtonIcon/index.js +6 -0
- package/dist/esm/components/DButtonIcon/index.js.map +1 -0
- package/dist/esm/components/DButtonIcon/warnMissingAccessibleName.js +40 -0
- package/dist/esm/components/DButtonIcon/warnMissingAccessibleName.js.map +1 -0
- package/dist/esm/components/DCard/DCard.js +17 -0
- package/dist/esm/components/DCard/DCard.js.map +1 -0
- package/dist/esm/components/DCard/components/DCardBody.js +9 -0
- package/dist/esm/components/DCard/components/DCardBody.js.map +1 -0
- package/dist/esm/components/DCard/components/DCardFooter.js +9 -0
- package/dist/esm/components/DCard/components/DCardFooter.js.map +1 -0
- package/dist/esm/components/DCard/components/DCardHeader.js +9 -0
- package/dist/esm/components/DCard/components/DCardHeader.js.map +1 -0
- package/dist/esm/components/DCard/index.js +9 -0
- package/dist/esm/components/DCard/index.js.map +1 -0
- package/dist/esm/components/DCarousel/DCarousel.js +39 -0
- package/dist/esm/components/DCarousel/DCarousel.js.map +1 -0
- package/dist/esm/components/DCarousel/components/DCarouselSlide.js +12 -0
- package/dist/esm/components/DCarousel/components/DCarouselSlide.js.map +1 -0
- package/dist/esm/components/DCarousel/index.js +7 -0
- package/dist/esm/components/DCarousel/index.js.map +1 -0
- package/dist/esm/components/DChip/DChip.js +18 -0
- package/dist/esm/components/DChip/DChip.js.map +1 -0
- package/dist/esm/components/DChip/index.js +6 -0
- package/dist/esm/components/DChip/index.js.map +1 -0
- package/dist/esm/components/DCollapse/DCollapse.js +30 -0
- package/dist/esm/components/DCollapse/DCollapse.js.map +1 -0
- package/dist/esm/components/DCollapse/index.js +6 -0
- package/dist/esm/components/DCollapse/index.js.map +1 -0
- package/dist/esm/components/DConfirmModal/DConfirmModalContainer.js +59 -0
- package/dist/esm/components/DConfirmModal/DConfirmModalContainer.js.map +1 -0
- package/dist/esm/components/DConfirmModal/DConfirmModalUI.js +39 -0
- package/dist/esm/components/DConfirmModal/DConfirmModalUI.js.map +1 -0
- package/dist/esm/components/DConfirmModal/confirmModalStore.js +38 -0
- package/dist/esm/components/DConfirmModal/confirmModalStore.js.map +1 -0
- package/dist/esm/components/DCreditCard/DCreditCard.js +15 -0
- package/dist/esm/components/DCreditCard/DCreditCard.js.map +1 -0
- package/dist/esm/components/DCreditCard/index.js +6 -0
- package/dist/esm/components/DCreditCard/index.js.map +1 -0
- package/dist/esm/components/DCurrencyText/DCurrencyText.js +10 -0
- package/dist/esm/components/DCurrencyText/DCurrencyText.js.map +1 -0
- package/dist/esm/components/DCurrencyText/index.js +6 -0
- package/dist/esm/components/DCurrencyText/index.js.map +1 -0
- package/dist/esm/components/DDataStateWrapper/DDataStateWrapper.js +42 -0
- package/dist/esm/components/DDataStateWrapper/DDataStateWrapper.js.map +1 -0
- package/dist/esm/components/DDataStateWrapper/components/EmptyState.js +10 -0
- package/dist/esm/components/DDataStateWrapper/components/EmptyState.js.map +1 -0
- package/dist/esm/components/DDataStateWrapper/components/ErrorState.js +10 -0
- package/dist/esm/components/DDataStateWrapper/components/ErrorState.js.map +1 -0
- package/dist/esm/components/DDataStateWrapper/components/LoadingState.js +8 -0
- package/dist/esm/components/DDataStateWrapper/components/LoadingState.js.map +1 -0
- package/dist/esm/components/DDataStateWrapper/index.js +9 -0
- package/dist/esm/components/DDataStateWrapper/index.js.map +1 -0
- package/dist/esm/components/DDatePicker/DDatePicker.js +54 -0
- package/dist/esm/components/DDatePicker/DDatePicker.js.map +1 -0
- package/dist/esm/components/DDatePicker/components/DDatePickerHeaderSelector.js +50 -0
- package/dist/esm/components/DDatePicker/components/DDatePickerHeaderSelector.js.map +1 -0
- package/dist/esm/components/DDatePicker/components/DDatePickerInput.js +16 -0
- package/dist/esm/components/DDatePicker/components/DDatePickerInput.js.map +1 -0
- package/dist/esm/components/DDatePicker/components/DDatePickerTime.js +11 -0
- package/dist/esm/components/DDatePicker/components/DDatePickerTime.js.map +1 -0
- package/dist/esm/components/DDatePicker/index.js +6 -0
- package/dist/esm/components/DDatePicker/index.js.map +1 -0
- package/dist/esm/components/DDropdown/DDropdown.js +315 -0
- package/dist/esm/components/DDropdown/DDropdown.js.map +1 -0
- package/dist/esm/components/DDropdown/index.js +6 -0
- package/dist/esm/components/DDropdown/index.js.map +1 -0
- package/dist/esm/components/DErrorBoundary/DErrorBoundary.js +22 -0
- package/dist/esm/components/DErrorBoundary/DErrorBoundary.js.map +1 -0
- package/dist/esm/components/DErrorBoundary/components/DefaultErrorBoundary.js +10 -0
- package/dist/esm/components/DErrorBoundary/components/DefaultErrorBoundary.js.map +1 -0
- package/dist/esm/components/DErrorBoundary/index.js +7 -0
- package/dist/esm/components/DErrorBoundary/index.js.map +1 -0
- package/dist/esm/components/DIcon/DIcon.js +21 -0
- package/dist/esm/components/DIcon/DIcon.js.map +1 -0
- package/dist/esm/components/DIcon/index.js +6 -0
- package/dist/esm/components/DIcon/index.js.map +1 -0
- package/dist/esm/components/DIconBase/DIconBase.js +146 -0
- package/dist/esm/components/DIconBase/DIconBase.js.map +1 -0
- package/dist/esm/components/DIconBase/index.js +6 -0
- package/dist/esm/components/DIconBase/index.js.map +1 -0
- package/dist/esm/components/DIconBase/resolveIconFromRegistry.js +20 -0
- package/dist/esm/components/DIconBase/resolveIconFromRegistry.js.map +1 -0
- package/dist/esm/components/DIconBase/warnUnknownIcon.js +59 -0
- package/dist/esm/components/DIconBase/warnUnknownIcon.js.map +1 -0
- package/dist/esm/components/DInput/DInput.js +95 -0
- package/dist/esm/components/DInput/DInput.js.map +1 -0
- package/dist/esm/components/DInput/index.js +6 -0
- package/dist/esm/components/DInput/index.js.map +1 -0
- package/dist/esm/components/DInputCheck/DInputCheck.js +94 -0
- package/dist/esm/components/DInputCheck/DInputCheck.js.map +1 -0
- package/dist/esm/components/DInputCheck/index.js +6 -0
- package/dist/esm/components/DInputCheck/index.js.map +1 -0
- package/dist/esm/components/DInputCounter/DInputCounter.js +107 -0
- package/dist/esm/components/DInputCounter/DInputCounter.js.map +1 -0
- package/dist/esm/components/DInputCounter/index.js +6 -0
- package/dist/esm/components/DInputCounter/index.js.map +1 -0
- package/dist/esm/components/DInputCurrency/DInputCurrency.js +25 -0
- package/dist/esm/components/DInputCurrency/DInputCurrency.js.map +1 -0
- package/dist/esm/components/DInputCurrency/index.js +6 -0
- package/dist/esm/components/DInputCurrency/index.js.map +1 -0
- package/dist/esm/components/DInputMask/DInputMask.js +13 -0
- package/dist/esm/components/DInputMask/DInputMask.js.map +1 -0
- package/dist/esm/components/DInputMask/index.js +6 -0
- package/dist/esm/components/DInputMask/index.js.map +1 -0
- package/dist/esm/components/DInputPassword/DInputPassword.js +24 -0
- package/dist/esm/components/DInputPassword/DInputPassword.js.map +1 -0
- package/dist/esm/components/DInputPassword/index.js +6 -0
- package/dist/esm/components/DInputPassword/index.js.map +1 -0
- package/dist/esm/components/DInputPhone/DInputPhone.js +108 -0
- package/dist/esm/components/DInputPhone/DInputPhone.js.map +1 -0
- package/dist/esm/components/DInputPhone/index.js +6 -0
- package/dist/esm/components/DInputPhone/index.js.map +1 -0
- package/dist/esm/components/DInputPin/DInputPin.js +88 -0
- package/dist/esm/components/DInputPin/DInputPin.js.map +1 -0
- package/dist/esm/components/DInputPin/index.js +6 -0
- package/dist/esm/components/DInputPin/index.js.map +1 -0
- package/dist/esm/components/DInputRange/DInputRange.js +60 -0
- package/dist/esm/components/DInputRange/DInputRange.js.map +1 -0
- package/dist/esm/components/DInputRange/index.js +6 -0
- package/dist/esm/components/DInputRange/index.js.map +1 -0
- package/dist/esm/components/DInputSearch/DInputSearch.js +57 -0
- package/dist/esm/components/DInputSearch/DInputSearch.js.map +1 -0
- package/dist/esm/components/DInputSearch/index.js +6 -0
- package/dist/esm/components/DInputSearch/index.js.map +1 -0
- package/dist/esm/components/DInputSelect/DInputSelect.js +104 -0
- package/dist/esm/components/DInputSelect/DInputSelect.js.map +1 -0
- package/dist/esm/components/DInputSelect/index.js +6 -0
- package/dist/esm/components/DInputSelect/index.js.map +1 -0
- package/dist/esm/components/DInputSwitch/DInputSwitch.js +43 -0
- package/dist/esm/components/DInputSwitch/DInputSwitch.js.map +1 -0
- package/dist/esm/components/DInputSwitch/index.js +6 -0
- package/dist/esm/components/DInputSwitch/index.js.map +1 -0
- package/dist/esm/components/DLayout/DLayout.js +22 -0
- package/dist/esm/components/DLayout/DLayout.js.map +1 -0
- package/dist/esm/components/DLayout/components/DLayoutPane.js +16 -0
- package/dist/esm/components/DLayout/components/DLayoutPane.js.map +1 -0
- package/dist/esm/components/DLayout/index.js +7 -0
- package/dist/esm/components/DLayout/index.js.map +1 -0
- package/dist/esm/components/DListGroup/DListGroup.js +39 -0
- package/dist/esm/components/DListGroup/DListGroup.js.map +1 -0
- package/dist/esm/components/DListGroup/ListGroupContext.js +11 -0
- package/dist/esm/components/DListGroup/ListGroupContext.js.map +1 -0
- package/dist/esm/components/DListGroup/components/DListGroupItem.js +59 -0
- package/dist/esm/components/DListGroup/components/DListGroupItem.js.map +1 -0
- package/dist/esm/components/DListGroup/components/warnInvalidListMarkup.js +30 -0
- package/dist/esm/components/DListGroup/components/warnInvalidListMarkup.js.map +1 -0
- package/dist/esm/components/DListGroup/index.js +7 -0
- package/dist/esm/components/DListGroup/index.js.map +1 -0
- package/dist/esm/components/DModal/DModal.js +37 -0
- package/dist/esm/components/DModal/DModal.js.map +1 -0
- package/dist/esm/components/DModal/components/DModalBody.js +9 -0
- package/dist/esm/components/DModal/components/DModalBody.js.map +1 -0
- package/dist/esm/components/DModal/components/DModalFooter.js +14 -0
- package/dist/esm/components/DModal/components/DModalFooter.js.map +1 -0
- package/dist/esm/components/DModal/components/DModalHeader.js +15 -0
- package/dist/esm/components/DModal/components/DModalHeader.js.map +1 -0
- package/dist/esm/components/DModal/index.js +9 -0
- package/dist/esm/components/DModal/index.js.map +1 -0
- package/dist/esm/components/DOffcanvas/DOffcanvas.js +82 -0
- package/dist/esm/components/DOffcanvas/DOffcanvas.js.map +1 -0
- package/dist/esm/components/DOffcanvas/components/DOffcanvasBody.js +9 -0
- package/dist/esm/components/DOffcanvas/components/DOffcanvasBody.js.map +1 -0
- package/dist/esm/components/DOffcanvas/components/DOffcanvasFooter.js +14 -0
- package/dist/esm/components/DOffcanvas/components/DOffcanvasFooter.js.map +1 -0
- package/dist/esm/components/DOffcanvas/components/DOffcanvasHeader.js +15 -0
- package/dist/esm/components/DOffcanvas/components/DOffcanvasHeader.js.map +1 -0
- package/dist/esm/components/DOffcanvas/index.js +9 -0
- package/dist/esm/components/DOffcanvas/index.js.map +1 -0
- package/dist/esm/components/DOtp/DOtp.js +26 -0
- package/dist/esm/components/DOtp/DOtp.js.map +1 -0
- package/dist/esm/components/DOtp/components/OtpCountdown.js +12 -0
- package/dist/esm/components/DOtp/components/OtpCountdown.js.map +1 -0
- package/dist/esm/components/DOtp/index.js +6 -0
- package/dist/esm/components/DOtp/index.js.map +1 -0
- package/dist/esm/components/DPaginator/DPaginator.js +12 -0
- package/dist/esm/components/DPaginator/DPaginator.js.map +1 -0
- package/dist/esm/components/DPaginator/index.js +6 -0
- package/dist/esm/components/DPaginator/index.js.map +1 -0
- package/dist/esm/components/DPasswordStrengthMeter/DPasswordStrengthMeter.js +27 -0
- package/dist/esm/components/DPasswordStrengthMeter/DPasswordStrengthMeter.js.map +1 -0
- package/dist/esm/components/DPasswordStrengthMeter/PasswordCheckItem.js +10 -0
- package/dist/esm/components/DPasswordStrengthMeter/PasswordCheckItem.js.map +1 -0
- package/dist/esm/components/DPasswordStrengthMeter/PasswordCheckList.js +41 -0
- package/dist/esm/components/DPasswordStrengthMeter/PasswordCheckList.js.map +1 -0
- package/dist/esm/components/DPasswordStrengthMeter/PasswordStrength.js +23 -0
- package/dist/esm/components/DPasswordStrengthMeter/PasswordStrength.js.map +1 -0
- package/dist/esm/components/DPasswordStrengthMeter/index.js +6 -0
- package/dist/esm/components/DPasswordStrengthMeter/index.js.map +1 -0
- package/dist/esm/components/DPopover/DPopover.js +49 -0
- package/dist/esm/components/DPopover/DPopover.js.map +1 -0
- package/dist/esm/components/DPopover/index.js +6 -0
- package/dist/esm/components/DPopover/index.js.map +1 -0
- package/dist/esm/components/DProgress/DProgress.js +22 -0
- package/dist/esm/components/DProgress/DProgress.js.map +1 -0
- package/dist/esm/components/DProgress/index.js +6 -0
- package/dist/esm/components/DProgress/index.js.map +1 -0
- package/dist/esm/components/DSelect/DSelect.js +88 -0
- package/dist/esm/components/DSelect/DSelect.js.map +1 -0
- package/dist/esm/components/DSelect/components/DSelectClearIndicator.js +12 -0
- package/dist/esm/components/DSelect/components/DSelectClearIndicator.js.map +1 -0
- package/dist/esm/components/DSelect/components/DSelectDropdownIndicator.js +12 -0
- package/dist/esm/components/DSelect/components/DSelectDropdownIndicator.js.map +1 -0
- package/dist/esm/components/DSelect/components/DSelectLoadingIndicator.js +12 -0
- package/dist/esm/components/DSelect/components/DSelectLoadingIndicator.js.map +1 -0
- package/dist/esm/components/DSelect/components/DSelectMultiValueRemove.js +12 -0
- package/dist/esm/components/DSelect/components/DSelectMultiValueRemove.js.map +1 -0
- package/dist/esm/components/DSelect/components/DSelectOptionCheck.js +14 -0
- package/dist/esm/components/DSelect/components/DSelectOptionCheck.js.map +1 -0
- package/dist/esm/components/DSelect/components/DSelectOptionEmoji.js +14 -0
- package/dist/esm/components/DSelect/components/DSelectOptionEmoji.js.map +1 -0
- package/dist/esm/components/DSelect/components/DSelectOptionIcon.js +15 -0
- package/dist/esm/components/DSelect/components/DSelectOptionIcon.js.map +1 -0
- package/dist/esm/components/DSelect/components/DSelectPlaceholder.js +14 -0
- package/dist/esm/components/DSelect/components/DSelectPlaceholder.js.map +1 -0
- package/dist/esm/components/DSelect/components/DSelectSingleValueEmoji.js +15 -0
- package/dist/esm/components/DSelect/components/DSelectSingleValueEmoji.js.map +1 -0
- package/dist/esm/components/DSelect/components/DSelectSingleValueEmojiText.js +15 -0
- package/dist/esm/components/DSelect/components/DSelectSingleValueEmojiText.js.map +1 -0
- package/dist/esm/components/DSelect/components/DSelectSingleValueIconText.js +16 -0
- package/dist/esm/components/DSelect/components/DSelectSingleValueIconText.js.map +1 -0
- package/dist/esm/components/DSelect/createAriaGuidance.js +57 -0
- package/dist/esm/components/DSelect/createAriaGuidance.js.map +1 -0
- package/dist/esm/components/DSelect/index.js +6 -0
- package/dist/esm/components/DSelect/index.js.map +1 -0
- package/dist/esm/components/DStepper/DStepper.js +13 -0
- package/dist/esm/components/DStepper/DStepper.js.map +1 -0
- package/dist/esm/components/DStepper/index.js +6 -0
- package/dist/esm/components/DStepper/index.js.map +1 -0
- package/dist/esm/components/DStepperDesktop/DStepperDesktop.js +27 -0
- package/dist/esm/components/DStepperDesktop/DStepperDesktop.js.map +1 -0
- package/dist/esm/components/DStepperDesktop/index.js +6 -0
- package/dist/esm/components/DStepperDesktop/index.js.map +1 -0
- package/dist/esm/components/DStepperMobile/DStepperMobile.js +37 -0
- package/dist/esm/components/DStepperMobile/DStepperMobile.js.map +1 -0
- package/dist/esm/components/DStepperMobile/index.js +6 -0
- package/dist/esm/components/DStepperMobile/index.js.map +1 -0
- package/dist/esm/components/DTabs/DTabs.js +106 -0
- package/dist/esm/components/DTabs/DTabs.js.map +1 -0
- package/dist/esm/components/DTabs/TabContext.js +14 -0
- package/dist/esm/components/DTabs/TabContext.js.map +1 -0
- package/dist/esm/components/DTabs/components/DTabContent.js +14 -0
- package/dist/esm/components/DTabs/components/DTabContent.js.map +1 -0
- package/dist/esm/components/DTabs/components/DTabsProvider.js +22 -0
- package/dist/esm/components/DTabs/components/DTabsProvider.js.map +1 -0
- package/dist/esm/components/DTabs/index.js +9 -0
- package/dist/esm/components/DTabs/index.js.map +1 -0
- package/dist/esm/components/DTimeline/DTimeline.js +12 -0
- package/dist/esm/components/DTimeline/DTimeline.js.map +1 -0
- package/dist/esm/components/DTimeline/index.js +6 -0
- package/dist/esm/components/DTimeline/index.js.map +1 -0
- package/dist/esm/components/DToast/DToast.js +20 -0
- package/dist/esm/components/DToast/DToast.js.map +1 -0
- package/dist/esm/components/DToast/components/DToastBody.js +9 -0
- package/dist/esm/components/DToast/components/DToastBody.js.map +1 -0
- package/dist/esm/components/DToast/components/DToastHeader.js +9 -0
- package/dist/esm/components/DToast/components/DToastHeader.js.map +1 -0
- package/dist/esm/components/DToast/index.js +8 -0
- package/dist/esm/components/DToast/index.js.map +1 -0
- package/dist/esm/components/DToastContainer/DToastContainer.js +9 -0
- package/dist/esm/components/DToastContainer/DToastContainer.js.map +1 -0
- package/dist/esm/components/DToastContainer/index.js +7 -0
- package/dist/esm/components/DToastContainer/index.js.map +1 -0
- package/dist/esm/components/DToastContainer/useDToast.js +58 -0
- package/dist/esm/components/DToastContainer/useDToast.js.map +1 -0
- package/dist/esm/components/DTooltip/DTooltip.js +51 -0
- package/dist/esm/components/DTooltip/DTooltip.js.map +1 -0
- package/dist/esm/components/DTooltip/index.js +6 -0
- package/dist/esm/components/DTooltip/index.js.map +1 -0
- package/dist/esm/components/DVoucher/DVoucher.js +55 -0
- package/dist/esm/components/DVoucher/DVoucher.js.map +1 -0
- package/dist/esm/components/DVoucher/hooks/useScreenshot.js +30 -0
- package/dist/esm/components/DVoucher/hooks/useScreenshot.js.map +1 -0
- package/dist/esm/components/DVoucher/hooks/useScreenshotDownload.js +30 -0
- package/dist/esm/components/DVoucher/hooks/useScreenshotDownload.js.map +1 -0
- package/dist/esm/components/DVoucher/hooks/useScreenshotWebShare.js +27 -0
- package/dist/esm/components/DVoucher/hooks/useScreenshotWebShare.js.map +1 -0
- package/dist/esm/components/DVoucher/index.js +9 -0
- package/dist/esm/components/DVoucher/index.js.map +1 -0
- package/dist/esm/components/config.js +14 -0
- package/dist/esm/components/config.js.map +1 -0
- package/dist/esm/components/internal/DFormLabel.js +46 -0
- package/dist/esm/components/internal/DFormLabel.js.map +1 -0
- package/dist/esm/contexts/DContext.js +124 -0
- package/dist/esm/contexts/DContext.js.map +1 -0
- package/dist/esm/contexts/DPortalContext.js +163 -0
- package/dist/esm/contexts/DPortalContext.js.map +1 -0
- package/dist/esm/contexts/portal/DPortalStack.js +12 -0
- package/dist/esm/contexts/portal/DPortalStack.js.map +1 -0
- package/dist/esm/hooks/useConfirmModal.js +63 -0
- package/dist/esm/hooks/useConfirmModal.js.map +1 -0
- package/dist/esm/hooks/useControlledState.js +51 -0
- package/dist/esm/hooks/useControlledState.js.map +1 -0
- package/dist/esm/hooks/useCountdown.js +45 -0
- package/dist/esm/hooks/useCountdown.js.map +1 -0
- package/dist/esm/hooks/useDisableBodyScrollEffect.js +52 -0
- package/dist/esm/hooks/useDisableBodyScrollEffect.js.map +1 -0
- package/dist/esm/hooks/useDisableInputWheel.js +17 -0
- package/dist/esm/hooks/useDisableInputWheel.js.map +1 -0
- package/dist/esm/hooks/useFormatCurrency.js +16 -0
- package/dist/esm/hooks/useFormatCurrency.js.map +1 -0
- package/dist/esm/hooks/useInputCurrency.js +130 -0
- package/dist/esm/hooks/useInputCurrency.js.map +1 -0
- package/dist/esm/hooks/useItemSelection.js +35 -0
- package/dist/esm/hooks/useItemSelection.js.map +1 -0
- package/dist/esm/hooks/useMediaBreakpointUp.js +69 -0
- package/dist/esm/hooks/useMediaBreakpointUp.js.map +1 -0
- package/dist/esm/hooks/useMediaQuery.js +11 -0
- package/dist/esm/hooks/useMediaQuery.js.map +1 -0
- package/dist/esm/hooks/useOtp.js +107 -0
- package/dist/esm/hooks/useOtp.js.map +1 -0
- package/dist/esm/hooks/usePortal.js +26 -0
- package/dist/esm/hooks/usePortal.js.map +1 -0
- package/dist/esm/hooks/useProvidedRefOrCreate.js +24 -0
- package/dist/esm/hooks/useProvidedRefOrCreate.js.map +1 -0
- package/dist/esm/hooks/useResponsiveProp.js +61 -0
- package/dist/esm/hooks/useResponsiveProp.js.map +1 -0
- package/dist/esm/hooks/useStackState.js +40 -0
- package/dist/esm/hooks/useStackState.js.map +1 -0
- package/dist/esm/icons/coreIcons.js +55 -0
- package/dist/esm/icons/coreIcons.js.map +1 -0
- package/dist/esm/index.js +99 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/utils/attr-accept.js +38 -0
- package/dist/esm/utils/attr-accept.js.map +1 -0
- package/dist/esm/utils/buildUrl.js +57 -0
- package/dist/esm/utils/buildUrl.js.map +1 -0
- package/dist/esm/utils/changeQueryString.js +19 -0
- package/dist/esm/utils/changeQueryString.js.map +1 -0
- package/dist/esm/utils/configureI18n.js +20 -0
- package/dist/esm/utils/configureI18n.js.map +1 -0
- package/dist/esm/utils/formatCurrency.js +8 -0
- package/dist/esm/utils/formatCurrency.js.map +1 -0
- package/dist/esm/utils/getCssVariable.js +7 -0
- package/dist/esm/utils/getCssVariable.js.map +1 -0
- package/dist/esm/utils/getKeyboardFocusableElements.js +11 -0
- package/dist/esm/utils/getKeyboardFocusableElements.js.map +1 -0
- package/dist/esm/utils/getQueryString.js +8 -0
- package/dist/esm/utils/getQueryString.js.map +1 -0
- package/dist/esm/utils/hasLabelContent.js +48 -0
- package/dist/esm/utils/hasLabelContent.js.map +1 -0
- package/dist/esm/utils/isTextLabel.js +23 -0
- package/dist/esm/utils/isTextLabel.js.map +1 -0
- package/dist/esm/utils/labelClickGuard.js +61 -0
- package/dist/esm/utils/labelClickGuard.js.map +1 -0
- package/dist/esm/utils/mediaQuery.js +13 -0
- package/dist/esm/utils/mediaQuery.js.map +1 -0
- package/dist/esm/utils/sanitizeHref.js +67 -0
- package/dist/esm/utils/sanitizeHref.js.map +1 -0
- package/dist/esm/utils/validatePhoneNumber.js +14 -0
- package/dist/esm/utils/validatePhoneNumber.js.map +1 -0
- package/dist/esm/utils/warnLabelUsage.js +57 -0
- package/dist/esm/utils/warnLabelUsage.js.map +1 -0
- package/dist/icons-core.json +33 -0
- package/dist/index.esm.js +1151 -184
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +1151 -182
- package/dist/index.js.map +1 -1
- package/dist/types/components/DAlert/DAlert.d.ts +16 -2
- package/dist/types/components/DButtonIcon/DButtonIcon.d.ts +9 -1
- package/dist/types/components/DButtonIcon/warnMissingAccessibleName.d.ts +18 -0
- package/dist/types/components/DDataStateWrapper/DDataStateWrapper.d.ts +29 -4
- package/dist/types/components/DDataStateWrapper/index.d.ts +1 -1
- package/dist/types/components/DErrorBoundary/DErrorBoundary.d.ts +6 -1
- package/dist/types/components/DErrorBoundary/components/DefaultErrorBoundary.d.ts +3 -1
- package/dist/types/components/DIcon/DIcon.d.ts +8 -0
- package/dist/types/components/DIconBase/DIconBase.d.ts +43 -1
- package/dist/types/components/DIconBase/resolveIconFromRegistry.d.ts +14 -0
- package/dist/types/components/DIconBase/warnUnknownIcon.d.ts +13 -0
- package/dist/types/components/DInput/DInput.d.ts +11 -2
- package/dist/types/components/DInputCheck/DInputCheck.d.ts +28 -3
- package/dist/types/components/DInputCounter/DInputCounter.d.ts +15 -3
- package/dist/types/components/DInputCurrency/DInputCurrency.d.ts +10 -3
- package/dist/types/components/DInputPhone/DInputPhone.d.ts +11 -2
- package/dist/types/components/DInputPin/DInputPin.d.ts +12 -2
- package/dist/types/components/DInputRange/DInputRange.d.ts +16 -3
- package/dist/types/components/DInputSelect/DInputSelect.d.ts +18 -3
- package/dist/types/components/DInputSwitch/DInputSwitch.d.ts +28 -3
- package/dist/types/components/DListGroup/DListGroup.d.ts +12 -1
- package/dist/types/components/DListGroup/ListGroupContext.d.ts +8 -0
- package/dist/types/components/DListGroup/components/DListGroupItem.d.ts +6 -1
- package/dist/types/components/DListGroup/components/warnInvalidListMarkup.d.ts +13 -0
- package/dist/types/components/DPasswordStrengthMeter/DPasswordStrengthMeter.d.ts +18 -3
- package/dist/types/components/DProgress/DProgress.d.ts +13 -1
- package/dist/types/components/DSelect/DSelect.d.ts +23 -3
- package/dist/types/components/DSelect/createAriaGuidance.d.ts +21 -0
- package/dist/types/components/DTabs/DTabs.d.ts +13 -2
- package/dist/types/components/DTabs/TabContext.d.ts +5 -0
- package/dist/types/components/DTabs/components/DTabsProvider.d.ts +11 -0
- package/dist/types/components/DTabs/index.d.ts +1 -0
- package/dist/types/components/DToast/DToast.d.ts +10 -3
- package/dist/types/components/DToastContainer/useDToast.d.ts +8 -1
- package/dist/types/components/config.d.ts +10 -0
- package/dist/types/components/index.d.ts +2 -2
- package/dist/types/components/interface.d.ts +7 -0
- package/dist/types/components/internal/DFormLabel.d.ts +30 -0
- package/dist/types/contexts/portal/DPortalStack.d.ts +13 -0
- package/dist/types/hooks/useControlledState.d.ts +17 -0
- package/dist/types/hooks/useInputCurrency.d.ts +26 -1
- package/dist/types/hooks/useMediaBreakpointUp.d.ts +10 -0
- package/dist/types/icons/coreIcons.d.ts +24 -0
- package/dist/types/icons/index.d.ts +2 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/utils/hasLabelContent.d.ts +30 -0
- package/dist/types/utils/isTextLabel.d.ts +17 -0
- package/dist/types/utils/labelClickGuard.d.ts +20 -0
- package/dist/types/utils/warnLabelUsage.d.ts +43 -0
- package/package.json +10 -5
- package/src/style/abstracts/variables/_body.scss +2 -2
- package/src/style/abstracts/variables/_chips.scss +2 -0
- package/src/style/abstracts/variables/_colors.scss +2 -2
- package/src/style/base/_buttons.scss +4 -1
- package/src/style/base/_input-group.scss +5 -2
- package/src/style/base/_list-group.scss +55 -0
- package/src/style/components/_d-chip.scss +7 -2
- package/src/style/components/_d-tabs.scss +3 -0
- package/src/style/helpers/_color-bg.scss +5 -0
- package/src/style/root/_root.scss +9 -0
- package/dist/types/components/DVoucher/hooks/useScreenshotDownload.spec.d.ts +0 -1
- package/dist/types/components/DVoucher/hooks/useScreenshotWebShare.spec.d.ts +0 -1
- package/dist/types/hooks/tests/useCountdown.spec.d.ts +0 -1
- package/dist/types/hooks/tests/useDisableBodyScrollEffect.spec.d.ts +0 -1
- package/dist/types/hooks/tests/useDisableInputWheel.spec.d.ts +0 -1
- package/dist/types/hooks/tests/useFormatCurrency.spec.d.ts +0 -1
- package/dist/types/hooks/tests/useInputCurrency.spec.d.ts +0 -1
- package/dist/types/hooks/tests/useItemSelection.spec.d.ts +0 -1
- package/dist/types/hooks/tests/useMediaBreakpointUp.spec.d.ts +0 -1
- package/dist/types/hooks/tests/useMediaQuery.spec.d.ts +0 -1
- package/dist/types/hooks/tests/usePortal.spec.d.ts +0 -1
- package/dist/types/hooks/tests/useProvidedRefOrCreate.spec.d.ts +0 -1
- package/dist/types/hooks/tests/useStackState.spec.d.ts +0 -1
- package/dist/types/utils/tests/attr-accept.spec.d.ts +0 -1
- package/dist/types/utils/tests/buildUrl.spec.d.ts +0 -1
- package/dist/types/utils/tests/changeQueryString.spec.d.ts +0 -1
- package/dist/types/utils/tests/configureI18n.spec.d.ts +0 -1
- package/dist/types/utils/tests/formatCurrency.spec.d.ts +0 -1
- package/dist/types/utils/tests/getCssVariable.spec.d.ts +0 -1
- package/dist/types/utils/tests/getKeyboardFocusableElements.spec.d.ts +0 -1
- package/dist/types/utils/tests/getQueryString.spec.d.ts +0 -1
- package/dist/types/utils/tests/mediaQuery.spec.d.ts +0 -1
- package/dist/types/utils/tests/sanitizeHref.spec.d.ts +0 -1
- package/dist/types/utils/tests/validatePhoneNumber.spec.d.ts +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useMediaBreakpointUp.js","sources":["../../../dist-transpiled/hooks/useMediaBreakpointUp.js"],"sourcesContent":["import { useMemo } from 'react';\nimport { useDContext } from '../contexts/DContext';\nimport { PREFIX_BS } from '../components/config';\nimport useMediaQuery from './useMediaQuery';\nconst BREAKPOINTS = ['xs', 'sm', 'md', 'lg', 'xl', 'xxl'];\n// Breakpoints read from the CSS on first use and shared by every component\n// that resolves responsive props: one computed-style read for the page,\n// instead of one per breakpoint per render. `dynamic-ui.css` has to be loaded\n// before rendering; if it isn't, the empty result is kept too, so a\n// misconfigured tree doesn't pay the read on every render (responsive props\n// then keep their default value and useResponsiveProp warns in development).\nlet cssBreakpoints = null;\nfunction readCssBreakpoint(breakpoint) {\n if (cssBreakpoints)\n return cssBreakpoints[breakpoint];\n if (typeof document === 'undefined')\n return '';\n const style = getComputedStyle(document.documentElement);\n const read = Object.fromEntries(BREAKPOINTS.map((name) => [\n name,\n style.getPropertyValue(`--${PREFIX_BS}breakpoint-${name}`).trim(),\n ]));\n cssBreakpoints = read;\n return read[breakpoint];\n}\n/** Clears the cached CSS breakpoints. Only meant for tests. */\nexport function resetCssBreakpointsCache() {\n cssBreakpoints = null;\n}\n/**\n * Pixel value of a breakpoint. `DContextProvider` reads them from the CSS and\n * shares them through the context; outside of it (a tree without the\n * provider, or its first render) they are read from the same CSS variables\n * here, so responsive props resolve either way.\n */\nexport function useBreakpointValue(breakpoint) {\n const { breakpoints } = useDContext();\n const fromContext = breakpoints[breakpoint];\n return useMemo(() => fromContext || readCssBreakpoint(breakpoint), [fromContext, breakpoint]);\n}\nfunction useMediaBreakpointUp(breakpoint, useListener = false) {\n const value = useBreakpointValue(breakpoint);\n // Without a breakpoint the query can't match; `not all` keeps it false\n // instead of an invalid `(min-width: )`.\n const mediaQuery = value ? `(min-width: ${value})` : 'not all';\n return useMediaQuery(mediaQuery, useListener);\n}\nexport function useMediaBreakpointUpXs(useListener = false) {\n return useMediaBreakpointUp('xs', useListener);\n}\nexport function useMediaBreakpointUpSm(useListener = false) {\n return useMediaBreakpointUp('sm', useListener);\n}\nexport function useMediaBreakpointUpMd(useListener = false) {\n return useMediaBreakpointUp('md', useListener);\n}\nexport function useMediaBreakpointUpLg(useListener = false) {\n return useMediaBreakpointUp('lg', useListener);\n}\nexport function useMediaBreakpointUpXl(useListener = false) {\n return useMediaBreakpointUp('xl', useListener);\n}\nexport function useMediaBreakpointUpXxl(useListener = false) {\n return useMediaBreakpointUp('xxl', useListener);\n}\n//# sourceMappingURL=useMediaBreakpointUp.js.map"],"names":[],"mappings":";;;;;AAIA,MAAM,WAAW,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,CAAC;AACzD;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,cAAc,GAAG,IAAI;AACzB,SAAS,iBAAiB,CAAC,UAAU,EAAE;AACvC,IAAI,IAAI,cAAc;AACtB,QAAQ,OAAO,cAAc,CAAC,UAAU,CAAC;AACzC,IAAI,IAAI,OAAO,QAAQ,KAAK,WAAW;AACvC,QAAQ,OAAO,EAAE;AACjB,IAAI,MAAM,KAAK,GAAG,gBAAgB,CAAC,QAAQ,CAAC,eAAe,CAAC;AAC5D,IAAI,MAAM,IAAI,GAAG,MAAM,CAAC,WAAW,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,IAAI,KAAK;AAC9D,QAAQ,IAAI;AACZ,QAAQ,KAAK,CAAC,gBAAgB,CAAC,CAAC,EAAE,EAAE,SAAS,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE;AACzE,KAAK,CAAC,CAAC;AACP,IAAI,cAAc,GAAG,IAAI;AACzB,IAAI,OAAO,IAAI,CAAC,UAAU,CAAC;AAC3B;AACA;AACO,SAAS,wBAAwB,GAAG;AAC3C,IAAI,cAAc,GAAG,IAAI;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,kBAAkB,CAAC,UAAU,EAAE;AAC/C,IAAI,MAAM,EAAE,WAAW,EAAE,GAAG,WAAW,EAAE;AACzC,IAAI,MAAM,WAAW,GAAG,WAAW,CAAC,UAAU,CAAC;AAC/C,IAAI,OAAO,OAAO,CAAC,MAAM,WAAW,IAAI,iBAAiB,CAAC,UAAU,CAAC,EAAE,CAAC,WAAW,EAAE,UAAU,CAAC,CAAC;AACjG;AACA,SAAS,oBAAoB,CAAC,UAAU,EAAE,WAAW,GAAG,KAAK,EAAE;AAC/D,IAAI,MAAM,KAAK,GAAG,kBAAkB,CAAC,UAAU,CAAC;AAChD;AACA;AACA,IAAI,MAAM,UAAU,GAAG,KAAK,GAAG,CAAC,YAAY,EAAE,KAAK,CAAC,CAAC,CAAC,GAAG,SAAS;AAClE,IAAI,OAAO,aAAa,CAAC,UAAU,EAAE,WAAW,CAAC;AACjD;AACO,SAAS,sBAAsB,CAAC,WAAW,GAAG,KAAK,EAAE;AAC5D,IAAI,OAAO,oBAAoB,CAAC,IAAI,EAAE,WAAW,CAAC;AAClD;AACO,SAAS,sBAAsB,CAAC,WAAW,GAAG,KAAK,EAAE;AAC5D,IAAI,OAAO,oBAAoB,CAAC,IAAI,EAAE,WAAW,CAAC;AAClD;AACO,SAAS,sBAAsB,CAAC,WAAW,GAAG,KAAK,EAAE;AAC5D,IAAI,OAAO,oBAAoB,CAAC,IAAI,EAAE,WAAW,CAAC;AAClD;AACO,SAAS,sBAAsB,CAAC,WAAW,GAAG,KAAK,EAAE;AAC5D,IAAI,OAAO,oBAAoB,CAAC,IAAI,EAAE,WAAW,CAAC;AAClD;AACO,SAAS,sBAAsB,CAAC,WAAW,GAAG,KAAK,EAAE;AAC5D,IAAI,OAAO,oBAAoB,CAAC,IAAI,EAAE,WAAW,CAAC;AAClD;AACO,SAAS,uBAAuB,CAAC,WAAW,GAAG,KAAK,EAAE;AAC7D,IAAI,OAAO,oBAAoB,CAAC,KAAK,EAAE,WAAW,CAAC;AACnD;;;;"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { useSyncExternalStore } from 'react';
|
|
2
|
+
import { subscribeToMediaQuery, checkMediaQuery } from '../utils/mediaQuery.js';
|
|
3
|
+
|
|
4
|
+
function useMediaQuery(mediaQuery, useListener = false) {
|
|
5
|
+
/* eslint-disable-next-line @typescript-eslint/no-unused-vars */
|
|
6
|
+
const noop = (_) => () => { };
|
|
7
|
+
return useSyncExternalStore(useListener ? (cb) => subscribeToMediaQuery(mediaQuery, cb) : noop, () => (mediaQuery ? checkMediaQuery(mediaQuery) : true), () => false);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export { useMediaQuery as default };
|
|
11
|
+
//# sourceMappingURL=useMediaQuery.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useMediaQuery.js","sources":["../../../dist-transpiled/hooks/useMediaQuery.js"],"sourcesContent":["import { useSyncExternalStore } from 'react';\nimport { subscribeToMediaQuery, checkMediaQuery } from '../utils/mediaQuery';\nexport default function useMediaQuery(mediaQuery, useListener = false) {\n /* eslint-disable-next-line @typescript-eslint/no-unused-vars */\n const noop = (_) => () => { };\n return useSyncExternalStore(useListener ? (cb) => subscribeToMediaQuery(mediaQuery, cb) : noop, () => (mediaQuery ? checkMediaQuery(mediaQuery) : true), () => false);\n}\n//# sourceMappingURL=useMediaQuery.js.map"],"names":[],"mappings":";;;AAEe,SAAS,aAAa,CAAC,UAAU,EAAE,WAAW,GAAG,KAAK,EAAE;AACvE;AACA,IAAI,MAAM,IAAI,GAAG,CAAC,CAAC,KAAK,MAAM,EAAE,CAAC;AACjC,IAAI,OAAO,oBAAoB,CAAC,WAAW,GAAG,CAAC,EAAE,KAAK,qBAAqB,CAAC,UAAU,EAAE,EAAE,CAAC,GAAG,IAAI,EAAE,OAAO,UAAU,GAAG,eAAe,CAAC,UAAU,CAAC,GAAG,IAAI,CAAC,EAAE,MAAM,KAAK,CAAC;AACzK;;;;"}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { useState, useCallback } from 'react';
|
|
2
|
+
import useCountdown from './useCountdown.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Headless hook exposing the same OTP logic used internally by `DOtp`
|
|
6
|
+
* (code state, length + correctness validation, submit action and resend
|
|
7
|
+
* countdown), without any bundled markup/styles.
|
|
8
|
+
*
|
|
9
|
+
* Use this when the default `DOtp` component doesn't match your design and
|
|
10
|
+
* you need to build a fully custom UI while reusing the same behavior.
|
|
11
|
+
*
|
|
12
|
+
* Internally composes `useCountdown` for the resend timer and re-exposes
|
|
13
|
+
* `secondsLeft`/`restartCountdown`, so there is no need to call
|
|
14
|
+
* `useCountdown` separately.
|
|
15
|
+
*
|
|
16
|
+
* `invalid` becomes `true` both when the OTP is shorter than `otpSize` and
|
|
17
|
+
* when `action` throws/rejects (e.g. the backend rejected the entered code
|
|
18
|
+
* as incorrect). In the latter case, the thrown value is exposed as `error`
|
|
19
|
+
* so custom UIs can render an appropriate message (e.g. "Invalid code" vs.
|
|
20
|
+
* "Enter all digits"). `invalid`/`error` are cleared automatically as soon
|
|
21
|
+
* as the user edits the code via `setOtp`.
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* function CustomOtp() {
|
|
25
|
+
* const {
|
|
26
|
+
* otp,
|
|
27
|
+
* setOtp,
|
|
28
|
+
* invalid,
|
|
29
|
+
* error,
|
|
30
|
+
* submit,
|
|
31
|
+
* isLoading,
|
|
32
|
+
* secondsLeft,
|
|
33
|
+
* restartCountdown,
|
|
34
|
+
* } = useOtp({ action: async () => verifyOtp(otp), otpSize: 6, seconds: 15 });
|
|
35
|
+
*
|
|
36
|
+
* return (
|
|
37
|
+
* <>
|
|
38
|
+
* <MyCustomPinInput value={otp} onChange={setOtp} invalid={invalid} />
|
|
39
|
+
* {invalid && <span>{error ? 'Invalid code' : 'Enter all digits'}</span>}
|
|
40
|
+
* <button disabled={isLoading} onClick={() => { submit().catch(() => {}); }}>
|
|
41
|
+
* {isLoading ? 'Submitting...' : 'Submit'}
|
|
42
|
+
* </button>
|
|
43
|
+
* <button disabled={secondsLeft > 0} onClick={restartCountdown}>
|
|
44
|
+
* Resend {secondsLeft > 0 ? `(${secondsLeft}s)` : ''}
|
|
45
|
+
* </button>
|
|
46
|
+
* </>
|
|
47
|
+
* );
|
|
48
|
+
* }
|
|
49
|
+
*/
|
|
50
|
+
function useOtp({ action, otpSize = 6, seconds = 15, }) {
|
|
51
|
+
const [otp, setOtpValue] = useState('');
|
|
52
|
+
const [invalid, setInvalid] = useState(false);
|
|
53
|
+
const [error, setError] = useState(null);
|
|
54
|
+
const [isLoading, setIsLoading] = useState(false);
|
|
55
|
+
const { secondsLeft, restartCountdown } = useCountdown(seconds);
|
|
56
|
+
const setOtp = useCallback((value) => {
|
|
57
|
+
setOtpValue((prevOtp) => {
|
|
58
|
+
// Guard against no-op calls (e.g. DInputPin re-notifying the same
|
|
59
|
+
// value when its onChange reference changes) so we don't wipe out
|
|
60
|
+
// an `invalid`/`error` state that was just set by submit().
|
|
61
|
+
if (prevOtp === value) {
|
|
62
|
+
return prevOtp;
|
|
63
|
+
}
|
|
64
|
+
setInvalid(false);
|
|
65
|
+
setError(null);
|
|
66
|
+
return value;
|
|
67
|
+
});
|
|
68
|
+
}, []);
|
|
69
|
+
const submit = useCallback(async () => {
|
|
70
|
+
if (otp.length < otpSize) {
|
|
71
|
+
setInvalid(true);
|
|
72
|
+
setError(null);
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
setIsLoading(true);
|
|
76
|
+
try {
|
|
77
|
+
await action();
|
|
78
|
+
setInvalid(false);
|
|
79
|
+
setError(null);
|
|
80
|
+
}
|
|
81
|
+
catch (err) {
|
|
82
|
+
setInvalid(true);
|
|
83
|
+
setError(err);
|
|
84
|
+
throw err;
|
|
85
|
+
}
|
|
86
|
+
finally {
|
|
87
|
+
setIsLoading(false);
|
|
88
|
+
}
|
|
89
|
+
}, [
|
|
90
|
+
otp.length,
|
|
91
|
+
action,
|
|
92
|
+
otpSize,
|
|
93
|
+
]);
|
|
94
|
+
return {
|
|
95
|
+
otp,
|
|
96
|
+
setOtp,
|
|
97
|
+
invalid,
|
|
98
|
+
error,
|
|
99
|
+
submit,
|
|
100
|
+
isLoading,
|
|
101
|
+
secondsLeft,
|
|
102
|
+
restartCountdown,
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
export { useOtp as default };
|
|
107
|
+
//# sourceMappingURL=useOtp.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useOtp.js","sources":["../../../dist-transpiled/hooks/useOtp.js"],"sourcesContent":["import { useCallback, useState } from 'react';\nimport useCountdown from './useCountdown';\n/**\n * Headless hook exposing the same OTP logic used internally by `DOtp`\n * (code state, length + correctness validation, submit action and resend\n * countdown), without any bundled markup/styles.\n *\n * Use this when the default `DOtp` component doesn't match your design and\n * you need to build a fully custom UI while reusing the same behavior.\n *\n * Internally composes `useCountdown` for the resend timer and re-exposes\n * `secondsLeft`/`restartCountdown`, so there is no need to call\n * `useCountdown` separately.\n *\n * `invalid` becomes `true` both when the OTP is shorter than `otpSize` and\n * when `action` throws/rejects (e.g. the backend rejected the entered code\n * as incorrect). In the latter case, the thrown value is exposed as `error`\n * so custom UIs can render an appropriate message (e.g. \"Invalid code\" vs.\n * \"Enter all digits\"). `invalid`/`error` are cleared automatically as soon\n * as the user edits the code via `setOtp`.\n *\n * @example\n * function CustomOtp() {\n * const {\n * otp,\n * setOtp,\n * invalid,\n * error,\n * submit,\n * isLoading,\n * secondsLeft,\n * restartCountdown,\n * } = useOtp({ action: async () => verifyOtp(otp), otpSize: 6, seconds: 15 });\n *\n * return (\n * <>\n * <MyCustomPinInput value={otp} onChange={setOtp} invalid={invalid} />\n * {invalid && <span>{error ? 'Invalid code' : 'Enter all digits'}</span>}\n * <button disabled={isLoading} onClick={() => { submit().catch(() => {}); }}>\n * {isLoading ? 'Submitting...' : 'Submit'}\n * </button>\n * <button disabled={secondsLeft > 0} onClick={restartCountdown}>\n * Resend {secondsLeft > 0 ? `(${secondsLeft}s)` : ''}\n * </button>\n * </>\n * );\n * }\n */\nexport default function useOtp({ action, otpSize = 6, seconds = 15, }) {\n const [otp, setOtpValue] = useState('');\n const [invalid, setInvalid] = useState(false);\n const [error, setError] = useState(null);\n const [isLoading, setIsLoading] = useState(false);\n const { secondsLeft, restartCountdown } = useCountdown(seconds);\n const setOtp = useCallback((value) => {\n setOtpValue((prevOtp) => {\n // Guard against no-op calls (e.g. DInputPin re-notifying the same\n // value when its onChange reference changes) so we don't wipe out\n // an `invalid`/`error` state that was just set by submit().\n if (prevOtp === value) {\n return prevOtp;\n }\n setInvalid(false);\n setError(null);\n return value;\n });\n }, []);\n const submit = useCallback(async () => {\n if (otp.length < otpSize) {\n setInvalid(true);\n setError(null);\n return;\n }\n setIsLoading(true);\n try {\n await action();\n setInvalid(false);\n setError(null);\n }\n catch (err) {\n setInvalid(true);\n setError(err);\n throw err;\n }\n finally {\n setIsLoading(false);\n }\n }, [\n otp.length,\n action,\n otpSize,\n ]);\n return {\n otp,\n setOtp,\n invalid,\n error,\n submit,\n isLoading,\n secondsLeft,\n restartCountdown,\n };\n}\n//# sourceMappingURL=useOtp.js.map"],"names":[],"mappings":";;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAAS,MAAM,CAAC,EAAE,MAAM,EAAE,OAAO,GAAG,CAAC,EAAE,OAAO,GAAG,EAAE,GAAG,EAAE;AACvE,IAAI,MAAM,CAAC,GAAG,EAAE,WAAW,CAAC,GAAG,QAAQ,CAAC,EAAE,CAAC;AAC3C,IAAI,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC;AACjD,IAAI,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAC,IAAI,CAAC;AAC5C,IAAI,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC;AACrD,IAAI,MAAM,EAAE,WAAW,EAAE,gBAAgB,EAAE,GAAG,YAAY,CAAC,OAAO,CAAC;AACnE,IAAI,MAAM,MAAM,GAAG,WAAW,CAAC,CAAC,KAAK,KAAK;AAC1C,QAAQ,WAAW,CAAC,CAAC,OAAO,KAAK;AACjC;AACA;AACA;AACA,YAAY,IAAI,OAAO,KAAK,KAAK,EAAE;AACnC,gBAAgB,OAAO,OAAO;AAC9B,YAAY;AACZ,YAAY,UAAU,CAAC,KAAK,CAAC;AAC7B,YAAY,QAAQ,CAAC,IAAI,CAAC;AAC1B,YAAY,OAAO,KAAK;AACxB,QAAQ,CAAC,CAAC;AACV,IAAI,CAAC,EAAE,EAAE,CAAC;AACV,IAAI,MAAM,MAAM,GAAG,WAAW,CAAC,YAAY;AAC3C,QAAQ,IAAI,GAAG,CAAC,MAAM,GAAG,OAAO,EAAE;AAClC,YAAY,UAAU,CAAC,IAAI,CAAC;AAC5B,YAAY,QAAQ,CAAC,IAAI,CAAC;AAC1B,YAAY;AACZ,QAAQ;AACR,QAAQ,YAAY,CAAC,IAAI,CAAC;AAC1B,QAAQ,IAAI;AACZ,YAAY,MAAM,MAAM,EAAE;AAC1B,YAAY,UAAU,CAAC,KAAK,CAAC;AAC7B,YAAY,QAAQ,CAAC,IAAI,CAAC;AAC1B,QAAQ;AACR,QAAQ,OAAO,GAAG,EAAE;AACpB,YAAY,UAAU,CAAC,IAAI,CAAC;AAC5B,YAAY,QAAQ,CAAC,GAAG,CAAC;AACzB,YAAY,MAAM,GAAG;AACrB,QAAQ;AACR,gBAAgB;AAChB,YAAY,YAAY,CAAC,KAAK,CAAC;AAC/B,QAAQ;AACR,IAAI,CAAC,EAAE;AACP,QAAQ,GAAG,CAAC,MAAM;AAClB,QAAQ,MAAM;AACd,QAAQ,OAAO;AACf,KAAK,CAAC;AACN,IAAI,OAAO;AACX,QAAQ,GAAG;AACX,QAAQ,MAAM;AACd,QAAQ,OAAO;AACf,QAAQ,KAAK;AACb,QAAQ,MAAM;AACd,QAAQ,SAAS;AACjB,QAAQ,WAAW;AACnB,QAAQ,gBAAgB;AACxB,KAAK;AACL;;;;"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { useState, useEffect } from 'react';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @internal
|
|
5
|
+
* Creates a DOM `<div>` portal mount point and appends it to `document.body`.
|
|
6
|
+
* This hook is used exclusively by `DPortalContextProvider` and is **not** part
|
|
7
|
+
* of the public API. Use `useDPortalContext` instead.
|
|
8
|
+
*/
|
|
9
|
+
function usePortal(portalName) {
|
|
10
|
+
const [hasPortal, setHasPortal] = useState(false);
|
|
11
|
+
useEffect(() => {
|
|
12
|
+
const previousPortal = document.querySelector(`#${portalName}`);
|
|
13
|
+
if (previousPortal) {
|
|
14
|
+
previousPortal.remove();
|
|
15
|
+
}
|
|
16
|
+
const portal = document.createElement('div');
|
|
17
|
+
portal.id = portalName;
|
|
18
|
+
portal.className = 'd-portal';
|
|
19
|
+
document.body.appendChild(portal);
|
|
20
|
+
setHasPortal(true);
|
|
21
|
+
}, [portalName]);
|
|
22
|
+
return { created: hasPortal };
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export { usePortal as default };
|
|
26
|
+
//# sourceMappingURL=usePortal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"usePortal.js","sources":["../../../dist-transpiled/hooks/usePortal.js"],"sourcesContent":["import { useEffect, useState } from 'react';\n/**\n * @internal\n * Creates a DOM `<div>` portal mount point and appends it to `document.body`.\n * This hook is used exclusively by `DPortalContextProvider` and is **not** part\n * of the public API. Use `useDPortalContext` instead.\n */\nexport default function usePortal(portalName) {\n const [hasPortal, setHasPortal] = useState(false);\n useEffect(() => {\n const previousPortal = document.querySelector(`#${portalName}`);\n if (previousPortal) {\n previousPortal.remove();\n }\n const portal = document.createElement('div');\n portal.id = portalName;\n portal.className = 'd-portal';\n document.body.appendChild(portal);\n setHasPortal(true);\n }, [portalName]);\n return { created: hasPortal };\n}\n//# sourceMappingURL=usePortal.js.map"],"names":[],"mappings":";;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAAS,SAAS,CAAC,UAAU,EAAE;AAC9C,IAAI,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC;AACrD,IAAI,SAAS,CAAC,MAAM;AACpB,QAAQ,MAAM,cAAc,GAAG,QAAQ,CAAC,aAAa,CAAC,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC,CAAC;AACvE,QAAQ,IAAI,cAAc,EAAE;AAC5B,YAAY,cAAc,CAAC,MAAM,EAAE;AACnC,QAAQ;AACR,QAAQ,MAAM,MAAM,GAAG,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC;AACpD,QAAQ,MAAM,CAAC,EAAE,GAAG,UAAU;AAC9B,QAAQ,MAAM,CAAC,SAAS,GAAG,UAAU;AACrC,QAAQ,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC;AACzC,QAAQ,YAAY,CAAC,IAAI,CAAC;AAC1B,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,CAAC;AACpB,IAAI,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE;AACjC;;;;"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
/* eslint-disable */
|
|
4
|
+
/**
|
|
5
|
+
* This file is originally from `@primer/react`
|
|
6
|
+
* The original source for this lived in the URL below.
|
|
7
|
+
*
|
|
8
|
+
* @see https://github.com/primer/react/blob/216d2a9f57b8acb0701ab4e04a23e057fc325c90/src/hooks/useProvidedRefOrCreate.ts
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* There are some situations where we only want to create a new ref if one is not provided to a component
|
|
12
|
+
* or hook as a prop. However, due to the `rules-of-hooks`, we cannot conditionally make a call to `React.useRef`
|
|
13
|
+
* only in the situations where the ref is not provided as a prop.
|
|
14
|
+
* This hook aims to encapsulate that logic, so the consumer doesn't need to be concerned with violating `rules-of-hooks`.
|
|
15
|
+
* @param providedRef The ref to use - if undefined, will use the ref from a call to React.useRef
|
|
16
|
+
* @type TRef The type of the RefObject which should be created.
|
|
17
|
+
*/
|
|
18
|
+
function useProvidedRefOrCreate(providedRef) {
|
|
19
|
+
const createdRef = React.useRef(null);
|
|
20
|
+
return providedRef !== null && providedRef !== void 0 ? providedRef : createdRef;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export { useProvidedRefOrCreate as default };
|
|
24
|
+
//# sourceMappingURL=useProvidedRefOrCreate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useProvidedRefOrCreate.js","sources":["../../../dist-transpiled/hooks/useProvidedRefOrCreate.js"],"sourcesContent":["/* eslint-disable */\n/**\n * This file is originally from `@primer/react`\n * The original source for this lived in the URL below.\n *\n * @see https://github.com/primer/react/blob/216d2a9f57b8acb0701ab4e04a23e057fc325c90/src/hooks/useProvidedRefOrCreate.ts\n */\nimport React from 'react';\n/**\n * There are some situations where we only want to create a new ref if one is not provided to a component\n * or hook as a prop. However, due to the `rules-of-hooks`, we cannot conditionally make a call to `React.useRef`\n * only in the situations where the ref is not provided as a prop.\n * This hook aims to encapsulate that logic, so the consumer doesn't need to be concerned with violating `rules-of-hooks`.\n * @param providedRef The ref to use - if undefined, will use the ref from a call to React.useRef\n * @type TRef The type of the RefObject which should be created.\n */\nexport default function useProvidedRefOrCreate(providedRef) {\n const createdRef = React.useRef(null);\n return providedRef !== null && providedRef !== void 0 ? providedRef : createdRef;\n}\n//# sourceMappingURL=useProvidedRefOrCreate.js.map"],"names":[],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAAS,sBAAsB,CAAC,WAAW,EAAE;AAC5D,IAAI,MAAM,UAAU,GAAG,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC;AACzC,IAAI,OAAO,WAAW,KAAK,IAAI,IAAI,WAAW,KAAK,MAAM,GAAG,WAAW,GAAG,UAAU;AACpF;;;;"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { useCallback } from 'react';
|
|
2
|
+
import { PREFIX_BS } from '../components/config.js';
|
|
3
|
+
import { useMediaBreakpointUpXs, useMediaBreakpointUpSm, useMediaBreakpointUpMd, useMediaBreakpointUpLg, useMediaBreakpointUpXl, useMediaBreakpointUpXxl, useBreakpointValue } from './useMediaBreakpointUp.js';
|
|
4
|
+
|
|
5
|
+
let warnedMissingBreakpoints = false;
|
|
6
|
+
/**
|
|
7
|
+
* React hook to resolve a responsive property value based on the current viewport breakpoint.
|
|
8
|
+
*
|
|
9
|
+
* Given a `ResponsiveProp` object, this hook returns the value for the highest matching breakpoint.
|
|
10
|
+
* If multiple breakpoints match, the value for the largest (highest) breakpoint is used.
|
|
11
|
+
* If no breakpoints match, `undefined` is returned.
|
|
12
|
+
*
|
|
13
|
+
* @param useListener - Whether to listen for breakpoint changes (default: false).
|
|
14
|
+
* @returns An object with a `responsivePropValue` function that takes a
|
|
15
|
+
* `ResponsiveProp` and returns the resolved value.
|
|
16
|
+
*
|
|
17
|
+
* Usage example:
|
|
18
|
+
* ```ts
|
|
19
|
+
* const { responsivePropValue } = useResponsiveProp();
|
|
20
|
+
* const value = responsivePropValue({ xs: "A", md: "B", xl: "C" });
|
|
21
|
+
* // value will be "C" if xl breakpoint is active, "B" if md is active, etc.
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
function useResponsiveProp(useListener = false) {
|
|
25
|
+
const bpXsUp = useMediaBreakpointUpXs(useListener);
|
|
26
|
+
const bpSmUp = useMediaBreakpointUpSm(useListener);
|
|
27
|
+
const bpMdUp = useMediaBreakpointUpMd(useListener);
|
|
28
|
+
const bpLgUp = useMediaBreakpointUpLg(useListener);
|
|
29
|
+
const bpXlUp = useMediaBreakpointUpXl(useListener);
|
|
30
|
+
const bpXxlUp = useMediaBreakpointUpXxl(useListener);
|
|
31
|
+
// `xs` is `0` and can't tell a missing variable apart, so `sm` is checked.
|
|
32
|
+
const hasBreakpoints = !!useBreakpointValue('sm');
|
|
33
|
+
const responsivePropValue = useCallback((prop) => {
|
|
34
|
+
if (process.env.NODE_ENV !== 'production' && !hasBreakpoints && !warnedMissingBreakpoints) {
|
|
35
|
+
warnedMissingBreakpoints = true;
|
|
36
|
+
// eslint-disable-next-line no-console
|
|
37
|
+
console.warn(`[Dynamic UI] The --${PREFIX_BS}breakpoint-* CSS variables are not available, so a `
|
|
38
|
+
+ 'responsive prop (an object by breakpoint) falls back to its default value. Load '
|
|
39
|
+
+ 'dynamic-ui.css before rendering. It never appears in production builds.');
|
|
40
|
+
}
|
|
41
|
+
// Pick the highest matched breakpoint value that is defined in prop
|
|
42
|
+
if (prop.xxl !== undefined && bpXxlUp)
|
|
43
|
+
return prop.xxl;
|
|
44
|
+
if (prop.xl !== undefined && bpXlUp)
|
|
45
|
+
return prop.xl;
|
|
46
|
+
if (prop.lg !== undefined && bpLgUp)
|
|
47
|
+
return prop.lg;
|
|
48
|
+
if (prop.md !== undefined && bpMdUp)
|
|
49
|
+
return prop.md;
|
|
50
|
+
if (prop.sm !== undefined && bpSmUp)
|
|
51
|
+
return prop.sm;
|
|
52
|
+
if (prop.xs !== undefined && bpXsUp)
|
|
53
|
+
return prop.xs;
|
|
54
|
+
// Fallback: return undefined if no breakpoint matches
|
|
55
|
+
return undefined;
|
|
56
|
+
}, [bpSmUp, bpMdUp, bpLgUp, bpXlUp, bpXxlUp, bpXsUp, hasBreakpoints]);
|
|
57
|
+
return { responsivePropValue };
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export { useResponsiveProp };
|
|
61
|
+
//# sourceMappingURL=useResponsiveProp.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useResponsiveProp.js","sources":["../../../dist-transpiled/hooks/useResponsiveProp.js"],"sourcesContent":["import { useCallback } from 'react';\nimport { PREFIX_BS } from '../components/config';\nimport { useBreakpointValue, useMediaBreakpointUpLg, useMediaBreakpointUpMd, useMediaBreakpointUpSm, useMediaBreakpointUpXl, useMediaBreakpointUpXs, useMediaBreakpointUpXxl, } from './useMediaBreakpointUp';\nlet warnedMissingBreakpoints = false;\n/**\n * React hook to resolve a responsive property value based on the current viewport breakpoint.\n *\n * Given a `ResponsiveProp` object, this hook returns the value for the highest matching breakpoint.\n * If multiple breakpoints match, the value for the largest (highest) breakpoint is used.\n * If no breakpoints match, `undefined` is returned.\n *\n * @param useListener - Whether to listen for breakpoint changes (default: false).\n * @returns An object with a `responsivePropValue` function that takes a\n * `ResponsiveProp` and returns the resolved value.\n *\n * Usage example:\n * ```ts\n * const { responsivePropValue } = useResponsiveProp();\n * const value = responsivePropValue({ xs: \"A\", md: \"B\", xl: \"C\" });\n * // value will be \"C\" if xl breakpoint is active, \"B\" if md is active, etc.\n * ```\n */\nexport function useResponsiveProp(useListener = false) {\n const bpXsUp = useMediaBreakpointUpXs(useListener);\n const bpSmUp = useMediaBreakpointUpSm(useListener);\n const bpMdUp = useMediaBreakpointUpMd(useListener);\n const bpLgUp = useMediaBreakpointUpLg(useListener);\n const bpXlUp = useMediaBreakpointUpXl(useListener);\n const bpXxlUp = useMediaBreakpointUpXxl(useListener);\n // `xs` is `0` and can't tell a missing variable apart, so `sm` is checked.\n const hasBreakpoints = !!useBreakpointValue('sm');\n const responsivePropValue = useCallback((prop) => {\n if (process.env.NODE_ENV !== 'production' && !hasBreakpoints && !warnedMissingBreakpoints) {\n warnedMissingBreakpoints = true;\n // eslint-disable-next-line no-console\n console.warn(`[Dynamic UI] The --${PREFIX_BS}breakpoint-* CSS variables are not available, so a `\n + 'responsive prop (an object by breakpoint) falls back to its default value. Load '\n + 'dynamic-ui.css before rendering. It never appears in production builds.');\n }\n // Pick the highest matched breakpoint value that is defined in prop\n if (prop.xxl !== undefined && bpXxlUp)\n return prop.xxl;\n if (prop.xl !== undefined && bpXlUp)\n return prop.xl;\n if (prop.lg !== undefined && bpLgUp)\n return prop.lg;\n if (prop.md !== undefined && bpMdUp)\n return prop.md;\n if (prop.sm !== undefined && bpSmUp)\n return prop.sm;\n if (prop.xs !== undefined && bpXsUp)\n return prop.xs;\n // Fallback: return undefined if no breakpoint matches\n return undefined;\n }, [bpSmUp, bpMdUp, bpLgUp, bpXlUp, bpXxlUp, bpXsUp, hasBreakpoints]);\n return { responsivePropValue };\n}\n//# sourceMappingURL=useResponsiveProp.js.map"],"names":[],"mappings":";;;;AAGA,IAAI,wBAAwB,GAAG,KAAK;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,iBAAiB,CAAC,WAAW,GAAG,KAAK,EAAE;AACvD,IAAI,MAAM,MAAM,GAAG,sBAAsB,CAAC,WAAW,CAAC;AACtD,IAAI,MAAM,MAAM,GAAG,sBAAsB,CAAC,WAAW,CAAC;AACtD,IAAI,MAAM,MAAM,GAAG,sBAAsB,CAAC,WAAW,CAAC;AACtD,IAAI,MAAM,MAAM,GAAG,sBAAsB,CAAC,WAAW,CAAC;AACtD,IAAI,MAAM,MAAM,GAAG,sBAAsB,CAAC,WAAW,CAAC;AACtD,IAAI,MAAM,OAAO,GAAG,uBAAuB,CAAC,WAAW,CAAC;AACxD;AACA,IAAI,MAAM,cAAc,GAAG,CAAC,CAAC,kBAAkB,CAAC,IAAI,CAAC;AACrD,IAAI,MAAM,mBAAmB,GAAG,WAAW,CAAC,CAAC,IAAI,KAAK;AACtD,QAAQ,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY,IAAI,CAAC,cAAc,IAAI,CAAC,wBAAwB,EAAE;AACnG,YAAY,wBAAwB,GAAG,IAAI;AAC3C;AACA,YAAY,OAAO,CAAC,IAAI,CAAC,CAAC,mBAAmB,EAAE,SAAS,CAAC,mDAAmD;AAC5G,kBAAkB;AAClB,kBAAkB,yEAAyE,CAAC;AAC5F,QAAQ;AACR;AACA,QAAQ,IAAI,IAAI,CAAC,GAAG,KAAK,SAAS,IAAI,OAAO;AAC7C,YAAY,OAAO,IAAI,CAAC,GAAG;AAC3B,QAAQ,IAAI,IAAI,CAAC,EAAE,KAAK,SAAS,IAAI,MAAM;AAC3C,YAAY,OAAO,IAAI,CAAC,EAAE;AAC1B,QAAQ,IAAI,IAAI,CAAC,EAAE,KAAK,SAAS,IAAI,MAAM;AAC3C,YAAY,OAAO,IAAI,CAAC,EAAE;AAC1B,QAAQ,IAAI,IAAI,CAAC,EAAE,KAAK,SAAS,IAAI,MAAM;AAC3C,YAAY,OAAO,IAAI,CAAC,EAAE;AAC1B,QAAQ,IAAI,IAAI,CAAC,EAAE,KAAK,SAAS,IAAI,MAAM;AAC3C,YAAY,OAAO,IAAI,CAAC,EAAE;AAC1B,QAAQ,IAAI,IAAI,CAAC,EAAE,KAAK,SAAS,IAAI,MAAM;AAC3C,YAAY,OAAO,IAAI,CAAC,EAAE;AAC1B;AACA,QAAQ,OAAO,SAAS;AACxB,IAAI,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,cAAc,CAAC,CAAC;AACzE,IAAI,OAAO,EAAE,mBAAmB,EAAE;AAClC;;;;"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { useState, useCallback, useMemo } from 'react';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* useStackState inspired from rooks
|
|
5
|
+
* @see https://github.com/imbhargav5/rooks/blob/main/packages/rooks/src/hooks/useStackState.ts
|
|
6
|
+
* @description Manages a stack with react hooks.
|
|
7
|
+
* @param initialList Initial value of the list
|
|
8
|
+
* @returns The list and controls to modify the stack
|
|
9
|
+
* @see https://react-hooks.org/docs/useStackState
|
|
10
|
+
*/
|
|
11
|
+
function useStackState(initialList = []) {
|
|
12
|
+
const [list, setList] = useState(initialList);
|
|
13
|
+
const push = useCallback((item) => (setList((prevList) => [
|
|
14
|
+
...prevList,
|
|
15
|
+
item,
|
|
16
|
+
])), []);
|
|
17
|
+
const pop = useCallback(() => (setList((prevList) => (prevList.slice(0, prevList.length - 1)))), []);
|
|
18
|
+
const peek = useCallback(() => list.at(-1), [list]);
|
|
19
|
+
const clear = useCallback(() => setList([]), []);
|
|
20
|
+
const isEmpty = useCallback(() => list.length === 0, [list.length]);
|
|
21
|
+
const controls = useMemo(() => ({
|
|
22
|
+
clear,
|
|
23
|
+
isEmpty,
|
|
24
|
+
length: list.length,
|
|
25
|
+
peek,
|
|
26
|
+
pop,
|
|
27
|
+
push,
|
|
28
|
+
}), [
|
|
29
|
+
clear,
|
|
30
|
+
isEmpty,
|
|
31
|
+
list.length,
|
|
32
|
+
peek,
|
|
33
|
+
pop,
|
|
34
|
+
push,
|
|
35
|
+
]);
|
|
36
|
+
return [list, controls];
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export { useStackState as default };
|
|
40
|
+
//# sourceMappingURL=useStackState.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useStackState.js","sources":["../../../dist-transpiled/hooks/useStackState.js"],"sourcesContent":["import { useCallback, useMemo, useState } from 'react';\n/**\n * useStackState inspired from rooks\n * @see https://github.com/imbhargav5/rooks/blob/main/packages/rooks/src/hooks/useStackState.ts\n * @description Manages a stack with react hooks.\n * @param initialList Initial value of the list\n * @returns The list and controls to modify the stack\n * @see https://react-hooks.org/docs/useStackState\n */\nexport default function useStackState(initialList = []) {\n const [list, setList] = useState(initialList);\n const push = useCallback((item) => (setList((prevList) => [\n ...prevList,\n item,\n ])), []);\n const pop = useCallback(() => (setList((prevList) => (prevList.slice(0, prevList.length - 1)))), []);\n const peek = useCallback(() => list.at(-1), [list]);\n const clear = useCallback(() => setList([]), []);\n const isEmpty = useCallback(() => list.length === 0, [list.length]);\n const controls = useMemo(() => ({\n clear,\n isEmpty,\n length: list.length,\n peek,\n pop,\n push,\n }), [\n clear,\n isEmpty,\n list.length,\n peek,\n pop,\n push,\n ]);\n return [list, controls];\n}\n//# sourceMappingURL=useStackState.js.map"],"names":[],"mappings":";;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAAS,aAAa,CAAC,WAAW,GAAG,EAAE,EAAE;AACxD,IAAI,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,QAAQ,CAAC,WAAW,CAAC;AACjD,IAAI,MAAM,IAAI,GAAG,WAAW,CAAC,CAAC,IAAI,MAAM,OAAO,CAAC,CAAC,QAAQ,KAAK;AAC9D,QAAQ,GAAG,QAAQ;AACnB,QAAQ,IAAI;AACZ,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC;AACZ,IAAI,MAAM,GAAG,GAAG,WAAW,CAAC,OAAO,OAAO,CAAC,CAAC,QAAQ,MAAM,QAAQ,CAAC,KAAK,CAAC,CAAC,EAAE,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;AACxG,IAAI,MAAM,IAAI,GAAG,WAAW,CAAC,MAAM,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC;AACvD,IAAI,MAAM,KAAK,GAAG,WAAW,CAAC,MAAM,OAAO,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;AACpD,IAAI,MAAM,OAAO,GAAG,WAAW,CAAC,MAAM,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AACvE,IAAI,MAAM,QAAQ,GAAG,OAAO,CAAC,OAAO;AACpC,QAAQ,KAAK;AACb,QAAQ,OAAO;AACf,QAAQ,MAAM,EAAE,IAAI,CAAC,MAAM;AAC3B,QAAQ,IAAI;AACZ,QAAQ,GAAG;AACX,QAAQ,IAAI;AACZ,KAAK,CAAC,EAAE;AACR,QAAQ,KAAK;AACb,QAAQ,OAAO;AACf,QAAQ,IAAI,CAAC,MAAM;AACnB,QAAQ,IAAI;AACZ,QAAQ,GAAG;AACX,QAAQ,IAAI;AACZ,KAAK,CAAC;AACN,IAAI,OAAO,CAAC,IAAI,EAAE,QAAQ,CAAC;AAC3B;;;;"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The lucide-react icons Dynamic UI renders on its own, without the consumer
|
|
3
|
+
* asking for them by name.
|
|
4
|
+
*
|
|
5
|
+
* Two sources feed this list:
|
|
6
|
+
*
|
|
7
|
+
* - The `iconMap` defaults of `DContextProvider` (`src/contexts/DContext.tsx`),
|
|
8
|
+
* used by close buttons, chevrons, alert states, input adornments and the
|
|
9
|
+
* stepper checkmark.
|
|
10
|
+
* - Names hard-coded in component JSX or in a prop default, such as
|
|
11
|
+
* `DDropdown`'s toggle or `DVoucher`'s action buttons.
|
|
12
|
+
*
|
|
13
|
+
* Any bundler-level optimisation that narrows lucide-react down to the icons a
|
|
14
|
+
* widget actually uses must keep this set, or Dynamic UI components break for
|
|
15
|
+
* reasons the widget author cannot see in their own source. That is why the
|
|
16
|
+
* list ships in the package as `dist/icons-core.json` and is exported here.
|
|
17
|
+
*
|
|
18
|
+
* `src/icons/coreIcons.spec.ts` scans `src/components/**` and fails when an
|
|
19
|
+
* internally used icon name is missing from this list or absent from
|
|
20
|
+
* lucide-react, so the two cannot drift apart.
|
|
21
|
+
*/
|
|
22
|
+
const CORE_LUCIDE_ICONS = [
|
|
23
|
+
// iconMap defaults — src/contexts/DContext.tsx
|
|
24
|
+
'AlertCircle',
|
|
25
|
+
'AlertTriangle',
|
|
26
|
+
'Calendar',
|
|
27
|
+
'Check',
|
|
28
|
+
'CheckCircle',
|
|
29
|
+
'ChevronDown',
|
|
30
|
+
'ChevronLeft',
|
|
31
|
+
'ChevronRight',
|
|
32
|
+
'ChevronUp',
|
|
33
|
+
'Eye',
|
|
34
|
+
'EyeOff',
|
|
35
|
+
'Info',
|
|
36
|
+
'Minus',
|
|
37
|
+
'Plus',
|
|
38
|
+
'Search',
|
|
39
|
+
'Upload',
|
|
40
|
+
'X',
|
|
41
|
+
// Hard-coded in component JSX or in a prop default
|
|
42
|
+
'Circle',
|
|
43
|
+
'CircleCheck',
|
|
44
|
+
'CircleCheckBig',
|
|
45
|
+
'Download',
|
|
46
|
+
'FileText',
|
|
47
|
+
'MoreVertical',
|
|
48
|
+
'Paperclip',
|
|
49
|
+
'RefreshCw',
|
|
50
|
+
'Share2',
|
|
51
|
+
'Trash',
|
|
52
|
+
];
|
|
53
|
+
|
|
54
|
+
export { CORE_LUCIDE_ICONS };
|
|
55
|
+
//# sourceMappingURL=coreIcons.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"coreIcons.js","sources":["../../../dist-transpiled/icons/coreIcons.js"],"sourcesContent":["/**\n * The lucide-react icons Dynamic UI renders on its own, without the consumer\n * asking for them by name.\n *\n * Two sources feed this list:\n *\n * - The `iconMap` defaults of `DContextProvider` (`src/contexts/DContext.tsx`),\n * used by close buttons, chevrons, alert states, input adornments and the\n * stepper checkmark.\n * - Names hard-coded in component JSX or in a prop default, such as\n * `DDropdown`'s toggle or `DVoucher`'s action buttons.\n *\n * Any bundler-level optimisation that narrows lucide-react down to the icons a\n * widget actually uses must keep this set, or Dynamic UI components break for\n * reasons the widget author cannot see in their own source. That is why the\n * list ships in the package as `dist/icons-core.json` and is exported here.\n *\n * `src/icons/coreIcons.spec.ts` scans `src/components/**` and fails when an\n * internally used icon name is missing from this list or absent from\n * lucide-react, so the two cannot drift apart.\n */\nexport const CORE_LUCIDE_ICONS = [\n // iconMap defaults — src/contexts/DContext.tsx\n 'AlertCircle',\n 'AlertTriangle',\n 'Calendar',\n 'Check',\n 'CheckCircle',\n 'ChevronDown',\n 'ChevronLeft',\n 'ChevronRight',\n 'ChevronUp',\n 'Eye',\n 'EyeOff',\n 'Info',\n 'Minus',\n 'Plus',\n 'Search',\n 'Upload',\n 'X',\n // Hard-coded in component JSX or in a prop default\n 'Circle',\n 'CircleCheck',\n 'CircleCheckBig',\n 'Download',\n 'FileText',\n 'MoreVertical',\n 'Paperclip',\n 'RefreshCw',\n 'Share2',\n 'Trash',\n];\n//# sourceMappingURL=coreIcons.js.map"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,iBAAiB,GAAG;AACjC;AACA,IAAI,aAAa;AACjB,IAAI,eAAe;AACnB,IAAI,UAAU;AACd,IAAI,OAAO;AACX,IAAI,aAAa;AACjB,IAAI,aAAa;AACjB,IAAI,aAAa;AACjB,IAAI,cAAc;AAClB,IAAI,WAAW;AACf,IAAI,KAAK;AACT,IAAI,QAAQ;AACZ,IAAI,MAAM;AACV,IAAI,OAAO;AACX,IAAI,MAAM;AACV,IAAI,QAAQ;AACZ,IAAI,QAAQ;AACZ,IAAI,GAAG;AACP;AACA,IAAI,QAAQ;AACZ,IAAI,aAAa;AACjB,IAAI,gBAAgB;AACpB,IAAI,UAAU;AACd,IAAI,UAAU;AACd,IAAI,cAAc;AAClB,IAAI,WAAW;AACf,IAAI,WAAW;AACf,IAAI,QAAQ;AACZ,IAAI,OAAO;AACX;;;;"}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
export { default as DAlert } from './components/DAlert/DAlert.js';
|
|
2
|
+
export { default as DAvatar } from './components/DAvatar/DAvatar.js';
|
|
3
|
+
export { default as DBadge } from './components/DBadge/DBadge.js';
|
|
4
|
+
export { default as DBox } from './components/DBox/DBox.js';
|
|
5
|
+
export { default as DBoxFile } from './components/DBoxFile/DBoxFile.js';
|
|
6
|
+
export { default as DButton } from './components/DButton/DButton.js';
|
|
7
|
+
export { default as DButtonIcon } from './components/DButtonIcon/DButtonIcon.js';
|
|
8
|
+
export { default as DCard } from './components/DCard/DCard.js';
|
|
9
|
+
export { default as DCardHeader } from './components/DCard/components/DCardHeader.js';
|
|
10
|
+
export { default as DCardBody } from './components/DCard/components/DCardBody.js';
|
|
11
|
+
export { default as DCardFooter } from './components/DCard/components/DCardFooter.js';
|
|
12
|
+
export { default as DCarousel } from './components/DCarousel/DCarousel.js';
|
|
13
|
+
export { default as DCarouselSlide } from './components/DCarousel/components/DCarouselSlide.js';
|
|
14
|
+
export { default as DChip } from './components/DChip/DChip.js';
|
|
15
|
+
export { default as DCollapse } from './components/DCollapse/DCollapse.js';
|
|
16
|
+
export { default as DConfirmModalContainer } from './components/DConfirmModal/DConfirmModalContainer.js';
|
|
17
|
+
export { default as DCreditCard } from './components/DCreditCard/DCreditCard.js';
|
|
18
|
+
export { default as DCurrencyText } from './components/DCurrencyText/DCurrencyText.js';
|
|
19
|
+
export { default as DDataStateWrapper } from './components/DDataStateWrapper/DDataStateWrapper.js';
|
|
20
|
+
export { EmptyState } from './components/DDataStateWrapper/components/EmptyState.js';
|
|
21
|
+
export { ErrorState } from './components/DDataStateWrapper/components/ErrorState.js';
|
|
22
|
+
export { LoadingState } from './components/DDataStateWrapper/components/LoadingState.js';
|
|
23
|
+
export { default as DDatePicker } from './components/DDatePicker/DDatePicker.js';
|
|
24
|
+
export { default as DDropdown } from './components/DDropdown/DDropdown.js';
|
|
25
|
+
export { default as DErrorBoundary } from './components/DErrorBoundary/DErrorBoundary.js';
|
|
26
|
+
export { default as DIcon } from './components/DIcon/DIcon.js';
|
|
27
|
+
export { default as DIconBase } from './components/DIconBase/DIconBase.js';
|
|
28
|
+
export { default as DInput } from './components/DInput/DInput.js';
|
|
29
|
+
export { default as DInputCheck } from './components/DInputCheck/DInputCheck.js';
|
|
30
|
+
export { default as DInputCounter } from './components/DInputCounter/DInputCounter.js';
|
|
31
|
+
export { default as DInputCurrency } from './components/DInputCurrency/DInputCurrency.js';
|
|
32
|
+
export { default as DInputMask } from './components/DInputMask/DInputMask.js';
|
|
33
|
+
export { default as DInputPassword } from './components/DInputPassword/DInputPassword.js';
|
|
34
|
+
export { default as DInputPhone } from './components/DInputPhone/DInputPhone.js';
|
|
35
|
+
export { default as DInputPin } from './components/DInputPin/DInputPin.js';
|
|
36
|
+
export { default as DInputRange } from './components/DInputRange/DInputRange.js';
|
|
37
|
+
export { default as DInputSearch } from './components/DInputSearch/DInputSearch.js';
|
|
38
|
+
export { default as DInputSelect } from './components/DInputSelect/DInputSelect.js';
|
|
39
|
+
export { default as DInputSwitch } from './components/DInputSwitch/DInputSwitch.js';
|
|
40
|
+
export { default as DLayout } from './components/DLayout/DLayout.js';
|
|
41
|
+
export { default as DLayoutPane } from './components/DLayout/components/DLayoutPane.js';
|
|
42
|
+
export { default as DListGroup } from './components/DListGroup/DListGroup.js';
|
|
43
|
+
export { default as DListGroupItem } from './components/DListGroup/components/DListGroupItem.js';
|
|
44
|
+
export { default as DModal } from './components/DModal/DModal.js';
|
|
45
|
+
export { default as DModalHeader } from './components/DModal/components/DModalHeader.js';
|
|
46
|
+
export { default as DModalBody } from './components/DModal/components/DModalBody.js';
|
|
47
|
+
export { default as DModalFooter } from './components/DModal/components/DModalFooter.js';
|
|
48
|
+
export { default as DOffcanvas } from './components/DOffcanvas/DOffcanvas.js';
|
|
49
|
+
export { default as DOffcanvasHeader } from './components/DOffcanvas/components/DOffcanvasHeader.js';
|
|
50
|
+
export { default as DOffcanvasBody } from './components/DOffcanvas/components/DOffcanvasBody.js';
|
|
51
|
+
export { default as DOffcanvasFooter } from './components/DOffcanvas/components/DOffcanvasFooter.js';
|
|
52
|
+
export { default as DOtp } from './components/DOtp/DOtp.js';
|
|
53
|
+
export { default as DPaginator } from './components/DPaginator/DPaginator.js';
|
|
54
|
+
export { default as DPasswordStrengthMeter } from './components/DPasswordStrengthMeter/DPasswordStrengthMeter.js';
|
|
55
|
+
export { default as DPopover } from './components/DPopover/DPopover.js';
|
|
56
|
+
export { default as DProgress } from './components/DProgress/DProgress.js';
|
|
57
|
+
export { default as DSelect } from './components/DSelect/DSelect.js';
|
|
58
|
+
export { default as DStepper } from './components/DStepper/DStepper.js';
|
|
59
|
+
export { default as DStepperDesktop } from './components/DStepperDesktop/DStepperDesktop.js';
|
|
60
|
+
export { default as DStepperMobile } from './components/DStepperMobile/DStepperMobile.js';
|
|
61
|
+
export { default as DTabContent } from './components/DTabs/components/DTabContent.js';
|
|
62
|
+
export { default as DTabs } from './components/DTabs/DTabs.js';
|
|
63
|
+
export { default as DTabsProvider } from './components/DTabs/components/DTabsProvider.js';
|
|
64
|
+
export { useTabContext } from './components/DTabs/TabContext.js';
|
|
65
|
+
export { default as DTimeline } from './components/DTimeline/DTimeline.js';
|
|
66
|
+
export { default as DToast } from './components/DToast/DToast.js';
|
|
67
|
+
export { default as DToastContainer } from './components/DToastContainer/DToastContainer.js';
|
|
68
|
+
export { default as useDToast } from './components/DToastContainer/useDToast.js';
|
|
69
|
+
export { default as DTooltip } from './components/DTooltip/DTooltip.js';
|
|
70
|
+
export { default as DVoucher } from './components/DVoucher/DVoucher.js';
|
|
71
|
+
export { default as useScreenshot } from './components/DVoucher/hooks/useScreenshot.js';
|
|
72
|
+
export { default as useScreenshotDownload } from './components/DVoucher/hooks/useScreenshotDownload.js';
|
|
73
|
+
export { default as useScreenshotWebShare } from './components/DVoucher/hooks/useScreenshotWebShare.js';
|
|
74
|
+
export { default as buildUrl } from './utils/buildUrl.js';
|
|
75
|
+
export { default as changeQueryString } from './utils/changeQueryString.js';
|
|
76
|
+
export { default as configureI18n } from './utils/configureI18n.js';
|
|
77
|
+
export { default as formatCurrency } from './utils/formatCurrency.js';
|
|
78
|
+
export { default as getCssVariable } from './utils/getCssVariable.js';
|
|
79
|
+
export { default as getQueryString } from './utils/getQueryString.js';
|
|
80
|
+
export { default as sanitizeHref } from './utils/sanitizeHref.js';
|
|
81
|
+
export { default as useConfirmModal } from './hooks/useConfirmModal.js';
|
|
82
|
+
export { default as useCountdown } from './hooks/useCountdown.js';
|
|
83
|
+
export { default as useDisableBodyScrollEffect } from './hooks/useDisableBodyScrollEffect.js';
|
|
84
|
+
export { default as useDisableInputWheel } from './hooks/useDisableInputWheel.js';
|
|
85
|
+
export { default as useFormatCurrency } from './hooks/useFormatCurrency.js';
|
|
86
|
+
export { default as useInputCurrency } from './hooks/useInputCurrency.js';
|
|
87
|
+
export { default as useItemSelection } from './hooks/useItemSelection.js';
|
|
88
|
+
export { default as useMediaQuery } from './hooks/useMediaQuery.js';
|
|
89
|
+
export { default as useOtp } from './hooks/useOtp.js';
|
|
90
|
+
export { default as useProvidedRefOrCreate } from './hooks/useProvidedRefOrCreate.js';
|
|
91
|
+
export { default as useStackState } from './hooks/useStackState.js';
|
|
92
|
+
export { default as validatePhoneNumber } from './utils/validatePhoneNumber.js';
|
|
93
|
+
export { CORE_LUCIDE_ICONS } from './icons/coreIcons.js';
|
|
94
|
+
export { DContext, DContextProvider, useDContext } from './contexts/DContext.js';
|
|
95
|
+
export { checkMediaQuery, subscribeToMediaQuery } from './utils/mediaQuery.js';
|
|
96
|
+
export { getErrorMessage, useErrorBoundary } from 'react-error-boundary';
|
|
97
|
+
export { useDPortalContext } from './contexts/DPortalContext.js';
|
|
98
|
+
export { useMediaBreakpointUpLg, useMediaBreakpointUpMd, useMediaBreakpointUpSm, useMediaBreakpointUpXl, useMediaBreakpointUpXs, useMediaBreakpointUpXxl } from './hooks/useMediaBreakpointUp.js';
|
|
99
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Check if the provided file type should be accepted by the input with accept attribute.
|
|
3
|
+
* https://developer.mozilla.org/en-US/docs/Web/HTML/Element/Input#attr-accept
|
|
4
|
+
*
|
|
5
|
+
* Inspired by https://github.com/enyo/dropzone
|
|
6
|
+
*
|
|
7
|
+
* @param file {File} https://developer.mozilla.org/en-US/docs/Web/API/File
|
|
8
|
+
* @param acceptedFiles {string|string[]}
|
|
9
|
+
* @returns {boolean}
|
|
10
|
+
*/
|
|
11
|
+
function attrAccept(file, acceptedFiles) {
|
|
12
|
+
if (file && acceptedFiles) {
|
|
13
|
+
const acceptedFilesArray = Array.isArray(acceptedFiles)
|
|
14
|
+
? acceptedFiles
|
|
15
|
+
: acceptedFiles.split(',');
|
|
16
|
+
if (acceptedFilesArray.length === 0) {
|
|
17
|
+
return true;
|
|
18
|
+
}
|
|
19
|
+
const fileName = file.name || '';
|
|
20
|
+
const mimeType = (file.type || '').toLowerCase();
|
|
21
|
+
const baseMimeType = mimeType.replace(/\/.*$/, '');
|
|
22
|
+
return acceptedFilesArray.some((type) => {
|
|
23
|
+
const validType = type.trim().toLowerCase();
|
|
24
|
+
if (validType.charAt(0) === '.') {
|
|
25
|
+
return fileName.toLowerCase().endsWith(validType);
|
|
26
|
+
}
|
|
27
|
+
if (validType.endsWith('/*')) {
|
|
28
|
+
// This is something like a image/* mime type
|
|
29
|
+
return baseMimeType === validType.replace(/\/.*$/, '');
|
|
30
|
+
}
|
|
31
|
+
return mimeType === validType;
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
return true;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export { attrAccept as default };
|
|
38
|
+
//# sourceMappingURL=attr-accept.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"attr-accept.js","sources":["../../../dist-transpiled/utils/attr-accept.js"],"sourcesContent":["/**\n * Check if the provided file type should be accepted by the input with accept attribute.\n * https://developer.mozilla.org/en-US/docs/Web/HTML/Element/Input#attr-accept\n *\n * Inspired by https://github.com/enyo/dropzone\n *\n * @param file {File} https://developer.mozilla.org/en-US/docs/Web/API/File\n * @param acceptedFiles {string|string[]}\n * @returns {boolean}\n */\nexport default function attrAccept(file, acceptedFiles) {\n if (file && acceptedFiles) {\n const acceptedFilesArray = Array.isArray(acceptedFiles)\n ? acceptedFiles\n : acceptedFiles.split(',');\n if (acceptedFilesArray.length === 0) {\n return true;\n }\n const fileName = file.name || '';\n const mimeType = (file.type || '').toLowerCase();\n const baseMimeType = mimeType.replace(/\\/.*$/, '');\n return acceptedFilesArray.some((type) => {\n const validType = type.trim().toLowerCase();\n if (validType.charAt(0) === '.') {\n return fileName.toLowerCase().endsWith(validType);\n }\n if (validType.endsWith('/*')) {\n // This is something like a image/* mime type\n return baseMimeType === validType.replace(/\\/.*$/, '');\n }\n return mimeType === validType;\n });\n }\n return true;\n}\n//# sourceMappingURL=attr-accept.js.map"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAAS,UAAU,CAAC,IAAI,EAAE,aAAa,EAAE;AACxD,IAAI,IAAI,IAAI,IAAI,aAAa,EAAE;AAC/B,QAAQ,MAAM,kBAAkB,GAAG,KAAK,CAAC,OAAO,CAAC,aAAa;AAC9D,cAAc;AACd,cAAc,aAAa,CAAC,KAAK,CAAC,GAAG,CAAC;AACtC,QAAQ,IAAI,kBAAkB,CAAC,MAAM,KAAK,CAAC,EAAE;AAC7C,YAAY,OAAO,IAAI;AACvB,QAAQ;AACR,QAAQ,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,IAAI,EAAE;AACxC,QAAQ,MAAM,QAAQ,GAAG,CAAC,IAAI,CAAC,IAAI,IAAI,EAAE,EAAE,WAAW,EAAE;AACxD,QAAQ,MAAM,YAAY,GAAG,QAAQ,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC;AAC1D,QAAQ,OAAO,kBAAkB,CAAC,IAAI,CAAC,CAAC,IAAI,KAAK;AACjD,YAAY,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE;AACvD,YAAY,IAAI,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,GAAG,EAAE;AAC7C,gBAAgB,OAAO,QAAQ,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,SAAS,CAAC;AACjE,YAAY;AACZ,YAAY,IAAI,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE;AAC1C;AACA,gBAAgB,OAAO,YAAY,KAAK,SAAS,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC;AACtE,YAAY;AACZ,YAAY,OAAO,QAAQ,KAAK,SAAS;AACzC,QAAQ,CAAC,CAAC;AACV,IAAI;AACJ,IAAI,OAAO,IAAI;AACf;;;;"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Characters the URL parser drops before resolving a URL, so they cannot be used to hide a
|
|
3
|
+
* scheme-relative prefix (e.g. `/<TAB>/evil.com`).
|
|
4
|
+
*/
|
|
5
|
+
const IGNORED_CHARS = /[\t\n\r]/g;
|
|
6
|
+
/**
|
|
7
|
+
* Leading separators. Browsers treat a leading `\` exactly like a leading `/`, so both have
|
|
8
|
+
* to be stripped to prevent scheme-relative URLs (`//evil.com`, `/\evil.com`, `\\evil.com`).
|
|
9
|
+
*/
|
|
10
|
+
const LEADING_SEPARATORS = /^[/\\]+/;
|
|
11
|
+
/**
|
|
12
|
+
* Builds an internal URL from a `path` and a set of query `params`, normalizing leading
|
|
13
|
+
* separators to prevent scheme-relative URLs (e.g. `//accounts` and `/\accounts` both become
|
|
14
|
+
* `/accounts`).
|
|
15
|
+
*
|
|
16
|
+
* The `path` is trimmed and every tab, line feed and carriage return is removed before
|
|
17
|
+
* building the result, because the URL parser ignores those characters too and they would
|
|
18
|
+
* otherwise hide a scheme-relative prefix (`/<TAB>/evil.com` resolves to `//evil.com`).
|
|
19
|
+
*
|
|
20
|
+
* Handles the special case where `path` is the literal string `'#'`, which happens when
|
|
21
|
+
* a Liquid template variable used as a link target is left unconfigured; in that case the
|
|
22
|
+
* params are ignored and `'#'` is returned as-is instead of building a broken URL.
|
|
23
|
+
*
|
|
24
|
+
* @param path - The path to build the URL from. Leading separators are stripped before
|
|
25
|
+
* building the result (`/accounts`, `//accounts` and `\accounts` are all treated as `accounts`).
|
|
26
|
+
* @param params - Key/value pairs serialized as the query string.
|
|
27
|
+
* @returns The resulting URL:
|
|
28
|
+
* - `'#'` when `path` normalizes to `'#'` (`'#'`, `'/#'`), ignoring the params.
|
|
29
|
+
* - `'/'` when `path` is empty and there are no params.
|
|
30
|
+
* - `'/?<query>'` when `path` is empty and there are params.
|
|
31
|
+
* - `'<path>'` or `'<path>?<query>'` when `path` starts with `#`, since a fragment must not be
|
|
32
|
+
* prefixed with `/` (it would navigate away from the current document).
|
|
33
|
+
* - `'/<path>'` or `'/<path>?<query>'` otherwise.
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* buildUrl('accounts', { account_id: '42' }); // '/accounts?account_id=42'
|
|
37
|
+
* buildUrl('//accounts', {}); // '/accounts'
|
|
38
|
+
* buildUrl('#', { account_id: '42' }); // '#'
|
|
39
|
+
* buildUrl('#accounts', { account_id: '42' }); // '#accounts?account_id=42'
|
|
40
|
+
* buildUrl('', { tab: 'movimientos' }); // '/?tab=movimientos'
|
|
41
|
+
*/
|
|
42
|
+
function buildUrl(path, params) {
|
|
43
|
+
const normalizedPath = path
|
|
44
|
+
.trim()
|
|
45
|
+
.replace(IGNORED_CHARS, '')
|
|
46
|
+
.replace(LEADING_SEPARATORS, '');
|
|
47
|
+
if (normalizedPath === '#')
|
|
48
|
+
return '#';
|
|
49
|
+
const query = new URLSearchParams(Object.entries(params).map(([key, value]) => [key, String(value)])).toString();
|
|
50
|
+
if (normalizedPath === '')
|
|
51
|
+
return query ? `/?${query}` : '/';
|
|
52
|
+
const prefix = normalizedPath.startsWith('#') ? '' : '/';
|
|
53
|
+
return `${prefix}${normalizedPath}${query ? `?${query}` : ''}`;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export { buildUrl as default };
|
|
57
|
+
//# sourceMappingURL=buildUrl.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"buildUrl.js","sources":["../../../dist-transpiled/utils/buildUrl.js"],"sourcesContent":["/**\n * Characters the URL parser drops before resolving a URL, so they cannot be used to hide a\n * scheme-relative prefix (e.g. `/<TAB>/evil.com`).\n */\nconst IGNORED_CHARS = /[\\t\\n\\r]/g;\n/**\n * Leading separators. Browsers treat a leading `\\` exactly like a leading `/`, so both have\n * to be stripped to prevent scheme-relative URLs (`//evil.com`, `/\\evil.com`, `\\\\evil.com`).\n */\nconst LEADING_SEPARATORS = /^[/\\\\]+/;\n/**\n * Builds an internal URL from a `path` and a set of query `params`, normalizing leading\n * separators to prevent scheme-relative URLs (e.g. `//accounts` and `/\\accounts` both become\n * `/accounts`).\n *\n * The `path` is trimmed and every tab, line feed and carriage return is removed before\n * building the result, because the URL parser ignores those characters too and they would\n * otherwise hide a scheme-relative prefix (`/<TAB>/evil.com` resolves to `//evil.com`).\n *\n * Handles the special case where `path` is the literal string `'#'`, which happens when\n * a Liquid template variable used as a link target is left unconfigured; in that case the\n * params are ignored and `'#'` is returned as-is instead of building a broken URL.\n *\n * @param path - The path to build the URL from. Leading separators are stripped before\n * building the result (`/accounts`, `//accounts` and `\\accounts` are all treated as `accounts`).\n * @param params - Key/value pairs serialized as the query string.\n * @returns The resulting URL:\n * - `'#'` when `path` normalizes to `'#'` (`'#'`, `'/#'`), ignoring the params.\n * - `'/'` when `path` is empty and there are no params.\n * - `'/?<query>'` when `path` is empty and there are params.\n * - `'<path>'` or `'<path>?<query>'` when `path` starts with `#`, since a fragment must not be\n * prefixed with `/` (it would navigate away from the current document).\n * - `'/<path>'` or `'/<path>?<query>'` otherwise.\n *\n * @example\n * buildUrl('accounts', { account_id: '42' }); // '/accounts?account_id=42'\n * buildUrl('//accounts', {}); // '/accounts'\n * buildUrl('#', { account_id: '42' }); // '#'\n * buildUrl('#accounts', { account_id: '42' }); // '#accounts?account_id=42'\n * buildUrl('', { tab: 'movimientos' }); // '/?tab=movimientos'\n */\nexport default function buildUrl(path, params) {\n const normalizedPath = path\n .trim()\n .replace(IGNORED_CHARS, '')\n .replace(LEADING_SEPARATORS, '');\n if (normalizedPath === '#')\n return '#';\n const query = new URLSearchParams(Object.entries(params).map(([key, value]) => [key, String(value)])).toString();\n if (normalizedPath === '')\n return query ? `/?${query}` : '/';\n const prefix = normalizedPath.startsWith('#') ? '' : '/';\n return `${prefix}${normalizedPath}${query ? `?${query}` : ''}`;\n}\n//# sourceMappingURL=buildUrl.js.map"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA,MAAM,aAAa,GAAG,WAAW;AACjC;AACA;AACA;AACA;AACA,MAAM,kBAAkB,GAAG,SAAS;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAAS,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE;AAC/C,IAAI,MAAM,cAAc,GAAG;AAC3B,SAAS,IAAI;AACb,SAAS,OAAO,CAAC,aAAa,EAAE,EAAE;AAClC,SAAS,OAAO,CAAC,kBAAkB,EAAE,EAAE,CAAC;AACxC,IAAI,IAAI,cAAc,KAAK,GAAG;AAC9B,QAAQ,OAAO,GAAG;AAClB,IAAI,MAAM,KAAK,GAAG,IAAI,eAAe,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,KAAK,CAAC,GAAG,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;AACpH,IAAI,IAAI,cAAc,KAAK,EAAE;AAC7B,QAAQ,OAAO,KAAK,GAAG,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC,GAAG,GAAG;AACzC,IAAI,MAAM,MAAM,GAAG,cAAc,CAAC,UAAU,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,GAAG;AAC5D,IAAI,OAAO,CAAC,EAAE,MAAM,CAAC,EAAE,cAAc,CAAC,EAAE,KAAK,GAAG,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC;AAClE;;;;"}
|