@economic/taco 1.0.5 → 1.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/_virtual/_rollupPluginBabelHelpers.js +35 -0
- package/dist/esm/_virtual/_rollupPluginBabelHelpers.js.map +1 -0
- package/dist/esm/components/Accordion/Accordion.js +93 -0
- package/dist/esm/components/Accordion/Accordion.js.map +1 -0
- package/dist/esm/components/Backdrop/Backdrop.js +13 -0
- package/dist/esm/components/Backdrop/Backdrop.js.map +1 -0
- package/dist/esm/components/Badge/Badge.js +32 -0
- package/dist/esm/components/Badge/Badge.js.map +1 -0
- package/dist/esm/components/Banner/Banner.js +24 -0
- package/dist/esm/components/Banner/Banner.js.map +1 -0
- package/dist/esm/components/Banner/util.js +36 -0
- package/dist/esm/components/Banner/util.js.map +1 -0
- package/dist/esm/components/Button/Button.js +36 -0
- package/dist/esm/components/Button/Button.js.map +1 -0
- package/dist/esm/components/Button/util.js +77 -0
- package/dist/esm/components/Button/util.js.map +1 -0
- package/dist/esm/components/Calendar/Calendar.js +152 -0
- package/dist/esm/components/Calendar/Calendar.js.map +1 -0
- package/dist/esm/components/Checkbox/Checkbox.js +58 -0
- package/dist/esm/components/Checkbox/Checkbox.js.map +1 -0
- package/dist/esm/components/Combobox/Combobox.js +89 -0
- package/dist/esm/components/Combobox/Combobox.js.map +1 -0
- package/dist/esm/components/Combobox/useCombobox.js +285 -0
- package/dist/esm/components/Combobox/useCombobox.js.map +1 -0
- package/dist/esm/components/Datepicker/Datepicker.js +75 -0
- package/dist/esm/components/Datepicker/Datepicker.js.map +1 -0
- package/dist/esm/components/Datepicker/useDatepicker.js +88 -0
- package/dist/esm/components/Datepicker/useDatepicker.js.map +1 -0
- package/dist/esm/components/Dialog/Context.js +26 -0
- package/dist/esm/components/Dialog/Context.js.map +1 -0
- package/dist/esm/components/Dialog/Dialog.js +98 -0
- package/dist/esm/components/Dialog/Dialog.js.map +1 -0
- package/dist/esm/components/Dialog/components/Content.js +135 -0
- package/dist/esm/components/Dialog/components/Content.js.map +1 -0
- package/dist/esm/components/Dialog/components/Drawer.js +42 -0
- package/dist/esm/components/Dialog/components/Drawer.js.map +1 -0
- package/dist/esm/components/Dialog/components/Extra.js +15 -0
- package/dist/esm/components/Dialog/components/Extra.js.map +1 -0
- package/dist/esm/components/Dialog/components/Trigger.js +15 -0
- package/dist/esm/components/Dialog/components/Trigger.js.map +1 -0
- package/dist/esm/components/Field/Field.js +33 -0
- package/dist/esm/components/Field/Field.js.map +1 -0
- package/dist/esm/components/Form/Form.js +22 -0
- package/dist/esm/components/Form/Form.js.map +1 -0
- package/dist/esm/components/Group/Group.js +20 -0
- package/dist/esm/components/Group/Group.js.map +1 -0
- package/dist/esm/components/Hanger/Hanger.js +104 -0
- package/dist/esm/components/Hanger/Hanger.js.map +1 -0
- package/dist/esm/components/HoverCard/HoverCard.js +33 -0
- package/dist/esm/components/HoverCard/HoverCard.js.map +1 -0
- package/dist/esm/components/Icon/Icon.js +30 -0
- package/dist/esm/components/Icon/Icon.js.map +1 -0
- package/dist/esm/components/Icon/components/AccountPreview.js +18 -0
- package/dist/esm/components/Icon/components/AccountPreview.js.map +1 -0
- package/dist/esm/components/Icon/components/Accounting.js +18 -0
- package/dist/esm/components/Icon/components/Accounting.js.map +1 -0
- package/dist/esm/components/Icon/components/AccountingYear.js +18 -0
- package/dist/esm/components/Icon/components/AccountingYear.js.map +1 -0
- package/dist/esm/components/Icon/components/AccountingYearCancel.js +18 -0
- package/dist/esm/components/Icon/components/AccountingYearCancel.js.map +1 -0
- package/dist/esm/components/Icon/components/ArrowBottom.js +18 -0
- package/dist/esm/components/Icon/components/ArrowBottom.js.map +1 -0
- package/dist/esm/components/Icon/components/ArrowDown.js +18 -0
- package/dist/esm/components/Icon/components/ArrowDown.js.map +1 -0
- package/dist/esm/components/Icon/components/ArrowEnd.js +18 -0
- package/dist/esm/components/Icon/components/ArrowEnd.js.map +1 -0
- package/dist/esm/components/Icon/components/ArrowLeft.js +18 -0
- package/dist/esm/components/Icon/components/ArrowLeft.js.map +1 -0
- package/dist/esm/components/Icon/components/ArrowRight.js +18 -0
- package/dist/esm/components/Icon/components/ArrowRight.js.map +1 -0
- package/dist/esm/components/Icon/components/ArrowStart.js +18 -0
- package/dist/esm/components/Icon/components/ArrowStart.js.map +1 -0
- package/dist/esm/components/Icon/components/ArrowTop.js +18 -0
- package/dist/esm/components/Icon/components/ArrowTop.js.map +1 -0
- package/dist/esm/components/Icon/components/ArrowUp.js +18 -0
- package/dist/esm/components/Icon/components/ArrowUp.js.map +1 -0
- package/dist/esm/components/Icon/components/Attach.js +18 -0
- package/dist/esm/components/Icon/components/Attach.js.map +1 -0
- package/dist/esm/components/Icon/components/AttachAuto.js +18 -0
- package/dist/esm/components/Icon/components/AttachAuto.js.map +1 -0
- package/dist/esm/components/Icon/components/AttachCancel.js +18 -0
- package/dist/esm/components/Icon/components/AttachCancel.js.map +1 -0
- package/dist/esm/components/Icon/components/Autotext.js +18 -0
- package/dist/esm/components/Icon/components/Autotext.js.map +1 -0
- package/dist/esm/components/Icon/components/AutotextInsert.js +18 -0
- package/dist/esm/components/Icon/components/AutotextInsert.js.map +1 -0
- package/dist/esm/components/Icon/components/Basic.js +18 -0
- package/dist/esm/components/Icon/components/Basic.js.map +1 -0
- package/dist/esm/components/Icon/components/BasicTabs.js +18 -0
- package/dist/esm/components/Icon/components/BasicTabs.js.map +1 -0
- package/dist/esm/components/Icon/components/BellSolid.js +18 -0
- package/dist/esm/components/Icon/components/BellSolid.js.map +1 -0
- package/dist/esm/components/Icon/components/Book.js +18 -0
- package/dist/esm/components/Icon/components/Book.js.map +1 -0
- package/dist/esm/components/Icon/components/Booking.js +18 -0
- package/dist/esm/components/Icon/components/Booking.js.map +1 -0
- package/dist/esm/components/Icon/components/Budget.js +18 -0
- package/dist/esm/components/Icon/components/Budget.js.map +1 -0
- package/dist/esm/components/Icon/components/Calendar.js +18 -0
- package/dist/esm/components/Icon/components/Calendar.js.map +1 -0
- package/dist/esm/components/Icon/components/CashAccount.js +17 -0
- package/dist/esm/components/Icon/components/CashAccount.js.map +1 -0
- package/dist/esm/components/Icon/components/CashReports.js +18 -0
- package/dist/esm/components/Icon/components/CashReports.js.map +1 -0
- package/dist/esm/components/Icon/components/Chat.js +18 -0
- package/dist/esm/components/Icon/components/Chat.js.map +1 -0
- package/dist/esm/components/Icon/components/ChatSolid.js +18 -0
- package/dist/esm/components/Icon/components/ChatSolid.js.map +1 -0
- package/dist/esm/components/Icon/components/ChevronDown.js +18 -0
- package/dist/esm/components/Icon/components/ChevronDown.js.map +1 -0
- package/dist/esm/components/Icon/components/ChevronDownDouble.js +18 -0
- package/dist/esm/components/Icon/components/ChevronDownDouble.js.map +1 -0
- package/dist/esm/components/Icon/components/ChevronDownSolid.js +18 -0
- package/dist/esm/components/Icon/components/ChevronDownSolid.js.map +1 -0
- package/dist/esm/components/Icon/components/ChevronLeft.js +18 -0
- package/dist/esm/components/Icon/components/ChevronLeft.js.map +1 -0
- package/dist/esm/components/Icon/components/ChevronLeftDouble.js +18 -0
- package/dist/esm/components/Icon/components/ChevronLeftDouble.js.map +1 -0
- package/dist/esm/components/Icon/components/ChevronRight.js +18 -0
- package/dist/esm/components/Icon/components/ChevronRight.js.map +1 -0
- package/dist/esm/components/Icon/components/ChevronRightDouble.js +18 -0
- package/dist/esm/components/Icon/components/ChevronRightDouble.js.map +1 -0
- package/dist/esm/components/Icon/components/ChevronUp.js +18 -0
- package/dist/esm/components/Icon/components/ChevronUp.js.map +1 -0
- package/dist/esm/components/Icon/components/ChevronUpDouble.js +18 -0
- package/dist/esm/components/Icon/components/ChevronUpDouble.js.map +1 -0
- package/dist/esm/components/Icon/components/ChevronUpSolid.js +18 -0
- package/dist/esm/components/Icon/components/ChevronUpSolid.js.map +1 -0
- package/dist/esm/components/Icon/components/CircleClose.js +19 -0
- package/dist/esm/components/Icon/components/CircleClose.js.map +1 -0
- package/dist/esm/components/Icon/components/CircleMinus.js +18 -0
- package/dist/esm/components/Icon/components/CircleMinus.js.map +1 -0
- package/dist/esm/components/Icon/components/CirclePlus.js +18 -0
- package/dist/esm/components/Icon/components/CirclePlus.js.map +1 -0
- package/dist/esm/components/Icon/components/CircleTick.js +18 -0
- package/dist/esm/components/Icon/components/CircleTick.js.map +1 -0
- package/dist/esm/components/Icon/components/Clamp.js +18 -0
- package/dist/esm/components/Icon/components/Clamp.js.map +1 -0
- package/dist/esm/components/Icon/components/ClampOpen.js +18 -0
- package/dist/esm/components/Icon/components/ClampOpen.js.map +1 -0
- package/dist/esm/components/Icon/components/Close.js +18 -0
- package/dist/esm/components/Icon/components/Close.js.map +1 -0
- package/dist/esm/components/Icon/components/ConnectionEnable.js +17 -0
- package/dist/esm/components/Icon/components/ConnectionEnable.js.map +1 -0
- package/dist/esm/components/Icon/components/ConnectionRevoke.js +17 -0
- package/dist/esm/components/Icon/components/ConnectionRevoke.js.map +1 -0
- package/dist/esm/components/Icon/components/Contacts.js +18 -0
- package/dist/esm/components/Icon/components/Contacts.js.map +1 -0
- package/dist/esm/components/Icon/components/Copy.js +18 -0
- package/dist/esm/components/Icon/components/Copy.js.map +1 -0
- package/dist/esm/components/Icon/components/Courses.js +17 -0
- package/dist/esm/components/Icon/components/Courses.js.map +1 -0
- package/dist/esm/components/Icon/components/Credit.js +18 -0
- package/dist/esm/components/Icon/components/Credit.js.map +1 -0
- package/dist/esm/components/Icon/components/Delete.js +18 -0
- package/dist/esm/components/Icon/components/Delete.js.map +1 -0
- package/dist/esm/components/Icon/components/DeletePermanently.js +18 -0
- package/dist/esm/components/Icon/components/DeletePermanently.js.map +1 -0
- package/dist/esm/components/Icon/components/Depecriate.js +18 -0
- package/dist/esm/components/Icon/components/Depecriate.js.map +1 -0
- package/dist/esm/components/Icon/components/Developer.js +18 -0
- package/dist/esm/components/Icon/components/Developer.js.map +1 -0
- package/dist/esm/components/Icon/components/DistributionTemplate.js +18 -0
- package/dist/esm/components/Icon/components/DistributionTemplate.js.map +1 -0
- package/dist/esm/components/Icon/components/Document.js +17 -0
- package/dist/esm/components/Icon/components/Document.js.map +1 -0
- package/dist/esm/components/Icon/components/DocumentApprove.js +18 -0
- package/dist/esm/components/Icon/components/DocumentApprove.js.map +1 -0
- package/dist/esm/components/Icon/components/DocumentCreateEntry.js +18 -0
- package/dist/esm/components/Icon/components/DocumentCreateEntry.js.map +1 -0
- package/dist/esm/components/Icon/components/DocumentCut.js +18 -0
- package/dist/esm/components/Icon/components/DocumentCut.js.map +1 -0
- package/dist/esm/components/Icon/components/DocumentError.js +18 -0
- package/dist/esm/components/Icon/components/DocumentError.js.map +1 -0
- package/dist/esm/components/Icon/components/DocumentIsolatePage.js +18 -0
- package/dist/esm/components/Icon/components/DocumentIsolatePage.js.map +1 -0
- package/dist/esm/components/Icon/components/DocumentMerge.js +18 -0
- package/dist/esm/components/Icon/components/DocumentMerge.js.map +1 -0
- package/dist/esm/components/Icon/components/DocumentMove.js +18 -0
- package/dist/esm/components/Icon/components/DocumentMove.js.map +1 -0
- package/dist/esm/components/Icon/components/DocumentPreview.js +18 -0
- package/dist/esm/components/Icon/components/DocumentPreview.js.map +1 -0
- package/dist/esm/components/Icon/components/DocumentReceived.js +17 -0
- package/dist/esm/components/Icon/components/DocumentReceived.js.map +1 -0
- package/dist/esm/components/Icon/components/DocumentRejectedRequest.js +17 -0
- package/dist/esm/components/Icon/components/DocumentRejectedRequest.js.map +1 -0
- package/dist/esm/components/Icon/components/DocumentSplit.js +18 -0
- package/dist/esm/components/Icon/components/DocumentSplit.js.map +1 -0
- package/dist/esm/components/Icon/components/DocumentTime.js +18 -0
- package/dist/esm/components/Icon/components/DocumentTime.js.map +1 -0
- package/dist/esm/components/Icon/components/Download.js +18 -0
- package/dist/esm/components/Icon/components/Download.js.map +1 -0
- package/dist/esm/components/Icon/components/Drag.js +18 -0
- package/dist/esm/components/Icon/components/Drag.js.map +1 -0
- package/dist/esm/components/Icon/components/ECopedia.js +18 -0
- package/dist/esm/components/Icon/components/ECopedia.js.map +1 -0
- package/dist/esm/components/Icon/components/ESignature.js +18 -0
- package/dist/esm/components/Icon/components/ESignature.js.map +1 -0
- package/dist/esm/components/Icon/components/Edit.js +18 -0
- package/dist/esm/components/Icon/components/Edit.js.map +1 -0
- package/dist/esm/components/Icon/components/EllipsisHorizontal.js +18 -0
- package/dist/esm/components/Icon/components/EllipsisHorizontal.js.map +1 -0
- package/dist/esm/components/Icon/components/EllipsisVertical.js +18 -0
- package/dist/esm/components/Icon/components/EllipsisVertical.js.map +1 -0
- package/dist/esm/components/Icon/components/EntriesOnAccount.js +18 -0
- package/dist/esm/components/Icon/components/EntriesOnAccount.js.map +1 -0
- package/dist/esm/components/Icon/components/EntriesOpen.js +18 -0
- package/dist/esm/components/Icon/components/EntriesOpen.js.map +1 -0
- package/dist/esm/components/Icon/components/EntriesWarning.js +18 -0
- package/dist/esm/components/Icon/components/EntriesWarning.js.map +1 -0
- package/dist/esm/components/Icon/components/EntryTypeCustomerInvoice.js +18 -0
- package/dist/esm/components/Icon/components/EntryTypeCustomerInvoice.js.map +1 -0
- package/dist/esm/components/Icon/components/EntryTypeCustomerPayment.js +18 -0
- package/dist/esm/components/Icon/components/EntryTypeCustomerPayment.js.map +1 -0
- package/dist/esm/components/Icon/components/EntryTypeJournalEntry.js +18 -0
- package/dist/esm/components/Icon/components/EntryTypeJournalEntry.js.map +1 -0
- package/dist/esm/components/Icon/components/EntryTypeManualCustomerInvoice.js +18 -0
- package/dist/esm/components/Icon/components/EntryTypeManualCustomerInvoice.js.map +1 -0
- package/dist/esm/components/Icon/components/EntryTypeSupplierInvoice.js +18 -0
- package/dist/esm/components/Icon/components/EntryTypeSupplierInvoice.js.map +1 -0
- package/dist/esm/components/Icon/components/EntryTypeSupplierPayment.js +18 -0
- package/dist/esm/components/Icon/components/EntryTypeSupplierPayment.js.map +1 -0
- package/dist/esm/components/Icon/components/Envelope.js +18 -0
- package/dist/esm/components/Icon/components/Envelope.js.map +1 -0
- package/dist/esm/components/Icon/components/EnvelopeApproved.js +18 -0
- package/dist/esm/components/Icon/components/EnvelopeApproved.js.map +1 -0
- package/dist/esm/components/Icon/components/ExpandView.js +18 -0
- package/dist/esm/components/Icon/components/ExpandView.js.map +1 -0
- package/dist/esm/components/Icon/components/Expenses.js +18 -0
- package/dist/esm/components/Icon/components/Expenses.js.map +1 -0
- package/dist/esm/components/Icon/components/Export.js +18 -0
- package/dist/esm/components/Icon/components/Export.js.map +1 -0
- package/dist/esm/components/Icon/components/ExportToExcel.js +18 -0
- package/dist/esm/components/Icon/components/ExportToExcel.js.map +1 -0
- package/dist/esm/components/Icon/components/ExportToPdf.js +18 -0
- package/dist/esm/components/Icon/components/ExportToPdf.js.map +1 -0
- package/dist/esm/components/Icon/components/Filter.js +18 -0
- package/dist/esm/components/Icon/components/Filter.js.map +1 -0
- package/dist/esm/components/Icon/components/FilterSolid.js +18 -0
- package/dist/esm/components/Icon/components/FilterSolid.js.map +1 -0
- package/dist/esm/components/Icon/components/GraphSolid.js +18 -0
- package/dist/esm/components/Icon/components/GraphSolid.js.map +1 -0
- package/dist/esm/components/Icon/components/Hash.js +18 -0
- package/dist/esm/components/Icon/components/Hash.js.map +1 -0
- package/dist/esm/components/Icon/components/Home.js +18 -0
- package/dist/esm/components/Icon/components/Home.js.map +1 -0
- package/dist/esm/components/Icon/components/Images.js +18 -0
- package/dist/esm/components/Icon/components/Images.js.map +1 -0
- package/dist/esm/components/Icon/components/Import.js +18 -0
- package/dist/esm/components/Icon/components/Import.js.map +1 -0
- package/dist/esm/components/Icon/components/Inbox.js +20 -0
- package/dist/esm/components/Icon/components/Inbox.js.map +1 -0
- package/dist/esm/components/Icon/components/InboxEinvoicing.js +20 -0
- package/dist/esm/components/Icon/components/InboxEinvoicing.js.map +1 -0
- package/dist/esm/components/Icon/components/InboxScanning.js +20 -0
- package/dist/esm/components/Icon/components/InboxScanning.js.map +1 -0
- package/dist/esm/components/Icon/components/InboxSmart.js +20 -0
- package/dist/esm/components/Icon/components/InboxSmart.js.map +1 -0
- package/dist/esm/components/Icon/components/Info.js +18 -0
- package/dist/esm/components/Icon/components/Info.js.map +1 -0
- package/dist/esm/components/Icon/components/Inventory.js +18 -0
- package/dist/esm/components/Icon/components/Inventory.js.map +1 -0
- package/dist/esm/components/Icon/components/InventoryMatrix.js +18 -0
- package/dist/esm/components/Icon/components/InventoryMatrix.js.map +1 -0
- package/dist/esm/components/Icon/components/JournalPro.js +18 -0
- package/dist/esm/components/Icon/components/JournalPro.js.map +1 -0
- package/dist/esm/components/Icon/components/Layout.js +18 -0
- package/dist/esm/components/Icon/components/Layout.js.map +1 -0
- package/dist/esm/components/Icon/components/LayoutBoth.js +18 -0
- package/dist/esm/components/Icon/components/LayoutBoth.js.map +1 -0
- package/dist/esm/components/Icon/components/LayoutFirst.js +18 -0
- package/dist/esm/components/Icon/components/LayoutFirst.js.map +1 -0
- package/dist/esm/components/Icon/components/LayoutLast.js +18 -0
- package/dist/esm/components/Icon/components/LayoutLast.js.map +1 -0
- package/dist/esm/components/Icon/components/LayoutNone.js +18 -0
- package/dist/esm/components/Icon/components/LayoutNone.js.map +1 -0
- package/dist/esm/components/Icon/components/LedgerCard.js +18 -0
- package/dist/esm/components/Icon/components/LedgerCard.js.map +1 -0
- package/dist/esm/components/Icon/components/LedgerCardCustomerReminder.js +18 -0
- package/dist/esm/components/Icon/components/LedgerCardCustomerReminder.js.map +1 -0
- package/dist/esm/components/Icon/components/LedgerCardManualCustomerInvoice.js +18 -0
- package/dist/esm/components/Icon/components/LedgerCardManualCustomerInvoice.js.map +1 -0
- package/dist/esm/components/Icon/components/LedgerCardObsoleteStock.js +18 -0
- package/dist/esm/components/Icon/components/LedgerCardObsoleteStock.js.map +1 -0
- package/dist/esm/components/Icon/components/LedgerCardOpeningEntry.js +18 -0
- package/dist/esm/components/Icon/components/LedgerCardOpeningEntry.js.map +1 -0
- package/dist/esm/components/Icon/components/LedgerCardReservedEntry.js +18 -0
- package/dist/esm/components/Icon/components/LedgerCardReservedEntry.js.map +1 -0
- package/dist/esm/components/Icon/components/LedgerCardShrinkagePilferage.js +18 -0
- package/dist/esm/components/Icon/components/LedgerCardShrinkagePilferage.js.map +1 -0
- package/dist/esm/components/Icon/components/LedgerCardStockAdjustment.js +18 -0
- package/dist/esm/components/Icon/components/LedgerCardStockAdjustment.js.map +1 -0
- package/dist/esm/components/Icon/components/LedgerCardTransferredOpeningEntry.js +18 -0
- package/dist/esm/components/Icon/components/LedgerCardTransferredOpeningEntry.js.map +1 -0
- package/dist/esm/components/Icon/components/Lightbulb.js +18 -0
- package/dist/esm/components/Icon/components/Lightbulb.js.map +1 -0
- package/dist/esm/components/Icon/components/Line.js +18 -0
- package/dist/esm/components/Icon/components/Line.js.map +1 -0
- package/dist/esm/components/Icon/components/List.js +18 -0
- package/dist/esm/components/Icon/components/List.js.map +1 -0
- package/dist/esm/components/Icon/components/ListBulleted.js +18 -0
- package/dist/esm/components/Icon/components/ListBulleted.js.map +1 -0
- package/dist/esm/components/Icon/components/ListSearch.js +18 -0
- package/dist/esm/components/Icon/components/ListSearch.js.map +1 -0
- package/dist/esm/components/Icon/components/LockOpen.js +18 -0
- package/dist/esm/components/Icon/components/LockOpen.js.map +1 -0
- package/dist/esm/components/Icon/components/Log.js +18 -0
- package/dist/esm/components/Icon/components/Log.js.map +1 -0
- package/dist/esm/components/Icon/components/Market.js +18 -0
- package/dist/esm/components/Icon/components/Market.js.map +1 -0
- package/dist/esm/components/Icon/components/MatchAmount.js +18 -0
- package/dist/esm/components/Icon/components/MatchAmount.js.map +1 -0
- package/dist/esm/components/Icon/components/MatchEntries.js +18 -0
- package/dist/esm/components/Icon/components/MatchEntries.js.map +1 -0
- package/dist/esm/components/Icon/components/Mileage.js +18 -0
- package/dist/esm/components/Icon/components/Mileage.js.map +1 -0
- package/dist/esm/components/Icon/components/ModalResize.js +18 -0
- package/dist/esm/components/Icon/components/ModalResize.js.map +1 -0
- package/dist/esm/components/Icon/components/ModalShrink.js +18 -0
- package/dist/esm/components/Icon/components/ModalShrink.js.map +1 -0
- package/dist/esm/components/Icon/components/More.js +18 -0
- package/dist/esm/components/Icon/components/More.js.map +1 -0
- package/dist/esm/components/Icon/components/MoreSolid.js +18 -0
- package/dist/esm/components/Icon/components/MoreSolid.js.map +1 -0
- package/dist/esm/components/Icon/components/Move.js +18 -0
- package/dist/esm/components/Icon/components/Move.js.map +1 -0
- package/dist/esm/components/Icon/components/NavigationList.js +18 -0
- package/dist/esm/components/Icon/components/NavigationList.js.map +1 -0
- package/dist/esm/components/Icon/components/Note.js +18 -0
- package/dist/esm/components/Icon/components/Note.js.map +1 -0
- package/dist/esm/components/Icon/components/NoteFollowUp.js +18 -0
- package/dist/esm/components/Icon/components/NoteFollowUp.js.map +1 -0
- package/dist/esm/components/Icon/components/NoteRead.js +18 -0
- package/dist/esm/components/Icon/components/NoteRead.js.map +1 -0
- package/dist/esm/components/Icon/components/PartnerApi.js +18 -0
- package/dist/esm/components/Icon/components/PartnerApi.js.map +1 -0
- package/dist/esm/components/Icon/components/Period.js +18 -0
- package/dist/esm/components/Icon/components/Period.js.map +1 -0
- package/dist/esm/components/Icon/components/PersonChange.js +18 -0
- package/dist/esm/components/Icon/components/PersonChange.js.map +1 -0
- package/dist/esm/components/Icon/components/PersonMinus.js +18 -0
- package/dist/esm/components/Icon/components/PersonMinus.js.map +1 -0
- package/dist/esm/components/Icon/components/PersonPlus.js +18 -0
- package/dist/esm/components/Icon/components/PersonPlus.js.map +1 -0
- package/dist/esm/components/Icon/components/PersonTick.js +18 -0
- package/dist/esm/components/Icon/components/PersonTick.js.map +1 -0
- package/dist/esm/components/Icon/components/Play.js +18 -0
- package/dist/esm/components/Icon/components/Play.js.map +1 -0
- package/dist/esm/components/Icon/components/PlusMinus.js +18 -0
- package/dist/esm/components/Icon/components/PlusMinus.js.map +1 -0
- package/dist/esm/components/Icon/components/Print.js +18 -0
- package/dist/esm/components/Icon/components/Print.js.map +1 -0
- package/dist/esm/components/Icon/components/ProcessPayment.js +18 -0
- package/dist/esm/components/Icon/components/ProcessPayment.js.map +1 -0
- package/dist/esm/components/Icon/components/ProductLedgerCard.js +18 -0
- package/dist/esm/components/Icon/components/ProductLedgerCard.js.map +1 -0
- package/dist/esm/components/Icon/components/ProjectCards.js +18 -0
- package/dist/esm/components/Icon/components/ProjectCards.js.map +1 -0
- package/dist/esm/components/Icon/components/Projects.js +18 -0
- package/dist/esm/components/Icon/components/Projects.js.map +1 -0
- package/dist/esm/components/Icon/components/Quicklinks.js +18 -0
- package/dist/esm/components/Icon/components/Quicklinks.js.map +1 -0
- package/dist/esm/components/Icon/components/RatingBankruptcy.js +18 -0
- package/dist/esm/components/Icon/components/RatingBankruptcy.js.map +1 -0
- package/dist/esm/components/Icon/components/RatingPaymentProblems.js +18 -0
- package/dist/esm/components/Icon/components/RatingPaymentProblems.js.map +1 -0
- package/dist/esm/components/Icon/components/Reconciled.js +18 -0
- package/dist/esm/components/Icon/components/Reconciled.js.map +1 -0
- package/dist/esm/components/Icon/components/Refresh.js +17 -0
- package/dist/esm/components/Icon/components/Refresh.js.map +1 -0
- package/dist/esm/components/Icon/components/Report.js +18 -0
- package/dist/esm/components/Icon/components/Report.js.map +1 -0
- package/dist/esm/components/Icon/components/ReportSolid.js +18 -0
- package/dist/esm/components/Icon/components/ReportSolid.js.map +1 -0
- package/dist/esm/components/Icon/components/Restore.js +18 -0
- package/dist/esm/components/Icon/components/Restore.js.map +1 -0
- package/dist/esm/components/Icon/components/RotateLeft.js +17 -0
- package/dist/esm/components/Icon/components/RotateLeft.js.map +1 -0
- package/dist/esm/components/Icon/components/RotateRight.js +17 -0
- package/dist/esm/components/Icon/components/RotateRight.js.map +1 -0
- package/dist/esm/components/Icon/components/Sales.js +18 -0
- package/dist/esm/components/Icon/components/Sales.js.map +1 -0
- package/dist/esm/components/Icon/components/Search.js +18 -0
- package/dist/esm/components/Icon/components/Search.js.map +1 -0
- package/dist/esm/components/Icon/components/SearchBold.js +18 -0
- package/dist/esm/components/Icon/components/SearchBold.js.map +1 -0
- package/dist/esm/components/Icon/components/Secure.js +18 -0
- package/dist/esm/components/Icon/components/Secure.js.map +1 -0
- package/dist/esm/components/Icon/components/SecureTick.js +18 -0
- package/dist/esm/components/Icon/components/SecureTick.js.map +1 -0
- package/dist/esm/components/Icon/components/Settings.js +18 -0
- package/dist/esm/components/Icon/components/Settings.js.map +1 -0
- package/dist/esm/components/Icon/components/SettingsSolid.js +18 -0
- package/dist/esm/components/Icon/components/SettingsSolid.js.map +1 -0
- package/dist/esm/components/Icon/components/Shortcuts.js +18 -0
- package/dist/esm/components/Icon/components/Shortcuts.js.map +1 -0
- package/dist/esm/components/Icon/components/ShowAll.js +18 -0
- package/dist/esm/components/Icon/components/ShowAll.js.map +1 -0
- package/dist/esm/components/Icon/components/ShowLess.js +18 -0
- package/dist/esm/components/Icon/components/ShowLess.js.map +1 -0
- package/dist/esm/components/Icon/components/ShowMore.js +18 -0
- package/dist/esm/components/Icon/components/ShowMore.js.map +1 -0
- package/dist/esm/components/Icon/components/ShowTemplate.js +18 -0
- package/dist/esm/components/Icon/components/ShowTemplate.js.map +1 -0
- package/dist/esm/components/Icon/components/Sliders.js +18 -0
- package/dist/esm/components/Icon/components/Sliders.js.map +1 -0
- package/dist/esm/components/Icon/components/Smartpay.js +18 -0
- package/dist/esm/components/Icon/components/Smartpay.js.map +1 -0
- package/dist/esm/components/Icon/components/SortBy.js +18 -0
- package/dist/esm/components/Icon/components/SortBy.js.map +1 -0
- package/dist/esm/components/Icon/components/Spinner.js +21 -0
- package/dist/esm/components/Icon/components/Spinner.js.map +1 -0
- package/dist/esm/components/Icon/components/Star.js +18 -0
- package/dist/esm/components/Icon/components/Star.js.map +1 -0
- package/dist/esm/components/Icon/components/StarSolid.js +18 -0
- package/dist/esm/components/Icon/components/StarSolid.js.map +1 -0
- package/dist/esm/components/Icon/components/Subscriptions.js +18 -0
- package/dist/esm/components/Icon/components/Subscriptions.js.map +1 -0
- package/dist/esm/components/Icon/components/SystemEntries.js +18 -0
- package/dist/esm/components/Icon/components/SystemEntries.js.map +1 -0
- package/dist/esm/components/Icon/components/Tag.js +18 -0
- package/dist/esm/components/Icon/components/Tag.js.map +1 -0
- package/dist/esm/components/Icon/components/TemplateOverride.js +18 -0
- package/dist/esm/components/Icon/components/TemplateOverride.js.map +1 -0
- package/dist/esm/components/Icon/components/Templates.js +18 -0
- package/dist/esm/components/Icon/components/Templates.js.map +1 -0
- package/dist/esm/components/Icon/components/ThumbBoth.js +18 -0
- package/dist/esm/components/Icon/components/ThumbBoth.js.map +1 -0
- package/dist/esm/components/Icon/components/ThumbDown.js +18 -0
- package/dist/esm/components/Icon/components/ThumbDown.js.map +1 -0
- package/dist/esm/components/Icon/components/ThumbDownSolid.js +18 -0
- package/dist/esm/components/Icon/components/ThumbDownSolid.js.map +1 -0
- package/dist/esm/components/Icon/components/ThumbUp.js +18 -0
- package/dist/esm/components/Icon/components/ThumbUp.js.map +1 -0
- package/dist/esm/components/Icon/components/ThumbUpSolid.js +18 -0
- package/dist/esm/components/Icon/components/ThumbUpSolid.js.map +1 -0
- package/dist/esm/components/Icon/components/Tick.js +18 -0
- package/dist/esm/components/Icon/components/Tick.js.map +1 -0
- package/dist/esm/components/Icon/components/Time.js +18 -0
- package/dist/esm/components/Icon/components/Time.js.map +1 -0
- package/dist/esm/components/Icon/components/Transfer.js +18 -0
- package/dist/esm/components/Icon/components/Transfer.js.map +1 -0
- package/dist/esm/components/Icon/components/TransferCancel.js +24 -0
- package/dist/esm/components/Icon/components/TransferCancel.js.map +1 -0
- package/dist/esm/components/Icon/components/TransferLocked.js +18 -0
- package/dist/esm/components/Icon/components/TransferLocked.js.map +1 -0
- package/dist/esm/components/Icon/components/Undock.js +18 -0
- package/dist/esm/components/Icon/components/Undock.js.map +1 -0
- package/dist/esm/components/Icon/components/Unreconciled.js +18 -0
- package/dist/esm/components/Icon/components/Unreconciled.js.map +1 -0
- package/dist/esm/components/Icon/components/Warning.js +17 -0
- package/dist/esm/components/Icon/components/Warning.js.map +1 -0
- package/dist/esm/components/Icon/components/Webshop.js +18 -0
- package/dist/esm/components/Icon/components/Webshop.js.map +1 -0
- package/dist/esm/components/Icon/components/Website.js +18 -0
- package/dist/esm/components/Icon/components/Website.js.map +1 -0
- package/dist/esm/components/Icon/components/Workflow.js +17 -0
- package/dist/esm/components/Icon/components/Workflow.js.map +1 -0
- package/dist/esm/components/Icon/components/Zoom.js +18 -0
- package/dist/esm/components/Icon/components/Zoom.js.map +1 -0
- package/dist/esm/components/Icon/components/index.js +414 -0
- package/dist/esm/components/Icon/components/index.js.map +1 -0
- package/dist/esm/components/IconButton/IconButton.js +35 -0
- package/dist/esm/components/IconButton/IconButton.js.map +1 -0
- package/dist/esm/components/Input/Input.js +85 -0
- package/dist/esm/components/Input/Input.js.map +1 -0
- package/dist/esm/components/Input/util.js +22 -0
- package/dist/esm/components/Input/util.js.map +1 -0
- package/dist/esm/components/Listbox/Listbox.js +58 -0
- package/dist/esm/components/Listbox/Listbox.js.map +1 -0
- package/dist/esm/components/Listbox/ScrollableList.js +174 -0
- package/dist/esm/components/Listbox/ScrollableList.js.map +1 -0
- package/dist/esm/components/Listbox/useListbox.js +145 -0
- package/dist/esm/components/Listbox/useListbox.js.map +1 -0
- package/dist/esm/components/Listbox/useMultiListbox.js +196 -0
- package/dist/esm/components/Listbox/useMultiListbox.js.map +1 -0
- package/dist/esm/components/Listbox/useTypeahead.js +28 -0
- package/dist/esm/components/Listbox/useTypeahead.js.map +1 -0
- package/dist/esm/components/Listbox/util.js +150 -0
- package/dist/esm/components/Listbox/util.js.map +1 -0
- package/dist/esm/components/Menu/Context.js +9 -0
- package/dist/esm/components/Menu/Context.js.map +1 -0
- package/dist/esm/components/Menu/Menu.js +74 -0
- package/dist/esm/components/Menu/Menu.js.map +1 -0
- package/dist/esm/components/Menu/components/Checkbox.js +31 -0
- package/dist/esm/components/Menu/components/Checkbox.js.map +1 -0
- package/dist/esm/components/Menu/components/Content.js +50 -0
- package/dist/esm/components/Menu/components/Content.js.map +1 -0
- package/dist/esm/components/Menu/components/Header.js +38 -0
- package/dist/esm/components/Menu/components/Header.js.map +1 -0
- package/dist/esm/components/Menu/components/Item.js +140 -0
- package/dist/esm/components/Menu/components/Item.js.map +1 -0
- package/dist/esm/components/Menu/components/Link.js +39 -0
- package/dist/esm/components/Menu/components/Link.js.map +1 -0
- package/dist/esm/components/Menu/components/RadioGroup.js +48 -0
- package/dist/esm/components/Menu/components/RadioGroup.js.map +1 -0
- package/dist/esm/components/Menu/components/Separator.js +35 -0
- package/dist/esm/components/Menu/components/Separator.js.map +1 -0
- package/dist/esm/components/Menu/components/Trigger.js +33 -0
- package/dist/esm/components/Menu/components/Trigger.js.map +1 -0
- package/dist/esm/components/Navigation/Navigation.js +125 -0
- package/dist/esm/components/Navigation/Navigation.js.map +1 -0
- package/dist/esm/components/Pagination/PageNumbers.js +50 -0
- package/dist/esm/components/Pagination/PageNumbers.js.map +1 -0
- package/dist/esm/components/Pagination/Pagination.js +103 -0
- package/dist/esm/components/Pagination/Pagination.js.map +1 -0
- package/dist/esm/components/Pagination/usePagination.js +15 -0
- package/dist/esm/components/Pagination/usePagination.js.map +1 -0
- package/dist/esm/components/Pagination/usePaginationShortcuts.js +50 -0
- package/dist/esm/components/Pagination/usePaginationShortcuts.js.map +1 -0
- package/dist/esm/components/Popover/Popover.js +84 -0
- package/dist/esm/components/Popover/Popover.js.map +1 -0
- package/dist/esm/components/Popover/Primitives.js +41 -0
- package/dist/esm/components/Popover/Primitives.js.map +1 -0
- package/dist/esm/components/Progress/Progress.js +32 -0
- package/dist/esm/components/Progress/Progress.js.map +1 -0
- package/dist/esm/components/Provider/Provider.js +105 -0
- package/dist/esm/components/Provider/Provider.js.map +1 -0
- package/dist/esm/components/RadioGroup/RadioGroup.js +106 -0
- package/dist/esm/components/RadioGroup/RadioGroup.js.map +1 -0
- package/dist/esm/components/SearchInput/SearchInput.js +95 -0
- package/dist/esm/components/SearchInput/SearchInput.js.map +1 -0
- package/dist/esm/components/Select/Select.js +100 -0
- package/dist/esm/components/Select/Select.js.map +1 -0
- package/dist/esm/components/Select/useSelect.js +212 -0
- package/dist/esm/components/Select/useSelect.js.map +1 -0
- package/dist/esm/components/Spinner/Spinner.js +48 -0
- package/dist/esm/components/Spinner/Spinner.js.map +1 -0
- package/dist/esm/components/Switch/Switch.js +37 -0
- package/dist/esm/components/Switch/Switch.js.map +1 -0
- package/dist/esm/components/Table/components/BaseTable.js +48 -0
- package/dist/esm/components/Table/components/BaseTable.js.map +1 -0
- package/dist/esm/components/Table/components/PaginatedTable.js +16 -0
- package/dist/esm/components/Table/components/PaginatedTable.js.map +1 -0
- package/dist/esm/components/Table/components/Table.js +56 -0
- package/dist/esm/components/Table/components/Table.js.map +1 -0
- package/dist/esm/components/Table/components/WindowedTable.js +186 -0
- package/dist/esm/components/Table/components/WindowedTable.js.map +1 -0
- package/dist/esm/components/Table/hooks/plugins/useRowActions.js +236 -0
- package/dist/esm/components/Table/hooks/plugins/useRowActions.js.map +1 -0
- package/dist/esm/components/Table/hooks/plugins/useRowDraggable.js +129 -0
- package/dist/esm/components/Table/hooks/plugins/useRowDraggable.js.map +1 -0
- package/dist/esm/components/Table/hooks/plugins/useRowEditing.js +100 -0
- package/dist/esm/components/Table/hooks/plugins/useRowEditing.js.map +1 -0
- package/dist/esm/components/Table/hooks/plugins/useRowSelect.js +108 -0
- package/dist/esm/components/Table/hooks/plugins/useRowSelect.js.map +1 -0
- package/dist/esm/components/Table/hooks/useRowCreation.js +106 -0
- package/dist/esm/components/Table/hooks/useRowCreation.js.map +1 -0
- package/dist/esm/components/Table/hooks/useTable.js +217 -0
- package/dist/esm/components/Table/hooks/useTable.js.map +1 -0
- package/dist/esm/components/Table/hooks/useTableKeyboardNavigation.js +132 -0
- package/dist/esm/components/Table/hooks/useTableKeyboardNavigation.js.map +1 -0
- package/dist/esm/components/Table/util/renderColumn.js +40 -0
- package/dist/esm/components/Table/util/renderColumn.js.map +1 -0
- package/dist/esm/components/Table/util/renderRow.js +101 -0
- package/dist/esm/components/Table/util/renderRow.js.map +1 -0
- package/dist/esm/components/Table/util/rowIndexPath.js +57 -0
- package/dist/esm/components/Table/util/rowIndexPath.js.map +1 -0
- package/dist/esm/components/Table/util/sortTypes.js +82 -0
- package/dist/esm/components/Table/util/sortTypes.js.map +1 -0
- package/dist/esm/components/Table/util.js +99 -0
- package/dist/esm/components/Table/util.js.map +1 -0
- package/dist/esm/components/Tabs/Tabs.js +69 -0
- package/dist/esm/components/Tabs/Tabs.js.map +1 -0
- package/dist/esm/components/Textarea/Textarea.js +39 -0
- package/dist/esm/components/Textarea/Textarea.js.map +1 -0
- package/dist/esm/components/Toast/Toast.js +79 -0
- package/dist/esm/components/Toast/Toast.js.map +1 -0
- package/dist/esm/components/Toast/Toaster.js +163 -0
- package/dist/esm/components/Toast/Toaster.js.map +1 -0
- package/dist/esm/components/Toast/util.js +46 -0
- package/dist/esm/components/Toast/util.js.map +1 -0
- package/dist/esm/components/Tooltip/Tooltip.js +32 -0
- package/dist/esm/components/Tooltip/Tooltip.js.map +1 -0
- package/dist/esm/components/Tour/Tour.js +142 -0
- package/dist/esm/components/Tour/Tour.js.map +1 -0
- package/dist/esm/components/Treeview/Treeview.js +73 -0
- package/dist/esm/components/Treeview/Treeview.js.map +1 -0
- package/dist/esm/components/VisuallyHidden/VisuallyHidden.js +11 -0
- package/dist/esm/components/VisuallyHidden/VisuallyHidden.js.map +1 -0
- package/dist/esm/index.css +661 -0
- package/dist/esm/index.js +50 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/primitives/Button.js +21 -0
- package/dist/esm/primitives/Button.js.map +1 -0
- package/dist/esm/utils/date.js +98 -0
- package/dist/esm/utils/date.js.map +1 -0
- package/dist/esm/utils/hooks/useBoundingClientRectListener.js +50 -0
- package/dist/esm/utils/hooks/useBoundingClientRectListener.js.map +1 -0
- package/dist/esm/utils/hooks/useDraggable.js +42 -0
- package/dist/esm/utils/hooks/useDraggable.js.map +1 -0
- package/dist/esm/utils/hooks/useDropTarget.js +38 -0
- package/dist/esm/utils/hooks/useDropTarget.js.map +1 -0
- package/dist/esm/utils/hooks/useListKeyboardNavigation.js +58 -0
- package/dist/esm/utils/hooks/useListKeyboardNavigation.js.map +1 -0
- package/dist/esm/utils/hooks/useListScrollTo.js +38 -0
- package/dist/esm/utils/hooks/useListScrollTo.js.map +1 -0
- package/dist/esm/utils/hooks/useOnClickOutside.js +27 -0
- package/dist/esm/utils/hooks/useOnClickOutside.js.map +1 -0
- package/dist/esm/utils/hooks/useProxiedRef.js +18 -0
- package/dist/esm/utils/hooks/useProxiedRef.js.map +1 -0
- package/dist/esm/utils/hooks/useTimer.js +50 -0
- package/dist/esm/utils/hooks/useTimer.js.map +1 -0
- package/dist/esm/utils/input.js +49 -0
- package/dist/esm/utils/input.js.map +1 -0
- package/dist/esm/utils/mergeRefs.js +14 -0
- package/dist/esm/utils/mergeRefs.js.map +1 -0
- package/dist/esm/utils/taillwind.js +41 -0
- package/dist/esm/utils/taillwind.js.map +1 -0
- package/dist/taco.cjs.development.js +458 -552
- package/dist/taco.cjs.development.js.map +1 -1
- package/dist/taco.cjs.production.min.js +2 -0
- package/dist/taco.cjs.production.min.js.map +1 -0
- package/package.json +2 -2
@@ -0,0 +1,37 @@
|
|
1
|
+
import { forwardRef, createElement } from 'react';
|
2
|
+
import cn from 'classnames';
|
3
|
+
import { Root, Thumb } from '@radix-ui/react-switch';
|
4
|
+
|
5
|
+
const Switch = /*#__PURE__*/forwardRef(function Switch(props, ref) {
|
6
|
+
const {
|
7
|
+
label,
|
8
|
+
onChange,
|
9
|
+
...otherProps
|
10
|
+
} = props;
|
11
|
+
const className = cn('group h-5 w-9 flex rounded-full inline-flex', {
|
12
|
+
'mr-2': !!label,
|
13
|
+
'bg-grey-darker hover:bg-grey-dark aria-checked:bg-blue aria-checked:hover:bg-blue-light focus:yt-focus': !props.disabled,
|
14
|
+
'bg-grey-light cursor-not-allowed aria-checked:bg-blue-light': props.disabled
|
15
|
+
}, props.className);
|
16
|
+
const element = createElement(Root, Object.assign({}, otherProps, {
|
17
|
+
className: className,
|
18
|
+
onCheckedChange: onChange,
|
19
|
+
ref: ref
|
20
|
+
}), createElement(Thumb, {
|
21
|
+
className: "'will-change-transform group-aria-checked:translate-x-[1.1rem] mt-0.5 h-4 w-4 translate-x-[0.15rem] rounded-full bg-white transition-transform group-disabled:opacity-50"
|
22
|
+
}));
|
23
|
+
|
24
|
+
if (label) {
|
25
|
+
const labelClassName = cn('flex items-center cursor-pointer', {
|
26
|
+
'cursor-not-allowed text-grey-dark': props.disabled
|
27
|
+
});
|
28
|
+
return createElement("label", {
|
29
|
+
className: labelClassName
|
30
|
+
}, element, label);
|
31
|
+
}
|
32
|
+
|
33
|
+
return element;
|
34
|
+
});
|
35
|
+
|
36
|
+
export { Switch };
|
37
|
+
//# sourceMappingURL=Switch.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"Switch.js","sources":["../../../../src/components/Switch/Switch.tsx"],"sourcesContent":["import * as React from 'react';\r\nimport cn from 'classnames';\r\nimport * as PrimitiveSwitch from '@radix-ui/react-switch';\r\n\r\ntype SwitchBaseProps = Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'children' | 'onChange'> & {\r\n /** Label for the switch */\r\n label?: React.ReactNode;\r\n /* Whether user input is required */\r\n required?: boolean;\r\n};\r\n\r\ninterface UncontrolledSwitchProps extends SwitchBaseProps {\r\n checked?: never;\r\n onChange?: never;\r\n /* The default checked state (uncontrolled) */\r\n defaultChecked?: boolean;\r\n}\r\n\r\ninterface ControlledSwitchProps extends SwitchBaseProps {\r\n defaultChecked?: never;\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) => void;\r\n}\r\n\r\nexport type SwitchProps = UncontrolledSwitchProps | ControlledSwitchProps;\r\n\r\nexport const Switch = React.forwardRef(function Switch(props: SwitchProps, ref: React.Ref<HTMLButtonElement>) {\r\n const { label, onChange, ...otherProps } = props;\r\n\r\n const className = cn(\r\n 'group h-5 w-9 flex rounded-full inline-flex',\r\n {\r\n 'mr-2': !!label,\r\n 'bg-grey-darker hover:bg-grey-dark aria-checked:bg-blue aria-checked:hover:bg-blue-light focus:yt-focus':\r\n !props.disabled,\r\n 'bg-grey-light cursor-not-allowed aria-checked:bg-blue-light': props.disabled,\r\n },\r\n props.className\r\n );\r\n\r\n const element = (\r\n <PrimitiveSwitch.Root {...otherProps} className={className} onCheckedChange={onChange} ref={ref}>\r\n <PrimitiveSwitch.Thumb className=\"'will-change-transform group-aria-checked:translate-x-[1.1rem] mt-0.5 h-4 w-4 translate-x-[0.15rem] rounded-full bg-white transition-transform group-disabled:opacity-50\" />\r\n </PrimitiveSwitch.Root>\r\n );\r\n\r\n if (label) {\r\n const labelClassName = cn('flex items-center cursor-pointer', {\r\n 'cursor-not-allowed text-grey-dark': props.disabled,\r\n });\r\n\r\n return (\r\n <label className={labelClassName}>\r\n {element}\r\n {label}\r\n </label>\r\n );\r\n }\r\n\r\n return element;\r\n});\r\n"],"names":["Switch","React","props","ref","label","onChange","otherProps","className","cn","disabled","element","PrimitiveSwitch","onCheckedChange","labelClassName"],"mappings":";;;;MA4BaA,MAAM,gBAAGC,UAAA,CAAiB,SAASD,MAAT,CAAgBE,KAAhB,EAAoCC,GAApC;AACnC,QAAM;AAAEC,IAAAA,KAAF;AAASC,IAAAA,QAAT;AAAmB,OAAGC;AAAtB,MAAqCJ,KAA3C;AAEA,QAAMK,SAAS,GAAGC,EAAE,CAChB,6CADgB,EAEhB;AACI,YAAQ,CAAC,CAACJ,KADd;AAEI,8GACI,CAACF,KAAK,CAACO,QAHf;AAII,mEAA+DP,KAAK,CAACO;AAJzE,GAFgB,EAQhBP,KAAK,CAACK,SARU,CAApB;AAWA,QAAMG,OAAO,GACTT,aAAA,CAACU,IAAD,oBAA0BL;AAAYC,IAAAA,SAAS,EAAEA;AAAWK,IAAAA,eAAe,EAAEP;AAAUF,IAAAA,GAAG,EAAEA;IAA5F,EACIF,aAAA,CAACU,KAAD;AAAuBJ,IAAAA,SAAS,EAAC;GAAjC,CADJ,CADJ;;AAMA,MAAIH,KAAJ,EAAW;AACP,UAAMS,cAAc,GAAGL,EAAE,CAAC,kCAAD,EAAqC;AAC1D,2CAAqCN,KAAK,CAACO;AADe,KAArC,CAAzB;AAIA,WACIR,aAAA,QAAA;AAAOM,MAAAA,SAAS,EAAEM;KAAlB,EACKH,OADL,EAEKN,KAFL,CADJ;AAMH;;AAED,SAAOM,OAAP;AACH,CAlCqB;;;;"}
|
@@ -0,0 +1,48 @@
|
|
1
|
+
import React__default from 'react';
|
2
|
+
import cn from 'classnames';
|
3
|
+
import { useProxiedRef } from '../../../utils/hooks/useProxiedRef.js';
|
4
|
+
import { Column } from '../util/renderColumn.js';
|
5
|
+
|
6
|
+
const DefaultEmptyState = () => null;
|
7
|
+
const BaseTable = /*#__PURE__*/React__default.forwardRef(function BaseTable(props, ref) {
|
8
|
+
const tableRef = useProxiedRef(ref);
|
9
|
+
const {
|
10
|
+
autoFocus,
|
11
|
+
children,
|
12
|
+
disableSorting: _,
|
13
|
+
headerGroups,
|
14
|
+
headerRef,
|
15
|
+
bodyRef,
|
16
|
+
...otherProps
|
17
|
+
} = props;
|
18
|
+
React__default.useEffect(() => {
|
19
|
+
if (autoFocus && tableRef.current) {
|
20
|
+
tableRef.current.focus();
|
21
|
+
}
|
22
|
+
}, []);
|
23
|
+
const className = cn('yt-table flex flex-col focus:yt-focus focus:rounded-sm', props.className);
|
24
|
+
return React__default.createElement("div", Object.assign({}, otherProps, {
|
25
|
+
role: "table",
|
26
|
+
className: className,
|
27
|
+
ref: tableRef
|
28
|
+
}), React__default.createElement("div", {
|
29
|
+
role: "rowgroup",
|
30
|
+
className: "yt-table__head",
|
31
|
+
ref: headerRef
|
32
|
+
}, headerGroups === null || headerGroups === void 0 ? void 0 : headerGroups.map((headerGroup, index) => React__default.createElement("div", {
|
33
|
+
key: index,
|
34
|
+
role: "row",
|
35
|
+
className: "border-grey-light flex h-auto min-h-[2.5rem] w-full select-none border-t-0 border-b-2 font-bold"
|
36
|
+
}, headerGroup.headers.map((cell, index) => React__default.createElement(Column, {
|
37
|
+
key: index,
|
38
|
+
index: index,
|
39
|
+
cell: cell
|
40
|
+
}))))), React__default.createElement("div", {
|
41
|
+
role: "rowgroup",
|
42
|
+
className: "yt-table__body",
|
43
|
+
ref: bodyRef
|
44
|
+
}, children));
|
45
|
+
});
|
46
|
+
|
47
|
+
export { BaseTable, DefaultEmptyState };
|
48
|
+
//# sourceMappingURL=BaseTable.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"BaseTable.js","sources":["../../../../../src/components/Table/components/BaseTable.tsx"],"sourcesContent":["import React from 'react';\r\nimport cn from 'classnames';\r\nimport { HeaderGroup } from 'react-table';\r\nimport { useProxiedRef } from '../../../utils/hooks/useProxiedRef';\r\nimport { InternalBaseTable } from '../types';\r\nimport './Table.css';\r\nimport { Column } from '../util/renderColumn';\r\n\r\nexport const DefaultEmptyState = (): React.ReactNode => null;\r\n\r\nexport const BaseTable = React.forwardRef(function BaseTable(props: InternalBaseTable, ref: React.Ref<HTMLDivElement>) {\r\n const tableRef = useProxiedRef<HTMLDivElement>(ref);\r\n const { autoFocus, children, disableSorting: _, headerGroups, headerRef, bodyRef, ...otherProps } = props;\r\n\r\n React.useEffect(() => {\r\n if (autoFocus && tableRef.current) {\r\n tableRef.current.focus();\r\n }\r\n }, []);\r\n\r\n const className = cn('yt-table flex flex-col focus:yt-focus focus:rounded-sm', props.className);\r\n\r\n return (\r\n <div {...otherProps} role=\"table\" className={className} ref={tableRef}>\r\n <div role=\"rowgroup\" className=\"yt-table__head\" ref={headerRef}>\r\n {headerGroups?.map((headerGroup: HeaderGroup<object>, index: number) => (\r\n <div\r\n key={index}\r\n role=\"row\"\r\n className=\"border-grey-light flex h-auto min-h-[2.5rem] w-full select-none border-t-0 border-b-2 font-bold\"\r\n >\r\n {headerGroup.headers.map((cell: any, index: number) => (\r\n <Column key={index} index={index} cell={cell} />\r\n ))}\r\n </div>\r\n ))}\r\n </div>\r\n\r\n <div role=\"rowgroup\" className=\"yt-table__body\" ref={bodyRef}>\r\n {children}\r\n </div>\r\n </div>\r\n );\r\n});\r\n"],"names":["DefaultEmptyState","BaseTable","React","forwardRef","props","ref","tableRef","useProxiedRef","autoFocus","children","disableSorting","_","headerGroups","headerRef","bodyRef","otherProps","useEffect","current","focus","className","cn","role","map","headerGroup","index","key","headers","cell","Column"],"mappings":";;;;;MAQaA,iBAAiB,GAAG,MAAuB;MAE3CC,SAAS,gBAAGC,cAAK,CAACC,UAAN,CAAiB,SAASF,SAAT,CAAmBG,KAAnB,EAA6CC,GAA7C;AACtC,QAAMC,QAAQ,GAAGC,aAAa,CAAiBF,GAAjB,CAA9B;AACA,QAAM;AAAEG,IAAAA,SAAF;AAAaC,IAAAA,QAAb;AAAuBC,IAAAA,cAAc,EAAEC,CAAvC;AAA0CC,IAAAA,YAA1C;AAAwDC,IAAAA,SAAxD;AAAmEC,IAAAA,OAAnE;AAA4E,OAAGC;AAA/E,MAA8FX,KAApG;AAEAF,EAAAA,cAAK,CAACc,SAAN,CAAgB;AACZ,QAAIR,SAAS,IAAIF,QAAQ,CAACW,OAA1B,EAAmC;AAC/BX,MAAAA,QAAQ,CAACW,OAAT,CAAiBC,KAAjB;AACH;AACJ,GAJD,EAIG,EAJH;AAMA,QAAMC,SAAS,GAAGC,EAAE,CAAC,wDAAD,EAA2DhB,KAAK,CAACe,SAAjE,CAApB;AAEA,SACIjB,4BAAA,MAAA,oBAASa;AAAYM,IAAAA,IAAI,EAAC;AAAQF,IAAAA,SAAS,EAAEA;AAAWd,IAAAA,GAAG,EAAEC;IAA7D,EACIJ,4BAAA,MAAA;AAAKmB,IAAAA,IAAI,EAAC;AAAWF,IAAAA,SAAS,EAAC;AAAiBd,IAAAA,GAAG,EAAEQ;GAArD,EACKD,YADL,aACKA,YADL,uBACKA,YAAY,CAAEU,GAAd,CAAkB,CAACC,WAAD,EAAmCC,KAAnC,KACftB,4BAAA,MAAA;AACIuB,IAAAA,GAAG,EAAED;AACLH,IAAAA,IAAI,EAAC;AACLF,IAAAA,SAAS,EAAC;GAHd,EAKKI,WAAW,CAACG,OAAZ,CAAoBJ,GAApB,CAAwB,CAACK,IAAD,EAAYH,KAAZ,KACrBtB,4BAAA,CAAC0B,MAAD;AAAQH,IAAAA,GAAG,EAAED;AAAOA,IAAAA,KAAK,EAAEA;AAAOG,IAAAA,IAAI,EAAEA;GAAxC,CADH,CALL,CADH,CADL,CADJ,EAeIzB,4BAAA,MAAA;AAAKmB,IAAAA,IAAI,EAAC;AAAWF,IAAAA,SAAS,EAAC;AAAiBd,IAAAA,GAAG,EAAES;GAArD,EACKL,QADL,CAfJ,CADJ;AAqBH,CAjCwB;;;;"}
|
@@ -0,0 +1,16 @@
|
|
1
|
+
import React__default from 'react';
|
2
|
+
import { Table } from './Table.js';
|
3
|
+
|
4
|
+
const PaginatedTable = /*#__PURE__*/React__default.forwardRef(function PaginatedTable(props, ref) {
|
5
|
+
return React__default.createElement(Table, Object.assign({}, props, {
|
6
|
+
disablePagination: false,
|
7
|
+
ref: ref
|
8
|
+
}));
|
9
|
+
});
|
10
|
+
|
11
|
+
PaginatedTable.Column = () => null;
|
12
|
+
|
13
|
+
PaginatedTable.Group = () => null;
|
14
|
+
|
15
|
+
export { PaginatedTable };
|
16
|
+
//# sourceMappingURL=PaginatedTable.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"PaginatedTable.js","sources":["../../../../../src/components/Table/components/PaginatedTable.tsx"],"sourcesContent":["import React from 'react';\r\nimport { ForwardedGenericTableWithStatics, TableProps, TableRef } from '../types';\r\nimport { Table } from './Table';\r\n\r\nexport const PaginatedTable = React.forwardRef(function PaginatedTable<T>(props: TableProps<T>, ref: React.Ref<TableRef>) {\r\n return <Table {...props} disablePagination={false} ref={ref} />;\r\n}) as ForwardedGenericTableWithStatics;\r\n\r\nPaginatedTable.Column = () => null;\r\nPaginatedTable.Group = () => null;\r\n"],"names":["PaginatedTable","React","forwardRef","props","ref","Table","disablePagination","Column","Group"],"mappings":";;;MAIaA,cAAc,gBAAGC,cAAK,CAACC,UAAN,CAAiB,SAASF,cAAT,CAA2BG,KAA3B,EAAiDC,GAAjD;AAC3C,SAAOH,4BAAA,CAACI,KAAD,oBAAWF;AAAOG,IAAAA,iBAAiB,EAAE;AAAOF,IAAAA,GAAG,EAAEA;IAAjD,CAAP;AACH,CAF6B;;AAI9BJ,cAAc,CAACO,MAAf,GAAwB,MAAM,IAA9B;;AACAP,cAAc,CAACQ,KAAf,GAAuB,MAAM,IAA7B;;;;"}
|
@@ -0,0 +1,56 @@
|
|
1
|
+
import React__default from 'react';
|
2
|
+
import { useProxiedRef } from '../../../utils/hooks/useProxiedRef.js';
|
3
|
+
import { Pagination } from '../../Pagination/Pagination.js';
|
4
|
+
import { useTable } from '../hooks/useTable.js';
|
5
|
+
import { Row } from '../util/renderRow.js';
|
6
|
+
import { BaseTable, DefaultEmptyState } from './BaseTable.js';
|
7
|
+
|
8
|
+
const Table = /*#__PURE__*/React__default.forwardRef(function Table(props, ref) {
|
9
|
+
const {
|
10
|
+
emptyStateRenderer = DefaultEmptyState,
|
11
|
+
...otherProps
|
12
|
+
} = props;
|
13
|
+
const tableRef = useProxiedRef(ref);
|
14
|
+
const {
|
15
|
+
rowProps,
|
16
|
+
tableProps,
|
17
|
+
rows,
|
18
|
+
prepareRow,
|
19
|
+
pagination,
|
20
|
+
instance
|
21
|
+
} = useTable(otherProps, tableRef);
|
22
|
+
let paginationElement;
|
23
|
+
|
24
|
+
if (pagination) {
|
25
|
+
paginationElement = React__default.createElement(Pagination, {
|
26
|
+
className: "my-4 w-full",
|
27
|
+
length: pagination.length,
|
28
|
+
pageIndex: pagination.pageIndex,
|
29
|
+
pageSize: pagination.pageSize,
|
30
|
+
setPageIndex: pagination.setPageIndex,
|
31
|
+
setPageSize: pagination.setPageSize,
|
32
|
+
showPageControls: pagination.length > pagination.pageSize,
|
33
|
+
dangerouslyHijackGlobalKeyboardNavigation: props.dangerouslyHijackGlobalKeyboardNavigation
|
34
|
+
});
|
35
|
+
}
|
36
|
+
|
37
|
+
return React__default.createElement(React__default.Fragment, null, paginationElement, React__default.createElement(BaseTable, Object.assign({}, tableProps, {
|
38
|
+
ref: tableRef
|
39
|
+
}), rows.length ? rows.map((row, index) => {
|
40
|
+
prepareRow(row, index);
|
41
|
+
return React__default.createElement(Row, Object.assign({}, rowProps, {
|
42
|
+
key: index,
|
43
|
+
index: index,
|
44
|
+
row: row,
|
45
|
+
instance: instance,
|
46
|
+
headerGroups: tableProps.headerGroups
|
47
|
+
}));
|
48
|
+
}) : emptyStateRenderer()), paginationElement);
|
49
|
+
});
|
50
|
+
|
51
|
+
Table.Column = () => null;
|
52
|
+
|
53
|
+
Table.Group = () => null;
|
54
|
+
|
55
|
+
export { Table };
|
56
|
+
//# sourceMappingURL=Table.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"Table.js","sources":["../../../../../src/components/Table/components/Table.tsx"],"sourcesContent":["import React from 'react';\r\nimport { PluginHook } from 'react-table';\r\nimport { TableProps, InternalTableRow, ForwardedGenericTableWithStatics, TableRef } from '../types';\r\nimport { useTable } from '../hooks/useTable';\r\nimport { Pagination } from '../../Pagination/Pagination';\r\nimport { useProxiedRef } from '../../../utils/hooks/useProxiedRef';\r\nimport { Row } from '../util/renderRow';\r\nimport { DefaultEmptyState, BaseTable } from './BaseTable';\r\n\r\nexport const Table = React.forwardRef(function Table<T>(\r\n props: TableProps<T> & { plugins: PluginHook<{}>[] },\r\n ref: React.Ref<TableRef>\r\n) {\r\n const { emptyStateRenderer = DefaultEmptyState, ...otherProps } = props;\r\n const tableRef: any = useProxiedRef<HTMLDivElement>(ref);\r\n const { rowProps, tableProps, rows, prepareRow, pagination, instance } = useTable(otherProps, tableRef);\r\n\r\n let paginationElement;\r\n\r\n if (pagination) {\r\n paginationElement = (\r\n <Pagination\r\n className=\"my-4 w-full\"\r\n length={pagination.length}\r\n pageIndex={pagination.pageIndex}\r\n pageSize={pagination.pageSize}\r\n setPageIndex={pagination.setPageIndex}\r\n setPageSize={pagination.setPageSize}\r\n showPageControls={pagination.length > pagination.pageSize}\r\n dangerouslyHijackGlobalKeyboardNavigation={props.dangerouslyHijackGlobalKeyboardNavigation}\r\n />\r\n );\r\n }\r\n\r\n return (\r\n <>\r\n {paginationElement}\r\n <BaseTable {...tableProps} ref={tableRef}>\r\n {rows.length\r\n ? rows.map((row: InternalTableRow, index: number) => {\r\n prepareRow(row, index);\r\n return (\r\n <Row\r\n {...rowProps}\r\n key={index}\r\n index={index}\r\n row={row}\r\n instance={instance}\r\n headerGroups={tableProps.headerGroups}\r\n />\r\n );\r\n })\r\n : emptyStateRenderer()}\r\n </BaseTable>\r\n {paginationElement}\r\n </>\r\n );\r\n}) as ForwardedGenericTableWithStatics;\r\n\r\nTable.Column = () => null;\r\nTable.Group = () => null;\r\n"],"names":["Table","React","forwardRef","props","ref","emptyStateRenderer","DefaultEmptyState","otherProps","tableRef","useProxiedRef","rowProps","tableProps","rows","prepareRow","pagination","instance","useTable","paginationElement","Pagination","className","length","pageIndex","pageSize","setPageIndex","setPageSize","showPageControls","dangerouslyHijackGlobalKeyboardNavigation","BaseTable","map","row","index","Row","key","headerGroups","Column","Group"],"mappings":";;;;;;;MASaA,KAAK,gBAAGC,cAAK,CAACC,UAAN,CAAiB,SAASF,KAAT,CAClCG,KADkC,EAElCC,GAFkC;AAIlC,QAAM;AAAEC,IAAAA,kBAAkB,GAAGC,iBAAvB;AAA0C,OAAGC;AAA7C,MAA4DJ,KAAlE;AACA,QAAMK,QAAQ,GAAQC,aAAa,CAAiBL,GAAjB,CAAnC;AACA,QAAM;AAAEM,IAAAA,QAAF;AAAYC,IAAAA,UAAZ;AAAwBC,IAAAA,IAAxB;AAA8BC,IAAAA,UAA9B;AAA0CC,IAAAA,UAA1C;AAAsDC,IAAAA;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
3
|
+
import { useLocalization } from '../../Provider/Provider.js';
|
4
|
+
import { useProxiedRef } from '../../../utils/hooks/useProxiedRef.js';
|
5
|
+
import { useBoundingClientRectListener } from '../../../utils/hooks/useBoundingClientRectListener.js';
|
6
|
+
import { useTable } from '../hooks/useTable.js';
|
7
|
+
import { Row } from '../util/renderRow.js';
|
8
|
+
import { BaseTable, DefaultEmptyState } from './BaseTable.js';
|
9
|
+
import { VariableSizeList, areEqual } from 'react-window';
|
10
|
+
import InfiniteLoader from 'react-window-infinite-loader';
|
11
|
+
|
12
|
+
const ROW_HEIGHT = 40;
|
13
|
+
const VariableRow = /*#__PURE__*/React__default.memo(({
|
14
|
+
data,
|
15
|
+
index,
|
16
|
+
style: {
|
17
|
+
height: _,
|
18
|
+
...style
|
19
|
+
}
|
20
|
+
}) => {
|
21
|
+
const {
|
22
|
+
texts
|
23
|
+
} = useLocalization();
|
24
|
+
const {
|
25
|
+
rows,
|
26
|
+
setRowHeight,
|
27
|
+
rowProps,
|
28
|
+
tableProps,
|
29
|
+
instance,
|
30
|
+
prepareRow,
|
31
|
+
rowHeights
|
32
|
+
} = data;
|
33
|
+
const row = rows[index];
|
34
|
+
const ref = React__default.useRef(null);
|
35
|
+
React__default.useEffect(() => {
|
36
|
+
if (ref !== null && ref !== void 0 && ref.current) {
|
37
|
+
setRowHeight(index, ref.current.getBoundingClientRect().height);
|
38
|
+
}
|
39
|
+
}, [rowHeights[index]]);
|
40
|
+
|
41
|
+
if (row) {
|
42
|
+
prepareRow(row, index);
|
43
|
+
return React__default.createElement(Row, Object.assign({}, rowProps, {
|
44
|
+
style: style,
|
45
|
+
key: index,
|
46
|
+
index: index,
|
47
|
+
row: row,
|
48
|
+
instance: instance,
|
49
|
+
headerGroups: tableProps.headerGroups,
|
50
|
+
setRowHeight: setRowHeight,
|
51
|
+
ref: ref
|
52
|
+
}));
|
53
|
+
}
|
54
|
+
|
55
|
+
return React__default.createElement("div", {
|
56
|
+
className: "yt-table__row",
|
57
|
+
role: "row",
|
58
|
+
style: style
|
59
|
+
}, React__default.createElement("div", {
|
60
|
+
className: "yt-table__cell text-grey-dark"
|
61
|
+
}, texts.table.loading));
|
62
|
+
}, areEqual);
|
63
|
+
|
64
|
+
const getAverageRowHeight = (rowHeights = {}) => {
|
65
|
+
const keys = Object.keys(rowHeights);
|
66
|
+
const estimatedHeight = keys.reduce((p, i) => p + rowHeights[i], 0);
|
67
|
+
return estimatedHeight / keys.length;
|
68
|
+
};
|
69
|
+
|
70
|
+
const WindowedTable = /*#__PURE__*/React__default.forwardRef(function WindowedTable(props, ref) {
|
71
|
+
const tableRef = useProxiedRef(ref);
|
72
|
+
const {
|
73
|
+
emptyStateRenderer = DefaultEmptyState,
|
74
|
+
length,
|
75
|
+
loadMore,
|
76
|
+
...otherProps
|
77
|
+
} = props;
|
78
|
+
const {
|
79
|
+
rowProps,
|
80
|
+
tableProps,
|
81
|
+
rows,
|
82
|
+
prepareRow,
|
83
|
+
instance,
|
84
|
+
state
|
85
|
+
} = useTable({ ...otherProps,
|
86
|
+
windowed: true
|
87
|
+
}, tableRef); // determine heights for windowing calculations
|
88
|
+
|
89
|
+
const headerRef = React__default.useRef(null);
|
90
|
+
const rowsRef = React__default.useRef(null);
|
91
|
+
const tableDimensions = useBoundingClientRectListener(tableRef);
|
92
|
+
const headerDimensions = useBoundingClientRectListener(headerRef);
|
93
|
+
const height = tableDimensions && headerDimensions ? tableDimensions.height - headerDimensions.height : null; // variable row height calculations
|
94
|
+
|
95
|
+
const estimatedRowHeight = rowProps.rowHeight || ROW_HEIGHT;
|
96
|
+
const rowHeights = React__default.useRef({});
|
97
|
+
const setRowHeight = React__default.useCallback((index, size) => {
|
98
|
+
if (rowHeights.current[index] !== size) {
|
99
|
+
rowHeights.current = { ...rowHeights.current,
|
100
|
+
[index]: size
|
101
|
+
};
|
102
|
+
|
103
|
+
if (rowsRef.current) {
|
104
|
+
rowsRef.current.resetAfterIndex(0);
|
105
|
+
}
|
106
|
+
}
|
107
|
+
}, []);
|
108
|
+
const getRowHeight = React__default.useCallback(index => rowHeights.current[index] || estimatedRowHeight, []);
|
109
|
+
React__default.useEffect(() => {
|
110
|
+
if (rowsRef && rowsRef.current && rowProps.activeIndex !== undefined) {
|
111
|
+
rowsRef.current.scrollToItem(rowProps.activeIndex);
|
112
|
+
}
|
113
|
+
}, [rowProps.activeIndex]); // trigger recalculation of variable row heights if the data changes
|
114
|
+
|
115
|
+
React__default.useEffect(() => {
|
116
|
+
rowHeights.current = {};
|
117
|
+
|
118
|
+
if (rowsRef.current) {
|
119
|
+
rowsRef.current.resetAfterIndex(0);
|
120
|
+
}
|
121
|
+
}, [rows.length]);
|
122
|
+
const contentHeight = estimatedRowHeight * props.data.length || 0;
|
123
|
+
const isScrollbarVisible = height !== null ? contentHeight > height : false;
|
124
|
+
const className = cn(tableProps.className, 'yt-table--windowed', {
|
125
|
+
'table-with-scrollbar': isScrollbarVisible
|
126
|
+
});
|
127
|
+
let list;
|
128
|
+
const itemData = {
|
129
|
+
rows,
|
130
|
+
setRowHeight,
|
131
|
+
rowProps,
|
132
|
+
tableProps,
|
133
|
+
instance,
|
134
|
+
prepareRow,
|
135
|
+
state,
|
136
|
+
rowHeights: rowHeights.current
|
137
|
+
};
|
138
|
+
|
139
|
+
if (height && rows.length) {
|
140
|
+
const listProps = {
|
141
|
+
height,
|
142
|
+
itemData,
|
143
|
+
estimatedItemSize: getAverageRowHeight(rowHeights.current),
|
144
|
+
itemSize: getRowHeight,
|
145
|
+
width: '100%'
|
146
|
+
};
|
147
|
+
|
148
|
+
if (loadMore && length) {
|
149
|
+
const isLoaded = index => !!rows[index];
|
150
|
+
|
151
|
+
list = React__default.createElement(InfiniteLoader, {
|
152
|
+
isItemLoaded: isLoaded,
|
153
|
+
itemCount: length,
|
154
|
+
loadMoreItems: loadMore
|
155
|
+
}, ({
|
156
|
+
onItemsRendered,
|
157
|
+
ref
|
158
|
+
}) => React__default.createElement(VariableSizeList, Object.assign({}, listProps, {
|
159
|
+
itemCount: length,
|
160
|
+
onItemsRendered: onItemsRendered,
|
161
|
+
ref: list => {
|
162
|
+
ref(list);
|
163
|
+
rowsRef.current = list;
|
164
|
+
}
|
165
|
+
}), VariableRow));
|
166
|
+
} else {
|
167
|
+
list = React__default.createElement(VariableSizeList, Object.assign({}, listProps, {
|
168
|
+
itemCount: rows.length,
|
169
|
+
ref: rowsRef
|
170
|
+
}), VariableRow);
|
171
|
+
}
|
172
|
+
}
|
173
|
+
|
174
|
+
return React__default.createElement(BaseTable, Object.assign({}, tableProps, {
|
175
|
+
className: className,
|
176
|
+
headerRef: headerRef,
|
177
|
+
ref: tableRef
|
178
|
+
}), list ? list : emptyStateRenderer());
|
179
|
+
});
|
180
|
+
|
181
|
+
WindowedTable.Column = () => null;
|
182
|
+
|
183
|
+
WindowedTable.Group = () => null;
|
184
|
+
|
185
|
+
export { WindowedTable };
|
186
|
+
//# sourceMappingURL=WindowedTable.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"WindowedTable.js","sources":["../../../../../src/components/Table/components/WindowedTable.tsx"],"sourcesContent":["import React from 'react';\r\nimport cn from 'classnames';\r\nimport { PluginHook } from 'react-table';\r\nimport { areEqual, VariableSizeList } from 'react-window';\r\nimport InfiniteLoader from 'react-window-infinite-loader';\r\nimport { TableProps, ForwardedGenericTableWithStatics, TableRef } from '../types';\r\nimport { useTable } from '../hooks/useTable';\r\nimport { useBoundingClientRectListener } from '../../../utils/hooks/useBoundingClientRectListener';\r\nimport { useProxiedRef } from '../../../utils/hooks/useProxiedRef';\r\nimport { Row } from '../util/renderRow';\r\nimport { DefaultEmptyState, BaseTable } from './BaseTable';\r\nimport { useLocalization } from '../../Provider/Provider';\r\n\r\nconst ROW_HEIGHT = 40;\r\n\r\nconst VariableRow = React.memo(({ data, index, style: { height: _, ...style } }: any) => {\r\n const { texts } = useLocalization();\r\n const { rows, setRowHeight, rowProps, tableProps, instance, prepareRow, rowHeights } = data;\r\n const row = rows[index];\r\n const ref = React.useRef<HTMLDivElement>(null);\r\n\r\n React.useEffect(() => {\r\n if (ref?.current) {\r\n setRowHeight(index, ref.current.getBoundingClientRect().height);\r\n }\r\n }, [rowHeights[index]]);\r\n\r\n if (row) {\r\n prepareRow(row, index);\r\n\r\n return (\r\n <Row\r\n {...rowProps}\r\n style={style}\r\n key={index}\r\n index={index}\r\n row={row}\r\n instance={instance}\r\n headerGroups={tableProps.headerGroups}\r\n setRowHeight={setRowHeight}\r\n ref={ref}\r\n />\r\n );\r\n }\r\n\r\n return (\r\n <div className=\"yt-table__row\" role=\"row\" style={style}>\r\n <div className=\"yt-table__cell text-grey-dark\">{texts.table.loading}</div>\r\n </div>\r\n );\r\n}, areEqual);\r\n\r\nconst getAverageRowHeight = (rowHeights = {}) => {\r\n const keys = Object.keys(rowHeights);\r\n const estimatedHeight = keys.reduce((p, i) => p + rowHeights[i], 0);\r\n return estimatedHeight / keys.length;\r\n};\r\n\r\nexport const WindowedTable = React.forwardRef(function WindowedTable<T>(\r\n props: TableProps<T> & { plugins: PluginHook<{}>[] },\r\n ref: React.Ref<TableRef>\r\n) {\r\n const tableRef: any = useProxiedRef<HTMLDivElement>(ref);\r\n const { emptyStateRenderer = DefaultEmptyState, length, loadMore, ...otherProps } = props;\r\n const { rowProps, tableProps, rows, prepareRow, instance, state } = useTable<T>({ ...otherProps, windowed: true }, tableRef);\r\n\r\n // determine heights for windowing calculations\r\n const headerRef = React.useRef<HTMLDivElement>(null);\r\n const rowsRef = React.useRef<any>(null);\r\n const tableDimensions = useBoundingClientRectListener(tableRef);\r\n const headerDimensions = useBoundingClientRectListener(headerRef);\r\n const height = tableDimensions && headerDimensions ? tableDimensions.height - headerDimensions.height : null;\r\n\r\n // variable row height calculations\r\n const estimatedRowHeight = rowProps.rowHeight || ROW_HEIGHT;\r\n const rowHeights = React.useRef<Record<string, number>>({});\r\n const setRowHeight = React.useCallback((index: number, size: number) => {\r\n if (rowHeights.current[index] !== size) {\r\n rowHeights.current = {\r\n ...rowHeights.current,\r\n [index]: size,\r\n };\r\n\r\n if (rowsRef.current) {\r\n rowsRef.current.resetAfterIndex(0);\r\n }\r\n }\r\n }, []);\r\n const getRowHeight = React.useCallback(index => rowHeights.current[index] || estimatedRowHeight, []);\r\n\r\n React.useEffect(() => {\r\n if (rowsRef && rowsRef.current && rowProps.activeIndex !== undefined) {\r\n rowsRef.current.scrollToItem(rowProps.activeIndex);\r\n }\r\n }, [rowProps.activeIndex]);\r\n\r\n // trigger recalculation of variable row heights if the data changes\r\n React.useEffect(() => {\r\n rowHeights.current = {};\r\n\r\n if (rowsRef.current) {\r\n rowsRef.current.resetAfterIndex(0);\r\n }\r\n }, [rows.length]);\r\n\r\n const contentHeight = estimatedRowHeight * props.data.length || 0;\r\n const isScrollbarVisible = height !== null ? contentHeight > height : false;\r\n\r\n const className = cn(tableProps.className, 'yt-table--windowed', { 'table-with-scrollbar': isScrollbarVisible });\r\n\r\n let list;\r\n\r\n const itemData = {\r\n rows,\r\n setRowHeight,\r\n rowProps,\r\n tableProps,\r\n instance,\r\n prepareRow,\r\n state,\r\n rowHeights: rowHeights.current,\r\n };\r\n\r\n if (height && rows.length) {\r\n const listProps = {\r\n height,\r\n itemData,\r\n estimatedItemSize: getAverageRowHeight(rowHeights.current),\r\n itemSize: getRowHeight,\r\n width: '100%',\r\n };\r\n\r\n if (loadMore && length) {\r\n const isLoaded = (index: number) => !!rows[index];\r\n\r\n list = (\r\n <InfiniteLoader isItemLoaded={isLoaded} itemCount={length} loadMoreItems={loadMore as any}>\r\n {({ onItemsRendered, ref }: any) => (\r\n <VariableSizeList\r\n {...listProps}\r\n itemCount={length}\r\n onItemsRendered={onItemsRendered}\r\n ref={list => {\r\n ref(list);\r\n rowsRef.current = list;\r\n }}\r\n >\r\n {VariableRow}\r\n </VariableSizeList>\r\n )}\r\n </InfiniteLoader>\r\n );\r\n } else {\r\n list = (\r\n <VariableSizeList {...listProps} itemCount={rows.length} ref={rowsRef}>\r\n {VariableRow}\r\n </VariableSizeList>\r\n );\r\n }\r\n }\r\n\r\n return (\r\n <BaseTable {...tableProps} className={className} headerRef={headerRef} ref={tableRef}>\r\n {list ? list : emptyStateRenderer()}\r\n </BaseTable>\r\n );\r\n}) as ForwardedGenericTableWithStatics;\r\n\r\nWindowedTable.Column = () => null;\r\nWindowedTable.Group = () => null;\r\n"],"names":["ROW_HEIGHT","VariableRow","React","memo","data","index","style","height","_","texts","useLocalization","rows","setRowHeight","rowProps","tableProps","instance","prepareRow","rowHeights","row","ref","useRef","useEffect","current","getBoundingClientRect","Row","key","headerGroups","className","role","table","loading","areEqual","getAverageRowHeight","keys","Object","estimatedHeight","reduce","p","i","length","WindowedTable","forwardRef","props","tableRef","useProxiedRef","emptyStateRenderer","DefaultEmptyState","loadMore","otherProps","state","useTable","windowed","headerRef","rowsRef","tableDimensions","useBoundingClientRectListener","headerDimensions","estimatedRowHeight","rowHeight","useCallback","size","resetAfterIndex","getRowHeight","activeIndex","undefined","scrollToItem","contentHeight","isScrollbarVisible","cn","list","itemData","listProps","estimatedItemSize","itemSize","width","isLoaded","InfiniteLoader","isItemLoaded","itemCount","loadMoreItems","onItemsRendered","VariableSizeList","BaseTable","Column","Group"],"mappings":";;;;;;;;;;;AAaA,MAAMA,UAAU,GAAG,EAAnB;AAEA,MAAMC,WAAW,gBAAGC,cAAK,CAACC,IAAN,CAAW,CAAC;AAAEC,EAAAA,IAAF;AAAQC,EAAAA,KAAR;AAAeC,EAAAA,KAAK,EAAE;AAAEC,IAAAA,MAAM,EAAEC,CAAV;AAAa,OAAGF;AAAhB;AAAtB,CAAD;AAC3B,QAAM;AAAEG,IAAAA;AAAF,MAAYC,eAAe,EAAjC;AACA,QAAM;AAAEC,IAAAA,IAAF;AAAQC,IAAAA,YAAR;AAAsBC,IAAAA,QAAtB;AAAgCC,IAAAA,UAAhC;AAA4CC,IAAAA,QAA5C;AAAsDC,IAAAA,UAAtD;AAAkEC,IAAAA;AAAlE,MAAiFb,IAAvF;AACA,QAAMc,GAAG,G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BAAA,CAAC+E,gBAAD,oBAAsBV;AAAWO,QAAAA,SAAS,EAAEnE,IAAI,CAAC4B;AAAQpB,QAAAA,GAAG,EAAEkC;QAA9D,EACKpD,WADL,CADJ;AAKH;AACJ;;AAED,SACIC,4BAAA,CAACgF,SAAD,oBAAepE;AAAYa,IAAAA,SAAS,EAAEA;AAAWyB,IAAAA,SAAS,EAAEA;AAAWjC,IAAAA,GAAG,EAAEwB;IAA5E,EACK0B,IAAI,GAAGA,IAAH,GAAUxB,kBAAkB,EADrC,CADJ;AAKH,CA5G4B;;AA8G7BL,aAAa,CAAC2C,MAAd,GAAuB,MAAM,IAA7B;;AACA3C,aAAa,CAAC4C,KAAd,GAAsB,MAAM,IAA5B;;;;"}
|
@@ -0,0 +1,236 @@
|
|
1
|
+
import React__default from 'react';
|
2
|
+
import { IconButton } from '../../../IconButton/IconButton.js';
|
3
|
+
import keycode from 'keycode';
|
4
|
+
import { Menu } from '../../../Menu/Menu.js';
|
5
|
+
import { sanitizeRowProps } from '../../util.js';
|
6
|
+
import { InView } from 'react-intersection-observer';
|
7
|
+
|
8
|
+
const actionGroupClassName = '-mt-1 -mb-1 h-8 flex';
|
9
|
+
|
10
|
+
const hasActions = (inlineEditingUniqueId, handlers, actions) => {
|
11
|
+
return !!actions || handlers.onRowCreate || handlers.onRowCopy || handlers.onRowDelete || !!inlineEditingUniqueId || handlers.onRowEdit;
|
12
|
+
};
|
13
|
+
|
14
|
+
const getActions = (actions, row = undefined) => {
|
15
|
+
const primary = [];
|
16
|
+
const secondary = [];
|
17
|
+
|
18
|
+
if (actions) {
|
19
|
+
let visibleActions = actions.filter(x => !!x);
|
20
|
+
|
21
|
+
if (row) {
|
22
|
+
visibleActions = visibleActions.filter(action => {
|
23
|
+
if (action.visible !== undefined) {
|
24
|
+
if (typeof action.visible === 'function') {
|
25
|
+
return action.visible(row);
|
26
|
+
}
|
27
|
+
|
28
|
+
return action.visible;
|
29
|
+
}
|
30
|
+
|
31
|
+
return true;
|
32
|
+
});
|
33
|
+
}
|
34
|
+
|
35
|
+
visibleActions.forEach(action => {
|
36
|
+
if (action.showOnRow) {
|
37
|
+
primary.push(action);
|
38
|
+
} else {
|
39
|
+
secondary.push(action);
|
40
|
+
}
|
41
|
+
});
|
42
|
+
}
|
43
|
+
|
44
|
+
return [primary, secondary];
|
45
|
+
};
|
46
|
+
|
47
|
+
const getLength = (inlineEditingUniqueId, handlers, actions) => {
|
48
|
+
const [primaryActions, secondaryActions] = getActions(actions);
|
49
|
+
let length = primaryActions.length + (secondaryActions.length ? 1 : 0);
|
50
|
+
|
51
|
+
if (handlers.onRowCreate) {
|
52
|
+
length++;
|
53
|
+
}
|
54
|
+
|
55
|
+
if (handlers.onRowCopy) {
|
56
|
+
length++;
|
57
|
+
}
|
58
|
+
|
59
|
+
if (handlers.onRowDelete) {
|
60
|
+
length++;
|
61
|
+
}
|
62
|
+
|
63
|
+
if (!!inlineEditingUniqueId || handlers.onRowEdit) {
|
64
|
+
length++;
|
65
|
+
|
66
|
+
if (length < 2) {
|
67
|
+
length++;
|
68
|
+
}
|
69
|
+
}
|
70
|
+
|
71
|
+
return length;
|
72
|
+
};
|
73
|
+
|
74
|
+
const getActionProps = (action, row) => {
|
75
|
+
return {
|
76
|
+
'aria-label': typeof action.tooltip === 'function' ? action.tooltip(row) : action.tooltip,
|
77
|
+
disabled: typeof action.disabled === 'function' ? action.disabled(row) : action.disabled,
|
78
|
+
onClick: event => {
|
79
|
+
action.onClick(row, event);
|
80
|
+
}
|
81
|
+
};
|
82
|
+
};
|
83
|
+
|
84
|
+
const EditModeActions = () => {
|
85
|
+
React__default.useEffect(() => {
|
86
|
+
const listener = event => {
|
87
|
+
var _event$target, _event$target$form;
|
88
|
+
|
89
|
+
if (event.keyCode === keycode('escape') && (_event$target = event.target) !== null && _event$target !== void 0 && (_event$target$form = _event$target.form) !== null && _event$target$form !== void 0 && _event$target$form.reset) {
|
90
|
+
event.preventDefault();
|
91
|
+
event.target.form.reset();
|
92
|
+
}
|
93
|
+
};
|
94
|
+
|
95
|
+
document.addEventListener('keydown', listener);
|
96
|
+
return () => {
|
97
|
+
document.removeEventListener('keydown', listener);
|
98
|
+
};
|
99
|
+
}, []);
|
100
|
+
return React__default.createElement("div", {
|
101
|
+
className: actionGroupClassName
|
102
|
+
}, React__default.createElement(IconButton, {
|
103
|
+
appearance: "primary",
|
104
|
+
icon: "tick",
|
105
|
+
type: "submit",
|
106
|
+
className: "mr-2"
|
107
|
+
}), React__default.createElement(IconButton, {
|
108
|
+
appearance: "ghost",
|
109
|
+
icon: "close",
|
110
|
+
type: "reset"
|
111
|
+
}));
|
112
|
+
};
|
113
|
+
|
114
|
+
const useRowActions = (inlineEditingUniqueId, handlers, actions, rowExpansionRenderer, texts, windowed = false) => {
|
115
|
+
const inlineEditing = !!inlineEditingUniqueId;
|
116
|
+
const actionsLength = getLength(inlineEditingUniqueId, handlers, actions);
|
117
|
+
|
118
|
+
const plugin = hooks => {
|
119
|
+
if (hasActions(inlineEditingUniqueId, handlers, actions)) {
|
120
|
+
hooks.visibleColumns.push(columns => [...columns, {
|
121
|
+
id: '_actions',
|
122
|
+
className: 'flex justify-end px-1 overflow-visible',
|
123
|
+
flex: `0 0 calc((${actionsLength} * 2rem) + .5rem)`,
|
124
|
+
Cell: ({
|
125
|
+
row
|
126
|
+
}) => {
|
127
|
+
if (row.isEditing) {
|
128
|
+
return React__default.createElement(EditModeActions, null);
|
129
|
+
}
|
130
|
+
|
131
|
+
const sanitizedRow = sanitizeRowProps(row, rowExpansionRenderer);
|
132
|
+
const [primaryActions, secondaryActions] = getActions(actions, sanitizedRow);
|
133
|
+
const output = React__default.createElement(React__default.Fragment, null, handlers.onRowCreate && React__default.createElement(IconButton, {
|
134
|
+
appearance: "discrete",
|
135
|
+
icon: "circle-plus",
|
136
|
+
"aria-label": texts.table.newSubRow,
|
137
|
+
tooltip: texts.table.newSubRow,
|
138
|
+
disabled: inlineEditing && !row.canEdit,
|
139
|
+
onClick: event => {
|
140
|
+
event.stopPropagation();
|
141
|
+
event.persist();
|
142
|
+
row.setActive();
|
143
|
+
|
144
|
+
if (!row.isExpanded) {
|
145
|
+
row.toggleRowExpanded();
|
146
|
+
}
|
147
|
+
|
148
|
+
handlers.onRowCreate(sanitizedRow, event);
|
149
|
+
}
|
150
|
+
}), (inlineEditing || handlers.onRowEdit) && React__default.createElement(IconButton, {
|
151
|
+
appearance: "discrete",
|
152
|
+
icon: "edit",
|
153
|
+
"aria-label": texts.table.edit,
|
154
|
+
tooltip: texts.table.edit,
|
155
|
+
disabled: inlineEditing && !row.canEdit,
|
156
|
+
onClick: event => {
|
157
|
+
event.stopPropagation();
|
158
|
+
row.setActive();
|
159
|
+
|
160
|
+
if (inlineEditing) {
|
161
|
+
row.toggleRowEditing();
|
162
|
+
} else if (handlers.onRowEdit) {
|
163
|
+
event.persist();
|
164
|
+
handlers.onRowEdit(sanitizedRow, event);
|
165
|
+
}
|
166
|
+
}
|
167
|
+
}), handlers.onRowCopy && React__default.createElement(IconButton, {
|
168
|
+
appearance: "discrete",
|
169
|
+
icon: "copy",
|
170
|
+
"aria-label": texts.table.copy,
|
171
|
+
tooltip: texts.table.copy,
|
172
|
+
disabled: inlineEditing && !row.canEdit,
|
173
|
+
onClick: event => {
|
174
|
+
event.stopPropagation();
|
175
|
+
event.persist();
|
176
|
+
row.setActive();
|
177
|
+
handlers.onRowCopy(sanitizedRow, event);
|
178
|
+
}
|
179
|
+
}), handlers.onRowDelete && React__default.createElement(IconButton, {
|
180
|
+
appearance: "discrete",
|
181
|
+
icon: "delete",
|
182
|
+
"aria-label": texts.table.del,
|
183
|
+
tooltip: texts.table.del,
|
184
|
+
disabled: inlineEditing && !row.canEdit,
|
185
|
+
onClick: event => {
|
186
|
+
event.stopPropagation();
|
187
|
+
event.persist();
|
188
|
+
row.setActive();
|
189
|
+
handlers.onRowDelete(sanitizedRow, event);
|
190
|
+
}
|
191
|
+
}), primaryActions.map((action, index) => React__default.createElement(IconButton, Object.assign({}, getActionProps(action, sanitizedRow), {
|
192
|
+
key: index,
|
193
|
+
appearance: "discrete",
|
194
|
+
icon: typeof action.icon === 'function' ? action.icon(sanitizedRow) : action.icon,
|
195
|
+
tooltip: typeof action.tooltip === 'function' ? action.tooltip(sanitizedRow) : action.tooltip
|
196
|
+
}))), secondaryActions.length ? React__default.createElement(Menu, null, React__default.createElement(Menu.Trigger, null, React__default.createElement(IconButton, {
|
197
|
+
appearance: "discrete",
|
198
|
+
icon: "ellipsis-vertical",
|
199
|
+
"aria-label": texts.table.actions,
|
200
|
+
tooltip: texts.table.actions,
|
201
|
+
disabled: inlineEditing && !row.canEdit,
|
202
|
+
onClick: event => {
|
203
|
+
event.stopPropagation();
|
204
|
+
row.setActive();
|
205
|
+
}
|
206
|
+
})), React__default.createElement(Menu.Content, null, secondaryActions.map((action, index) => React__default.createElement(Menu.Item, Object.assign({
|
207
|
+
key: index,
|
208
|
+
icon: typeof action.icon === 'function' ? action.icon(sanitizedRow) : action.icon
|
209
|
+
}, getActionProps(action, sanitizedRow)), typeof action.text === 'function' ? action.text(sanitizedRow) : action.text)))) : null);
|
210
|
+
|
211
|
+
if (windowed) {
|
212
|
+
return React__default.createElement("div", {
|
213
|
+
className: actionGroupClassName
|
214
|
+
}, output);
|
215
|
+
}
|
216
|
+
|
217
|
+
return React__default.createElement(InView, {
|
218
|
+
rootMargin: "100px 0px"
|
219
|
+
}, ({
|
220
|
+
inView,
|
221
|
+
ref
|
222
|
+
}) => React__default.createElement("div", {
|
223
|
+
className: actionGroupClassName,
|
224
|
+
ref: ref
|
225
|
+
}, inView ? output : null));
|
226
|
+
}
|
227
|
+
}]);
|
228
|
+
}
|
229
|
+
};
|
230
|
+
|
231
|
+
plugin.pluginName = 'useRowActions';
|
232
|
+
return plugin;
|
233
|
+
};
|
234
|
+
|
235
|
+
export { useRowActions };
|
236
|
+
//# sourceMappingURL=useRowActions.js.map
|