@economic/taco 1.14.3 → 1.15.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +82 -82
- package/dist/components/Button/Button.stories.d.ts +3 -0
- package/dist/components/IconButton/IconButton.stories.d.ts +3 -0
- package/dist/components/Popover/Popover.d.ts +6 -0
- package/dist/components/Popover/Popover.stories.d.ts +17 -2
- package/dist/esm/index.css +190 -190
- package/dist/esm/packages/taco/src/components/AlertDialog/AlertDialog.js.map +1 -1
- package/dist/esm/packages/taco/src/components/AlertDialog/Context.js.map +1 -1
- package/dist/esm/packages/taco/src/components/AlertDialog/components/Content.js.map +1 -1
- package/dist/esm/packages/taco/src/components/AlertDialog/components/Footer.js.map +1 -1
- package/dist/esm/packages/taco/src/components/AlertDialog/components/Trigger.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Backdrop/Backdrop.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Button/Button.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Button/util.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Calendar/Calendar.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Card/Card.js +1 -1
- package/dist/esm/packages/taco/src/components/Card/Card.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Combobox/Combobox.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Combobox/useCombobox.js +2 -2
- package/dist/esm/packages/taco/src/components/Combobox/useCombobox.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Datepicker/Datepicker.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Datepicker/useDatepicker.js +2 -2
- package/dist/esm/packages/taco/src/components/Datepicker/useDatepicker.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Dialog/Dialog.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Dialog/components/Content.js +2 -2
- package/dist/esm/packages/taco/src/components/Dialog/components/Content.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Dialog/components/Drawer.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Dialog/components/Trigger.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Dialog/util.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Hanger/Hanger.js.map +1 -1
- package/dist/esm/packages/taco/src/components/HoverCard/HoverCard.js.map +1 -1
- package/dist/esm/packages/taco/src/components/HoverCard/Primitives.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/AccountPreview.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/Accounting.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/AccountingYear.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/AccountingYearCancel.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/ArrowBottom.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/ArrowDown.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/ArrowEnd.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/ArrowLeft.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/ArrowRight.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/ArrowStart.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/ArrowTop.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/ArrowUp.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/Attach.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/AttachAuto.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/AttachCancel.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/Autotext.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/AutotextInsert.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/Basic.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/BasicTabs.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/BellSolid.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/Book.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/Booking.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/Budget.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/Calendar.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/CashAccount.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/CashReports.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/Chat.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/ChatSolid.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/ChevronDown.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/ChevronDownDouble.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/ChevronDownSolid.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/ChevronLeft.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/ChevronLeftDouble.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/ChevronLeftSolid.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/ChevronRight.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/ChevronRightDouble.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/ChevronRightSolid.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/ChevronUp.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/ChevronUpDouble.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/ChevronUpSolid.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/CircleClose.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/CircleMinus.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/CirclePlus.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/CircleTick.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/Clamp.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/ClampOpen.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/Close.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/ConnectionEnable.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/ConnectionRevoke.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/Contacts.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/Copy.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/Courses.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/Credit.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/Delete.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/DeletePermanently.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/Depecriate.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/Developer.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/DistributionTemplate.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/Document.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/DocumentApprove.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/DocumentCreateEntry.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/DocumentCut.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/DocumentError.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/DocumentIsolatePage.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/DocumentMerge.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/DocumentMove.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/DocumentPreview.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/DocumentReceived.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/DocumentRejectedRequest.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/DocumentSplit.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/DocumentTime.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/Download.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/Drag.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/ECopedia.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/ESignature.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/Edit.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/EllipsisHorizontal.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/EllipsisVertical.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/EntriesOnAccount.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/EntriesOpen.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/EntriesWarning.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/EntryTypeCustomerInvoice.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/EntryTypeCustomerPayment.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/EntryTypeJournalEntry.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/EntryTypeManualCustomerInvoice.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/EntryTypeSupplierInvoice.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/EntryTypeSupplierPayment.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/Envelope.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/EnvelopeApproved.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/ExpandView.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/Expenses.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/Export.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/ExportToExcel.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/ExportToPdf.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/Filter.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/FilterSolid.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/GraphSolid.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/Hash.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/Home.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/Images.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/Import.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/Inbox.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/InboxEinvoicing.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/InboxScanning.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/InboxSmart.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/Info.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/Inventory.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/InventoryMatrix.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/JournalPro.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/Layout.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/LayoutBoth.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/LayoutFirst.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/LayoutLast.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/LayoutNone.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/LedgerCard.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/LedgerCardCustomerReminder.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/LedgerCardManualCustomerInvoice.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/LedgerCardObsoleteStock.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/LedgerCardOpeningEntry.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/LedgerCardReservedEntry.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/LedgerCardShrinkagePilferage.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/LedgerCardStockAdjustment.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/LedgerCardTransferredOpeningEntry.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/Lightbulb.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/Line.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/List.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/ListBulleted.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/ListSearch.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/LockOpen.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/Log.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/LogOut.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/Market.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/MatchAmount.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/MatchEntries.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/Menu.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/Mileage.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/ModalResize.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/ModalShrink.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/More.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/MoreSolid.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/Move.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/NavigationList.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/Note.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/NoteFollowUp.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/NoteRead.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/Numbers.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/PartnerApi.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/Period.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/PersonChange.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/PersonMinus.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/PersonPlus.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/PersonTick.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/Play.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/PlusMinus.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/Print.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/ProcessPayment.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/ProductLedgerCard.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/Profile.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/ProjectCards.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/Projects.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/Quicklinks.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/RatingBankruptcy.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/RatingPaymentProblems.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/Reconciled.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/Refresh.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/Report.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/ReportSolid.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/Restore.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/RotateLeft.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/RotateRight.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/Sales.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/Search.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/SearchBold.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/Secure.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/SecureTick.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/Settings.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/SettingsSolid.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/Shortcuts.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/ShowAll.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/ShowLess.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/ShowMore.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/ShowTemplate.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/Sliders.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/Smartpay.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/SortBy.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/Spinner.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/Star.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/StarSolid.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/Subscriptions.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/SystemEntries.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/Tag.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/TemplateOverride.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/Templates.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/ThumbBoth.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/ThumbDown.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/ThumbDownSolid.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/ThumbUp.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/ThumbUpSolid.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/Tick.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/Time.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/Transfer.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/TransferCancel.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/TransferLocked.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/Undo.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/Undock.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/Unreconciled.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/Warning.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/Webshop.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/Website.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/Workflow.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/Zoom.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/index.js.map +1 -1
- package/dist/esm/packages/taco/src/components/IconButton/IconButton.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Input/Input.js +2 -2
- package/dist/esm/packages/taco/src/components/Input/Input.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Input/util.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Listbox/ScrollableList.js +2 -2
- package/dist/esm/packages/taco/src/components/Listbox/ScrollableList.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Listbox/useListbox.js +2 -2
- package/dist/esm/packages/taco/src/components/Listbox/useListbox.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Listbox/useMultiListbox.js +2 -2
- package/dist/esm/packages/taco/src/components/Listbox/useMultiListbox.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Listbox/util.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Menu/Menu.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Menu/components/Checkbox.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Menu/components/Content.js +2 -2
- package/dist/esm/packages/taco/src/components/Menu/components/Content.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Menu/components/Header.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Menu/components/Item.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Menu/components/RadioGroup.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Menu/components/Trigger.js +2 -2
- package/dist/esm/packages/taco/src/components/Menu/components/Trigger.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Navigation/Navigation.js +2 -2
- package/dist/esm/packages/taco/src/components/Navigation/Navigation.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Pagination/PageNumbers.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Pagination/Pagination.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Popover/Popover.js +7 -1
- package/dist/esm/packages/taco/src/components/Popover/Popover.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Popover/Primitives.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Popover/util.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Provider/Provider.js.map +1 -1
- package/dist/esm/packages/taco/src/components/RadioGroup/RadioGroup.js.map +1 -1
- package/dist/esm/packages/taco/src/components/ScrollArea/ScrollArea.js.map +1 -1
- package/dist/esm/packages/taco/src/components/SearchInput/SearchInput.js +2 -2
- package/dist/esm/packages/taco/src/components/SearchInput/SearchInput.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Select/Select.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Select/useSelect.js +2 -2
- package/dist/esm/packages/taco/src/components/Select/useSelect.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Select2/Select2.js +1 -1
- package/dist/esm/packages/taco/src/components/Select2/Select2.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Select2/components/Collection.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Select2/components/Context.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Select2/components/Create.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Select2/components/Edit.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Select2/components/Group.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Select2/components/Option.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Select2/components/Search.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Select2/components/Title.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Select2/components/Trigger.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Select2/hooks/useChildren.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Select2/utilities.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Switch/Switch.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table/components/BaseTable.js +2 -2
- package/dist/esm/packages/taco/src/components/Table/components/BaseTable.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table/components/Table.js +2 -2
- package/dist/esm/packages/taco/src/components/Table/components/Table.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table/components/WindowedTable.js +2 -2
- package/dist/esm/packages/taco/src/components/Table/components/WindowedTable.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table/hooks/plugins/useRowActions.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table/hooks/useTable.js +1 -2
- package/dist/esm/packages/taco/src/components/Table/hooks/useTable.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table/hooks/useTableKeyboardNavigation.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table/util/rowIndexPath.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table/util/sortTypes.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table/util.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Tag/Tag.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Toast/Toast.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Toast/Toaster.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Toast/util.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Tooltip/Tooltip.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Tour/Tour.js.map +1 -1
- package/dist/esm/packages/taco/src/hooks/useBoundingClientRectListener.js.map +1 -1
- package/dist/esm/packages/taco/src/hooks/useId.js.map +1 -1
- package/dist/esm/packages/taco/src/hooks/useIsFormControl.js.map +1 -1
- package/dist/esm/packages/taco/src/hooks/useMergedRef.js.map +1 -1
- package/dist/esm/packages/taco/src/hooks/usePrevious.js.map +1 -1
- package/dist/esm/packages/taco/src/index.js +2 -2
- package/dist/esm/packages/taco/src/primitives/BubbleSelect.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Button.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Collection/components/Root.js +1 -1
- package/dist/esm/packages/taco/src/primitives/Collection/components/Root.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Listbox2/components/Context.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Listbox2/components/Group.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Listbox2/components/Option.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Listbox2/components/Root.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Listbox2/components/Title.js.map +1 -1
- package/dist/esm/packages/taco/src/utils/aria.js.map +1 -1
- package/dist/esm/packages/taco/src/utils/colors.js.map +1 -1
- package/dist/esm/packages/taco/src/utils/date.js.map +1 -1
- package/dist/esm/packages/taco/src/utils/debounce.js.map +1 -1
- package/dist/esm/packages/taco/src/utils/device.js.map +1 -1
- package/dist/esm/packages/taco/src/utils/dom.js.map +1 -1
- package/dist/esm/packages/taco/src/utils/hooks/useDropTarget.js.map +1 -1
- package/dist/esm/packages/taco/src/utils/hooks/useListKeyboardNavigation.js.map +1 -1
- package/dist/esm/packages/taco/src/utils/hooks/useListScrollTo.js.map +1 -1
- package/dist/esm/packages/taco/src/utils/hooks/useOnClickOutside.js.map +1 -1
- package/dist/esm/packages/taco/src/utils/hooks/useTimer.js.map +1 -1
- package/dist/esm/packages/taco/src/utils/input.js.map +1 -1
- package/dist/esm/packages/taco/src/utils/mergeRefs.js.map +1 -1
- package/dist/esm/packages/taco/src/utils/taillwind.js.map +1 -1
- package/dist/index.css +190 -190
- package/dist/taco.cjs.development.js +73 -82
- package/dist/taco.cjs.development.js.map +1 -1
- package/dist/taco.cjs.production.min.js +1 -1
- package/dist/taco.cjs.production.min.js.map +1 -1
- package/dist/utils/storyutils.d.ts +2 -1
- package/package.json +23 -24
- package/plugins/tailwindcss-aria-attributes.js +73 -73
- package/tailwind.config.js +284 -284
- package/types.json +2 -2
- package/dist/esm/packages/taco/src/utils/hooks/useProxiedRef.js +0 -18
- package/dist/esm/packages/taco/src/utils/hooks/useProxiedRef.js.map +0 -1
- package/dist/utils/hooks/useProxiedRef.d.ts +0 -2
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"util.js","sources":["../../../../../../../src/components/Listbox/util.ts"],"sourcesContent":["import React from 'react';\nimport { ScrollableListItem, ScrollableListItemValue, getId } from './ScrollableList';\nimport { setInputValueByRef as setInputValueByRefBase } from '../../utils/input';\n\nconst getValue = (value: ScrollableListItemValue | undefined): string => String(value ?? '');\n\nexport const setInputValueByRef = (input: HTMLInputElement | null, value: ScrollableListItemValue, event = 'change'): void => {\n setInputValueByRefBase(input, getValue(value), event);\n};\n\nexport const getIndexFromValue = (data: ScrollableListItem[], value: ScrollableListItemValue | undefined): number | undefined => {\n const index = data.findIndex(option => getValue(option.value) === getValue(value));\n return index > -1 ? index : undefined;\n};\n\nexport const getSelectedIndexesFromValue = (data: ScrollableListItem[], value: ScrollableListItemValue | undefined): number[] => {\n if (typeof value !== 'string') return [];\n\n return value\n .split(',')\n .map(v => data.findIndex(o => String(o.value) === v))\n .filter(v => v !== -1);\n};\n\nexport const findByValue = (data: ScrollableListItem[], value: ScrollableListItemValue): ScrollableListItem | undefined => {\n return data.find(option => getValue(option.value) === getValue(value));\n};\n\nexport const searchForString = (child: JSX.Element | string, value: string, strategy = 'includes'): boolean => {\n try {\n if (typeof child !== 'string' && child.props?.children) {\n if (Array.isArray(child.props?.children)) {\n return !!child.props.children.find((subChild: JSX.Element | string) =>\n searchForString(subChild, value, strategy)\n );\n }\n\n return searchForString(child.props?.children, value, strategy);\n } else {\n return child.toString().toLowerCase()[strategy](String(value).toLowerCase());\n }\n } catch {\n return false;\n }\n};\n\nconst getIndexInRangeByValue = (\n data: ScrollableListItem[],\n query: string,\n firstIndex: number,\n lastIndex: number = data.length\n): number => {\n const index = data.slice(firstIndex, lastIndex).findIndex(option => {\n if (option.disabled) {\n return false;\n }\n\n return searchForString(option.text, query, 'startsWith');\n });\n\n return index > -1 ? index + firstIndex : -1;\n};\n\nexport const findNextIndexByValue = (data: ScrollableListItem[], query: string, activeIndex: number | undefined): number => {\n const firstIndex = activeIndex === undefined ? 0 : activeIndex + 1;\n let index = getIndexInRangeByValue(data, query, firstIndex);\n\n if (index === -1) {\n index = getIndexInRangeByValue(data, query, 0, activeIndex);\n }\n\n return index;\n};\n\nexport const getActiveDescendant = (data: ScrollableListItem[], currentIndex: number | undefined, id: string): any => {\n return currentIndex !== undefined && data[currentIndex] ? getId(id, data[currentIndex].value) : undefined;\n};\n\nexport const useFlattenedData = (data: ScrollableListItem[]): ScrollableListItem[] => {\n return React.useMemo(() => {\n const items: ScrollableListItem[] = [];\n\n const flatten = (item: ScrollableListItem, path: number, parentPath?: string, parentDisabled?: boolean) => {\n const currentPath = parentPath ? `${parentPath}.${path}` : `${path}`;\n const isItemDisabled = parentDisabled || item.disabled;\n\n items.push({\n ...item,\n disabled: isItemDisabled,\n path: currentPath,\n hasChildren: !!item.children,\n });\n\n if (item.children) {\n item.children.forEach((childItem: ScrollableListItem, childPath: number) =>\n flatten(childItem, childPath, currentPath, isItemDisabled)\n );\n }\n };\n\n data.forEach((item, index) => {\n flatten(item, index);\n });\n\n return items;\n }, [data]);\n};\n\nexport const sanitizeItem = (item: ScrollableListItem | undefined) => {\n if (item) {\n const { hasChildren: _1, path: _2, ...rest } = item;\n return rest;\n }\n\n return undefined;\n};\n\nexport const getOptionParents = (data: ScrollableListItem[], path?: string) => {\n const indexes = path?.split('.') ?? [];\n\n if (indexes.length > 1) {\n // we don't want to map the current item\n indexes.pop();\n // we need to rebuild the path as we map\n let lastPath: string;\n\n return indexes.map(i => {\n lastPath = lastPath ? [lastPath, i].join('.') : i;\n return sanitizeItem(data.find((i: ScrollableListItem) => i.path === lastPath));\n });\n }\n\n return null;\n};\n\nexport const filterData = (data: ScrollableListItem[], value: ScrollableListItemValue = ''): ScrollableListItem[] => {\n if (value === '' || value === null) {\n return data;\n }\n\n const filteredOptionValues = new Set();\n const shouldFilterOption = (option: ScrollableListItem): boolean => {\n if (option.disabled) {\n return false;\n }\n\n return searchForString(option.text, String(value));\n };\n\n data.forEach(option => {\n if (shouldFilterOption(option)) {\n const parents = getOptionParents(data, option.path);\n\n filteredOptionValues.add(option.value);\n\n if (parents !== null) {\n parents.forEach(option => filteredOptionValues.add(option?.value));\n }\n }\n });\n\n return data.filter(({ value }) => filteredOptionValues.has(value));\n};\n"],"names":["getValue","value","String","setInputValueByRef","input","event","setInputValueByRefBase","getIndexFromValue","data","index","findIndex","option","undefined","getSelectedIndexesFromValue","split","map","v","o","filter","findByValue","find","searchForString","child","strategy","props","children","Array","isArray","subChild","toString","toLowerCase","getIndexInRangeByValue","query","firstIndex","lastIndex","length","slice","disabled","text","findNextIndexByValue","activeIndex","getActiveDescendant","currentIndex","id","getId","useFlattenedData","React","useMemo","items","flatten","item","path","parentPath","parentDisabled","currentPath","isItemDisabled","push","hasChildren","forEach","childItem","childPath","sanitizeItem","_1","_2","rest","getOptionParents","indexes","pop","lastPath","i","join","filterData","filteredOptionValues","Set","shouldFilterOption","parents","add","has"],"mappings":";;;;AAIA,MAA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AAM;IACf,IAAI+D,kBAAkB,CAAC/D,MAAM,CAAC,EAAE;MAC5B,MAAMgE,OAAO,GAAGV,gBAAgB,CAACzD,IAAI,EAAEG,MAAM,CAACwC,IAAI,CAAC;MAEnDqB,oBAAoB,CAACI,GAAG,CAACjE,MAAM,CAACV,KAAK,CAAC;MAEtC,IAAI0E,OAAO,KAAK,IAAI,EAAE;QAClBA,OAAO,CAACjB,OAAO,CAAC/C,MAAM,IAAI6D,oBAAoB,CAACI,GAAG,CAACjE,MAAM,aAANA,MAAM,uBAANA,MAAM,CAAEV,KAAK,CAAC,CAAC;;;GAG7E,CAAC;EAEF,OAAOO,IAAI,CAACU,MAAM,CAAC,CAAC;IAAEjB;GAAO,KAAKuE,oBAAoB,CAACK,GAAG,CAAC5E,KAAK,CAAC,CAAC;AACtE;;;;"}
|
1
|
+
{"version":3,"file":"util.js","sources":["../../../../../../../src/components/Listbox/util.ts"],"sourcesContent":["import React from 'react';\r\nimport { ScrollableListItem, ScrollableListItemValue, getId } from './ScrollableList';\r\nimport { setInputValueByRef as setInputValueByRefBase } from '../../utils/input';\r\n\r\nconst getValue = (value: ScrollableListItemValue | undefined): string => String(value ?? '');\r\n\r\nexport const setInputValueByRef = (input: HTMLInputElement | null, value: ScrollableListItemValue, event = 'change'): void => {\r\n setInputValueByRefBase(input, getValue(value), event);\r\n};\r\n\r\nexport const getIndexFromValue = (data: ScrollableListItem[], value: ScrollableListItemValue | undefined): number | undefined => {\r\n const index = data.findIndex(option => getValue(option.value) === getValue(value));\r\n return index > -1 ? index : undefined;\r\n};\r\n\r\nexport const getSelectedIndexesFromValue = (data: ScrollableListItem[], value: ScrollableListItemValue | undefined): number[] => {\r\n if (typeof value !== 'string') return [];\r\n\r\n return value\r\n .split(',')\r\n .map(v => data.findIndex(o => String(o.value) === v))\r\n .filter(v => v !== -1);\r\n};\r\n\r\nexport const findByValue = (data: ScrollableListItem[], value: ScrollableListItemValue): ScrollableListItem | undefined => {\r\n return data.find(option => getValue(option.value) === getValue(value));\r\n};\r\n\r\nexport const searchForString = (child: JSX.Element | string, value: string, strategy = 'includes'): boolean => {\r\n try {\r\n if (typeof child !== 'string' && child.props?.children) {\r\n if (Array.isArray(child.props?.children)) {\r\n return !!child.props.children.find((subChild: JSX.Element | string) =>\r\n searchForString(subChild, value, strategy)\r\n );\r\n }\r\n\r\n return searchForString(child.props?.children, value, strategy);\r\n } else {\r\n return child.toString().toLowerCase()[strategy](String(value).toLowerCase());\r\n }\r\n } catch {\r\n return false;\r\n }\r\n};\r\n\r\nconst getIndexInRangeByValue = (\r\n data: ScrollableListItem[],\r\n query: string,\r\n firstIndex: number,\r\n lastIndex: number = data.length\r\n): number => {\r\n const index = data.slice(firstIndex, lastIndex).findIndex(option => {\r\n if (option.disabled) {\r\n return false;\r\n }\r\n\r\n return searchForString(option.text, query, 'startsWith');\r\n });\r\n\r\n return index > -1 ? index + firstIndex : -1;\r\n};\r\n\r\nexport const findNextIndexByValue = (data: ScrollableListItem[], query: string, activeIndex: number | undefined): number => {\r\n const firstIndex = activeIndex === undefined ? 0 : activeIndex + 1;\r\n let index = getIndexInRangeByValue(data, query, firstIndex);\r\n\r\n if (index === -1) {\r\n index = getIndexInRangeByValue(data, query, 0, activeIndex);\r\n }\r\n\r\n return index;\r\n};\r\n\r\nexport const getActiveDescendant = (data: ScrollableListItem[], currentIndex: number | undefined, id: string): any => {\r\n return currentIndex !== undefined && data[currentIndex] ? getId(id, data[currentIndex].value) : undefined;\r\n};\r\n\r\nexport const useFlattenedData = (data: ScrollableListItem[]): ScrollableListItem[] => {\r\n return React.useMemo(() => {\r\n const items: ScrollableListItem[] = [];\r\n\r\n const flatten = (item: ScrollableListItem, path: number, parentPath?: string, parentDisabled?: boolean) => {\r\n const currentPath = parentPath ? `${parentPath}.${path}` : `${path}`;\r\n const isItemDisabled = parentDisabled || item.disabled;\r\n\r\n items.push({\r\n ...item,\r\n disabled: isItemDisabled,\r\n path: currentPath,\r\n hasChildren: !!item.children,\r\n });\r\n\r\n if (item.children) {\r\n item.children.forEach((childItem: ScrollableListItem, childPath: number) =>\r\n flatten(childItem, childPath, currentPath, isItemDisabled)\r\n );\r\n }\r\n };\r\n\r\n data.forEach((item, index) => {\r\n flatten(item, index);\r\n });\r\n\r\n return items;\r\n }, [data]);\r\n};\r\n\r\nexport const sanitizeItem = (item: ScrollableListItem | undefined) => {\r\n if (item) {\r\n const { hasChildren: _1, path: _2, ...rest } = item;\r\n return rest;\r\n }\r\n\r\n return undefined;\r\n};\r\n\r\nexport const getOptionParents = (data: ScrollableListItem[], path?: string) => {\r\n const indexes = path?.split('.') ?? [];\r\n\r\n if (indexes.length > 1) {\r\n // we don't want to map the current item\r\n indexes.pop();\r\n // we need to rebuild the path as we map\r\n let lastPath: string;\r\n\r\n return indexes.map(i => {\r\n lastPath = lastPath ? [lastPath, i].join('.') : i;\r\n return sanitizeItem(data.find((i: ScrollableListItem) => i.path === lastPath));\r\n });\r\n }\r\n\r\n return null;\r\n};\r\n\r\nexport const filterData = (data: ScrollableListItem[], value: ScrollableListItemValue = ''): ScrollableListItem[] => {\r\n if (value === '' || value === null) {\r\n return data;\r\n }\r\n\r\n const filteredOptionValues = new Set();\r\n const shouldFilterOption = (option: ScrollableListItem): boolean => {\r\n if (option.disabled) {\r\n return false;\r\n }\r\n\r\n return searchForString(option.text, String(value));\r\n };\r\n\r\n data.forEach(option => {\r\n if (shouldFilterOption(option)) {\r\n const parents = getOptionParents(data, option.path);\r\n\r\n filteredOptionValues.add(option.value);\r\n\r\n if (parents !== null) {\r\n parents.forEach(option => filteredOptionValues.add(option?.value));\r\n }\r\n }\r\n });\r\n\r\n return data.filter(({ value }) => filteredOptionValues.has(value));\r\n};\r\n"],"names":["getValue","value","String","setInputValueByRef","input","event","setInputValueByRefBase","getIndexFromValue","data","index","findIndex","option","undefined","getSelectedIndexesFromValue","split","map","v","o","filter","findByValue","find","searchForString","child","strategy","props","children","Array","isArray","subChild","toString","toLowerCase","getIndexInRangeByValue","query","firstIndex","lastIndex","length","slice","disabled","text","findNextIndexByValue","activeIndex","getActiveDescendant","currentIndex","id","getId","useFlattenedData","React","useMemo","items","flatten","item","path","parentPath","parentDisabled","currentPath","isItemDisabled","push","hasChildren","forEach","childItem","childPath","sanitizeItem","_1","_2","rest","getOptionParents","indexes","pop","lastPath","i","join","filterData","filteredOptionValues","Set","shouldFilterOption","parents","add","has"],"mappings":";;;;AAIA,MAAMA,QAAQ,GAAIC,KAA0C,IAAaC,MAAM,CAACD,KAAK,aAALA,KAAK,cAALA,KAAK,GAAI,EAAE,CAAC;MAE/EE,kBAAkB,GAAG,CAACC,KAA8B,EAAEH,KAA8B,EAAEI,KAAK,GAAG,QAAQ;EAC/GC,oBAAsB,CAACF,KAAK,EAAEJ,QAAQ,CAACC,KAAK,CAAC,EAAEI,KAAK,CAAC;AACzD;MAEaE,iBAAiB,GAAG,CAACC,IAA0B,EAAEP,KAA0C;EACpG,MAAMQ,KAAK,GAAGD,IAAI,CAACE,SAAS,CAACC,MAAM,IAAIX,QAAQ,CAACW,MAAM,CAACV,KAAK,CAAC,KAAKD,QAAQ,CAACC,KAAK,CAAC,CAAC;EAClF,OAAOQ,KAAK,GAAG,CAAC,CAAC,GAAGA,KAAK,GAAGG,SAAS;AACzC;MAEaC,2BAA2B,GAAG,CAACL,IAA0B,EAAEP,KAA0C;EAC9G,IAAI,OAAOA,KAAK,KAAK,QAAQ,EAAE,OAAO,EAAE;EAExC,OAAOA,KAAK,CACPa,KAAK,CAAC,GAAG,CAAC,CACVC,GAAG,CAACC,CAAC,IAAIR,IAAI,CAACE,SAAS,CAACO,CAAC,IAAIf,MAAM,CAACe,CAAC,CAAChB,KAAK,CAAC,KAAKe,CAAC,CAAC,CAAC,CACpDE,MAAM,CAACF,CAAC,IAAIA,CAAC,KAAK,CAAC,CAAC,CAAC;AAC9B;MAEaG,WAAW,GAAG,CAACX,IAA0B,EAAEP,KAA8B;EAClF,OAAOO,IAAI,CAACY,IAAI,CAACT,MAAM,IAAIX,QA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AoB,GAAG,IAAIC,GAAG,EAAE;EACtC,MAAMC,kBAAkB,GAAI/D,MAA0B;IAClD,IAAIA,MAAM,CAAC0B,QAAQ,EAAE;MACjB,OAAO,KAAK;;IAGhB,OAAOhB,eAAe,CAACV,MAAM,CAAC2B,IAAI,EAAEpC,MAAM,CAACD,KAAK,CAAC,CAAC;GACrD;EAEDO,IAAI,CAACkD,OAAO,CAAC/C,MAAM;IACf,IAAI+D,kBAAkB,CAAC/D,MAAM,CAAC,EAAE;MAC5B,MAAMgE,OAAO,GAAGV,gBAAgB,CAACzD,IAAI,EAAEG,MAAM,CAACwC,IAAI,CAAC;MAEnDqB,oBAAoB,CAACI,GAAG,CAACjE,MAAM,CAACV,KAAK,CAAC;MAEtC,IAAI0E,OAAO,KAAK,IAAI,EAAE;QAClBA,OAAO,CAACjB,OAAO,CAAC/C,MAAM,IAAI6D,oBAAoB,CAACI,GAAG,CAACjE,MAAM,aAANA,MAAM,uBAANA,MAAM,CAAEV,KAAK,CAAC,CAAC;;;GAG7E,CAAC;EAEF,OAAOO,IAAI,CAACU,MAAM,CAAC,CAAC;IAAEjB;GAAO,KAAKuE,oBAAoB,CAACK,GAAG,CAAC5E,KAAK,CAAC,CAAC;AACtE;;;;"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Menu.js","sources":["../../../../../../../src/components/Menu/Menu.tsx"],"sourcesContent":["import * as React from 'react';\nimport * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';\nimport { MenuContext } from './Context';\nimport { Content, MenuContentProps } from './components/Content';\nimport { Item, MenuItemProps } from './components/Item';\nimport { Link, MenuLinkItemProps } from './components/Link';\nimport { Trigger, MenuTriggerProps } from './components/Trigger';\nimport { Checkbox, MenuCheckboxItemProps } from './components/Checkbox';\nimport { ForwardedMenuRadioGroupWithStatics, RadioGroup } from './components/RadioGroup';\nimport { Separator } from './components/Separator';\nimport { Header, MenuHeaderProps } from './components/Header';\n\nexport type MenuProps = {\n children: React.ReactNode;\n id?: string;\n /** A trigger to be used for the menu, should not be set if `children` already contains a trigger */\n trigger?: JSX.Element;\n};\nexport type ForwardedMenuWithStatics = React.ForwardRefExoticComponent<MenuProps & React.RefAttributes<HTMLElement>> & {\n Trigger: React.ForwardRefExoticComponent<MenuTriggerProps>;\n Content: React.ForwardRefExoticComponent<MenuContentProps>;\n Item: React.ForwardRefExoticComponent<MenuItemProps>;\n Link: React.ForwardRefExoticComponent<MenuLinkItemProps>;\n Checkbox: React.ForwardRefExoticComponent<MenuCheckboxItemProps>;\n Separator: React.FunctionComponent;\n Header: React.ForwardRefExoticComponent<MenuHeaderProps>;\n RadioGroup: ForwardedMenuRadioGroupWithStatics;\n};\n\nexport const Menu = React.forwardRef<HTMLButtonElement, MenuProps>(function Menu(externalProps, ref) {\n const { children, trigger, ...props } = externalProps;\n const [open, setOpen] = React.useState(false);\n const [indented, setIndented] = React.useState(false);\n const [minWidth, setMinWidth] = React.useState<number | undefined>(undefined);\n\n const context = React.useMemo(\n () => ({\n indented,\n registerIndentation: () => setIndented(true),\n minWidth,\n setMinWidth: (width: number) => setMinWidth(width),\n close: () => setOpen(false),\n }),\n [indented, minWidth]\n );\n\n return (\n <MenuContext.Provider value={context}>\n <DropdownMenuPrimitive.Root {...props} modal={false} open={open} onOpenChange={setOpen}>\n {trigger && <Trigger ref={ref}>{trigger}</Trigger>}\n {children}\n </DropdownMenuPrimitive.Root>\n </MenuContext.Provider>\n );\n}) as ForwardedMenuWithStatics;\nMenu.Trigger = Trigger;\nMenu.Content = Content;\nMenu.Item = Item;\nMenu.Link = Link;\nMenu.Checkbox = Checkbox;\nMenu.Separator = Separator;\nMenu.Header = Header;\nMenu.RadioGroup = RadioGroup;\n"],"names":["Menu","React","externalProps","ref","children","trigger","props","open","setOpen","indented","setIndented","minWidth","setMinWidth","undefined","context","registerIndentation","width","close","MenuContext","Provider","value","DropdownMenuPrimitive","modal","onOpenChange","Trigger","Content","Item","Link","Checkbox","Separator","Header","RadioGroup"],"mappings":";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AAC8B,MAAM,GAAGA,MAAM;AACpB9B,IAAI,CAAC+B,UAAU,GAAGA,UAAU;;;;"}
|
1
|
+
{"version":3,"file":"Menu.js","sources":["../../../../../../../src/components/Menu/Menu.tsx"],"sourcesContent":["import * as React from 'react';\r\nimport * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';\r\nimport { MenuContext } from './Context';\r\nimport { Content, MenuContentProps } from './components/Content';\r\nimport { Item, MenuItemProps } from './components/Item';\r\nimport { Link, MenuLinkItemProps } from './components/Link';\r\nimport { Trigger, MenuTriggerProps } from './components/Trigger';\r\nimport { Checkbox, MenuCheckboxItemProps } from './components/Checkbox';\r\nimport { ForwardedMenuRadioGroupWithStatics, RadioGroup } from './components/RadioGroup';\r\nimport { Separator } from './components/Separator';\r\nimport { Header, MenuHeaderProps } from './components/Header';\r\n\r\nexport type MenuProps = {\r\n children: React.ReactNode;\r\n id?: string;\r\n /** A trigger to be used for the menu, should not be set if `children` already contains a trigger */\r\n trigger?: JSX.Element;\r\n};\r\nexport type ForwardedMenuWithStatics = React.ForwardRefExoticComponent<MenuProps & React.RefAttributes<HTMLElement>> & {\r\n Trigger: React.ForwardRefExoticComponent<MenuTriggerProps>;\r\n Content: React.ForwardRefExoticComponent<MenuContentProps>;\r\n Item: React.ForwardRefExoticComponent<MenuItemProps>;\r\n Link: React.ForwardRefExoticComponent<MenuLinkItemProps>;\r\n Checkbox: React.ForwardRefExoticComponent<MenuCheckboxItemProps>;\r\n Separator: React.FunctionComponent;\r\n Header: React.ForwardRefExoticComponent<MenuHeaderProps>;\r\n RadioGroup: ForwardedMenuRadioGroupWithStatics;\r\n};\r\n\r\nexport const Menu = React.forwardRef<HTMLButtonElement, MenuProps>(function Menu(externalProps, ref) {\r\n const { children, trigger, ...props } = externalProps;\r\n const [open, setOpen] = React.useState(false);\r\n const [indented, setIndented] = React.useState(false);\r\n const [minWidth, setMinWidth] = React.useState<number | undefined>(undefined);\r\n\r\n const context = React.useMemo(\r\n () => ({\r\n indented,\r\n registerIndentation: () => setIndented(true),\r\n minWidth,\r\n setMinWidth: (width: number) => setMinWidth(width),\r\n close: () => setOpen(false),\r\n }),\r\n [indented, minWidth]\r\n );\r\n\r\n return (\r\n <MenuContext.Provider value={context}>\r\n <DropdownMenuPrimitive.Root {...props} modal={false} open={open} onOpenChange={setOpen}>\r\n {trigger && <Trigger ref={ref}>{trigger}</Trigger>}\r\n {children}\r\n </DropdownMenuPrimitive.Root>\r\n </MenuContext.Provider>\r\n );\r\n}) as ForwardedMenuWithStatics;\r\nMenu.Trigger = Trigger;\r\nMenu.Content = Content;\r\nMenu.Item = Item;\r\nMenu.Link = Link;\r\nMenu.Checkbox = Checkbox;\r\nMenu.Separator = Separator;\r\nMenu.Header = Header;\r\nMenu.RadioGroup = RadioGroup;\r\n"],"names":["Menu","React","externalProps","ref","children","trigger","props","open","setOpen","indented","setIndented","minWidth","setMinWidth","undefined","context","registerIndentation","width","close","MenuContext","Provider","value","DropdownMenuPrimitive","modal","onOpenChange","Trigger","Content","Item","Link","Checkbox","Separator","Header","RadioGroup"],"mappings":";;;;;;;;;;;;MA6BaA,IAAI,gBAAGC,UAAgB,CAA+B,SAASD,IAAI,CAACE,aAAa,EAAEC,GAAG;EAC/F,MAAM;IAAEC,QAAQ;IAAEC,OAAO;IAAE,GAAGC;GAAO,GAAGJ,aAAa;EACrD,MAAM,CAACK,IAAI,EAAEC,OAAO,CAAC,GAAGP,QAAc,CAAC,KAAK,CAAC;EAC7C,MAAM,CAACQ,QAAQ,EAAEC,WAAW,CAAC,GAAGT,QAAc,CAAC,KAAK,CAAC;EACrD,MAAM,CAACU,QAAQ,EAAEC,WAAW,CAAC,GAAGX,QAAc,CAAqBY,SAAS,CAAC;EAE7E,MAAMC,OAAO,GAAGb,OAAa,CACzB,OAAO;IACHQ,QAAQ;IACRM,mBAAmB,EAAE,MAAML,WAAW,CAAC,IAAI,CAAC;IAC5CC,QAAQ;IACRC,WAAW,EAAGI,KAAa,IAAKJ,WAAW,CAACI,KAAK,CAAC;IAClDC,KAAK,EAAE,MAAMT,OAAO,CAAC,KAAK;GAC7B,CAAC,EACF,CAACC,QAAQ,EAAEE,QAAQ,CAAC,CACvB;EAED,oBACIV,cAACiB,WAAW,CAACC,QAAQ;IAACC,KAAK,EAAEN;kBACzBb,cAACoB,IAA0B,oBAAKf,KAAK;IAAEgB,KAAK,EAAE,KAAK;IAAEf,IAAI,EAAEA,IAAI;IAAEgB,YAAY,EAAEf;MAC1EH,OAAO,iBAAIJ,cAACuB,OAAO;IAACrB,GAAG,EAAEA;KAAME,OAAO,CAAW,EACjDD,QAAQ,CACgB,CACV;AAE/B,CAAC;AACDJ,IAAI,CAACwB,OAAO,GAAGA,OAAO;AACtBxB,IAAI,CAACyB,OAAO,GAAGA,OAAO;AACtBzB,IAAI,CAAC0B,IAAI,GAAGA,IAAI;AAChB1B,IAAI,CAAC2B,IAAI,GAAGA,IAAI;AAChB3B,IAAI,CAAC4B,QAAQ,GAAGA,QAAQ;AACxB5B,IAAI,CAAC6B,SAAS,GAAGA,SAAS;AAC1B7B,IAAI,CAAC8B,MAAM,GAAGA,MAAM;AACpB9B,IAAI,CAAC+B,UAAU,GAAGA,UAAU;;;;"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Checkbox.js","sources":["../../../../../../../../src/components/Menu/components/Checkbox.tsx"],"sourcesContent":["import * as React from 'react';\nimport * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';\nimport { Icon } from '../../Icon/Icon';\nimport { useItemStyling } from './Item';\n\nexport type MenuCheckboxItemProps = Omit<React.HTMLAttributes<HTMLDivElement>, 'onSelect'> & {\n /* Whether the checkbox item is disabled */\n disabled?: boolean;\n /* The current checked state (controlled) */\n checked: boolean;\n /* Handler called when the checked state changes */\n onChange: (checked: boolean | 'indeterminate') => void;\n};\n\nexport const Checkbox = React.forwardRef<HTMLDivElement, MenuCheckboxItemProps>(function MenuCheckboxItem(props, ref) {\n const { checked, children, onChange, ...otherProps } = props;\n const className = useItemStyling({\n disabled: props.disabled,\n indented: true,\n className: props.className,\n });\n\n return (\n <DropdownMenuPrimitive.CheckboxItem\n {...otherProps}\n checked={checked}\n className={className}\n onCheckedChange={onChange}\n ref={ref}>\n <DropdownMenuPrimitive.ItemIndicator className=\"absolute left-0 ml-1.5\">\n <Icon name=\"tick\" className=\"-ml-px !h-4 !w-4\" />\n </DropdownMenuPrimitive.ItemIndicator>\n {children}\n </DropdownMenuPrimitive.CheckboxItem>\n );\n});\n"],"names":["Checkbox","React","MenuCheckboxItem","props","ref","checked","children","onChange","otherProps","className","useItemStyling","disabled","indented","DropdownMenuPrimitive","onCheckedChange","Icon","name"],"mappings":";;;;;MAcaA,QAAQ,gBAAGC,UAAgB,CAAwC,SAASC,gBAAgB,CAACC,KAAK,EAAEC,GAAG;EAChH,MAAM;IAAEC,OAAO;IAAEC,QAAQ;IAAEC,QAAQ;IAAE,GAAGC;GAAY,GAAGL,KAAK;EAC5D,MAAMM,SAAS,GAAGC,cAAc,CAAC;IAC7BC,QAAQ,EAAER,KAAK,CAACQ,QAAQ;IACxBC,QAAQ,EAAE,IAAI;IACdH,SAAS,EAAEN,KAAK,CAACM;GACpB,CAAC;EAEF,oBACIR,cAACY,YAAkC,oBAC3BL,UAAU;IACdH,OAAO,EAAEA,OAAO;IAChBI,SAAS,EAAEA,SAAS;IACpBK,eAAe,EAAEP,QAAQ;IACzBH,GAAG,EAAEA;mBACLH,cAACY,aAAmC;IAACJ,SAAS,EAAC;kBAC3CR,cAACc,IAAI;IAACC,IAAI,EAAC,MAAM;IAACP,SAAS,EAAC;IAAqB,CACf,EACrCH,QAAQ,CACwB;AAE7C,CAAC;;;;"}
|
1
|
+
{"version":3,"file":"Checkbox.js","sources":["../../../../../../../../src/components/Menu/components/Checkbox.tsx"],"sourcesContent":["import * as React from 'react';\r\nimport * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';\r\nimport { Icon } from '../../Icon/Icon';\r\nimport { useItemStyling } from './Item';\r\n\r\nexport type MenuCheckboxItemProps = Omit<React.HTMLAttributes<HTMLDivElement>, 'onSelect'> & {\r\n /* Whether the checkbox item is disabled */\r\n disabled?: boolean;\r\n /* The current checked state (controlled) */\r\n checked: boolean;\r\n /* Handler called when the checked state changes */\r\n onChange: (checked: boolean | 'indeterminate') => void;\r\n};\r\n\r\nexport const Checkbox = React.forwardRef<HTMLDivElement, MenuCheckboxItemProps>(function MenuCheckboxItem(props, ref) {\r\n const { checked, children, onChange, ...otherProps } = props;\r\n const className = useItemStyling({\r\n disabled: props.disabled,\r\n indented: true,\r\n className: props.className,\r\n });\r\n\r\n return (\r\n <DropdownMenuPrimitive.CheckboxItem\r\n {...otherProps}\r\n checked={checked}\r\n className={className}\r\n onCheckedChange={onChange}\r\n ref={ref}>\r\n <DropdownMenuPrimitive.ItemIndicator className=\"absolute left-0 ml-1.5\">\r\n <Icon name=\"tick\" className=\"-ml-px !h-4 !w-4\" />\r\n </DropdownMenuPrimitive.ItemIndicator>\r\n {children}\r\n </DropdownMenuPrimitive.CheckboxItem>\r\n );\r\n});\r\n"],"names":["Checkbox","React","MenuCheckboxItem","props","ref","checked","children","onChange","otherProps","className","useItemStyling","disabled","indented","DropdownMenuPrimitive","onCheckedChange","Icon","name"],"mappings":";;;;;MAcaA,QAAQ,gBAAGC,UAAgB,CAAwC,SAASC,gBAAgB,CAACC,KAAK,EAAEC,GAAG;EAChH,MAAM;IAAEC,OAAO;IAAEC,QAAQ;IAAEC,QAAQ;IAAE,GAAGC;GAAY,GAAGL,KAAK;EAC5D,MAAMM,SAAS,GAAGC,cAAc,CAAC;IAC7BC,QAAQ,EAAER,KAAK,CAACQ,QAAQ;IACxBC,QAAQ,EAAE,IAAI;IACdH,SAAS,EAAEN,KAAK,CAACM;GACpB,CAAC;EAEF,oBACIR,cAACY,YAAkC,oBAC3BL,UAAU;IACdH,OAAO,EAAEA,OAAO;IAChBI,SAAS,EAAEA,SAAS;IACpBK,eAAe,EAAEP,QAAQ;IACzBH,GAAG,EAAEA;mBACLH,cAACY,aAAmC;IAACJ,SAAS,EAAC;kBAC3CR,cAACc,IAAI;IAACC,IAAI,EAAC,MAAM;IAACP,SAAS,EAAC;IAAqB,CACf,EACrCH,QAAQ,CACwB;AAE7C,CAAC;;;;"}
|
@@ -1,11 +1,11 @@
|
|
1
1
|
import { forwardRef, createElement } from 'react';
|
2
2
|
import cn from 'classnames';
|
3
|
-
import {
|
3
|
+
import { useMergedRef } from '../../../hooks/useMergedRef.js';
|
4
4
|
import { Portal, Content as Content$1 } from '@radix-ui/react-dropdown-menu';
|
5
5
|
import { useCurrentMenu } from '../Context.js';
|
6
6
|
|
7
7
|
const Content = /*#__PURE__*/forwardRef(function MenuContent(props, ref) {
|
8
|
-
const internalRef =
|
8
|
+
const internalRef = useMergedRef(ref);
|
9
9
|
const menu = useCurrentMenu();
|
10
10
|
const {
|
11
11
|
children,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Content.js","sources":["../../../../../../../../src/components/Menu/components/Content.tsx"],"sourcesContent":["import * as React from 'react';\nimport * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';\nimport cn from 'classnames';\nimport { Placement } from '../../../types';\nimport {
|
1
|
+
{"version":3,"file":"Content.js","sources":["../../../../../../../../src/components/Menu/components/Content.tsx"],"sourcesContent":["import * as React from 'react';\r\nimport * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';\r\nimport cn from 'classnames';\r\nimport { Placement } from '../../../types';\r\nimport { useMergedRef } from '../../../hooks/useMergedRef';\r\nimport { useCurrentMenu } from '../Context';\r\n\r\nexport type MenuContentProps = Omit<DropdownMenuPrimitive.DropdownMenuContentProps, 'children' | 'side'> & {\r\n children: React.ReactNode;\r\n /** Set the position of the Menu relative to its trigger. Default value is `bottom` */\r\n placement?: Placement;\r\n};\r\n\r\nexport const Content = React.forwardRef(function MenuContent(props: MenuContentProps, ref: React.Ref<HTMLDivElement>) {\r\n const internalRef = useMergedRef<any>(ref);\r\n const menu = useCurrentMenu();\r\n const { children, placement: side, ...otherProps } = props;\r\n const className = cn('border rounded block outline-none p-1 wcag-white border-grey yt-shadow', props.className);\r\n\r\n return (\r\n <DropdownMenuPrimitive.Portal>\r\n <DropdownMenuPrimitive.Content\r\n {...otherProps}\r\n align=\"start\"\r\n className={className}\r\n data-taco=\"menu\"\r\n side={side}\r\n sideOffset={2}\r\n style={{ minWidth: menu?.minWidth }}\r\n ref={internalRef}>\r\n {children}\r\n </DropdownMenuPrimitive.Content>\r\n </DropdownMenuPrimitive.Portal>\r\n );\r\n});\r\n"],"names":["Content","React","MenuContent","props","ref","internalRef","useMergedRef","menu","useCurrentMenu","children","placement","side","otherProps","className","cn","DropdownMenuPrimitive","align","sideOffset","style","minWidth"],"mappings":";;;;;;MAaaA,OAAO,gBAAGC,UAAgB,CAAC,SAASC,WAAW,CAACC,KAAuB,EAAEC,GAA8B;EAChH,MAAMC,WAAW,GAAGC,YAAY,CAAMF,GAAG,CAAC;EAC1C,MAAMG,IAAI,GAAGC,cAAc,EAAE;EAC7B,MAAM;IAAEC,QAAQ;IAAEC,SAAS,EAAEC,IAAI;IAAE,GAAGC;GAAY,GAAGT,KAAK;EAC1D,MAAMU,SAAS,GAAGC,EAAE,CAAC,wEAAwE,EAAEX,KAAK,CAACU,SAAS,CAAC;EAE/G,oBACIZ,cAACc,MAA4B,qBACzBd,cAACc,SAA6B,oBACtBH,UAAU;IACdI,KAAK,EAAC,OAAO;IACbH,SAAS,EAAEA,SAAS;iBACV,MAAM;IAChBF,IAAI,EAAEA,IAAI;IACVM,UAAU,EAAE,CAAC;IACbC,KAAK,EAAE;MAAEC,QAAQ,EAAEZ,IAAI,aAAJA,IAAI,uBAAJA,IAAI,CAAEY;KAAU;IACnCf,GAAG,EAAEC;MACJI,QAAQ,CACmB,CACL;AAEvC,CAAC;;;;"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Header.js","sources":["../../../../../../../../src/components/Menu/components/Header.tsx"],"sourcesContent":["import * as React from 'react';\nimport * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';\nimport cn from 'classnames';\nimport { useCurrentMenu } from '../Context';\n\nexport type MenuHeaderProps = React.HTMLAttributes<HTMLDivElement>;\n\nexport const Header = React.forwardRef<HTMLDivElement, MenuHeaderProps>(function MenuHeader(props, ref) {\n const menu = useCurrentMenu();\n const className = cn(\n 'flex items-center justify-start h-7 pr-1.5 text-xs text-grey-darkest',\n {\n 'pl-7': menu?.indented,\n 'pl-1.5': !menu?.indented,\n },\n props.className\n );\n\n return <DropdownMenuPrimitive.Label {...props} className={className} ref={ref} />;\n});\n"],"names":["Header","React","MenuHeader","props","ref","menu","useCurrentMenu","className","cn","indented","DropdownMenuPrimitive"],"mappings":";;;;;MAOaA,MAAM,gBAAGC,UAAgB,CAAkC,SAASC,UAAU,CAACC,KAAK,EAAEC,GAAG;EAClG,MAAMC,IAAI,GAAGC,cAAc,EAAE;EAC7B,MAAMC,SAAS,GAAGC,EAAE,CAChB,sEAAsE,EACtE;IACI,MAAM,EAAEH,IAAI,aAAJA,IAAI,uBAAJA,IAAI,CAAEI,QAAQ;IACtB,QAAQ,EAAE,EAACJ,IAAI,aAAJA,IAAI,eAAJA,IAAI,CAAEI,QAAQ;GAC5B,EACDN,KAAK,CAACI,SAAS,CAClB;EAED,oBAAON,cAACS,KAA2B,oBAAKP,KAAK;IAAEI,SAAS,EAAEA,SAAS;IAAEH,GAAG,EAAEA;KAAO;AACrF,CAAC;;;;"}
|
1
|
+
{"version":3,"file":"Header.js","sources":["../../../../../../../../src/components/Menu/components/Header.tsx"],"sourcesContent":["import * as React from 'react';\r\nimport * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';\r\nimport cn from 'classnames';\r\nimport { useCurrentMenu } from '../Context';\r\n\r\nexport type MenuHeaderProps = React.HTMLAttributes<HTMLDivElement>;\r\n\r\nexport const Header = React.forwardRef<HTMLDivElement, MenuHeaderProps>(function MenuHeader(props, ref) {\r\n const menu = useCurrentMenu();\r\n const className = cn(\r\n 'flex items-center justify-start h-7 pr-1.5 text-xs text-grey-darkest',\r\n {\r\n 'pl-7': menu?.indented,\r\n 'pl-1.5': !menu?.indented,\r\n },\r\n props.className\r\n );\r\n\r\n return <DropdownMenuPrimitive.Label {...props} className={className} ref={ref} />;\r\n});\r\n"],"names":["Header","React","MenuHeader","props","ref","menu","useCurrentMenu","className","cn","indented","DropdownMenuPrimitive"],"mappings":";;;;;MAOaA,MAAM,gBAAGC,UAAgB,CAAkC,SAASC,UAAU,CAACC,KAAK,EAAEC,GAAG;EAClG,MAAMC,IAAI,GAAGC,cAAc,EAAE;EAC7B,MAAMC,SAAS,GAAGC,EAAE,CAChB,sEAAsE,EACtE;IACI,MAAM,EAAEH,IAAI,aAAJA,IAAI,uBAAJA,IAAI,CAAEI,QAAQ;IACtB,QAAQ,EAAE,EAACJ,IAAI,aAAJA,IAAI,eAAJA,IAAI,CAAEI,QAAQ;GAC5B,EACDN,KAAK,CAACI,SAAS,CAClB;EAED,oBAAON,cAACS,KAA2B,oBAAKP,KAAK;IAAEI,SAAS,EAAEA,SAAS;IAAEH,GAAG,EAAEA;KAAO;AACrF,CAAC;;;;"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Item.js","sources":["../../../../../../../../src/components/Menu/components/Item.tsx"],"sourcesContent":["import * as React from 'react';\nimport * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';\nimport cn from 'classnames';\nimport { IconName } from '../../Icon/Icon';\nimport { Icon as IconPrimitive } from '../../Icon/Icon';\nimport { useCurrentMenu } from '../Context';\nimport { DialogProps } from '../../Dialog/Dialog';\n\nexport const Icon = ({ name }) => (\n <span className=\"absolute left-0 ml-1\">\n <IconPrimitive className=\"-ml-px -mt-px !h-5 !w-5\" name={name} />\n </span>\n);\n\nexport const useItemStyling = ({ disabled, indented, className }) => {\n const menu = useCurrentMenu();\n\n React.useEffect(() => {\n if (indented && !menu?.indented) {\n menu?.registerIndentation();\n }\n }, [indented]);\n\n return cn(\n 'flex items-center justify-start h-8 pr-1.5 relative rounded w-full focus:outline-none group',\n {\n 'pl-7': menu?.indented,\n 'pl-1.5': !menu?.indented,\n 'cursor-pointer hover:bg-grey-light text-black hover:text-black': !disabled,\n 'cursor-not-allowed hover:bg-white text-grey-dark': disabled,\n },\n className\n );\n};\n\nexport const Shortcut = props => {\n return <span {...props} className=\"text-grey-darkest ml-auto pl-3\" />;\n};\n\nexport type MenuItemProps = Omit<React.HTMLAttributes<HTMLDivElement>, 'onSelect'> & {\n dialog?: (props: Partial<DialogProps>) => JSX.Element;\n disabled?: boolean;\n icon?: IconName;\n onClick?: (event: React.MouseEvent<HTMLDivElement, MouseEvent>) => void;\n shortcut?: string;\n};\n\nexport const Item = React.forwardRef(function MenuItem(props: MenuItemProps, ref: React.Ref<HTMLDivElement>) {\n const { dialog, icon, onClick, shortcut, ...otherProps } = props;\n const menu = useCurrentMenu();\n const className = useItemStyling({\n disabled: props.disabled,\n indented: !!icon,\n className: props.className,\n });\n\n const disabled = props.disabled ?? props['aria-disabled'];\n\n let handleClick;\n\n // radix has a bug that does not disable clicks when disabled is set on items\n if (disabled) {\n handleClick = event => {\n event.preventDefault();\n event.stopPropagation();\n };\n }\n\n const handleSelect = event => {\n if (onClick) {\n onClick(event);\n }\n\n if (props['aria-haspopup'] || typeof dialog === 'function') {\n event.preventDefault();\n }\n };\n\n let button = (\n <DropdownMenuPrimitive.Item {...otherProps} className={className} onClick={handleClick} onSelect={handleSelect} ref={ref}>\n {icon && <Icon name={icon} />}\n {props.children}\n {shortcut && <Shortcut>{shortcut}</Shortcut>}\n </DropdownMenuPrimitive.Item>\n );\n\n if (typeof dialog === 'function') {\n button = dialog({ trigger: button, onClose: menu?.close });\n }\n\n return button;\n});\n"],"names":["Icon","name","React","className","IconPrimitive","useItemStyling","disabled","indented","menu","useCurrentMenu","registerIndentation","cn","Shortcut","props","Item","MenuItem","ref","dialog","icon","onClick","shortcut","otherProps","handleClick","event","preventDefault","stop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CAACV;GACpB,CAAC;EAEF,MAAMG,QAAQ,sBAAGO,KAAK,CAACP,QAAQ,6DAAIO,KAAK,CAAC,eAAe,CAAC;EAEzD,IAAIS,WAAW;;EAGf,IAAIhB,QAAQ,EAAE;IACVgB,WAAW,GAAGC,KAAK;MACfA,KAAK,CAACC,cAAc,EAAE;MACtBD,KAAK,CAACE,eAAe,EAAE;KAC1B;;EAGL,MAAMC,YAAY,GAAGH,KAAK;IACtB,IAAIJ,OAAO,EAAE;MACTA,OAAO,CAACI,KAAK,CAAC;;IAGlB,IAAIV,KAAK,CAAC,eAAe,CAAC,IAAI,OAAOI,MAAM,KAAK,UAAU,EAAE;MACxDM,KAAK,CAACC,cAAc,EAAE;;GAE7B;EAED,IAAIG,MAAM,gBACNzB,cAAC0B,MAA0B,oBAAKP,UAAU;IAAElB,SAAS,EAAEA,SAAS;IAAEgB,OAAO,EAAEG,WAAW;IAAEO,QAAQ,EAAEH,YAAY;IAAEV,GAAG,EAAEA;MAChHE,IAAI,iBAAIhB,cAACF,IAAI;IAACC,IAAI,EAAEiB;IAAQ,EAC5BL,KAAK,CAACiB,QAAQ,EACdV,QAAQ,iBAAIlB,cAACU,QAAQ,QAAEQ,QAAQ,CAAY,CAEnD;EAED,IAAI,OAAOH,MAAM,KAAK,UAAU,EAAE;IAC9BU,MAAM,GAAGV,MAAM,CAAC;MAAEc,OAAO,EAAEJ,MAAM;MAAEK,OAAO,EAAExB,IAAI,aAAJA,IAAI,uBAAJA,IAAI,CAAEyB;KAAO,CAAC;;EAG9D,OAAON,MAAM;AACjB,CAAC;;;;"}
|
1
|
+
{"version":3,"file":"Item.js","sources":["../../../../../../../../src/components/Menu/components/Item.tsx"],"sourcesContent":["import * as React from 'react';\r\nimport * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';\r\nimport cn from 'classnames';\r\nimport { IconName } from '../../Icon/Icon';\r\nimport { Icon as IconPrimitive } from '../../Icon/Icon';\r\nimport { useCurrentMenu } from '../Context';\r\nimport { DialogProps } from '../../Dialog/Dialog';\r\n\r\nexport const Icon = ({ name }) => (\r\n <span className=\"absolute left-0 ml-1\">\r\n <IconPrimitive className=\"-ml-px -mt-px !h-5 !w-5\" name={name} />\r\n </span>\r\n);\r\n\r\nexport const useItemStyling = ({ disabled, indented, className }) => {\r\n const menu = useCurrentMenu();\r\n\r\n React.useEffect(() => {\r\n if (indented && !menu?.indented) {\r\n menu?.registerIndentation();\r\n }\r\n }, [indented]);\r\n\r\n return cn(\r\n 'flex items-center justify-start h-8 pr-1.5 relative rounded w-full focus:outline-none group',\r\n {\r\n 'pl-7': menu?.indented,\r\n 'pl-1.5': !menu?.indented,\r\n 'cursor-pointer hover:bg-grey-light text-black hover:text-black': !disabled,\r\n 'cursor-not-allowed hover:bg-white text-grey-dark': disabled,\r\n },\r\n className\r\n );\r\n};\r\n\r\nexport const Shortcut = props => {\r\n return <span {...props} className=\"text-grey-darkest ml-auto pl-3\" />;\r\n};\r\n\r\nexport type MenuItemProps = Omit<React.HTMLAttributes<HTMLDivElement>, 'onSelect'> & {\r\n dialog?: (props: Partial<DialogProps>) => JSX.Element;\r\n disabled?: boolean;\r\n icon?: IconName;\r\n onClick?: (event: React.MouseEvent<HTMLDivElement, MouseEvent>) => void;\r\n shortcut?: string;\r\n};\r\n\r\nexport const Item = React.forwardRef(function MenuItem(props: MenuItemProps, ref: React.Ref<HTMLDivElement>) {\r\n const { dialog, icon, onClick, shortcut, ...otherProps } = props;\r\n const menu = useCurrentMenu();\r\n const className = useItemStyling({\r\n disabled: props.disabled,\r\n indented: !!icon,\r\n className: props.className,\r\n });\r\n\r\n const disabled = props.disabled ?? props['aria-disabled'];\r\n\r\n let handleClick;\r\n\r\n // radix has a bug that does not disable clicks when disabled is set on items\r\n if (disabled) {\r\n handleClick = event => {\r\n event.preventDefault();\r\n event.stopPropagation();\r\n };\r\n }\r\n\r\n const handleSelect = event => {\r\n if (onClick) {\r\n onClick(event);\r\n }\r\n\r\n if (props['aria-haspopup'] || typeof dialog === 'function') {\r\n event.preventDefault();\r\n }\r\n };\r\n\r\n let button = (\r\n <DropdownMenuPrimitive.Item {...otherProps} className={className} onClick={handleClick} onSelect={handleSelect} ref={ref}>\r\n {icon && <Icon name={icon} />}\r\n {props.children}\r\n {shortcut && <Shortcut>{shortcut}</Shortcut>}\r\n </DropdownMenuPrimitive.Item>\r\n );\r\n\r\n if (typeof dialog === 'function') {\r\n button = dialog({ trigger: button, onClose: menu?.close });\r\n }\r\n\r\n return button;\r\n});\r\n"],"names":["Icon","name","React","className","IconPrimitive","useItemStyling","disabled","indented","menu","useCurrentMenu","registerIndentation","cn","Shortcut","props","Item","MenuItem","ref","dialog","icon","onClick","shortcut","otherProps","handleClick","event","preventDefault","stopPropagation","handleSelect","button","DropdownMenuPrimitive","onSelect","children","trigger","onClose","close"],"mappings":";;;;;;MAQaA,IAAI,GAAG,CAAC;EAAEC;CAAM,kBACzBC;EAAMC,SAAS,EAAC;gBACZD,cAACE,MAAa;EAACD,SAAS,EAAC,yBAAyB;EAACF,IAAI,EAAEA;EAAQ;MAI5DI,cAAc,GAAG,CAAC;EAAEC,QAAQ;EAAEC,QAAQ;EAAEJ;CAAW;EAC5D,MAAMK,IAAI,GAAGC,cAAc,EAAE;EAE7BP,SAAe,CAAC;IACZ,IAAIK,QAAQ,IAAI,EAACC,IAAI,aAAJA,IAAI,eAAJA,IAAI,CAAED,QAAQ,GAAE;MAC7BC,IAAI,aAAJA,IAAI,uBAAJA,IAAI,CAAEE,mBAAmB,EAAE;;GAElC,EAAE,CAACH,QAAQ,CAAC,CAAC;EAEd,OAAOI,EAAE,CACL,6FAA6F,EAC7F;IACI,MAAM,EAAEH,IAAI,aAAJA,IAAI,uBAAJA,IAAI,CAAED,QAAQ;IACtB,QAAQ,EAAE,EAACC,IAAI,aAAJA,IAAI,eAAJA,IAAI,CAAED,QAAQ;IACzB,gEAAgE,EAAE,CAACD,QAAQ;IAC3E,kDAAkD,EAAEA;GACvD,EACDH,SAAS,CACZ;AAC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OH,MAAM,KAAK,UAAU,EAAE;IAC9BU,MAAM,GAAGV,MAAM,CAAC;MAAEc,OAAO,EAAEJ,MAAM;MAAEK,OAAO,EAAExB,IAAI,aAAJA,IAAI,uBAAJA,IAAI,CAAEyB;KAAO,CAAC;;EAG9D,OAAON,MAAM;AACjB,CAAC;;;;"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"RadioGroup.js","sources":["../../../../../../../../src/components/Menu/components/RadioGroup.tsx"],"sourcesContent":["import * as React from 'react';\nimport * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';\nimport cn from 'classnames';\nimport { getRadioGroupItemValueAsString, RadioGroupItemProps, RadioGroupProps, useRadioGroup } from '../../RadioGroup/RadioGroup';\nimport { useItemStyling } from './Item';\n\nexport type MenuRadioGroupItemProps = RadioGroupItemProps<HTMLDivElement>;\n\nexport const RadioItem = (props: MenuRadioGroupItemProps) => {\n const context = React.useContext(MenuRadioGroupContext);\n const { children, value, ...otherProps } = props;\n const disabled = context.disabled || props.disabled;\n const className = useItemStyling({\n disabled: disabled,\n indented: true,\n className: props.className,\n });\n\n return (\n <DropdownMenuPrimitive.RadioItem\n {...otherProps}\n className={className}\n disabled={disabled}\n value={getRadioGroupItemValueAsString(value)}>\n <DropdownMenuPrimitive.ItemIndicator className=\"absolute left-0 ml-1.5\">\n <span className=\"ml-1 flex h-1.5 w-1.5 rounded-full bg-current \" />\n </DropdownMenuPrimitive.ItemIndicator>\n {children}\n </DropdownMenuPrimitive.RadioItem>\n );\n};\n\nconst MenuRadioGroupContext = React.createContext({ disabled: false });\n\nexport type MenuRadioGroupProps = RadioGroupProps;\n\nexport type ForwardedMenuRadioGroupWithStatics = React.ForwardRefExoticComponent<\n MenuRadioGroupProps & React.RefAttributes<HTMLElement>\n> & {\n Item: React.FunctionComponent<MenuRadioGroupItemProps>;\n};\n\nexport const RadioGroup = React.forwardRef<HTMLDivElement, MenuRadioGroupProps>(function MenuRadioItem(props, ref) {\n const { context, props: otherProps } = useRadioGroup(props);\n const className = cn('flex flex-col', props.className);\n\n return (\n <MenuRadioGroupContext.Provider value={context}>\n <DropdownMenuPrimitive.RadioGroup {...otherProps} className={className} ref={ref} />\n </MenuRadioGroupContext.Provider>\n );\n}) as ForwardedMenuRadioGroupWithStatics;\nRadioGroup.Item = RadioItem;\n"],"names":["RadioItem","props","context","React","MenuRadioGroupContext","children","value","otherProps","disabled","className","useItemStyling","indented","DropdownMenuPrimitive","getRadioGroupItemValueAsString","RadioGroup","MenuRadioItem","ref","useRadioGroup","cn","Provider","Item"],"mappings":";;;;;;MAQaA,SAAS,GAAIC,KAA8B;EACpD,MAAMC,OAAO,GAAGC,UAAgB,CAACC,qBAAqB,CAAC;EACvD,MAAM;IAAEC,QAAQ;IAAEC,KAAK;IAAE,GAAGC;GAAY,GAAGN,KAAK;EAChD,MAAMO,QAAQ,GAAGN,OAAO,CAACM,QAAQ,IAAIP,KAAK,CAACO,QAAQ;EACnD,MAAMC,SAAS,GAAGC,cAAc,CAAC;IAC7BF,QAAQ,EAAEA,QAAQ;IAClBG,QAAQ,EAAE,IAAI;IACdF,SAAS,EAAER,KAAK,CAACQ;GACpB,CAAC;EAEF,oBACIN,cAACS,WAA+B,oBACxBL,UAAU;IACdE,SAAS,EAAEA,SAAS;IACpBD,QAAQ,EAAEA,QAAQ;IAClBF,KAAK,EAAEO,8BAA8B,CAACP,KAAK;mBAC3CH,cAACS,aAAmC;IAACH,SAAS,EAAC;kBAC3CN;IAAMM,SAAS,EAAC;IAAmD,CACjC,EACrCJ,QAAQ,CACqB;AAE1C;AAEA,MAAMD,qBAAqB,gBAAGD,aAAmB,CAAC;EAAEK,QAAQ,EAAE;CAAO,CAAC;MAUzDM,UAAU,gBAAGX,UAAgB,CAAsC,SAASY,aAAa,CAACd,KAAK,EAAEe,GAAG;EAC7G,MAAM;IAAEd,OAAO;IAAED,KAAK,EAAEM;GAAY,GAAGU,aAAa,CAAChB,KAAK,CAAC;EAC3D,MAAMQ,SAAS,GAAGS,EAAE,CAAC,eAAe,EAAEjB,KAAK,CAACQ,SAAS,CAAC;EAEtD,oBACIN,cAACC,qBAAqB,CAACe,QAAQ;IAACb,KAAK,EAAEJ;kBACnCC,cAACS,YAAgC,oBAAKL,UAAU;IAAEE,SAAS,EAAEA,SAAS;IAAEO,GAAG,EAAEA;KAAO,CACvD;AAEzC,CAAC;AACDF,UAAU,CAACM,IAAI,GAAGpB,SAAS;;;;"}
|
1
|
+
{"version":3,"file":"RadioGroup.js","sources":["../../../../../../../../src/components/Menu/components/RadioGroup.tsx"],"sourcesContent":["import * as React from 'react';\r\nimport * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';\r\nimport cn from 'classnames';\r\nimport { getRadioGroupItemValueAsString, RadioGroupItemProps, RadioGroupProps, useRadioGroup } from '../../RadioGroup/RadioGroup';\r\nimport { useItemStyling } from './Item';\r\n\r\nexport type MenuRadioGroupItemProps = RadioGroupItemProps<HTMLDivElement>;\r\n\r\nexport const RadioItem = (props: MenuRadioGroupItemProps) => {\r\n const context = React.useContext(MenuRadioGroupContext);\r\n const { children, value, ...otherProps } = props;\r\n const disabled = context.disabled || props.disabled;\r\n const className = useItemStyling({\r\n disabled: disabled,\r\n indented: true,\r\n className: props.className,\r\n });\r\n\r\n return (\r\n <DropdownMenuPrimitive.RadioItem\r\n {...otherProps}\r\n className={className}\r\n disabled={disabled}\r\n value={getRadioGroupItemValueAsString(value)}>\r\n <DropdownMenuPrimitive.ItemIndicator className=\"absolute left-0 ml-1.5\">\r\n <span className=\"ml-1 flex h-1.5 w-1.5 rounded-full bg-current \" />\r\n </DropdownMenuPrimitive.ItemIndicator>\r\n {children}\r\n </DropdownMenuPrimitive.RadioItem>\r\n );\r\n};\r\n\r\nconst MenuRadioGroupContext = React.createContext({ disabled: false });\r\n\r\nexport type MenuRadioGroupProps = RadioGroupProps;\r\n\r\nexport type ForwardedMenuRadioGroupWithStatics = React.ForwardRefExoticComponent<\r\n MenuRadioGroupProps & React.RefAttributes<HTMLElement>\r\n> & {\r\n Item: React.FunctionComponent<MenuRadioGroupItemProps>;\r\n};\r\n\r\nexport const RadioGroup = React.forwardRef<HTMLDivElement, MenuRadioGroupProps>(function MenuRadioItem(props, ref) {\r\n const { context, props: otherProps } = useRadioGroup(props);\r\n const className = cn('flex flex-col', props.className);\r\n\r\n return (\r\n <MenuRadioGroupContext.Provider value={context}>\r\n <DropdownMenuPrimitive.RadioGroup {...otherProps} className={className} ref={ref} />\r\n </MenuRadioGroupContext.Provider>\r\n );\r\n}) as ForwardedMenuRadioGroupWithStatics;\r\nRadioGroup.Item = RadioItem;\r\n"],"names":["RadioItem","props","context","React","MenuRadioGroupContext","children","value","otherProps","disabled","className","useItemStyling","indented","DropdownMenuPrimitive","getRadioGroupItemValueAsString","RadioGroup","MenuRadioItem","ref","useRadioGroup","cn","Provider","Item"],"mappings":";;;;;;MAQaA,SAAS,GAAIC,KAA8B;EACpD,MAAMC,OAAO,GAAGC,UAAgB,CAACC,qBAAqB,CAAC;EACvD,MAAM;IAAEC,QAAQ;IAAEC,KAAK;IAAE,GAAGC;GAAY,GAAGN,KAAK;EAChD,MAAMO,QAAQ,GAAGN,OAAO,CAACM,QAAQ,IAAIP,KAAK,CAACO,QAAQ;EACnD,MAAMC,SAAS,GAAGC,cAAc,CAAC;IAC7BF,QAAQ,EAAEA,QAAQ;IAClBG,QAAQ,EAAE,IAAI;IACdF,SAAS,EAAER,KAAK,CAACQ;GACpB,CAAC;EAEF,oBACIN,cAACS,WAA+B,oBACxBL,UAAU;IACdE,SAAS,EAAEA,SAAS;IACpBD,QAAQ,EAAEA,QAAQ;IAClBF,KAAK,EAAEO,8BAA8B,CAACP,KAAK;mBAC3CH,cAACS,aAAmC;IAACH,SAAS,EAAC;kBAC3CN;IAAMM,SAAS,EAAC;IAAmD,CACjC,EACrCJ,QAAQ,CACqB;AAE1C;AAEA,MAAMD,qBAAqB,gBAAGD,aAAmB,CAAC;EAAEK,QAAQ,EAAE;CAAO,CAAC;MAUzDM,UAAU,gBAAGX,UAAgB,CAAsC,SAASY,aAAa,CAACd,KAAK,EAAEe,GAAG;EAC7G,MAAM;IAAEd,OAAO;IAAED,KAAK,EAAEM;GAAY,GAAGU,aAAa,CAAChB,KAAK,CAAC;EAC3D,MAAMQ,SAAS,GAAGS,EAAE,CAAC,eAAe,EAAEjB,KAAK,CAACQ,SAAS,CAAC;EAEtD,oBACIN,cAACC,qBAAqB,CAACe,QAAQ;IAACb,KAAK,EAAEJ;kBACnCC,cAACS,YAAgC,oBAAKL,UAAU;IAAEE,SAAS,EAAEA,SAAS;IAAEO,GAAG,EAAEA;KAAO,CACvD;AAEzC,CAAC;AACDF,UAAU,CAACM,IAAI,GAAGpB,SAAS;;;;"}
|
@@ -1,11 +1,11 @@
|
|
1
1
|
import { forwardRef, useEffect, createElement } from 'react';
|
2
|
-
import {
|
2
|
+
import { useMergedRef } from '../../../hooks/useMergedRef.js';
|
3
3
|
import { Trigger as Trigger$1 } from '@radix-ui/react-dropdown-menu';
|
4
4
|
import { useCurrentMenu } from '../Context.js';
|
5
5
|
|
6
6
|
const Trigger = /*#__PURE__*/forwardRef(function MenuTrigger(props, ref) {
|
7
7
|
const menu = useCurrentMenu();
|
8
|
-
const internalRef =
|
8
|
+
const internalRef = useMergedRef(ref);
|
9
9
|
useEffect(() => {
|
10
10
|
if (internalRef.current) {
|
11
11
|
menu === null || menu === void 0 ? void 0 : menu.setMinWidth(internalRef.current.getBoundingClientRect().width);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Trigger.js","sources":["../../../../../../../../src/components/Menu/components/Trigger.tsx"],"sourcesContent":["import * as React from 'react';\nimport * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';\nimport {
|
1
|
+
{"version":3,"file":"Trigger.js","sources":["../../../../../../../../src/components/Menu/components/Trigger.tsx"],"sourcesContent":["import * as React from 'react';\r\nimport * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';\r\nimport { useMergedRef } from '../../../hooks/useMergedRef';\r\nimport { useCurrentMenu } from '../Context';\r\n\r\nexport type MenuTriggerProps = Omit<React.HTMLAttributes<HTMLButtonElement>, 'children'> & {\r\n children: React.ReactElement;\r\n};\r\n\r\nexport const Trigger = React.forwardRef(function MenuTrigger(props: MenuTriggerProps, ref: React.Ref<HTMLButtonElement>) {\r\n const menu = useCurrentMenu();\r\n const internalRef = useMergedRef<HTMLButtonElement>(ref);\r\n\r\n React.useEffect(() => {\r\n if (internalRef.current) {\r\n menu?.setMinWidth(internalRef.current.getBoundingClientRect().width);\r\n }\r\n }, [internalRef]);\r\n\r\n return <DropdownMenuPrimitive.Trigger {...props} asChild ref={internalRef} />;\r\n});\r\n"],"names":["Trigger","React","MenuTrigger","props","ref","menu","useCurrentMenu","internalRef","useMergedRef","current","setMinWidth","getBoundingClientRect","width","DropdownMenuPrimitive","asChild"],"mappings":";;;;;MASaA,OAAO,gBAAGC,UAAgB,CAAC,SAASC,WAAW,CAACC,KAAuB,EAAEC,GAAiC;EACnH,MAAMC,IAAI,GAAGC,cAAc,EAAE;EAC7B,MAAMC,WAAW,GAAGC,YAAY,CAAoBJ,GAAG,CAAC;EAExDH,SAAe,CAAC;IACZ,IAAIM,WAAW,CAACE,OAAO,EAAE;MACrBJ,IAAI,aAAJA,IAAI,uBAAJA,IAAI,CAAEK,WAAW,CAACH,WAAW,CAACE,OAAO,CAACE,qBAAqB,EAAE,CAACC,KAAK,CAAC;;GAE3E,EAAE,CAACL,WAAW,CAAC,CAAC;EAEjB,oBAAON,cAACY,SAA6B,oBAAKV,KAAK;IAAEW,OAAO;IAACV,GAAG,EAAEG;KAAe;AACjF,CAAC;;;;"}
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import React__default from 'react';
|
2
2
|
import cn from 'classnames';
|
3
3
|
import { Icon } from '../Icon/Icon.js';
|
4
|
-
import {
|
4
|
+
import { useMergedRef } from '../../hooks/useMergedRef.js';
|
5
5
|
import { Treeview } from '../Treeview/Treeview.js';
|
6
6
|
import { useDropTarget } from '../../utils/hooks/useDropTarget.js';
|
7
7
|
|
@@ -15,7 +15,7 @@ const Item = /*#__PURE__*/React__default.forwardRef(function Item(props, ref) {
|
|
15
15
|
role,
|
16
16
|
...otherProps
|
17
17
|
} = props;
|
18
|
-
const proxyRef =
|
18
|
+
const proxyRef = useMergedRef(ref);
|
19
19
|
const [isDraggedOver, dropTargetProps] = useDropTarget(onDrop);
|
20
20
|
const isTreeitem = role === 'treeitem';
|
21
21
|
const className = cn('yt-navigation__item cursor-pointer', {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Navigation.js","sources":["../../../../../../../src/components/Navigation/Navigation.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'classnames';\nimport { TreeviewProps, Treeview, TreeviewGroupProps, TreeviewItemProps } from '../Treeview/Treeview';\nimport { Icon } from '../Icon/Icon';\nimport { useDropTarget } from '../../utils/hooks/useDropTarget';\nimport { useProxiedRef } from '../../utils/hooks/useProxiedRef';\nimport './Navigation.css';\n\n// Item\nexport type NavigationItemProps = Omit<TreeviewItemProps, 'prefix'> & {\n /** Change the style to indicate the link is selected */\n active?: boolean;\n /** Handler to be used when dropping a dragged element over the navigation link */\n onDrop?: React.DragEventHandler;\n /**\n * Small amount of information placed next to the text of the link.\n * This can be any valid react element, for e.g. a `span`.\n * Should be used to indicate a relevant information of the link,\n * for e.g. the number of unread notifications\n */\n postfix?: React.ReactNode;\n /**\n * Small amount of information placed before the text of the link.\n * This can be any valid react element, for e.g. a `span`.\n * Should be used to indicate a feedback for user,\n * for e.g. display some sort of visual informational state or a relevant icon.\n */\n prefix?: React.ReactNode;\n /** Target of the link */\n target?: string;\n};\n\nconst Item = React.forwardRef(function Item(props: NavigationItemProps, ref: React.Ref<HTMLAnchorElement>) {\n const { active, children, onDrop, postfix, prefix, role, ...otherProps } = props;\n const proxyRef = useProxiedRef<HTMLAnchorElement>(ref);\n const [isDraggedOver, dropTargetProps] = useDropTarget(onDrop);\n const isTreeitem = role === 'treeitem';\n const className = cn(\n 'yt-navigation__item cursor-pointer',\n {\n 'w-full mb-px py-1 px-3 flex items-center hover:bg-grey-dark': isTreeitem,\n 'bg-white w-full h-10 px-3 flex-shrink-0 flex items-center justify-between cursor-pointer': !isTreeitem,\n 'yt-navigation__item--active': active && !isDraggedOver,\n 'bg-grey-dark': isTreeitem && active && !isDraggedOver,\n 'yt-navigation__item--dropping bg-blue': isDraggedOver,\n },\n props.className\n );\n\n const handleClick = (event: React.MouseEvent<HTMLSpanElement>): void => {\n if (event.target instanceof HTMLAnchorElement || event.target instanceof HTMLButtonElement) {\n return;\n }\n\n if (proxyRef.current) {\n proxyRef.current.click();\n }\n };\n\n return (\n <span {...dropTargetProps} className={className} onClick={handleClick} role={role}>\n {prefix && <span className=\"yt-navigation__item__prefix flex items-center\">{prefix}</span>}\n <a {...otherProps} className=\"block flex-grow truncate\" ref={proxyRef}>\n {children}\n </a>\n {postfix && <span className=\"yt-navigation__item__postfix ml-1\">{postfix}</span>}\n </span>\n );\n});\n\n// Panel\nexport type NavigationPanelProps = React.HTMLAttributes<HTMLDivElement>;\n\nconst Panel = React.forwardRef(function Panel(props: NavigationPanelProps, ref: React.Ref<HTMLDivElement>) {\n return <div {...props} className={cn('w-full bg-white p-3', props.className)} ref={ref} />;\n});\n\n// Group\nexport type NavigationMenuGroupProps = TreeviewGroupProps;\n\nconst MenuGroup = React.forwardRef(function MenuGroup(props: NavigationMenuGroupProps, ref: React.Ref<HTMLDivElement>) {\n const className = cn(\n 'flex-shrink-0 space-y-1 outline-none',\n {\n 'bg-white pb-2': props.fixed,\n },\n typeof props.className === 'function' ? props.className(false) : props.className\n );\n const title = (expanded: boolean): JSX.Element => {\n const className = cn('bg-white h-10 pl-3 pr-1 flex items-center justify-between w-full', {\n 'mb-1': expanded,\n 'cursor-pointer hover:text-blue': !props.fixed,\n });\n\n return (\n <span className={className}>\n {typeof props.title === 'function' ? props.title(expanded) : props.title}\n {!props.fixed && <Icon name={expanded ? 'chevron-up' : 'chevron-down'} />}\n </span>\n );\n };\n\n return <Treeview.Group {...props} className={className} title={title} ref={ref} />;\n});\n\n// Menu\nexport type NavigationMenuProps = React.PropsWithChildren<TreeviewProps>;\n\nexport type ForwardedNavigationMenuWithStatics = React.ForwardRefExoticComponent<\n NavigationMenuProps & React.RefAttributes<HTMLDivElement>\n> & {\n /** Expandable region reprezenting a group of related links */\n Group: React.ForwardRefExoticComponent<NavigationMenuGroupProps & React.RefAttributes<HTMLDivElement>>;\n};\n\nconst Menu = React.forwardRef(function Menu(props: NavigationMenuProps, ref: React.Ref<HTMLDivElement>) {\n const scrollableAreas = React.useMemo(() => {\n const scrollableAreas: any[] = [];\n\n const children = React.Children.toArray(props.children).filter(\n child => !!child\n ) as React.ReactElement<NavigationMenuGroupProps>[];\n\n children.forEach(child => {\n if (child.props.fixed) {\n scrollableAreas.push(child);\n } else {\n const x = scrollableAreas[scrollableAreas.length - 1];\n if (Array.isArray(x)) {\n x.push(child);\n } else {\n scrollableAreas.push([child]);\n }\n }\n });\n\n return scrollableAreas;\n }, [props.children]);\n\n return (\n <Treeview\n {...props}\n className={cn('divide-grey-light flex flex-grow flex-col divide-y-2 overflow-y-auto', props.className)}\n ref={ref}>\n {scrollableAreas.map((area, i) =>\n Array.isArray(area) ? (\n <div\n className=\"divide-grey-light flex h-0 flex-auto flex-shrink-0 flex-grow flex-col divide-y-2 overflow-y-auto\"\n key={i}>\n {area}\n </div>\n ) : (\n area\n )\n )}\n </Treeview>\n );\n}) as ForwardedNavigationMenuWithStatics;\n\nMenu.Group = MenuGroup;\n\n// Navigation\nexport type NavigationProps = React.HTMLAttributes<HTMLDivElement>;\n\nexport type ForwardedNavigationWithStatics = React.ForwardRefExoticComponent<\n NavigationProps & React.RefAttributes<HTMLDivElement>\n> & {\n /** Navigation link */\n Item: React.ForwardRefExoticComponent<NavigationItemProps & React.RefAttributes<HTMLAnchorElement>>;\n /**\n * Container for the expandable groups that hold navigation links.\n * Should be used as a direct child of Navigation component, e.g. `Navigation.Menu`.\n * Should have the menu groups as a direct child, e.g. `Navigation.Menu.Group`\n */\n Menu: ForwardedNavigationMenuWithStatics;\n /**\n * Isolated container within the Navigation.\n * This can be used to create a region in the Navigation that is usually not scrollable, nor expandable,\n * containing useful information for user and quick actions\n */\n Panel: React.ForwardRefExoticComponent<NavigationPanelProps & React.RefAttributes<HTMLDivElement>>;\n};\n\nexport const Navigation = React.forwardRef(function Navigation(props: NavigationProps, ref: React.Ref<HTMLDivElement>) {\n const { children, ...otherProps } = props;\n const className = cn('h-full flex flex-col bg-grey-light divide-y-2 divide-grey-light', props.className);\n\n return (\n <div {...otherProps} className={className} data-taco=\"navigation\" ref={ref}>\n {children}\n </div>\n );\n}) as ForwardedNavigationWithStatics;\n\nNavigation.Menu = Menu;\nNavigation.Item = Item;\nNavigation.Panel = Panel;\n"],"names":["Item","React","forwardRef","props","ref","active","children","onDrop","postfix","prefix","role","otherProps","proxyRef","useProxiedRef","isDraggedOver","dropTargetProps","useDropTarget","isTreeitem","className","cn","handleClick","event","target","HTMLAnchorElement","HTMLButtonElement","current","click","onClick","Panel","MenuGroup","fixed","title","expanded","Icon","name","Treeview","Group","Menu","scrollableAreas","useMemo","Children","toArray","filter","child","forEach","push","x","length","Array","isArray","map","area","i","key","Navigation"],"mappings":";;;;;;;AAgCA,MAAMA,IAAI,gBAAGC,cAAK,CAACC,UAAU,CAAC,SAASF,IAAI,CAACG,KAA0B,EAAEC,GAAiC;EACrG,MAAM;IAAEC,MAAM;IAAEC,QAAQ;IAAEC,MAAM;IAAEC,OAAO;IAAEC,MAAM;IAAEC,IAAI;IAAE,GAAGC;GAAY,GAAGR,KAAK;EAChF,MAAMS,QAAQ,GAAGC,aAAa,CAAoBT,GAAG,CAAC;EACtD,MAAM,CAACU,aAAa,EAAEC,eAAe,CAAC,GAAGC,aAAa,CAACT,MAAM,CAAC;EAC9D,MAAMU,UAAU,GAAGP,IAAI,KAAK,UAAU;EACtC,MAAMQ,SAAS,GAAGC,EAAE,CA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src/components/Navigation/Navigation.tsx"],"sourcesContent":["import React from 'react';\r\nimport cn from 'classnames';\r\nimport { TreeviewProps, Treeview, TreeviewGroupProps, TreeviewItemProps } from '../Treeview/Treeview';\r\nimport { Icon } from '../Icon/Icon';\r\nimport { useDropTarget } from '../../utils/hooks/useDropTarget';\r\nimport { useMergedRef } from '../../hooks/useMergedRef';\r\nimport './Navigation.css';\r\n\r\n// Item\r\nexport type NavigationItemProps = Omit<TreeviewItemProps, 'prefix'> & {\r\n /** Change the style to indicate the link is selected */\r\n active?: boolean;\r\n /** Handler to be used when dropping a dragged element over the navigation link */\r\n onDrop?: React.DragEventHandler;\r\n /**\r\n * Small amount of information placed next to the text of the link.\r\n * This can be any valid react element, for e.g. a `span`.\r\n * Should be used to indicate a relevant information of the link,\r\n * for e.g. the number of unread notifications\r\n */\r\n postfix?: React.ReactNode;\r\n /**\r\n * Small amount of information placed before the text of the link.\r\n * This can be any valid react element, for e.g. a `span`.\r\n * Should be used to indicate a feedback for user,\r\n * for e.g. display some sort of visual informational state or a relevant icon.\r\n */\r\n prefix?: React.ReactNode;\r\n /** Target of the link */\r\n target?: string;\r\n};\r\n\r\nconst Item = React.forwardRef(function Item(props: NavigationItemProps, ref: React.Ref<HTMLAnchorElement>) {\r\n const { active, children, onDrop, postfix, prefix, role, ...otherProps } = props;\r\n const proxyRef = useMergedRef<HTMLAnchorElement>(ref);\r\n const [isDraggedOver, dropTargetProps] = useDropTarget(onDrop);\r\n const isTreeitem = role === 'treeitem';\r\n const className = cn(\r\n 'yt-navigation__item cursor-pointer',\r\n {\r\n 'w-full mb-px py-1 px-3 flex items-center hover:bg-grey-dark': isTreeitem,\r\n 'bg-white w-full h-10 px-3 flex-shrink-0 flex items-center justify-between cursor-pointer': !isTreeitem,\r\n 'yt-navigation__item--active': active && !isDraggedOver,\r\n 'bg-grey-dark': isTreeitem && active && !isDraggedOver,\r\n 'yt-navigation__item--dropping bg-blue': isDraggedOver,\r\n },\r\n props.className\r\n );\r\n\r\n const handleClick = (event: React.MouseEvent<HTMLSpanElement>): void => {\r\n if (event.target instanceof HTMLAnchorElement || event.target instanceof HTMLButtonElement) {\r\n return;\r\n }\r\n\r\n if (proxyRef.current) {\r\n proxyRef.current.click();\r\n }\r\n };\r\n\r\n return (\r\n <span {...dropTargetProps} className={className} onClick={handleClick} role={role}>\r\n {prefix && <span className=\"yt-navigation__item__prefix flex items-center\">{prefix}</span>}\r\n <a {...otherProps} className=\"block flex-grow truncate\" ref={proxyRef}>\r\n {children}\r\n </a>\r\n {postfix && <span className=\"yt-navigation__item__postfix ml-1\">{postfix}</span>}\r\n </span>\r\n );\r\n});\r\n\r\n// Panel\r\nexport type NavigationPanelProps = React.HTMLAttributes<HTMLDivElement>;\r\n\r\nconst Panel = React.forwardRef(function Panel(props: NavigationPanelProps, ref: React.Ref<HTMLDivElement>) {\r\n return <div {...props} className={cn('w-full bg-white p-3', props.className)} ref={ref} />;\r\n});\r\n\r\n// Group\r\nexport type NavigationMenuGroupProps = TreeviewGroupProps;\r\n\r\nconst MenuGroup = React.forwardRef(function MenuGroup(props: NavigationMenuGroupProps, ref: React.Ref<HTMLDivElement>) {\r\n const className = cn(\r\n 'flex-shrink-0 space-y-1 outline-none',\r\n {\r\n 'bg-white pb-2': props.fixed,\r\n },\r\n typeof props.className === 'function' ? props.className(false) : props.className\r\n );\r\n const title = (expanded: boolean): JSX.Element => {\r\n const className = cn('bg-white h-10 pl-3 pr-1 flex items-center justify-between w-full', {\r\n 'mb-1': expanded,\r\n 'cursor-pointer hover:text-blue': !props.fixed,\r\n });\r\n\r\n return (\r\n <span className={className}>\r\n {typeof props.title === 'function' ? props.title(expanded) : props.title}\r\n {!props.fixed && <Icon name={expanded ? 'chevron-up' : 'chevron-down'} />}\r\n </span>\r\n );\r\n };\r\n\r\n return <Treeview.Group {...props} className={className} title={title} ref={ref} />;\r\n});\r\n\r\n// Menu\r\nexport type NavigationMenuProps = React.PropsWithChildren<TreeviewProps>;\r\n\r\nexport type ForwardedNavigationMenuWithStatics = React.ForwardRefExoticComponent<\r\n NavigationMenuProps & React.RefAttributes<HTMLDivElement>\r\n> & {\r\n /** Expandable region reprezenting a group of related links */\r\n Group: React.ForwardRefExoticComponent<NavigationMenuGroupProps & React.RefAttributes<HTMLDivElement>>;\r\n};\r\n\r\nconst Menu = React.forwardRef(function Menu(props: NavigationMenuProps, ref: React.Ref<HTMLDivElement>) {\r\n const scrollableAreas = React.useMemo(() => {\r\n const scrollableAreas: any[] = [];\r\n\r\n const children = React.Children.toArray(props.children).filter(\r\n child => !!child\r\n ) as React.ReactElement<NavigationMenuGroupProps>[];\r\n\r\n children.forEach(child => {\r\n if (child.props.fixed) {\r\n scrollableAreas.push(child);\r\n } else {\r\n const x = scrollableAreas[scrollableAreas.length - 1];\r\n if (Array.isArray(x)) {\r\n x.push(child);\r\n } else {\r\n scrollableAreas.push([child]);\r\n }\r\n }\r\n });\r\n\r\n return scrollableAreas;\r\n }, [props.children]);\r\n\r\n return (\r\n <Treeview\r\n {...props}\r\n className={cn('divide-grey-light flex flex-grow flex-col divide-y-2 overflow-y-auto', props.className)}\r\n ref={ref}>\r\n {scrollableAreas.map((area, i) =>\r\n Array.isArray(area) ? (\r\n <div\r\n className=\"divide-grey-light flex h-0 flex-auto flex-shrink-0 flex-grow flex-col divide-y-2 overflow-y-auto\"\r\n key={i}>\r\n {area}\r\n </div>\r\n ) : (\r\n area\r\n )\r\n )}\r\n </Treeview>\r\n );\r\n}) as ForwardedNavigationMenuWithStatics;\r\n\r\nMenu.Group = MenuGroup;\r\n\r\n// Navigation\r\nexport type NavigationProps = React.HTMLAttributes<HTMLDivElement>;\r\n\r\nexport type ForwardedNavigationWithStatics = React.ForwardRefExoticComponent<\r\n NavigationProps & React.RefAttributes<HTMLDivElement>\r\n> & {\r\n /** Navigation link */\r\n Item: React.ForwardRefExoticComponent<NavigationItemProps & React.RefAttributes<HTMLAnchorElement>>;\r\n /**\r\n * Container for the expandable groups that hold navigation links.\r\n * Should be used as a direct child of Navigation component, e.g. `Navigation.Menu`.\r\n * Should have the menu groups as a direct child, e.g. `Navigation.Menu.Group`\r\n */\r\n Menu: ForwardedNavigationMenuWithStatics;\r\n /**\r\n * Isolated container within the Navigation.\r\n * This can be used to create a region in the Navigation that is usually not scrollable, nor expandable,\r\n * containing useful information for user and quick actions\r\n */\r\n Panel: React.ForwardRefExoticComponent<NavigationPanelProps & React.RefAttributes<HTMLDivElement>>;\r\n};\r\n\r\nexport const Navigation = React.forwardRef(function Navigation(props: NavigationProps, ref: React.Ref<HTMLDivElement>) {\r\n const { children, ...otherProps } = props;\r\n const className = cn('h-full flex flex-col bg-grey-light divide-y-2 divide-grey-light', props.className);\r\n\r\n return (\r\n <div {...otherProps} className={className} data-taco=\"navigation\" ref={ref}>\r\n {children}\r\n </div>\r\n );\r\n}) as ForwardedNavigationWithStatics;\r\n\r\nNavigation.Menu = Menu;\r\nNavigation.Item = Item;\r\nNavigation.Panel = Panel;\r\n"],"names":["Item","React","forwardRef","props","ref","active","children","onDrop","postfix","prefix","role","otherProps","proxyRef","useMergedRef","isDraggedOver","dropTargetProps","useDropTarget","isTreeitem","className","cn","handleClick","event","target","HTMLAnchorElement","HTMLButtonElement","current","click","onClick","Panel","MenuGroup","fixed","title","expanded","Icon","name","Treeview","Group","Menu","scrollableAreas","useMemo","Children","toArray","filter","child","forEach","push","x","length","Array","isArray","map","area","i","key","Navigation"],"mappings":";;;;;;;AAgCA,MAAMA,IAAI,gBAAGC,cAAK,CAACC,UAAU,CAAC,SAASF,IAAI,CAACG,KAA0B,EAAEC,GAAiC;EACrG,MAAM;IAAEC,MAAM;IAAEC,QAAQ;IAAEC,MAAM;IAAEC,OAAO;IAAEC,MAAM;IAAEC,IAAI;IAAE,GAAGC;GAAY,GAAGR,KAAK;EAChF,MAAMS,QAAQ,GAAGC,YAAY,CAAoBT,GAAG,CAAC;EACrD,MAAM,CAACU,aAAa,EAAEC,eAAe,CAAC,GAAGC,aAAa,CAACT,MAAM,CAAC;EAC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CAAC1B,KAAK,GAAGA,KAAK;;;;"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"PageNumbers.js","sources":["../../../../../../../src/components/Pagination/PageNumbers.tsx"],"sourcesContent":["import * as React from 'react';\nimport { Button } from '../Button/Button';\nimport { useLocalization } from '../Provider/Provider';\n\ntype PageNumberProps = {\n currentPageIndex: number;\n onClick: (pageIndex: number) => void;\n pageCount: number;\n};\n\nconst createPageRange = (pageCount: number, pageNumber: number): number[] => {\n let lowerLimit = Math.min(pageNumber, pageCount);\n let upperLimit = Math.min(pageNumber, pageCount);\n\n for (let b = 1; b < 5 && b < pageCount; ) {\n if (lowerLimit > 1) {\n lowerLimit--;\n b++;\n }\n if (b < 5 && upperLimit < pageCount) {\n upperLimit++;\n b++;\n }\n }\n\n const range: number[] = [];\n\n for (let i = lowerLimit; i <= upperLimit; i++) {\n range.push(i);\n }\n\n return range;\n};\n\nexport const PageNumbers = ({ currentPageIndex = 0, onClick: handleClick, pageCount }: PageNumberProps): JSX.Element => {\n const range = createPageRange(pageCount, currentPageIndex + 1);\n const { texts } = useLocalization();\n\n return (\n <>\n {range.map((pageNumber: number) => (\n <Button\n appearance={pageNumber === currentPageIndex + 1 ? 'primary' : 'default'}\n aria-current={pageNumber === currentPageIndex + 1 ? 'page' : undefined}\n key={pageNumber}\n onClick={() => handleClick(pageNumber - 1)}\n aria-label={texts.pagination.actions.pageX.replace('[X]', String(pageNumber))}\n tooltip={texts.pagination.actions.pageX.replace('[X]', String(pageNumber))}>\n {pageNumber}\n </Button>\n ))}\n </>\n );\n};\n"],"names":["createPageRange","pageCount","pageNumber","lowerLimit","Math","min","upperLimit","b","range","i","push","PageNumbers","currentPageIndex","onClick","handleClick","texts","useLocalization","React","map","Button","appearance","undefined","key","pagination","actions","pageX","replace","String","tooltip"],"mappings":";;;;AAUA,MAAMA,eAAe,GAAG,CAACC,SAAiB,EAAEC,UAAkB;EAC1D,IAAIC,UAAU,GAAGC,IAAI,CAACC,GAAG,C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B,OAAO,EAAEb,KAAK,CAACQ,UAAU,CAACC,OAAO,CAACC,KAAK,CAACC,OAAO,CAAC,KAAK,EAAEC,MAAM,CAACzB,UAAU,CAAC;KACxEA,UAAU,CAElB,CAAC,CACH;AAEX;;;;"}
|
1
|
+
{"version":3,"file":"PageNumbers.js","sources":["../../../../../../../src/components/Pagination/PageNumbers.tsx"],"sourcesContent":["import * as React from 'react';\r\nimport { Button } from '../Button/Button';\r\nimport { useLocalization } from '../Provider/Provider';\r\n\r\ntype PageNumberProps = {\r\n currentPageIndex: number;\r\n onClick: (pageIndex: number) => void;\r\n pageCount: number;\r\n};\r\n\r\nconst createPageRange = (pageCount: number, pageNumber: number): number[] => {\r\n let lowerLimit = Math.min(pageNumber, pageCount);\r\n let upperLimit = Math.min(pageNumber, pageCount);\r\n\r\n for (let b = 1; b < 5 && b < pageCount; ) {\r\n if (lowerLimit > 1) {\r\n lowerLimit--;\r\n b++;\r\n }\r\n if (b < 5 && upperLimit < pageCount) {\r\n upperLimit++;\r\n b++;\r\n }\r\n }\r\n\r\n const range: number[] = [];\r\n\r\n for (let i = lowerLimit; i <= upperLimit; i++) {\r\n range.push(i);\r\n }\r\n\r\n return range;\r\n};\r\n\r\nexport const PageNumbers = ({ currentPageIndex = 0, onClick: handleClick, pageCount }: PageNumberProps): JSX.Element => {\r\n const range = createPageRange(pageCount, currentPageIndex + 1);\r\n const { texts } = useLocalization();\r\n\r\n return (\r\n <>\r\n {range.map((pageNumber: number) => (\r\n <Button\r\n appearance={pageNumber === currentPageIndex + 1 ? 'primary' : 'default'}\r\n aria-current={pageNumber === currentPageIndex + 1 ? 'page' : undefined}\r\n key={pageNumber}\r\n onClick={() => handleClick(pageNumber - 1)}\r\n aria-label={texts.pagination.actions.pageX.replace('[X]', String(pageNumber))}\r\n tooltip={texts.pagination.actions.pageX.replace('[X]', String(pageNumber))}>\r\n {pageNumber}\r\n </Button>\r\n ))}\r\n </>\r\n );\r\n};\r\n"],"names":["createPageRange","pageCount","pageNumber","lowerLimit","Math","min","upperLimit","b","range","i","push","PageNumbers","currentPageIndex","onClick","handleClick","texts","useLocalization","React","map","Button","appearance","undefined","key","pagination","actions","pageX","replace","String","tooltip"],"mappings":";;;;AAUA,MAAMA,eAAe,GAAG,CAACC,SAAiB,EAAEC,UAAkB;EAC1D,IAAIC,UAAU,GAAGC,IAAI,CAACC,GAAG,CAACH,UAAU,EAAED,SAAS,CAAC;EAChD,IAAIK,UAAU,GAAGF,IAAI,CAACC,GAAG,CAACH,UAAU,EAAED,SAAS,CAAC;EAEhD,KAAK,IAAIM,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAG,CAAC,IAAIA,CAAC,GAAGN,SAAS,GAAI;IACtC,IAAIE,UAAU,GAAG,CAAC,EAAE;MAChBA,UAAU,EAAE;MACZI,CAAC,EAAE;;IAEP,IAAIA,CAAC,GAAG,CAAC,IAAID,UAAU,GAAGL,SAAS,EAAE;MACjCK,UAAU,EAAE;MACZC,CAAC,EAAE;;;EAIX,MAAMC,KAAK,GAAa,EAAE;EAE1B,KAAK,IAAIC,CAAC,GAAGN,UAAU,EAAEM,CAAC,IAAIH,UAAU,EAAEG,CAAC,EAAE,EAAE;IAC3CD,KAAK,CAACE,IAAI,CAACD,CAAC,CAAC;;EAGjB,OAAOD,KAAK;AAChB,CAAC;MAEYG,WAAW,GAAG,CAAC;EAAEC,gBAAgB,GAAG,CAAC;EAAEC,OAAO,EAAEC,WAAW;EAAEb;CAA4B;EAClG,MAAMO,KAAK,GAAGR,eAAe,CAACC,SAAS,EAAEW,gBAAgB,GAAG,CAAC,CAAC;EAC9D,MAAM;IAAEG;GAAO,GAAGC,eAAe,EAAE;EAEnC,oBACIC,8BACKT,KAAK,CAACU,GAAG,CAAEhB,UAAkB,iBAC1Be,cAACE,MAAM;IACHC,UAAU,EAAElB,UAAU,KAAKU,gBAAgB,GAAG,CAAC,GAAG,SAAS,GAAG,SAAS;oBACzDV,UAAU,KAAKU,gBAAgB,GAAG,CAAC,GAAG,MAAM,GAAGS,SAAS;IACtEC,GAAG,EAAEpB,UAAU;IACfW,OAAO,EAAE,MAAMC,WAAW,CAACZ,UAAU,GAAG,CAAC,CAAC;kBAC9Ba,KAAK,CAACQ,UAAU,CAACC,OAAO,CAACC,KAAK,CAACC,OAAO,CAAC,KAAK,EAAEC,MAAM,CAACzB,UAAU,CAAC,CAAC;IAC7E0B,OAAO,EAAEb,KAAK,CAACQ,UAAU,CAACC,OAAO,CAACC,KAAK,CAACC,OAAO,CAAC,KAAK,EAAEC,MAAM,CAACzB,UAAU,CAAC;KACxEA,UAAU,CAElB,CAAC,CACH;AAEX;;;;"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Pagination.js","sources":["../../../../../../../src/components/Pagination/Pagination.tsx"],"sourcesContent":["import * as React from 'react';\nimport cn from 'classnames';\nimport { PageNumbers } from './PageNumbers';\nimport { LocalizationTexts, useLocalization } from '../Provider/Provider';\nimport { Select } from '../Select/Select';\nimport { Group } from '../Group/Group';\nimport { IconButton } from '../IconButton/IconButton';\nimport { usePaginationValues } from './usePagination';\nimport { usePaginationShortcuts } from './usePaginationShortcuts';\n\nexport * from './usePagination';\n\nexport type PaginationTextsActions = {\n /**\n * Aria-label for first page action button.\n * To read more about how to provide the text, see [Provider](component:provider) component\n */\n firstPage: string;\n /**\n * Aria-label for first page action button with shortcut.\n * To read more about how to provide the text, see [Provider](component:provider) component\n */\n firstPageWithShortcut: string;\n /**\n * Aria-label for next page action button.\n * To read more about how to provide the text, see [Provider](component:provider) component\n */\n nextPage: string;\n /**\n * Aria-label for next page action button with shortcut.\n * To read more about how to provide the text, see [Provider](component:provider) component\n */\n nextPageWithShortcut: string;\n /**\n * Aria-label for previous page action button.\n * To read more about how to provide the text, see [Provider](component:provider) component\n */\n previousPage: string;\n /**\n * Aria-label for previous page action button with shortcut.\n * To read more about how to provide the text, see [Provider](component:provider) component\n */\n previousPageWithShortcut: string;\n /**\n * Aria-label for last page action button.\n * To read more about how to provide the text, see [Provider](component:provider) component\n */\n lastPage: string;\n /**\n * Aria-label for last page action button with shortcut.\n * To read more about how to provide the text, see [Provider](component:provider) component\n */\n lastPageWithShortcut: string;\n /**\n * Aria-label for page X action button.\n * To read more about how to provide the text, see [Provider](component:provider) component\n */\n pageX: string;\n};\n\nexport type PaginationTexts = {\n /**\n * Aria-label provided for page numbers and page actions group.\n * To read more about how to provide the text, see [Provider](component:provider) component\n */\n label: string;\n /**\n * Aria-label provided for page size selection.\n * To read more about how to provide the text, see [Provider](component:provider) component\n */\n pageSize: string;\n /**\n * Text that indicates the number of the first and last element displayed on the current page, out of total items\n * To read more about how to provide the text, see [Provider](component:provider) component\n */\n showingXofYofTotal: string;\n /**\n * Aria-labels provided for page action buttons.\n * To read more about how to provide the text, see [Provider](component:provider) component\n */\n actions: PaginationTextsActions;\n};\n\nexport type PaginationProps = React.HTMLAttributes<HTMLDivElement> &\n usePaginationValues & {\n /** Indicate total number of items that will be paginated */\n length: number;\n /** Page size options */\n pageSizes?: number[];\n /** Shows page controls */\n showPageControls?: boolean;\n /** Shows page numbers between navigation buttons, which allows users to quickly navigate to a specific page */\n showPageNumbers?: boolean;\n /** Shows a dropdown with page sizes, which allows user to change the number of items displayed on the page */\n showPageSize?: boolean;\n /** Enable pagination shortcuts */\n dangerouslyHijackGlobalKeyboardNavigation?: boolean;\n };\n\nconst getShowingLabel = (length: number, pageIndex: number, pageSize: number, texts: LocalizationTexts): string => {\n const minItemIndex = pageIndex * pageSize + 1;\n const maxItemIndex = (pageIndex + 1) * pageSize;\n\n return texts.pagination.showingXofYofTotal\n .replace('[X]', length === 0 ? '0' : String(minItemIndex))\n .replace('[Y]', String(maxItemIndex > length ? length : maxItemIndex))\n .replace('[total]', String(length));\n};\n\nexport const Pagination = React.forwardRef(function Pagination(props: PaginationProps, ref: React.Ref<HTMLDivElement>) {\n const {\n length,\n pageIndex,\n pageSize,\n pageSizes = [10, 25, 50, 100, 500],\n setPageIndex,\n setPageSize,\n showPageControls = true,\n showPageNumbers = true,\n showPageSize = true,\n dangerouslyHijackGlobalKeyboardNavigation = false,\n ...otherProps\n } = props;\n const { texts } = useLocalization();\n\n const maxPageIndex = Math.ceil(length / pageSize) - 1;\n const showShortcutTexts = dangerouslyHijackGlobalKeyboardNavigation;\n\n usePaginationShortcuts({\n setPageIndex,\n maxPageIndex,\n pageIndex,\n dangerouslyHijackGlobalKeyboardNavigation,\n });\n\n const pageCount = Math.ceil(length / pageSize);\n const canPreviousPage = pageIndex > 0;\n const canNextPage = pageIndex < pageCount - 1;\n\n const className = cn('inline-flex relative justify-between items-center', props.className);\n\n return (\n <div {...otherProps} className={className} data-taco=\"pagination\" ref={ref}>\n {showPageSize && (\n <span className=\"mr-4\">\n {getShowingLabel(length, pageIndex, pageSize, texts)}\n <Select\n aria-label={texts.pagination.pageSize}\n className=\"ml-4 !w-20\"\n data={pageSizes.map(pageSize => ({\n text: String(pageSize),\n value: pageSize,\n }))}\n onChange={event => {\n setPageIndex(0);\n setPageSize(Number(event.target.value));\n }}\n value={pageSize}\n />\n </span>\n )}\n {showPageControls && (\n <Group as=\"nav\" aria-label={texts.pagination.label}>\n <IconButton\n appearance=\"default\"\n disabled={!canPreviousPage}\n icon=\"arrow-start\"\n onClick={() => setPageIndex(0)}\n aria-label={\n showShortcutTexts\n ? texts.pagination.actions.firstPageWithShortcut\n : texts.pagination.actions.firstPage\n }\n tooltip={\n showShortcutTexts\n ? texts.pagination.actions.firstPageWithShortcut\n : texts.pagination.actions.firstPage\n }\n />\n <IconButton\n appearance=\"default\"\n disabled={!canPreviousPage}\n icon=\"arrow-left\"\n onClick={() => setPageIndex(pageIndex - 1)}\n aria-label={\n showShortcutTexts\n ? texts.pagination.actions.previousPageWithShortcut\n : texts.pagination.actions.previousPage\n }\n tooltip={\n showShortcutTexts\n ? texts.pagination.actions.previousPageWithShortcut\n : texts.pagination.actions.previousPage\n }\n />\n {showPageNumbers && pageCount > 0 && (\n <PageNumbers pageCount={pageCount} currentPageIndex={pageIndex} onClick={setPageIndex} />\n )}\n <IconButton\n appearance=\"default\"\n disabled={!canNextPage}\n icon=\"arrow-right\"\n onClick={() => setPageIndex(pageIndex + 1)}\n aria-label={\n showShortcutTexts ? texts.pagination.actions.nextPageWithShortcut : texts.pagination.actions.nextPage\n }\n tooltip={\n showShortcutTexts ? texts.pagination.actions.nextPageWithShortcut : texts.pagination.actions.nextPage\n }\n />\n <IconButton\n appearance=\"default\"\n disabled={!canNextPage}\n icon=\"arrow-end\"\n onClick={() => setPageIndex(pageCount - 1)}\n aria-label={\n showShortcutTexts ? texts.pagination.actions.lastPageWithShortcut : texts.pagination.actions.lastPage\n }\n tooltip={\n showShortcutTexts ? texts.pagination.actions.lastPageWithShortcut : texts.pagination.actions.lastPage\n }\n />\n </Group>\n )}\n </div>\n );\n});\n"],"names":["getShowingLabel","length","pageIndex","pageSize","texts","minItemIndex","maxItemIndex","pagination","showingXofYofTotal","replace","String","Pagination","React","props","ref","pageSizes","setPageIndex","setPageSize","showPageControls","showPageNumbers","showPageSize","dangerouslyHijackGlobalKeyboardNavigation","otherProps","useLocalization","maxPageIndex","Math","ceil","showShortcutTexts","usePaginationShortcuts","pageCount","canPreviousPage","canNextPage","className","cn","Select","data","map","text","value","onChange","event","Number","target","Group","as","label","IconButton","appearance","disabled","icon","onClick","actions","firstPageWithShortcut","firstPage","tooltip","previousPageWithShortcut","previousPage","PageNumbers","currentPageIndex","nextPageWithShortcut","nextPage","lastPageWithShortcut","lastPage"],"mappings":";;;;;;;;;;AAmGA,MAAMA,eAAe,GAAG,CAACC,MAAc,EAAEC,SAAiB,EAAEC,QAAgB,EAAEC,KAAwB;EAClG,MAAMC,YAAY,GAAGH,SAAS,GAAGC,QAAQ,GAAG,CAAC;EAC7C,MAAMG,YAAY,GAAG,CAACJ,SAAS,GAAG,CAAC,IAAIC,QAAQ;EAE/C,OAAOC,KAAK,CAACG,UAAU,CAACC,kBAAkB,CACrCC,OAAO,CAAC,KAAK,EAAER,MAAM,KAAK,CAAC,G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AAO,CAACW;IAEnG,CAET,CACC;AAEd,CAAC;;;;"}
|
1
|
+
{"version":3,"file":"Pagination.js","sources":["../../../../../../../src/components/Pagination/Pagination.tsx"],"sourcesContent":["import * as React from 'react';\r\nimport cn from 'classnames';\r\nimport { PageNumbers } from './PageNumbers';\r\nimport { LocalizationTexts, useLocalization } from '../Provider/Provider';\r\nimport { Select } from '../Select/Select';\r\nimport { Group } from '../Group/Group';\r\nimport { IconButton } from '../IconButton/IconButton';\r\nimport { usePaginationValues } from './usePagination';\r\nimport { usePaginationShortcuts } from './usePaginationShortcuts';\r\n\r\nexport * from './usePagination';\r\n\r\nexport type PaginationTextsActions = {\r\n /**\r\n * Aria-label for first page action button.\r\n * To read more about how to provide the text, see [Provider](component:provider) component\r\n */\r\n firstPage: string;\r\n /**\r\n * Aria-label for first page action button with shortcut.\r\n * To read more about how to provide the text, see [Provider](component:provider) component\r\n */\r\n firstPageWithShortcut: string;\r\n /**\r\n * Aria-label for next page action button.\r\n * To read more about how to provide the text, see [Provider](component:provider) component\r\n */\r\n nextPage: string;\r\n /**\r\n * Aria-label for next page action button with shortcut.\r\n * To read more about how to provide the text, see [Provider](component:provider) component\r\n */\r\n nextPageWithShortcut: string;\r\n /**\r\n * Aria-label for previous page action button.\r\n * To read more about how to provide the text, see [Provider](component:provider) component\r\n */\r\n previousPage: string;\r\n /**\r\n * Aria-label for previous page action button with shortcut.\r\n * To read more about how to provide the text, see [Provider](component:provider) component\r\n */\r\n previousPageWithShortcut: string;\r\n /**\r\n * Aria-label for last page action button.\r\n * To read more about how to provide the text, see [Provider](component:provider) component\r\n */\r\n lastPage: string;\r\n /**\r\n * Aria-label for last page action button with shortcut.\r\n * To read more about how to provide the text, see [Provider](component:provider) component\r\n */\r\n lastPageWithShortcut: string;\r\n /**\r\n * Aria-label for page X action button.\r\n * To read more about how to provide the text, see [Provider](component:provider) component\r\n */\r\n pageX: string;\r\n};\r\n\r\nexport type PaginationTexts = {\r\n /**\r\n * Aria-label provided for page numbers and page actions group.\r\n * To read more about how to provide the text, see [Provider](component:provider) component\r\n */\r\n label: string;\r\n /**\r\n * Aria-label provided for page size selection.\r\n * To read more about how to provide the text, see [Provider](component:provider) component\r\n */\r\n pageSize: string;\r\n /**\r\n * Text that indicates the number of the first and last element displayed on the current page, out of total items\r\n * To read more about how to provide the text, see [Provider](component:provider) component\r\n */\r\n showingXofYofTotal: string;\r\n /**\r\n * Aria-labels provided for page action buttons.\r\n * To read more about how to provide the text, see [Provider](component:provider) component\r\n */\r\n actions: PaginationTextsActions;\r\n};\r\n\r\nexport type PaginationProps = React.HTMLAttributes<HTMLDivElement> &\r\n usePaginationValues & {\r\n /** Indicate total number of items that will be paginated */\r\n length: number;\r\n /** Page size options */\r\n pageSizes?: number[];\r\n /** Shows page controls */\r\n showPageControls?: boolean;\r\n /** Shows page numbers between navigation buttons, which allows users to quickly navigate to a specific page */\r\n showPageNumbers?: boolean;\r\n /** Shows a dropdown with page sizes, which allows user to change the number of items displayed on the page */\r\n showPageSize?: boolean;\r\n /** Enable pagination shortcuts */\r\n dangerouslyHijackGlobalKeyboardNavigation?: boolean;\r\n };\r\n\r\nconst getShowingLabel = (length: number, pageIndex: number, pageSize: number, texts: LocalizationTexts): string => {\r\n const minItemIndex = pageIndex * pageSize + 1;\r\n const maxItemIndex = (pageIndex + 1) * pageSize;\r\n\r\n return texts.pagination.showingXofYofTotal\r\n .replace('[X]', length === 0 ? '0' : String(minItemIndex))\r\n .replace('[Y]', String(maxItemIndex > length ? length : maxItemIndex))\r\n .replace('[total]', String(length));\r\n};\r\n\r\nexport const Pagination = React.forwardRef(function Pagination(props: PaginationProps, ref: React.Ref<HTMLDivElement>) {\r\n const {\r\n length,\r\n pageIndex,\r\n pageSize,\r\n pageSizes = [10, 25, 50, 100, 500],\r\n setPageIndex,\r\n setPageSize,\r\n showPageControls = true,\r\n showPageNumbers = true,\r\n showPageSize = true,\r\n dangerouslyHijackGlobalKeyboardNavigation = false,\r\n ...otherProps\r\n } = props;\r\n const { texts } = useLocalization();\r\n\r\n const maxPageIndex = Math.ceil(length / pageSize) - 1;\r\n const showShortcutTexts = dangerouslyHijackGlobalKeyboardNavigation;\r\n\r\n usePaginationShortcuts({\r\n setPageIndex,\r\n maxPageIndex,\r\n pageIndex,\r\n dangerouslyHijackGlobalKeyboardNavigation,\r\n });\r\n\r\n const pageCount = Math.ceil(length / pageSize);\r\n const canPreviousPage = pageIndex > 0;\r\n const canNextPage = pageIndex < pageCount - 1;\r\n\r\n const className = cn('inline-flex relative justify-between items-center', props.className);\r\n\r\n return (\r\n <div {...otherProps} className={className} data-taco=\"pagination\" ref={ref}>\r\n {showPageSize && (\r\n <span className=\"mr-4\">\r\n {getShowingLabel(length, pageIndex, pageSize, texts)}\r\n <Select\r\n aria-label={texts.pagination.pageSize}\r\n className=\"ml-4 !w-20\"\r\n data={pageSizes.map(pageSize => ({\r\n text: String(pageSize),\r\n value: pageSize,\r\n }))}\r\n onChange={event => {\r\n setPageIndex(0);\r\n setPageSize(Number(event.target.value));\r\n }}\r\n value={pageSize}\r\n />\r\n </span>\r\n )}\r\n {showPageControls && (\r\n <Group as=\"nav\" aria-label={texts.pagination.label}>\r\n <IconButton\r\n appearance=\"default\"\r\n disabled={!canPreviousPage}\r\n icon=\"arrow-start\"\r\n onClick={() => setPageIndex(0)}\r\n aria-label={\r\n showShortcutTexts\r\n ? texts.pagination.actions.firstPageWithShortcut\r\n : texts.pagination.actions.firstPage\r\n }\r\n tooltip={\r\n showShortcutTexts\r\n ? texts.pagination.actions.firstPageWithShortcut\r\n : texts.pagination.actions.firstPage\r\n }\r\n />\r\n <IconButton\r\n appearance=\"default\"\r\n disabled={!canPreviousPage}\r\n icon=\"arrow-left\"\r\n onClick={() => setPageIndex(pageIndex - 1)}\r\n aria-label={\r\n showShortcutTexts\r\n ? texts.pagination.actions.previousPageWithShortcut\r\n : texts.pagination.actions.previousPage\r\n }\r\n tooltip={\r\n showShortcutTexts\r\n ? texts.pagination.actions.previousPageWithShortcut\r\n : texts.pagination.actions.previousPage\r\n }\r\n />\r\n {showPageNumbers && pageCount > 0 && (\r\n <PageNumbers pageCount={pageCount} currentPageIndex={pageIndex} onClick={setPageIndex} />\r\n )}\r\n <IconButton\r\n appearance=\"default\"\r\n disabled={!canNextPage}\r\n icon=\"arrow-right\"\r\n onClick={() => setPageIndex(pageIndex + 1)}\r\n aria-label={\r\n showShortcutTexts ? texts.pagination.actions.nextPageWithShortcut : texts.pagination.actions.nextPage\r\n }\r\n tooltip={\r\n showShortcutTexts ? texts.pagination.actions.nextPageWithShortcut : texts.pagination.actions.nextPage\r\n }\r\n />\r\n <IconButton\r\n appearance=\"default\"\r\n disabled={!canNextPage}\r\n icon=\"arrow-end\"\r\n onClick={() => setPageIndex(pageCount - 1)}\r\n aria-label={\r\n showShortcutTexts ? texts.pagination.actions.lastPageWithShortcut : texts.pagination.actions.lastPage\r\n }\r\n tooltip={\r\n showShortcutTexts ? texts.pagination.actions.lastPageWithShortcut : texts.pagination.actions.lastPage\r\n }\r\n />\r\n </Group>\r\n )}\r\n </div>\r\n );\r\n});\r\n"],"names":["getShowingLabel","length","pageIndex","pageSize","texts","minItemIndex","maxItemIndex","pagination","showingXofYofTotal","replace","String","Pagination","React","props","ref","pageSizes","setPageIndex","setPageSize","showPageControls","showPageNumbers","showPageSize","dangerouslyHijackGlobalKeyboardNavigation","otherProps","useLocalization","maxPageIndex","Math","ceil","showShortcutTexts","usePaginationShortcuts","pageCount","canPreviousPage","canNextPage","className","cn","Select","data","map","text","value","onChange","event","Number","target","Group","as","label","IconButton","appearance","disabled","icon","onClick","actions","firstPageWithShortcut","firstPage","tooltip","previousPageWithShortcut","previousPage","PageNumbers","currentPageIndex","nextPageWithShortcut","nextPage","lastPageWithShortcut","lastPage"],"mappings":";;;;;;;;;;AAmGA,MAAMA,eAAe,GAAG,CAACC,MAAc,EAAEC,SAAiB,EAAEC,QAAgB,EAAEC,KAAwB;EAClG,MAAMC,YAAY,GAAGH,SAAS,GAAGC,QA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AoB,GAAGzD,KAAK,CAACG,UAAU,CAAC4C,OAAO,CAACW,QAAQ;IAEzGR,OAAO,EACH3B,iBAAiB,GAAGvB,KAAK,CAACG,UAAU,CAAC4C,OAAO,CAACU,oBAAoB,GAAGzD,KAAK,CAACG,UAAU,CAAC4C,OAAO,CAACW;IAEnG,CAET,CACC;AAEd,CAAC;;;;"}
|
@@ -70,7 +70,10 @@ const Close = /*#__PURE__*/forwardRef((props, ref) => /*#__PURE__*/createElement
|
|
70
70
|
const Popover = /*#__PURE__*/forwardRef(function Popover(props, ref) {
|
71
71
|
const {
|
72
72
|
children,
|
73
|
+
defaultOpen,
|
73
74
|
modal = false,
|
75
|
+
open,
|
76
|
+
onChange,
|
74
77
|
trigger,
|
75
78
|
...otherProps
|
76
79
|
} = props;
|
@@ -81,7 +84,10 @@ const Popover = /*#__PURE__*/forwardRef(function Popover(props, ref) {
|
|
81
84
|
return /*#__PURE__*/createElement(PopoverContext.Provider, {
|
82
85
|
value: context
|
83
86
|
}, /*#__PURE__*/createElement(Root, {
|
84
|
-
|
87
|
+
defaultOpen: defaultOpen,
|
88
|
+
modal: modal,
|
89
|
+
open: open,
|
90
|
+
onOpenChange: onChange
|
85
91
|
}, trigger && /*#__PURE__*/createElement(Trigger, null, trigger), children));
|
86
92
|
});
|
87
93
|
Popover.Trigger = Trigger;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Popover.js","sources":["../../../../../../../src/components/Popover/Popover.tsx"],"sourcesContent":["import * as React from 'react';\nimport cn from 'classnames';\nimport * as PopoverPrimitive from '@radix-ui/react-popover';\nimport { Placement } from '../..';\nimport { UnstyledArrow } from './Primitives';\nimport { mergeRefs } from '../../utils/mergeRefs';\nimport { getPopoverStyleClassnames } from './util';\n\ntype PopoverContextValue = { props: any; ref: React.Ref<HTMLElement> };\n\nconst PopoverContext = React.createContext<PopoverContextValue>({\n props: {},\n ref: null,\n});\n\nexport type PopoverTriggerProps = React.HTMLAttributes<HTMLElement>;\nconst Trigger = React.forwardRef(function PopoverAnchor(props: PopoverTriggerProps, externalRef: React.Ref<HTMLElement>) {\n const { ref: parentRef, props: parentProps } = React.useContext(PopoverContext);\n const refCallback = mergeRefs([parentRef, externalRef]);\n\n let children = props.children;\n\n if (React.isValidElement(props.children) && typeof props.children?.type === 'function') {\n console.warn(\n `Popover.Trigger requires its child to forwardRef so that it can attach to the dom element. Did you mean to wrap '${props.children.type.name}' in React.forwardRef()? Taco has wrapped '${props.children.type.name}' in a 'span' to maintain functionality, but this may cause unintended behaviour`\n );\n children = <span>{props.children}</span>;\n }\n\n return <PopoverPrimitive.Trigger {...parentProps} {...props} children={children} ref={refCallback} asChild />;\n});\n\nconst RenderPropWrapper = React.forwardRef(function RenderPropWrapper({ children, onClick }: any, ref) {\n const close = () => {\n onClick(new CustomEvent('hide'));\n };\n\n return children({ close, ref });\n});\n\nexport type PopoverContentRenderProps = { close: () => void };\nexport type PopoverContentProps = Omit<PopoverPrimitive.PopoverContentProps, 'side'> & {\n children: React.ReactNode | ((props: PopoverContentRenderProps) => React.ReactNode);\n /** Set the position of the Popover relative to its trigger. Default value is `bottom` */\n placement?: Placement;\n};\nconst Content = React.forwardRef(function PopoverContent(props: PopoverContentProps, ref: React.Ref<HTMLDivElement>) {\n const { placement: side, ...popoverContentProps } = props;\n const className = cn(getPopoverStyleClassnames(), props.className);\n\n let output;\n\n if (typeof props.children === 'function') {\n output = (\n <PopoverPrimitive.Close asChild>\n <RenderPropWrapper>{props.children}</RenderPropWrapper>\n </PopoverPrimitive.Close>\n );\n } else {\n output = props.children;\n }\n\n return (\n <PopoverPrimitive.Portal>\n <PopoverPrimitive.Content\n {...popoverContentProps}\n className={className}\n data-taco=\"popover\"\n side={side}\n sideOffset={1}\n ref={ref}>\n {output}\n <UnstyledArrow className=\"text-white\" />\n </PopoverPrimitive.Content>\n </PopoverPrimitive.Portal>\n );\n});\n\nexport type PopoverCloseProps = React.HTMLAttributes<HTMLButtonElement>;\nconst Close = React.forwardRef(\n (props: PopoverCloseProps, ref: React.Ref<HTMLButtonElement>): JSX.Element => (\n <PopoverPrimitive.Close {...props} ref={ref} asChild />\n )\n);\n\nexport type PopoverProps = React.PropsWithChildren<{\n modal?: boolean;\n /** A trigger to be used for the popover, should not be set if `children` already contains a trigger */\n trigger?: JSX.Element;\n}>;\nexport type ForwardedPopoverWithStatics = React.ForwardRefExoticComponent<PopoverProps & React.RefAttributes<HTMLElement>> & {\n Trigger: React.ForwardRefExoticComponent<PopoverTriggerProps>;\n Content: React.ForwardRefExoticComponent<PopoverContentProps>;\n Close: React.ForwardRefExoticComponent<PopoverCloseProps>;\n Portal: React.FunctionComponent<PopoverPrimitive.PortalProps>;\n};\n\nexport const Popover = React.forwardRef<HTMLElement, PopoverProps>(function Popover(props, ref) {\n const { children, modal = false, trigger, ...otherProps } = props;\n const context = React.useMemo(() => ({ props: otherProps, ref }), [otherProps]);\n\n return (\n <PopoverContext.Provider value={context}>\n <PopoverPrimitive.Root modal={modal}>\n {trigger && <Trigger>{trigger}</Trigger>}\n {children}\n </PopoverPrimitive.Root>\n </PopoverContext.Provider>\n );\n}) as ForwardedPopoverWithStatics;\nPopover.Trigger = Trigger;\nPopover.Content = Content;\nPopover.Close = Close;\nPopover.Portal = PopoverPrimitive.Portal;\n"],"names":["PopoverContext","React","props","ref","Trigger","PopoverAnchor","externalRef","parentRef","parentProps","refCallback","mergeRefs","children","type","console","warn","name","PopoverPrimitive","asChild","RenderPropWrapper","onClick","close","CustomEvent","Content","PopoverContent","placement","side","popoverContentProps","className","cn","getPopoverStyleClassnames","output","sideOffset","UnstyledArrow","Close","Popover","modal","trigger","otherProps","context","Provider","value","Portal"],"mappings":";;;;;;;AAUA,MAAMA,cAAc,gBAAGC,aAAmB,CAAsB;EAC5DC,KAAK,EAAE,EAAE;EACTC,GAAG,EAAE;CACR,CAAC;AAGF,MAAMC,OAAO,gBAAGH,UAAgB,CAAC,SAASI,aAAa,CAACH,KAA0B,EAAEI,WAAmC;;EACnH,MAAM;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,OAAO5B,KAAK,CAACS,QAAQ,KAAK,UAAU,EAAE;IACtCmB,MAAM,gBACF7B,cAACe,OAAsB;MAACC,OAAO;oBAC3BhB,cAACiB,iBAAiB,QAAEhB,KAAK,CAACS,QAAQ,CAAqB,CAE9D;GACJ,MAAM;IACHmB,MAAM,GAAG5B,KAAK,CAACS,QAAQ;;EAG3B,oBACIV,cAACe,MAAuB,qBACpBf,cAACe,SAAwB,oBACjBU,mBAAmB;IACvBC,SAAS,EAAEA,SAAS;iBACV,SAAS;IACnBF,IAAI,EAAEA,IAAI;IACVM,UAAU,EAAE,CAAC;IACb5B,GAAG,EAAEA;MACJ2B,MAAM,eACP7B,cAAC+B,aAAa;IAACL,SAAS,EAAC;IAAe,CACjB,CACL;AAElC,CAAC,CAAC;AAGF,MAAMM,KAAK,gBAAGhC,UAAgB,CAC1B,CAACC,KAAwB,EAAEC,GAAiC,kBACxDF,cAACe,OAAsB,oBAAKd,KAAK;EAAEC,GAAG,EAAEA,GAAG;EAAEc,OAAO;GACvD,CACJ;
|
1
|
+
{"version":3,"file":"Popover.js","sources":["../../../../../../../src/components/Popover/Popover.tsx"],"sourcesContent":["import * as React from 'react';\r\nimport cn from 'classnames';\r\nimport * as PopoverPrimitive from '@radix-ui/react-popover';\r\nimport { Placement } from '../..';\r\nimport { UnstyledArrow } from './Primitives';\r\nimport { mergeRefs } from '../../utils/mergeRefs';\r\nimport { getPopoverStyleClassnames } from './util';\r\n\r\ntype PopoverContextValue = { props: any; ref: React.Ref<HTMLElement> };\r\n\r\nconst PopoverContext = React.createContext<PopoverContextValue>({\r\n props: {},\r\n ref: null,\r\n});\r\n\r\nexport type PopoverTriggerProps = React.HTMLAttributes<HTMLElement>;\r\nconst Trigger = React.forwardRef(function PopoverAnchor(props: PopoverTriggerProps, externalRef: React.Ref<HTMLElement>) {\r\n const { ref: parentRef, props: parentProps } = React.useContext(PopoverContext);\r\n const refCallback = mergeRefs([parentRef, externalRef]);\r\n\r\n let children = props.children;\r\n\r\n if (React.isValidElement(props.children) && typeof props.children?.type === 'function') {\r\n console.warn(\r\n `Popover.Trigger requires its child to forwardRef so that it can attach to the dom element. Did you mean to wrap '${props.children.type.name}' in React.forwardRef()? Taco has wrapped '${props.children.type.name}' in a 'span' to maintain functionality, but this may cause unintended behaviour`\r\n );\r\n children = <span>{props.children}</span>;\r\n }\r\n\r\n return <PopoverPrimitive.Trigger {...parentProps} {...props} children={children} ref={refCallback} asChild />;\r\n});\r\n\r\nconst RenderPropWrapper = React.forwardRef(function RenderPropWrapper({ children, onClick }: any, ref) {\r\n const close = () => {\r\n onClick(new CustomEvent('hide'));\r\n };\r\n\r\n return children({ close, ref });\r\n});\r\n\r\nexport type PopoverContentRenderProps = { close: () => void };\r\nexport type PopoverContentProps = Omit<PopoverPrimitive.PopoverContentProps, 'side'> & {\r\n children: React.ReactNode | ((props: PopoverContentRenderProps) => React.ReactNode);\r\n /** Set the position of the Popover relative to its trigger. Default value is `bottom` */\r\n placement?: Placement;\r\n};\r\nconst Content = React.forwardRef(function PopoverContent(props: PopoverContentProps, ref: React.Ref<HTMLDivElement>) {\r\n const { placement: side, ...popoverContentProps } = props;\r\n const className = cn(getPopoverStyleClassnames(), props.className);\r\n\r\n let output;\r\n\r\n if (typeof props.children === 'function') {\r\n output = (\r\n <PopoverPrimitive.Close asChild>\r\n <RenderPropWrapper>{props.children}</RenderPropWrapper>\r\n </PopoverPrimitive.Close>\r\n );\r\n } else {\r\n output = props.children;\r\n }\r\n\r\n return (\r\n <PopoverPrimitive.Portal>\r\n <PopoverPrimitive.Content\r\n {...popoverContentProps}\r\n className={className}\r\n data-taco=\"popover\"\r\n side={side}\r\n sideOffset={1}\r\n ref={ref}>\r\n {output}\r\n <UnstyledArrow className=\"text-white\" />\r\n </PopoverPrimitive.Content>\r\n </PopoverPrimitive.Portal>\r\n );\r\n});\r\n\r\nexport type PopoverCloseProps = React.HTMLAttributes<HTMLButtonElement>;\r\nconst Close = React.forwardRef(\r\n (props: PopoverCloseProps, ref: React.Ref<HTMLButtonElement>): JSX.Element => (\r\n <PopoverPrimitive.Close {...props} ref={ref} asChild />\r\n )\r\n);\r\n\r\nexport type PopoverProps = React.PropsWithChildren<{\r\n modal?: boolean;\r\n /** A trigger to be used for the popover, should not be set if `children` already contains a trigger */\r\n trigger?: JSX.Element;\r\n /** Set whether the popover is open by default or not, use when not providing a trigger */\r\n defaultOpen?: boolean;\r\n /** Control the open state of the popover from outside the component */\r\n open?: boolean;\r\n /** Called when the popover opens or closes, must be used in conjunction with open */\r\n onChange?: (open: boolean) => void;\r\n}>;\r\nexport type ForwardedPopoverWithStatics = React.ForwardRefExoticComponent<PopoverProps & React.RefAttributes<HTMLElement>> & {\r\n Trigger: React.ForwardRefExoticComponent<PopoverTriggerProps>;\r\n Content: React.ForwardRefExoticComponent<PopoverContentProps>;\r\n Close: React.ForwardRefExoticComponent<PopoverCloseProps>;\r\n Portal: React.FunctionComponent<PopoverPrimitive.PortalProps>;\r\n};\r\n\r\nexport const Popover = React.forwardRef<HTMLElement, PopoverProps>(function Popover(props, ref) {\r\n const { children, defaultOpen, modal = false, open, onChange, trigger, ...otherProps } = props;\r\n const context = React.useMemo(() => ({ props: otherProps, ref }), [otherProps]);\r\n\r\n return (\r\n <PopoverContext.Provider value={context}>\r\n <PopoverPrimitive.Root defaultOpen={defaultOpen} modal={modal} open={open} onOpenChange={onChange}>\r\n {trigger && <Trigger>{trigger}</Trigger>}\r\n {children}\r\n </PopoverPrimitive.Root>\r\n </PopoverContext.Provider>\r\n );\r\n}) as ForwardedPopoverWithStatics;\r\nPopover.Trigger = Trigger;\r\nPopover.Content = Content;\r\nPopover.Close = Close;\r\nPopover.Portal = PopoverPrimitive.Portal;\r\n"],"names":["PopoverContext","React","props","ref","Trigger","PopoverAnchor","externalRef","parentRef","parentProps","refCallback","mergeRefs","children","type","console","warn","name","PopoverPrimitive","asChild","RenderPropWrapper","onClick","close","CustomEvent","Content","PopoverContent","placement","side","popoverContentProps","className","cn","getPopoverStyleClassnames","output","sideOffset","UnstyledArrow","Close","Popover","defaultOpen","modal","open","onChange","trigger","otherProps","context","Provider","value","onOpenChange","Portal"],"mappings":";;;;;;;AAUA,MAAMA,cAAc,gBAAGC,aAAmB,CAAsB;EAC5DC,KAAK,EAAE,EAAE;EACTC,GAAG,EAAE;CACR,CAAC;AAGF,MAAMC,OAAO,gBAAGH,UAAgB,CAAC,SAASI,aAAa,CAACH,KAA0B,EAAEI,WAAmC;;EACnH,MAAM;IAAEH,GAAG,EAAEI,SAAS;IAAEL,KAAK,EAAEM;GAAa,GAAGP,UAAgB,CAACD,cAAc,CAAC;EAC/E,MAAMS,WAAW,GAAGC,SAAS,CAAC,CAACH,SAAS,EAAED,WAAW,CAAC,CAAC;EAEvD,IAAIK,QAAQ,GAAGT,KAAK,CAACS,QAAQ;EAE7B,kBAAIV,cAAoB,CAACC,KAAK,CAACS,QAAQ,CAAC,IAAI,2BAAOT,KAAK,CAACS,QAAQ,oDAAd,gBAAgBC,IAAI,MAAK,UAAU,EAAE;IACpFC,OAAO,CAACC,IAAI,qHAC4GZ,KAAK,CAACS,QAAQ,CAACC,IAAI,CAACG,kDAAkDb,KAAK,CAACS,QAAQ,CAACC,IAAI,CAACG,sFAAsF,CACvS;IACDJ,QAAQ,gBAAGV,4BAAOC,KAAK,CAACS,QAAQ,CAAQ;;EAG5C,oBAAOV,cAACe,SAAwB,oBAAKR,WAAW,EAAMN,KAAK;IAAES,QAAQ,EAAEA,QAAQ;IAAER,GAAG,EAAEM,WAAW;IAAEQ,OAAO;KAAG;AACjH,CAAC,CAAC;AAEF,MAAMC,iBAAiB,gBAAGjB,UAAgB,CAAC,SAASiB,iBAAiB,CAAC;EAAEP,QAAQ;EAAEQ;CAAc,EAAEhB,GAAG;EACjG,MAAMiB,KAAK,GAAG;IACVD,OAAO,CAAC,IAAIE,WAAW,CAAC,MAAM,CAAC,CAAC;GACnC;EAED,OAAOV,QAAQ,CAAC;IAAES,KAAK;IAAEjB;GAAK,CAAC;AAC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U;IAAErC;GAAK,CAAC,EAAE,CAACqC,UAAU,CAAC,CAAC;EAE/E,oBACIvC,cAACD,cAAc,CAAC0C,QAAQ;IAACC,KAAK,EAAEF;kBAC5BxC,cAACe,IAAqB;IAACmB,WAAW,EAAEA,WAAW;IAAEC,KAAK,EAAEA,KAAK;IAAEC,IAAI,EAAEA,IAAI;IAAEO,YAAY,EAAEN;KACpFC,OAAO,iBAAItC,cAACG,OAAO,QAAEmC,OAAO,CAAW,EACvC5B,QAAQ,CACW,CACF;AAElC,CAAC;AACDuB,OAAO,CAAC9B,OAAO,GAAGA,OAAO;AACzB8B,OAAO,CAACZ,OAAO,GAAGA,OAAO;AACzBY,OAAO,CAACD,KAAK,GAAGA,KAAK;AACrBC,OAAO,CAACW,MAAM,GAAG7B,MAAuB;;;;"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Primitives.js","sources":["../../../../../../../src/components/Popover/Primitives.tsx"],"sourcesContent":["import * as React from 'react';\nimport * as PopoverPrimitive from '@radix-ui/react-popover';\n\nexport const UnstyledArrow = React.forwardRef<SVGSVGElement, React.SVGAttributes<SVGElement>>(function PopoverArrow(props, ref) {\n return (\n <PopoverPrimitive.Arrow className=\"pointer-events-none -mt-px\" asChild offset={2} width={30} height={11}>\n <svg {...props} ref={ref} viewBox=\"0 19 30 11\" style={{ transform: 'rotateZ(180deg)' }}>\n <path\n className=\"text-grey-dark group-focus:text-blue-light fill-current\"\n d=\"M23.7,27.1L17,19.9C16.5,19.3,15.8,19,15,19s-1.6,0.3-2.1,0.9l-6.6,7.2C5.3,28.1,3.4,29,2,29h26 C26.7,29,24.6,28.1,23.7,27.1z\"></path>\n <path\n className=\"fill-current\"\n d=\"M23,27.8c1.1,1.2,3.4,2.2,5,2.2h2H0h2c1.7,0,3.9-1,5-2.2l6.6-7.2c0.7-0.8,2-0.8,2.7,0L23,27.8L23,27.8z\"></path>\n </svg>\n </PopoverPrimitive.Arrow>\n );\n});\n"],"names":["UnstyledArrow","React","PopoverArrow","props","ref","PopoverPrimitive","className","asChild","offset","width","height","viewBox","style","transform","d"],"mappings":";;;MAGaA,aAAa,gBAAGC,UAAgB,CAAiD,SAASC,YAAY,CAACC,KAAK,EAAEC,GAAG;EAC1H,oBACIH,cAACI,KAAsB;IAACC,SAAS,EAAC,4BAA4B;IAACC,OAAO;IAACC,MAAM,EAAE,CAAC;IAAEC,KAAK,EAAE,EAAE;IAAEC,MAAM,EAAE;kBACjGT,uCAASE,KAAK;IAAEC,GAAG,EAAEA,GAAG;IAAEO,OAAO,EAAC,YAAY;IAACC,KAAK,EAAE;MAAEC,SAAS,EAAE;;mBAC/DZ;IACIK,SAAS,EAAC,yDAAyD;IACnEQ,CAAC,EAAC;IAAoI,eAC1Ib;IACIK,SAAS,EAAC,cAAc;IACxBQ,CAAC,EAAC;IAA6G,CACjH,CACe;AAEjC,CAAC;;;;"}
|
1
|
+
{"version":3,"file":"Primitives.js","sources":["../../../../../../../src/components/Popover/Primitives.tsx"],"sourcesContent":["import * as React from 'react';\r\nimport * as PopoverPrimitive from '@radix-ui/react-popover';\r\n\r\nexport const UnstyledArrow = React.forwardRef<SVGSVGElement, React.SVGAttributes<SVGElement>>(function PopoverArrow(props, ref) {\r\n return (\r\n <PopoverPrimitive.Arrow className=\"pointer-events-none -mt-px\" asChild offset={2} width={30} height={11}>\r\n <svg {...props} ref={ref} viewBox=\"0 19 30 11\" style={{ transform: 'rotateZ(180deg)' }}>\r\n <path\r\n className=\"text-grey-dark group-focus:text-blue-light fill-current\"\r\n d=\"M23.7,27.1L17,19.9C16.5,19.3,15.8,19,15,19s-1.6,0.3-2.1,0.9l-6.6,7.2C5.3,28.1,3.4,29,2,29h26 C26.7,29,24.6,28.1,23.7,27.1z\"></path>\r\n <path\r\n className=\"fill-current\"\r\n d=\"M23,27.8c1.1,1.2,3.4,2.2,5,2.2h2H0h2c1.7,0,3.9-1,5-2.2l6.6-7.2c0.7-0.8,2-0.8,2.7,0L23,27.8L23,27.8z\"></path>\r\n </svg>\r\n </PopoverPrimitive.Arrow>\r\n );\r\n});\r\n"],"names":["UnstyledArrow","React","PopoverArrow","props","ref","PopoverPrimitive","className","asChild","offset","width","height","viewBox","style","transform","d"],"mappings":";;;MAGaA,aAAa,gBAAGC,UAAgB,CAAiD,SAASC,YAAY,CAACC,KAAK,EAAEC,GAAG;EAC1H,oBACIH,cAACI,KAAsB;IAACC,SAAS,EAAC,4BAA4B;IAACC,OAAO;IAACC,MAAM,EAAE,CAAC;IAAEC,KAAK,EAAE,EAAE;IAAEC,MAAM,EAAE;kBACjGT,uCAASE,KAAK;IAAEC,GAAG,EAAEA,GAAG;IAAEO,OAAO,EAAC,YAAY;IAACC,KAAK,EAAE;MAAEC,SAAS,EAAE;;mBAC/DZ;IACIK,SAAS,EAAC,yDAAyD;IACnEQ,CAAC,EAAC;IAAoI,eAC1Ib;IACIK,SAAS,EAAC,cAAc;IACxBQ,CAAC,EAAC;IAA6G,CACjH,CACe;AAEjC,CAAC;;;;"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"util.js","sources":["../../../../../../../src/components/Popover/util.ts"],"sourcesContent":["export const getPopoverStyleClassnames = () =>\n 'bg-white focus:border-blue-light border border-transparent rounded p-3 yt-shadow focus:yt-focus outline-none group';\n"],"names":["getPopoverStyleClassnames"],"mappings":"MAAaA,yBAAyB,GAAG,MACrC;;;;"}
|
1
|
+
{"version":3,"file":"util.js","sources":["../../../../../../../src/components/Popover/util.ts"],"sourcesContent":["export const getPopoverStyleClassnames = () =>\r\n 'bg-white focus:border-blue-light border border-transparent rounded p-3 yt-shadow focus:yt-focus outline-none group';\r\n"],"names":["getPopoverStyleClassnames"],"mappings":"MAAaA,yBAAyB,GAAG,MACrC;;;;"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Provider.js","sources":["../../../../../../../src/components/Provider/Provider.tsx"],"sourcesContent":["import * as React from 'react';\nimport * as Tooltip from '@radix-ui/react-tooltip';\nimport { Locale } from '../../types';\nimport { CalendarTexts } from '../Calendar/Calendar';\nimport { ComboboxTexts } from '../Combobox/Combobox';\nimport { DialogTexts } from '../Dialog/Dialog';\nimport { PaginationTexts } from '../Pagination/Pagination';\nimport { ListboxTexts } from '../Listbox/Listbox';\nimport { ToastsTexts } from '../Toast/Toast';\nimport { DatepickerTexts } from '../Datepicker/Datepicker';\nimport { HangerTexts } from '../Hanger/Hanger';\nimport { SelectTexts } from '../Select/Select';\nimport { TourTexts } from '../Tour/Tour';\nimport { TableTexts } from '../Table/Table';\nimport { SearchInputTexts } from '../SearchInput/SearchInput';\nimport { ToastProvider } from '../Toast/Toaster';\nimport { Select2Texts } from '../Select2/Select2';\n\nexport type LocalizationTexts = {\n /** Localized texts and aria-labels for [Calendar](component:calendar) component */\n calendar: CalendarTexts;\n /** Localized texts and aria-labels for [Combobox](component:combobox) component */\n combobox: ComboboxTexts;\n /** Localized texts and aria-labels for [DatePicker](component:datepicker) component */\n datepicker: DatepickerTexts;\n /** Localized texts and aria-labels for [Hanger](component:hanger) component */\n hanger: HangerTexts;\n /** Localized texts and aria-labels for [Listbox](component:listbox) component */\n listbox: ListboxTexts;\n /** Localized texts and aria-labels for [Dialog](component:dialog) component */\n dialog: DialogTexts;\n /** Localized texts and aria-labels for [Pagination](component:pagination) component */\n pagination: PaginationTexts;\n /** Localized texts and aria-labels for [Table](component:table) component */\n table: TableTexts;\n /** Localized texts and aria-labels for [Select](component:select) component */\n select: SelectTexts;\n /** Localized texts and aria-labels for [Select2](component:select2) component */\n select2: Select2Texts;\n /** Localized texts and aria-labels for [Toast](component:toast) component */\n toasts: ToastsTexts;\n /** Localized texts and aria-labels for [Tour](component:tour) component */\n tour: TourTexts;\n /** Localized texts and aria-labels for [SearchInput](component:searchinput) component */\n searchInput: SearchInputTexts;\n};\n\nexport type Localization = {\n /**\n * Provide the language code used in application.\n * Default value is `en-GB`\n */\n locale: Locale;\n /** Provide the texts and aria-labels for components used within the provider */\n texts: LocalizationTexts;\n /** Provide the formatting */\n formatting: {\n /** Default value is `dd.mm.yy` */\n date: string;\n };\n};\nexport type Taco = {\n /** Define localized texts and formatted data in your application */\n localization: Localization;\n};\n\nexport const defaultLocalisationTexts = {\n calendar: {\n months: [\n 'January',\n 'February',\n 'March',\n 'April',\n 'May',\n 'June',\n 'July',\n 'August',\n 'September',\n 'October',\n 'November',\n 'December',\n ],\n weekdaysShort: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],\n actions: {\n previousMonth: 'Previous month',\n nextMonth: 'Next month',\n previousYear: 'Previous year',\n nextYear: 'Next year',\n today: 'Today',\n },\n },\n combobox: {\n tooltip: 'Search in list',\n },\n datepicker: {\n calendar: 'Calendar',\n clear: 'Clear',\n expand: 'Show calendar',\n shortcuts: 'Shortcuts',\n },\n hanger: {\n close: 'Close',\n },\n listbox: {\n loading: 'Loading results...',\n empty: 'No results found',\n allOption: 'All',\n },\n dialog: {\n close: 'Close',\n drag: 'Drag',\n },\n pagination: {\n label: 'Pagination',\n pageSize: 'Items per page',\n showingXofYofTotal: 'Showing [X] - [Y] of [total]',\n actions: {\n firstPage: 'Goto first page',\n firstPageWithShortcut: 'Goto first page (Home)',\n previousPage: 'Goto previous page',\n previousPageWithShortcut: 'Goto previous page (Page Up)',\n nextPage: 'Goto next page',\n nextPageWithShortcut: 'Goto next page (Page Down)',\n lastPage: 'Goto last page',\n lastPageWithShortcut: 'Goto last page (End)',\n pageX: 'Goto page [X]',\n },\n },\n table: {\n actions: 'Other actions',\n edit: 'Edit (e)',\n copy: 'Copy (c)',\n del: 'Delete (del)',\n newSubRow: 'New row (shift + n)',\n loading: 'Loading...',\n },\n select: {\n allOptionsSelected: 'All',\n },\n select2: {\n allSelect: 'Select all',\n allDeselect: 'Deselect all',\n cancel: 'Cancel',\n chooseColor: 'Pick a color',\n create: 'Create',\n delete: 'Delete',\n save: 'Save',\n search: 'Search...',\n searchOrCreate: 'Search or create...',\n },\n toasts: {\n dismiss: 'Dismiss',\n },\n tour: {\n back: 'Back',\n close: 'Close',\n skip: 'Close and complete',\n last: 'Done',\n next: 'Next',\n open: 'Open',\n },\n searchInput: {\n inputLabel: 'Search...',\n },\n};\n\nconst defaultLocalizationContext: Localization = {\n locale: 'en-GB',\n texts: defaultLocalisationTexts,\n formatting: {\n date: 'dd.mm.yy',\n },\n};\n\nconst Context = React.createContext<Taco>({\n localization: defaultLocalizationContext,\n});\n\nexport type ProviderProps = {\n /** Content would be your application */\n children?: any;\n /** Define localized texts and formatted data in your application */\n localization?: Localization;\n};\n\nexport const Provider = (props: ProviderProps): JSX.Element => {\n const { children, localization = defaultLocalizationContext } = props;\n const value = React.useMemo(() => ({ localization }), [localization]);\n\n return (\n <Context.Provider value={value}>\n <Tooltip.Provider>\n <ToastProvider>{children}</ToastProvider>\n </Tooltip.Provider>\n </Context.Provider>\n );\n};\n\nexport const useTaco = (): Taco => React.useContext(Context);\nexport const useLocalization = (): Localization => useTaco().localization;\n"],"names":["defaultLocalisationTexts","calendar","months","weekdaysShort","actions","previousMonth","nextMonth","previousYear","nextYear","today","combobox","tooltip","datepicker","clear","expand","shortcuts","hanger","close","listbox","loading","empty","allOption","dialog","drag","pagination","label","pageSize","showingXofYofTotal","firstPage","firstPageWithShortcut","previousPage","previousPageWithShortcut","nextPage","nextPageWithShortcut","lastPage","lastPageWithShortcut","pageX","table","edit","copy","del","newSubRow","select","allOptionsSelected","select2","allSelect","allDeselect","cancel","chooseColor","create","delete","save","search","searchOrCreate","toasts","dismiss","tour","back","skip","last","next","open","searchInput","inputLabel","defaultLocalizationContext","locale","texts","formatting","date","Context","React","localization","Provider","props","children","value","Tooltip","ToastProvider","useTaco","useLocalization"],"mappings":";;;;MAkEaA,wBAAwB,GAAG;EACpCC,QAAQ,EAAE;IACNC,MAAM,EAAE,CACJ,SAAS,EACT,UAAU,EACV,OAAO,EACP,OAAO,EACP,KAAK,EACL,MAAM,EACN,MAAM,EACN,QAAQ,EACR,WAAW,EACX,SAAS,EACT,UAAU,EACV,UAAU,C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vB;EACDC,OAAO,EAAE;IACLC,SAAS,EAAE,YAAY;IACvBC,WAAW,EAAE,cAAc;IAC3BC,MAAM,EAAE,QAAQ;IAChBC,WAAW,EAAE,cAAc;IAC3BC,MAAM,EAAE,QAAQ;IAChBC,MAAM,EAAE,QAAQ;IAChBC,IAAI,EAAE,MAAM;IACZC,MAAM,EAAE,WAAW;IACnBC,cAAc,EAAE;GACnB;EACDC,MAAM,EAAE;IACJC,OAAO,EAAE;GACZ;EACDC,IAAI,EAAE;IACFC,IAAI,EAAE,MAAM;IACZxC,KAAK,EAAE,OAAO;IACdyC,IAAI,EAAE,oBAAoB;IAC1BC,IAAI,EAAE,MAAM;IACZC,IAAI,EAAE,MAAM;IACZC,IAAI,EAAE;GACT;EACDC,WAAW,EAAE;IACTC,UAAU,EAAE;;;AAIpB,MAAMC,0BAA0B,GAAiB;EAC7CC,MAAM,EAAE,OAAO;EACfC,KAAK,EAAElE,wBAAwB;EAC/BmE,UAAU,EAAE;IACRC,IAAI,EAAE;;CAEb;AAED,MAAMC,OAAO,gBAAGC,aAAmB,CAAO;EACtCC,YAAY,EAAEP;CACjB,CAAC;MASWQ,QAAQ,GAAIC,KAAoB;EACzC,MAAM;IAAEC,QAAQ;IAAEH,YAAY,GAAGP;GAA4B,GAAGS,KAAK;EACrE,MAAME,KAAK,GAAGL,OAAa,CAAC,OAAO;IAAEC;GAAc,CAAC,EAAE,CAACA,YAAY,CAAC,CAAC;EAErE,oBACID,cAACD,OAAO,CAACG,QAAQ;IAACG,KAAK,EAAEA;kBACrBL,cAACM,UAAgB,qBACbN,cAACO,aAAa,QAAEH,QAAQ,CAAiB,CAC1B,CACJ;AAE3B;MAEaI,OAAO,GAAG,MAAYR,UAAgB,CAACD,OAAO;MAC9CU,eAAe,GAAG,MAAoBD,OAAO,EAAE,CAACP;;;;"}
|
1
|
+
{"version":3,"file":"Provider.js","sources":["../../../../../../../src/components/Provider/Provider.tsx"],"sourcesContent":["import * as React from 'react';\r\nimport * as Tooltip from '@radix-ui/react-tooltip';\r\nimport { Locale } from '../../types';\r\nimport { CalendarTexts } from '../Calendar/Calendar';\r\nimport { ComboboxTexts } from '../Combobox/Combobox';\r\nimport { DialogTexts } from '../Dialog/Dialog';\r\nimport { PaginationTexts } from '../Pagination/Pagination';\r\nimport { ListboxTexts } from '../Listbox/Listbox';\r\nimport { ToastsTexts } from '../Toast/Toast';\r\nimport { DatepickerTexts } from '../Datepicker/Datepicker';\r\nimport { HangerTexts } from '../Hanger/Hanger';\r\nimport { SelectTexts } from '../Select/Select';\r\nimport { TourTexts } from '../Tour/Tour';\r\nimport { TableTexts } from '../Table/Table';\r\nimport { SearchInputTexts } from '../SearchInput/SearchInput';\r\nimport { ToastProvider } from '../Toast/Toaster';\r\nimport { Select2Texts } from '../Select2/Select2';\r\n\r\nexport type LocalizationTexts = {\r\n /** Localized texts and aria-labels for [Calendar](component:calendar) component */\r\n calendar: CalendarTexts;\r\n /** Localized texts and aria-labels for [Combobox](component:combobox) component */\r\n combobox: ComboboxTexts;\r\n /** Localized texts and aria-labels for [DatePicker](component:datepicker) component */\r\n datepicker: DatepickerTexts;\r\n /** Localized texts and aria-labels for [Hanger](component:hanger) component */\r\n hanger: HangerTexts;\r\n /** Localized texts and aria-labels for [Listbox](component:listbox) component */\r\n listbox: ListboxTexts;\r\n /** Localized texts and aria-labels for [Dialog](component:dialog) component */\r\n dialog: DialogTexts;\r\n /** Localized texts and aria-labels for [Pagination](component:pagination) component */\r\n pagination: PaginationTexts;\r\n /** Localized texts and aria-labels for [Table](component:table) component */\r\n table: TableTexts;\r\n /** Localized texts and aria-labels for [Select](component:select) component */\r\n select: SelectTexts;\r\n /** Localized texts and aria-labels for [Select2](component:select2) component */\r\n select2: Select2Texts;\r\n /** Localized texts and aria-labels for [Toast](component:toast) component */\r\n toasts: ToastsTexts;\r\n /** Localized texts and aria-labels for [Tour](component:tour) component */\r\n tour: TourTexts;\r\n /** Localized texts and aria-labels for [SearchInput](component:searchinput) component */\r\n searchInput: SearchInputTexts;\r\n};\r\n\r\nexport type Localization = {\r\n /**\r\n * Provide the language code used in application.\r\n * Default value is `en-GB`\r\n */\r\n locale: Locale;\r\n /** Provide the texts and aria-labels for components used within the provider */\r\n texts: LocalizationTexts;\r\n /** Provide the formatting */\r\n formatting: {\r\n /** Default value is `dd.mm.yy` */\r\n date: string;\r\n };\r\n};\r\nexport type Taco = {\r\n /** Define localized texts and formatted data in your application */\r\n localization: Localization;\r\n};\r\n\r\nexport const defaultLocalisationTexts = {\r\n calendar: {\r\n months: [\r\n 'January',\r\n 'February',\r\n 'March',\r\n 'April',\r\n 'May',\r\n 'June',\r\n 'July',\r\n 'August',\r\n 'September',\r\n 'October',\r\n 'November',\r\n 'December',\r\n ],\r\n weekdaysShort: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],\r\n actions: {\r\n previousMonth: 'Previous month',\r\n nextMonth: 'Next month',\r\n previousYear: 'Previous year',\r\n nextYear: 'Next year',\r\n today: 'Today',\r\n },\r\n },\r\n combobox: {\r\n tooltip: 'Search in list',\r\n },\r\n datepicker: {\r\n calendar: 'Calendar',\r\n clear: 'Clear',\r\n expand: 'Show calendar',\r\n shortcuts: 'Shortcuts',\r\n },\r\n hanger: {\r\n close: 'Close',\r\n },\r\n listbox: {\r\n loading: 'Loading results...',\r\n empty: 'No results found',\r\n allOption: 'All',\r\n },\r\n dialog: {\r\n close: 'Close',\r\n drag: 'Drag',\r\n },\r\n pagination: {\r\n label: 'Pagination',\r\n pageSize: 'Items per page',\r\n showingXofYofTotal: 'Showing [X] - [Y] of [total]',\r\n actions: {\r\n firstPage: 'Goto first page',\r\n firstPageWithShortcut: 'Goto first page (Home)',\r\n previousPage: 'Goto previous page',\r\n previousPageWithShortcut: 'Goto previous page (Page Up)',\r\n nextPage: 'Goto next page',\r\n nextPageWithShortcut: 'Goto next page (Page Down)',\r\n lastPage: 'Goto last page',\r\n lastPageWithShortcut: 'Goto last page (End)',\r\n pageX: 'Goto page [X]',\r\n },\r\n },\r\n table: {\r\n actions: 'Other actions',\r\n edit: 'Edit (e)',\r\n copy: 'Copy (c)',\r\n del: 'Delete (del)',\r\n newSubRow: 'New row (shift + n)',\r\n loading: 'Loading...',\r\n },\r\n select: {\r\n allOptionsSelected: 'All',\r\n },\r\n select2: {\r\n allSelect: 'Select all',\r\n allDeselect: 'Deselect all',\r\n cancel: 'Cancel',\r\n chooseColor: 'Pick a color',\r\n create: 'Create',\r\n delete: 'Delete',\r\n save: 'Save',\r\n search: 'Search...',\r\n searchOrCreate: 'Search or create...',\r\n },\r\n toasts: {\r\n dismiss: 'Dismiss',\r\n },\r\n tour: {\r\n back: 'Back',\r\n close: 'Close',\r\n skip: 'Close and complete',\r\n last: 'Done',\r\n next: 'Next',\r\n open: 'Open',\r\n },\r\n searchInput: {\r\n inputLabel: 'Search...',\r\n },\r\n};\r\n\r\nconst defaultLocalizationContext: Localization = {\r\n locale: 'en-GB',\r\n texts: defaultLocalisationTexts,\r\n formatting: {\r\n date: 'dd.mm.yy',\r\n },\r\n};\r\n\r\nconst Context = React.createContext<Taco>({\r\n localization: defaultLocalizationContext,\r\n});\r\n\r\nexport type ProviderProps = {\r\n /** Content would be your application */\r\n children?: any;\r\n /** Define localized texts and formatted data in your application */\r\n localization?: Localization;\r\n};\r\n\r\nexport const Provider = (props: ProviderProps): JSX.Element => {\r\n const { children, localization = defaultLocalizationContext } = props;\r\n const value = React.useMemo(() => ({ localization }), [localization]);\r\n\r\n return (\r\n <Context.Provider value={value}>\r\n <Tooltip.Provider>\r\n <ToastProvider>{children}</ToastProvider>\r\n </Tooltip.Provider>\r\n </Context.Provider>\r\n );\r\n};\r\n\r\nexport const useTaco = (): Taco => React.useContext(Context);\r\nexport const useLocalization = (): Localization => useTaco().localization;\r\n"],"names":["defaultLocalisationTexts","calendar","months","weekdaysShort","actions","previousMonth","nextMonth","previousYear","nextYear","today","combobox","tooltip","datepicker","clear","expand","shortcuts","hanger","close","listbox","loading","empty","allOption","dialog","drag","pagination","label","pageSize","showingXofYofTotal","firstPage","firstPageWithShortcut","previousPage","previousPageWithShortcut","nextPage","nextPageWithShortcut","lastPage","lastPageWithShortcut","pageX","table","edit","copy","del","newSubRow","select","allOptionsSelected","select2","allSelect","allDeselect","cancel","chooseColor","create","delete","save","search","searchOrCreate","toasts","dismiss","tour","back","skip","last","next","open","searchInput","inputLabel","defaultLocalizationContext","locale","texts","formatting","date","Context","React","localization","Provider","props","children","value","Tooltip","ToastProvider","useTaco","useLocalization"],"mappings":";;;;MAkEaA,wBAAwB,GAAG;EACpCC,QAAQ,EAAE;IACNC,MAAM,EAAE,CACJ,SAAS,EACT,UAAU,EACV,OAAO,EACP,OAAO,EACP,KAAK,EACL,MAAM,EACN,MAAM,EACN,QAAQ,EACR,WAAW,EACX,SAAS,EACT,UAAU,EACV,UAAU,CACb;IACDC,aAAa,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC;IAChEC,OAAO,EAAE;MACLC,aAAa,EAAE,gBAAgB;MAC/BC,SAAS,EAAE,YAAY;MACvBC,YAAY,EAAE,eAAe;MAC7BC,QAAQ,EAAE,WAAW;MACrBC,KAAK,EAAE;;GAEd;EACDC,QAAQ,EAAE;IACNC,OAAO,EAAE;GACZ;EACDC,UAAU,EAAE;IACRX,QAAQ,EAAE,UAAU;IACpBY,KAAK,EAAE,OAAO;IACdC,MAAM,EAAE,eAAe;IACvBC,SAAS,EAAE;GACd;EACDC,MAAM,EAAE;IACJC,KAAK,EAAE;GACV;EACDC,OAAO,EAAE;IACLC,OAAO,EAAE,oBAAoB;IAC7BC,KAAK,EAAE,kBAAkB;IACzBC,SAAS,EAAE;GACd;EACDC,MAAM,EAAE;IACJL,KAAK,EAAE,OAAO;IACdM,IAAI,EAAE;GACT;EACDC,UAAU,EAAE;IACRC,KAAK,EAAE,YAAY;IACnBC,QAAQ,EAAE,gBAAgB;IAC1BC,kBAA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