@react-md/core 1.0.0-next.1 → 1.0.0-next.11
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/.stylelintrc.json +14 -0
- package/.turbo/turbo-build.log +11 -7
- package/.turbo/turbo-typecheck.log +4 -4
- package/CHANGELOG.md +183 -0
- package/README.md +39 -24
- package/coverage/clover.xml +2 -2
- package/coverage/lcov-report/AutoComplete.tsx.html +283 -0
- package/coverage/lcov-report/Avatar.tsx.html +472 -0
- package/coverage/lcov-report/DefaultToastRenderer.tsx.html +166 -112
- package/coverage/lcov-report/IconRotator.tsx.html +322 -0
- package/coverage/lcov-report/ListItem.tsx.html +892 -0
- package/coverage/lcov-report/ListItemLink.tsx.html +616 -0
- package/coverage/lcov-report/MenuItemCheckbox.tsx.html +223 -0
- package/coverage/lcov-report/MenuItemInputToggle.tsx.html +178 -232
- package/coverage/lcov-report/MenuItemRadio.tsx.html +436 -0
- package/coverage/lcov-report/Portal.tsx.html +223 -0
- package/coverage/lcov-report/PortalContainerProvider.tsx.html +367 -0
- package/coverage/lcov-report/RootHtml.tsx.html +370 -0
- package/coverage/lcov-report/Select.tsx.html +1411 -0
- package/coverage/lcov-report/SkeletonPlaceholder.tsx.html +613 -0
- package/coverage/lcov-report/Snackbar.tsx.html +360 -402
- package/coverage/lcov-report/SrOnly.tsx.html +328 -0
- package/coverage/lcov-report/Tab.tsx.html +261 -147
- package/coverage/lcov-report/Toast.tsx.html +868 -0
- package/coverage/lcov-report/ToastManager.tsx.html +1783 -0
- package/coverage/lcov-report/ToastManagerProvider.tsx.html +216 -216
- package/coverage/lcov-report/TreeGroup.tsx.html +313 -0
- package/coverage/lcov-report/Typography.tsx.html +1027 -0
- package/coverage/lcov-report/app-bar/AppBar.tsx.html +178 -28
- package/coverage/lcov-report/app-bar/index.html +7 -7
- package/coverage/lcov-report/autocomplete/AutoComplete.tsx.html +283 -0
- package/coverage/lcov-report/autocomplete/Autocomplete.tsx.html +475 -0
- package/coverage/lcov-report/autocomplete/AutocompleteGeneric.tsx.html +304 -0
- package/coverage/lcov-report/autocomplete/index.html +221 -0
- package/coverage/lcov-report/autocomplete/useAutoComplete.ts.html +775 -0
- package/coverage/lcov-report/autocomplete/useAutocomplete.ts.html +1273 -0
- package/coverage/lcov-report/autocomplete/useAutocompleteAgain.ts.html +829 -0
- package/coverage/lcov-report/autocomplete/useAutocompletev2.ts.html +715 -0
- package/coverage/lcov-report/autocomplete/useInlineAutoComplete.ts.html +340 -0
- package/coverage/lcov-report/autocomplete/useInlineAutocomplete.ts.html +430 -0
- package/coverage/lcov-report/autocomplete/useInlineSelection.ts.html +310 -0
- package/coverage/lcov-report/autocomplete/utils.ts.html +196 -0
- package/coverage/lcov-report/avatar/Avatar.tsx.html +162 -99
- package/coverage/lcov-report/avatar/index.html +19 -34
- package/coverage/lcov-report/avatar/styles.ts.html +1 -1
- package/coverage/lcov-report/button/Button.tsx.html +85 -85
- package/coverage/lcov-report/button/TooltippedButton.tsx.html +445 -0
- package/coverage/lcov-report/button/index.html +12 -12
- package/coverage/lcov-report/card/Card.tsx.html +349 -0
- package/coverage/lcov-report/card/CardContent.tsx.html +223 -0
- package/coverage/lcov-report/card/ClickableCard.tsx.html +400 -0
- package/coverage/lcov-report/card/index.html +21 -21
- package/coverage/lcov-report/card/styles.ts.html +428 -392
- package/coverage/lcov-report/cssUtils.ts.html +86 -59
- package/coverage/lcov-report/dialog/DialogFooter.tsx.html +36 -36
- package/coverage/lcov-report/dialog/DialogHeader.tsx.html +26 -26
- package/coverage/lcov-report/dialog/index.html +34 -19
- package/coverage/lcov-report/draggable/index.html +21 -36
- package/coverage/lcov-report/draggable/useDraggable.ts.html +377 -368
- package/coverage/lcov-report/draggable/utils.ts.html +96 -195
- package/coverage/lcov-report/expansion-panel/ExpansionList.tsx.html +211 -0
- package/coverage/lcov-report/expansion-panel/ExpansionPanel.tsx.html +12 -15
- package/coverage/lcov-report/expansion-panel/index.html +34 -19
- package/coverage/lcov-report/expansion-panel/useExpansionPanels.ts.html +928 -0
- package/coverage/lcov-report/form/AutoComplete.tsx.html +283 -0
- package/coverage/lcov-report/form/Form.tsx.html +22 -22
- package/coverage/lcov-report/form/Label.tsx.html +442 -0
- package/coverage/lcov-report/form/MenuItemInputToggle.tsx.html +2 -2
- package/coverage/lcov-report/form/OptGroup.tsx.html +169 -166
- package/coverage/lcov-report/form/Option.tsx.html +727 -0
- package/coverage/lcov-report/form/ResizingTextArea.tsx.html +442 -0
- package/coverage/lcov-report/form/ResizingTextAreaWrapper.tsx.html +310 -0
- package/coverage/lcov-report/form/Select.tsx.html +1456 -0
- package/coverage/lcov-report/form/SelectOriginal.tsx.html +1630 -0
- package/coverage/lcov-report/form/SelectV2.tsx.html +1024 -0
- package/coverage/lcov-report/form/SelectedOption.tsx.html +250 -0
- package/coverage/lcov-report/form/SimpleTextArea.tsx.html +727 -0
- package/coverage/lcov-report/form/Slider.tsx.html +163 -40
- package/coverage/lcov-report/form/TextArea.tsx.html +596 -740
- package/coverage/lcov-report/form/TextArea2.tsx.html +985 -0
- package/coverage/lcov-report/form/TextAreaBackup.tsx.html +1006 -0
- package/coverage/lcov-report/form/TextField.tsx.html +156 -234
- package/coverage/lcov-report/form/index.html +111 -21
- package/coverage/lcov-report/form/selectUtils.ts.html +188 -221
- package/coverage/lcov-report/form/textAreaStyles.ts.html +8 -11
- package/coverage/lcov-report/form/useAutoComplete.ts.html +787 -0
- package/coverage/lcov-report/form/useCombobox.ts.html +454 -460
- package/coverage/lcov-report/form/useComboboxList.ts.html +108 -93
- package/coverage/lcov-report/form/useFormReset.ts.html +229 -0
- package/coverage/lcov-report/form/useInlineAutoComplete.ts.html +379 -0
- package/coverage/lcov-report/form/useResizingTextArea.ts.html +631 -0
- package/coverage/lcov-report/form/useResizingTextArea2.ts.html +631 -0
- package/coverage/lcov-report/form/useSelectCombobox.ts.html +499 -0
- package/coverage/lcov-report/form/utils.ts.html +209 -170
- package/coverage/lcov-report/getListItemHeight.ts.html +298 -0
- package/coverage/lcov-report/icon/FontIcon.tsx.html +64 -64
- package/coverage/lcov-report/icon/MaterialIcon.tsx.html +235 -0
- package/coverage/lcov-report/icon/index.html +19 -19
- package/coverage/lcov-report/index.html +1 -1
- package/coverage/lcov-report/interaction/UserInteractionModeProvider.tsx.html +679 -0
- package/coverage/lcov-report/interaction/config.ts.html +181 -0
- package/coverage/lcov-report/interaction/index.html +33 -18
- package/coverage/lcov-report/list/List.tsx.html +490 -0
- package/coverage/lcov-report/list/ListItem.tsx.html +886 -0
- package/coverage/lcov-report/list/ListItemAddon.tsx.html +286 -0
- package/coverage/lcov-report/list/ListItemChildren.tsx.html +445 -0
- package/coverage/lcov-report/list/ListItemLink.tsx.html +5 -5
- package/coverage/lcov-report/list/index.html +81 -6
- package/coverage/lcov-report/list/listItemStyles.ts.html +703 -0
- package/coverage/lcov-report/media-queries/appSize.ts.html +1 -1
- package/coverage/lcov-report/media-queries/index.html +1 -1
- package/coverage/lcov-report/menu/DropdownMenu.tsx.html +188 -188
- package/coverage/lcov-report/menu/Menu.tsx.html +276 -252
- package/coverage/lcov-report/menu/MenuItem.tsx.html +292 -0
- package/coverage/lcov-report/menu/MenuItemCircularProgress.tsx.html +433 -0
- package/coverage/lcov-report/menu/MenuVisibilityProvider.tsx.html +48 -33
- package/coverage/lcov-report/menu/index.html +14 -44
- package/coverage/lcov-report/menu/useContextMenu.ts.html +490 -0
- package/coverage/lcov-report/menuItemInputToggleStyles.ts.html +319 -0
- package/coverage/lcov-report/movement/index.html +19 -19
- package/coverage/lcov-report/movement/useKeyboardMovementProvider.ts.html +422 -383
- package/coverage/lcov-report/positioning/constants.ts.html +463 -0
- package/coverage/lcov-report/positioning/index.html +30 -30
- package/coverage/lcov-report/positioning/useFixedPositioning.ts.html +1321 -0
- package/coverage/lcov-report/progress/CircularProgress.tsx.html +184 -184
- package/coverage/lcov-report/progress/index.html +19 -34
- package/coverage/lcov-report/searching/caseInsensitive.ts.html +685 -0
- package/coverage/lcov-report/searching/fuzzy.ts.html +610 -0
- package/coverage/lcov-report/searching/index.html +146 -0
- package/coverage/lcov-report/searching/toSearchQuery.ts.html +145 -0
- package/coverage/lcov-report/searching/useFuzzyMatch.ts.html +211 -0
- package/coverage/lcov-report/searching/utils.ts.html +244 -0
- package/coverage/lcov-report/sheet/index.html +8 -8
- package/coverage/lcov-report/sheet/styles.ts.html +376 -0
- package/coverage/lcov-report/skeletonPlaceholderUtils.ts.html +400 -0
- package/coverage/lcov-report/snackbar/Snackbar.tsx.html +55 -97
- package/coverage/lcov-report/snackbar/Toast.tsx.html +546 -501
- package/coverage/lcov-report/snackbar/ToastManager.tsx.html +269 -269
- package/coverage/lcov-report/snackbar/ToastManagerProvider.tsx.html +23 -23
- package/coverage/lcov-report/snackbar/index.html +59 -14
- package/coverage/lcov-report/snackbar/snackbarStyles.ts.html +12 -87
- package/coverage/lcov-report/snackbar/toastStyles.ts.html +206 -146
- package/coverage/lcov-report/snackbar/useCurrentToastActions.ts.html +226 -0
- package/coverage/lcov-report/snackbarStyles.ts.html +46 -121
- package/coverage/lcov-report/src/CoreProviders.tsx.html +20 -20
- package/coverage/lcov-report/src/NoSsr.tsx.html +1 -1
- package/coverage/lcov-report/src/RootHtml.tsx.html +370 -0
- package/coverage/lcov-report/src/SsrProvider.tsx.html +10 -10
- package/coverage/lcov-report/src/app-bar/AppBar.tsx.html +143 -23
- package/coverage/lcov-report/src/app-bar/AppBarTitle.tsx.html +1 -1
- package/coverage/lcov-report/src/app-bar/index.html +5 -5
- package/coverage/lcov-report/src/autocomplete/Autocomplete.tsx.html +364 -0
- package/coverage/lcov-report/src/autocomplete/AutocompleteGeneric.tsx.html +304 -0
- package/coverage/lcov-report/src/autocomplete/index.html +221 -0
- package/coverage/lcov-report/src/autocomplete/useAutocomplete.ts.html +637 -0
- package/coverage/lcov-report/src/autocomplete/useAutocompleteAgain.ts.html +829 -0
- package/coverage/lcov-report/src/autocomplete/useAutocompletev2.ts.html +715 -0
- package/coverage/lcov-report/src/autocomplete/useInlineAutocomplete.ts.html +430 -0
- package/coverage/lcov-report/src/autocomplete/useInlineSelection.ts.html +241 -0
- package/coverage/lcov-report/src/autocomplete/utils.ts.html +196 -0
- package/coverage/lcov-report/src/avatar/Avatar.tsx.html +2 -2
- package/coverage/lcov-report/src/avatar/index.html +1 -1
- package/coverage/lcov-report/src/avatar/styles.ts.html +1 -1
- package/coverage/lcov-report/src/badge/Badge.tsx.html +1 -1
- package/coverage/lcov-report/src/badge/index.html +1 -1
- package/coverage/lcov-report/src/box/Box.tsx.html +1 -1
- package/coverage/lcov-report/src/box/index.html +23 -8
- package/coverage/lcov-report/src/box/styles.ts.html +46 -46
- package/coverage/lcov-report/src/button/AsyncButton.tsx.html +1 -1
- package/coverage/lcov-report/src/button/Button.tsx.html +87 -87
- package/coverage/lcov-report/src/button/ButtonUnstyled.tsx.html +1 -1
- package/coverage/lcov-report/src/button/FloatingActionButton.tsx.html +11 -11
- package/coverage/lcov-report/src/button/TooltippedButton.tsx.html +445 -0
- package/coverage/lcov-report/src/button/buttonStyles.ts.html +52 -52
- package/coverage/lcov-report/src/button/buttonUnstyledStyles.ts.html +1 -1
- package/coverage/lcov-report/src/button/index.html +8 -23
- package/coverage/lcov-report/src/card/Card.tsx.html +37 -31
- package/coverage/lcov-report/src/card/CardContent.tsx.html +4 -4
- package/coverage/lcov-report/src/card/CardFooter.tsx.html +1 -1
- package/coverage/lcov-report/src/card/CardHeader.tsx.html +1 -1
- package/coverage/lcov-report/src/card/CardSubtitle.tsx.html +1 -1
- package/coverage/lcov-report/src/card/CardTitle.tsx.html +1 -1
- package/coverage/lcov-report/src/card/ClickableCard.tsx.html +400 -0
- package/coverage/lcov-report/src/card/index.html +24 -9
- package/coverage/lcov-report/src/card/styles.ts.html +58 -31
- package/coverage/lcov-report/src/chip/Chip.tsx.html +1 -1
- package/coverage/lcov-report/src/chip/index.html +7 -7
- package/coverage/lcov-report/src/chip/styles.ts.html +9 -12
- package/coverage/lcov-report/src/cssUtils.ts.html +53 -53
- package/coverage/lcov-report/src/delegateEvent.ts.html +109 -109
- package/coverage/lcov-report/src/dialog/Dialog.tsx.html +1 -1
- package/coverage/lcov-report/src/dialog/DialogContainer.tsx.html +1 -1
- package/coverage/lcov-report/src/dialog/DialogContent.tsx.html +1 -1
- package/coverage/lcov-report/src/dialog/DialogFooter.tsx.html +1 -1
- package/coverage/lcov-report/src/dialog/DialogHeader.tsx.html +1 -1
- package/coverage/lcov-report/src/dialog/DialogTitle.tsx.html +1 -1
- package/coverage/lcov-report/src/dialog/FixedDialog.tsx.html +1 -1
- package/coverage/lcov-report/src/dialog/NestedDialogProvider.ts.html +1 -1
- package/coverage/lcov-report/src/dialog/index.html +129 -9
- package/coverage/lcov-report/src/dialog/styles.ts.html +1 -1
- package/coverage/lcov-report/src/divider/Divider.tsx.html +4 -7
- package/coverage/lcov-report/src/divider/index.html +5 -5
- package/coverage/lcov-report/src/divider/styles.ts.html +1 -1
- package/coverage/lcov-report/src/draggable/index.html +27 -27
- package/coverage/lcov-report/src/draggable/useDraggable.ts.html +47 -44
- package/coverage/lcov-report/src/draggable/utils.ts.html +29 -131
- package/coverage/lcov-report/src/expansion-panel/ExpansionList.tsx.html +1 -1
- package/coverage/lcov-report/src/expansion-panel/ExpansionPanel.tsx.html +1 -1
- package/coverage/lcov-report/src/expansion-panel/ExpansionPanelHeader.tsx.html +1 -1
- package/coverage/lcov-report/src/expansion-panel/index.html +8 -8
- package/coverage/lcov-report/src/expansion-panel/useExpansionList.ts.html +1 -1
- package/coverage/lcov-report/src/expansion-panel/useExpansionPanels.ts.html +36 -24
- package/coverage/lcov-report/src/focus/index.html +1 -1
- package/coverage/lcov-report/src/focus/useFocusContainer.ts.html +1 -1
- package/coverage/lcov-report/src/focus/utils.ts.html +1 -1
- package/coverage/lcov-report/src/form/AutoComplete.tsx.html +283 -0
- package/coverage/lcov-report/src/form/Checkbox.tsx.html +1 -1
- package/coverage/lcov-report/src/form/Fieldset.tsx.html +1 -1
- package/coverage/lcov-report/src/form/FileInput.tsx.html +1 -1
- package/coverage/lcov-report/src/form/Form.tsx.html +11 -8
- package/coverage/lcov-report/src/form/FormMessage.tsx.html +1 -1
- package/coverage/lcov-report/src/form/FormMessageContainer.tsx.html +5 -5
- package/coverage/lcov-report/src/form/FormMessageCounter.tsx.html +1 -1
- package/coverage/lcov-report/src/form/InputToggle.tsx.html +110 -110
- package/coverage/lcov-report/src/form/InputToggleIcon.tsx.html +63 -63
- package/coverage/lcov-report/src/form/Label.tsx.html +98 -98
- package/coverage/lcov-report/src/form/Legend.tsx.html +1 -1
- package/coverage/lcov-report/src/form/MenuItemCheckbox.tsx.html +3 -3
- package/coverage/lcov-report/src/form/MenuItemFileInput.tsx.html +1 -1
- package/coverage/lcov-report/src/form/MenuItemInputToggle.tsx.html +178 -232
- package/coverage/lcov-report/src/form/MenuItemRadio.tsx.html +3 -3
- package/coverage/lcov-report/src/form/MenuItemSwitch.tsx.html +1 -1
- package/coverage/lcov-report/src/form/MenuItemTextField.tsx.html +1 -1
- package/coverage/lcov-report/src/form/NativeSelect.tsx.html +1 -1
- package/coverage/lcov-report/src/form/OptGroup.tsx.html +1 -1
- package/coverage/lcov-report/src/form/Option.tsx.html +1 -1
- package/coverage/lcov-report/src/form/Password.tsx.html +1 -1
- package/coverage/lcov-report/src/form/Radio.tsx.html +3 -3
- package/coverage/lcov-report/src/form/ResizingTextArea.tsx.html +988 -0
- package/coverage/lcov-report/src/form/ResizingTextAreaWrapper.tsx.html +310 -0
- package/coverage/lcov-report/src/form/Select.tsx.html +894 -1122
- package/coverage/lcov-report/src/form/SelectValue.tsx.html +1 -1
- package/coverage/lcov-report/src/form/SimpleTextArea.tsx.html +694 -0
- package/coverage/lcov-report/src/form/Slider.tsx.html +1 -1
- package/coverage/lcov-report/src/form/SliderContainer.tsx.html +1 -1
- package/coverage/lcov-report/src/form/SliderMark.tsx.html +1 -1
- package/coverage/lcov-report/src/form/SliderMarkLabel.tsx.html +1 -1
- package/coverage/lcov-report/src/form/SliderThumb.tsx.html +1 -1
- package/coverage/lcov-report/src/form/SliderTrack.tsx.html +1 -1
- package/coverage/lcov-report/src/form/SliderValueMarks.tsx.html +1 -1
- package/coverage/lcov-report/src/form/SliderValueTooltip.tsx.html +1 -1
- package/coverage/lcov-report/src/form/Switch.tsx.html +1 -1
- package/coverage/lcov-report/src/form/SwitchTrack.tsx.html +1 -1
- package/coverage/lcov-report/src/form/TextArea.tsx.html +646 -580
- package/coverage/lcov-report/src/form/TextArea2.tsx.html +985 -0
- package/coverage/lcov-report/src/form/TextAreaBackup.tsx.html +985 -0
- package/coverage/lcov-report/src/form/TextField.tsx.html +3 -3
- package/coverage/lcov-report/src/form/TextFieldAddon.tsx.html +1 -1
- package/coverage/lcov-report/src/form/TextFieldContainer.tsx.html +1 -1
- package/coverage/lcov-report/src/form/TextFieldContainerStyles.ts.html +8 -8
- package/coverage/lcov-report/src/form/fileUtils.ts.html +1 -1
- package/coverage/lcov-report/src/form/formConfig.ts.html +1 -1
- package/coverage/lcov-report/src/form/formMessageStyles.ts.html +1 -1
- package/coverage/lcov-report/src/form/index.html +81 -21
- package/coverage/lcov-report/src/form/inputToggleStyles.ts.html +30 -30
- package/coverage/lcov-report/src/form/menuItemInputToggleStyles.ts.html +319 -0
- package/coverage/lcov-report/src/form/nativeSelectStyles.ts.html +1 -1
- package/coverage/lcov-report/src/form/optionStyles.ts.html +1 -1
- package/coverage/lcov-report/src/form/passwordStyles.ts.html +1 -1
- package/coverage/lcov-report/src/form/selectStyles.ts.html +1 -1
- package/coverage/lcov-report/src/form/selectUtils.ts.html +1 -1
- package/coverage/lcov-report/src/form/sliderUtils.ts.html +1 -1
- package/coverage/lcov-report/src/form/switchStyles.ts.html +1 -1
- package/coverage/lcov-report/src/form/textAreaStyles.ts.html +3 -3
- package/coverage/lcov-report/src/form/textFieldStyles.ts.html +1 -1
- package/coverage/lcov-report/src/form/useAutoComplete.ts.html +787 -0
- package/coverage/lcov-report/src/form/useCheckboxGroup.ts.html +1 -1
- package/coverage/lcov-report/src/form/useCombobox.ts.html +943 -457
- package/coverage/lcov-report/src/form/useEditableCombobox.ts.html +502 -0
- package/coverage/lcov-report/src/form/useFileUpload.ts.html +1 -1
- package/coverage/lcov-report/src/form/useInlineAutoComplete.ts.html +109 -0
- package/coverage/lcov-report/src/form/useListboxProvider.ts.html +1 -1
- package/coverage/lcov-report/src/form/useNumberField.ts.html +1 -1
- package/coverage/lcov-report/src/form/useRadioGroup.ts.html +47 -47
- package/coverage/lcov-report/src/form/useRangeSlider.ts.html +1 -1
- package/coverage/lcov-report/src/form/useResizingTextArea.ts.html +405 -294
- package/coverage/lcov-report/src/form/useSelectCombobox.ts.html +295 -0
- package/coverage/lcov-report/src/form/useSlider.ts.html +1 -1
- package/coverage/lcov-report/src/form/useTextField.ts.html +1 -1
- package/coverage/lcov-report/src/form/utils.ts.html +200 -170
- package/coverage/lcov-report/src/form/validation.ts.html +1 -1
- package/coverage/lcov-report/src/hoverMode/index.html +1 -1
- package/coverage/lcov-report/src/hoverMode/useHoverMode.ts.html +98 -98
- package/coverage/lcov-report/src/hoverMode/useHoverModeProvider.ts.html +19 -19
- package/coverage/lcov-report/src/icon/FontIcon.tsx.html +28 -28
- package/coverage/lcov-report/src/icon/IconRotator.tsx.html +5 -8
- package/coverage/lcov-report/src/icon/MaterialIcon.tsx.html +1 -1
- package/coverage/lcov-report/src/icon/MaterialSymbol.tsx.html +1 -1
- package/coverage/lcov-report/src/icon/SVGIcon.tsx.html +1 -1
- package/coverage/lcov-report/src/icon/TextIconSpacing.tsx.html +51 -51
- package/coverage/lcov-report/src/icon/iconConfig.tsx.html +10 -10
- package/coverage/lcov-report/src/icon/index.html +10 -145
- package/coverage/lcov-report/src/icon/material.ts.html +1 -1
- package/coverage/lcov-report/src/icon/materialConfig.ts.html +1 -1
- package/coverage/lcov-report/src/icon/styles.ts.html +38 -38
- package/coverage/lcov-report/src/index.html +10 -10
- package/coverage/lcov-report/src/interaction/Ripple.tsx.html +1 -1
- package/coverage/lcov-report/src/interaction/RippleContainer.tsx.html +1 -1
- package/coverage/lcov-report/src/interaction/UserInteractionModeProvider.tsx.html +87 -87
- package/coverage/lcov-report/src/interaction/config.ts.html +7 -7
- package/coverage/lcov-report/src/interaction/index.html +1 -1
- package/coverage/lcov-report/src/interaction/useElementInteraction.tsx.html +123 -123
- package/coverage/lcov-report/src/interaction/useHigherContrastChildren.tsx.html +19 -19
- package/coverage/lcov-report/src/interaction/utils.ts.html +1 -1
- package/coverage/lcov-report/src/layout/LayoutAppBar.tsx.html +1 -1
- package/coverage/lcov-report/src/layout/LayoutNav.tsx.html +60 -60
- package/coverage/lcov-report/src/layout/LayoutWindowSplitter.tsx.html +1 -1
- package/coverage/lcov-report/src/layout/Main.tsx.html +1 -1
- package/coverage/lcov-report/src/layout/index.html +15 -15
- package/coverage/lcov-report/src/layout/layoutNavStyles.ts.html +5 -5
- package/coverage/lcov-report/src/layout/layoutWindowSplitterStyles.ts.html +1 -1
- package/coverage/lcov-report/src/layout/mainStyles.ts.html +1 -1
- package/coverage/lcov-report/src/layout/useExpandableLayout.ts.html +1 -1
- package/coverage/lcov-report/src/layout/useHorizontalLayoutTransition.ts.html +1 -1
- package/coverage/lcov-report/src/layout/useLayoutAppBarHeight.ts.html +20 -32
- package/coverage/lcov-report/src/layout/useLayoutTree.ts.html +1 -1
- package/coverage/lcov-report/src/layout/useLayoutWindowSplitter.ts.html +1 -1
- package/coverage/lcov-report/src/layout/useMainTabIndex.ts.html +1 -1
- package/coverage/lcov-report/src/layout/useResizableLayout.ts.html +1 -1
- package/coverage/lcov-report/src/layout/useTemporaryLayout.ts.html +1 -1
- package/coverage/lcov-report/src/link/Link.tsx.html +1 -1
- package/coverage/lcov-report/src/link/SkipToMainContent.tsx.html +1 -1
- package/coverage/lcov-report/src/link/index.html +1 -1
- package/coverage/lcov-report/src/link/styles.ts.html +1 -1
- package/coverage/lcov-report/src/list/List.tsx.html +1 -1
- package/coverage/lcov-report/src/list/ListItem.tsx.html +158 -137
- package/coverage/lcov-report/src/list/ListItemAddon.tsx.html +45 -39
- package/coverage/lcov-report/src/list/ListItemChildren.tsx.html +88 -82
- package/coverage/lcov-report/src/list/ListItemLink.tsx.html +5 -5
- package/coverage/lcov-report/src/list/ListItemText.tsx.html +35 -35
- package/coverage/lcov-report/src/list/ListSubheader.tsx.html +1 -1
- package/coverage/lcov-report/src/list/getListItemHeight.ts.html +44 -47
- package/coverage/lcov-report/src/list/index.html +13 -13
- package/coverage/lcov-report/src/list/listItemStyles.ts.html +102 -72
- package/coverage/lcov-report/src/media-queries/AppSizeProvider.tsx.html +54 -54
- package/coverage/lcov-report/src/media-queries/appSize.ts.html +1 -1
- package/coverage/lcov-report/src/media-queries/index.html +1 -1
- package/coverage/lcov-report/src/media-queries/useMediaQuery.ts.html +28 -28
- package/coverage/lcov-report/src/menu/DropdownMenu.tsx.html +1 -1
- package/coverage/lcov-report/src/menu/Menu.tsx.html +4 -4
- package/coverage/lcov-report/src/menu/MenuBar.tsx.html +1 -1
- package/coverage/lcov-report/src/menu/MenuButton.tsx.html +1 -1
- package/coverage/lcov-report/src/menu/MenuConfigurationProvider.tsx.html +1 -1
- package/coverage/lcov-report/src/menu/MenuItem.tsx.html +1 -1
- package/coverage/lcov-report/src/menu/MenuItemButton.tsx.html +1 -1
- package/coverage/lcov-report/src/menu/MenuItemCircularProgress.tsx.html +433 -0
- package/coverage/lcov-report/src/menu/MenuItemGroup.tsx.html +1 -1
- package/coverage/lcov-report/src/menu/MenuItemSeparator.tsx.html +1 -1
- package/coverage/lcov-report/src/menu/MenuSheet.tsx.html +1 -1
- package/coverage/lcov-report/src/menu/MenuVisibilityProvider.tsx.html +1 -1
- package/coverage/lcov-report/src/menu/MenuWidget.tsx.html +1 -1
- package/coverage/lcov-report/src/menu/MenuWidgetKeyboardProvider.tsx.html +1 -1
- package/coverage/lcov-report/src/menu/index.html +13 -238
- package/coverage/lcov-report/src/menu/useContextMenu.ts.html +1 -1
- package/coverage/lcov-report/src/menu/useMenuBarProvider.ts.html +1 -1
- package/coverage/lcov-report/src/menu/utils.ts.html +1 -1
- package/coverage/lcov-report/src/movement/constants.ts.html +1 -1
- package/coverage/lcov-report/src/movement/findMatchIndex.ts.html +1 -1
- package/coverage/lcov-report/src/movement/index.html +17 -62
- package/coverage/lcov-report/src/movement/useKeyboardMovementProvider.ts.html +3 -3
- package/coverage/lcov-report/src/movement/utils.ts.html +143 -119
- package/coverage/lcov-report/src/overlay/Overlay.tsx.html +1 -1
- package/coverage/lcov-report/src/overlay/index.html +1 -1
- package/coverage/lcov-report/src/overlay/overlayStyles.ts.html +1 -1
- package/coverage/lcov-report/src/portal/Portal.tsx.html +7 -7
- package/coverage/lcov-report/src/portal/PortalContainerProvider.tsx.html +59 -35
- package/coverage/lcov-report/src/portal/index.html +7 -7
- package/coverage/lcov-report/src/positioning/constants.ts.html +1 -1
- package/coverage/lcov-report/src/positioning/createHorizontalPosition.ts.html +47 -47
- package/coverage/lcov-report/src/positioning/createVerticalPosition.ts.html +55 -55
- package/coverage/lcov-report/src/positioning/getFixedPosition.ts.html +89 -89
- package/coverage/lcov-report/src/positioning/index.html +1 -1
- package/coverage/lcov-report/src/positioning/useFixedPositioning.ts.html +193 -193
- package/coverage/lcov-report/src/positioning/utils.ts.html +59 -59
- package/coverage/lcov-report/src/progress/CircularProgress.tsx.html +83 -83
- package/coverage/lcov-report/src/progress/LinearProgress.tsx.html +3 -3
- package/coverage/lcov-report/src/progress/getProgressA11y.ts.html +1 -1
- package/coverage/lcov-report/src/progress/index.html +20 -5
- package/coverage/lcov-report/src/responsive-item/ResponsiveItemContainer.tsx.html +1 -1
- package/coverage/lcov-report/src/responsive-item/ResponsiveItemOverlay.tsx.html +1 -1
- package/coverage/lcov-report/src/responsive-item/index.html +1 -1
- package/coverage/lcov-report/src/responsive-item/styles.ts.html +1 -1
- package/coverage/lcov-report/src/scroll/ScrollLock.tsx.html +1 -1
- package/coverage/lcov-report/src/scroll/getScrollbarWidth.ts.html +1 -1
- package/coverage/lcov-report/src/scroll/index.html +1 -1
- package/coverage/lcov-report/src/scroll/useScrollLock.ts.html +1 -1
- package/coverage/lcov-report/src/segmented-button/SegmentedButton.tsx.html +1 -1
- package/coverage/lcov-report/src/segmented-button/SegmentedButtonContainer.tsx.html +1 -1
- package/coverage/lcov-report/src/segmented-button/index.html +1 -1
- package/coverage/lcov-report/src/segmented-button/segmentedButtonContainerStyles.ts.html +1 -1
- package/coverage/lcov-report/src/segmented-button/segmentedButtonStyles.ts.html +1 -1
- package/coverage/lcov-report/src/sheet/Sheet.tsx.html +1 -1
- package/coverage/lcov-report/src/sheet/index.html +5 -5
- package/coverage/lcov-report/src/sheet/styles.ts.html +45 -48
- package/coverage/lcov-report/src/snackbar/DefaultToastRenderer.tsx.html +80 -80
- package/coverage/lcov-report/src/snackbar/Snackbar.tsx.html +21 -45
- package/coverage/lcov-report/src/snackbar/Toast.tsx.html +108 -93
- package/coverage/lcov-report/src/snackbar/ToastActionButton.tsx.html +1 -1
- package/coverage/lcov-report/src/snackbar/ToastCloseButton.tsx.html +1 -1
- package/coverage/lcov-report/src/snackbar/ToastContent.tsx.html +48 -48
- package/coverage/lcov-report/src/snackbar/ToastManager.tsx.html +278 -275
- package/coverage/lcov-report/src/snackbar/ToastManagerProvider.tsx.html +6 -6
- package/coverage/lcov-report/src/snackbar/index.html +19 -19
- package/coverage/lcov-report/src/snackbar/snackbarStyles.ts.html +15 -15
- package/coverage/lcov-report/src/snackbar/toastContentStyles.ts.html +14 -14
- package/coverage/lcov-report/src/snackbar/toastStyles.ts.html +27 -27
- package/coverage/lcov-report/src/snackbar/useCurrentToastActions.ts.html +1 -1
- package/coverage/lcov-report/src/suspense/CircularProgressSuspense.tsx.html +142 -142
- package/coverage/lcov-report/src/suspense/NullSuspense.tsx.html +88 -88
- package/coverage/lcov-report/src/suspense/index.html +36 -21
- package/coverage/lcov-report/src/table/Table.tsx.html +45 -114
- package/coverage/lcov-report/src/table/TableBody.tsx.html +43 -43
- package/coverage/lcov-report/src/table/TableCell.tsx.html +109 -298
- package/coverage/lcov-report/src/table/TableCellContent.tsx.html +81 -27
- package/coverage/lcov-report/src/table/TableCheckbox.tsx.html +16 -10
- package/coverage/lcov-report/src/table/TableConfigurationProvider.tsx.html +20 -20
- package/coverage/lcov-report/src/table/TableContainer.tsx.html +7 -28
- package/coverage/lcov-report/src/table/TableContainerProvider.tsx.html +1 -1
- package/coverage/lcov-report/src/table/TableFooter.tsx.html +64 -43
- package/coverage/lcov-report/src/table/TableHeader.tsx.html +41 -92
- package/coverage/lcov-report/src/table/TableRadio.tsx.html +676 -0
- package/coverage/lcov-report/src/table/TableRow.tsx.html +38 -119
- package/coverage/lcov-report/src/table/index.html +151 -46
- package/coverage/lcov-report/src/table/tableCellStyles.ts.html +334 -0
- package/coverage/lcov-report/src/table/tableContainerStyles.ts.html +142 -0
- package/coverage/lcov-report/src/table/tableFooterStyles.ts.html +166 -0
- package/coverage/lcov-report/src/table/tableHeaderStyles.ts.html +172 -0
- package/coverage/lcov-report/src/table/tableRowStyles.ts.html +169 -0
- package/coverage/lcov-report/src/table/tableStyles.ts.html +157 -0
- package/coverage/lcov-report/src/tabs/Tab.tsx.html +263 -143
- package/coverage/lcov-report/src/tabs/TabList.tsx.html +1 -1
- package/coverage/lcov-report/src/tabs/TabListScrollButton.tsx.html +1 -1
- package/coverage/lcov-report/src/tabs/index.html +25 -25
- package/coverage/lcov-report/src/tabs/tabIndicatorStyles.ts.html +37 -7
- package/coverage/lcov-report/src/tabs/tabListScrollButtonStyles.ts.html +1 -1
- package/coverage/lcov-report/src/tabs/tabListStyles.ts.html +2 -2
- package/coverage/lcov-report/src/tabs/tabStyles.ts.html +64 -28
- package/coverage/lcov-report/src/tabs/useTabList.ts.html +44 -38
- package/coverage/lcov-report/src/tabs/useTabs.ts.html +1 -1
- package/coverage/lcov-report/src/tabs/utils.ts.html +3 -3
- package/coverage/lcov-report/src/test-utils/IntersectionObserver.ts.html +1 -1
- package/coverage/lcov-report/src/test-utils/ResizeObserver.ts.html +402 -261
- package/coverage/lcov-report/src/test-utils/data-testid.ts.html +18 -6
- package/coverage/lcov-report/src/test-utils/drag.ts.html +1 -1
- package/coverage/lcov-report/src/test-utils/index.html +12 -117
- package/coverage/lcov-report/src/test-utils/jest-setup.ts.html +9 -9
- package/coverage/lcov-report/src/test-utils/matchMedia.ts.html +55 -55
- package/coverage/lcov-report/src/test-utils/polyfills/IntersectionObserver.ts.html +4 -4
- package/coverage/lcov-report/src/test-utils/polyfills/ResizeObserver.ts.html +3 -3
- package/coverage/lcov-report/src/test-utils/polyfills/TextDecoder.ts.html +106 -0
- package/coverage/lcov-report/src/test-utils/polyfills/TextEncoder.ts.html +100 -0
- package/coverage/lcov-report/src/test-utils/polyfills/index.html +1 -1
- package/coverage/lcov-report/src/test-utils/polyfills/matchMedia.ts.html +6 -6
- package/coverage/lcov-report/src/test-utils/polyfills/offsetParent.ts.html +14 -14
- package/coverage/lcov-report/src/test-utils/polyfills/scrollIntoView.ts.html +5 -5
- package/coverage/lcov-report/src/test-utils/render.tsx.html +21 -21
- package/coverage/lcov-report/src/test-utils/root-html-environment.ts.html +85 -0
- package/coverage/lcov-report/src/test-utils/timers.ts.html +1 -1
- package/coverage/lcov-report/src/theme/LocalStorageColorSchemeProvider.tsx.html +1 -1
- package/coverage/lcov-report/src/theme/ThemeProvider.tsx.html +1 -1
- package/coverage/lcov-report/src/theme/colors.ts.html +1 -1
- package/coverage/lcov-report/src/theme/cssVars.ts.html +1 -1
- package/coverage/lcov-report/src/theme/index.html +1 -1
- package/coverage/lcov-report/src/theme/useCSSVariables.ts.html +25 -25
- package/coverage/lcov-report/src/theme/useColorScheme.ts.html +1 -1
- package/coverage/lcov-report/src/theme/useColorSchemeMetaTag.ts.html +1 -1
- package/coverage/lcov-report/src/theme/useColorSchemeProvider.ts.html +1 -1
- package/coverage/lcov-report/src/theme/usePrefersColorScheme.ts.html +1 -1
- package/coverage/lcov-report/src/theme/utils.ts.html +1 -1
- package/coverage/lcov-report/src/tooltip/Tooltip.tsx.html +62 -62
- package/coverage/lcov-report/src/tooltip/TooltipHoverModeProvider.tsx.html +3 -3
- package/coverage/lcov-report/src/tooltip/constants.ts.html +1 -1
- package/coverage/lcov-report/src/tooltip/index.html +9 -9
- package/coverage/lcov-report/src/tooltip/tooltipStyles.ts.html +12 -12
- package/coverage/lcov-report/src/tooltip/useTooltip.ts.html +243 -222
- package/coverage/lcov-report/src/tooltip/useTooltipPosition.ts.html +27 -27
- package/coverage/lcov-report/src/tooltip/utils.ts.html +22 -22
- package/coverage/lcov-report/src/transition/CSSTransition.tsx.html +1 -1
- package/coverage/lcov-report/src/transition/Collapse.tsx.html +1 -1
- package/coverage/lcov-report/src/transition/CrossFade.tsx.html +1 -1
- package/coverage/lcov-report/src/transition/ScaleTransition.tsx.html +1 -1
- package/coverage/lcov-report/src/transition/SkeletonPlaceholder.tsx.html +374 -338
- package/coverage/lcov-report/src/transition/Slide.tsx.html +1 -1
- package/coverage/lcov-report/src/transition/SlideContainer.tsx.html +1 -1
- package/coverage/lcov-report/src/transition/collapseStyles.ts.html +1 -1
- package/coverage/lcov-report/src/transition/config.ts.html +5 -5
- package/coverage/lcov-report/src/transition/index.html +49 -34
- package/coverage/lcov-report/src/transition/maxWidthTransition.ts.html +1 -1
- package/coverage/lcov-report/src/transition/skeletonPlaceholderUtils.ts.html +400 -0
- package/coverage/lcov-report/src/transition/useCSSTransition.ts.html +68 -68
- package/coverage/lcov-report/src/transition/useCarousel.ts.html +1 -1
- package/coverage/lcov-report/src/transition/useCollapseTransition.ts.html +10 -64
- package/coverage/lcov-report/src/transition/useCrossFadeTransition.ts.html +1 -1
- package/coverage/lcov-report/src/transition/useMaxWidthTransition.ts.html +1 -1
- package/coverage/lcov-report/src/transition/useScaleTransition.ts.html +18 -18
- package/coverage/lcov-report/src/transition/useSkeletonPlaceholder.ts.html +607 -562
- package/coverage/lcov-report/src/transition/useSlideTransition.ts.html +1 -1
- package/coverage/lcov-report/src/transition/useTransition.ts.html +232 -232
- package/coverage/lcov-report/src/transition/utils.ts.html +45 -45
- package/coverage/lcov-report/src/tree/DefaultTreeItemRenderer.tsx.html +18 -6
- package/coverage/lcov-report/src/tree/Tree.tsx.html +20 -8
- package/coverage/lcov-report/src/tree/TreeGroup.tsx.html +1 -1
- package/coverage/lcov-report/src/tree/TreeItem.tsx.html +7 -10
- package/coverage/lcov-report/src/tree/TreeItemExpander.tsx.html +1 -1
- package/coverage/lcov-report/src/tree/TreeProvider.tsx.html +1 -1
- package/coverage/lcov-report/src/tree/index.html +16 -196
- package/coverage/lcov-report/src/tree/styles.ts.html +4 -31
- package/coverage/lcov-report/src/tree/useTree.ts.html +1 -1
- package/coverage/lcov-report/src/tree/useTreeExpansion.ts.html +1 -1
- package/coverage/lcov-report/src/tree/useTreeItems.ts.html +1 -1
- package/coverage/lcov-report/src/tree/useTreeMovement.ts.html +87 -87
- package/coverage/lcov-report/src/tree/useTreeSelection.ts.html +1 -1
- package/coverage/lcov-report/src/tree/utils.ts.html +1 -1
- package/coverage/lcov-report/src/typography/SrOnly.tsx.html +12 -12
- package/coverage/lcov-report/src/typography/TextContainer.tsx.html +1 -1
- package/coverage/lcov-report/src/typography/Typography.tsx.html +94 -94
- package/coverage/lcov-report/src/typography/WritingDirectionProvider.tsx.html +1 -1
- package/coverage/lcov-report/src/typography/index.html +1 -1
- package/coverage/lcov-report/src/useAsyncAction.ts.html +1 -1
- package/coverage/lcov-report/src/useDebouncedFunction.ts.html +246 -240
- package/coverage/lcov-report/src/useDropzone.ts.html +1 -1
- package/coverage/lcov-report/src/useElementSize.ts.html +334 -0
- package/coverage/lcov-report/src/useEnsuredId.ts.html +8 -8
- package/coverage/lcov-report/src/useEnsuredRef.ts.html +14 -14
- package/coverage/lcov-report/src/useEnsuredState.ts.html +16 -16
- package/coverage/lcov-report/src/useHtmlClassName.ts.html +1 -1
- package/coverage/lcov-report/src/useIntersectionObserver.ts.html +1 -1
- package/coverage/lcov-report/src/useIsomorphicLayoutEffect.ts.html +1 -1
- package/coverage/lcov-report/src/useLocalStorage.ts.html +1 -1
- package/coverage/lcov-report/src/useOrientation.ts.html +30 -30
- package/coverage/lcov-report/src/usePageInactive.ts.html +30 -30
- package/coverage/lcov-report/src/useResizeListener.ts.html +38 -32
- package/coverage/lcov-report/src/useResizeObserver.ts.html +133 -244
- package/coverage/lcov-report/src/useThrottledFunction.ts.html +57 -51
- package/coverage/lcov-report/src/useToggle.ts.html +1 -1
- package/coverage/lcov-report/src/useUnmounted.ts.html +1 -1
- package/coverage/lcov-report/src/useWindowSize.ts.html +124 -94
- package/coverage/lcov-report/src/utils/RenderRecursively.tsx.html +1 -1
- package/coverage/lcov-report/src/utils/alphaNumericSort.ts.html +1 -1
- package/coverage/lcov-report/src/utils/applyRef.ts.html +11 -11
- package/coverage/lcov-report/src/utils/bem.ts.html +50 -50
- package/coverage/lcov-report/src/utils/filters.ts.html +357 -84
- package/coverage/lcov-report/src/utils/getClientPosition.ts.html +1 -1
- package/coverage/lcov-report/src/utils/getMiddleOfRange.ts.html +163 -0
- package/coverage/lcov-report/src/utils/getPercentage.ts.html +9 -9
- package/coverage/lcov-report/src/utils/getRangeDefaultValue.ts.html +66 -87
- package/coverage/lcov-report/src/utils/getRangeSteps.ts.html +7 -7
- package/coverage/lcov-report/src/utils/identity.ts.html +1 -1
- package/coverage/lcov-report/src/utils/index.html +13 -253
- package/coverage/lcov-report/src/utils/isElementVisible.ts.html +1 -1
- package/coverage/lcov-report/src/utils/isValidNumber.ts.html +118 -0
- package/coverage/lcov-report/src/utils/loop.ts.html +1 -1
- package/coverage/lcov-report/src/utils/nearest.ts.html +21 -21
- package/coverage/lcov-report/src/utils/parseCssLengthUnit.ts.html +18 -18
- package/coverage/lcov-report/src/utils/randomInt.ts.html +52 -52
- package/coverage/lcov-report/src/utils/wait.ts.html +1 -1
- package/coverage/lcov-report/src/utils/withinRange.ts.html +1 -1
- package/coverage/lcov-report/src/window-splitter/WindowSplitter.tsx.html +1 -1
- package/coverage/lcov-report/src/window-splitter/index.html +14 -14
- package/coverage/lcov-report/src/window-splitter/useWindowSplitter.ts.html +19 -67
- package/coverage/lcov-report/src/window-splitter/useWindowSplitterMaxValue.ts.html +256 -0
- package/coverage/lcov-report/suspense/CircularProgressSuspense.tsx.html +283 -0
- package/coverage/lcov-report/suspense/NullSuspense.tsx.html +202 -0
- package/coverage/lcov-report/suspense/index.html +131 -0
- package/coverage/lcov-report/tabIndicatorStyles.ts.html +43 -13
- package/coverage/lcov-report/tabListStyles.ts.html +35 -26
- package/coverage/lcov-report/tabStyles.ts.html +68 -26
- package/coverage/lcov-report/tabs/Tab.tsx.html +233 -143
- package/coverage/lcov-report/tabs/TabList.tsx.html +85 -85
- package/coverage/lcov-report/tabs/index.html +56 -11
- package/coverage/lcov-report/tabs/tabIndicatorStyles.ts.html +187 -0
- package/coverage/lcov-report/tabs/tabListStyles.ts.html +241 -0
- package/coverage/lcov-report/tabs/tabStyles.ts.html +253 -0
- package/coverage/lcov-report/tabs/useTabList.ts.html +736 -0
- package/coverage/lcov-report/tabs/useTabs.ts.html +1 -1
- package/coverage/lcov-report/tabs/utils.ts.html +1 -1
- package/coverage/lcov-report/test-utils/index.html +21 -21
- package/coverage/lcov-report/test-utils/use.ts.html +187 -0
- package/coverage/lcov-report/tooltip/Tooltip.tsx.html +62 -62
- package/coverage/lcov-report/tooltip/index.html +10 -70
- package/coverage/lcov-report/tooltip/useTooltip.ts.html +243 -222
- package/coverage/lcov-report/transition/SkeletonPlaceholder.tsx.html +595 -0
- package/coverage/lcov-report/transition/config.ts.html +5 -5
- package/coverage/lcov-report/transition/index.html +1 -1
- package/coverage/lcov-report/transition/skeletonPlaceholderUtils.ts.html +400 -0
- package/coverage/lcov-report/transition/useScaleTransition.ts.html +535 -0
- package/coverage/lcov-report/transition/useSkeletonPlaceholder.ts.html +952 -0
- package/coverage/lcov-report/tree/TreeItem.tsx.html +7 -10
- package/coverage/lcov-report/tree/index.html +17 -47
- package/coverage/lcov-report/tree/styles.ts.html +538 -0
- package/coverage/lcov-report/tree/useTreeMovement.ts.html +140 -143
- package/coverage/lcov-report/typography/Typography.tsx.html +138 -432
- package/coverage/lcov-report/typography/WritingDirectionProvider.tsx.html +75 -75
- package/coverage/lcov-report/typography/index.html +18 -18
- package/coverage/lcov-report/useAutoComplete.ts.html +787 -0
- package/coverage/lcov-report/useCollapseTransition.ts.html +166 -211
- package/coverage/lcov-report/useCombobox.ts.html +1513 -0
- package/coverage/lcov-report/useInlineAutoComplete.ts.html +379 -0
- package/coverage/lcov-report/useSelectCombobox.ts.html +295 -0
- package/coverage/lcov-report/useSkeletonPlaceholder.ts.html +952 -0
- package/coverage/lcov-report/useTabList.ts.html +142 -136
- package/coverage/lcov-report/useWindowSplitter.ts.html +640 -0
- package/coverage/lcov-report/useWindowSplitterMaxValue.ts.html +256 -0
- package/coverage/lcov-report/utils/alphaNumericSort.ts.html +11 -50
- package/coverage/lcov-report/utils/filters.ts.html +1056 -201
- package/coverage/lcov-report/utils/index.html +15 -30
- package/coverage/lcov-report/utils/isElementVisible.ts.html +14 -14
- package/coverage/lcov-report/utils/randomInt.ts.html +148 -0
- package/coverage/lcov-report/utils/searching.ts.html +85 -0
- package/coverage/lcov-report/utils/wait.ts.html +1 -1
- package/coverage/lcov-report/utils.ts.html +109 -277
- package/coverage/lcov-report/window-splitter/index.html +21 -36
- package/coverage/lcov-report/window-splitter/useWindowSplitter.ts.html +406 -328
- package/dist/RootHtml.d.ts +62 -0
- package/dist/RootHtml.js +49 -0
- package/dist/RootHtml.js.map +1 -0
- package/dist/_box-shadows.scss +12 -2
- package/dist/_core.scss +207 -253
- package/dist/_utils.scss +89 -0
- package/dist/app-bar/AppBar.d.ts +4 -9
- package/dist/app-bar/AppBar.js +29 -7
- package/dist/app-bar/AppBar.js.map +1 -1
- package/dist/app-bar/_app-bar.scss +114 -122
- package/dist/avatar/Avatar.d.ts +15 -1
- package/dist/avatar/Avatar.js +5 -2
- package/dist/avatar/Avatar.js.map +1 -1
- package/dist/avatar/_avatar.scss +74 -81
- package/dist/badge/_badge.scss +97 -59
- package/dist/box/_box.scss +72 -81
- package/dist/button/TooltippedButton.d.ts +62 -0
- package/dist/button/TooltippedButton.js +62 -0
- package/dist/button/TooltippedButton.js.map +1 -0
- package/dist/button/_button.scss +170 -180
- package/dist/card/Card.js +3 -2
- package/dist/card/Card.js.map +1 -1
- package/dist/card/CardContent.js +1 -1
- package/dist/card/CardContent.js.map +1 -1
- package/dist/card/ClickableCard.d.ts +42 -0
- package/dist/card/ClickableCard.js +73 -0
- package/dist/card/ClickableCard.js.map +1 -0
- package/dist/card/_card.scss +81 -82
- package/dist/card/styles.d.ts +8 -0
- package/dist/card/styles.js +6 -3
- package/dist/card/styles.js.map +1 -1
- package/dist/chip/_chip.scss +137 -148
- package/dist/dialog/FixedDialog.d.ts +5 -4
- package/dist/dialog/FixedDialog.js +5 -4
- package/dist/dialog/FixedDialog.js.map +1 -1
- package/dist/dialog/_dialog.scss +179 -162
- package/dist/divider/Divider.d.ts +0 -1
- package/dist/divider/Divider.js.map +1 -1
- package/dist/divider/_divider.scss +61 -70
- package/dist/draggable/_draggable.scss +16 -12
- package/dist/draggable/useDraggable.d.ts +12 -23
- package/dist/draggable/useDraggable.js +15 -6
- package/dist/draggable/useDraggable.js.map +1 -1
- package/dist/draggable/utils.d.ts +4 -17
- package/dist/draggable/utils.js +9 -25
- package/dist/draggable/utils.js.map +1 -1
- package/dist/expansion-panel/_expansion-panel.scss +76 -50
- package/dist/expansion-panel/useExpansionPanels.d.ts +5 -3
- package/dist/expansion-panel/useExpansionPanels.js +16 -9
- package/dist/expansion-panel/useExpansionPanels.js.map +1 -1
- package/dist/form/Form.d.ts +1 -1
- package/dist/form/Form.js +2 -1
- package/dist/form/Form.js.map +1 -1
- package/dist/form/Label.d.ts +5 -5
- package/dist/form/Label.js.map +1 -1
- package/dist/form/MenuItemInputToggle.d.ts +2 -15
- package/dist/form/MenuItemInputToggle.js +26 -37
- package/dist/form/MenuItemInputToggle.js.map +1 -1
- package/dist/form/NativeSelect.d.ts +5 -2
- package/dist/form/NativeSelect.js.map +1 -1
- package/dist/form/Option.js +3 -2
- package/dist/form/Option.js.map +1 -1
- package/dist/form/ResizingTextAreaWrapper.d.ts +19 -0
- package/dist/form/ResizingTextAreaWrapper.js +35 -0
- package/dist/form/ResizingTextAreaWrapper.js.map +1 -0
- package/dist/form/Select.d.ts +105 -15
- package/dist/form/Select.js +160 -244
- package/dist/form/Select.js.map +1 -1
- package/dist/form/SelectedOption.d.ts +21 -0
- package/dist/form/SelectedOption.js +37 -0
- package/dist/form/SelectedOption.js.map +1 -0
- package/dist/form/TextArea.d.ts +11 -0
- package/dist/form/TextArea.js +19 -29
- package/dist/form/TextArea.js.map +1 -1
- package/dist/form/TextField.d.ts +2 -2
- package/dist/form/TextField.js +7 -6
- package/dist/form/TextField.js.map +1 -1
- package/dist/form/TextFieldContainer.js +2 -2
- package/dist/form/TextFieldContainer.js.map +1 -1
- package/dist/form/_form.scss +1336 -1260
- package/dist/form/menuItemInputToggleStyles.d.ts +39 -0
- package/dist/form/menuItemInputToggleStyles.js +31 -0
- package/dist/form/menuItemInputToggleStyles.js.map +1 -0
- package/dist/form/selectUtils.d.ts +1 -3
- package/dist/form/selectUtils.js +2 -10
- package/dist/form/selectUtils.js.map +1 -1
- package/dist/form/textAreaStyles.d.ts +2 -2
- package/dist/form/textAreaStyles.js.map +1 -1
- package/dist/form/{TextFieldContainerStyles.d.ts → textFieldContainerStyles.d.ts} +7 -7
- package/dist/form/{TextFieldContainerStyles.js → textFieldContainerStyles.js} +1 -1
- package/dist/form/textFieldContainerStyles.js.map +1 -0
- package/dist/form/types.d.ts +6 -8
- package/dist/form/types.js.map +1 -1
- package/dist/form/useCombobox.d.ts +157 -0
- package/dist/form/useCombobox.js +206 -0
- package/dist/form/useCombobox.js.map +1 -0
- package/dist/form/useEditableCombobox.d.ts +15 -0
- package/dist/form/useEditableCombobox.js +101 -0
- package/dist/form/useEditableCombobox.js.map +1 -0
- package/dist/form/useFormReset.d.ts +16 -0
- package/dist/form/useFormReset.js +32 -0
- package/dist/form/useFormReset.js.map +1 -0
- package/dist/form/useListboxProvider.d.ts +4 -2
- package/dist/form/useListboxProvider.js +6 -8
- package/dist/form/useListboxProvider.js.map +1 -1
- package/dist/form/useResizingTextArea.d.ts +5 -2
- package/dist/form/useResizingTextArea.js +52 -21
- package/dist/form/useResizingTextArea.js.map +1 -1
- package/dist/form/useSelectCombobox.d.ts +17 -0
- package/dist/form/useSelectCombobox.js +36 -0
- package/dist/form/useSelectCombobox.js.map +1 -0
- package/dist/form/utils.d.ts +11 -1
- package/dist/form/utils.js +6 -0
- package/dist/form/utils.js.map +1 -1
- package/dist/icon/IconRotator.js +2 -3
- package/dist/icon/IconRotator.js.map +1 -1
- package/dist/icon/_icon.scss +105 -112
- package/dist/index.d.ts +23 -2
- package/dist/index.js +23 -2
- package/dist/index.js.map +1 -1
- package/dist/interaction/_interaction.scss +144 -135
- package/dist/layout/_layout.scss +82 -86
- package/dist/layout/useLayoutAppBarHeight.js +5 -9
- package/dist/layout/useLayoutAppBarHeight.js.map +1 -1
- package/dist/link/_link.scss +74 -66
- package/dist/list/ListItem.d.ts +8 -3
- package/dist/list/ListItem.js +4 -3
- package/dist/list/ListItem.js.map +1 -1
- package/dist/list/ListItemAddon.js +2 -1
- package/dist/list/ListItemAddon.js.map +1 -1
- package/dist/list/ListItemChildren.js +3 -2
- package/dist/list/ListItemChildren.js.map +1 -1
- package/dist/list/ListItemLink.js +3 -3
- package/dist/list/ListItemLink.js.map +1 -1
- package/dist/list/_list.scss +187 -184
- package/dist/list/getListItemHeight.d.ts +0 -1
- package/dist/list/getListItemHeight.js +2 -2
- package/dist/list/getListItemHeight.js.map +1 -1
- package/dist/list/listItemStyles.d.ts +9 -1
- package/dist/list/listItemStyles.js +5 -5
- package/dist/list/listItemStyles.js.map +1 -1
- package/dist/list/types.d.ts +25 -6
- package/dist/list/types.js.map +1 -1
- package/dist/menu/Menu.d.ts +1 -1
- package/dist/menu/Menu.js +12 -1
- package/dist/menu/Menu.js.map +1 -1
- package/dist/menu/MenuItemCircularProgress.d.ts +60 -0
- package/dist/menu/MenuItemCircularProgress.js +74 -0
- package/dist/menu/MenuItemCircularProgress.js.map +1 -0
- package/dist/menu/_menu.scss +29 -50
- package/dist/menu/useContextMenu.d.ts +3 -3
- package/dist/menu/useContextMenu.js +3 -3
- package/dist/menu/useContextMenu.js.map +1 -1
- package/dist/movement/types.d.ts +40 -21
- package/dist/movement/types.js.map +1 -1
- package/dist/movement/useKeyboardMovementProvider.js +15 -4
- package/dist/movement/useKeyboardMovementProvider.js.map +1 -1
- package/dist/movement/utils.d.ts +7 -2
- package/dist/movement/utils.js +10 -0
- package/dist/movement/utils.js.map +1 -1
- package/dist/overlay/_overlay.scss +39 -42
- package/dist/portal/PortalContainerProvider.d.ts +2 -2
- package/dist/portal/PortalContainerProvider.js +6 -1
- package/dist/portal/PortalContainerProvider.js.map +1 -1
- package/dist/positioning/useFixedPositioning.js +0 -8
- package/dist/positioning/useFixedPositioning.js.map +1 -1
- package/dist/progress/_progress.scss +33 -33
- package/dist/responsive-item/_responsive-item.scss +91 -89
- package/dist/searching/caseInsensitive.d.ts +150 -0
- package/dist/searching/caseInsensitive.js +30 -0
- package/dist/searching/caseInsensitive.js.map +1 -0
- package/dist/searching/fuzzy.d.ts +128 -0
- package/dist/searching/fuzzy.js +54 -0
- package/dist/searching/fuzzy.js.map +1 -0
- package/dist/searching/toSearchQuery.d.ts +7 -0
- package/dist/searching/toSearchQuery.js +15 -0
- package/dist/searching/toSearchQuery.js.map +1 -0
- package/dist/searching/types.d.ts +28 -0
- package/dist/searching/types.js +5 -0
- package/dist/searching/types.js.map +1 -0
- package/dist/searching/useFuzzyMatch.d.ts +19 -0
- package/dist/searching/useFuzzyMatch.js +26 -0
- package/dist/searching/useFuzzyMatch.js.map +1 -0
- package/dist/searching/utils.d.ts +21 -0
- package/dist/searching/utils.js +28 -0
- package/dist/searching/utils.js.map +1 -0
- package/dist/segmented-button/_segmented-button.scss +86 -92
- package/dist/sheet/_sheet.scss +107 -123
- package/dist/sheet/styles.d.ts +14 -15
- package/dist/sheet/styles.js.map +1 -1
- package/dist/snackbar/DefaultToastRenderer.js +1 -1
- package/dist/snackbar/DefaultToastRenderer.js.map +1 -1
- package/dist/snackbar/Snackbar.d.ts +10 -10
- package/dist/snackbar/Snackbar.js +3 -3
- package/dist/snackbar/Snackbar.js.map +1 -1
- package/dist/snackbar/Toast.d.ts +1 -1
- package/dist/snackbar/Toast.js +5 -1
- package/dist/snackbar/Toast.js.map +1 -1
- package/dist/snackbar/ToastManager.d.ts +2 -1
- package/dist/snackbar/ToastManager.js +1 -1
- package/dist/snackbar/ToastManager.js.map +1 -1
- package/dist/snackbar/_snackbar.scss +148 -144
- package/dist/snackbar/snackbarStyles.d.ts +1 -0
- package/dist/snackbar/snackbarStyles.js +2 -1
- package/dist/snackbar/snackbarStyles.js.map +1 -1
- package/dist/table/TableCheckbox.d.ts +3 -2
- package/dist/table/TableCheckbox.js +4 -2
- package/dist/table/TableCheckbox.js.map +1 -1
- package/dist/table/TableRadio.d.ts +3 -2
- package/dist/table/TableRadio.js +4 -2
- package/dist/table/TableRadio.js.map +1 -1
- package/dist/table/_table.scss +214 -227
- package/dist/table/tableCellStyles.d.ts +1 -1
- package/dist/table/tableCellStyles.js.map +1 -1
- package/dist/tabs/Tab.d.ts +24 -3
- package/dist/tabs/Tab.js +15 -8
- package/dist/tabs/Tab.js.map +1 -1
- package/dist/tabs/_tabs.scss +62 -53
- package/dist/tabs/tabIndicatorStyles.d.ts +2 -1
- package/dist/tabs/tabIndicatorStyles.js +6 -3
- package/dist/tabs/tabIndicatorStyles.js.map +1 -1
- package/dist/tabs/tabListStyles.js +2 -1
- package/dist/tabs/tabListStyles.js.map +1 -1
- package/dist/tabs/tabStyles.d.ts +2 -0
- package/dist/tabs/tabStyles.js +6 -3
- package/dist/tabs/tabStyles.js.map +1 -1
- package/dist/tabs/useTabList.d.ts +3 -3
- package/dist/tabs/useTabList.js +9 -6
- package/dist/tabs/useTabList.js.map +1 -1
- package/dist/test-utils/IntersectionObserver.d.ts +12 -0
- package/dist/test-utils/ResizeObserver.d.ts +214 -0
- package/dist/test-utils/ResizeObserver.js +69 -49
- package/dist/test-utils/ResizeObserver.js.map +1 -1
- package/dist/test-utils/data-testid.d.ts +7 -0
- package/dist/test-utils/data-testid.js +1 -0
- package/dist/test-utils/data-testid.js.map +1 -1
- package/dist/test-utils/drag.d.ts +26 -0
- package/dist/test-utils/index.d.ts +7 -0
- package/dist/test-utils/jest-setup.d.ts +1 -0
- package/dist/test-utils/matchMedia.d.ts +101 -0
- package/dist/test-utils/matchMedia.js +2 -2
- package/dist/test-utils/matchMedia.js.map +1 -1
- package/dist/test-utils/polyfills/IntersectionObserver.d.ts +1 -0
- package/dist/test-utils/polyfills/ResizeObserver.d.ts +1 -0
- package/dist/test-utils/polyfills/TextDecoder.d.ts +1 -0
- package/dist/test-utils/polyfills/TextDecoder.js +8 -0
- package/dist/test-utils/polyfills/TextDecoder.js.map +1 -0
- package/dist/test-utils/polyfills/TextEncoder.d.ts +1 -0
- package/dist/test-utils/polyfills/TextEncoder.js +6 -0
- package/dist/test-utils/polyfills/TextEncoder.js.map +1 -0
- package/dist/test-utils/polyfills/index.d.ts +7 -0
- package/dist/test-utils/polyfills/index.js +2 -0
- package/dist/test-utils/polyfills/index.js.map +1 -1
- package/dist/test-utils/polyfills/matchMedia.d.ts +1 -0
- package/dist/test-utils/polyfills/offsetParent.d.ts +1 -0
- package/dist/test-utils/polyfills/scrollIntoView.d.ts +1 -0
- package/dist/test-utils/render.d.ts +13 -0
- package/dist/test-utils/timers.d.ts +39 -0
- package/dist/theme/_theme.scss +243 -133
- package/dist/tooltip/_tooltip.scss +76 -83
- package/dist/tooltip/useTooltip.d.ts +14 -14
- package/dist/tooltip/useTooltip.js.map +1 -1
- package/dist/transition/SkeletonPlaceholder.d.ts +2 -2
- package/dist/transition/SkeletonPlaceholder.js +8 -3
- package/dist/transition/SkeletonPlaceholder.js.map +1 -1
- package/dist/transition/_transition.scss +89 -78
- package/dist/transition/skeletonPlaceholderUtils.d.ts +77 -0
- package/dist/transition/skeletonPlaceholderUtils.js +38 -0
- package/dist/transition/skeletonPlaceholderUtils.js.map +1 -0
- package/dist/transition/useCollapseTransition.d.ts +3 -18
- package/dist/transition/useCollapseTransition.js +1 -10
- package/dist/transition/useCollapseTransition.js.map +1 -1
- package/dist/transition/useSkeletonPlaceholder.d.ts +12 -7
- package/dist/transition/useSkeletonPlaceholder.js +38 -37
- package/dist/transition/useSkeletonPlaceholder.js.map +1 -1
- package/dist/transition/utils.js +7 -2
- package/dist/transition/utils.js.map +1 -1
- package/dist/tree/DefaultTreeItemRenderer.d.ts +2 -2
- package/dist/tree/DefaultTreeItemRenderer.js.map +1 -1
- package/dist/tree/Tree.d.ts +8 -4
- package/dist/tree/Tree.js.map +1 -1
- package/dist/tree/TreeItem.js +3 -4
- package/dist/tree/TreeItem.js.map +1 -1
- package/dist/tree/_tree.scss +111 -109
- package/dist/tree/styles.d.ts +0 -6
- package/dist/tree/styles.js +1 -2
- package/dist/tree/styles.js.map +1 -1
- package/dist/tree/useTreeMovement.js +1 -1
- package/dist/tree/useTreeMovement.js.map +1 -1
- package/dist/types.d.ts +13 -0
- package/dist/types.js +1 -2
- package/dist/types.js.map +1 -1
- package/dist/typography/SrOnly.d.ts +3 -3
- package/dist/typography/SrOnly.js +4 -4
- package/dist/typography/SrOnly.js.map +1 -1
- package/dist/typography/Typography.d.ts +19 -19
- package/dist/typography/Typography.js +19 -19
- package/dist/typography/Typography.js.map +1 -1
- package/dist/typography/WritingDirectionProvider.d.ts +2 -2
- package/dist/typography/WritingDirectionProvider.js +2 -2
- package/dist/typography/WritingDirectionProvider.js.map +1 -1
- package/dist/typography/_typography.scss +141 -87
- package/dist/useDebouncedFunction.d.ts +2 -2
- package/dist/useDebouncedFunction.js +10 -6
- package/dist/useDebouncedFunction.js.map +1 -1
- package/dist/useElementSize.d.ts +40 -0
- package/dist/useElementSize.js +53 -0
- package/dist/useElementSize.js.map +1 -0
- package/dist/useEnsuredState.d.ts +1 -1
- package/dist/useEnsuredState.js.map +1 -1
- package/dist/useResizeListener.d.ts +1 -1
- package/dist/useResizeListener.js +1 -0
- package/dist/useResizeListener.js.map +1 -1
- package/dist/useResizeObserver.d.ts +4 -43
- package/dist/useResizeObserver.js +4 -43
- package/dist/useResizeObserver.js.map +1 -1
- package/dist/useThrottledFunction.d.ts +2 -2
- package/dist/useThrottledFunction.js +20 -16
- package/dist/useThrottledFunction.js.map +1 -1
- package/dist/useWindowSize.d.ts +14 -11
- package/dist/useWindowSize.js +12 -7
- package/dist/useWindowSize.js.map +1 -1
- package/dist/utils/alphaNumericSort.d.ts +1 -1
- package/dist/utils/alphaNumericSort.js +2 -10
- package/dist/utils/alphaNumericSort.js.map +1 -1
- package/dist/utils/getMiddleOfRange.d.ts +13 -0
- package/dist/utils/getMiddleOfRange.js +20 -0
- package/dist/utils/getMiddleOfRange.js.map +1 -0
- package/dist/utils/getRangeDefaultValue.d.ts +3 -5
- package/dist/utils/getRangeDefaultValue.js +3 -13
- package/dist/utils/getRangeDefaultValue.js.map +1 -1
- package/dist/utils/getRangeSteps.d.ts +1 -1
- package/dist/utils/getRangeSteps.js +2 -2
- package/dist/utils/getRangeSteps.js.map +1 -1
- package/dist/utils/nearest.js +1 -1
- package/dist/utils/nearest.js.map +1 -1
- package/dist/window-splitter/_window-splitter.scss +83 -112
- package/dist/window-splitter/useWindowSplitter.d.ts +3 -5
- package/dist/window-splitter/useWindowSplitter.js +3 -11
- package/dist/window-splitter/useWindowSplitter.js.map +1 -1
- package/jest.config.ts +4 -0
- package/package.json +374 -32
- package/scripts/{copySassFiles.js → copySassFiles.ts} +5 -5
- package/scripts/tsconfig.json +18 -0
- package/src/RootHtml.tsx +95 -0
- package/src/__tests__/RootHtml.node.tsx +46 -0
- package/src/__tests__/__snapshots__/RootHtml.node.tsx.snap +19 -0
- package/src/__tests__/useDebouncedFunction.tsx +65 -24
- package/src/__tests__/useElementSize.tsx +181 -0
- package/src/__tests__/useThrottledFunction.tsx +54 -0
- package/src/__tests__/useWindowSize.node.tsx +56 -0
- package/src/__tests__/useWindowSize.tsx +156 -0
- package/src/_box-shadows.scss +12 -2
- package/src/_core.scss +207 -253
- package/src/_utils.scss +89 -0
- package/src/app-bar/AppBar.tsx +59 -19
- package/src/app-bar/__tests__/__snapshots__/AppBar.tsx.snap +21 -21
- package/src/app-bar/_app-bar.scss +114 -122
- package/src/avatar/Avatar.tsx +25 -4
- package/src/avatar/__tests__/Avatar.tsx +1 -1
- package/src/avatar/__tests__/__snapshots__/Avatar.tsx.snap +6 -6
- package/src/avatar/_avatar.scss +74 -81
- package/src/badge/_badge.scss +97 -59
- package/src/box/_box.scss +72 -81
- package/src/button/TooltippedButton.tsx +120 -0
- package/src/button/__tests__/TooltippedButton.tsx +60 -0
- package/src/button/__tests__/__snapshots__/Button.tsx.snap +1 -1
- package/src/button/__tests__/__snapshots__/TooltippedButton.tsx.snap +26 -0
- package/src/button/_button.scss +170 -180
- package/src/card/Card.tsx +5 -3
- package/src/card/CardContent.tsx +3 -3
- package/src/card/ClickableCard.tsx +105 -0
- package/src/card/__tests__/ClickableCard.tsx +66 -0
- package/src/card/__tests__/__snapshots__/CardHeader.tsx.snap +1 -1
- package/src/card/__tests__/__snapshots__/CardSubtitle.tsx.snap +2 -2
- package/src/card/__tests__/__snapshots__/ClickableCard.tsx.snap +20 -0
- package/src/card/__tests__/__snapshots__/styles.ts.snap +1 -1
- package/src/card/_card.scss +81 -82
- package/src/card/styles.ts +19 -10
- package/src/chip/_chip.scss +137 -148
- package/src/dialog/FixedDialog.tsx +5 -4
- package/src/dialog/_dialog.scss +179 -162
- package/src/divider/Divider.tsx +0 -1
- package/src/divider/_divider.scss +61 -70
- package/src/draggable/_draggable.scss +16 -12
- package/src/draggable/useDraggable.ts +26 -25
- package/src/draggable/utils.ts +16 -50
- package/src/expansion-panel/__tests__/ExpansionPanel.tsx +2 -2
- package/src/expansion-panel/_expansion-panel.scss +76 -50
- package/src/expansion-panel/useExpansionPanels.ts +20 -16
- package/src/form/Form.tsx +2 -1
- package/src/form/Label.tsx +5 -5
- package/src/form/MenuItemInputToggle.tsx +46 -64
- package/src/form/NativeSelect.tsx +6 -3
- package/src/form/Option.tsx +8 -2
- package/src/form/ResizingTextAreaWrapper.tsx +75 -0
- package/src/form/Select.tsx +251 -327
- package/src/form/SelectedOption.tsx +55 -0
- package/src/form/TextArea.tsx +40 -32
- package/src/form/TextField.tsx +19 -19
- package/src/form/TextFieldContainer.tsx +2 -2
- package/src/form/__tests__/MenuItemCheckbox.tsx +53 -0
- package/src/form/__tests__/MenuItemRadio.tsx +53 -0
- package/src/form/__tests__/Select.tsx +439 -0
- package/src/form/__tests__/TextArea.tsx +433 -0
- package/src/form/__tests__/TextField.tsx +195 -0
- package/src/form/__tests__/__snapshots__/FileInput.tsx.snap +23 -23
- package/src/form/__tests__/__snapshots__/MenuItemCheckbox.tsx.snap +96 -0
- package/src/form/__tests__/__snapshots__/MenuItemRadio.tsx.snap +96 -0
- package/src/form/__tests__/__snapshots__/Select.tsx.snap +492 -0
- package/src/form/__tests__/__snapshots__/TextArea.tsx.snap +548 -0
- package/src/form/__tests__/__snapshots__/TextField.tsx.snap +279 -0
- package/src/form/__tests__/useFormReset.tsx +195 -0
- package/src/form/_form.scss +1336 -1260
- package/src/form/menuItemInputToggleStyles.ts +78 -0
- package/src/form/selectUtils.ts +3 -14
- package/src/form/textAreaStyles.ts +2 -2
- package/src/form/{TextFieldContainerStyles.ts → textFieldContainerStyles.ts} +7 -7
- package/src/form/types.ts +6 -8
- package/src/form/useCombobox.ts +523 -0
- package/src/form/useEditableCombobox.ts +139 -0
- package/src/form/useFormReset.ts +48 -0
- package/src/form/useListboxProvider.ts +9 -7
- package/src/form/useResizingTextArea.ts +66 -25
- package/src/form/useSelectCombobox.ts +70 -0
- package/src/form/utils.ts +17 -4
- package/src/icon/IconRotator.tsx +1 -2
- package/src/icon/_icon.scss +105 -112
- package/src/index.ts +23 -2
- package/src/interaction/_interaction.scss +144 -135
- package/src/layout/__tests__/__snapshots__/LayoutAppBar.tsx.snap +4 -4
- package/src/layout/__tests__/__snapshots__/useExpandableLayout.tsx.snap +1 -1
- package/src/layout/__tests__/__snapshots__/useLayoutTree.tsx.snap +18 -18
- package/src/layout/__tests__/__snapshots__/useResizableLayout.tsx.snap +1 -1
- package/src/layout/__tests__/__snapshots__/useTemporaryLayout.tsx.snap +1 -1
- package/src/layout/_layout.scss +82 -86
- package/src/layout/useLayoutAppBarHeight.ts +5 -9
- package/src/link/_link.scss +74 -66
- package/src/list/ListItem.tsx +20 -13
- package/src/list/ListItemAddon.tsx +5 -3
- package/src/list/ListItemChildren.tsx +4 -2
- package/src/list/ListItemLink.tsx +4 -4
- package/src/list/__tests__/ListItem.tsx +1 -1
- package/src/list/__tests__/__snapshots__/ListItem.tsx.snap +1 -1
- package/src/list/__tests__/getListItemHeight.ts +2 -2
- package/src/list/_list.scss +187 -184
- package/src/list/getListItemHeight.ts +2 -3
- package/src/list/listItemStyles.ts +15 -5
- package/src/list/types.ts +28 -6
- package/src/menu/Menu.tsx +10 -2
- package/src/menu/MenuItemCircularProgress.tsx +116 -0
- package/src/menu/__tests__/MenuItemCircularProgress.tsx +39 -0
- package/src/menu/__tests__/__snapshots__/MenuItemCircularProgress.tsx.snap +68 -0
- package/src/menu/__tests__/__snapshots__/useContextMenu.tsx.snap +54 -0
- package/src/menu/__tests__/useContextMenu.tsx +41 -0
- package/src/menu/_menu.scss +29 -50
- package/src/menu/useContextMenu.ts +3 -3
- package/src/movement/types.ts +50 -25
- package/src/movement/useKeyboardMovementProvider.ts +21 -8
- package/src/movement/utils.ts +12 -2
- package/src/overlay/_overlay.scss +39 -42
- package/src/portal/PortalContainerProvider.tsx +10 -2
- package/src/portal/__tests__/PortalContainerProvider.tsx +23 -0
- package/src/positioning/__tests__/__snapshots__/useFixedPositioning.tsx.snap +0 -32
- package/src/positioning/__tests__/useFixedPositioning.tsx +0 -14
- package/src/positioning/useFixedPositioning.ts +0 -6
- package/src/progress/_progress.scss +33 -33
- package/src/responsive-item/_responsive-item.scss +91 -89
- package/src/searching/__tests__/caseInsensitive.ts +165 -0
- package/src/searching/__tests__/fuzzy.ts +169 -0
- package/src/searching/__tests__/toSearchQuery.ts +21 -0
- package/src/searching/__tests__/useFuzzyMatch.tsx +200 -0
- package/src/searching/caseInsensitive.ts +200 -0
- package/src/searching/fuzzy.ts +175 -0
- package/src/searching/toSearchQuery.ts +20 -0
- package/src/searching/types.ts +34 -0
- package/src/searching/useFuzzyMatch.ts +42 -0
- package/src/searching/utils.ts +53 -0
- package/src/segmented-button/_segmented-button.scss +86 -92
- package/src/sheet/_sheet.scss +107 -123
- package/src/sheet/styles.ts +14 -15
- package/src/snackbar/DefaultToastRenderer.tsx +1 -1
- package/src/snackbar/Snackbar.tsx +28 -32
- package/src/snackbar/Toast.tsx +7 -2
- package/src/snackbar/ToastManager.tsx +3 -2
- package/src/snackbar/__tests__/Snackbar.tsx +12 -11
- package/src/snackbar/__tests__/ToastManagerProvider.tsx +20 -42
- package/src/snackbar/__tests__/__snapshots__/Snackbar.tsx.snap +127 -27
- package/src/snackbar/__tests__/__snapshots__/ToastManagerProvider.tsx.snap +23 -8
- package/src/snackbar/_snackbar.scss +148 -144
- package/src/snackbar/snackbarStyles.ts +3 -1
- package/src/suspense/__tests__/CircularProgressSuspense.tsx +90 -0
- package/src/suspense/__tests__/NullSuspense.tsx +46 -0
- package/src/suspense/__tests__/__snapshots__/CircularProgressSuspense.tsx.snap +24 -0
- package/src/table/TableCheckbox.tsx +4 -2
- package/src/table/TableRadio.tsx +4 -2
- package/src/table/_table.scss +214 -227
- package/src/table/tableCellStyles.ts +1 -1
- package/src/tabs/Tab.tsx +110 -70
- package/src/tabs/__tests__/Tab.tsx +25 -2
- package/src/tabs/__tests__/TabList.tsx +4 -4
- package/src/tabs/__tests__/__snapshots__/TabList.tsx.snap +2 -2
- package/src/tabs/_tabs.scss +62 -53
- package/src/tabs/tabIndicatorStyles.ts +13 -3
- package/src/tabs/tabListStyles.ts +1 -1
- package/src/tabs/tabStyles.ts +16 -4
- package/src/tabs/useTabList.ts +10 -8
- package/src/test-utils/ResizeObserver.ts +100 -53
- package/src/test-utils/__tests__/ResizeObserver.ts +1 -1
- package/src/test-utils/data-testid.ts +5 -1
- package/src/test-utils/matchMedia.ts +2 -2
- package/src/test-utils/polyfills/TextDecoder.ts +7 -0
- package/src/test-utils/polyfills/TextEncoder.ts +5 -0
- package/src/test-utils/polyfills/index.ts +2 -0
- package/src/theme/_theme.scss +243 -133
- package/src/tooltip/_tooltip.scss +76 -83
- package/src/tooltip/useTooltip.ts +23 -16
- package/src/transition/SkeletonPlaceholder.tsx +18 -6
- package/src/transition/__tests__/SkeletonPlaceholder.tsx +72 -0
- package/src/transition/__tests__/__snapshots__/SkeletonPlaceholder.tsx.snap +24 -0
- package/src/transition/__tests__/utils.ts +25 -0
- package/src/transition/_transition.scss +89 -78
- package/src/transition/skeletonPlaceholderUtils.ts +105 -0
- package/src/transition/useCollapseTransition.ts +6 -24
- package/src/transition/useSkeletonPlaceholder.ts +62 -47
- package/src/transition/utils.ts +10 -5
- package/src/tree/DefaultTreeItemRenderer.tsx +6 -2
- package/src/tree/Tree.tsx +8 -4
- package/src/tree/TreeItem.tsx +3 -4
- package/src/tree/__tests__/Tree.tsx +1 -1
- package/src/tree/__tests__/__snapshots__/Tree.tsx.snap +124 -124
- package/src/tree/_tree.scss +111 -109
- package/src/tree/styles.ts +0 -9
- package/src/tree/useTreeMovement.ts +1 -1
- package/src/types.ts +13 -0
- package/src/typography/SrOnly.tsx +9 -9
- package/src/typography/Typography.tsx +19 -19
- package/src/typography/WritingDirectionProvider.tsx +4 -2
- package/src/typography/__tests__/__snapshots__/SrOnly.tsx.snap +5 -5
- package/src/typography/_typography.scss +141 -87
- package/src/useDebouncedFunction.ts +12 -10
- package/src/useElementSize.ts +83 -0
- package/src/useEnsuredState.ts +1 -1
- package/src/useResizeListener.ts +3 -1
- package/src/useResizeObserver.ts +8 -45
- package/src/useThrottledFunction.ts +12 -10
- package/src/useWindowSize.ts +29 -19
- package/src/utils/__tests__/getMiddleOfRange.ts +12 -0
- package/src/utils/__tests__/getRangeDefaultValue.ts +47 -0
- package/src/utils/alphaNumericSort.ts +3 -16
- package/src/utils/getMiddleOfRange.ts +26 -0
- package/src/utils/getRangeDefaultValue.ts +8 -15
- package/src/utils/getRangeSteps.ts +2 -2
- package/src/utils/nearest.ts +1 -1
- package/src/window-splitter/_window-splitter.scss +83 -112
- package/src/window-splitter/useWindowSplitter.ts +12 -28
- package/tsconfig.types.json +1 -1
- package/.turbo/turbo-lint.log +0 -12
- package/.turbo/turbo-test.log +0 -166
- package/dist/divider/VerticalDivider.d.ts +0 -32
- package/dist/divider/useVerticalDividerHeight.d.ts +0 -37
- package/dist/form/SelectValue.d.ts +0 -17
- package/dist/form/SelectValue.js +0 -32
- package/dist/form/SelectValue.js.map +0 -1
- package/dist/form/TextFieldContainerStyles.js.map +0 -1
- package/dist/icon/MaterialIconsProvider.d.ts +0 -12
- package/dist/icon/MaterialIconsProvider.js +0 -17
- package/dist/icon/MaterialIconsProvider.js.map +0 -1
- package/dist/icon/MaterialSymbolsProvider.d.ts +0 -145
- package/dist/icon/MaterialSymbolsProvider.js +0 -60
- package/dist/icon/MaterialSymbolsProvider.js.map +0 -1
- package/dist/link/LinkProvider.d.ts +0 -29
- package/dist/menu/menuConfig.d.ts +0 -60
- package/dist/tooltip/useOverflowTooltip.d.ts +0 -61
- package/dist/utils/filters.d.ts +0 -196
- package/dist/utils/filters.js +0 -67
- package/dist/utils/filters.js.map +0 -1
- package/src/form/SelectValue.tsx +0 -39
- package/src/utils/__tests__/filters.ts +0 -279
- package/src/utils/filters.ts +0 -320
|
@@ -17,15 +17,15 @@ const noop = ()=>{
|
|
|
17
17
|
* const { menuProps, onContextMenu } = useContextMenu();
|
|
18
18
|
*
|
|
19
19
|
* return (
|
|
20
|
-
*
|
|
21
|
-
* <textarea />
|
|
20
|
+
* <>
|
|
21
|
+
* <textarea onContextMenu={onContextMenu} />
|
|
22
22
|
* <Menu {...menuProps}>
|
|
23
23
|
* <MenuItem>Cut</MenuItem>
|
|
24
24
|
* <MenuItem>Copy</MenuItem>
|
|
25
25
|
* <MenuItem>Paste</MenuItem>
|
|
26
26
|
* <MenuItem>Undo</MenuItem>
|
|
27
27
|
* </Menu>
|
|
28
|
-
*
|
|
28
|
+
* </>
|
|
29
29
|
* );
|
|
30
30
|
* }
|
|
31
31
|
* ```
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/menu/useContextMenu.ts"],"sourcesContent":["\"use client\";\nimport type { MouseEvent, RefObject } from \"react\";\nimport { useCallback, useRef, useState } from \"react\";\nimport { BELOW_INNER_LEFT_ANCHOR } from \"../positioning/constants.js\";\nimport type { InitialCoords, PositionAnchor } from \"../positioning/types.js\";\nimport type { UseStateObject } from \"../types.js\";\n\n/** @remarks \\@since 6.0.0 */\nexport interface ContextMenuProps extends InitialCoords {\n \"aria-label\": string;\n anchor: PositionAnchor;\n fixedTo: RefObject<HTMLElement>;\n visible: boolean;\n preventScroll: boolean;\n onRequestClose(): void;\n}\n\n/**\n * @remarks\n * \\@since 5.0.0\n * \\@since 6.0.0 Dropped most options since they are no longer required for the\n * context menu to work. Apply any `Menu` props directly to the `Menu` component\n * instead.\n */\nexport interface ContextMenuHookOptions {\n /**\n * @defaultValue `BELOW_INNER_LEFT_ANCHOR`\n * @see {@link BELOW_INNER_LEFT_ANCHOR}\n */\n anchor?: PositionAnchor;\n\n /**\n * @defaultValue `\"Context Menu\"`\n */\n menuLabel?: string;\n\n /**\n * @defaultValue `true`\n */\n preventScroll?: boolean;\n onContextMenu?<E extends HTMLElement>(event: MouseEvent<E>): void;\n}\n\n/**\n * @remarks\n * \\@since 5.0.0\n * \\@since 6.0.0 Renamed from `ContextMenuHookReturnValue` to\n * `ContextMenuImplementation` and dropped the `menuRef` and `menuNodeRef`\n * fields.\n */\nexport interface ContextMenuImplementation\n extends UseStateObject<\"visible\", boolean> {\n menuProps: ContextMenuProps;\n onContextMenu<E extends HTMLElement>(event: MouseEvent<E>): void;\n}\n\nconst noop = (): void => {\n // do nothing\n};\n\n/**\n * This hook controls the visibility and positioning for a context menu.\n *\n * @example\n * Simple Example\n * ```tsx\n * import type { ReactElement } from \"react\";\n * import [ Menu, MenuItem, useContextMenu ] from \"@react-md/core\":\n *\n * function Example(): ReactElement {\n * const { menuProps, onContextMenu } = useContextMenu();\n *\n * return (\n * <
|
|
1
|
+
{"version":3,"sources":["../../src/menu/useContextMenu.ts"],"sourcesContent":["\"use client\";\nimport type { MouseEvent, RefObject } from \"react\";\nimport { useCallback, useRef, useState } from \"react\";\nimport { BELOW_INNER_LEFT_ANCHOR } from \"../positioning/constants.js\";\nimport type { InitialCoords, PositionAnchor } from \"../positioning/types.js\";\nimport type { UseStateObject } from \"../types.js\";\n\n/** @remarks \\@since 6.0.0 */\nexport interface ContextMenuProps extends InitialCoords {\n \"aria-label\": string;\n anchor: PositionAnchor;\n fixedTo: RefObject<HTMLElement>;\n visible: boolean;\n preventScroll: boolean;\n onRequestClose(): void;\n}\n\n/**\n * @remarks\n * \\@since 5.0.0\n * \\@since 6.0.0 Dropped most options since they are no longer required for the\n * context menu to work. Apply any `Menu` props directly to the `Menu` component\n * instead.\n */\nexport interface ContextMenuHookOptions {\n /**\n * @defaultValue `BELOW_INNER_LEFT_ANCHOR`\n * @see {@link BELOW_INNER_LEFT_ANCHOR}\n */\n anchor?: PositionAnchor;\n\n /**\n * @defaultValue `\"Context Menu\"`\n */\n menuLabel?: string;\n\n /**\n * @defaultValue `true`\n */\n preventScroll?: boolean;\n onContextMenu?<E extends HTMLElement>(event: MouseEvent<E>): void;\n}\n\n/**\n * @remarks\n * \\@since 5.0.0\n * \\@since 6.0.0 Renamed from `ContextMenuHookReturnValue` to\n * `ContextMenuImplementation` and dropped the `menuRef` and `menuNodeRef`\n * fields.\n */\nexport interface ContextMenuImplementation\n extends UseStateObject<\"visible\", boolean> {\n menuProps: ContextMenuProps;\n onContextMenu<E extends HTMLElement>(event: MouseEvent<E>): void;\n}\n\nconst noop = (): void => {\n // do nothing\n};\n\n/**\n * This hook controls the visibility and positioning for a context menu.\n *\n * @example\n * Simple Example\n * ```tsx\n * import type { ReactElement } from \"react\";\n * import [ Menu, MenuItem, useContextMenu ] from \"@react-md/core\":\n *\n * function Example(): ReactElement {\n * const { menuProps, onContextMenu } = useContextMenu();\n *\n * return (\n * <>\n * <textarea onContextMenu={onContextMenu} />\n * <Menu {...menuProps}>\n * <MenuItem>Cut</MenuItem>\n * <MenuItem>Copy</MenuItem>\n * <MenuItem>Paste</MenuItem>\n * <MenuItem>Undo</MenuItem>\n * </Menu>\n * </>\n * );\n * }\n * ```\n *\n * @remarks\n * \\@since 5.0.0\n * \\@since 6.0.0 No longer supports overriding most of the `Menu` props. The\n * props must be passed to the `Menu` component manually.\n */\nexport function useContextMenu(\n options: ContextMenuHookOptions = {}\n): ContextMenuImplementation {\n const {\n anchor = BELOW_INNER_LEFT_ANCHOR,\n menuLabel = \"Context Menu\",\n onContextMenu = noop,\n preventScroll = true,\n } = options;\n const [coords, setCoords] = useState<InitialCoords>({});\n const [visible, setVisible] = useState(false);\n const fixedTo = useRef<HTMLElement>(null);\n const onRequestClose = useCallback(() => {\n setVisible(false);\n }, []);\n\n return {\n visible,\n setVisible,\n menuProps: {\n \"aria-label\": menuLabel,\n anchor,\n ...coords,\n fixedTo,\n visible,\n onRequestClose,\n preventScroll,\n },\n onContextMenu(event) {\n onContextMenu(event);\n if (event.isPropagationStopped()) {\n return;\n }\n\n event.preventDefault();\n event.stopPropagation();\n setCoords({\n initialX: event.clientX,\n initialY: event.clientY,\n });\n setVisible(true);\n },\n };\n}\n"],"names":["useCallback","useRef","useState","BELOW_INNER_LEFT_ANCHOR","noop","useContextMenu","options","anchor","menuLabel","onContextMenu","preventScroll","coords","setCoords","visible","setVisible","fixedTo","onRequestClose","menuProps","event","isPropagationStopped","preventDefault","stopPropagation","initialX","clientX","initialY","clientY"],"mappings":"AAAA;AAEA,SAASA,WAAW,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,QAAQ;AACtD,SAASC,uBAAuB,QAAQ,8BAA8B;AAqDtE,MAAMC,OAAO;AACX,aAAa;AACf;AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8BC,GACD,OAAO,SAASC,eACdC,UAAkC,CAAC,CAAC;IAEpC,MAAM,EACJC,SAASJ,uBAAuB,EAChCK,YAAY,cAAc,EAC1BC,gBAAgBL,IAAI,EACpBM,gBAAgB,IAAI,EACrB,GAAGJ;IACJ,MAAM,CAACK,QAAQC,UAAU,GAAGV,SAAwB,CAAC;IACrD,MAAM,CAACW,SAASC,WAAW,GAAGZ,SAAS;IACvC,MAAMa,UAAUd,OAAoB;IACpC,MAAMe,iBAAiBhB,YAAY;QACjCc,WAAW;IACb,GAAG,EAAE;IAEL,OAAO;QACLD;QACAC;QACAG,WAAW;YACT,cAAcT;YACdD;YACA,GAAGI,MAAM;YACTI;YACAF;YACAG;YACAN;QACF;QACAD,eAAcS,KAAK;YACjBT,cAAcS;YACd,IAAIA,MAAMC,oBAAoB,IAAI;gBAChC;YACF;YAEAD,MAAME,cAAc;YACpBF,MAAMG,eAAe;YACrBT,UAAU;gBACRU,UAAUJ,MAAMK,OAAO;gBACvBC,UAAUN,MAAMO,OAAO;YACzB;YACAX,WAAW;QACb;IACF;AACF"}
|
package/dist/movement/types.d.ts
CHANGED
|
@@ -17,6 +17,23 @@ import type { NonNullMutableRef, NonNullRef, UseStateSetter } from "../types.js"
|
|
|
17
17
|
* @remarks \@since 6.0.0
|
|
18
18
|
*/
|
|
19
19
|
export type TabIndexBehavior = "roving" | "virtual";
|
|
20
|
+
/**
|
|
21
|
+
* This should be used for specific widgets that should not include all
|
|
22
|
+
* focusable elements and instead only specific elements.
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```ts
|
|
26
|
+
* const getExpansionPanelsOnly: GetFocusableElements = (container) =>
|
|
27
|
+
* [...container.querySelectorAll(".rmd-expansion-panel__button")];
|
|
28
|
+
*
|
|
29
|
+
* const getTreeItemsOnly: GetFocusableElements = (container) =>
|
|
30
|
+
* [...container.querySelectorAll("[role='treeitem']")];
|
|
31
|
+
* ```
|
|
32
|
+
*
|
|
33
|
+
* @defaultValue `getFocusableElements`
|
|
34
|
+
* @see the default `getFocusableElements` function.
|
|
35
|
+
*/
|
|
36
|
+
export type GetFocusableElements = (container: HTMLElement, programmatic: boolean) => readonly HTMLElement[];
|
|
20
37
|
/**
|
|
21
38
|
* @remarks \@since 5.0.0
|
|
22
39
|
*/
|
|
@@ -126,7 +143,12 @@ export type GetDefaultFocusedIndex = (options: FocusableIndexOptions) => number;
|
|
|
126
143
|
* @remarks \@since 6.0.0
|
|
127
144
|
* @internal
|
|
128
145
|
*/
|
|
129
|
-
export
|
|
146
|
+
export type ExtendKeyDown<E extends HTMLElement> = (movementData: KeyboardMovementExtensionData<E>) => void;
|
|
147
|
+
/**
|
|
148
|
+
* @remarks \@since 6.0.0
|
|
149
|
+
* @internal
|
|
150
|
+
*/
|
|
151
|
+
export interface KeyboardMovementFocusChangeEvent {
|
|
130
152
|
index: number;
|
|
131
153
|
element: HTMLElement;
|
|
132
154
|
}
|
|
@@ -134,7 +156,7 @@ export interface FocusChangeEvent {
|
|
|
134
156
|
* @remarks \@since 6.0.0
|
|
135
157
|
* @internal
|
|
136
158
|
*/
|
|
137
|
-
export type
|
|
159
|
+
export type KeyboardMovementFocusChangeEventHandler = (event: KeyboardMovementFocusChangeEvent) => void;
|
|
138
160
|
/**
|
|
139
161
|
* @remarks \@since 6.0.0
|
|
140
162
|
* @internal
|
|
@@ -155,14 +177,16 @@ export interface KeyboardMovementProviderOptions<E extends HTMLElement> extends
|
|
|
155
177
|
onClick?(event: MouseEvent<E>): void;
|
|
156
178
|
onFocus?(event: FocusEvent<E>): void;
|
|
157
179
|
onKeyDown?(event: KeyboardEvent<E>): void;
|
|
180
|
+
/** @defaultValue `false` */
|
|
181
|
+
disabled?: boolean;
|
|
158
182
|
/**
|
|
159
183
|
* This is used to implement custom keyboard movement for the `keydown` event.
|
|
160
184
|
*/
|
|
161
|
-
extendKeyDown
|
|
185
|
+
extendKeyDown?: ExtendKeyDown<E>;
|
|
162
186
|
/**
|
|
163
187
|
* Triggered whenever the focus changes.
|
|
164
188
|
*/
|
|
165
|
-
onFocusChange?:
|
|
189
|
+
onFocusChange?: KeyboardMovementFocusChangeEventHandler;
|
|
166
190
|
/**
|
|
167
191
|
* From what I've understood so far, programmatically focusable elements
|
|
168
192
|
* should only be included when disabled elements via `aria-disabled` are
|
|
@@ -171,28 +195,22 @@ export interface KeyboardMovementProviderOptions<E extends HTMLElement> extends
|
|
|
171
195
|
* @defaultValue `includeDisabled`
|
|
172
196
|
*/
|
|
173
197
|
programmatic?: boolean;
|
|
174
|
-
/**
|
|
175
|
-
|
|
176
|
-
* focusable elements and instead only specific elements.
|
|
177
|
-
*
|
|
178
|
-
* @example
|
|
179
|
-
* ```ts
|
|
180
|
-
* const getExpansionPanelsOnly = (container: HTMLElement): readonly HTMLElement[] =>
|
|
181
|
-
* container.querySelectorAll(".rmd-expansion-panel__button");
|
|
182
|
-
*
|
|
183
|
-
* const getTreeItemsOnly = (container: HTMLElement): readonly HTMLElement[] =>
|
|
184
|
-
* container.querySelectorAll("[role='treeitem']");
|
|
185
|
-
* ```
|
|
186
|
-
*
|
|
187
|
-
* @defaultValue `getFocusableElements`
|
|
188
|
-
* @see the default `getFocusableElements` function.
|
|
189
|
-
*/
|
|
190
|
-
getFocusableElements?(container: HTMLElement, programmatic: boolean): readonly HTMLElement[];
|
|
198
|
+
/** @see {@link GetFocusableElements} */
|
|
199
|
+
getFocusableElements?: GetFocusableElements;
|
|
191
200
|
/**
|
|
192
201
|
* This can be used to set the initial focus index whenever the container
|
|
193
202
|
* element is first focused or the focus index is `-1` on other focus events.
|
|
194
203
|
*/
|
|
195
204
|
getDefaultFocusedIndex?: GetDefaultFocusedIndex;
|
|
205
|
+
/**
|
|
206
|
+
* This was added to support editable combobox behavior. As the user types or
|
|
207
|
+
* uses native input keyboard behavior, the focus index should be reset to
|
|
208
|
+
* `-1` so that the next "ArrowDown" event focuses the first option again
|
|
209
|
+
* instead of the last selected one.
|
|
210
|
+
*
|
|
211
|
+
* @defaultValue `false`
|
|
212
|
+
*/
|
|
213
|
+
isNegativeOneAllowed?: boolean;
|
|
196
214
|
}
|
|
197
215
|
/**
|
|
198
216
|
* @remarks \@since 6.0.0
|
|
@@ -226,5 +244,6 @@ export interface KeyboardMovementProviderImplementation<E extends HTMLElement> {
|
|
|
226
244
|
movementProps: Readonly<KeyboardMovementProps<E>>;
|
|
227
245
|
movementContext: Readonly<KeyboardMovementContext>;
|
|
228
246
|
currentFocusIndex: NonNullMutableRef<number>;
|
|
247
|
+
activeDescendantId: string;
|
|
229
248
|
setActiveDescendantId: UseStateSetter<string>;
|
|
230
249
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/movement/types.ts"],"sourcesContent":["import type {\n FocusEvent,\n FocusEventHandler,\n KeyboardEvent,\n KeyboardEventHandler,\n MouseEvent,\n MouseEventHandler,\n} from \"react\";\nimport type {\n NonNullMutableRef,\n NonNullRef,\n UseStateSetter,\n} from \"../types.js\";\n\n/**\n * Set this to `\"roving\"` when:\n * - there are a group of focusable elements that have a `tabIndex={-1}`\n * - the container element defaults to having a `tabIndex={0}`\n * - if the container is focused, it should no longer be included in the normal\n * tab flow. Instead, the current focused element should be included instead\n * by changing its `tabIndex` from `-1` to `0`\n *\n * Set this to `\"virtual\"` when:\n * - the container element should never lose focus\n * - the \"focused\" element only gains focus styles instead of being focused\n * - the container element specifies an `aria-activedescendant` pointing to one\n * of the ids for the child \"focusable\" elements\n *\n * @remarks \\@since 6.0.0\n */\nexport type TabIndexBehavior = \"roving\" | \"virtual\";\n\n/**\n * @remarks \\@since 5.0.0\n */\nexport interface KeyboardMovementConfiguration {\n /**\n * A list of keys that will attempt to increment the focus index by 1.\n *\n * @defaultValue `[\"ArrowDown\"]`\n */\n incrementKeys?: readonly string[];\n\n /**\n * A list of keys that will attempt to decrement the focus index by 1.\n *\n * @defaultValue `[\"ArrowUp\"]`\n */\n decrementKeys?: readonly string[];\n\n /**\n * A list of keys that will set the focus index to `0`.\n *\n * @defaultValue `[\"Home\"]`\n */\n jumpToFirstKeys?: readonly string[];\n\n /**\n * A list of keys that will set the focus index to the last focusable index.\n *\n * @defaultValue `[\"End\"]`\n */\n jumpToLastKeys?: readonly string[];\n}\n\n/**\n * The defined {@link KeyboardMovementConfiguration} that should be used for\n * custom keyboard focus behavior.\n *\n * @remarks \\@since 5.0.0\n */\nexport type KeyboardMovementConfig = Required<KeyboardMovementConfiguration>;\n\n/**\n * @remarks \\@since 5.0.0\n */\nexport interface KeyboardMovementBehavior {\n /**\n * Boolean if pressing a letter will focus the next item in the\n * {@link KeyboardMovementProvider} that starts with the same letter.\n *\n * @defaultValue `false`\n */\n searchable?: boolean;\n\n /**\n * Boolean if the {@link KeyboardMovementProvider} should allow the focus behavior\n * to loop from the first to last or last to first item instead of preventing\n * any new focus behavior. In other words... if the last item is focused and\n * the user presses a key that should advance the focus to the next focusable\n * element, should the focus stay on the current element or loop back and\n * focus the first focusable item.\n *\n * @defaultValue `false`\n */\n loopable?: boolean;\n\n /**\n * Boolean if elements that are `aria-disabled` or `disabled` should still be\n * able to gain focus.\n *\n * @defaultValue `false`\n */\n includeDisabled?: boolean;\n\n /**\n * Boolean if the keyboard movement is horizontal instead of vertical. This\n * updates the default keyboard config to use `ArrowRight` and `ArrowLeft`\n * instead of `ArrowDown` and `ArrowUp`,\n *\n * @remarks \\@since 5.1.2\n * @defaultValue `false`\n */\n horizontal?: boolean;\n}\n\n/**\n * @remarks\n * \\@since 5.0.0\n * \\@since 6.0.0 Removed `attach`, `detach` and `watching`\n * @internal\n */\nexport interface KeyboardMovementContext\n extends Required<KeyboardMovementBehavior> {\n /** {@inheritDoc KeyboardMovementConfig} */\n config: NonNullRef<KeyboardMovementConfig>;\n\n /** @see {@link TabIndexBehavior} */\n tabIndexBehavior: TabIndexBehavior | undefined;\n\n /**\n * Note: This will only update if the {@link KeyboardMovementProviderOptions.tabIndexBehavior}\n * has been set to `\"roving\"` or `\"virtual\"`.\n */\n activeDescendantId: string;\n}\n\n/**\n * @remarks \\@since 6.0.0\n * @internal\n */\nexport interface FocusableIndexOptions {\n focusables: readonly HTMLElement[];\n includeDisabled: boolean;\n}\n\n/**\n * @remarks \\@since 6.0.0\n * @internal\n */\nexport type GetDefaultFocusedIndex = (options: FocusableIndexOptions) => number;\n\n/**\n * @remarks \\@since 6.0.0\n * @internal\n */\nexport interface
|
|
1
|
+
{"version":3,"sources":["../../src/movement/types.ts"],"sourcesContent":["import type {\n FocusEvent,\n FocusEventHandler,\n KeyboardEvent,\n KeyboardEventHandler,\n MouseEvent,\n MouseEventHandler,\n} from \"react\";\nimport type {\n NonNullMutableRef,\n NonNullRef,\n UseStateSetter,\n} from \"../types.js\";\n\n/**\n * Set this to `\"roving\"` when:\n * - there are a group of focusable elements that have a `tabIndex={-1}`\n * - the container element defaults to having a `tabIndex={0}`\n * - if the container is focused, it should no longer be included in the normal\n * tab flow. Instead, the current focused element should be included instead\n * by changing its `tabIndex` from `-1` to `0`\n *\n * Set this to `\"virtual\"` when:\n * - the container element should never lose focus\n * - the \"focused\" element only gains focus styles instead of being focused\n * - the container element specifies an `aria-activedescendant` pointing to one\n * of the ids for the child \"focusable\" elements\n *\n * @remarks \\@since 6.0.0\n */\nexport type TabIndexBehavior = \"roving\" | \"virtual\";\n\n/**\n * This should be used for specific widgets that should not include all\n * focusable elements and instead only specific elements.\n *\n * @example\n * ```ts\n * const getExpansionPanelsOnly: GetFocusableElements = (container) =>\n * [...container.querySelectorAll(\".rmd-expansion-panel__button\")];\n *\n * const getTreeItemsOnly: GetFocusableElements = (container) =>\n * [...container.querySelectorAll(\"[role='treeitem']\")];\n * ```\n *\n * @defaultValue `getFocusableElements`\n * @see the default `getFocusableElements` function.\n */\nexport type GetFocusableElements = (\n container: HTMLElement,\n programmatic: boolean\n) => readonly HTMLElement[];\n\n/**\n * @remarks \\@since 5.0.0\n */\nexport interface KeyboardMovementConfiguration {\n /**\n * A list of keys that will attempt to increment the focus index by 1.\n *\n * @defaultValue `[\"ArrowDown\"]`\n */\n incrementKeys?: readonly string[];\n\n /**\n * A list of keys that will attempt to decrement the focus index by 1.\n *\n * @defaultValue `[\"ArrowUp\"]`\n */\n decrementKeys?: readonly string[];\n\n /**\n * A list of keys that will set the focus index to `0`.\n *\n * @defaultValue `[\"Home\"]`\n */\n jumpToFirstKeys?: readonly string[];\n\n /**\n * A list of keys that will set the focus index to the last focusable index.\n *\n * @defaultValue `[\"End\"]`\n */\n jumpToLastKeys?: readonly string[];\n}\n\n/**\n * The defined {@link KeyboardMovementConfiguration} that should be used for\n * custom keyboard focus behavior.\n *\n * @remarks \\@since 5.0.0\n */\nexport type KeyboardMovementConfig = Required<KeyboardMovementConfiguration>;\n\n/**\n * @remarks \\@since 5.0.0\n */\nexport interface KeyboardMovementBehavior {\n /**\n * Boolean if pressing a letter will focus the next item in the\n * {@link KeyboardMovementProvider} that starts with the same letter.\n *\n * @defaultValue `false`\n */\n searchable?: boolean;\n\n /**\n * Boolean if the {@link KeyboardMovementProvider} should allow the focus behavior\n * to loop from the first to last or last to first item instead of preventing\n * any new focus behavior. In other words... if the last item is focused and\n * the user presses a key that should advance the focus to the next focusable\n * element, should the focus stay on the current element or loop back and\n * focus the first focusable item.\n *\n * @defaultValue `false`\n */\n loopable?: boolean;\n\n /**\n * Boolean if elements that are `aria-disabled` or `disabled` should still be\n * able to gain focus.\n *\n * @defaultValue `false`\n */\n includeDisabled?: boolean;\n\n /**\n * Boolean if the keyboard movement is horizontal instead of vertical. This\n * updates the default keyboard config to use `ArrowRight` and `ArrowLeft`\n * instead of `ArrowDown` and `ArrowUp`,\n *\n * @remarks \\@since 5.1.2\n * @defaultValue `false`\n */\n horizontal?: boolean;\n}\n\n/**\n * @remarks\n * \\@since 5.0.0\n * \\@since 6.0.0 Removed `attach`, `detach` and `watching`\n * @internal\n */\nexport interface KeyboardMovementContext\n extends Required<KeyboardMovementBehavior> {\n /** {@inheritDoc KeyboardMovementConfig} */\n config: NonNullRef<KeyboardMovementConfig>;\n\n /** @see {@link TabIndexBehavior} */\n tabIndexBehavior: TabIndexBehavior | undefined;\n\n /**\n * Note: This will only update if the {@link KeyboardMovementProviderOptions.tabIndexBehavior}\n * has been set to `\"roving\"` or `\"virtual\"`.\n */\n activeDescendantId: string;\n}\n\n/**\n * @remarks \\@since 6.0.0\n * @internal\n */\nexport interface FocusableIndexOptions {\n focusables: readonly HTMLElement[];\n includeDisabled: boolean;\n}\n\n/**\n * @remarks \\@since 6.0.0\n * @internal\n */\nexport type GetDefaultFocusedIndex = (options: FocusableIndexOptions) => number;\n\n/**\n * @remarks \\@since 6.0.0\n * @internal\n */\nexport type ExtendKeyDown<E extends HTMLElement> = (\n movementData: KeyboardMovementExtensionData<E>\n) => void;\n\n/**\n * @remarks \\@since 6.0.0\n * @internal\n */\nexport interface KeyboardMovementFocusChangeEvent {\n index: number;\n element: HTMLElement;\n}\n\n/**\n * @remarks \\@since 6.0.0\n * @internal\n */\nexport type KeyboardMovementFocusChangeEventHandler = (\n event: KeyboardMovementFocusChangeEvent\n) => void;\n\n/**\n * @remarks \\@since 6.0.0\n * @internal\n */\nexport interface KeyboardMovementExtensionData<E extends HTMLElement>\n extends KeyboardMovementContext {\n event: KeyboardEvent<E>;\n currentFocusIndex: NonNullMutableRef<number>;\n setFocusIndex(index: number, focusables: readonly HTMLElement[]): void;\n setActiveDescendantId(id: string): void;\n}\n\n/**\n * @remarks \\@since 6.0.0\n * @internal\n */\nexport interface KeyboardMovementProviderOptions<E extends HTMLElement>\n extends KeyboardMovementBehavior,\n KeyboardMovementConfiguration {\n /** @see {@link TabIndexBehavior} */\n tabIndexBehavior?: TabIndexBehavior;\n\n onClick?(event: MouseEvent<E>): void;\n onFocus?(event: FocusEvent<E>): void;\n onKeyDown?(event: KeyboardEvent<E>): void;\n\n /** @defaultValue `false` */\n disabled?: boolean;\n\n /**\n * This is used to implement custom keyboard movement for the `keydown` event.\n */\n extendKeyDown?: ExtendKeyDown<E>;\n\n /**\n * Triggered whenever the focus changes.\n */\n onFocusChange?: KeyboardMovementFocusChangeEventHandler;\n\n /**\n * From what I've understood so far, programmatically focusable elements\n * should only be included when disabled elements via `aria-disabled` are\n * allowed.\n *\n * @defaultValue `includeDisabled`\n */\n programmatic?: boolean;\n\n /** @see {@link GetFocusableElements} */\n getFocusableElements?: GetFocusableElements;\n\n /**\n * This can be used to set the initial focus index whenever the container\n * element is first focused or the focus index is `-1` on other focus events.\n */\n getDefaultFocusedIndex?: GetDefaultFocusedIndex;\n\n /**\n * This was added to support editable combobox behavior. As the user types or\n * uses native input keyboard behavior, the focus index should be reset to\n * `-1` so that the next \"ArrowDown\" event focuses the first option again\n * instead of the last selected one.\n *\n * @defaultValue `false`\n */\n isNegativeOneAllowed?: boolean;\n}\n\n/**\n * @remarks \\@since 6.0.0\n * @internal\n */\nexport interface KeyboardMovementProps<E extends HTMLElement> {\n /**\n * This will only be provided if the {@link KeyboardMovementContext.tabIndexBehavior}\n * is set to `\"virtual\"`.\n */\n \"aria-activedescendant\"?: string;\n\n /**\n * This will not be provided if the {@link KeyboardMovementContext.tabIndexBehavior}\n * is `undefined`. Otherwise:\n * - `0` when `\"virtual\"`\n * - `0` when `\"roving\"` and the container element has not been focused at\n * least once\n * - `-1` when `\"roving\"` and the container has been focused at least once\n * - a child element **should** have a `tabIndex={0}` instead\n */\n tabIndex?: number;\n onClick: MouseEventHandler<E>;\n onFocus: FocusEventHandler<E>;\n onKeyDown: KeyboardEventHandler<E>;\n}\n\n/**\n * @remarks \\@since 6.0.0\n * @internal\n */\nexport interface KeyboardMovementProviderImplementation<E extends HTMLElement> {\n movementProps: Readonly<KeyboardMovementProps<E>>;\n movementContext: Readonly<KeyboardMovementContext>;\n currentFocusIndex: NonNullMutableRef<number>;\n activeDescendantId: string;\n setActiveDescendantId: UseStateSetter<string>;\n}\n"],"names":[],"mappings":"AAoSA;;;CAGC,GACD,WAMC"}
|
|
@@ -157,7 +157,7 @@ const returnNegative1 = ()=>-1;
|
|
|
157
157
|
* @remarks \@since 6.0.0
|
|
158
158
|
* @internal
|
|
159
159
|
*/ export function useKeyboardMovementProvider(options = {}) {
|
|
160
|
-
const { onClick = noop, onFocus = noop, onKeyDown = noop, loopable = false, searchable = false, horizontal = false, includeDisabled = false, tabIndexBehavior, extendKeyDown = noop, onFocusChange = noop, programmatic = includeDisabled, incrementKeys: propIncrementKeys, decrementKeys: propDecrementKeys, jumpToFirstKeys: propJumpToFirstKeys, jumpToLastKeys: propJumpToLastKeys, getFocusableElements = defaultGetFocusableElements, getDefaultFocusedIndex = returnNegative1 } = options;
|
|
160
|
+
const { onClick = noop, onFocus = noop, onKeyDown = noop, loopable = false, disabled, searchable = false, horizontal = false, includeDisabled = false, tabIndexBehavior, extendKeyDown = noop, onFocusChange = noop, programmatic = includeDisabled, incrementKeys: propIncrementKeys, decrementKeys: propDecrementKeys, jumpToFirstKeys: propJumpToFirstKeys, jumpToLastKeys: propJumpToLastKeys, getFocusableElements = defaultGetFocusableElements, getDefaultFocusedIndex = returnNegative1, isNegativeOneAllowed = false } = options;
|
|
161
161
|
const isRTL = useDir().dir === "rtl";
|
|
162
162
|
let defaults;
|
|
163
163
|
if (horizontal) {
|
|
@@ -208,14 +208,21 @@ const returnNegative1 = ()=>-1;
|
|
|
208
208
|
};
|
|
209
209
|
}, []);
|
|
210
210
|
}
|
|
211
|
+
let tabIndex;
|
|
212
|
+
if (tabIndexBehavior) {
|
|
213
|
+
tabIndex = disabled || tabIndexBehavior === "roving" && activeDescendantId ? -1 : 0;
|
|
214
|
+
}
|
|
211
215
|
return {
|
|
212
216
|
movementProps: {
|
|
213
217
|
"aria-activedescendant": tabIndexBehavior === "virtual" ? activeDescendantId : undefined,
|
|
214
|
-
tabIndex
|
|
218
|
+
tabIndex,
|
|
215
219
|
// Note: This used to be on the `onFocus` event, but this causes issues in
|
|
216
220
|
// Chromium browsers for drag and drop behavior
|
|
217
221
|
onClick (event) {
|
|
218
222
|
onClick(event);
|
|
223
|
+
if (disabled) {
|
|
224
|
+
return;
|
|
225
|
+
}
|
|
219
226
|
// This makes it so you can click an element with a mouse and then
|
|
220
227
|
// keyboard navigate from that element instead of the last keyboard focus
|
|
221
228
|
// element
|
|
@@ -264,7 +271,7 @@ const returnNegative1 = ()=>-1;
|
|
|
264
271
|
// This allows my custom `getDefaultFocusedIndex` implementations to
|
|
265
272
|
// have a nice fallback without having to re-implement the "focus
|
|
266
273
|
// first" behavior
|
|
267
|
-
if (defaultFocusIndex === -1) {
|
|
274
|
+
if (!isNegativeOneAllowed && defaultFocusIndex === -1) {
|
|
268
275
|
if (tabIndexBehavior === "virtual") {
|
|
269
276
|
// virtual keyboard navigation **must** always focus at least one element
|
|
270
277
|
defaultFocusIndex = getVirtualFocusDefaultIndex({
|
|
@@ -301,6 +308,9 @@ const returnNegative1 = ()=>-1;
|
|
|
301
308
|
},
|
|
302
309
|
onKeyDown (event) {
|
|
303
310
|
onKeyDown(event);
|
|
311
|
+
if (disabled) {
|
|
312
|
+
return;
|
|
313
|
+
}
|
|
304
314
|
const { currentTarget } = event;
|
|
305
315
|
const setFocusIndex = (index, focusables)=>{
|
|
306
316
|
event.preventDefault();
|
|
@@ -338,7 +348,7 @@ const returnNegative1 = ()=>-1;
|
|
|
338
348
|
// TODO: Figure this part out. This is currently required for the tree
|
|
339
349
|
// movement when the asterisk key is pressed. There might be other cases
|
|
340
350
|
// as well.
|
|
341
|
-
if (currentFocusIndex.current === -1) {
|
|
351
|
+
if (!isNegativeOneAllowed && currentFocusIndex.current === -1) {
|
|
342
352
|
currentFocusIndex.current = recalculateFocusIndex({
|
|
343
353
|
focusables: getFocusableElements(currentTarget, programmatic),
|
|
344
354
|
includeDisabled,
|
|
@@ -403,6 +413,7 @@ const returnNegative1 = ()=>-1;
|
|
|
403
413
|
},
|
|
404
414
|
movementContext,
|
|
405
415
|
currentFocusIndex,
|
|
416
|
+
activeDescendantId,
|
|
406
417
|
setActiveDescendantId
|
|
407
418
|
};
|
|
408
419
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/movement/useKeyboardMovementProvider.ts"],"sourcesContent":["\"use client\";\nimport {\n createContext,\n useContext,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from \"react\";\nimport { getFocusableElements as defaultGetFocusableElements } from \"../focus/utils.js\";\nimport { useUserInteractionMode } from \"../interaction/UserInteractionModeProvider.js\";\nimport { useDir } from \"../typography/WritingDirectionProvider.js\";\nimport { useIsomorphicLayoutEffect } from \"../useIsomorphicLayoutEffect.js\";\nimport {\n DEFAULT_KEYBOARD_MOVEMENT,\n DEFAULT_LTR_KEYBOARD_MOVEMENT,\n DEFAULT_RTL_KEYBOARD_MOVEMENT,\n} from \"./constants.js\";\nimport { findMatchIndex } from \"./findMatchIndex.js\";\nimport type {\n KeyboardMovementConfig,\n KeyboardMovementConfiguration,\n KeyboardMovementContext,\n KeyboardMovementProviderImplementation,\n KeyboardMovementProviderOptions,\n} from \"./types.js\";\nimport {\n getFirstFocusableIndex,\n getLastFocusableIndex,\n getNextFocusableIndex,\n getSearchText,\n getVirtualFocusDefaultIndex,\n isElementDisabled,\n isNotFocusable,\n isSearchableEvent,\n recalculateFocusIndex,\n} from \"./utils.js\";\n\n/**\n * @remarks \\@since 5.0.0\n * @internal\n */\nconst context = createContext<KeyboardMovementContext>({\n config: { current: DEFAULT_KEYBOARD_MOVEMENT },\n loopable: false,\n searchable: false,\n horizontal: false,\n includeDisabled: false,\n tabIndexBehavior: undefined,\n activeDescendantId: \"\",\n});\ncontext.displayName = \"KeyboardMovement\";\nexport const { Provider: KeyboardMovementProvider } = context;\n\n/**\n * @remarks \\@since 5.0.0\n * @internal\n */\nexport function useKeyboardMovementContext(): Readonly<KeyboardMovementContext> {\n return useContext(context);\n}\n\nconst noop = (): void => {\n // do nothing\n};\n\nconst returnNegative1 = (): number => -1;\n\n/**\n * Implements the custom keyboard movement behavior throughout react-md. Using\n * the \"Find References\" will be the best way to see example usage.\n *\n * @example\n * Default Keyboard Movement for any Focusable Element\n * ```tsx\n * import {\n * KeyboardMovementProvider,\n * useKeyboardMovementProvider,\n * } from \"@react-md/core\";\n * import type { ReactElement, ReactNode } from \"react\";\n *\n * function Example({ children }: { children: ReactNode }): ReactElement {\n * const { movementContext, movementProps } = useKeyboardMovementProvider();\n *\n * // any focusable element child can be focused with the arrow , home, and\n * // end keys\n * return (\n * <KeyboardMovementProvider value={movementContext}>\n * <div {...movementProps}>\n * {children}\n * </div>\n * </KeyboardMovementProvider>\n * );\n * }\n * ```\n *\n * @example\n * Active Descendant Movement\n * ```tsx\n * import {\n * KeyboardMovementProvider,\n * useKeyboardMovementContext,\n * useKeyboardMovementProvider,\n * } from \"@react-md/core\";\n * import type { ReactElement, ReactNode } from \"react\";\n * import { useId } from \"react\";\n *\n * function Child(): ReactElement {\n * const id = useId()\n * const { activeDescendantId } = useKeyboardMovementContext();\n *\n * return (\n * <div\n * {...props}\n * id={id}\n * className={cnb(id === activeDescendantId && \"focused-class-name\")}\n * >\n * Some Content\n * </div>\n * );\n * }\n *\n * function Example({ children }: { children: ReactNode }): ReactElement {\n * const { movementContext, movementProps } = useKeyboardMovementProvider({\n * loopable: true,\n * searchable: true,\n * tabIndexBehavior: \"virtual\",\n * });\n *\n * // any focusable element child can be focused with the arrow , home, and\n * // end keys\n * return (\n * <KeyboardMovementProvider value={movementContext}>\n * <div {...movementProps}>\n * <Child />\n * <Child />\n * <Child />\n * </div>\n * </KeyboardMovementProvider>\n * );\n * }\n * ```\n *\n * @example\n * Roving Tab Index\n * ```tsx\n * import {\n * KeyboardMovementProvider,\n * useKeyboardMovementContext,\n * useKeyboardMovementProvider,\n * } from \"@react-md/core\";\n * import type { ReactElement, ReactNode } from \"react\";\n * import { useId } from \"react\";\n *\n * function Child(): ReactElement {\n * const id = useId()\n * const { activeDescendantId } = useKeyboardMovementContext();\n *\n * return (\n * <div\n * {...props}\n * id={id}\n * tabIndex={id === activeDescendantId ? 0 : -1}\n * >\n * Some Content\n * </div>\n * );\n * }\n *\n * function Example({ children }: { children: ReactNode }): ReactElement {\n * const { movementContext, movementProps } = useKeyboardMovementProvider({\n * loopable: true,\n * searchable: true,\n * tabIndexBehavior: \"roving\",\n * });\n *\n * // any focusable element child can be focused with the arrow , home, and\n * // end keys\n * return (\n * <KeyboardMovementProvider value={movementContext}>\n * <div {...movementProps}>\n * <Child />\n * <Child />\n * <Child />\n * </div>\n * </KeyboardMovementProvider>\n * );\n * }\n * ```\n * @remarks \\@since 6.0.0\n * @internal\n */\nexport function useKeyboardMovementProvider<E extends HTMLElement>(\n options: KeyboardMovementProviderOptions<E> = {}\n): KeyboardMovementProviderImplementation<E> {\n const {\n onClick = noop,\n onFocus = noop,\n onKeyDown = noop,\n loopable = false,\n searchable = false,\n horizontal = false,\n includeDisabled = false,\n tabIndexBehavior,\n extendKeyDown = noop,\n onFocusChange = noop,\n programmatic = includeDisabled,\n incrementKeys: propIncrementKeys,\n decrementKeys: propDecrementKeys,\n jumpToFirstKeys: propJumpToFirstKeys,\n jumpToLastKeys: propJumpToLastKeys,\n getFocusableElements = defaultGetFocusableElements,\n getDefaultFocusedIndex = returnNegative1,\n } = options;\n\n const isRTL = useDir().dir === \"rtl\";\n let defaults: Readonly<Required<KeyboardMovementConfiguration>>;\n if (horizontal) {\n defaults = isRTL\n ? DEFAULT_RTL_KEYBOARD_MOVEMENT\n : DEFAULT_LTR_KEYBOARD_MOVEMENT;\n } else {\n defaults = DEFAULT_KEYBOARD_MOVEMENT;\n }\n\n const incrementKeys = propIncrementKeys || defaults.incrementKeys;\n const decrementKeys = propDecrementKeys || defaults.decrementKeys;\n const jumpToFirstKeys = propJumpToFirstKeys || defaults.jumpToFirstKeys;\n const jumpToLastKeys = propJumpToLastKeys || defaults.jumpToLastKeys;\n\n const configuration: KeyboardMovementConfig = {\n incrementKeys,\n decrementKeys,\n jumpToFirstKeys,\n jumpToLastKeys,\n };\n const config = useRef(configuration);\n useIsomorphicLayoutEffect(() => {\n config.current = configuration;\n });\n\n const [activeDescendantId, setActiveDescendantId] = useState(\"\");\n const movementContext = useMemo<KeyboardMovementContext>(\n () => ({\n config,\n loopable,\n searchable,\n horizontal,\n includeDisabled,\n tabIndexBehavior,\n activeDescendantId,\n }),\n [\n activeDescendantId,\n horizontal,\n includeDisabled,\n loopable,\n searchable,\n tabIndexBehavior,\n ]\n );\n const currentFocusIndex = useRef(-1);\n const mode = useUserInteractionMode();\n const refocus = useRef(false);\n\n if (process.env.NODE_ENV !== \"production\") {\n // this fixes issues during hot reloading and using the `useId()` hook\n // eslint-disable-next-line react-hooks/rules-of-hooks\n useEffect(() => {\n return () => {\n setActiveDescendantId(\"\");\n };\n }, []);\n }\n\n return {\n movementProps: {\n \"aria-activedescendant\":\n tabIndexBehavior === \"virtual\" ? activeDescendantId : undefined,\n tabIndex:\n tabIndexBehavior === \"roving\"\n ? activeDescendantId\n ? -1\n : 0\n : undefined,\n\n // Note: This used to be on the `onFocus` event, but this causes issues in\n // Chromium browsers for drag and drop behavior\n onClick(event) {\n onClick(event);\n\n // This makes it so you can click an element with a mouse and then\n // keyboard navigate from that element instead of the last keyboard focus\n // element\n const { currentTarget, target } = event;\n if (target === currentTarget || !(target instanceof HTMLElement)) {\n return;\n }\n\n const focusables = getFocusableElements(currentTarget, programmatic);\n const focusedIndex = focusables.findIndex(\n (element) => element === target || element.contains(target)\n );\n if (focusedIndex === -1 || !focusables.length) {\n return;\n }\n\n currentFocusIndex.current = focusedIndex;\n const focused = focusables[focusedIndex];\n if (tabIndexBehavior) {\n setActiveDescendantId(focused.id);\n }\n\n // need to force focus back to the container element when using\n // aria activedescendant\n if (tabIndexBehavior === \"virtual\") {\n refocus.current = true;\n currentTarget.focus();\n }\n\n onFocusChange({\n index: focusedIndex,\n element: focused,\n });\n },\n onFocus(event) {\n onFocus(event);\n if (event.isPropagationStopped() || refocus.current) {\n refocus.current = false;\n return;\n }\n\n if (\n (mode !== \"keyboard\" && tabIndexBehavior !== \"virtual\") ||\n event.target !== event.currentTarget\n ) {\n return;\n }\n\n const focusables = getFocusableElements(\n event.currentTarget,\n programmatic\n );\n if (!focusables.length) {\n return;\n }\n\n let defaultFocusIndex = getDefaultFocusedIndex({\n focusables,\n includeDisabled,\n });\n\n // This allows my custom `getDefaultFocusedIndex` implementations to\n // have a nice fallback without having to re-implement the \"focus\n // first\" behavior\n if (defaultFocusIndex === -1) {\n if (tabIndexBehavior === \"virtual\") {\n // virtual keyboard navigation **must** always focus at least one element\n defaultFocusIndex = getVirtualFocusDefaultIndex({\n focusables,\n includeDisabled,\n activeDescendantId,\n });\n } else {\n defaultFocusIndex = getFirstFocusableIndex({\n focusables,\n includeDisabled,\n });\n }\n }\n\n if (defaultFocusIndex === -1) {\n return;\n }\n\n currentFocusIndex.current = defaultFocusIndex;\n const focused = focusables[defaultFocusIndex];\n if (tabIndexBehavior) {\n setActiveDescendantId(focused.id);\n }\n\n if (tabIndexBehavior !== \"virtual\") {\n focused.focus();\n } else {\n focused.scrollIntoView({ block: \"nearest\" });\n }\n\n onFocusChange({\n index: defaultFocusIndex,\n element: focused,\n });\n },\n onKeyDown(event) {\n onKeyDown(event);\n const { currentTarget } = event;\n\n const setFocusIndex = (\n index: number,\n focusables: readonly HTMLElement[]\n ): void => {\n event.preventDefault();\n event.stopPropagation();\n if (currentFocusIndex.current === index || index === -1) {\n return;\n }\n\n currentFocusIndex.current = index;\n const focused = focusables[index];\n if (tabIndexBehavior) {\n focused.scrollIntoView({\n block: \"nearest\",\n inline: \"nearest\",\n });\n setActiveDescendantId(focused.id);\n }\n\n if (tabIndexBehavior !== \"virtual\") {\n focused.focus();\n }\n\n onFocusChange({\n index,\n element: focused,\n });\n };\n\n extendKeyDown({\n event,\n setFocusIndex,\n currentFocusIndex,\n setActiveDescendantId,\n ...movementContext,\n });\n\n if (event.isPropagationStopped()) {\n return;\n }\n\n // TODO: Figure this part out. This is currently required for the tree\n // movement when the asterisk key is pressed. There might be other cases\n // as well.\n if (currentFocusIndex.current === -1) {\n currentFocusIndex.current = recalculateFocusIndex({\n focusables: getFocusableElements(currentTarget, programmatic),\n includeDisabled,\n tabIndexBehavior,\n activeDescendantId,\n });\n }\n\n const { key, shiftKey } = event;\n if (\n tabIndexBehavior === \"virtual\" &&\n activeDescendantId &&\n (key === \" \" || key === \"Enter\")\n ) {\n if (key === \" \") {\n event.preventDefault();\n }\n\n const focusables = getFocusableElements(currentTarget, programmatic);\n const activeElement = focusables[currentFocusIndex.current];\n if (!activeElement || isElementDisabled(activeElement)) {\n return;\n }\n\n activeElement.click();\n return;\n }\n\n const {\n incrementKeys,\n decrementKeys,\n jumpToFirstKeys,\n jumpToLastKeys,\n } = config.current;\n\n if (searchable && isSearchableEvent(event)) {\n const focusables = getFocusableElements(currentTarget, programmatic);\n const index = findMatchIndex({\n value: key,\n values: focusables.map((element) =>\n getSearchText(element, !isNotFocusable(element, includeDisabled))\n ),\n startIndex: shiftKey ? -1 : currentFocusIndex.current,\n });\n setFocusIndex(index, focusables);\n return;\n }\n\n const jumpToFirst = jumpToFirstKeys.includes(key);\n const jumpToLast = !jumpToFirst && jumpToLastKeys.includes(key);\n const increment =\n !jumpToFirst && !jumpToLast && incrementKeys.includes(key);\n const decrement =\n !jumpToFirst &&\n !jumpToLast &&\n !increment &&\n decrementKeys.includes(key);\n\n if (!jumpToFirst && !jumpToLast && !increment && !decrement) {\n return;\n }\n const focusables = getFocusableElements(currentTarget, programmatic);\n\n let index: number;\n if (jumpToFirst) {\n index = getFirstFocusableIndex({\n focusables,\n includeDisabled,\n });\n } else if (jumpToLast) {\n index = getLastFocusableIndex({\n focusables,\n includeDisabled,\n });\n } else {\n index = getNextFocusableIndex({\n loopable,\n increment,\n focusables,\n includeDisabled,\n currentFocusIndex: currentFocusIndex.current,\n });\n }\n\n setFocusIndex(index, focusables);\n },\n },\n movementContext,\n currentFocusIndex,\n setActiveDescendantId,\n };\n}\n"],"names":["createContext","useContext","useEffect","useMemo","useRef","useState","getFocusableElements","defaultGetFocusableElements","useUserInteractionMode","useDir","useIsomorphicLayoutEffect","DEFAULT_KEYBOARD_MOVEMENT","DEFAULT_LTR_KEYBOARD_MOVEMENT","DEFAULT_RTL_KEYBOARD_MOVEMENT","findMatchIndex","getFirstFocusableIndex","getLastFocusableIndex","getNextFocusableIndex","getSearchText","getVirtualFocusDefaultIndex","isElementDisabled","isNotFocusable","isSearchableEvent","recalculateFocusIndex","context","config","current","loopable","searchable","horizontal","includeDisabled","tabIndexBehavior","undefined","activeDescendantId","displayName","Provider","KeyboardMovementProvider","useKeyboardMovementContext","noop","returnNegative1","useKeyboardMovementProvider","options","onClick","onFocus","onKeyDown","extendKeyDown","onFocusChange","programmatic","incrementKeys","propIncrementKeys","decrementKeys","propDecrementKeys","jumpToFirstKeys","propJumpToFirstKeys","jumpToLastKeys","propJumpToLastKeys","getDefaultFocusedIndex","isRTL","dir","defaults","configuration","setActiveDescendantId","movementContext","currentFocusIndex","mode","refocus","process","env","NODE_ENV","movementProps","tabIndex","event","currentTarget","target","HTMLElement","focusables","focusedIndex","findIndex","element","contains","length","focused","id","focus","index","isPropagationStopped","defaultFocusIndex","scrollIntoView","block","setFocusIndex","preventDefault","stopPropagation","inline","key","shiftKey","activeElement","click","value","values","map","startIndex","jumpToFirst","includes","jumpToLast","increment","decrement"],"mappings":"AAAA;AACA,SACEA,aAAa,EACbC,UAAU,EACVC,SAAS,EACTC,OAAO,EACPC,MAAM,EACNC,QAAQ,QACH,QAAQ;AACf,SAASC,wBAAwBC,2BAA2B,QAAQ,oBAAoB;AACxF,SAAS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AW;oBAC3D;gBACF;gBACA,MAAM9B,aAAarE,qBAAqBkE,eAAezB;gBAEvD,IAAIqC;gBACJ,IAAIiB,aAAa;oBACfjB,QAAQrE,uBAAuB;wBAC7B4D;wBACA7C;oBACF;gBACF,OAAO,IAAIyE,YAAY;oBACrBnB,QAAQpE,sBAAsB;wBAC5B2D;wBACA7C;oBACF;gBACF,OAAO;oBACLsD,QAAQnE,sBAAsB;wBAC5BU;wBACA6E;wBACA7B;wBACA7C;wBACAiC,mBAAmBA,kBAAkBrC,OAAO;oBAC9C;gBACF;gBAEA+D,cAAcL,OAAOT;YACvB;QACF;QACAb;QACAC;QACAF;IACF;AACF"}
|
|
1
|
+
{"version":3,"sources":["../../src/movement/useKeyboardMovementProvider.ts"],"sourcesContent":["\"use client\";\nimport {\n createContext,\n useContext,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from \"react\";\nimport { getFocusableElements as defaultGetFocusableElements } from \"../focus/utils.js\";\nimport { useUserInteractionMode } from \"../interaction/UserInteractionModeProvider.js\";\nimport { useDir } from \"../typography/WritingDirectionProvider.js\";\nimport { useIsomorphicLayoutEffect } from \"../useIsomorphicLayoutEffect.js\";\nimport {\n DEFAULT_KEYBOARD_MOVEMENT,\n DEFAULT_LTR_KEYBOARD_MOVEMENT,\n DEFAULT_RTL_KEYBOARD_MOVEMENT,\n} from \"./constants.js\";\nimport { findMatchIndex } from \"./findMatchIndex.js\";\nimport type {\n KeyboardMovementConfig,\n KeyboardMovementConfiguration,\n KeyboardMovementContext,\n KeyboardMovementProviderImplementation,\n KeyboardMovementProviderOptions,\n} from \"./types.js\";\nimport {\n getFirstFocusableIndex,\n getLastFocusableIndex,\n getNextFocusableIndex,\n getSearchText,\n getVirtualFocusDefaultIndex,\n isElementDisabled,\n isNotFocusable,\n isSearchableEvent,\n recalculateFocusIndex,\n} from \"./utils.js\";\n\n/**\n * @remarks \\@since 5.0.0\n * @internal\n */\nconst context = createContext<KeyboardMovementContext>({\n config: { current: DEFAULT_KEYBOARD_MOVEMENT },\n loopable: false,\n searchable: false,\n horizontal: false,\n includeDisabled: false,\n tabIndexBehavior: undefined,\n activeDescendantId: \"\",\n});\ncontext.displayName = \"KeyboardMovement\";\nexport const { Provider: KeyboardMovementProvider } = context;\n\n/**\n * @remarks \\@since 5.0.0\n * @internal\n */\nexport function useKeyboardMovementContext(): Readonly<KeyboardMovementContext> {\n return useContext(context);\n}\n\nconst noop = (): void => {\n // do nothing\n};\n\nconst returnNegative1 = (): number => -1;\n\n/**\n * Implements the custom keyboard movement behavior throughout react-md. Using\n * the \"Find References\" will be the best way to see example usage.\n *\n * @example\n * Default Keyboard Movement for any Focusable Element\n * ```tsx\n * import {\n * KeyboardMovementProvider,\n * useKeyboardMovementProvider,\n * } from \"@react-md/core\";\n * import type { ReactElement, ReactNode } from \"react\";\n *\n * function Example({ children }: { children: ReactNode }): ReactElement {\n * const { movementContext, movementProps } = useKeyboardMovementProvider();\n *\n * // any focusable element child can be focused with the arrow , home, and\n * // end keys\n * return (\n * <KeyboardMovementProvider value={movementContext}>\n * <div {...movementProps}>\n * {children}\n * </div>\n * </KeyboardMovementProvider>\n * );\n * }\n * ```\n *\n * @example\n * Active Descendant Movement\n * ```tsx\n * import {\n * KeyboardMovementProvider,\n * useKeyboardMovementContext,\n * useKeyboardMovementProvider,\n * } from \"@react-md/core\";\n * import type { ReactElement, ReactNode } from \"react\";\n * import { useId } from \"react\";\n *\n * function Child(): ReactElement {\n * const id = useId()\n * const { activeDescendantId } = useKeyboardMovementContext();\n *\n * return (\n * <div\n * {...props}\n * id={id}\n * className={cnb(id === activeDescendantId && \"focused-class-name\")}\n * >\n * Some Content\n * </div>\n * );\n * }\n *\n * function Example({ children }: { children: ReactNode }): ReactElement {\n * const { movementContext, movementProps } = useKeyboardMovementProvider({\n * loopable: true,\n * searchable: true,\n * tabIndexBehavior: \"virtual\",\n * });\n *\n * // any focusable element child can be focused with the arrow , home, and\n * // end keys\n * return (\n * <KeyboardMovementProvider value={movementContext}>\n * <div {...movementProps}>\n * <Child />\n * <Child />\n * <Child />\n * </div>\n * </KeyboardMovementProvider>\n * );\n * }\n * ```\n *\n * @example\n * Roving Tab Index\n * ```tsx\n * import {\n * KeyboardMovementProvider,\n * useKeyboardMovementContext,\n * useKeyboardMovementProvider,\n * } from \"@react-md/core\";\n * import type { ReactElement, ReactNode } from \"react\";\n * import { useId } from \"react\";\n *\n * function Child(): ReactElement {\n * const id = useId()\n * const { activeDescendantId } = useKeyboardMovementContext();\n *\n * return (\n * <div\n * {...props}\n * id={id}\n * tabIndex={id === activeDescendantId ? 0 : -1}\n * >\n * Some Content\n * </div>\n * );\n * }\n *\n * function Example({ children }: { children: ReactNode }): ReactElement {\n * const { movementContext, movementProps } = useKeyboardMovementProvider({\n * loopable: true,\n * searchable: true,\n * tabIndexBehavior: \"roving\",\n * });\n *\n * // any focusable element child can be focused with the arrow , home, and\n * // end keys\n * return (\n * <KeyboardMovementProvider value={movementContext}>\n * <div {...movementProps}>\n * <Child />\n * <Child />\n * <Child />\n * </div>\n * </KeyboardMovementProvider>\n * );\n * }\n * ```\n * @remarks \\@since 6.0.0\n * @internal\n */\nexport function useKeyboardMovementProvider<E extends HTMLElement>(\n options: KeyboardMovementProviderOptions<E> = {}\n): KeyboardMovementProviderImplementation<E> {\n const {\n onClick = noop,\n onFocus = noop,\n onKeyDown = noop,\n loopable = false,\n disabled,\n searchable = false,\n horizontal = false,\n includeDisabled = false,\n tabIndexBehavior,\n extendKeyDown = noop,\n onFocusChange = noop,\n programmatic = includeDisabled,\n incrementKeys: propIncrementKeys,\n decrementKeys: propDecrementKeys,\n jumpToFirstKeys: propJumpToFirstKeys,\n jumpToLastKeys: propJumpToLastKeys,\n getFocusableElements = defaultGetFocusableElements,\n getDefaultFocusedIndex = returnNegative1,\n isNegativeOneAllowed = false,\n } = options;\n\n const isRTL = useDir().dir === \"rtl\";\n let defaults: Readonly<Required<KeyboardMovementConfiguration>>;\n if (horizontal) {\n defaults = isRTL\n ? DEFAULT_RTL_KEYBOARD_MOVEMENT\n : DEFAULT_LTR_KEYBOARD_MOVEMENT;\n } else {\n defaults = DEFAULT_KEYBOARD_MOVEMENT;\n }\n\n const incrementKeys = propIncrementKeys || defaults.incrementKeys;\n const decrementKeys = propDecrementKeys || defaults.decrementKeys;\n const jumpToFirstKeys = propJumpToFirstKeys || defaults.jumpToFirstKeys;\n const jumpToLastKeys = propJumpToLastKeys || defaults.jumpToLastKeys;\n\n const configuration: KeyboardMovementConfig = {\n incrementKeys,\n decrementKeys,\n jumpToFirstKeys,\n jumpToLastKeys,\n };\n const config = useRef(configuration);\n useIsomorphicLayoutEffect(() => {\n config.current = configuration;\n });\n\n const [activeDescendantId, setActiveDescendantId] = useState(\"\");\n const movementContext = useMemo<KeyboardMovementContext>(\n () => ({\n config,\n loopable,\n searchable,\n horizontal,\n includeDisabled,\n tabIndexBehavior,\n activeDescendantId,\n }),\n [\n activeDescendantId,\n horizontal,\n includeDisabled,\n loopable,\n searchable,\n tabIndexBehavior,\n ]\n );\n const currentFocusIndex = useRef(-1);\n const mode = useUserInteractionMode();\n const refocus = useRef(false);\n\n if (process.env.NODE_ENV !== \"production\") {\n // this fixes issues during hot reloading and using the `useId()` hook\n // eslint-disable-next-line react-hooks/rules-of-hooks\n useEffect(() => {\n return () => {\n setActiveDescendantId(\"\");\n };\n }, []);\n }\n\n let tabIndex: number | undefined;\n if (tabIndexBehavior) {\n tabIndex =\n disabled || (tabIndexBehavior === \"roving\" && activeDescendantId)\n ? -1\n : 0;\n }\n\n return {\n movementProps: {\n \"aria-activedescendant\":\n tabIndexBehavior === \"virtual\" ? activeDescendantId : undefined,\n tabIndex,\n\n // Note: This used to be on the `onFocus` event, but this causes issues in\n // Chromium browsers for drag and drop behavior\n onClick(event) {\n onClick(event);\n if (disabled) {\n return;\n }\n\n // This makes it so you can click an element with a mouse and then\n // keyboard navigate from that element instead of the last keyboard focus\n // element\n const { currentTarget, target } = event;\n if (target === currentTarget || !(target instanceof HTMLElement)) {\n return;\n }\n\n const focusables = getFocusableElements(currentTarget, programmatic);\n const focusedIndex = focusables.findIndex(\n (element) => element === target || element.contains(target)\n );\n if (focusedIndex === -1 || !focusables.length) {\n return;\n }\n\n currentFocusIndex.current = focusedIndex;\n const focused = focusables[focusedIndex];\n if (tabIndexBehavior) {\n setActiveDescendantId(focused.id);\n }\n\n // need to force focus back to the container element when using\n // aria activedescendant\n if (tabIndexBehavior === \"virtual\") {\n refocus.current = true;\n currentTarget.focus();\n }\n\n onFocusChange({\n index: focusedIndex,\n element: focused,\n });\n },\n onFocus(event) {\n onFocus(event);\n if (event.isPropagationStopped() || refocus.current) {\n refocus.current = false;\n return;\n }\n\n if (\n (mode !== \"keyboard\" && tabIndexBehavior !== \"virtual\") ||\n event.target !== event.currentTarget\n ) {\n return;\n }\n\n const focusables = getFocusableElements(\n event.currentTarget,\n programmatic\n );\n if (!focusables.length) {\n return;\n }\n\n let defaultFocusIndex = getDefaultFocusedIndex({\n focusables,\n includeDisabled,\n });\n\n // This allows my custom `getDefaultFocusedIndex` implementations to\n // have a nice fallback without having to re-implement the \"focus\n // first\" behavior\n if (!isNegativeOneAllowed && defaultFocusIndex === -1) {\n if (tabIndexBehavior === \"virtual\") {\n // virtual keyboard navigation **must** always focus at least one element\n defaultFocusIndex = getVirtualFocusDefaultIndex({\n focusables,\n includeDisabled,\n activeDescendantId,\n });\n } else {\n defaultFocusIndex = getFirstFocusableIndex({\n focusables,\n includeDisabled,\n });\n }\n }\n\n if (defaultFocusIndex === -1) {\n return;\n }\n\n currentFocusIndex.current = defaultFocusIndex;\n const focused = focusables[defaultFocusIndex];\n if (tabIndexBehavior) {\n setActiveDescendantId(focused.id);\n }\n\n if (tabIndexBehavior !== \"virtual\") {\n focused.focus();\n } else {\n focused.scrollIntoView({ block: \"nearest\" });\n }\n\n onFocusChange({\n index: defaultFocusIndex,\n element: focused,\n });\n },\n onKeyDown(event) {\n onKeyDown(event);\n if (disabled) {\n return;\n }\n\n const { currentTarget } = event;\n\n const setFocusIndex = (\n index: number,\n focusables: readonly HTMLElement[]\n ): void => {\n event.preventDefault();\n event.stopPropagation();\n if (currentFocusIndex.current === index || index === -1) {\n return;\n }\n\n currentFocusIndex.current = index;\n const focused = focusables[index];\n if (tabIndexBehavior) {\n focused.scrollIntoView({\n block: \"nearest\",\n inline: \"nearest\",\n });\n setActiveDescendantId(focused.id);\n }\n\n if (tabIndexBehavior !== \"virtual\") {\n focused.focus();\n }\n\n onFocusChange({\n index,\n element: focused,\n });\n };\n\n extendKeyDown({\n event,\n setFocusIndex,\n currentFocusIndex,\n setActiveDescendantId,\n ...movementContext,\n });\n\n if (event.isPropagationStopped()) {\n return;\n }\n\n // TODO: Figure this part out. This is currently required for the tree\n // movement when the asterisk key is pressed. There might be other cases\n // as well.\n if (!isNegativeOneAllowed && currentFocusIndex.current === -1) {\n currentFocusIndex.current = recalculateFocusIndex({\n focusables: getFocusableElements(currentTarget, programmatic),\n includeDisabled,\n tabIndexBehavior,\n activeDescendantId,\n });\n }\n\n const { key, shiftKey } = event;\n if (\n tabIndexBehavior === \"virtual\" &&\n activeDescendantId &&\n (key === \" \" || key === \"Enter\")\n ) {\n if (key === \" \") {\n event.preventDefault();\n }\n\n const focusables = getFocusableElements(currentTarget, programmatic);\n const activeElement = focusables[currentFocusIndex.current];\n if (!activeElement || isElementDisabled(activeElement)) {\n return;\n }\n\n activeElement.click();\n return;\n }\n\n const {\n incrementKeys,\n decrementKeys,\n jumpToFirstKeys,\n jumpToLastKeys,\n } = config.current;\n\n if (searchable && isSearchableEvent(event)) {\n const focusables = getFocusableElements(currentTarget, programmatic);\n const index = findMatchIndex({\n value: key,\n values: focusables.map((element) =>\n getSearchText(element, !isNotFocusable(element, includeDisabled))\n ),\n startIndex: shiftKey ? -1 : currentFocusIndex.current,\n });\n setFocusIndex(index, focusables);\n return;\n }\n\n const jumpToFirst = jumpToFirstKeys.includes(key);\n const jumpToLast = !jumpToFirst && jumpToLastKeys.includes(key);\n const increment =\n !jumpToFirst && !jumpToLast && incrementKeys.includes(key);\n const decrement =\n !jumpToFirst &&\n !jumpToLast &&\n !increment &&\n decrementKeys.includes(key);\n\n if (!jumpToFirst && !jumpToLast && !increment && !decrement) {\n return;\n }\n const focusables = getFocusableElements(currentTarget, programmatic);\n\n let index: number;\n if (jumpToFirst) {\n index = getFirstFocusableIndex({\n focusables,\n includeDisabled,\n });\n } else if (jumpToLast) {\n index = getLastFocusableIndex({\n focusables,\n includeDisabled,\n });\n } else {\n index = getNextFocusableIndex({\n loopable,\n increment,\n focusables,\n includeDisabled,\n currentFocusIndex: currentFocusIndex.current,\n });\n }\n\n setFocusIndex(index, focusables);\n },\n },\n movementContext,\n currentFocusIndex,\n activeDescendantId,\n setActiveDescendantId,\n };\n}\n"],"names":["createContext","useContext","useEffect","useMemo","useRef","useState","getFocusableElements","defaultGetFocusableElements","useUserInteractionMode","useDir","useIsomorphicLayoutEffect","DEFAULT_KEYBOARD_MOVEMENT","DEFAULT_LTR_KEYBOARD_MOVEMENT","DEFAULT_RTL_KEYBOARD_MOVEMENT","findMatchIndex","getFirstFocusableIndex","getLastFocusableIndex","getNextFocusableIndex","getSearchText","getVirtualFocusDefaultIndex","isElementDisabled","isNotFocusable","isSearchableEvent","recalculateFocusIndex","context","config","current","loopable","searchable","horizontal","includeDisabled","tabIndexBehavior","undefined","activeDescendantId","displayName","Provider","KeyboardMovementProvider","useKeyboardMovementContext","noop","returnNegative1","useKeyboardMovementProvider","options","onClick","onFocus","onKeyDown","disabled","extendKeyDown","onFocusChange","programmatic","incrementKeys","propIncrementKeys","decrementKeys","propDecrementKeys","jumpToFirstKeys","propJumpToFirstKeys","jumpToLastKeys","propJumpToLastKeys","getDefaultFocusedIndex","isNegativeOneAllowed","isRTL","dir","defaults","configuration","setActiveDescendantId","movementContext","currentFocusIndex","mode","refocus","process","env","NODE_ENV","tabIndex","movementProps","event","currentTarget","target","HTMLElement","focusables","focusedIndex","findIndex","element","contains","length","focused","id","focus","index","isPropagationStopped","defaultFocusIndex","scrollIntoView","block","setFocusIndex","preventDefault","stopPropagation","inline","key","shiftKey","activeElement","click","value","values","map","startIndex","jumpToFirst","includes","jumpToLast","increment","decrement"],"mappings":"AAAA;AACA,SACEA,aAAa,EACbC,UAAU,EACVC,SAAS,EACTC,OAAO,EACPC,MAAM,EACNC,QAAQ,QACH,QAAQ;AACf,SAASC,wBAAwBC,2BAA2B,QAAQ,oBAAoB;AACxF,SAASC,sBAAsB,QAAQ,gDAAgD;AACvF,SAASC,MAAM,QAAQ,4CAA4C;AACnE,SAASC,yBAAyB,QAAQ,kCAAkC;AAC5E,SACEC,yBAAyB,EACzBC,6BAA6B,EAC7BC,6BAA6B,QACxB,iBAAiB;AACxB,SAASC,cAAc,QAAQ,sBAAsB;AAQrD,SACEC,sBAAsB,EACtBC,qBAAqB,EACrBC,qBAAqB,EACrBC,aAAa,EACbC,2BAA2B,EAC3BC,iBAAiB,EACjBC,cAAc,EACdC,iBAAiB,EACjBC,qBAAqB,QAChB,aAAa;AAEpB;;;CAGC,GACD,MAAMC,UAAUxB,cAAuC;IACrDyB,QAAQ;QAAEC,SAASf;IAA0B;IAC7CgB,UAAU;IACVC,YAAY;IACZC,YAAY;IACZC,iBAAiB;IACjBC,kBAAkBC;IAClBC,oBAAoB;AACtB;AACAT,QAAQU,WAAW,GAAG;AACtB,OAAO,MAAM,EAAEC,UAAUC,wBAAwB,EAAE,GAAGZ,QAAQ;AAE9D;;;CAGC,GACD,OAAO,SAASa;IACd,OAAOpC,WAAWuB;AACpB;AAEA,MAAMc,OAAO;AACX,aAAa;AACf;AAEA,MAAMC,kBAAkB,IAAc,CAAC;AAEvC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2HC,GACD,OAAO,SAASC,4BACdC,UAA8C,CAAC,CAAC;IAEhD,MAAM,EACJC,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WwB,GAAG,CAAC,CAACrB,UACtB9D,cAAc8D,SAAS,CAAC3D,eAAe2D,SAASlD;wBAElDwE,YAAYN,WAAW,CAAC,IAAI/B,kBAAkBvC,OAAO;oBACvD;oBACAiE,cAAcL,OAAOT;oBACrB;gBACF;gBAEA,MAAM0B,cAAclD,gBAAgBmD,QAAQ,CAACT;gBAC7C,MAAMU,aAAa,CAACF,eAAehD,eAAeiD,QAAQ,CAACT;gBAC3D,MAAMW,YACJ,CAACH,eAAe,CAACE,cAAcxD,cAAcuD,QAAQ,CAACT;gBACxD,MAAMY,YACJ,CAACJ,eACD,CAACE,cACD,CAACC,aACDvD,cAAcqD,QAAQ,CAACT;gBAEzB,IAAI,CAACQ,eAAe,CAACE,cAAc,CAACC,aAAa,CAACC,WAAW;oBAC3D;gBACF;gBACA,MAAM9B,aAAavE,qBAAqBoE,eAAe1B;gBAEvD,IAAIsC;gBACJ,IAAIiB,aAAa;oBACfjB,QAAQvE,uBAAuB;wBAC7B8D;wBACA/C;oBACF;gBACF,OAAO,IAAI2E,YAAY;oBACrBnB,QAAQtE,sBAAsB;wBAC5B6D;wBACA/C;oBACF;gBACF,OAAO;oBACLwD,QAAQrE,sBAAsB;wBAC5BU;wBACA+E;wBACA7B;wBACA/C;wBACAmC,mBAAmBA,kBAAkBvC,OAAO;oBAC9C;gBACF;gBAEAiE,cAAcL,OAAOT;YACvB;QACF;QACAb;QACAC;QACAhC;QACA8B;IACF;AACF"}
|
package/dist/movement/utils.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type
|
|
2
|
-
import type
|
|
1
|
+
import { type KeyboardEvent } from "react";
|
|
2
|
+
import { type FocusableIndexOptions, type TabIndexBehavior } from "./types.js";
|
|
3
3
|
/**
|
|
4
4
|
* @remarks \@since 6.0.0
|
|
5
5
|
* @internal
|
|
@@ -86,4 +86,9 @@ export declare function recalculateFocusIndex(options: RecalculateOptions): numb
|
|
|
86
86
|
* @internal
|
|
87
87
|
*/
|
|
88
88
|
export declare function isSearchableEvent(event: KeyboardEvent): boolean;
|
|
89
|
+
/**
|
|
90
|
+
* @remarks \@since 6.0.0
|
|
91
|
+
* @internal
|
|
92
|
+
*/
|
|
93
|
+
export declare function isTypeEvent(event: KeyboardEvent): boolean;
|
|
89
94
|
export {};
|
package/dist/movement/utils.js
CHANGED
|
@@ -155,5 +155,15 @@ import { loop } from "../utils/loop.js";
|
|
|
155
155
|
return key.length === 1 && // can't search with space since it is generally a click event
|
|
156
156
|
key !== " " && !altKey && !ctrlKey && !metaKey;
|
|
157
157
|
}
|
|
158
|
+
/**
|
|
159
|
+
* @remarks \@since 6.0.0
|
|
160
|
+
* @internal
|
|
161
|
+
*/ export function isTypeEvent(event) {
|
|
162
|
+
return isSearchableEvent(event) || [
|
|
163
|
+
"Backspace",
|
|
164
|
+
"Delete",
|
|
165
|
+
" "
|
|
166
|
+
].includes(event.key);
|
|
167
|
+
}
|
|
158
168
|
|
|
159
169
|
//# sourceMappingURL=utils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/movement/utils.ts"],"sourcesContent":["import type { KeyboardEvent } from \"react\";\nimport { loop } from \"../utils/loop.js\";\nimport type { FocusableIndexOptions, TabIndexBehavior } from \"./types.js\";\n\n/**\n * @remarks \\@since 6.0.0\n * @internal\n */\nexport const isElementDisabled = (element: HTMLElement): boolean =>\n element.getAttribute(\"disabled\") !== null ||\n element.getAttribute(\"aria-disabled\") === \"true\";\n\n/**\n * @remarks \\@since 5.0.0\n * @internal\n */\nexport const isNotFocusable = (\n element: HTMLElement | undefined,\n includeDisabled: boolean\n): boolean => {\n if (!element) {\n return true;\n }\n\n if (includeDisabled) {\n return false;\n }\n\n return isElementDisabled(element);\n};\n\n/**\n * @remarks \\@since 6.0.0\n * @internal\n */\nexport interface VirtualFocusableIndexOptions {\n focusables: readonly HTMLElement[];\n includeDisabled: boolean;\n activeDescendantId: string;\n}\n\n/**\n * @remarks \\@since 6.0.0\n * @internal\n */\nexport const getVirtualFocusDefaultIndex = (\n options: VirtualFocusableIndexOptions\n): number => {\n const { focusables, includeDisabled, activeDescendantId } = options;\n if (!focusables.length || (!activeDescendantId && includeDisabled)) {\n return 0;\n }\n\n const activeIndex = focusables.findIndex((element) => {\n if (activeDescendantId) {\n return element.id === activeDescendantId;\n }\n\n return !isElementDisabled(element);\n });\n return Math.max(0, activeIndex);\n};\n\n/**\n * @remarks \\@since 5.0.0\n * @internal\n */\nexport const getFirstFocusableIndex = (\n options: FocusableIndexOptions\n): number => {\n const { focusables, includeDisabled } = options;\n\n if (!focusables.length) {\n return -1;\n }\n\n let firstIndex = 0;\n while (\n firstIndex < focusables.length - 1 &&\n isNotFocusable(focusables[firstIndex], includeDisabled)\n ) {\n firstIndex += 1;\n }\n\n if (isNotFocusable(focusables[firstIndex], includeDisabled)) {\n return -1;\n }\n\n return firstIndex;\n};\n\n/**\n * @remarks \\@since 5.0.0\n * @internal\n */\nexport const getLastFocusableIndex = (\n options: FocusableIndexOptions\n): number => {\n const { focusables, includeDisabled } = options;\n\n if (!focusables.length) {\n return -1;\n }\n\n let lastIndex = focusables.length - 1;\n while (\n lastIndex > 0 &&\n isNotFocusable(focusables[lastIndex], includeDisabled)\n ) {\n lastIndex -= 1;\n }\n\n if (isNotFocusable(focusables[lastIndex], includeDisabled)) {\n return -1;\n }\n\n return lastIndex;\n};\n\n/**\n * @remarks \\@since 5.0.0\n * @internal\n */\ninterface NextFocusableIndexOptions extends FocusableIndexOptions {\n loopable: boolean;\n increment: boolean;\n currentFocusIndex: number;\n}\n\n/**\n * @remarks \\@since 5.0.0\n * @internal\n */\nexport const getNextFocusableIndex = (\n options: NextFocusableIndexOptions\n): number => {\n const {\n loopable,\n increment,\n focusables,\n includeDisabled,\n currentFocusIndex,\n } = options;\n if (!focusables.length) {\n return currentFocusIndex;\n }\n\n const min = getFirstFocusableIndex({ focusables, includeDisabled });\n const max = getLastFocusableIndex({ focusables, includeDisabled });\n let nextIndex = loop({\n min,\n max,\n value: currentFocusIndex,\n minmax: !loopable,\n increment,\n });\n while (\n isNotFocusable(focusables[nextIndex], includeDisabled) &&\n (loopable || nextIndex !== (increment ? max : min))\n ) {\n nextIndex = loop({\n min,\n max,\n value: nextIndex,\n minmax: !loopable,\n increment,\n });\n }\n\n // Since the `min` and `max` values are \"safely\" set, I don't need to verify\n // the nextIndex is still focusable\n return nextIndex;\n};\n\n/**\n * @remarks \\@since 5.0.0\n * @internal\n */\nexport function getSearchText(\n element: HTMLElement,\n searchable: boolean\n): string {\n if (!searchable) {\n return \"\";\n }\n\n const cloned = element.cloneNode(true) as HTMLElement;\n cloned\n .querySelectorAll(\n // Note: do not include DISPLAY_NONE_CLASS since it is presentational only\n \".rmd-icon--font,[aria-hidden=true],[hidden],[role=presentation]\"\n )\n .forEach((element) => {\n element.parentNode?.removeChild(element);\n });\n\n // Note: It would be good to use `cloned.innerText` (maybe?) at some point,\n // but it returns `undefined` in jsdom. It also does cause a reflow, so maybe\n // this is fine?\n // https://developer.mozilla.org/en-US/docs/Web/API/Node/textContent#differences_from_innertext\n return (cloned.textContent || \"\")[0].toUpperCase();\n}\n\n/**\n * @remarks \\@since 6.0.0\n * @internal\n */\nexport interface RecalculateOptions {\n focusables: readonly HTMLElement[];\n includeDisabled: boolean;\n tabIndexBehavior: TabIndexBehavior | undefined;\n activeDescendantId: string;\n}\n\n/**\n * This was added to help with specific widgets that cause focus index to change\n * between renders (i.e. expanding all tree items on the same level with `*`).\n * There might be a better way to handle this in the future.\n *\n * @remarks \\@since 6.0.0\n * @internal\n */\nexport function recalculateFocusIndex(options: RecalculateOptions): number {\n const { focusables, includeDisabled, tabIndexBehavior, activeDescendantId } =\n options;\n if (tabIndexBehavior === \"virtual\") {\n return getVirtualFocusDefaultIndex({\n focusables,\n includeDisabled,\n activeDescendantId,\n });\n }\n\n const { activeElement } = document;\n return focusables.findIndex((element) => element === activeElement);\n}\n\n/**\n * Checks if a keyboard event can trigger a search through focusable elements\n * by:\n *\n * - checking if the key is a single letter that is not the space key\n * - checking that the alt, ctrl, and meta keys are not being held\n *\n * The shift key **is allowed** because holding shift means \"search from the\n * beginning\" instead of \"search from current location\".\n *\n * @remarks \\@since 6.0.0\n * @internal\n */\nexport function isSearchableEvent(event: KeyboardEvent): boolean {\n const { key, altKey, ctrlKey, metaKey } = event;\n\n return (\n key.length === 1 &&\n // can't search with space since it is generally a click event\n key !== \" \" &&\n !altKey &&\n !ctrlKey &&\n !metaKey\n );\n}\n"],"names":["loop","isElementDisabled","element","getAttribute","isNotFocusable","includeDisabled","getVirtualFocusDefaultIndex","options","focusables","activeDescendantId","length","activeIndex","findIndex","id","Math","max","getFirstFocusableIndex","firstIndex","getLastFocusableIndex","lastIndex","getNextFocusableIndex","loopable","increment","currentFocusIndex","min","nextIndex","value","minmax","getSearchText","searchable","cloned","cloneNode","querySelectorAll","forEach","parentNode","removeChild","textContent","toUpperCase","recalculateFocusIndex","tabIndexBehavior","activeElement","document","isSearchableEvent","event","key","altKey","ctrlKey","metaKey"],"mappings":"AACA,SAASA,IAAI,QAAQ,mBAAmB;AAGxC;;;CAGC,GACD,OAAO,MAAMC,oBAAoB,CAACC,UAChCA,QAAQC,YAAY,CAAC,gBAAgB,QACrCD,QAAQC,YAAY,CAAC,qBAAqB,OAAO;AAEnD;;;CAGC,GACD,OAAO,MAAMC,iBAAiB,CAC5BF,SACAG;IAEA,IAAI,CAACH,SAAS;QACZ,OAAO;IACT;IAEA,IAAIG,iBAAiB;QACnB,OAAO;IACT;IAEA,OAAOJ,kBAAkBC;AAC3B,EAAE;AAYF;;;CAGC,GACD,OAAO,MAAMI,8BAA8B,CACzCC;IAEA,MAAM,EAAEC,UAAU,EAAEH,eAAe,EAAEI,kBAAkB,EAAE,GAAGF;IAC5D,IAAI,CAACC,WAAWE,MAAM,IAAK,CAACD,sBAAsBJ,iBAAkB;QAClE,OAAO;IACT;IAEA,MAAMM,cAAcH,WAAWI,SAAS,CAAC,CAACV;QACxC,IAAIO,oBAAoB;YAC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R,CAACC,UACD,CAACC,WACD,CAACC;AAEL"}
|
|
1
|
+
{"version":3,"sources":["../../src/movement/utils.ts"],"sourcesContent":["import { type KeyboardEvent } from \"react\";\nimport { loop } from \"../utils/loop.js\";\nimport { type FocusableIndexOptions, type TabIndexBehavior } from \"./types.js\";\n\n/**\n * @remarks \\@since 6.0.0\n * @internal\n */\nexport const isElementDisabled = (element: HTMLElement): boolean =>\n element.getAttribute(\"disabled\") !== null ||\n element.getAttribute(\"aria-disabled\") === \"true\";\n\n/**\n * @remarks \\@since 5.0.0\n * @internal\n */\nexport const isNotFocusable = (\n element: HTMLElement | undefined,\n includeDisabled: boolean\n): boolean => {\n if (!element) {\n return true;\n }\n\n if (includeDisabled) {\n return false;\n }\n\n return isElementDisabled(element);\n};\n\n/**\n * @remarks \\@since 6.0.0\n * @internal\n */\nexport interface VirtualFocusableIndexOptions {\n focusables: readonly HTMLElement[];\n includeDisabled: boolean;\n activeDescendantId: string;\n}\n\n/**\n * @remarks \\@since 6.0.0\n * @internal\n */\nexport const getVirtualFocusDefaultIndex = (\n options: VirtualFocusableIndexOptions\n): number => {\n const { focusables, includeDisabled, activeDescendantId } = options;\n if (!focusables.length || (!activeDescendantId && includeDisabled)) {\n return 0;\n }\n\n const activeIndex = focusables.findIndex((element) => {\n if (activeDescendantId) {\n return element.id === activeDescendantId;\n }\n\n return !isElementDisabled(element);\n });\n return Math.max(0, activeIndex);\n};\n\n/**\n * @remarks \\@since 5.0.0\n * @internal\n */\nexport const getFirstFocusableIndex = (\n options: FocusableIndexOptions\n): number => {\n const { focusables, includeDisabled } = options;\n\n if (!focusables.length) {\n return -1;\n }\n\n let firstIndex = 0;\n while (\n firstIndex < focusables.length - 1 &&\n isNotFocusable(focusables[firstIndex], includeDisabled)\n ) {\n firstIndex += 1;\n }\n\n if (isNotFocusable(focusables[firstIndex], includeDisabled)) {\n return -1;\n }\n\n return firstIndex;\n};\n\n/**\n * @remarks \\@since 5.0.0\n * @internal\n */\nexport const getLastFocusableIndex = (\n options: FocusableIndexOptions\n): number => {\n const { focusables, includeDisabled } = options;\n\n if (!focusables.length) {\n return -1;\n }\n\n let lastIndex = focusables.length - 1;\n while (\n lastIndex > 0 &&\n isNotFocusable(focusables[lastIndex], includeDisabled)\n ) {\n lastIndex -= 1;\n }\n\n if (isNotFocusable(focusables[lastIndex], includeDisabled)) {\n return -1;\n }\n\n return lastIndex;\n};\n\n/**\n * @remarks \\@since 5.0.0\n * @internal\n */\ninterface NextFocusableIndexOptions extends FocusableIndexOptions {\n loopable: boolean;\n increment: boolean;\n currentFocusIndex: number;\n}\n\n/**\n * @remarks \\@since 5.0.0\n * @internal\n */\nexport const getNextFocusableIndex = (\n options: NextFocusableIndexOptions\n): number => {\n const {\n loopable,\n increment,\n focusables,\n includeDisabled,\n currentFocusIndex,\n } = options;\n if (!focusables.length) {\n return currentFocusIndex;\n }\n\n const min = getFirstFocusableIndex({ focusables, includeDisabled });\n const max = getLastFocusableIndex({ focusables, includeDisabled });\n let nextIndex = loop({\n min,\n max,\n value: currentFocusIndex,\n minmax: !loopable,\n increment,\n });\n while (\n isNotFocusable(focusables[nextIndex], includeDisabled) &&\n (loopable || nextIndex !== (increment ? max : min))\n ) {\n nextIndex = loop({\n min,\n max,\n value: nextIndex,\n minmax: !loopable,\n increment,\n });\n }\n\n // Since the `min` and `max` values are \"safely\" set, I don't need to verify\n // the nextIndex is still focusable\n return nextIndex;\n};\n\n/**\n * @remarks \\@since 5.0.0\n * @internal\n */\nexport function getSearchText(\n element: HTMLElement,\n searchable: boolean\n): string {\n if (!searchable) {\n return \"\";\n }\n\n const cloned = element.cloneNode(true) as HTMLElement;\n cloned\n .querySelectorAll(\n // Note: do not include DISPLAY_NONE_CLASS since it is presentational only\n \".rmd-icon--font,[aria-hidden=true],[hidden],[role=presentation]\"\n )\n .forEach((element) => {\n element.parentNode?.removeChild(element);\n });\n\n // Note: It would be good to use `cloned.innerText` (maybe?) at some point,\n // but it returns `undefined` in jsdom. It also does cause a reflow, so maybe\n // this is fine?\n // https://developer.mozilla.org/en-US/docs/Web/API/Node/textContent#differences_from_innertext\n return (cloned.textContent || \"\")[0].toUpperCase();\n}\n\n/**\n * @remarks \\@since 6.0.0\n * @internal\n */\nexport interface RecalculateOptions {\n focusables: readonly HTMLElement[];\n includeDisabled: boolean;\n tabIndexBehavior: TabIndexBehavior | undefined;\n activeDescendantId: string;\n}\n\n/**\n * This was added to help with specific widgets that cause focus index to change\n * between renders (i.e. expanding all tree items on the same level with `*`).\n * There might be a better way to handle this in the future.\n *\n * @remarks \\@since 6.0.0\n * @internal\n */\nexport function recalculateFocusIndex(options: RecalculateOptions): number {\n const { focusables, includeDisabled, tabIndexBehavior, activeDescendantId } =\n options;\n if (tabIndexBehavior === \"virtual\") {\n return getVirtualFocusDefaultIndex({\n focusables,\n includeDisabled,\n activeDescendantId,\n });\n }\n\n const { activeElement } = document;\n return focusables.findIndex((element) => element === activeElement);\n}\n\n/**\n * Checks if a keyboard event can trigger a search through focusable elements\n * by:\n *\n * - checking if the key is a single letter that is not the space key\n * - checking that the alt, ctrl, and meta keys are not being held\n *\n * The shift key **is allowed** because holding shift means \"search from the\n * beginning\" instead of \"search from current location\".\n *\n * @remarks \\@since 6.0.0\n * @internal\n */\nexport function isSearchableEvent(event: KeyboardEvent): boolean {\n const { key, altKey, ctrlKey, metaKey } = event;\n\n return (\n key.length === 1 &&\n // can't search with space since it is generally a click event\n key !== \" \" &&\n !altKey &&\n !ctrlKey &&\n !metaKey\n );\n}\n\n/**\n * @remarks \\@since 6.0.0\n * @internal\n */\nexport function isTypeEvent(event: KeyboardEvent): boolean {\n return (\n isSearchableEvent(event) || [\"Backspace\", \"Delete\", \" \"].includes(event.key)\n );\n}\n"],"names":["loop","isElementDisabled","element","getAttribute","isNotFocusable","includeDisabled","getVirtualFocusDefaultIndex","options","focusables","activeDescendantId","length","activeIndex","findIndex","id","Math","max","getFirstFocusableIndex","firstIndex","getLastFocusableIndex","lastIndex","getNextFocusableIndex","loopable","increment","currentFocusIndex","min","nextIndex","value","minmax","getSearchText","searchable","cloned","cloneNode","querySelectorAll","forEach","parentNode","removeChild","textContent","toUpperCase","recalculateFocusIndex","tabIndexBehavior","activeElement","document","isSearchableEvent","event","key","altKey","ctrlKey","metaKey","isTypeEvent","includes"],"mappings":"AACA,SAASA,IAAI,QAAQ,mBAAmB;AAGxC;;;CAGC,GACD,OAAO,MAAMC,oBAAoB,CAACC,UAChCA,QAAQC,YAAY,CAAC,gBAAgB,QACrCD,QAAQC,YAAY,CAAC,qBAAqB,OAAO;AAEnD;;;CAGC,GACD,OAAO,MAAMC,iBAAiB,CAC5BF,SACAG;IAEA,IAAI,CAACH,SAAS;QACZ,OAAO;IACT;IAEA,IAAIG,iBAAiB;QACnB,OAAO;IACT;IAEA,OAAOJ,kBAAkBC;AAC3B,EAAE;AAYF;;;CAGC,GACD,OAAO,MAAMI,8BAA8B,CACzCC;IAEA,MAAM,EAAEC,UAAU,EAAEH,eAAe,EAAEI,kBAAkB,EAAE,GAAGF;IAC5D,IAAI,CAACC,WAAWE,MAAM,IAAK,CAACD,sBAAsBJ,iBAAkB;QAClE,OAAO;IACT;IAEA,MAAMM,cAAcH,WAAWI,SAAS,CAAC,CAACV;QACxC,IAAIO,oBAAoB;YACtB,OAAOP,QAAQW,EAAE,KAAKJ;QACxB;QAEA,OAAO,CAACR,kBAAkBC;IAC5B;IACA,OAAOY,KAAKC,GAAG,CAAC,GAAGJ;AACrB,EAAE;AAEF;;;CAGC,GACD,OAAO,MAAMK,yBAAyB,CACpCT;IAEA,MAAM,EAAEC,UAAU,EAAEH,eAAe,EAAE,GAAGE;IAExC,IAAI,CAACC,WAAWE,MAAM,EAAE;QACtB,OAAO,CAAC;IACV;IAEA,IAAIO,aAAa;IACjB,MACEA,aAAaT,WAAWE,MAAM,GAAG,KACjCN,eAAeI,UAAU,CAACS,WAAW,EAAEZ,iBACvC;QACAY,cAAc;IAChB;IAEA,IAAIb,eAAeI,UAAU,CAACS,WAAW,EAAE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E,gBAAgB,CACf,0EAA0E;IAC1E,mEAEDC,OAAO,CAAC,CAAC/B;QACRA,QAAQgC,UAAU,EAAEC,YAAYjC;IAClC;IAEF,2EAA2E;IAC3E,6EAA6E;IAC7E,gBAAgB;IAChB,+FAA+F;IAC/F,OAAO,AAAC4B,CAAAA,OAAOM,WAAW,IAAI,EAAC,CAAE,CAAC,EAAE,CAACC,WAAW;AAClD;AAaA;;;;;;;CAOC,GACD,OAAO,SAASC,sBAAsB/B,OAA2B;IAC/D,MAAM,EAAEC,UAAU,EAAEH,eAAe,EAAEkC,gBAAgB,EAAE9B,kBAAkB,EAAE,GACzEF;IACF,IAAIgC,qBAAqB,WAAW;QAClC,OAAOjC,4BAA4B;YACjCE;YACAH;YACAI;QACF;IACF;IAEA,MAAM,EAAE+B,aAAa,EAAE,GAAGC;IAC1B,OAAOjC,WAAWI,SAAS,CAAC,CAACV,UAAYA,YAAYsC;AACvD;AAEA;;;;;;;;;;;;CAYC,GACD,OAAO,SAASE,kBAAkBC,KAAoB;IACpD,MAAM,EAAEC,GAAG,EAAEC,MAAM,EAAEC,OAAO,EAAEC,OAAO,EAAE,GAAGJ;IAE1C,OACEC,IAAIlC,MAAM,KAAK,KACf,8DAA8D;IAC9DkC,QAAQ,OACR,CAACC,UACD,CAACC,WACD,CAACC;AAEL;AAEA;;;CAGC,GACD,OAAO,SAASC,YAAYL,KAAoB;IAC9C,OACED,kBAAkBC,UAAU;QAAC;QAAa;QAAU;KAAI,CAACM,QAAQ,CAACN,MAAMC,GAAG;AAE/E"}
|
|
@@ -9,68 +9,65 @@ $z-index: utils.$temporary-element-z-index !default;
|
|
|
9
9
|
$transition-duration: transition.$linear-duration !default;
|
|
10
10
|
$transition-timing-function: transition.$linear-timing-function !default;
|
|
11
11
|
|
|
12
|
-
$
|
|
13
|
-
background-color: (
|
|
14
|
-
var: --rmd-overlay-background-color,
|
|
15
|
-
value: $background-color,
|
|
16
|
-
),
|
|
17
|
-
z-index: (
|
|
18
|
-
var: --rmd-overlay-z-index,
|
|
19
|
-
value: $z-index,
|
|
20
|
-
),
|
|
21
|
-
);
|
|
12
|
+
$variables: (background-color, z-index);
|
|
22
13
|
|
|
23
14
|
@function get-var($name, $fallback: null) {
|
|
24
|
-
$
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
@if $value {
|
|
29
|
-
@return var(#{$var}, #{$value});
|
|
15
|
+
$var: utils.get-var-name($variables, $name, "overlay");
|
|
16
|
+
@if $fallback {
|
|
17
|
+
@return var(#{$var}, #{$fallback});
|
|
30
18
|
}
|
|
31
19
|
|
|
32
20
|
@return var(#{$var});
|
|
33
21
|
}
|
|
34
22
|
|
|
35
23
|
@mixin set-var($name, $value) {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
24
|
+
@if $value {
|
|
25
|
+
#{utils.get-var-name($variables, $name, "overlay")}: #{$value};
|
|
26
|
+
}
|
|
39
27
|
}
|
|
40
28
|
|
|
41
29
|
@mixin use-var($property, $name: $property, $fallback: null) {
|
|
42
30
|
#{$property}: get-var($name, $fallback);
|
|
43
31
|
}
|
|
44
32
|
|
|
45
|
-
@mixin
|
|
33
|
+
@mixin variables {
|
|
34
|
+
@if not $disable-everything {
|
|
35
|
+
@include set-var(background-color, $background-color);
|
|
36
|
+
@include set-var(z-index, $z-index);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
@mixin styles($disable-layer: false) {
|
|
46
41
|
@if not $disable-everything {
|
|
47
|
-
.
|
|
48
|
-
|
|
49
|
-
|
|
42
|
+
@include utils.optional-layer(overlay, $disable-layer) {
|
|
43
|
+
.rmd-overlay {
|
|
44
|
+
@include use-var(background-color);
|
|
45
|
+
@include use-var(z-index);
|
|
50
46
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
47
|
+
border-radius: inherit;
|
|
48
|
+
box-shadow: inherit;
|
|
49
|
+
inset: 0;
|
|
50
|
+
opacity: 0;
|
|
51
|
+
pointer-events: none;
|
|
52
|
+
position: fixed;
|
|
53
|
+
transition: opacity $transition-duration $transition-timing-function;
|
|
58
54
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
55
|
+
&--active {
|
|
56
|
+
opacity: 1;
|
|
57
|
+
}
|
|
62
58
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
59
|
+
&--clickable {
|
|
60
|
+
cursor: pointer;
|
|
61
|
+
}
|
|
66
62
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
63
|
+
&--visible {
|
|
64
|
+
overflow: hidden;
|
|
65
|
+
pointer-events: auto;
|
|
66
|
+
}
|
|
71
67
|
|
|
72
|
-
|
|
73
|
-
|
|
68
|
+
&--absolute {
|
|
69
|
+
position: absolute;
|
|
70
|
+
}
|
|
74
71
|
}
|
|
75
72
|
}
|
|
76
73
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type ReactElement, type ReactNode } from "react";
|
|
1
|
+
import { type ReactElement, type ReactNode, type RefObject } from "react";
|
|
2
2
|
/**
|
|
3
3
|
* @internal
|
|
4
4
|
* @remarks \@since 6.0.0
|
|
@@ -17,7 +17,7 @@ export interface PortalContainerProviderProps {
|
|
|
17
17
|
* `<div id="rmd-portal-container"></div>` will be added as the last child to
|
|
18
18
|
* the `document.body` and be used as the container element.
|
|
19
19
|
*/
|
|
20
|
-
container?: PortalContainer
|
|
20
|
+
container?: PortalContainer | RefObject<PortalContainer>;
|
|
21
21
|
children: ReactNode;
|
|
22
22
|
}
|
|
23
23
|
/**
|
|
@@ -27,6 +27,10 @@ const { Provider } = context;
|
|
|
27
27
|
const { container, children } = props;
|
|
28
28
|
const [value, setValue] = useState(portalContainer);
|
|
29
29
|
useEffect(()=>{
|
|
30
|
+
if (container && "current" in container) {
|
|
31
|
+
setValue(container.current);
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
30
34
|
if (typeof container !== "undefined") {
|
|
31
35
|
return;
|
|
32
36
|
}
|
|
@@ -46,8 +50,9 @@ const { Provider } = context;
|
|
|
46
50
|
}, [
|
|
47
51
|
container
|
|
48
52
|
]);
|
|
53
|
+
const containerValue = container && "current" in container || !container ? value : container;
|
|
49
54
|
return /*#__PURE__*/ _jsx(Provider, {
|
|
50
|
-
value:
|
|
55
|
+
value: containerValue,
|
|
51
56
|
children: children
|
|
52
57
|
});
|
|
53
58
|
}
|