@economic/taco 1.0.3 → 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/README.md +84 -84
- package/dist/esm/components/Accordion/Accordion.js.map +1 -1
- package/dist/esm/components/Backdrop/Backdrop.js.map +1 -1
- package/dist/esm/components/Badge/Badge.js.map +1 -1
- package/dist/esm/components/Banner/Banner.js.map +1 -1
- package/dist/esm/components/Banner/util.js +1 -1
- package/dist/esm/components/Banner/util.js.map +1 -1
- package/dist/esm/components/Button/Button.js.map +1 -1
- package/dist/esm/components/Button/util.js +18 -23
- package/dist/esm/components/Button/util.js.map +1 -1
- package/dist/esm/components/Calendar/Calendar.js.map +1 -1
- package/dist/esm/components/Checkbox/Checkbox.js.map +1 -1
- package/dist/esm/components/Combobox/Combobox.js.map +1 -1
- package/dist/esm/components/Combobox/useCombobox.js +67 -87
- package/dist/esm/components/Combobox/useCombobox.js.map +1 -1
- package/dist/esm/components/Datepicker/Datepicker.js.map +1 -1
- package/dist/esm/components/Datepicker/useDatepicker.js +27 -34
- package/dist/esm/components/Datepicker/useDatepicker.js.map +1 -1
- package/dist/esm/components/Dialog/Context.js +4 -4
- package/dist/esm/components/Dialog/Context.js.map +1 -1
- package/dist/esm/components/Dialog/Dialog.js.map +1 -1
- package/dist/esm/components/Dialog/components/Content.js +39 -44
- package/dist/esm/components/Dialog/components/Content.js.map +1 -1
- package/dist/esm/components/Dialog/components/Drawer.js +3 -3
- package/dist/esm/components/Dialog/components/Drawer.js.map +1 -1
- package/dist/esm/components/Dialog/components/Extra.js +2 -2
- package/dist/esm/components/Dialog/components/Extra.js.map +1 -1
- package/dist/esm/components/Dialog/components/Trigger.js +2 -2
- package/dist/esm/components/Dialog/components/Trigger.js.map +1 -1
- package/dist/esm/components/Field/Field.js.map +1 -1
- package/dist/esm/components/Form/Form.js.map +1 -1
- package/dist/esm/components/Group/Group.js.map +1 -1
- package/dist/esm/components/Hanger/Hanger.js.map +1 -1
- package/dist/esm/components/HoverCard/HoverCard.js.map +1 -1
- package/dist/esm/components/Icon/Icon.js.map +1 -1
- package/dist/esm/components/Icon/components/AccountPreview.js.map +1 -1
- package/dist/esm/components/Icon/components/Accounting.js.map +1 -1
- package/dist/esm/components/Icon/components/AccountingYear.js.map +1 -1
- package/dist/esm/components/Icon/components/AccountingYearCancel.js.map +1 -1
- package/dist/esm/components/Icon/components/ArrowBottom.js.map +1 -1
- package/dist/esm/components/Icon/components/ArrowDown.js.map +1 -1
- package/dist/esm/components/Icon/components/ArrowEnd.js.map +1 -1
- package/dist/esm/components/Icon/components/ArrowLeft.js.map +1 -1
- package/dist/esm/components/Icon/components/ArrowRight.js.map +1 -1
- package/dist/esm/components/Icon/components/ArrowStart.js.map +1 -1
- package/dist/esm/components/Icon/components/ArrowTop.js.map +1 -1
- package/dist/esm/components/Icon/components/ArrowUp.js.map +1 -1
- package/dist/esm/components/Icon/components/Attach.js.map +1 -1
- package/dist/esm/components/Icon/components/AttachAuto.js.map +1 -1
- package/dist/esm/components/Icon/components/AttachCancel.js.map +1 -1
- package/dist/esm/components/Icon/components/Autotext.js.map +1 -1
- package/dist/esm/components/Icon/components/AutotextInsert.js.map +1 -1
- package/dist/esm/components/Icon/components/Basic.js.map +1 -1
- package/dist/esm/components/Icon/components/BasicTabs.js.map +1 -1
- package/dist/esm/components/Icon/components/BellSolid.js.map +1 -1
- package/dist/esm/components/Icon/components/Book.js.map +1 -1
- package/dist/esm/components/Icon/components/Booking.js.map +1 -1
- package/dist/esm/components/Icon/components/Budget.js.map +1 -1
- package/dist/esm/components/Icon/components/Calendar.js.map +1 -1
- package/dist/esm/components/Icon/components/CashAccount.js.map +1 -1
- package/dist/esm/components/Icon/components/CashReports.js.map +1 -1
- package/dist/esm/components/Icon/components/Chat.js.map +1 -1
- package/dist/esm/components/Icon/components/ChatSolid.js.map +1 -1
- package/dist/esm/components/Icon/components/ChevronDown.js.map +1 -1
- package/dist/esm/components/Icon/components/ChevronDownDouble.js.map +1 -1
- package/dist/esm/components/Icon/components/ChevronDownSolid.js.map +1 -1
- package/dist/esm/components/Icon/components/ChevronLeft.js.map +1 -1
- package/dist/esm/components/Icon/components/ChevronLeftDouble.js.map +1 -1
- package/dist/esm/components/Icon/components/ChevronRight.js.map +1 -1
- package/dist/esm/components/Icon/components/ChevronRightDouble.js.map +1 -1
- package/dist/esm/components/Icon/components/ChevronUp.js.map +1 -1
- package/dist/esm/components/Icon/components/ChevronUpDouble.js.map +1 -1
- package/dist/esm/components/Icon/components/ChevronUpSolid.js.map +1 -1
- package/dist/esm/components/Icon/components/CircleClose.js.map +1 -1
- package/dist/esm/components/Icon/components/CircleMinus.js.map +1 -1
- package/dist/esm/components/Icon/components/CirclePlus.js.map +1 -1
- package/dist/esm/components/Icon/components/CircleTick.js.map +1 -1
- package/dist/esm/components/Icon/components/Clamp.js.map +1 -1
- package/dist/esm/components/Icon/components/ClampOpen.js.map +1 -1
- package/dist/esm/components/Icon/components/Close.js.map +1 -1
- package/dist/esm/components/Icon/components/ConnectionEnable.js.map +1 -1
- package/dist/esm/components/Icon/components/ConnectionRevoke.js.map +1 -1
- package/dist/esm/components/Icon/components/Contacts.js.map +1 -1
- package/dist/esm/components/Icon/components/Copy.js.map +1 -1
- package/dist/esm/components/Icon/components/Courses.js.map +1 -1
- package/dist/esm/components/Icon/components/Credit.js.map +1 -1
- package/dist/esm/components/Icon/components/Delete.js.map +1 -1
- package/dist/esm/components/Icon/components/DeletePermanently.js.map +1 -1
- package/dist/esm/components/Icon/components/Depecriate.js.map +1 -1
- package/dist/esm/components/Icon/components/Developer.js.map +1 -1
- package/dist/esm/components/Icon/components/DistributionTemplate.js.map +1 -1
- package/dist/esm/components/Icon/components/Document.js.map +1 -1
- package/dist/esm/components/Icon/components/DocumentApprove.js.map +1 -1
- package/dist/esm/components/Icon/components/DocumentCreateEntry.js.map +1 -1
- package/dist/esm/components/Icon/components/DocumentCut.js.map +1 -1
- package/dist/esm/components/Icon/components/DocumentError.js.map +1 -1
- package/dist/esm/components/Icon/components/DocumentIsolatePage.js.map +1 -1
- package/dist/esm/components/Icon/components/DocumentMerge.js.map +1 -1
- package/dist/esm/components/Icon/components/DocumentMove.js.map +1 -1
- package/dist/esm/components/Icon/components/DocumentPreview.js.map +1 -1
- package/dist/esm/components/Icon/components/DocumentReceived.js.map +1 -1
- package/dist/esm/components/Icon/components/DocumentRejectedRequest.js.map +1 -1
- package/dist/esm/components/Icon/components/DocumentSplit.js.map +1 -1
- package/dist/esm/components/Icon/components/DocumentTime.js.map +1 -1
- package/dist/esm/components/Icon/components/Download.js.map +1 -1
- package/dist/esm/components/Icon/components/Drag.js.map +1 -1
- package/dist/esm/components/Icon/components/ECopedia.js.map +1 -1
- package/dist/esm/components/Icon/components/ESignature.js.map +1 -1
- package/dist/esm/components/Icon/components/Edit.js.map +1 -1
- package/dist/esm/components/Icon/components/EllipsisHorizontal.js.map +1 -1
- package/dist/esm/components/Icon/components/EllipsisVertical.js.map +1 -1
- package/dist/esm/components/Icon/components/EntriesOnAccount.js.map +1 -1
- package/dist/esm/components/Icon/components/EntriesOpen.js.map +1 -1
- package/dist/esm/components/Icon/components/EntriesWarning.js.map +1 -1
- package/dist/esm/components/Icon/components/EntryTypeCustomerInvoice.js.map +1 -1
- package/dist/esm/components/Icon/components/EntryTypeCustomerPayment.js.map +1 -1
- package/dist/esm/components/Icon/components/EntryTypeJournalEntry.js.map +1 -1
- package/dist/esm/components/Icon/components/EntryTypeManualCustomerInvoice.js.map +1 -1
- package/dist/esm/components/Icon/components/EntryTypeSupplierInvoice.js.map +1 -1
- package/dist/esm/components/Icon/components/EntryTypeSupplierPayment.js.map +1 -1
- package/dist/esm/components/Icon/components/Envelope.js.map +1 -1
- package/dist/esm/components/Icon/components/EnvelopeApproved.js.map +1 -1
- package/dist/esm/components/Icon/components/ExpandView.js.map +1 -1
- package/dist/esm/components/Icon/components/Expenses.js.map +1 -1
- package/dist/esm/components/Icon/components/Export.js.map +1 -1
- package/dist/esm/components/Icon/components/ExportToExcel.js.map +1 -1
- package/dist/esm/components/Icon/components/ExportToPdf.js.map +1 -1
- package/dist/esm/components/Icon/components/Filter.js.map +1 -1
- package/dist/esm/components/Icon/components/FilterSolid.js.map +1 -1
- package/dist/esm/components/Icon/components/GraphSolid.js.map +1 -1
- package/dist/esm/components/Icon/components/Hash.js.map +1 -1
- package/dist/esm/components/Icon/components/Home.js.map +1 -1
- package/dist/esm/components/Icon/components/Images.js.map +1 -1
- package/dist/esm/components/Icon/components/Import.js.map +1 -1
- package/dist/esm/components/Icon/components/Inbox.js.map +1 -1
- package/dist/esm/components/Icon/components/InboxEinvoicing.js.map +1 -1
- package/dist/esm/components/Icon/components/InboxScanning.js.map +1 -1
- package/dist/esm/components/Icon/components/InboxSmart.js.map +1 -1
- package/dist/esm/components/Icon/components/Info.js.map +1 -1
- package/dist/esm/components/Icon/components/Inventory.js.map +1 -1
- package/dist/esm/components/Icon/components/InventoryMatrix.js.map +1 -1
- package/dist/esm/components/Icon/components/JournalPro.js.map +1 -1
- package/dist/esm/components/Icon/components/Layout.js.map +1 -1
- package/dist/esm/components/Icon/components/LayoutBoth.js.map +1 -1
- package/dist/esm/components/Icon/components/LayoutFirst.js.map +1 -1
- package/dist/esm/components/Icon/components/LayoutLast.js.map +1 -1
- package/dist/esm/components/Icon/components/LayoutNone.js.map +1 -1
- package/dist/esm/components/Icon/components/LedgerCard.js.map +1 -1
- package/dist/esm/components/Icon/components/LedgerCardCustomerReminder.js.map +1 -1
- package/dist/esm/components/Icon/components/LedgerCardManualCustomerInvoice.js.map +1 -1
- package/dist/esm/components/Icon/components/LedgerCardObsoleteStock.js.map +1 -1
- package/dist/esm/components/Icon/components/LedgerCardOpeningEntry.js.map +1 -1
- package/dist/esm/components/Icon/components/LedgerCardReservedEntry.js.map +1 -1
- package/dist/esm/components/Icon/components/LedgerCardShrinkagePilferage.js.map +1 -1
- package/dist/esm/components/Icon/components/LedgerCardStockAdjustment.js.map +1 -1
- package/dist/esm/components/Icon/components/LedgerCardTransferredOpeningEntry.js.map +1 -1
- package/dist/esm/components/Icon/components/Lightbulb.js.map +1 -1
- package/dist/esm/components/Icon/components/Line.js.map +1 -1
- package/dist/esm/components/Icon/components/List.js.map +1 -1
- package/dist/esm/components/Icon/components/ListBulleted.js.map +1 -1
- package/dist/esm/components/Icon/components/ListSearch.js.map +1 -1
- package/dist/esm/components/Icon/components/LockOpen.js.map +1 -1
- package/dist/esm/components/Icon/components/Log.js.map +1 -1
- package/dist/esm/components/Icon/components/Market.js.map +1 -1
- package/dist/esm/components/Icon/components/MatchAmount.js.map +1 -1
- package/dist/esm/components/Icon/components/MatchEntries.js.map +1 -1
- package/dist/esm/components/Icon/components/Mileage.js.map +1 -1
- package/dist/esm/components/Icon/components/ModalResize.js.map +1 -1
- package/dist/esm/components/Icon/components/ModalShrink.js.map +1 -1
- package/dist/esm/components/Icon/components/More.js.map +1 -1
- package/dist/esm/components/Icon/components/MoreSolid.js.map +1 -1
- package/dist/esm/components/Icon/components/Move.js.map +1 -1
- package/dist/esm/components/Icon/components/NavigationList.js.map +1 -1
- package/dist/esm/components/Icon/components/Note.js.map +1 -1
- package/dist/esm/components/Icon/components/NoteFollowUp.js.map +1 -1
- package/dist/esm/components/Icon/components/NoteRead.js.map +1 -1
- package/dist/esm/components/Icon/components/PartnerApi.js.map +1 -1
- package/dist/esm/components/Icon/components/Period.js.map +1 -1
- package/dist/esm/components/Icon/components/PersonChange.js.map +1 -1
- package/dist/esm/components/Icon/components/PersonMinus.js.map +1 -1
- package/dist/esm/components/Icon/components/PersonPlus.js.map +1 -1
- package/dist/esm/components/Icon/components/PersonTick.js.map +1 -1
- package/dist/esm/components/Icon/components/Play.js.map +1 -1
- package/dist/esm/components/Icon/components/PlusMinus.js.map +1 -1
- package/dist/esm/components/Icon/components/Print.js.map +1 -1
- package/dist/esm/components/Icon/components/ProcessPayment.js.map +1 -1
- package/dist/esm/components/Icon/components/ProductLedgerCard.js.map +1 -1
- package/dist/esm/components/Icon/components/ProjectCards.js.map +1 -1
- package/dist/esm/components/Icon/components/Projects.js.map +1 -1
- package/dist/esm/components/Icon/components/Quicklinks.js.map +1 -1
- package/dist/esm/components/Icon/components/RatingBankruptcy.js.map +1 -1
- package/dist/esm/components/Icon/components/RatingPaymentProblems.js.map +1 -1
- package/dist/esm/components/Icon/components/Reconciled.js.map +1 -1
- package/dist/esm/components/Icon/components/Refresh.js.map +1 -1
- package/dist/esm/components/Icon/components/Report.js.map +1 -1
- package/dist/esm/components/Icon/components/ReportSolid.js.map +1 -1
- package/dist/esm/components/Icon/components/Restore.js.map +1 -1
- package/dist/esm/components/Icon/components/RotateLeft.js.map +1 -1
- package/dist/esm/components/Icon/components/RotateRight.js.map +1 -1
- package/dist/esm/components/Icon/components/Sales.js.map +1 -1
- package/dist/esm/components/Icon/components/Search.js.map +1 -1
- package/dist/esm/components/Icon/components/SearchBold.js.map +1 -1
- package/dist/esm/components/Icon/components/Secure.js.map +1 -1
- package/dist/esm/components/Icon/components/SecureTick.js.map +1 -1
- package/dist/esm/components/Icon/components/Settings.js.map +1 -1
- package/dist/esm/components/Icon/components/SettingsSolid.js.map +1 -1
- package/dist/esm/components/Icon/components/Shortcuts.js.map +1 -1
- package/dist/esm/components/Icon/components/ShowAll.js.map +1 -1
- package/dist/esm/components/Icon/components/ShowLess.js.map +1 -1
- package/dist/esm/components/Icon/components/ShowMore.js.map +1 -1
- package/dist/esm/components/Icon/components/ShowTemplate.js.map +1 -1
- package/dist/esm/components/Icon/components/Sliders.js.map +1 -1
- package/dist/esm/components/Icon/components/Smartpay.js.map +1 -1
- package/dist/esm/components/Icon/components/SortBy.js.map +1 -1
- package/dist/esm/components/Icon/components/Spinner.js.map +1 -1
- package/dist/esm/components/Icon/components/Star.js.map +1 -1
- package/dist/esm/components/Icon/components/StarSolid.js.map +1 -1
- package/dist/esm/components/Icon/components/Subscriptions.js.map +1 -1
- package/dist/esm/components/Icon/components/SystemEntries.js.map +1 -1
- package/dist/esm/components/Icon/components/Tag.js.map +1 -1
- package/dist/esm/components/Icon/components/TemplateOverride.js.map +1 -1
- package/dist/esm/components/Icon/components/Templates.js.map +1 -1
- package/dist/esm/components/Icon/components/ThumbBoth.js.map +1 -1
- package/dist/esm/components/Icon/components/ThumbDown.js.map +1 -1
- package/dist/esm/components/Icon/components/ThumbDownSolid.js.map +1 -1
- package/dist/esm/components/Icon/components/ThumbUp.js.map +1 -1
- package/dist/esm/components/Icon/components/ThumbUpSolid.js.map +1 -1
- package/dist/esm/components/Icon/components/Tick.js.map +1 -1
- package/dist/esm/components/Icon/components/Time.js.map +1 -1
- package/dist/esm/components/Icon/components/Transfer.js.map +1 -1
- package/dist/esm/components/Icon/components/TransferCancel.js.map +1 -1
- package/dist/esm/components/Icon/components/TransferLocked.js.map +1 -1
- package/dist/esm/components/Icon/components/Undock.js.map +1 -1
- package/dist/esm/components/Icon/components/Unreconciled.js.map +1 -1
- package/dist/esm/components/Icon/components/Warning.js.map +1 -1
- package/dist/esm/components/Icon/components/Webshop.js.map +1 -1
- package/dist/esm/components/Icon/components/Website.js.map +1 -1
- package/dist/esm/components/Icon/components/Workflow.js.map +1 -1
- package/dist/esm/components/Icon/components/Zoom.js.map +1 -1
- package/dist/esm/components/Icon/components/index.js +4 -4
- package/dist/esm/components/Icon/components/index.js.map +1 -1
- package/dist/esm/components/IconButton/IconButton.js.map +1 -1
- package/dist/esm/components/Input/Input.js.map +1 -1
- package/dist/esm/components/Input/util.js +2 -2
- package/dist/esm/components/Input/util.js.map +1 -1
- package/dist/esm/components/Listbox/Listbox.js.map +1 -1
- package/dist/esm/components/Listbox/ScrollableList.js +64 -83
- package/dist/esm/components/Listbox/ScrollableList.js.map +1 -1
- package/dist/esm/components/Listbox/useListbox.js +51 -60
- package/dist/esm/components/Listbox/useListbox.js.map +1 -1
- package/dist/esm/components/Listbox/useMultiListbox.js +64 -91
- package/dist/esm/components/Listbox/useMultiListbox.js.map +1 -1
- package/dist/esm/components/Listbox/useTypeahead.js +10 -9
- package/dist/esm/components/Listbox/useTypeahead.js.map +1 -1
- package/dist/esm/components/Listbox/util.js +48 -85
- package/dist/esm/components/Listbox/util.js.map +1 -1
- package/dist/esm/components/Menu/Context.js +2 -2
- package/dist/esm/components/Menu/Context.js.map +1 -1
- package/dist/esm/components/Menu/Menu.js.map +1 -1
- package/dist/esm/components/Menu/components/Checkbox.js +8 -9
- package/dist/esm/components/Menu/components/Checkbox.js.map +1 -1
- package/dist/esm/components/Menu/components/Content.js +10 -13
- package/dist/esm/components/Menu/components/Content.js.map +1 -1
- package/dist/esm/components/Menu/components/Header.js +4 -4
- package/dist/esm/components/Menu/components/Header.js.map +1 -1
- package/dist/esm/components/Menu/components/Item.js +34 -35
- package/dist/esm/components/Menu/components/Item.js.map +1 -1
- package/dist/esm/components/Menu/components/Link.js +10 -11
- package/dist/esm/components/Menu/components/Link.js.map +1 -1
- package/dist/esm/components/Menu/components/RadioGroup.js +16 -18
- package/dist/esm/components/Menu/components/RadioGroup.js.map +1 -1
- package/dist/esm/components/Menu/components/Separator.js +4 -4
- package/dist/esm/components/Menu/components/Separator.js.map +1 -1
- package/dist/esm/components/Menu/components/Trigger.js +5 -5
- package/dist/esm/components/Menu/components/Trigger.js.map +1 -1
- package/dist/esm/components/Navigation/Navigation.js +35 -44
- package/dist/esm/components/Navigation/Navigation.js.map +1 -1
- package/dist/esm/components/Pagination/PageNumbers.js +23 -28
- package/dist/esm/components/Pagination/PageNumbers.js.map +1 -1
- package/dist/esm/components/Pagination/Pagination.js +39 -56
- package/dist/esm/components/Pagination/Pagination.js.map +1 -1
- package/dist/esm/components/Pagination/usePagination.js +7 -21
- package/dist/esm/components/Pagination/usePagination.js.map +1 -1
- package/dist/esm/components/Pagination/usePaginationShortcuts.js +9 -9
- package/dist/esm/components/Pagination/usePaginationShortcuts.js.map +1 -1
- package/dist/esm/components/Popover/Popover.js +29 -34
- package/dist/esm/components/Popover/Popover.js.map +1 -1
- package/dist/esm/components/Popover/Primitives.js +7 -8
- package/dist/esm/components/Popover/Primitives.js.map +1 -1
- package/dist/esm/components/Progress/Progress.js +11 -15
- package/dist/esm/components/Progress/Progress.js.map +1 -1
- package/dist/esm/components/Provider/Provider.js +13 -18
- package/dist/esm/components/Provider/Provider.js.map +1 -1
- package/dist/esm/components/RadioGroup/RadioGroup.js +45 -57
- package/dist/esm/components/RadioGroup/RadioGroup.js.map +1 -1
- package/dist/esm/components/SearchInput/SearchInput.js.map +1 -1
- package/dist/esm/components/Select/Select.js +30 -31
- package/dist/esm/components/Select/Select.js.map +1 -1
- package/dist/esm/components/Select/useSelect.js +63 -81
- package/dist/esm/components/Select/useSelect.js.map +1 -1
- package/dist/esm/components/Spinner/Spinner.js +12 -19
- package/dist/esm/components/Spinner/Spinner.js.map +1 -1
- package/dist/esm/components/Switch/Switch.js +9 -10
- package/dist/esm/components/Switch/Switch.js.map +1 -1
- package/dist/esm/components/Table/components/BaseTable.js +23 -30
- package/dist/esm/components/Table/components/BaseTable.js.map +1 -1
- package/dist/esm/components/Table/components/PaginatedTable.js +3 -7
- package/dist/esm/components/Table/components/PaginatedTable.js.map +1 -1
- package/dist/esm/components/Table/components/Table.js +18 -25
- package/dist/esm/components/Table/components/Table.js.map +1 -1
- package/dist/esm/components/Table/components/WindowedTable.js +88 -104
- package/dist/esm/components/Table/components/WindowedTable.js.map +1 -1
- package/dist/esm/components/Table/hooks/plugins/useRowActions.js +122 -147
- package/dist/esm/components/Table/hooks/plugins/useRowActions.js.map +1 -1
- package/dist/esm/components/Table/hooks/plugins/useRowDraggable.js +57 -61
- package/dist/esm/components/Table/hooks/plugins/useRowDraggable.js.map +1 -1
- package/dist/esm/components/Table/hooks/plugins/useRowEditing.js +39 -36
- package/dist/esm/components/Table/hooks/plugins/useRowEditing.js.map +1 -1
- package/dist/esm/components/Table/hooks/plugins/useRowSelect.js +79 -89
- package/dist/esm/components/Table/hooks/plugins/useRowSelect.js.map +1 -1
- package/dist/esm/components/Table/hooks/useRowCreation.js +29 -64
- package/dist/esm/components/Table/hooks/useRowCreation.js.map +1 -1
- package/dist/esm/components/Table/hooks/useTable.js +119 -141
- package/dist/esm/components/Table/hooks/useTable.js.map +1 -1
- package/dist/esm/components/Table/hooks/useTableKeyboardNavigation.js +12 -15
- package/dist/esm/components/Table/hooks/useTableKeyboardNavigation.js.map +1 -1
- package/dist/esm/components/Table/util/renderColumn.js +10 -10
- package/dist/esm/components/Table/util/renderColumn.js.map +1 -1
- package/dist/esm/components/Table/util/renderRow.js +37 -46
- package/dist/esm/components/Table/util/renderRow.js.map +1 -1
- package/dist/esm/components/Table/util/rowIndexPath.js +14 -16
- package/dist/esm/components/Table/util/rowIndexPath.js.map +1 -1
- package/dist/esm/components/Table/util/sortTypes.js +23 -31
- package/dist/esm/components/Table/util/sortTypes.js.map +1 -1
- package/dist/esm/components/Table/util.js +29 -41
- package/dist/esm/components/Table/util.js.map +1 -1
- package/dist/esm/components/Tabs/Tabs.js +25 -27
- package/dist/esm/components/Tabs/Tabs.js.map +1 -1
- package/dist/esm/components/Textarea/Textarea.js +11 -9
- package/dist/esm/components/Textarea/Textarea.js.map +1 -1
- package/dist/esm/components/Toast/Toast.js +20 -21
- package/dist/esm/components/Toast/Toast.js.map +1 -1
- package/dist/esm/components/Toast/Toaster.js +88 -118
- package/dist/esm/components/Toast/Toaster.js.map +1 -1
- package/dist/esm/components/Toast/util.js +2 -2
- package/dist/esm/components/Toast/util.js.map +1 -1
- package/dist/esm/components/Tooltip/Tooltip.js +7 -8
- package/dist/esm/components/Tooltip/Tooltip.js.map +1 -1
- package/dist/esm/components/Tour/Tour.js +44 -50
- package/dist/esm/components/Tour/Tour.js.map +1 -1
- package/dist/esm/components/Treeview/Treeview.js +26 -36
- package/dist/esm/components/Treeview/Treeview.js.map +1 -1
- package/dist/esm/components/VisuallyHidden/VisuallyHidden.js +1 -1
- package/dist/esm/components/VisuallyHidden/VisuallyHidden.js.map +1 -1
- package/dist/esm/index.css +661 -661
- package/dist/esm/index.js +1 -1
- package/dist/esm/primitives/Button.js +9 -13
- package/dist/esm/primitives/Button.js.map +1 -1
- package/dist/esm/utils/date.js.map +1 -1
- package/dist/esm/utils/hooks/useBoundingClientRectListener.js.map +1 -1
- package/dist/esm/utils/hooks/useDraggable.js +16 -18
- package/dist/esm/utils/hooks/useDraggable.js.map +1 -1
- package/dist/esm/utils/hooks/useDropTarget.js +7 -10
- package/dist/esm/utils/hooks/useDropTarget.js.map +1 -1
- package/dist/esm/utils/hooks/useListKeyboardNavigation.js.map +1 -1
- package/dist/esm/utils/hooks/useListScrollTo.js.map +1 -1
- package/dist/esm/utils/hooks/useOnClickOutside.js.map +1 -1
- package/dist/esm/utils/hooks/useProxiedRef.js +3 -3
- package/dist/esm/utils/hooks/useProxiedRef.js.map +1 -1
- package/dist/esm/utils/hooks/useTimer.js +9 -17
- package/dist/esm/utils/hooks/useTimer.js.map +1 -1
- package/dist/esm/utils/input.js +7 -11
- package/dist/esm/utils/input.js.map +1 -1
- package/dist/esm/utils/mergeRefs.js +2 -2
- package/dist/esm/utils/mergeRefs.js.map +1 -1
- package/dist/esm/utils/taillwind.js +2 -2
- package/dist/esm/utils/taillwind.js.map +1 -1
- package/dist/index.css +661 -661
- package/dist/taco.cjs.development.js +1895 -2318
- 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/package.json +2 -2
- package/plugins/tailwindcss-aria-attributes.js +73 -73
- package/tailwind.config.js +297 -297
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"RadioGroup.js","sources":["../../../../src/components/RadioGroup/RadioGroup.tsx"],"sourcesContent":["import * as React from 'react';\nimport cn from 'classnames';\nimport * as RadioGroupPrimitive from '@radix-ui/react-radio-group';\nimport { Orientation } from '../../types';\n\nexport type RadioGroupItemValue = string | number | boolean | null;\n\nexport const getRadioGroupItemValueAsString = (value: RadioGroupItemValue): string => (value === null ? '' : String(value));\n\nexport const findByValue = (values: RadioGroupItemValue[], valueAsString: string): RadioGroupItemValue =>\n values.find(value => getRadioGroupItemValueAsString(value) === valueAsString) as RadioGroupItemValue;\n\nconst RadioGroupContext = React.createContext({ disabled: false, invalid: false });\n\nexport type RadioGroupItemProps<T = HTMLButtonElement> = Omit<\n React.ButtonHTMLAttributes<T>,\n 'children' | 'onSelect' | 'value'\n> & {\n /** Label for the radio group item */\n children: React.ReactNode;\n /* Whether the radio group item is disabled */\n disabled?: boolean;\n /** Value of the radio button */\n value: RadioGroupItemValue;\n};\n\nconst RadioGroupItem = React.forwardRef(function RadioGroupItem(props: RadioGroupItemProps, ref: React.Ref<HTMLButtonElement>) {\n const context = React.useContext(RadioGroupContext);\n const { children, value, ...otherProps } = props;\n\n const isDisabled = context.disabled || props.disabled;\n\n const className = cn(\n 'flex flex-shrink-0 self-start items-center justify-center h-4 w-4 mt-[0.2rem] rounded-full bg-white border-2 hover:border-4',\n {\n 'border-grey-dark focus:yt-focus aria-checked:bg-blue aria-checked:border-blue hover:aria-checked:border-blue-light':\n !isDisabled && !context.invalid,\n 'border-grey cursor-not-allowed aria-checked:bg-blue-light aria-checked:border-blue-light ': isDisabled,\n 'border-red text-red focus:border-red focus:yt-focus-red aria-checked:bg-red aria-checked:border-red':\n context.invalid && !isDisabled,\n }\n );\n const labelClassName = cn(\n 'flex items-center cursor-pointer gap-2',\n {\n 'cursor-not-allowed text-grey-dark': isDisabled,\n },\n props.className\n );\n\n return (\n <label className={labelClassName}>\n <RadioGroupPrimitive.Item\n {...otherProps}\n className={className}\n disabled={isDisabled}\n ref={ref}\n value={getRadioGroupItemValueAsString(value)}\n >\n <RadioGroupPrimitive.Indicator className=\"h-2 w-2 rounded-full bg-white\" />\n </RadioGroupPrimitive.Item>\n {children}\n </label>\n );\n});\n\ntype ReactGroupBaseChild = React.ReactElement<RadioGroupItemProps> | boolean | null;\n\ntype RadioGroupBaseProps = Omit<React.HTMLAttributes<HTMLDivElement>, 'children' | 'defaultValue' | 'onChange' | 'value'> & {\n children: ReactGroupBaseChild[];\n /* Whether the radio group is disabled */\n disabled?: boolean;\n /* Whether the radio group is in an invalid state */\n invalid?: boolean;\n /** The name of the radio group, used when submitting an HTML form */\n name?: string;\n /**\n * Orientation of the radio group\n * @defaultValue vertical\n */\n orientation?: Orientation;\n /* Whether the radio group requires user input */\n required?: boolean;\n};\n\ninterface UncontrolledRadioGroupProps extends RadioGroupBaseProps {\n /* The default value (uncontrolled) */\n defaultValue?: RadioGroupItemValue;\n onChange?: never;\n value?: never;\n}\n\ninterface ControlledRadioGroupProps extends RadioGroupBaseProps {\n defaultValue?: never;\n /** Handler called when the value changes */\n onChange: (value: RadioGroupItemValue) => void;\n /** The current value (controlled) */\n value?: RadioGroupItemValue;\n}\n\nexport type RadioGroupProps = UncontrolledRadioGroupProps | ControlledRadioGroupProps;\n\nexport type ForwardedRadioGroupWithStatics = React.ForwardRefExoticComponent<\n RadioGroupProps & React.RefAttributes<HTMLDivElement>\n> & {\n /** Item component rendered in a `RadioGroup` component */\n Item: React.ForwardRefExoticComponent<RadioGroupItemProps>;\n};\n\nexport const useRadioGroup = (props: RadioGroupProps) => {\n const { children, defaultValue, disabled, invalid, onChange, orientation = 'vertical', value, ...otherProps } = props;\n\n const values = React.useMemo<RadioGroupItemValue[]>(() => {\n const radioGroupItemValues: RadioGroupItemValue[] = [];\n\n React.Children.forEach(children, child => {\n if (React.isValidElement(child)) {\n radioGroupItemValues.push(child.props.value);\n }\n });\n\n return radioGroupItemValues;\n }, [children]);\n\n const context = React.useMemo(() => ({ disabled: disabled ?? false, invalid: invalid ?? false }), [disabled, invalid]);\n\n let valueProps;\n\n if (onChange !== undefined) {\n const handleChange = (value: string): void => onChange(findByValue(values, value));\n\n valueProps = {\n onValueChange: handleChange,\n value: value !== undefined ? getRadioGroupItemValueAsString(value) : undefined,\n };\n } else {\n valueProps = {\n defaultValue: defaultValue !== undefined ? getRadioGroupItemValueAsString(defaultValue) : undefined,\n };\n }\n\n return {\n context,\n props: {\n ...otherProps,\n ...valueProps,\n children,\n orientation,\n },\n };\n};\n\nexport const RadioGroup = React.forwardRef(function RadioGroup(props: RadioGroupProps, ref: React.Ref<HTMLDivElement>) {\n const { context, props: otherProps } = useRadioGroup(props);\n const className = cn(\n 'flex items-start gap-y-2',\n {\n 'flex-wrap gap-x-4 ': otherProps.orientation === 'horizontal',\n 'flex-col': otherProps.orientation === 'vertical',\n },\n otherProps.className\n );\n\n return (\n <RadioGroupContext.Provider value={context}>\n <RadioGroupPrimitive.Root {...otherProps} className={className} data-taco=\"radio-group\" ref={ref} />\n </RadioGroupContext.Provider>\n );\n}) as ForwardedRadioGroupWithStatics;\nRadioGroup.Item = RadioGroupItem;\n"],"names":["getRadioGroupItemValueAsString","value","String","findByValue","values","valueAsString","find","RadioGroupContext","React","disabled","invalid","RadioGroupItem","props","ref","context","children","otherProps","isDisabled","className","cn","labelClassName","RadioGroupPrimitive","useRadioGroup","defaultValue","onChange","orientation","radioGroupItemValues","forEach","child","push","valueProps","undefined","handleChange","onValueChange","RadioGroup","Provider","Item"],"mappings":";;;;;;;IAOaA,8BAA8B,GAAG,SAAjCA,8BAAiC,CAACC,KAAD;AAAA,SAAyCA,KAAK,KAAK,IAAV,GAAiB,EAAjB,GAAsBC,MAAM,CAACD,KAAD,CAArE;AAAA;IAEjCE,WAAW,GAAG,SAAdA,WAAc,CAACC,MAAD,EAAgCC,aAAhC;AAAA,SACvBD,MAAM,CAACE,IAAP,CAAY,UAAAL,KAAK;AAAA,WAAID,8BAA8B,CAACC,KAAD,CAA9B,KAA0CI,aAA9C;AAAA,GAAjB,CADuB;AAAA;AAG3B,IAAME,iBAAiB,gBAAGC,aAAA,CAAoB;AAAEC,EAAAA,QAAQ,EAAE,KAAZ;AAAmBC,EAAAA,OAAO,EAAE;AAA5B,CAApB,CAA1B;AAcA,IAAMC,cAAc,gBAAGH,UAAA,CAAiB,SAASG,cAAT,CAAwBC,KAAxB,EAAoDC,GAApD;AACpC,MAAMC,OAAO,GAAGN,UAAA,CAAiBD,iBAAjB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,YAAD,CAA3D,GAA4EQ;AADjF,KAAb;AAGH;;AAED,SAAO;AACHjB,IAAAA,OAAO,EAAPA,OADG;AAEHF,IAAAA,KAAK,eACEI,UADF,EAEEc,UAFF;AAGDf,MAAAA,QAAQ,EAARA,QAHC;AAIDU,MAAAA,WAAW,EAAXA;AAJC;AAFF,GAAP;AASH;IAEYS,UAAU,gBAAG1B,UAAA,CAAiB,SAAS0B,UAAT,CAAoBtB,KAApB,EAA4CC,GAA5C;AACvC,uBAAuCS,aAAa,CAACV,KAAD,CAApD;AAAA,MAAQE,OAAR,kBAAQA,OAAR;AAAA,MAAwBE,UAAxB,kBAAiBJ,KAAjB;;AACA,MAAMM,SAAS,GAAGC,EAAE,CAChB,0BADgB,EAEhB;AACI,0BAAsBH,UAAU,CAACS,WAAX,KAA2B,YADrD;AAEI,gBAAYT,UAAU,CAACS,WAAX,KAA2B;AAF3C,GAFgB,EAMhBT,UAAU,CAACE,SANK,CAApB;AASA,SACIV,aAAA,CAACD,iBAAiB,CAAC4B,QAAnB;AAA4BlC,IAAAA,KAAK,EAAEa;GAAnC,EACIN,aAAA,CAACa,IAAD,oBAA8BL;AAAYE,IAAAA,SAAS,EAAEA;iBAAqB;AAAcL,IAAAA,GAAG,EAAEA;IAA7F,CADJ,CADJ;AAKH,CAhByB;AAiB1BqB,UAAU,CAACE,IAAX,GAAkBzB,cAAlB;;;;"}
|
1
|
+
{"version":3,"file":"RadioGroup.js","sources":["../../../../src/components/RadioGroup/RadioGroup.tsx"],"sourcesContent":["import * as React from 'react';\r\nimport cn from 'classnames';\r\nimport * as RadioGroupPrimitive from '@radix-ui/react-radio-group';\r\nimport { Orientation } from '../../types';\r\n\r\nexport type RadioGroupItemValue = string | number | boolean | null;\r\n\r\nexport const getRadioGroupItemValueAsString = (value: RadioGroupItemValue): string => (value === null ? '' : String(value));\r\n\r\nexport const findByValue = (values: RadioGroupItemValue[], valueAsString: string): RadioGroupItemValue =>\r\n values.find(value => getRadioGroupItemValueAsString(value) === valueAsString) as RadioGroupItemValue;\r\n\r\nconst RadioGroupContext = React.createContext({ disabled: false, invalid: false });\r\n\r\nexport type RadioGroupItemProps<T = HTMLButtonElement> = Omit<\r\n React.ButtonHTMLAttributes<T>,\r\n 'children' | 'onSelect' | 'value'\r\n> & {\r\n /** Label for the radio group item */\r\n children: React.ReactNode;\r\n /* Whether the radio group item is disabled */\r\n disabled?: boolean;\r\n /** Value of the radio button */\r\n value: RadioGroupItemValue;\r\n};\r\n\r\nconst RadioGroupItem = React.forwardRef(function RadioGroupItem(props: RadioGroupItemProps, ref: React.Ref<HTMLButtonElement>) {\r\n const context = React.useContext(RadioGroupContext);\r\n const { children, value, ...otherProps } = props;\r\n\r\n const isDisabled = context.disabled || props.disabled;\r\n\r\n const className = cn(\r\n 'flex flex-shrink-0 self-start items-center justify-center h-4 w-4 mt-[0.2rem] rounded-full bg-white border-2 hover:border-4',\r\n {\r\n 'border-grey-dark focus:yt-focus aria-checked:bg-blue aria-checked:border-blue hover:aria-checked:border-blue-light':\r\n !isDisabled && !context.invalid,\r\n 'border-grey cursor-not-allowed aria-checked:bg-blue-light aria-checked:border-blue-light ': isDisabled,\r\n 'border-red text-red focus:border-red focus:yt-focus-red aria-checked:bg-red aria-checked:border-red':\r\n context.invalid && !isDisabled,\r\n }\r\n );\r\n const labelClassName = cn(\r\n 'flex items-center cursor-pointer gap-2',\r\n {\r\n 'cursor-not-allowed text-grey-dark': isDisabled,\r\n },\r\n props.className\r\n );\r\n\r\n return (\r\n <label className={labelClassName}>\r\n <RadioGroupPrimitive.Item\r\n {...otherProps}\r\n className={className}\r\n disabled={isDisabled}\r\n ref={ref}\r\n value={getRadioGroupItemValueAsString(value)}\r\n >\r\n <RadioGroupPrimitive.Indicator className=\"h-2 w-2 rounded-full bg-white\" />\r\n </RadioGroupPrimitive.Item>\r\n {children}\r\n </label>\r\n );\r\n});\r\n\r\ntype ReactGroupBaseChild = React.ReactElement<RadioGroupItemProps> | boolean | null;\r\n\r\ntype RadioGroupBaseProps = Omit<React.HTMLAttributes<HTMLDivElement>, 'children' | 'defaultValue' | 'onChange' | 'value'> & {\r\n children: ReactGroupBaseChild[];\r\n /* Whether the radio group is disabled */\r\n disabled?: boolean;\r\n /* Whether the radio group is in an invalid state */\r\n invalid?: boolean;\r\n /** The name of the radio group, used when submitting an HTML form */\r\n name?: string;\r\n /**\r\n * Orientation of the radio group\r\n * @defaultValue vertical\r\n */\r\n orientation?: Orientation;\r\n /* Whether the radio group requires user input */\r\n required?: boolean;\r\n};\r\n\r\ninterface UncontrolledRadioGroupProps extends RadioGroupBaseProps {\r\n /* The default value (uncontrolled) */\r\n defaultValue?: RadioGroupItemValue;\r\n onChange?: never;\r\n value?: never;\r\n}\r\n\r\ninterface ControlledRadioGroupProps extends RadioGroupBaseProps {\r\n defaultValue?: never;\r\n /** Handler called when the value changes */\r\n onChange: (value: RadioGroupItemValue) => void;\r\n /** The current value (controlled) */\r\n value?: RadioGroupItemValue;\r\n}\r\n\r\nexport type RadioGroupProps = UncontrolledRadioGroupProps | ControlledRadioGroupProps;\r\n\r\nexport type ForwardedRadioGroupWithStatics = React.ForwardRefExoticComponent<\r\n RadioGroupProps & React.RefAttributes<HTMLDivElement>\r\n> & {\r\n /** Item component rendered in a `RadioGroup` component */\r\n Item: React.ForwardRefExoticComponent<RadioGroupItemProps>;\r\n};\r\n\r\nexport const useRadioGroup = (props: RadioGroupProps) => {\r\n const { children, defaultValue, disabled, invalid, onChange, orientation = 'vertical', value, ...otherProps } = props;\r\n\r\n const values = React.useMemo<RadioGroupItemValue[]>(() => {\r\n const radioGroupItemValues: RadioGroupItemValue[] = [];\r\n\r\n React.Children.forEach(children, child => {\r\n if (React.isValidElement(child)) {\r\n radioGroupItemValues.push(child.props.value);\r\n }\r\n });\r\n\r\n return radioGroupItemValues;\r\n }, [children]);\r\n\r\n const context = React.useMemo(() => ({ disabled: disabled ?? false, invalid: invalid ?? false }), [disabled, invalid]);\r\n\r\n let valueProps;\r\n\r\n if (onChange !== undefined) {\r\n const handleChange = (value: string): void => onChange(findByValue(values, value));\r\n\r\n valueProps = {\r\n onValueChange: handleChange,\r\n value: value !== undefined ? getRadioGroupItemValueAsString(value) : undefined,\r\n };\r\n } else {\r\n valueProps = {\r\n defaultValue: defaultValue !== undefined ? getRadioGroupItemValueAsString(defaultValue) : undefined,\r\n };\r\n }\r\n\r\n return {\r\n context,\r\n props: {\r\n ...otherProps,\r\n ...valueProps,\r\n children,\r\n orientation,\r\n },\r\n };\r\n};\r\n\r\nexport const RadioGroup = React.forwardRef(function RadioGroup(props: RadioGroupProps, ref: React.Ref<HTMLDivElement>) {\r\n const { context, props: otherProps } = useRadioGroup(props);\r\n const className = cn(\r\n 'flex items-start gap-y-2',\r\n {\r\n 'flex-wrap gap-x-4 ': otherProps.orientation === 'horizontal',\r\n 'flex-col': otherProps.orientation === 'vertical',\r\n },\r\n otherProps.className\r\n );\r\n\r\n return (\r\n <RadioGroupContext.Provider value={context}>\r\n <RadioGroupPrimitive.Root {...otherProps} className={className} data-taco=\"radio-group\" ref={ref} />\r\n </RadioGroupContext.Provider>\r\n );\r\n}) as ForwardedRadioGroupWithStatics;\r\nRadioGroup.Item = RadioGroupItem;\r\n"],"names":["getRadioGroupItemValueAsString","value","String","findByValue","values","valueAsString","find","RadioGroupContext","React","disabled","invalid","RadioGroupItem","props","ref","context","children","otherProps","isDisabled","className","cn","labelClassName","RadioGroupPrimitive","useRadioGroup","defaultValue","onChange","orientation","radioGroupItemValues","forEach","child","push","valueProps","undefined","handleChange","onValueChange","RadioGroup","Provider","Item"],"mappings":";;;;MAOaA,8BAA8B,GAAIC,KAAD,IAAyCA,KAAK,KAAK,IAAV,GAAiB,EAAjB,GAAsBC,MAAM,CAACD,KAAD;MAEtGE,WAAW,GAAG,CAACC,MAAD,EAAgCC,aAAhC,KACvBD,MAAM,CAACE,IAAP,CAAYL,KAAK,IAAID,8BAA8B,CAACC,KAAD,CAA9B,KAA0CI,aAA/D;AAEJ,MAAME,iBAAi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ACH,GAAGI,UADA;AAEH,SAAGc,UAFA;AAGHf,MAAAA,QAHG;AAIHU,MAAAA;AAJG;AAFJ,GAAP;AASH;MAEYS,UAAU,gBAAG1B,UAAA,CAAiB,SAAS0B,UAAT,CAAoBtB,KAApB,EAA4CC,GAA5C;AACvC,QAAM;AAAEC,IAAAA,OAAF;AAAWF,IAAAA,KAAK,EAAEI;AAAlB,MAAiCM,aAAa,CAACV,KAAD,CAApD;AACA,QAAMM,SAAS,GAAGC,EAAE,CAChB,0BADgB,EAEhB;AACI,0BAAsBH,UAAU,CAACS,WAAX,KAA2B,YADrD;AAEI,gBAAYT,UAAU,CAACS,WAAX,KAA2B;AAF3C,GAFgB,EAMhBT,UAAU,CAACE,SANK,CAApB;AASA,SACIV,aAAA,CAACD,iBAAiB,CAAC4B,QAAnB;AAA4BlC,IAAAA,KAAK,EAAEa;GAAnC,EACIN,aAAA,CAACa,IAAD,oBAA8BL;AAAYE,IAAAA,SAAS,EAAEA;iBAAqB;AAAcL,IAAAA,GAAG,EAAEA;IAA7F,CADJ,CADJ;AAKH,CAhByB;AAiB1BqB,UAAU,CAACE,IAAX,GAAkBzB,cAAlB;;;;"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"SearchInput.js","sources":["../../../../src/components/SearchInput/SearchInput.tsx"],"sourcesContent":["import * as React from 'react';\nimport keycode from 'keycode';\nimport { Input, InputProps, useLocalization, IconButton } from '../..';\n\nexport type SearchInputTexts = {\n /**\n * aria-label text for input\n */\n inputLabel: string;\n};\n\nexport type SearchInputProps = Omit<InputProps, 'icon'> & {\n /** Current input value will be passed to the method. In order to get the value, the component must be controlled otherwise value will always be undefined */\n onSearch?: (value: string | number | readonly string[] | undefined) => void;\n};\n\nexport const SearchInput = React.forwardRef(function SearchInput(\n { onSearch, ...props }: SearchInputProps,\n ref: React.Ref<HTMLInputElement>\n) {\n const { texts } = useLocalization();\n\n const handleClick = (): void => {\n if (!props.disabled) {\n onSearch?.(props.value);\n }\n };\n\n const handleKeyDown = (event: React.KeyboardEvent<HTMLInputElement>): void => {\n const isEnterKeyPressed = event.keyCode === keycode('enter');\n\n if (isEnterKeyPressed) {\n handleClick();\n }\n\n props.onKeyDown?.(event);\n };\n\n return (\n <Input\n aria-label={texts.searchInput.inputLabel}\n {...props}\n button={\n <IconButton\n icon=\"search\"\n className=\"!border-transparent !bg-transparent focus:!border-transparent peer-focus:!border-transparent peer-focus:peer-active:!border-transparent\"\n disabled={props.disabled}\n onClick={handleClick}\n />\n }\n onKeyDown={handleKeyDown}\n ref={ref}\n type=\"search\"\n />\n );\n});\n"],"names":["SearchInput","React","ref","onSearch","props","useLocalization","texts","handleClick","disabled","value","handleKeyDown","event","isEnterKeyPressed","keyCode","keycode","onKeyDown","Input","searchInput","inputLabel","button","IconButton","icon","className","onClick","type"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAgBaA,WAAW,gBAAGC,UAAA,CAAiB,SAASD,WAAT,OAExCE,GAFwC;MACtCC,gBAAAA;MAAaC;;AAGf,yBAAkBC,eAAe,EAAjC;AAAA,MAAQC,KAAR,oBAAQA,KAAR;;AAEA,MAAMC,WAAW,GAAG,SAAdA,WAAc;AAChB,QAAI,CAACH,KAAK,CAACI,QAAX,EAAqB;AACjBL,MAAAA,QAAQ,SAAR,IAAAA,QAAQ,WAAR,YAAAA,QAAQ,CAAGC,KAAK,CAACK,KAAT,CAAR;AACH;AACJ,GAJD;;AAMA,MAAMC,aAAa,GAAG,SAAhBA,aAAgB,CAACC,KAAD;;;AAClB,QAAMC,iBAAiB,GAAGD,KAAK,CAACE,OAAN,KAAkBC,OAAO,CAAC,OAAD,CAAnD;;AAEA,QAAIF,iBAAJ,EAAuB;AACnBL,MAAAA,WAAW;AACd;;AAED,wBAAAH,KAAK,CAACW,SAAN,2EAAAX,KAAK,EAAaO,KAAb,CAAL;AACH,GARD;;AAUA,SACIV,aAAA,CAACe,KAAD;kBACgBV,KAAK,CAACW,WAAN,CAAkBC;KAC1Bd;AACJe,IAAAA,MAAM,EACFlB,aAAA,CAACmB,UAAD;AACIC,MAAAA,IAAI,EAAC;AACLC,MAAAA,SAAS,EAAC;AACVd,MAAAA,QAAQ,EAAEJ,KAAK,CAACI;AAChBe,MAAAA,OAAO,EAAEhB;KAJb;AAOJQ,IAAAA,SAAS,EAAEL;AACXR,IAAAA,GAAG,EAAEA;AACLsB,IAAAA,IAAI,EAAC;IAbT,CADJ;AAiBH,CAvC0B;;;;"}
|
1
|
+
{"version":3,"file":"SearchInput.js","sources":["../../../../src/components/SearchInput/SearchInput.tsx"],"sourcesContent":["import * as React from 'react';\r\nimport keycode from 'keycode';\r\nimport { Input, InputProps, useLocalization, IconButton } from '../..';\r\n\r\nexport type SearchInputTexts = {\r\n /**\r\n * aria-label text for input\r\n */\r\n inputLabel: string;\r\n};\r\n\r\nexport type SearchInputProps = Omit<InputProps, 'icon'> & {\r\n /** Current input value will be passed to the method. In order to get the value, the component must be controlled otherwise value will always be undefined */\r\n onSearch?: (value: string | number | readonly string[] | undefined) => void;\r\n};\r\n\r\nexport const SearchInput = React.forwardRef(function SearchInput(\r\n { onSearch, ...props }: SearchInputProps,\r\n ref: React.Ref<HTMLInputElement>\r\n) {\r\n const { texts } = useLocalization();\r\n\r\n const handleClick = (): void => {\r\n if (!props.disabled) {\r\n onSearch?.(props.value);\r\n }\r\n };\r\n\r\n const handleKeyDown = (event: React.KeyboardEvent<HTMLInputElement>): void => {\r\n const isEnterKeyPressed = event.keyCode === keycode('enter');\r\n\r\n if (isEnterKeyPressed) {\r\n handleClick();\r\n }\r\n\r\n props.onKeyDown?.(event);\r\n };\r\n\r\n return (\r\n <Input\r\n aria-label={texts.searchInput.inputLabel}\r\n {...props}\r\n button={\r\n <IconButton\r\n icon=\"search\"\r\n className=\"!border-transparent !bg-transparent focus:!border-transparent peer-focus:!border-transparent peer-focus:peer-active:!border-transparent\"\r\n disabled={props.disabled}\r\n onClick={handleClick}\r\n />\r\n }\r\n onKeyDown={handleKeyDown}\r\n ref={ref}\r\n type=\"search\"\r\n />\r\n );\r\n});\r\n"],"names":["SearchInput","React","ref","onSearch","props","useLocalization","texts","handleClick","disabled","value","handleKeyDown","event","isEnterKeyPressed","keyCode","keycode","onKeyDown","Input","searchInput","inputLabel","button","IconButton","icon","className","onClick","type"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAgBaA,WAAW,gBAAGC,UAAA,CAAiB,SAASD,WAAT,OAExCE,GAFwC;MACtCC,gBAAAA;MAAaC;;AAGf,yBAAkBC,eAAe,EAAjC;AAAA,MAAQC,KAAR,oBAAQA,KAAR;;AAEA,MAAMC,WAAW,GAAG,SAAdA,WAAc;AAChB,QAAI,CAACH,KAAK,CAACI,QAAX,EAAqB;AACjBL,MAAAA,QAAQ,SAAR,IAAAA,QAAQ,WAAR,YAAAA,QAAQ,CAAGC,KAAK,CAACK,KAAT,CAAR;AACH;AACJ,GAJD;;AAMA,MAAMC,aAAa,GAAG,SAAhBA,aAAgB,CAACC,KAAD;;;AAClB,QAAMC,iBAAiB,GAAGD,KAAK,CAACE,OAAN,KAAkBC,OAAO,CAAC,OAAD,CAAnD;;AAEA,QAAIF,iBAAJ,EAAuB;AACnBL,MAAAA,WAAW;AACd;;AAED,wBAAAH,KAAK,CAACW,SAAN,2EAAAX,KAAK,EAAaO,KAAb,CAAL;AACH,GARD;;AAUA,SACIV,aAAA,CAACe,KAAD;kBACgBV,KAAK,CAACW,WAAN,CAAkBC;KAC1Bd;AACJe,IAAAA,MAAM,EACFlB,aAAA,CAACmB,UAAD;AACIC,MAAAA,IAAI,EAAC;AACLC,MAAAA,SAAS,EAAC;AACVd,MAAAA,QAAQ,EAAEJ,KAAK,CAACI;AAChBe,MAAAA,OAAO,EAAEhB;KAJb;AAOJQ,IAAAA,SAAS,EAAEL;AACXR,IAAAA,GAAG,EAAEA;AACLsB,IAAAA,IAAI,EAAC;IAbT,CADJ;AAiBH,CAvC0B;;;;"}
|
@@ -1,4 +1,3 @@
|
|
1
|
-
import { objectWithoutPropertiesLoose as _objectWithoutPropertiesLoose, extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
2
1
|
import { forwardRef, createElement, useRef, useEffect, Fragment } from 'react';
|
3
2
|
import cn from 'classnames';
|
4
3
|
import { Icon } from '../Icon/Icon.js';
|
@@ -10,54 +9,52 @@ import { Combobox } from '../Combobox/Combobox.js';
|
|
10
9
|
import { MultiListbox, Listbox } from '../Listbox/Listbox.js';
|
11
10
|
import { useSelect } from './useSelect.js';
|
12
11
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
var className = cn('inline-flex relative w-full', {
|
12
|
+
const BaseSelect = /*#__PURE__*/forwardRef(function BaseSelect(props, ref) {
|
13
|
+
const {
|
14
|
+
autoFocus,
|
15
|
+
className: externalClassName,
|
16
|
+
highlighted,
|
17
|
+
style,
|
18
|
+
...otherProps
|
19
|
+
} = props;
|
20
|
+
const {
|
21
|
+
button,
|
22
|
+
listbox,
|
23
|
+
popover,
|
24
|
+
input,
|
25
|
+
text,
|
26
|
+
more = 0
|
27
|
+
} = useSelect(otherProps, ref);
|
28
|
+
const internalRef = useRef(null);
|
29
|
+
const selectDimensions = useBoundingClientRectListener(internalRef);
|
30
|
+
const className = cn('inline-flex relative w-full', {
|
33
31
|
'yt-select--readonly': props.readOnly
|
34
32
|
}, externalClassName);
|
35
|
-
|
33
|
+
const inputClassname = cn(getInputClasses(props), 'h-8 text-left pr-0', {
|
36
34
|
'border-blue': popover.open
|
37
35
|
});
|
38
|
-
useEffect(
|
36
|
+
useEffect(() => {
|
39
37
|
if (autoFocus && internalRef.current) {
|
40
38
|
internalRef.current.focus();
|
41
39
|
}
|
42
40
|
}, []);
|
43
41
|
|
44
|
-
|
42
|
+
const renderMultiSelection = () => {
|
45
43
|
return createElement(Fragment, null, createElement("span", {
|
46
44
|
className: "flex-grow truncate text-left"
|
47
45
|
}, text), more > 0 && createElement(Badge, {
|
48
46
|
className: "ml-2"
|
49
|
-
},
|
47
|
+
}, `+${more}`));
|
50
48
|
};
|
51
49
|
|
52
|
-
|
50
|
+
const commonListboxProps = { ...listbox,
|
53
51
|
className: 'w-auto',
|
54
52
|
invalid: undefined,
|
55
53
|
style: {
|
56
54
|
minWidth: selectDimensions === null || selectDimensions === void 0 ? void 0 : selectDimensions.width
|
57
55
|
},
|
58
56
|
tabIndex: popover.open ? 0 : -1
|
59
|
-
}
|
60
|
-
|
57
|
+
};
|
61
58
|
return createElement("span", {
|
62
59
|
className: className,
|
63
60
|
"data-taco": "select",
|
@@ -80,9 +77,11 @@ var BaseSelect = /*#__PURE__*/forwardRef(function BaseSelect(props, ref) {
|
|
80
77
|
type: "text"
|
81
78
|
}))));
|
82
79
|
});
|
83
|
-
|
84
|
-
|
85
|
-
|
80
|
+
const Select = /*#__PURE__*/forwardRef(function Select(props, ref) {
|
81
|
+
const {
|
82
|
+
editable,
|
83
|
+
...otherProps
|
84
|
+
} = props;
|
86
85
|
|
87
86
|
if (editable) {
|
88
87
|
return createElement(Combobox, Object.assign({}, otherProps, {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Select.js","sources":["../../../../src/components/Select/Select.tsx"],"sourcesContent":["import * as React from 'react';\nimport cn from 'classnames';\nimport * as PopoverPrimitive from '@radix-ui/react-popover';\nimport { Icon } from '../Icon/Icon';\nimport { Listbox, MultiListbox, ListboxProps } from '../Listbox/Listbox';\nimport { useBoundingClientRectListener } from '../../utils/hooks/useBoundingClientRectListener';\nimport { useSelect } from './useSelect';\nimport { Combobox, ComboboxProps } from '../Combobox/Combobox';\nimport { Badge } from '../Badge/Badge';\nimport { getInputClasses } from '../Input/util';\n\nexport type SelectTexts = {\n /**\n * The text displayed when all options are selected when multiselect mode in on.\n */\n allOptionsSelected: string;\n};\n\nexport type BaseSelectProps = Omit<ListboxProps, 'dialog'> &\n Omit<ComboboxProps, 'inline'> & {\n /**\n * Allows to select multiple values.\n * All the selected values will be combined in a comma-seperated string as the value of the input.\n */\n multiselect?: boolean;\n };\n\nexport type SelectProps = BaseSelectProps & {\n /**\n * Creates an editable select.\n * Setting this will render a inline Combobox which will display the provided data on click/focus,\n * even if there is no value in the input.\n * After user starts typing, matching data will be displayed.\n */\n editable?: boolean;\n};\n\nconst BaseSelect = React.forwardRef(function BaseSelect(props: BaseSelectProps, ref: React.Ref<HTMLInputElement>) {\n const { autoFocus, className: externalClassName, highlighted, style, ...otherProps } = props;\n const { button, listbox, popover, input, text, more = 0 } = useSelect(otherProps, ref);\n const internalRef = React.useRef<HTMLButtonElement>(null);\n const selectDimensions = useBoundingClientRectListener(internalRef);\n const className = cn('inline-flex relative w-full', { 'yt-select--readonly': props.readOnly }, externalClassName);\n const inputClassname = cn(getInputClasses(props), 'h-8 text-left pr-0', {\n 'border-blue': popover.open,\n });\n\n React.useEffect(() => {\n if (autoFocus && internalRef.current) {\n internalRef.current.focus();\n }\n }, []);\n\n const renderMultiSelection = (): React.ReactNode => {\n return (\n <>\n <span className=\"flex-grow truncate text-left\">{text}</span>\n {more > 0 && <Badge className=\"ml-2\">{`+${more}`}</Badge>}\n </>\n );\n };\n\n const commonListboxProps: ListboxProps = {\n ...listbox,\n className: 'w-auto',\n invalid: undefined,\n style: { minWidth: selectDimensions?.width },\n tabIndex: popover.open ? 0 : -1,\n };\n\n return (\n <span className={className} data-taco=\"select\" style={style}>\n <PopoverPrimitive.Root {...popover}>\n <PopoverPrimitive.Trigger {...button} className={inputClassname} ref={internalRef}>\n {props.multiselect ? renderMultiSelection() : <span className=\"flex-grow truncate text-left\">{text}</span>}\n <span className=\"flex h-8 w-8 items-center justify-center\">\n <Icon className=\"pointer-events-none\" name={popover.open ? 'chevron-up' : 'chevron-down'} />\n </span>\n </PopoverPrimitive.Trigger>\n <PopoverPrimitive.Content align=\"start\" sideOffset={4}>\n {props.multiselect ? <MultiListbox {...commonListboxProps} /> : <Listbox {...commonListboxProps} />}\n </PopoverPrimitive.Content>\n <input {...input} className=\"hidden\" type=\"text\" />\n </PopoverPrimitive.Root>\n </span>\n );\n});\n\nexport const Select = React.forwardRef(function Select(props: SelectProps, ref: React.Ref<HTMLInputElement>) {\n const { editable, ...otherProps } = props;\n\n if (editable) {\n return <Combobox {...otherProps} dialog={undefined} inline ref={ref} />;\n }\n\n return <BaseSelect {...otherProps} ref={ref} />;\n});\n"],"names":["BaseSelect","React","props","ref","autoFocus","externalClassName","
|
1
|
+
{"version":3,"file":"Select.js","sources":["../../../../src/components/Select/Select.tsx"],"sourcesContent":["import * as React from 'react';\r\nimport cn from 'classnames';\r\nimport * as PopoverPrimitive from '@radix-ui/react-popover';\r\nimport { Icon } from '../Icon/Icon';\r\nimport { Listbox, MultiListbox, ListboxProps } from '../Listbox/Listbox';\r\nimport { useBoundingClientRectListener } from '../../utils/hooks/useBoundingClientRectListener';\r\nimport { useSelect } from './useSelect';\r\nimport { Combobox, ComboboxProps } from '../Combobox/Combobox';\r\nimport { Badge } from '../Badge/Badge';\r\nimport { getInputClasses } from '../Input/util';\r\n\r\nexport type SelectTexts = {\r\n /**\r\n * The text displayed when all options are selected when multiselect mode in on.\r\n */\r\n allOptionsSelected: string;\r\n};\r\n\r\nexport type BaseSelectProps = Omit<ListboxProps, 'dialog'> &\r\n Omit<ComboboxProps, 'inline'> & {\r\n /**\r\n * Allows to select multiple values.\r\n * All the selected values will be combined in a comma-seperated string as the value of the input.\r\n */\r\n multiselect?: boolean;\r\n };\r\n\r\nexport type SelectProps = BaseSelectProps & {\r\n /**\r\n * Creates an editable select.\r\n * Setting this will render a inline Combobox which will display the provided data on click/focus,\r\n * even if there is no value in the input.\r\n * After user starts typing, matching data will be displayed.\r\n */\r\n editable?: boolean;\r\n};\r\n\r\nconst BaseSelect = React.forwardRef(function BaseSelect(props: BaseSelectProps, ref: React.Ref<HTMLInputElement>) {\r\n const { autoFocus, className: externalClassName, highlighted, style, ...otherProps } = props;\r\n const { button, listbox, popover, input, text, more = 0 } = useSelect(otherProps, ref);\r\n const internalRef = React.useRef<HTMLButtonElement>(null);\r\n const selectDimensions = useBoundingClientRectListener(internalRef);\r\n const className = cn('inline-flex relative w-full', { 'yt-select--readonly': props.readOnly }, externalClassName);\r\n const inputClassname = cn(getInputClasses(props), 'h-8 text-left pr-0', {\r\n 'border-blue': popover.open,\r\n });\r\n\r\n React.useEffect(() => {\r\n if (autoFocus && internalRef.current) {\r\n internalRef.current.focus();\r\n }\r\n }, []);\r\n\r\n const renderMultiSelection = (): React.ReactNode => {\r\n return (\r\n <>\r\n <span className=\"flex-grow truncate text-left\">{text}</span>\r\n {more > 0 && <Badge className=\"ml-2\">{`+${more}`}</Badge>}\r\n </>\r\n );\r\n };\r\n\r\n const commonListboxProps: ListboxProps = {\r\n ...listbox,\r\n className: 'w-auto',\r\n invalid: undefined,\r\n style: { minWidth: selectDimensions?.width },\r\n tabIndex: popover.open ? 0 : -1,\r\n };\r\n\r\n return (\r\n <span className={className} data-taco=\"select\" style={style}>\r\n <PopoverPrimitive.Root {...popover}>\r\n <PopoverPrimitive.Trigger {...button} className={inputClassname} ref={internalRef}>\r\n {props.multiselect ? renderMultiSelection() : <span className=\"flex-grow truncate text-left\">{text}</span>}\r\n <span className=\"flex h-8 w-8 items-center justify-center\">\r\n <Icon className=\"pointer-events-none\" name={popover.open ? 'chevron-up' : 'chevron-down'} />\r\n </span>\r\n </PopoverPrimitive.Trigger>\r\n <PopoverPrimitive.Content align=\"start\" sideOffset={4}>\r\n {props.multiselect ? <MultiListbox {...commonListboxProps} /> : <Listbox {...commonListboxProps} />}\r\n </PopoverPrimitive.Content>\r\n <input {...input} className=\"hidden\" type=\"text\" />\r\n </PopoverPrimitive.Root>\r\n </span>\r\n );\r\n});\r\n\r\nexport const Select = React.forwardRef(function Select(props: SelectProps, ref: React.Ref<HTMLInputElement>) {\r\n const { editable, ...otherProps } = props;\r\n\r\n if (editable) {\r\n return <Combobox {...otherProps} dialog={undefined} inline ref={ref} />;\r\n }\r\n\r\n return <BaseSelect {...otherProps} ref={ref} />;\r\n});\r\n"],"names":["BaseSelect","React","props","ref","autoFocus","className","externalClassName","highlighted","style","otherProps","button","listbox","popover","input","text","more","useSelect","internalRef","selectDimensions","useBoundingClientRectListener","cn","readOnly","inputClassname","getInputClasses","open","current","focus","renderMultiSelection","Badge","commonListboxProps","invalid","undefined","minWidth","width","tabIndex","PopoverPrimitive","multiselect","Icon","name","align","sideOffset","MultiListbox","Listbox","type","Select","editable","Combobox","dialog","inline"],"mappings":";;;;;;;;;;;AAqCA,MAAMA,UAAU,gBAAGC,UAAA,CAAiB,SAASD,UAAT,CAAoBE,KAApB,EAA4CC,GAA5C;AAChC,QAAM;AAAEC,IAAAA,SAAF;AAAaC,IAAAA,SAAS,EAAEC,iBAAxB;AAA2CC,IAAAA,WAA3C;AAAwDC,IAAAA,KAAxD;AAA+D,OAAGC;AAAlE,MAAiFP,KAAvF;AACA,QAAM;AAAEQ,IAAAA,MAAF;AAAUC,IAAAA,OAAV;AAAmBC,IAAAA,OAAnB;AAA4BC,IAAAA,KAA5B;AAAmCC,IAAAA,IAAnC;AAAyCC,IAAAA,IAAI,GAAG;AAAhD,MAAsDC,SAAS,CAACP,UAAD,EAAaN,GAAb,CAArE;AACA,QAAMc,WAAW,GAAGhB,MAAA,CAAgC,IAAhC,CAApB;AACA,QAAMiB,gBAAgB,GAAGC,6BAA6B,CAACF,WAAD,CAAtD;AACA,QAAMZ,SAAS,GAAGe,EAAE,CAAC,6BAAD,EAAgC;AAAE,2BAAuBlB,KAAK,CAACmB;AAA/B,GAAhC,EAA2Ef,iBAA3E,CAApB;AACA,QAAMgB,cAAc,GAAGF,EAAE,CAACG,eAAe,CAACrB,KAAD,CAAhB,EAAyB,oBAAzB,EAA+C;AACp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oC,IAAD;AAAMhC,IAAAA,SAAS,EAAC;AAAsBiC,IAAAA,IAAI,EAAE1B,OAAO,CAACY,IAAR,GAAe,YAAf,GAA8B;GAA1E,CADJ,CAFJ,CADJ,EAOIvB,aAAA,CAACkC,OAAD;AAA0BI,IAAAA,KAAK,EAAC;AAAQC,IAAAA,UAAU,EAAE;GAApD,EACKtC,KAAK,CAACkC,WAAN,GAAoBnC,aAAA,CAACwC,YAAD,oBAAkBZ,mBAAlB,CAApB,GAA+D5B,aAAA,CAACyC,OAAD,oBAAab,mBAAb,CADpE,CAPJ,EAUI5B,aAAA,QAAA,oBAAWY;AAAOR,IAAAA,SAAS,EAAC;AAASsC,IAAAA,IAAI,EAAC;IAA1C,CAVJ,CADJ,CADJ;AAgBH,CAjDkB,CAAnB;MAmDaC,MAAM,gBAAG3C,UAAA,CAAiB,SAAS2C,MAAT,CAAgB1C,KAAhB,EAAoCC,GAApC;AACnC,QAAM;AAAE0C,IAAAA,QAAF;AAAY,OAAGpC;AAAf,MAA8BP,KAApC;;AAEA,MAAI2C,QAAJ,EAAc;AACV,WAAO5C,aAAA,CAAC6C,QAAD,oBAAcrC;AAAYsC,MAAAA,MAAM,EAAEhB;AAAWiB,MAAAA,MAAM;AAAC7C,MAAAA,GAAG,EAAEA;MAAzD,CAAP;AACH;;AAED,SAAOF,aAAA,CAACD,UAAD,oBAAgBS;AAAYN,IAAAA,GAAG,EAAEA;IAAjC,CAAP;AACH,CARqB;;;;"}
|
@@ -1,4 +1,3 @@
|
|
1
|
-
import { objectWithoutPropertiesLoose as _objectWithoutPropertiesLoose, extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
2
1
|
import { useState, useMemo, useRef, useEffect, createElement, Fragment, cloneElement } from 'react';
|
3
2
|
import cn from 'classnames';
|
4
3
|
import { v4 } from 'uuid';
|
@@ -8,47 +7,37 @@ import keycode from 'keycode';
|
|
8
7
|
import { createCustomEvent } from '../../utils/input.js';
|
9
8
|
import { useFlattenedData, findByValue, setInputValueByRef, sanitizeItem } from '../Listbox/util.js';
|
10
9
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
return nativeId || "select_" + v4();
|
40
|
-
}, [nativeId]);
|
41
|
-
var inputRef = useRef(null);
|
42
|
-
var buttonId = id + "-button"; // support 'escape' resetting to the value that was set when the listbox opened
|
43
|
-
|
44
|
-
var _React$useState2 = useState(value),
|
45
|
-
lastValue = _React$useState2[0],
|
46
|
-
setLastValue = _React$useState2[1];
|
47
|
-
|
48
|
-
useEffect(function () {
|
10
|
+
const useSelect = ({
|
11
|
+
'aria-label': ariaLabel,
|
12
|
+
'aria-labelledby': ariaLabelledBy,
|
13
|
+
data = [],
|
14
|
+
defaultValue,
|
15
|
+
disabled,
|
16
|
+
emptyValue,
|
17
|
+
id: nativeId,
|
18
|
+
multiselect,
|
19
|
+
onBlur,
|
20
|
+
onClick,
|
21
|
+
onChange,
|
22
|
+
readOnly,
|
23
|
+
value,
|
24
|
+
...otherProps
|
25
|
+
}, ref) => {
|
26
|
+
const {
|
27
|
+
texts
|
28
|
+
} = useLocalization();
|
29
|
+
const flattenedData = useFlattenedData(data);
|
30
|
+
const listboxInputRef = useProxiedRef(ref);
|
31
|
+
const [open, setOpen] = useState(false);
|
32
|
+
const id = useMemo(() => nativeId || `select_${v4()}`, [nativeId]);
|
33
|
+
const inputRef = useRef(null);
|
34
|
+
const buttonId = `${id}-button`; // support 'escape' resetting to the value that was set when the listbox opened
|
35
|
+
|
36
|
+
const [lastValue, setLastValue] = useState(value);
|
37
|
+
useEffect(() => {
|
49
38
|
setLastValue(value);
|
50
39
|
}, [open]);
|
51
|
-
useEffect(
|
40
|
+
useEffect(() => {
|
52
41
|
if (value === undefined) {
|
53
42
|
if (defaultValue !== undefined && findByValue(flattenedData, defaultValue)) {
|
54
43
|
setInputValueByRef(inputRef.current, defaultValue);
|
@@ -70,14 +59,14 @@ var useSelect = function useSelect(_ref, ref) {
|
|
70
59
|
}
|
71
60
|
}, []); // event handlers
|
72
61
|
|
73
|
-
|
62
|
+
const handleButtonKeyDown = event => {
|
74
63
|
if (event.keyCode === keycode('up') || event.keyCode === keycode('down')) {
|
75
64
|
event.preventDefault();
|
76
65
|
setOpen(true);
|
77
66
|
}
|
78
67
|
};
|
79
68
|
|
80
|
-
|
69
|
+
const handleListboxKeyDown = event => {
|
81
70
|
switch (event.keyCode) {
|
82
71
|
case keycode('escape'):
|
83
72
|
{
|
@@ -108,7 +97,7 @@ var useSelect = function useSelect(_ref, ref) {
|
|
108
97
|
}
|
109
98
|
};
|
110
99
|
|
111
|
-
|
100
|
+
const handleListboxClick = event => {
|
112
101
|
event.preventDefault();
|
113
102
|
|
114
103
|
if (!multiselect) {
|
@@ -120,16 +109,14 @@ var useSelect = function useSelect(_ref, ref) {
|
|
120
109
|
}
|
121
110
|
};
|
122
111
|
|
123
|
-
|
124
|
-
|
112
|
+
let text = '';
|
113
|
+
let more = 0;
|
125
114
|
|
126
115
|
if (value !== undefined) {
|
127
116
|
if (multiselect) {
|
128
|
-
|
117
|
+
const selectedValues = (value === null || value === void 0 ? void 0 : value.toString().split(',')) || [];
|
129
118
|
|
130
|
-
if (selectedValues.length === flattenedData.filter(
|
131
|
-
return !item.disabled;
|
132
|
-
}).length) {
|
119
|
+
if (selectedValues.length === flattenedData.filter(item => !item.disabled).length) {
|
133
120
|
text = texts.select.allOptionsSelected;
|
134
121
|
} else {
|
135
122
|
var _findByValue$text, _findByValue;
|
@@ -138,7 +125,7 @@ var useSelect = function useSelect(_ref, ref) {
|
|
138
125
|
more = selectedValues.length > 1 ? selectedValues.length - 1 : 0;
|
139
126
|
}
|
140
127
|
} else {
|
141
|
-
|
128
|
+
const item = findByValue(flattenedData, value);
|
142
129
|
|
143
130
|
if (item) {
|
144
131
|
text = item.icon ? createElement(Fragment, null, cloneElement(item.icon, {
|
@@ -148,27 +135,24 @@ var useSelect = function useSelect(_ref, ref) {
|
|
148
135
|
}
|
149
136
|
}
|
150
137
|
|
151
|
-
|
138
|
+
const handleInputChange = event => {
|
152
139
|
event.persist();
|
153
140
|
|
154
141
|
if (onChange) {
|
155
142
|
var _item$path$split, _item$path;
|
156
143
|
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
var indexes = (_item$path$split = _item === null || _item === void 0 ? void 0 : (_item$path = _item.path) === null || _item$path === void 0 ? void 0 : _item$path.split('.')) !== null && _item$path$split !== void 0 ? _item$path$split : [];
|
144
|
+
const item = findByValue(flattenedData, event.target.value);
|
145
|
+
event.detail = sanitizeItem(item);
|
146
|
+
const indexes = (_item$path$split = item === null || item === void 0 ? void 0 : (_item$path = item.path) === null || _item$path === void 0 ? void 0 : _item$path.split('.')) !== null && _item$path$split !== void 0 ? _item$path$split : [];
|
161
147
|
|
162
148
|
if (indexes.length > 1) {
|
163
149
|
// we don't want to map the current item
|
164
150
|
indexes.pop(); // we need to rebuild the path as we map
|
165
151
|
|
166
|
-
|
167
|
-
event.detail.parents = indexes.map(
|
152
|
+
let lastPath;
|
153
|
+
event.detail.parents = indexes.map(i => {
|
168
154
|
lastPath = lastPath ? [lastPath, i].join('.') : i;
|
169
|
-
return sanitizeItem(flattenedData.find(
|
170
|
-
return i.path === lastPath;
|
171
|
-
}));
|
155
|
+
return sanitizeItem(flattenedData.find(i => i.path === lastPath));
|
172
156
|
});
|
173
157
|
}
|
174
158
|
|
@@ -176,44 +160,42 @@ var useSelect = function useSelect(_ref, ref) {
|
|
176
160
|
}
|
177
161
|
};
|
178
162
|
|
179
|
-
|
163
|
+
const button = {
|
180
164
|
'aria-haspopup': 'listbox',
|
181
|
-
'aria-label': ariaLabel ? ariaLabel
|
182
|
-
'aria-labelledby': ariaLabelledBy ? ariaLabelledBy
|
165
|
+
'aria-label': ariaLabel ? `${ariaLabel} ${text}` : undefined,
|
166
|
+
'aria-labelledby': ariaLabelledBy ? `${ariaLabelledBy} ${buttonId}` : undefined,
|
183
167
|
disabled: disabled || readOnly,
|
184
168
|
id: buttonId,
|
185
169
|
onKeyDown: !disabled && !readOnly ? handleButtonKeyDown : undefined,
|
186
170
|
type: 'button'
|
187
171
|
};
|
188
|
-
|
189
|
-
var listbox = _extends({}, otherProps, {
|
172
|
+
const listbox = { ...otherProps,
|
190
173
|
'aria-label': ariaLabel,
|
191
174
|
'aria-labelledby': ariaLabelledBy,
|
192
|
-
data
|
193
|
-
disabled
|
194
|
-
emptyValue
|
195
|
-
onBlur
|
175
|
+
data,
|
176
|
+
disabled,
|
177
|
+
emptyValue,
|
178
|
+
onBlur,
|
196
179
|
onClick: handleListboxClick,
|
197
|
-
onChange:
|
180
|
+
onChange: event => {
|
198
181
|
setInputValueByRef(inputRef.current, event.target.value);
|
199
182
|
},
|
200
183
|
onKeyDown: handleListboxKeyDown,
|
201
184
|
ref: listboxInputRef,
|
202
|
-
value
|
203
|
-
}
|
204
|
-
|
205
|
-
var input = {
|
185
|
+
value
|
186
|
+
};
|
187
|
+
const input = {
|
206
188
|
onChange: handleInputChange,
|
207
189
|
ref: inputRef,
|
208
190
|
value: String(value !== null && value !== void 0 ? value : '')
|
209
191
|
};
|
210
192
|
return {
|
211
|
-
button
|
212
|
-
listbox
|
213
|
-
input
|
193
|
+
button,
|
194
|
+
listbox,
|
195
|
+
input,
|
214
196
|
popover: {
|
215
|
-
open
|
216
|
-
onOpenChange:
|
197
|
+
open,
|
198
|
+
onOpenChange: open => {
|
217
199
|
if (!open && onBlur) {
|
218
200
|
onBlur(createCustomEvent('blur'));
|
219
201
|
}
|
@@ -221,8 +203,8 @@ var useSelect = function useSelect(_ref, ref) {
|
|
221
203
|
setOpen(open);
|
222
204
|
}
|
223
205
|
},
|
224
|
-
text
|
225
|
-
more
|
206
|
+
text,
|
207
|
+
more
|
226
208
|
};
|
227
209
|
};
|
228
210
|
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"useSelect.js","sources":["../../../../src/components/Select/useSelect.tsx"],"sourcesContent":["import * as React from 'react';\nimport keycode from 'keycode';\nimport cn from 'classnames';\nimport { v4 as uuid } from 'uuid';\nimport * as PopoverPrimitive from '@radix-ui/react-popover';\nimport { useLocalization } from '../Provider/Provider';\nimport { SelectProps } from './Select';\nimport { ListboxProps } from '../Listbox/Listbox';\nimport { useProxiedRef } from '../../utils/hooks/useProxiedRef';\nimport { setInputValueByRef, findByValue, useFlattenedData, sanitizeItem } from '../Listbox/util';\nimport { ScrollableListItemValue } from '../Listbox/ScrollableList';\nimport { createCustomEvent } from '../../utils/input';\n\ntype InternalButtonProps = React.ButtonHTMLAttributes<HTMLButtonElement>;\ntype InternalListboxProps = ListboxProps & { ref: React.ForwardedRef<HTMLInputElement> };\ntype InternalInputProps = React.InputHTMLAttributes<HTMLInputElement> & { ref: React.ForwardedRef<HTMLInputElement> };\n\ntype useSelect = React.HtmlHTMLAttributes<HTMLDivElement> & {\n button: InternalButtonProps;\n listbox: InternalListboxProps;\n input: InternalInputProps;\n popover: Pick<PopoverPrimitive.PopoverProps, 'onOpenChange' | 'open'>;\n text: string | JSX.Element;\n more?: number;\n};\n\nexport const useSelect = (\n {\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n data = [],\n defaultValue,\n disabled,\n emptyValue,\n id: nativeId,\n multiselect,\n onBlur,\n onClick,\n onChange,\n readOnly,\n value,\n ...otherProps\n }: SelectProps,\n ref: React.Ref<HTMLInputElement>\n): useSelect => {\n const { texts } = useLocalization();\n const flattenedData = useFlattenedData(data);\n const listboxInputRef = useProxiedRef<HTMLInputElement>(ref);\n const [open, setOpen] = React.useState(false);\n const id = React.useMemo(() => nativeId || `select_${uuid()}`, [nativeId]);\n const inputRef = React.useRef<HTMLInputElement>(null);\n const buttonId = `${id}-button`;\n // support 'escape' resetting to the value that was set when the listbox opened\n const [lastValue, setLastValue] = React.useState<ScrollableListItemValue | undefined>(value);\n\n React.useEffect(() => {\n setLastValue(value);\n }, [open]);\n\n React.useEffect(() => {\n if (value === undefined) {\n if (defaultValue !== undefined && findByValue(flattenedData, defaultValue)) {\n setInputValueByRef(inputRef.current, defaultValue);\n } else {\n if (emptyValue !== undefined) {\n setInputValueByRef(inputRef.current, emptyValue);\n } else if (data.length > 0) {\n setInputValueByRef(inputRef.current, data[0].value);\n }\n }\n } else {\n if (!multiselect && !findByValue(flattenedData, value)) {\n if (emptyValue !== undefined) {\n setInputValueByRef(inputRef.current, emptyValue);\n } else if (data.length > 0) {\n setInputValueByRef(inputRef.current, data[0].value);\n }\n }\n }\n }, []);\n\n // event handlers\n const handleButtonKeyDown = (event: React.KeyboardEvent<HTMLButtonElement>): void => {\n if (event.keyCode === keycode('up') || event.keyCode === keycode('down')) {\n event.preventDefault();\n setOpen(true);\n }\n };\n\n const handleListboxKeyDown = (event: React.KeyboardEvent<HTMLElement>): void => {\n switch (event.keyCode) {\n case keycode('escape'): {\n event.preventDefault();\n if (lastValue !== undefined) {\n setInputValueByRef(listboxInputRef.current, lastValue);\n }\n\n setOpen(false);\n break;\n }\n\n case keycode('tab'):\n case keycode('enter'): {\n if (event.keyCode !== keycode('tab')) {\n event.preventDefault();\n }\n setOpen(false);\n break;\n }\n\n default:\n }\n\n if (otherProps.onKeyDown) {\n otherProps.onKeyDown(event);\n }\n };\n\n const handleListboxClick = (event: React.MouseEvent<HTMLLIElement>): void => {\n event.preventDefault();\n if (!multiselect) {\n setOpen(false);\n if (onBlur) {\n onBlur(createCustomEvent('blur'));\n }\n }\n };\n\n let text: string | JSX.Element = '';\n let more = 0;\n\n if (value !== undefined) {\n if (multiselect) {\n const selectedValues = value?.toString().split(',') || [];\n\n if (selectedValues.length === flattenedData.filter(item => !item.disabled).length) {\n text = texts.select.allOptionsSelected;\n } else {\n text = findByValue(flattenedData, selectedValues[0])?.text ?? '';\n more = selectedValues.length > 1 ? selectedValues.length - 1 : 0;\n }\n } else {\n const item = findByValue(flattenedData, value);\n\n if (item) {\n text = item.icon ? (\n <>\n {React.cloneElement(item.icon, {\n className: cn(item.icon.props.className, 'mr-1 -mt-px'),\n })}\n {item.text}\n </>\n ) : (\n item.text\n );\n }\n }\n }\n\n const handleInputChange = (event: React.ChangeEvent<HTMLInputElement>): void => {\n event.persist();\n\n if (onChange) {\n const item = findByValue(flattenedData, event.target.value);\n (event as any).detail = sanitizeItem(item);\n\n const indexes = item?.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 (event as any).detail.parents = indexes.map(i => {\n lastPath = lastPath ? [lastPath, i].join('.') : i;\n return sanitizeItem(flattenedData.find(i => i.path === lastPath));\n });\n }\n\n onChange(event);\n }\n };\n\n const button: InternalButtonProps = {\n 'aria-haspopup': 'listbox' as const,\n 'aria-label': ariaLabel ? `${ariaLabel} ${text}` : undefined,\n 'aria-labelledby': ariaLabelledBy ? `${ariaLabelledBy} ${buttonId}` : undefined,\n disabled: disabled || readOnly,\n id: buttonId,\n onKeyDown: !disabled && !readOnly ? handleButtonKeyDown : undefined,\n type: 'button',\n };\n\n const listbox: InternalListboxProps = {\n ...otherProps,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n data,\n disabled,\n emptyValue,\n onBlur,\n onClick: handleListboxClick,\n onChange: event => {\n setInputValueByRef(inputRef.current, event.target.value);\n },\n onKeyDown: handleListboxKeyDown,\n ref: listboxInputRef,\n value,\n };\n\n const input: InternalInputProps = {\n onChange: handleInputChange,\n ref: inputRef,\n value: String(value ?? ''),\n };\n\n return {\n button,\n listbox,\n input,\n popover: {\n open,\n onOpenChange: open => {\n if (!open && onBlur) {\n onBlur(createCustomEvent('blur'));\n }\n setOpen(open);\n },\n },\n text,\n more,\n };\n};\n"],"names":["useSelect","ref","ariaLabel","ariaLabelledBy","data","defaultValue","disabled","emptyValue","nativeId","id","multiselect","onBlur","onChange","readOnly","value","otherProps","useLocalization","texts","flattenedData","useFlattenedData","listboxInputRef","useProxiedRef","React","open","setOpen","uuid","inputRef","buttonId","lastValue","setLastValue","undefined","findByValue","setInputValueByRef","current","length","handleButtonKeyDown","event","keyCode","keycode","preventDefault","handleListboxKeyDown","onKeyDown","handleListboxClick","createCustomEvent","text","more","selectedValues","toString","split","filter","item","select","allOptionsSelected","icon","className","cn","props","handleInputChange","persist","target","detail","sanitizeItem","indexes","path","pop","lastPath","parents","map","i","join","find","button","type","listbox","onClick","input","String","popover","onOpenChange"],"mappings":";;;;;;;;;;;IA0BaA,SAAS,GAAG,SAAZA,SAAY,OAiBrBC,GAjBqB;MAEHC,iBAAd;MACmBC,sBAAnB;uBACAC;MAAAA,8BAAO;MACPC,oBAAAA;MACAC,gBAAAA;MACAC,kBAAAA;MACIC,gBAAJC;MACAC,mBAAAA;MACAC,cAAAA;MAEAC,gBAAAA;MACAC,gBAAAA;MACAC,aAAAA;MACGC;;AAIP,yBAAkBC,eAAe,EAAjC;AAAA,MAAQC,KAAR,oBAAQA,KAAR;;AACA,MAAMC,aAAa,GAAGC,gBAAgB,CAACf,IAAD,CAAtC;AACA,MAAMgB,eAAe,GAAGC,aAAa,CAAmBpB,GAAnB,CAArC;;AACA,wBAAwBqB,QAAA,CAAe,KAAf,CAAxB;AAAA,MAAOC,IAAP;AAAA,MAAaC,OAAb;;AACA,MAAMf,EAAE,GAAGa,OAAA,CAAc;AAAA,WAAMd,QAAQ,gBAAciB,EAAI,EAAhC;AAAA,GAAd,EAAoD,CAACjB,QAAD,CAApD,CAAX;AACA,MAAMkB,QAAQ,GAAGJ,MAAA,CAA+B,IAA/B,CAAjB;AACA,MAAMK,QAAQ,GAAMlB,EAAN,YAAd;;AAEA,yBAAkCa,QAAA,CAAoDR,KAApD,CAAlC;AAAA,MAAOc,SAAP;AAAA,MAAkBC,Y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sx"],"sourcesContent":["import * as React from 'react';\r\nimport keycode from 'keycode';\r\nimport cn from 'classnames';\r\nimport { v4 as uuid } from 'uuid';\r\nimport * as PopoverPrimitive from '@radix-ui/react-popover';\r\nimport { useLocalization } from '../Provider/Provider';\r\nimport { SelectProps } from './Select';\r\nimport { ListboxProps } from '../Listbox/Listbox';\r\nimport { useProxiedRef } from '../../utils/hooks/useProxiedRef';\r\nimport { setInputValueByRef, findByValue, useFlattenedData, sanitizeItem } from '../Listbox/util';\r\nimport { ScrollableListItemValue } from '../Listbox/ScrollableList';\r\nimport { createCustomEvent } from '../../utils/input';\r\n\r\ntype InternalButtonProps = React.ButtonHTMLAttributes<HTMLButtonElement>;\r\ntype InternalListboxProps = ListboxProps & { ref: React.ForwardedRef<HTMLInputElement> };\r\ntype InternalInputProps = React.InputHTMLAttributes<HTMLInputElement> & { ref: React.ForwardedRef<HTMLInputElement> };\r\n\r\ntype useSelect = React.HtmlHTMLAttributes<HTMLDivElement> & {\r\n button: InternalButtonProps;\r\n listbox: InternalListboxProps;\r\n input: InternalInputProps;\r\n popover: Pick<PopoverPrimitive.PopoverProps, 'onOpenChange' | 'open'>;\r\n text: string | JSX.Element;\r\n more?: number;\r\n};\r\n\r\nexport const useSelect = (\r\n {\r\n 'aria-label': ariaLabel,\r\n 'aria-labelledby': ariaLabelledBy,\r\n data = [],\r\n defaultValue,\r\n disabled,\r\n emptyValue,\r\n id: nativeId,\r\n multiselect,\r\n onBlur,\r\n onClick,\r\n onChange,\r\n readOnly,\r\n value,\r\n ...otherProps\r\n }: SelectProps,\r\n ref: React.Ref<HTMLInputElement>\r\n): useSelect => {\r\n const { texts } = useLocalization();\r\n const flattenedData = useFlattenedData(data);\r\n const listboxInputRef = useProxiedRef<HTMLInputElement>(ref);\r\n const [open, setOpen] = React.useState(false);\r\n const id = React.useMemo(() => nativeId || `select_${uuid()}`, [nativeId]);\r\n const inputRef = React.useRef<HTMLInputElement>(null);\r\n const buttonId = `${id}-button`;\r\n // support 'escape' resetting to the value that was set when the listbox opened\r\n const [lastValue, setLastValue] = React.useState<ScrollableListItemValue | undefined>(value);\r\n\r\n React.useEffect(() => {\r\n setLastValue(value);\r\n }, [open]);\r\n\r\n React.useEffect(() => {\r\n if (value === undefined) {\r\n if (defaultValue !== undefined && findByValue(flattenedData, defaultValue)) {\r\n setInputValueByRef(inputRef.current, defaultValue);\r\n } else {\r\n if (emptyValue !== undefined) {\r\n setInputValueByRef(inputRef.current, emptyValue);\r\n } else if (data.length > 0) {\r\n setInputValueByRef(inputRef.current, data[0].value);\r\n }\r\n }\r\n } else {\r\n if (!multiselect && !findByValue(flattenedData, value)) {\r\n if (emptyValue !== undefined) {\r\n setInputValueByRef(inputRef.current, emptyValue);\r\n } else if (data.length > 0) {\r\n setInputValueByRef(inputRef.current, data[0].value);\r\n }\r\n }\r\n }\r\n }, []);\r\n\r\n // event handlers\r\n const handleButtonKeyDown = (event: React.KeyboardEvent<HTMLButtonElement>): void => {\r\n if (event.keyCode === keycode('up') || event.keyCode === keycode('down')) {\r\n event.preventDefault();\r\n setOpen(true);\r\n }\r\n };\r\n\r\n const handleListboxKeyDown = (event: React.KeyboardEvent<HTMLElement>): void => {\r\n switch (event.keyCode) {\r\n case keycode('escape'): {\r\n event.preventDefault();\r\n if (lastValue !== undefined) {\r\n setInputValueByRef(listboxInputRef.current, lastValue);\r\n }\r\n\r\n setOpen(false);\r\n break;\r\n }\r\n\r\n case keycode('tab'):\r\n case keycode('enter'): {\r\n if (event.keyCode !== keycode('tab')) {\r\n event.preventDefault();\r\n }\r\n setOpen(false);\r\n break;\r\n }\r\n\r\n default:\r\n }\r\n\r\n if (otherProps.onKeyDown) {\r\n otherProps.onKeyDown(event);\r\n }\r\n };\r\n\r\n const handleListboxClick = (event: React.MouseEvent<HTMLLIElement>): void => {\r\n event.preventDefault();\r\n if (!multiselect) {\r\n setOpen(false);\r\n if (onBlur) {\r\n onBlur(createCustomEvent('blur'));\r\n }\r\n }\r\n };\r\n\r\n let text: string | JSX.Element = '';\r\n let more = 0;\r\n\r\n if (value !== undefined) {\r\n if (multiselect) {\r\n const selectedValues = value?.toString().split(',') || [];\r\n\r\n if (selectedValues.length === flattenedData.filter(item => !item.disabled).length) {\r\n text = texts.select.allOptionsSelected;\r\n } else {\r\n text = findByValue(flattenedData, selectedValues[0])?.text ?? '';\r\n more = selectedValues.length > 1 ? selectedValues.length - 1 : 0;\r\n }\r\n } else {\r\n const item = findByValue(flattenedData, value);\r\n\r\n if (item) {\r\n text = item.icon ? (\r\n <>\r\n {React.cloneElement(item.icon, {\r\n className: cn(item.icon.props.className, 'mr-1 -mt-px'),\r\n })}\r\n {item.text}\r\n </>\r\n ) : (\r\n item.text\r\n );\r\n }\r\n }\r\n }\r\n\r\n const handleInputChange = (event: React.ChangeEvent<HTMLInputElement>): void => {\r\n event.persist();\r\n\r\n if (onChange) {\r\n const item = findByValue(flattenedData, event.target.value);\r\n (event as any).detail = sanitizeItem(item);\r\n\r\n const indexes = item?.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 (event as any).detail.parents = indexes.map(i => {\r\n lastPath = lastPath ? [lastPath, i].join('.') : i;\r\n return sanitizeItem(flattenedData.find(i => i.path === lastPath));\r\n });\r\n }\r\n\r\n onChange(event);\r\n }\r\n };\r\n\r\n const button: InternalButtonProps = {\r\n 'aria-haspopup': 'listbox' as const,\r\n 'aria-label': ariaLabel ? `${ariaLabel} ${text}` : undefined,\r\n 'aria-labelledby': ariaLabelledBy ? `${ariaLabelledBy} ${buttonId}` : undefined,\r\n disabled: disabled || readOnly,\r\n id: buttonId,\r\n onKeyDown: !disabled && !readOnly ? handleButtonKeyDown : undefined,\r\n type: 'button',\r\n };\r\n\r\n const listbox: InternalListboxProps = {\r\n ...otherProps,\r\n 'aria-label': ariaLabel,\r\n 'aria-labelledby': ariaLabelledBy,\r\n data,\r\n disabled,\r\n emptyValue,\r\n onBlur,\r\n onClick: handleListboxClick,\r\n onChange: event => {\r\n setInputValueByRef(inputRef.current, event.target.value);\r\n },\r\n onKeyDown: handleListboxKeyDown,\r\n ref: listboxInputRef,\r\n value,\r\n };\r\n\r\n const input: InternalInputProps = {\r\n onChange: handleInputChange,\r\n ref: inputRef,\r\n value: String(value ?? ''),\r\n };\r\n\r\n return {\r\n button,\r\n listbox,\r\n input,\r\n popover: {\r\n open,\r\n onOpenChange: open => {\r\n if (!open && onBlur) {\r\n onBlur(createCustomEvent('blur'));\r\n }\r\n setOpen(open);\r\n },\r\n },\r\n text,\r\n more,\r\n };\r\n};\r\n"],"names":["useSelect","ariaLabel","ariaLabelledBy","data","defaultValue","disabled","emptyValue","id","nativeId","multiselect","onBlur","onClick","onChange","readOnly","value","otherProps","ref","texts","useLocalization","flattenedData","useFlattenedData","listboxInputRef","useProxiedRef","open","setOpen","React","uuid","inputRef","buttonId","lastValue","setLastValue","undefined","findByValue","setInputValueByRef","current","length","handleButtonKeyDown","event","keyCode","keycode","preventDefault","handleListboxKeyDown","onKeyDown","handleListboxClick","createCustomEvent","text","more","selectedValues","toString","split","filter","item","select","allOptionsSelected","icon","className","cn","props","handleInputChange","persist","target","detail","sanitizeItem","indexes","path","pop","lastPath","parents","map","i","join","find","button","type","listbox","input","String","popover","onOpenChange"],"mappings":";;;;;;;;;MA0BaA,SAAS,GAAG,CACrB;AACI,gBAAcC,SADlB;AAEI,qBAAmBC,cAFvB;AAGIC,EAAAA,IAAI,GAAG,EAHX;AAIIC,EAAAA,YAJJ;AAKIC,EAAAA,QALJ;AAMIC,EAAAA,UANJ;AAOIC,EAAAA,EAAE,EAAEC,QAPR;AAQIC,EAAAA,WARJ;AASIC,EAAAA,MATJ;AAUIC,EAAAA,OAVJ;AAWIC,EAAAA,QAXJ;AAYIC,EAAAA,QAZJ;AAaIC,EAAAA,KAbJ;AAcI,KAAGC;AAdP,CADqB,EAiBrBC,GAjBqB;AAmBrB,QAAM;AAAE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C,MAAD,CAAlB,CAAN;AACH;;AACDpB,QAAAA,OAAO,CAACD,IAAD,CAAP;AACH;AAPI,KAJN;AAaHsB,IAAAA,IAbG;AAcHC,IAAAA;AAdG,GAAP;AAgBH;;;;"}
|
@@ -1,28 +1,21 @@
|
|
1
|
-
import { objectWithoutPropertiesLoose as _objectWithoutPropertiesLoose } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
2
1
|
import React__default from 'react';
|
3
2
|
import cn from 'classnames';
|
4
3
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
setVisibility = _React$useState[1];
|
15
|
-
|
16
|
-
React__default.useEffect(function () {
|
17
|
-
var timeout;
|
4
|
+
const Spinner = /*#__PURE__*/React__default.forwardRef(function Spinner(props, ref) {
|
5
|
+
const {
|
6
|
+
delay = 500,
|
7
|
+
label,
|
8
|
+
...otherProps
|
9
|
+
} = props;
|
10
|
+
const [visible, setVisibility] = React__default.useState(!delay);
|
11
|
+
React__default.useEffect(() => {
|
12
|
+
let timeout;
|
18
13
|
|
19
14
|
if (delay) {
|
20
|
-
timeout = window.setTimeout(
|
21
|
-
return setVisibility(true);
|
22
|
-
}, delay);
|
15
|
+
timeout = window.setTimeout(() => setVisibility(true), delay);
|
23
16
|
}
|
24
17
|
|
25
|
-
return
|
18
|
+
return () => {
|
26
19
|
if (timeout) {
|
27
20
|
clearTimeout(timeout);
|
28
21
|
}
|
@@ -33,7 +26,7 @@ var Spinner = /*#__PURE__*/React__default.forwardRef(function Spinner(props, ref
|
|
33
26
|
return null;
|
34
27
|
}
|
35
28
|
|
36
|
-
|
29
|
+
const className = cn('inline-flex flex-col relative items-center', otherProps.className);
|
37
30
|
return React__default.createElement("div", Object.assign({}, otherProps, {
|
38
31
|
className: className,
|
39
32
|
"data-taco": "spinner",
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Spinner.js","sources":["../../../../src/components/Spinner/Spinner.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'classnames';\nimport './Spinner.css';\n\nexport type SpinnerProps = React.HTMLAttributes<HTMLDivElement> & {\n /**\n * Define a delay in milliseconds after which the spinner is shown.\n * Default value is `500`ms\n */\n delay?: number;\n /** Define a text that will be displayed below spinner */\n label?: string;\n};\n\nexport const Spinner = React.forwardRef(function Spinner(props: SpinnerProps, ref: React.Ref<HTMLDivElement>) {\n const { delay = 500, label, ...otherProps } = props;\n const [visible, setVisibility] = React.useState(!delay);\n\n React.useEffect(() => {\n let timeout: number;\n\n if (delay) {\n timeout = window.setTimeout(() => setVisibility(true), delay);\n }\n\n return () => {\n if (timeout) {\n clearTimeout(timeout);\n }\n };\n }, [delay]);\n\n if (!visible) {\n return null;\n }\n\n const className = cn('inline-flex flex-col relative items-center', otherProps.className);\n\n return (\n <div {...otherProps} className={className} data-taco=\"spinner\" ref={ref}>\n <svg\n className=\"h-10 w-10 animate-[spinnerRotation_2s_linear_infinite]\"\n viewBox=\"0 0 100 100\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <circle cx=\"50\" cy=\"50\" r=\"45\"></circle>\n </svg>\n {label && <span className=\"mt-4\">{label}</span>}\n </div>\n );\n});\n"],"names":["Spinner","React","forwardRef","props","ref","delay","label","otherProps","
|
1
|
+
{"version":3,"file":"Spinner.js","sources":["../../../../src/components/Spinner/Spinner.tsx"],"sourcesContent":["import React from 'react';\r\nimport cn from 'classnames';\r\nimport './Spinner.css';\r\n\r\nexport type SpinnerProps = React.HTMLAttributes<HTMLDivElement> & {\r\n /**\r\n * Define a delay in milliseconds after which the spinner is shown.\r\n * Default value is `500`ms\r\n */\r\n delay?: number;\r\n /** Define a text that will be displayed below spinner */\r\n label?: string;\r\n};\r\n\r\nexport const Spinner = React.forwardRef(function Spinner(props: SpinnerProps, ref: React.Ref<HTMLDivElement>) {\r\n const { delay = 500, label, ...otherProps } = props;\r\n const [visible, setVisibility] = React.useState(!delay);\r\n\r\n React.useEffect(() => {\r\n let timeout: number;\r\n\r\n if (delay) {\r\n timeout = window.setTimeout(() => setVisibility(true), delay);\r\n }\r\n\r\n return () => {\r\n if (timeout) {\r\n clearTimeout(timeout);\r\n }\r\n };\r\n }, [delay]);\r\n\r\n if (!visible) {\r\n return null;\r\n }\r\n\r\n const className = cn('inline-flex flex-col relative items-center', otherProps.className);\r\n\r\n return (\r\n <div {...otherProps} className={className} data-taco=\"spinner\" ref={ref}>\r\n <svg\r\n className=\"h-10 w-10 animate-[spinnerRotation_2s_linear_infinite]\"\r\n viewBox=\"0 0 100 100\"\r\n xmlns=\"http://www.w3.org/2000/svg\"\r\n >\r\n <circle cx=\"50\" cy=\"50\" r=\"45\"></circle>\r\n </svg>\r\n {label && <span className=\"mt-4\">{label}</span>}\r\n </div>\r\n );\r\n});\r\n"],"names":["Spinner","React","forwardRef","props","ref","delay","label","otherProps","visible","setVisibility","useState","useEffect","timeout","window","setTimeout","clearTimeout","className","cn","viewBox","xmlns","cx","cy","r"],"mappings":";;;MAcaA,OAAO,gBAAGC,cAAK,CAACC,UAAN,CAAiB,SAASF,OAAT,CAAiBG,KAAjB,EAAsCC,GAAtC;AACpC,QAAM;AAAEC,IAAAA,KAAK,GAAG,GAAV;AAAeC,IAAAA,KAAf;AAAsB,OAAGC;AAAzB,MAAwCJ,KAA9C;AACA,QAAM,CAACK,OAAD,EAAUC,aAAV,IAA2BR,cAAK,CAACS,QAAN,CAAe,CAACL,KAAhB,CAAjC;AAEAJ,EAAAA,cAAK,CAACU,SAAN,CAAgB;AACZ,QAAIC,OAAJ;;AAEA,QAAIP,KAAJ,EAAW;AACPO,MAAAA,OAAO,GAAGC,MAAM,CAACC,UAAP,CAAkB,MAAML,aAAa,CAAC,IAAD,CAArC,EAA6CJ,KAA7C,CAAV;AACH;;AAED,WAAO;AACH,UAAIO,OAAJ,EAAa;AACTG,QAAAA,YAAY,CAACH,OAAD,CAAZ;AACH;AACJ,KAJD;AAKH,GAZD,EAYG,CAACP,KAAD,C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