@react-md/core 1.0.0-next.14 → 1.0.0-next.15
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/.eslintrc.cjs +8 -0
- package/.turbo/turbo-build.log +22 -22
- package/.turbo/turbo-lint.log +3 -3
- package/.turbo/turbo-test.log +4000 -3982
- package/.turbo/turbo-typecheck.log +1 -23
- package/CHANGELOG.md +13 -0
- package/coverage/clover.xml +477 -410
- package/coverage/coverage-final.json +5 -4
- package/coverage/lcov-report/autocomplete/Autocomplete.tsx.html +81 -15
- package/coverage/lcov-report/autocomplete/AutocompleteClearButton.tsx.html +262 -0
- package/coverage/lcov-report/autocomplete/FilterAutocompleteOptions.tsx.html +364 -0
- package/coverage/lcov-report/autocomplete/index.html +48 -18
- package/coverage/lcov-report/card/Card.tsx.html +349 -0
- package/coverage/lcov-report/card/CardSubtitle.tsx.html +265 -0
- package/coverage/lcov-report/card/index.html +146 -0
- package/coverage/lcov-report/card/styles.ts.html +682 -0
- package/coverage/lcov-report/form/Option.tsx.html +727 -0
- package/coverage/lcov-report/form/index.html +131 -0
- package/coverage/lcov-report/form/useListboxProvider.ts.html +253 -0
- package/coverage/lcov-report/index.html +22 -37
- package/coverage/lcov-report/src/card/Card.tsx.html +349 -0
- package/coverage/lcov-report/src/card/CardSubtitle.tsx.html +277 -0
- package/coverage/lcov-report/src/card/index.html +146 -0
- package/coverage/lcov-report/src/card/styles.ts.html +682 -0
- package/coverage/lcov-report/src/cssUtils.ts.html +787 -0
- package/coverage/lcov-report/src/index.html +116 -0
- package/coverage/lcov-report/src/transition/index.html +116 -0
- package/coverage/lcov-report/src/transition/useCSSTransition.ts.html +766 -0
- package/coverage/lcov-report/transition/index.html +116 -0
- package/coverage/lcov-report/transition/useCSSTransition.ts.html +766 -0
- package/coverage/lcov.info +572 -456
- package/dist/CoreProviders.js.map +1 -1
- package/dist/NoSsr.js.map +1 -1
- package/dist/RootHtml.js.map +1 -1
- package/dist/SsrProvider.js.map +1 -1
- package/dist/app-bar/AppBar.js.map +1 -1
- package/dist/app-bar/AppBarTitle.d.ts +8 -4
- package/dist/app-bar/AppBarTitle.js +3 -2
- package/dist/app-bar/AppBarTitle.js.map +1 -1
- package/dist/autocomplete/Autocomplete.js.map +1 -1
- package/dist/autocomplete/AutocompleteCircularProgress.js.map +1 -1
- package/dist/autocomplete/AutocompleteDropdownButton.js.map +1 -1
- package/dist/autocomplete/FilterAutocompleteOptions.js.map +1 -1
- package/dist/autocomplete/autocompleteStyles.js.map +1 -1
- package/dist/autocomplete/defaults.d.ts +2 -2
- package/dist/autocomplete/defaults.js +3 -3
- package/dist/autocomplete/defaults.js.map +1 -1
- package/dist/autocomplete/types.js.map +1 -1
- package/dist/avatar/Avatar.d.ts +1 -2
- package/dist/avatar/Avatar.js +1 -2
- package/dist/avatar/Avatar.js.map +1 -1
- package/dist/avatar/styles.js.map +1 -1
- package/dist/badge/Badge.js.map +1 -1
- package/dist/box/Box.js.map +1 -1
- package/dist/box/styles.js.map +1 -1
- package/dist/button/AsyncButton.js.map +1 -1
- package/dist/button/Button.js.map +1 -1
- package/dist/button/ButtonUnstyled.js.map +1 -1
- package/dist/button/FloatingActionButton.js.map +1 -1
- package/dist/button/TooltippedButton.js.map +1 -1
- package/dist/button/buttonStyles.js.map +1 -1
- package/dist/button/buttonUnstyledStyles.js.map +1 -1
- package/dist/card/Card.d.ts +2 -1
- package/dist/card/Card.js.map +1 -1
- package/dist/card/CardContent.js.map +1 -1
- package/dist/card/CardFooter.js.map +1 -1
- package/dist/card/CardHeader.js.map +1 -1
- package/dist/card/CardSubtitle.d.ts +6 -0
- package/dist/card/CardSubtitle.js +2 -1
- package/dist/card/CardSubtitle.js.map +1 -1
- package/dist/card/CardTitle.js.map +1 -1
- package/dist/card/ClickableCard.js.map +1 -1
- package/dist/card/styles.js +2 -4
- package/dist/card/styles.js.map +1 -1
- package/dist/chip/Chip.js.map +1 -1
- package/dist/chip/styles.js.map +1 -1
- package/dist/cssUtils.d.ts +1 -1
- package/dist/cssUtils.js.map +1 -1
- package/dist/delegateEvent.js.map +1 -1
- package/dist/dialog/Dialog.js.map +1 -1
- package/dist/dialog/DialogContainer.js.map +1 -1
- package/dist/dialog/DialogContent.js.map +1 -1
- package/dist/dialog/DialogFooter.js.map +1 -1
- package/dist/dialog/DialogHeader.js.map +1 -1
- package/dist/dialog/DialogTitle.js.map +1 -1
- package/dist/dialog/FixedDialog.js.map +1 -1
- package/dist/dialog/NestedDialogProvider.js.map +1 -1
- package/dist/dialog/styles.js.map +1 -1
- package/dist/divider/Divider.js.map +1 -1
- package/dist/divider/styles.js.map +1 -1
- package/dist/draggable/useDraggable.js.map +1 -1
- package/dist/draggable/utils.js.map +1 -1
- package/dist/expansion-panel/ExpansionList.js.map +1 -1
- package/dist/expansion-panel/ExpansionPanel.js.map +1 -1
- package/dist/expansion-panel/ExpansionPanelHeader.js.map +1 -1
- package/dist/expansion-panel/useExpansionList.js.map +1 -1
- package/dist/expansion-panel/useExpansionPanels.js.map +1 -1
- package/dist/focus/useFocusContainer.js.map +1 -1
- package/dist/focus/utils.js.map +1 -1
- package/dist/form/Checkbox.js.map +1 -1
- package/dist/form/Fieldset.js.map +1 -1
- package/dist/form/FileInput.js.map +1 -1
- package/dist/form/Form.js.map +1 -1
- package/dist/form/FormMessage.js.map +1 -1
- package/dist/form/FormMessageContainer.js.map +1 -1
- package/dist/form/FormMessageCounter.js.map +1 -1
- package/dist/form/InputToggle.js.map +1 -1
- package/dist/form/InputToggleIcon.js.map +1 -1
- package/dist/form/Label.js.map +1 -1
- package/dist/form/Legend.js.map +1 -1
- package/dist/form/MenuItemCheckbox.js.map +1 -1
- package/dist/form/MenuItemFileInput.js.map +1 -1
- package/dist/form/MenuItemInputToggle.js.map +1 -1
- package/dist/form/MenuItemRadio.js.map +1 -1
- package/dist/form/MenuItemSwitch.js.map +1 -1
- package/dist/form/MenuItemTextField.js.map +1 -1
- package/dist/form/NativeSelect.js.map +1 -1
- package/dist/form/OptGroup.js.map +1 -1
- package/dist/form/Option.js.map +1 -1
- package/dist/form/Password.js.map +1 -1
- package/dist/form/Radio.js.map +1 -1
- package/dist/form/ResizingTextAreaWrapper.js.map +1 -1
- package/dist/form/Select.js.map +1 -1
- package/dist/form/SelectedOption.js.map +1 -1
- package/dist/form/Slider.js.map +1 -1
- package/dist/form/SliderContainer.js.map +1 -1
- package/dist/form/SliderMark.js.map +1 -1
- package/dist/form/SliderMarkLabel.js.map +1 -1
- package/dist/form/SliderThumb.js.map +1 -1
- package/dist/form/SliderTrack.js.map +1 -1
- package/dist/form/SliderValueMarks.js.map +1 -1
- package/dist/form/SliderValueTooltip.js.map +1 -1
- package/dist/form/Switch.js.map +1 -1
- package/dist/form/SwitchTrack.js.map +1 -1
- package/dist/form/TextArea.js.map +1 -1
- package/dist/form/TextField.js.map +1 -1
- package/dist/form/TextFieldAddon.js.map +1 -1
- package/dist/form/TextFieldContainer.js.map +1 -1
- package/dist/form/fileUtils.js.map +1 -1
- package/dist/form/formConfig.js.map +1 -1
- package/dist/form/formMessageStyles.js.map +1 -1
- package/dist/form/inputToggleStyles.js.map +1 -1
- package/dist/form/menuItemInputToggleStyles.js.map +1 -1
- package/dist/form/nativeSelectStyles.js.map +1 -1
- package/dist/form/optionStyles.js.map +1 -1
- package/dist/form/passwordStyles.js.map +1 -1
- package/dist/form/selectStyles.js.map +1 -1
- package/dist/form/selectUtils.js.map +1 -1
- package/dist/form/sliderUtils.js.map +1 -1
- package/dist/form/switchStyles.js.map +1 -1
- package/dist/form/textAreaStyles.js.map +1 -1
- package/dist/form/textFieldContainerStyles.js.map +1 -1
- package/dist/form/textFieldStyles.js.map +1 -1
- package/dist/form/types.js.map +1 -1
- package/dist/form/useCheckboxGroup.js.map +1 -1
- package/dist/form/useCombobox.js.map +1 -1
- package/dist/form/useEditableCombobox.js.map +1 -1
- package/dist/form/useFileUpload.js.map +1 -1
- package/dist/form/useFormReset.js.map +1 -1
- package/dist/form/useListboxProvider.js.map +1 -1
- package/dist/form/useNumberField.js.map +1 -1
- package/dist/form/useRadioGroup.js.map +1 -1
- package/dist/form/useRangeSlider.js.map +1 -1
- package/dist/form/useResizingTextArea.js.map +1 -1
- package/dist/form/useSelectCombobox.js.map +1 -1
- package/dist/form/useSlider.js.map +1 -1
- package/dist/form/useTextField.js.map +1 -1
- package/dist/form/useTextFieldContainerAddons.js.map +1 -1
- package/dist/form/utils.js.map +1 -1
- package/dist/form/validation.js.map +1 -1
- package/dist/hoverMode/useHoverMode.js.map +1 -1
- package/dist/hoverMode/useHoverModeProvider.js.map +1 -1
- package/dist/icon/FontIcon.d.ts +10 -6
- package/dist/icon/FontIcon.js +1 -5
- package/dist/icon/FontIcon.js.map +1 -1
- package/dist/icon/IconRotator.js.map +1 -1
- package/dist/icon/MaterialIcon.d.ts +19 -2
- package/dist/icon/MaterialIcon.js +14 -2
- package/dist/icon/MaterialIcon.js.map +1 -1
- package/dist/icon/MaterialSymbol.js.map +1 -1
- package/dist/icon/SVGIcon.d.ts +3 -0
- package/dist/icon/SVGIcon.js.map +1 -1
- package/dist/icon/TextIconSpacing.js.map +1 -1
- package/dist/icon/iconConfig.d.ts +1 -0
- package/dist/icon/iconConfig.js +1 -0
- package/dist/icon/iconConfig.js.map +1 -1
- package/dist/icon/material.d.ts +1 -1
- package/dist/icon/material.js.map +1 -1
- package/dist/icon/materialConfig.js.map +1 -1
- package/dist/icon/styles.js.map +1 -1
- package/dist/interaction/Ripple.js.map +1 -1
- package/dist/interaction/RippleContainer.js.map +1 -1
- package/dist/interaction/UserInteractionModeProvider.js.map +1 -1
- package/dist/interaction/config.js.map +1 -1
- package/dist/interaction/types.js.map +1 -1
- package/dist/interaction/useElementInteraction.js.map +1 -1
- package/dist/interaction/useHigherContrastChildren.js.map +1 -1
- package/dist/interaction/utils.js.map +1 -1
- package/dist/layout/LayoutAppBar.js.map +1 -1
- package/dist/layout/LayoutNav.js.map +1 -1
- package/dist/layout/LayoutWindowSplitter.js.map +1 -1
- package/dist/layout/Main.js.map +1 -1
- package/dist/layout/layoutNavStyles.js.map +1 -1
- package/dist/layout/layoutWindowSplitterStyles.js.map +1 -1
- package/dist/layout/mainStyles.js.map +1 -1
- package/dist/layout/useExpandableLayout.js.map +1 -1
- package/dist/layout/useHorizontalLayoutTransition.js.map +1 -1
- package/dist/layout/useLayoutAppBarHeight.js.map +1 -1
- package/dist/layout/useLayoutTree.js.map +1 -1
- package/dist/layout/useLayoutWindowSplitter.js.map +1 -1
- package/dist/layout/useMainTabIndex.js.map +1 -1
- package/dist/layout/useResizableLayout.js.map +1 -1
- package/dist/layout/useTemporaryLayout.js.map +1 -1
- package/dist/link/Link.d.ts +2 -4
- package/dist/link/Link.js +1 -2
- package/dist/link/Link.js.map +1 -1
- package/dist/link/SkipToMainContent.d.ts +10 -3
- package/dist/link/SkipToMainContent.js +4 -1
- package/dist/link/SkipToMainContent.js.map +1 -1
- package/dist/link/styles.d.ts +2 -2
- package/dist/link/styles.js.map +1 -1
- package/dist/list/List.js.map +1 -1
- package/dist/list/ListItem.js.map +1 -1
- package/dist/list/ListItemAddon.js.map +1 -1
- package/dist/list/ListItemChildren.js.map +1 -1
- package/dist/list/ListItemLink.js.map +1 -1
- package/dist/list/ListItemText.js.map +1 -1
- package/dist/list/ListSubheader.js.map +1 -1
- package/dist/list/getListItemHeight.js.map +1 -1
- package/dist/list/listItemStyles.js.map +1 -1
- package/dist/list/types.js.map +1 -1
- package/dist/media-queries/AppSizeProvider.js.map +1 -1
- package/dist/media-queries/appSize.js.map +1 -1
- package/dist/media-queries/useMediaQuery.js.map +1 -1
- package/dist/menu/DropdownMenu.js.map +1 -1
- package/dist/menu/Menu.js.map +1 -1
- package/dist/menu/MenuBar.js.map +1 -1
- package/dist/menu/MenuButton.js.map +1 -1
- package/dist/menu/MenuConfigurationProvider.js.map +1 -1
- package/dist/menu/MenuItem.js.map +1 -1
- package/dist/menu/MenuItemButton.js.map +1 -1
- package/dist/menu/MenuItemCircularProgress.js.map +1 -1
- package/dist/menu/MenuItemGroup.js.map +1 -1
- package/dist/menu/MenuItemSeparator.js.map +1 -1
- package/dist/menu/MenuSheet.js.map +1 -1
- package/dist/menu/MenuVisibilityProvider.js.map +1 -1
- package/dist/menu/MenuWidget.js.map +1 -1
- package/dist/menu/MenuWidgetKeyboardProvider.js.map +1 -1
- package/dist/menu/useContextMenu.js.map +1 -1
- package/dist/menu/useMenuBarProvider.js.map +1 -1
- package/dist/menu/utils.js.map +1 -1
- package/dist/movement/constants.js.map +1 -1
- package/dist/movement/findMatchIndex.js.map +1 -1
- package/dist/movement/types.js.map +1 -1
- package/dist/movement/useKeyboardMovementProvider.js.map +1 -1
- package/dist/movement/utils.js.map +1 -1
- package/dist/navigation/CollapsibleNavGroup.js.map +1 -1
- package/dist/navigation/DefaultNavigationRenderer.js.map +1 -1
- package/dist/navigation/NavGroup.js.map +1 -1
- package/dist/navigation/NavItem.js.map +1 -1
- package/dist/navigation/NavItemButton.js.map +1 -1
- package/dist/navigation/NavItemLink.js.map +1 -1
- package/dist/navigation/NavSubheader.js.map +1 -1
- package/dist/navigation/Navigation.js.map +1 -1
- package/dist/navigation/getHrefFromParents.js.map +1 -1
- package/dist/navigation/navGroupStyles.js.map +1 -1
- package/dist/navigation/navItemStyles.js.map +1 -1
- package/dist/navigation/types.js.map +1 -1
- package/dist/navigation/useActiveHeadingId.js.map +1 -1
- package/dist/overlay/Overlay.d.ts +1 -0
- package/dist/overlay/Overlay.js.map +1 -1
- package/dist/overlay/overlayStyles.js.map +1 -1
- package/dist/portal/Portal.d.ts +4 -0
- package/dist/portal/Portal.js.map +1 -1
- package/dist/portal/PortalContainerProvider.d.ts +8 -3
- package/dist/portal/PortalContainerProvider.js +1 -0
- package/dist/portal/PortalContainerProvider.js.map +1 -1
- package/dist/positioning/constants.js.map +1 -1
- package/dist/positioning/createHorizontalPosition.js.map +1 -1
- package/dist/positioning/createVerticalPosition.js.map +1 -1
- package/dist/positioning/getFixedPosition.js.map +1 -1
- package/dist/positioning/types.js.map +1 -1
- package/dist/positioning/useFixedPositioning.js.map +1 -1
- package/dist/positioning/utils.js.map +1 -1
- package/dist/progress/CircularProgress.d.ts +5 -4
- package/dist/progress/CircularProgress.js.map +1 -1
- package/dist/progress/LinearProgress.js.map +1 -1
- package/dist/progress/getProgressA11y.js.map +1 -1
- package/dist/progress/types.js.map +1 -1
- package/dist/responsive-item/ResponsiveItemContainer.js.map +1 -1
- package/dist/responsive-item/ResponsiveItemOverlay.js.map +1 -1
- package/dist/responsive-item/styles.js.map +1 -1
- package/dist/scroll/ScrollLock.js.map +1 -1
- package/dist/scroll/getScrollbarWidth.js.map +1 -1
- package/dist/scroll/useScrollLock.js.map +1 -1
- package/dist/searching/caseInsensitive.js.map +1 -1
- package/dist/searching/fuzzy.js.map +1 -1
- package/dist/searching/toSearchQuery.js.map +1 -1
- package/dist/searching/types.js.map +1 -1
- package/dist/searching/useFuzzyMatch.js.map +1 -1
- package/dist/searching/utils.js.map +1 -1
- package/dist/segmented-button/SegmentedButton.js.map +1 -1
- package/dist/segmented-button/SegmentedButtonContainer.js.map +1 -1
- package/dist/segmented-button/segmentedButtonContainerStyles.js.map +1 -1
- package/dist/segmented-button/segmentedButtonStyles.js.map +1 -1
- package/dist/sheet/Sheet.js.map +1 -1
- package/dist/sheet/styles.js.map +1 -1
- package/dist/snackbar/DefaultToastRenderer.js.map +1 -1
- package/dist/snackbar/Snackbar.js.map +1 -1
- package/dist/snackbar/Toast.js.map +1 -1
- package/dist/snackbar/ToastActionButton.js.map +1 -1
- package/dist/snackbar/ToastCloseButton.js.map +1 -1
- package/dist/snackbar/ToastContent.js.map +1 -1
- package/dist/snackbar/ToastManager.js.map +1 -1
- package/dist/snackbar/ToastManagerProvider.js.map +1 -1
- package/dist/snackbar/snackbarStyles.js.map +1 -1
- package/dist/snackbar/toastContentStyles.js.map +1 -1
- package/dist/snackbar/toastStyles.js.map +1 -1
- package/dist/snackbar/useCurrentToastActions.js.map +1 -1
- package/dist/suspense/CircularProgressSuspense.js.map +1 -1
- package/dist/suspense/NullSuspense.js.map +1 -1
- package/dist/table/StickyTableSection.d.ts +23 -0
- package/dist/table/StickyTableSection.js +56 -0
- package/dist/table/StickyTableSection.js.map +1 -0
- package/dist/table/Table.d.ts +1 -1
- package/dist/table/Table.js.map +1 -1
- package/dist/table/TableBody.d.ts +1 -1
- package/dist/table/TableBody.js.map +1 -1
- package/dist/table/TableCell.d.ts +3 -2
- package/dist/table/TableCell.js.map +1 -1
- package/dist/table/TableCellContent.d.ts +1 -2
- package/dist/table/TableCellContent.js.map +1 -1
- package/dist/table/TableCheckbox.js.map +1 -1
- package/dist/table/TableConfigurationProvider.d.ts +1 -73
- package/dist/table/TableConfigurationProvider.js.map +1 -1
- package/dist/table/TableContainer.js.map +1 -1
- package/dist/table/TableContainerProvider.js.map +1 -1
- package/dist/table/TableFooter.d.ts +8 -17
- package/dist/table/TableFooter.js +17 -80
- package/dist/table/TableFooter.js.map +1 -1
- package/dist/table/TableHeader.d.ts +8 -17
- package/dist/table/TableHeader.js +20 -87
- package/dist/table/TableHeader.js.map +1 -1
- package/dist/table/TableRadio.js.map +1 -1
- package/dist/table/TableRow.d.ts +1 -1
- package/dist/table/TableRow.js.map +1 -1
- package/dist/table/tableCellStyles.d.ts +1 -1
- package/dist/table/tableCellStyles.js.map +1 -1
- package/dist/table/tableContainerStyles.js.map +1 -1
- package/dist/table/tableFooterStyles.js.map +1 -1
- package/dist/table/tableHeaderStyles.js.map +1 -1
- package/dist/table/tableRowStyles.js.map +1 -1
- package/dist/table/tableStyles.js.map +1 -1
- package/dist/table/types.d.ts +89 -9
- package/dist/table/types.js.map +1 -1
- package/dist/table/useStickyTableSection.d.ts +27 -0
- package/dist/table/useStickyTableSection.js +84 -0
- package/dist/table/useStickyTableSection.js.map +1 -0
- package/dist/table/useTableSectionConfig.d.ts +13 -0
- package/dist/table/useTableSectionConfig.js +33 -0
- package/dist/table/useTableSectionConfig.js.map +1 -0
- package/dist/tabs/Tab.js.map +1 -1
- package/dist/tabs/TabList.js.map +1 -1
- package/dist/tabs/TabListScrollButton.js.map +1 -1
- package/dist/tabs/tabIndicatorStyles.js.map +1 -1
- package/dist/tabs/tabListScrollButtonStyles.js.map +1 -1
- package/dist/tabs/tabListStyles.js.map +1 -1
- package/dist/tabs/tabStyles.js.map +1 -1
- package/dist/tabs/useTabList.js.map +1 -1
- package/dist/tabs/useTabs.js.map +1 -1
- package/dist/tabs/utils.js.map +1 -1
- package/dist/test-utils/IntersectionObserver.js.map +1 -1
- package/dist/test-utils/ResizeObserver.js.map +1 -1
- package/dist/test-utils/data-testid.js.map +1 -1
- package/dist/test-utils/index.js.map +1 -1
- package/dist/test-utils/jest-setup.js.map +1 -1
- package/dist/test-utils/matchMedia.js.map +1 -1
- package/dist/test-utils/polyfills/IntersectionObserver.js.map +1 -1
- package/dist/test-utils/polyfills/ResizeObserver.js.map +1 -1
- package/dist/test-utils/polyfills/TextDecoder.js.map +1 -1
- package/dist/test-utils/polyfills/TextEncoder.js.map +1 -1
- package/dist/test-utils/polyfills/index.js.map +1 -1
- package/dist/test-utils/polyfills/matchMedia.js.map +1 -1
- package/dist/test-utils/polyfills/offsetParent.js.map +1 -1
- package/dist/test-utils/polyfills/scrollIntoView.js.map +1 -1
- package/dist/test-utils/render.js.map +1 -1
- package/dist/test-utils/timers.js.map +1 -1
- package/dist/theme/LocalStorageColorSchemeProvider.js.map +1 -1
- package/dist/theme/ThemeProvider.js.map +1 -1
- package/dist/theme/_theme.scss +2 -1
- package/dist/theme/colors.js.map +1 -1
- package/dist/theme/cssVars.js.map +1 -1
- package/dist/theme/types.js.map +1 -1
- package/dist/theme/useCSSVariables.js.map +1 -1
- package/dist/theme/useColorScheme.js.map +1 -1
- package/dist/theme/useColorSchemeMetaTag.js.map +1 -1
- package/dist/theme/useColorSchemeProvider.js.map +1 -1
- package/dist/theme/usePrefersColorScheme.js.map +1 -1
- package/dist/theme/utils.js.map +1 -1
- package/dist/tooltip/Tooltip.d.ts +20 -9
- package/dist/tooltip/Tooltip.js.map +1 -1
- package/dist/tooltip/TooltipHoverModeProvider.js.map +1 -1
- package/dist/tooltip/constants.js.map +1 -1
- package/dist/tooltip/tooltipStyles.js.map +1 -1
- package/dist/tooltip/useTooltip.d.ts +30 -16
- package/dist/tooltip/useTooltip.js.map +1 -1
- package/dist/tooltip/useTooltipPosition.d.ts +2 -4
- package/dist/tooltip/useTooltipPosition.js.map +1 -1
- package/dist/tooltip/utils.js.map +1 -1
- package/dist/transition/CSSTransition.js.map +1 -1
- package/dist/transition/Collapse.js.map +1 -1
- package/dist/transition/CrossFade.js.map +1 -1
- package/dist/transition/ScaleTransition.js.map +1 -1
- package/dist/transition/SkeletonPlaceholder.js.map +1 -1
- package/dist/transition/Slide.js.map +1 -1
- package/dist/transition/SlideContainer.js.map +1 -1
- package/dist/transition/collapseStyles.js.map +1 -1
- package/dist/transition/config.js.map +1 -1
- package/dist/transition/maxWidthTransition.js.map +1 -1
- package/dist/transition/skeletonPlaceholderUtils.js.map +1 -1
- package/dist/transition/types.d.ts +19 -24
- package/dist/transition/types.js.map +1 -1
- package/dist/transition/useCSSTransition.js.map +1 -1
- package/dist/transition/useCarousel.js.map +1 -1
- package/dist/transition/useCollapseTransition.js.map +1 -1
- package/dist/transition/useCrossFadeTransition.js.map +1 -1
- package/dist/transition/useMaxWidthTransition.js.map +1 -1
- package/dist/transition/useScaleTransition.js.map +1 -1
- package/dist/transition/useSkeletonPlaceholder.js.map +1 -1
- package/dist/transition/useSlideTransition.js.map +1 -1
- package/dist/transition/useTransition.d.ts +1 -0
- package/dist/transition/useTransition.js +1 -0
- package/dist/transition/useTransition.js.map +1 -1
- package/dist/transition/utils.js.map +1 -1
- package/dist/tree/DefaultTreeItemRenderer.js.map +1 -1
- package/dist/tree/Tree.js.map +1 -1
- package/dist/tree/TreeGroup.js.map +1 -1
- package/dist/tree/TreeItem.js.map +1 -1
- package/dist/tree/TreeItemExpander.js.map +1 -1
- package/dist/tree/TreeProvider.js.map +1 -1
- package/dist/tree/styles.js.map +1 -1
- package/dist/tree/types.js.map +1 -1
- package/dist/tree/useTree.d.ts +3 -3
- package/dist/tree/useTree.js.map +1 -1
- package/dist/tree/useTreeExpansion.js.map +1 -1
- package/dist/tree/useTreeItems.js.map +1 -1
- package/dist/tree/useTreeMovement.js.map +1 -1
- package/dist/tree/useTreeSelection.js.map +1 -1
- package/dist/tree/utils.js.map +1 -1
- package/dist/types.js.map +1 -1
- package/dist/typography/SrOnly.js.map +1 -1
- package/dist/typography/TextContainer.d.ts +4 -0
- package/dist/typography/TextContainer.js +2 -0
- package/dist/typography/TextContainer.js.map +1 -1
- package/dist/typography/Typography.d.ts +10 -0
- package/dist/typography/Typography.js +3 -0
- package/dist/typography/Typography.js.map +1 -1
- package/dist/typography/WritingDirectionProvider.js.map +1 -1
- package/dist/typography/textContainerStyles.js.map +1 -1
- package/dist/typography/typographyStyles.js.map +1 -1
- package/dist/useAsyncFunction.js.map +1 -1
- package/dist/useDebouncedFunction.js.map +1 -1
- package/dist/useDropzone.js.map +1 -1
- package/dist/useElementSize.js.map +1 -1
- package/dist/useEnsuredId.js.map +1 -1
- package/dist/useEnsuredRef.js.map +1 -1
- package/dist/useEnsuredState.js.map +1 -1
- package/dist/useHtmlClassName.js.map +1 -1
- package/dist/useIntersectionObserver.js.map +1 -1
- package/dist/useIsomorphicLayoutEffect.js.map +1 -1
- package/dist/useLocalStorage.js.map +1 -1
- package/dist/useMutationObserver.js.map +1 -1
- package/dist/useOrientation.js.map +1 -1
- package/dist/usePageInactive.js.map +1 -1
- package/dist/useResizeListener.js.map +1 -1
- package/dist/useResizeObserver.js.map +1 -1
- package/dist/useThrottledFunction.js.map +1 -1
- package/dist/useToggle.js.map +1 -1
- package/dist/useUnmounted.js.map +1 -1
- package/dist/useWindowSize.js.map +1 -1
- package/dist/utils/RenderRecursively.js.map +1 -1
- package/dist/utils/alphaNumericSort.js.map +1 -1
- package/dist/utils/applyRef.js.map +1 -1
- package/dist/utils/bem.js.map +1 -1
- package/dist/utils/getClientPosition.js.map +1 -1
- package/dist/utils/getMiddleOfRange.js.map +1 -1
- package/dist/utils/getPercentage.js.map +1 -1
- package/dist/utils/getRangeDefaultValue.js.map +1 -1
- package/dist/utils/getRangeSteps.js.map +1 -1
- package/dist/utils/identity.js.map +1 -1
- package/dist/utils/isElementVisible.js.map +1 -1
- package/dist/utils/loop.js.map +1 -1
- package/dist/utils/nearest.js.map +1 -1
- package/dist/utils/parseCssLengthUnit.js.map +1 -1
- package/dist/utils/randomInt.js.map +1 -1
- package/dist/utils/wait.js.map +1 -1
- package/dist/utils/withinRange.js.map +1 -1
- package/dist/window-splitter/WindowSplitter.js.map +1 -1
- package/dist/window-splitter/useWindowSplitter.js.map +1 -1
- package/package.json +21 -20
- package/scripts/getExportMap.ts +66 -0
- package/scripts/tsconfig.json +1 -1
- package/src/app-bar/AppBarTitle.tsx +8 -4
- package/src/autocomplete/defaults.ts +3 -3
- package/src/avatar/Avatar.tsx +1 -2
- package/src/card/Card.tsx +2 -1
- package/src/card/CardSubtitle.tsx +9 -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__/styles.ts.snap +1 -1
- package/src/card/styles.ts +2 -6
- package/src/cssUtils.ts +1 -1
- package/src/icon/FontIcon.tsx +19 -9
- package/src/icon/MaterialIcon.tsx +23 -4
- package/src/icon/SVGIcon.tsx +3 -0
- package/src/icon/iconConfig.tsx +1 -0
- package/src/icon/material.ts +276 -19
- package/src/link/Link.tsx +2 -4
- package/src/link/SkipToMainContent.tsx +11 -4
- package/src/link/styles.ts +2 -2
- package/src/overlay/Overlay.tsx +1 -0
- package/src/portal/Portal.tsx +5 -0
- package/src/portal/PortalContainerProvider.tsx +16 -7
- package/src/progress/CircularProgress.tsx +5 -4
- package/src/table/StickyTableSection.tsx +91 -0
- package/src/table/Table.tsx +2 -5
- package/src/table/TableBody.tsx +1 -2
- package/src/table/TableCell.tsx +3 -5
- package/src/table/TableCellContent.tsx +1 -3
- package/src/table/TableConfigurationProvider.tsx +1 -86
- package/src/table/TableFooter.tsx +19 -116
- package/src/table/TableHeader.tsx +20 -118
- package/src/table/TableRow.tsx +2 -4
- package/src/table/__tests__/Table.tsx +9 -8
- package/src/table/tableCellStyles.ts +1 -1
- package/src/table/types.ts +105 -10
- package/src/table/useStickyTableSection.tsx +126 -0
- package/src/table/useTableSectionConfig.ts +45 -0
- package/src/theme/_theme.scss +2 -1
- package/src/tooltip/Tooltip.tsx +24 -8
- package/src/tooltip/useTooltip.ts +52 -27
- package/src/tooltip/useTooltipPosition.ts +2 -4
- package/src/transition/types.ts +23 -27
- package/src/transition/useTransition.ts +1 -0
- package/src/tree/useTree.ts +3 -5
- package/src/typography/TextContainer.tsx +4 -0
- package/src/typography/Typography.tsx +10 -0
- package/src/useResizeListener.ts +1 -1
|
@@ -1,19 +1,11 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as _jsx
|
|
3
|
-
import { forwardRef
|
|
4
|
-
import {
|
|
5
|
-
import { useIntersectionObserver } from "../useIntersectionObserver.js";
|
|
6
|
-
import { TableConfigProvider, useTableConfig } from "./TableConfigurationProvider.js";
|
|
7
|
-
import { useTableContainer } from "./TableContainerProvider.js";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { forwardRef } from "react";
|
|
4
|
+
import { TableConfigProvider } from "./TableConfigurationProvider.js";
|
|
8
5
|
import { tableHeader } from "./tableHeaderStyles.js";
|
|
9
|
-
|
|
10
|
-
* @since 6.0.0
|
|
11
|
-
*/ export const isTableHeaderStickyActive = (entry)=>{
|
|
12
|
-
return entry.intersectionRatio < 1 && entry.boundingClientRect.bottom <= window.innerHeight;
|
|
13
|
-
};
|
|
6
|
+
import { useTableSectionConfig } from "./useTableSectionConfig.js";
|
|
14
7
|
/**
|
|
15
8
|
* **Client Component**
|
|
16
|
-
* TODO: Create separate useStickyTableHeader + StickyTableHeader component
|
|
17
9
|
*
|
|
18
10
|
* Creates a `<thead>` element with some basic styles. This component will also
|
|
19
11
|
* update the table configuration so that all the `TableCell` children will
|
|
@@ -22,84 +14,25 @@ import { tableHeader } from "./tableHeaderStyles.js";
|
|
|
22
14
|
* line-wrapping can be re-enabled if desired through the `hoverable` and
|
|
23
15
|
* `disableNoWrap` props.
|
|
24
16
|
*/ export const TableHeader = /*#__PURE__*/ forwardRef(function TableHeader(props, propRef) {
|
|
25
|
-
const { className,
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
lineWrap: propLineWrap,
|
|
29
|
-
disableHover: !hoverable
|
|
30
|
-
});
|
|
31
|
-
const configuration = useMemo(()=>({
|
|
32
|
-
dense,
|
|
33
|
-
header: true,
|
|
34
|
-
hAlign,
|
|
35
|
-
vAlign,
|
|
36
|
-
lineWrap,
|
|
37
|
-
disableBorders,
|
|
38
|
-
disableHover
|
|
39
|
-
}), [
|
|
40
|
-
dense,
|
|
41
|
-
hAlign,
|
|
42
|
-
vAlign,
|
|
17
|
+
const { className, sticky, lineWrap, hoverable, children, ...remaining } = props;
|
|
18
|
+
const config = useTableSectionConfig({
|
|
19
|
+
type: "header",
|
|
43
20
|
lineWrap,
|
|
44
|
-
|
|
45
|
-
disableHover
|
|
46
|
-
]);
|
|
47
|
-
const [theadRef, theadRefCallback] = useEnsuredRef(propRef);
|
|
48
|
-
const { exists, containerRef } = useTableContainer();
|
|
49
|
-
const [stickyActive, setStickyActive] = useState(false);
|
|
50
|
-
const targetRef = useIntersectionObserver({
|
|
51
|
-
ref: exists ? undefined : theadRefCallback,
|
|
52
|
-
root: containerRef,
|
|
53
|
-
disabled: !sticky || disableStickyStyles,
|
|
54
|
-
threshold: exists ? 0 : 1,
|
|
55
|
-
getRootMargin: useCallback(()=>{
|
|
56
|
-
const thead = theadRef.current;
|
|
57
|
-
if (!thead) {
|
|
58
|
-
return;
|
|
59
|
-
}
|
|
60
|
-
let topOffset;
|
|
61
|
-
if (exists) {
|
|
62
|
-
topOffset = thead.offsetHeight - 1;
|
|
63
|
-
} else {
|
|
64
|
-
const top = parseFloat(window.getComputedStyle(thead).top);
|
|
65
|
-
topOffset = Number.isNaN(top) ? 1 : top + 1;
|
|
66
|
-
}
|
|
67
|
-
return `-${topOffset}px 0px 0px`;
|
|
68
|
-
}, [
|
|
69
|
-
exists,
|
|
70
|
-
theadRef
|
|
71
|
-
]),
|
|
72
|
-
onUpdate: useCallback(([entry])=>{
|
|
73
|
-
setStickyActive(isStickyActive(entry, exists));
|
|
74
|
-
}, [
|
|
75
|
-
exists,
|
|
76
|
-
isStickyActive
|
|
77
|
-
]),
|
|
78
|
-
// allow the user defined sticky options to override the default behavior
|
|
79
|
-
...stickyOptions
|
|
21
|
+
hoverable
|
|
80
22
|
});
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
stickyActive,
|
|
92
|
-
stickyActiveClassName
|
|
93
|
-
}),
|
|
94
|
-
children: children
|
|
23
|
+
const { dense } = config;
|
|
24
|
+
return /*#__PURE__*/ _jsx(TableConfigProvider, {
|
|
25
|
+
value: config,
|
|
26
|
+
children: /*#__PURE__*/ _jsx("thead", {
|
|
27
|
+
...remaining,
|
|
28
|
+
ref: propRef,
|
|
29
|
+
className: tableHeader({
|
|
30
|
+
className,
|
|
31
|
+
dense,
|
|
32
|
+
sticky
|
|
95
33
|
}),
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
/*#__PURE__*/ _jsx("tbody", {
|
|
99
|
-
"aria-hidden": true,
|
|
100
|
-
ref: targetRef
|
|
101
|
-
})
|
|
102
|
-
]
|
|
34
|
+
children: children
|
|
35
|
+
})
|
|
103
36
|
});
|
|
104
37
|
});
|
|
105
38
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/table/TableHeader.tsx"],"sourcesContent":["\"use client\";\nimport {
|
|
1
|
+
{"version":3,"sources":["../../src/table/TableHeader.tsx"],"sourcesContent":["\"use client\";\nimport { forwardRef, type HTMLAttributes } from \"react\";\nimport { TableConfigProvider } from \"./TableConfigurationProvider.js\";\nimport { tableHeader } from \"./tableHeaderStyles.js\";\nimport { type TableSectionConfiguration } from \"./types.js\";\nimport { useTableSectionConfig } from \"./useTableSectionConfig.js\";\n\nexport interface TableHeaderProps\n extends HTMLAttributes<HTMLTableSectionElement>,\n TableSectionConfiguration {\n /**\n * NOTE: It is recommended to use the `StickyTableSection` component instead\n * of enabling this prop since it supports dynamically adding styles while the\n * header covering table rows.\n *\n * Set this to `true` to enable the sticky behavior.\n *\n * @defaultValue `false`\n */\n sticky?: boolean;\n}\n\n/**\n * **Client Component**\n *\n * Creates a `<thead>` element with some basic styles. This component will also\n * update the table configuration so that all the `TableCell` children will\n * automatically become `<th>` elements instead of the normal `<td>` as well as\n * disabling the hover effect and line wrapping. The hover effect and\n * line-wrapping can be re-enabled if desired through the `hoverable` and\n * `disableNoWrap` props.\n */\nexport const TableHeader = forwardRef<\n HTMLTableSectionElement,\n TableHeaderProps\n>(function TableHeader(props, propRef) {\n const { className, sticky, lineWrap, hoverable, children, ...remaining } =\n props;\n\n const config = useTableSectionConfig({\n type: \"header\",\n lineWrap,\n hoverable,\n });\n const { dense } = config;\n\n return (\n <TableConfigProvider value={config}>\n <thead\n {...remaining}\n ref={propRef}\n className={tableHeader({\n className,\n dense,\n sticky,\n })}\n >\n {children}\n </thead>\n </TableConfigProvider>\n );\n});\n"],"names":["forwardRef","TableConfigProvider","tableHeader","useTableSectionConfig","TableHeader","props","propRef","className","sticky","lineWrap","hoverable","children","remaining","config","type","dense","value","thead","ref"],"mappings":"AAAA;;AACA,SAASA,UAAU,QAA6B,QAAQ;AACxD,SAASC,mBAAmB,QAAQ,kCAAkC;AACtE,SAASC,WAAW,QAAQ,yBAAyB;AAErD,SAASC,qBAAqB,QAAQ,6BAA6B;AAiBnE;;;;;;;;;CASC,GACD,OAAO,MAAMC,4BAAcJ,WAGzB,SAASI,YAAYC,KAAK,EAAEC,OAAO;IACnC,MAAM,EAAEC,SAAS,EAAEC,MAAM,EAAEC,QAAQ,EAAEC,SAAS,EAAEC,QAAQ,EAAE,GAAGC,WAAW,GACtEP;IAEF,MAAMQ,SAASV,sBAAsB;QACnCW,MAAM;QACNL;QACAC;IACF;IACA,MAAM,EAAEK,KAAK,EAAE,GAAGF;IAElB,qBACE,KAACZ;QAAoBe,OAAOH;kBAC1B,cAAA,KAACI;YACE,GAAGL,SAAS;YACbM,KAAKZ;YACLC,WAAWL,YAAY;gBACrBK;gBACAQ;gBACAP;YACF;sBAECG;;;AAIT,GAAG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/table/TableRadio.tsx"],"sourcesContent":["\"use client\";\nimport { forwardRef, type TdHTMLAttributes } from \"react\";\nimport { type RadioProps } from \"../form/InputToggle.js\";\nimport { Radio } from \"../form/Radio.js\";\nimport { type PropsWithRef } from \"../types.js\";\nimport { TableCell } from \"./TableCell.js\";\n\nconst noop = (): void => {\n // do nothing\n};\n\n/**\n * @since 6.0.0\n */\nexport type TableRadioTdHTMLAttributes = Omit<\n TdHTMLAttributes<HTMLTableCellElement>,\n \"aria-sort\" | \"scope\" | \"onChange\" | \"onInvalid\"\n>;\n\n/**\n * @since 6.0.0\n */\nexport type TableRadioSupportedRadioProps = Pick<\n RadioProps,\n | \"name\"\n | \"value\"\n | \"icon\"\n | \"iconStyle\"\n | \"iconClassName\"\n | \"iconProps\"\n | \"checkedIcon\"\n | \"checked\"\n | \"onChange\"\n | \"defaultChecked\"\n | \"error\"\n | \"required\"\n | \"onInvalid\"\n>;\n\n/**\n * @since 6.0.0\n */\nexport interface TableRadioProps\n extends TableRadioTdHTMLAttributes,\n TableRadioSupportedRadioProps {\n /**\n * @defaultValue `!props[\"aria-labelledby\"] ? \"Select Row\" : undefined`\n */\n \"aria-label\"?: string;\n\n /** @defaultValue `false` */\n sticky?: boolean;\n\n /**\n * This allows you to override any props for the checkbox that are not\n * configurable as top-level props.\n *\n * @example Simple Example\n * ```tsx\n * checkboxProps={{\n * id: \"some-custom-id\",\n * ref: checkboxRef,\n * }}\n * ```\n *\n * @see {@link TableRadioSupportedRadioProps}\n * @since 6.0.0\n */\n radioProps?: PropsWithRef<RadioProps, HTMLInputElement>;\n}\n\n/**\n * **Client Component**\n * The `TableRadio` is used to render a `Radio` within a `TableCell` by applying\n * some minimal styles.\n *\n * @example Simple Example\n * ```tsx\n * import {\n * Table,\n * TableBody,\n * TableCell,\n * TableRadio,\n * TableContainer,\n * TableHeader,\n * TableRow,\n * useRadioGroup,\n * } from \"@react-md/core\";\n * import type { ReactElement } from \"react\";\n *\n * const rows = [\n * { name: \"Frozen Yogurt\", type: \"Ice Cream\" },\n * { name: \"Ice cream sandwich\", type: \"Ice Cream\" },\n * { name: \"Eclair\", type: \"Pastry\" },\n * // ...other content\n * ] as const;\n *\n * function Example(): ReactElement {\n * const { getRadioProps } = useRadioGroup({\n * name: \"selected\",\n * });\n * return (\n * <TableContainer>\n * <Table>\n * <TableHeader>\n * <TableRow>\n * <TableCell header={false} />\n * <TableCell>Name</TableCell>\n * <TableCell>Type</TableCell>\n * </TableRow>\n * </TableHeader>\n * <TableBody>\n * {rows.map(({ name, type }) => {\n * const radioProps = getRadioProps(name);\n * const { checked, onChange } = radioProps;\n *\n * return (\n * <TableRow\n * key={name}\n * onClick={onChange}\n * clickable\n * selected={checked}\n * >\n * <TableRadio {...radioProps} />\n * <TableCell>{name}</TableCell>\n * <TableCell hAlign=\"right\">{type}</TableCell>\n * </TableRow>\n * );\n * })}\n * </TableBody>\n * </Table>\n * </TableContainer>\n * );\n * }\n * ```\n * @since 6.0.0\n */\nexport const TableRadio = forwardRef<HTMLTableCellElement, TableRadioProps>(\n function TableRadio(props, ref) {\n const {\n \"aria-labelledby\": ariaLabelledBy,\n \"aria-label\": ariaLabel = !ariaLabelledBy ? \"Select Row\" : undefined,\n \"aria-controls\": ariaControls,\n name,\n icon,\n iconProps,\n iconStyle,\n iconClassName,\n checkedIcon,\n value,\n checked,\n onChange,\n defaultChecked,\n radioProps,\n onClick = noop,\n error,\n required,\n onInvalid,\n ...remaining\n } = props;\n\n return (\n <TableCell\n {...remaining}\n ref={ref}\n header={false}\n inputToggle\n onClick={(event) => {\n event.stopPropagation();\n onClick(event);\n }}\n >\n <Radio\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy}\n aria-controls={ariaControls}\n name={name}\n icon={icon}\n iconProps={iconProps}\n iconStyle={iconStyle}\n iconClassName={iconClassName}\n checkedIcon={checkedIcon}\n value={value}\n checked={checked}\n defaultChecked={defaultChecked}\n error={error}\n required={required}\n onChange={onChange}\n onInvalid={onInvalid}\n {...radioProps}\n />\n </TableCell>\n );\n }\n);\n"],"names":["forwardRef","Radio","TableCell","noop","TableRadio","props","ref","ariaLabelledBy","ariaLabel","undefined","ariaControls","name","icon","iconProps","iconStyle","iconClassName","checkedIcon","value","checked","onChange","defaultChecked","radioProps","onClick","error","required","onInvalid","remaining","header","inputToggle","event","stopPropagation","aria-label","aria-labelledby","aria-controls"],"
|
|
1
|
+
{"version":3,"sources":["../../src/table/TableRadio.tsx"],"sourcesContent":["\"use client\";\nimport { forwardRef, type TdHTMLAttributes } from \"react\";\nimport { type RadioProps } from \"../form/InputToggle.js\";\nimport { Radio } from \"../form/Radio.js\";\nimport { type PropsWithRef } from \"../types.js\";\nimport { TableCell } from \"./TableCell.js\";\n\nconst noop = (): void => {\n // do nothing\n};\n\n/**\n * @since 6.0.0\n */\nexport type TableRadioTdHTMLAttributes = Omit<\n TdHTMLAttributes<HTMLTableCellElement>,\n \"aria-sort\" | \"scope\" | \"onChange\" | \"onInvalid\"\n>;\n\n/**\n * @since 6.0.0\n */\nexport type TableRadioSupportedRadioProps = Pick<\n RadioProps,\n | \"name\"\n | \"value\"\n | \"icon\"\n | \"iconStyle\"\n | \"iconClassName\"\n | \"iconProps\"\n | \"checkedIcon\"\n | \"checked\"\n | \"onChange\"\n | \"defaultChecked\"\n | \"error\"\n | \"required\"\n | \"onInvalid\"\n>;\n\n/**\n * @since 6.0.0\n */\nexport interface TableRadioProps\n extends TableRadioTdHTMLAttributes,\n TableRadioSupportedRadioProps {\n /**\n * @defaultValue `!props[\"aria-labelledby\"] ? \"Select Row\" : undefined`\n */\n \"aria-label\"?: string;\n\n /** @defaultValue `false` */\n sticky?: boolean;\n\n /**\n * This allows you to override any props for the checkbox that are not\n * configurable as top-level props.\n *\n * @example Simple Example\n * ```tsx\n * checkboxProps={{\n * id: \"some-custom-id\",\n * ref: checkboxRef,\n * }}\n * ```\n *\n * @see {@link TableRadioSupportedRadioProps}\n * @since 6.0.0\n */\n radioProps?: PropsWithRef<RadioProps, HTMLInputElement>;\n}\n\n/**\n * **Client Component**\n * The `TableRadio` is used to render a `Radio` within a `TableCell` by applying\n * some minimal styles.\n *\n * @example Simple Example\n * ```tsx\n * import {\n * Table,\n * TableBody,\n * TableCell,\n * TableRadio,\n * TableContainer,\n * TableHeader,\n * TableRow,\n * useRadioGroup,\n * } from \"@react-md/core\";\n * import type { ReactElement } from \"react\";\n *\n * const rows = [\n * { name: \"Frozen Yogurt\", type: \"Ice Cream\" },\n * { name: \"Ice cream sandwich\", type: \"Ice Cream\" },\n * { name: \"Eclair\", type: \"Pastry\" },\n * // ...other content\n * ] as const;\n *\n * function Example(): ReactElement {\n * const { getRadioProps } = useRadioGroup({\n * name: \"selected\",\n * });\n * return (\n * <TableContainer>\n * <Table>\n * <TableHeader>\n * <TableRow>\n * <TableCell header={false} />\n * <TableCell>Name</TableCell>\n * <TableCell>Type</TableCell>\n * </TableRow>\n * </TableHeader>\n * <TableBody>\n * {rows.map(({ name, type }) => {\n * const radioProps = getRadioProps(name);\n * const { checked, onChange } = radioProps;\n *\n * return (\n * <TableRow\n * key={name}\n * onClick={onChange}\n * clickable\n * selected={checked}\n * >\n * <TableRadio {...radioProps} />\n * <TableCell>{name}</TableCell>\n * <TableCell hAlign=\"right\">{type}</TableCell>\n * </TableRow>\n * );\n * })}\n * </TableBody>\n * </Table>\n * </TableContainer>\n * );\n * }\n * ```\n * @since 6.0.0\n */\nexport const TableRadio = forwardRef<HTMLTableCellElement, TableRadioProps>(\n function TableRadio(props, ref) {\n const {\n \"aria-labelledby\": ariaLabelledBy,\n \"aria-label\": ariaLabel = !ariaLabelledBy ? \"Select Row\" : undefined,\n \"aria-controls\": ariaControls,\n name,\n icon,\n iconProps,\n iconStyle,\n iconClassName,\n checkedIcon,\n value,\n checked,\n onChange,\n defaultChecked,\n radioProps,\n onClick = noop,\n error,\n required,\n onInvalid,\n ...remaining\n } = props;\n\n return (\n <TableCell\n {...remaining}\n ref={ref}\n header={false}\n inputToggle\n onClick={(event) => {\n event.stopPropagation();\n onClick(event);\n }}\n >\n <Radio\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy}\n aria-controls={ariaControls}\n name={name}\n icon={icon}\n iconProps={iconProps}\n iconStyle={iconStyle}\n iconClassName={iconClassName}\n checkedIcon={checkedIcon}\n value={value}\n checked={checked}\n defaultChecked={defaultChecked}\n error={error}\n required={required}\n onChange={onChange}\n onInvalid={onInvalid}\n {...radioProps}\n />\n </TableCell>\n );\n }\n);\n"],"names":["forwardRef","Radio","TableCell","noop","TableRadio","props","ref","ariaLabelledBy","ariaLabel","undefined","ariaControls","name","icon","iconProps","iconStyle","iconClassName","checkedIcon","value","checked","onChange","defaultChecked","radioProps","onClick","error","required","onInvalid","remaining","header","inputToggle","event","stopPropagation","aria-label","aria-labelledby","aria-controls"],"mappings":"AAAA;;AACA,SAASA,UAAU,QAA+B,QAAQ;AAE1D,SAASC,KAAK,QAAQ,mBAAmB;AAEzC,SAASC,SAAS,QAAQ,iBAAiB;AAE3C,MAAMC,OAAO;AACX,aAAa;AACf;AA8DA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiEC,GACD,OAAO,MAAMC,2BAAaJ,WACxB,SAASI,WAAWC,KAAK,EAAEC,GAAG;IAC5B,MAAM,EACJ,mBAAmBC,cAAc,EACjC,cAAcC,YAAY,CAACD,iBAAiB,eAAeE,SAAS,EACpE,iBAAiBC,YAAY,EAC7BC,IAAI,EACJC,IAAI,EACJC,SAAS,EACTC,SAAS,EACTC,aAAa,EACbC,WAAW,EACXC,KAAK,EACLC,OAAO,EACPC,QAAQ,EACRC,cAAc,EACdC,UAAU,EACVC,UAAUnB,IAAI,EACdoB,KAAK,EACLC,QAAQ,EACRC,SAAS,EACT,GAAGC,WACJ,GAAGrB;IAEJ,qBACE,KAACH;QACE,GAAGwB,SAAS;QACbpB,KAAKA;QACLqB,QAAQ;QACRC,WAAW;QACXN,SAAS,CAACO;YACRA,MAAMC,eAAe;YACrBR,QAAQO;QACV;kBAEA,cAAA,KAAC5B;YACC8B,cAAYvB;YACZwB,mBAAiBzB;YACjB0B,iBAAevB;YACfC,MAAMA;YACNC,MAAMA;YACNC,WAAWA;YACXC,WAAWA;YACXC,eAAeA;YACfC,aAAaA;YACbC,OAAOA;YACPC,SAASA;YACTE,gBAAgBA;YAChBG,OAAOA;YACPC,UAAUA;YACVL,UAAUA;YACVM,WAAWA;YACV,GAAGJ,UAAU;;;AAItB,GACA"}
|
package/dist/table/TableRow.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type HTMLAttributes } from "react";
|
|
2
|
-
import { type TableRowConfiguration } from "./
|
|
2
|
+
import { type TableRowConfiguration } from "./types.js";
|
|
3
3
|
export interface TableRowProps extends HTMLAttributes<HTMLTableRowElement>, TableRowConfiguration {
|
|
4
4
|
/**
|
|
5
5
|
* Boolean if the current row has been selected and should apply the selected
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/table/TableRow.tsx"],"sourcesContent":["\"use client\";\nimport { forwardRef, type HTMLAttributes } from \"react\";\nimport {
|
|
1
|
+
{"version":3,"sources":["../../src/table/TableRow.tsx"],"sourcesContent":["\"use client\";\nimport { forwardRef, type HTMLAttributes } from \"react\";\nimport { useTableConfig } from \"./TableConfigurationProvider.js\";\nimport { tableRow } from \"./tableRowStyles.js\";\nimport { type TableRowConfiguration } from \"./types.js\";\n\nexport interface TableRowProps\n extends HTMLAttributes<HTMLTableRowElement>,\n TableRowConfiguration {\n /**\n * Boolean if the current row has been selected and should apply the selected\n * background-color.\n *\n * @defaultValue `false`\n */\n selected?: boolean;\n\n /**\n * Boolean if the row should be clickable and update the cursor while hovered\n * to be a pointer.\n *\n * @defaultValue `false`\n */\n clickable?: boolean;\n}\n\n/**\n * **Client Component**\n *\n * Creates a `<tr>` element with some general styles that are inherited from the\n * base table configuration.\n */\nexport const TableRow = forwardRef<HTMLTableRowElement, TableRowProps>(\n function TableRow(props, ref) {\n const {\n className,\n disableHover: propDisableHover,\n disableBorders: propDisableBorders,\n children,\n selected = false,\n clickable = false,\n ...remaining\n } = props;\n\n const { disableHover, disableBorders } = useTableConfig({\n disableHover: propDisableHover,\n disableBorders: propDisableBorders,\n });\n\n return (\n <tr\n {...remaining}\n ref={ref}\n className={tableRow({\n selected,\n clickable,\n disableHover,\n disableBorders,\n className,\n })}\n >\n {children}\n </tr>\n );\n }\n);\n"],"names":["forwardRef","useTableConfig","tableRow","TableRow","props","ref","className","disableHover","propDisableHover","disableBorders","propDisableBorders","children","selected","clickable","remaining","tr"],"mappings":"AAAA;;AACA,SAASA,UAAU,QAA6B,QAAQ;AACxD,SAASC,cAAc,QAAQ,kCAAkC;AACjE,SAASC,QAAQ,QAAQ,sBAAsB;AAuB/C;;;;;CAKC,GACD,OAAO,MAAMC,yBAAWH,WACtB,SAASG,SAASC,KAAK,EAAEC,GAAG;IAC1B,MAAM,EACJC,SAAS,EACTC,cAAcC,gBAAgB,EAC9BC,gBAAgBC,kBAAkB,EAClCC,QAAQ,EACRC,WAAW,KAAK,EAChBC,YAAY,KAAK,EACjB,GAAGC,WACJ,GAAGV;IAEJ,MAAM,EAAEG,YAAY,EAAEE,cAAc,EAAE,GAAGR,eAAe;QACtDM,cAAcC;QACdC,gBAAgBC;IAClB;IAEA,qBACE,KAACK;QACE,GAAGD,SAAS;QACbT,KAAKA;QACLC,WAAWJ,SAAS;YAClBU;YACAC;YACAN;YACAE;YACAH;QACF;kBAECK;;AAGP,GACA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type TableCellHorizontalAlignment, type TableCellVerticalAlignment } from "./
|
|
1
|
+
import { type TableCellHorizontalAlignment, type TableCellVerticalAlignment } from "./types.js";
|
|
2
2
|
/** @since 6.0.0 */
|
|
3
3
|
export interface TableCellClassNameOptions {
|
|
4
4
|
className?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/table/tableCellStyles.ts"],"sourcesContent":["import { cnb } from \"cnbuilder\";\nimport { cssUtils } from \"../cssUtils.js\";\nimport {\n type TableCellHorizontalAlignment,\n type TableCellVerticalAlignment,\n} from \"./
|
|
1
|
+
{"version":3,"sources":["../../src/table/tableCellStyles.ts"],"sourcesContent":["import { cnb } from \"cnbuilder\";\nimport { cssUtils } from \"../cssUtils.js\";\nimport {\n type TableCellHorizontalAlignment,\n type TableCellVerticalAlignment,\n} from \"./types.js\";\n\n/** @since 6.0.0 */\nexport interface TableCellClassNameOptions {\n className?: string;\n\n /**\n * Set this to `true` if the cell is rendered as a `<th>` so that the correct\n * sticky styles can be applied.\n */\n header: boolean;\n\n /**\n * Set this to true if the cell is rendered in a `<thead>` so that the correct\n * sticky styles can be applied.\n */\n isInTableHeader: boolean;\n\n /** @defaultValue `false` */\n grow?: boolean;\n\n /** @defaultValue `false` */\n sticky?: boolean;\n\n /** @defaultValue `false` */\n inputToggle?: boolean;\n\n hAlign?: TableCellHorizontalAlignment;\n vAlign?: TableCellVerticalAlignment;\n\n /** @defaultValue `true` */\n lineWrap?: boolean;\n\n /**\n * @defaultValue `\"horizontal\"`\n */\n padding?: \"horizontal\" | \"vertical\" | \"none\";\n}\n\n/**\n * @since 6.0.0\n */\nexport function tableCell(options: TableCellClassNameOptions): string {\n const {\n grow,\n sticky,\n header,\n inputToggle,\n hAlign,\n vAlign,\n lineWrap = true,\n padding = \"horizontal\",\n isInTableHeader,\n className,\n } = options;\n\n // using `&&` instead of `bem` since the latest version of typescript does not\n // support setting the same object key (empty string)\n const p = \"rmd-table-cell--\";\n return cnb(\n \"rmd-table-cell\",\n grow && `${p}grow`,\n header && `${p}header`,\n sticky && `${p}sticky`,\n inputToggle && `${p}input-toggle`,\n sticky && (!isInTableHeader || inputToggle) && `${p}sticky-cell`,\n sticky && isInTableHeader && `${p}sticky-header`,\n sticky && isInTableHeader && inputToggle && `${p}header-cell`,\n vAlign && vAlign !== \"middle\" && `${p}${vAlign}`,\n !lineWrap && `${p}no-wrap`,\n padding === \"vertical\" && `${p}v-padding`,\n padding === \"none\" && `${p}no-padding`,\n cssUtils({\n textAlign: hAlign,\n }),\n className\n );\n}\n"],"names":["cnb","cssUtils","tableCell","options","grow","sticky","header","inputToggle","hAlign","vAlign","lineWrap","padding","isInTableHeader","className","p","textAlign"],"mappings":"AAAA,SAASA,GAAG,QAAQ,YAAY;AAChC,SAASC,QAAQ,QAAQ,iBAAiB;AA2C1C;;CAEC,GACD,OAAO,SAASC,UAAUC,OAAkC;IAC1D,MAAM,EACJC,IAAI,EACJC,MAAM,EACNC,MAAM,EACNC,WAAW,EACXC,MAAM,EACNC,MAAM,EACNC,WAAW,IAAI,EACfC,UAAU,YAAY,EACtBC,eAAe,EACfC,SAAS,EACV,GAAGV;IAEJ,8EAA8E;IAC9E,qDAAqD;IACrD,MAAMW,IAAI;IACV,OAAOd,IACL,kBACAI,QAAQ,CAAC,EAAEU,EAAE,IAAI,CAAC,EAClBR,UAAU,CAAC,EAAEQ,EAAE,MAAM,CAAC,EACtBT,UAAU,CAAC,EAAES,EAAE,MAAM,CAAC,EACtBP,eAAe,CAAC,EAAEO,EAAE,YAAY,CAAC,EACjCT,UAAW,CAAA,CAACO,mBAAmBL,WAAU,KAAM,CAAC,EAAEO,EAAE,WAAW,CAAC,EAChET,UAAUO,mBAAmB,CAAC,EAAEE,EAAE,aAAa,CAAC,EAChDT,UAAUO,mBAAmBL,eAAe,CAAC,EAAEO,EAAE,WAAW,CAAC,EAC7DL,UAAUA,WAAW,YAAY,CAAC,EAAEK,EAAE,EAAEL,OAAO,CAAC,EAChD,CAACC,YAAY,CAAC,EAAEI,EAAE,OAAO,CAAC,EAC1BH,YAAY,cAAc,CAAC,EAAEG,EAAE,SAAS,CAAC,EACzCH,YAAY,UAAU,CAAC,EAAEG,EAAE,UAAU,CAAC,EACtCb,SAAS;QACPc,WAAWP;IACb,IACAK;AAEJ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/table/tableContainerStyles.ts"],"sourcesContent":["import { cnb } from \"cnbuilder\";\n\n/**\n * @since 6.0.0\n */\nexport interface TableContainerClassNameOptions {\n className?: string;\n}\n\n/**\n * @since 6.0.0\n */\nexport function tableContainer(\n options: TableContainerClassNameOptions = {}\n): string {\n const { className } = options;\n\n return cnb(\"rmd-table-container\", className);\n}\n"],"names":["cnb","tableContainer","options","className"],"
|
|
1
|
+
{"version":3,"sources":["../../src/table/tableContainerStyles.ts"],"sourcesContent":["import { cnb } from \"cnbuilder\";\n\n/**\n * @since 6.0.0\n */\nexport interface TableContainerClassNameOptions {\n className?: string;\n}\n\n/**\n * @since 6.0.0\n */\nexport function tableContainer(\n options: TableContainerClassNameOptions = {}\n): string {\n const { className } = options;\n\n return cnb(\"rmd-table-container\", className);\n}\n"],"names":["cnb","tableContainer","options","className"],"mappings":"AAAA,SAASA,GAAG,QAAQ,YAAY;AAShC;;CAEC,GACD,OAAO,SAASC,eACdC,UAA0C,CAAC,CAAC;IAE5C,MAAM,EAAEC,SAAS,EAAE,GAAGD;IAEtB,OAAOF,IAAI,uBAAuBG;AACpC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/table/tableFooterStyles.ts"],"sourcesContent":["import { cnb } from \"cnbuilder\";\nimport { bem } from \"../utils/bem.js\";\n\nconst styles = bem(\"rmd-tfoot\");\n\n/**\n * @since 6.0.0\n */\nexport interface TableFooterClassNameOptions {\n className?: string;\n sticky?: boolean;\n stickyActive?: boolean;\n stickyActiveClassName?: string;\n}\n\nexport function tableFooter(options: TableFooterClassNameOptions = {}): string {\n const { className, sticky, stickyActive, stickyActiveClassName } = options;\n\n return cnb(\n styles({\n sticky,\n \"sticky-active\": stickyActive,\n }),\n stickyActive && stickyActiveClassName,\n className\n );\n}\n"],"names":["cnb","bem","styles","tableFooter","options","className","sticky","stickyActive","stickyActiveClassName"],"
|
|
1
|
+
{"version":3,"sources":["../../src/table/tableFooterStyles.ts"],"sourcesContent":["import { cnb } from \"cnbuilder\";\nimport { bem } from \"../utils/bem.js\";\n\nconst styles = bem(\"rmd-tfoot\");\n\n/**\n * @since 6.0.0\n */\nexport interface TableFooterClassNameOptions {\n className?: string;\n sticky?: boolean;\n stickyActive?: boolean;\n stickyActiveClassName?: string;\n}\n\nexport function tableFooter(options: TableFooterClassNameOptions = {}): string {\n const { className, sticky, stickyActive, stickyActiveClassName } = options;\n\n return cnb(\n styles({\n sticky,\n \"sticky-active\": stickyActive,\n }),\n stickyActive && stickyActiveClassName,\n className\n );\n}\n"],"names":["cnb","bem","styles","tableFooter","options","className","sticky","stickyActive","stickyActiveClassName"],"mappings":"AAAA,SAASA,GAAG,QAAQ,YAAY;AAChC,SAASC,GAAG,QAAQ,kBAAkB;AAEtC,MAAMC,SAASD,IAAI;AAYnB,OAAO,SAASE,YAAYC,UAAuC,CAAC,CAAC;IACnE,MAAM,EAAEC,SAAS,EAAEC,MAAM,EAAEC,YAAY,EAAEC,qBAAqB,EAAE,GAAGJ;IAEnE,OAAOJ,IACLE,OAAO;QACLI;QACA,iBAAiBC;IACnB,IACAA,gBAAgBC,uBAChBH;AAEJ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/table/tableHeaderStyles.ts"],"sourcesContent":["import { cnb } from \"cnbuilder\";\nimport { bem } from \"../utils/bem.js\";\n\nconst styles = bem(\"rmd-thead\");\n\n/** @since 6.0.0 */\nexport interface TableHeaderClassNameOptions {\n className?: string;\n dense?: boolean;\n sticky?: boolean;\n stickyActive?: boolean;\n stickyActiveClassName?: string;\n}\n\n/** @since 6.0.0 */\nexport function tableHeader(options: TableHeaderClassNameOptions = {}): string {\n const { dense, sticky, stickyActive, stickyActiveClassName, className } =\n options;\n\n return cnb(\n styles({\n dense,\n sticky,\n \"sticky-active\": stickyActive,\n }),\n stickyActive && stickyActiveClassName,\n className\n );\n}\n"],"names":["cnb","bem","styles","tableHeader","options","dense","sticky","stickyActive","stickyActiveClassName","className"],"
|
|
1
|
+
{"version":3,"sources":["../../src/table/tableHeaderStyles.ts"],"sourcesContent":["import { cnb } from \"cnbuilder\";\nimport { bem } from \"../utils/bem.js\";\n\nconst styles = bem(\"rmd-thead\");\n\n/** @since 6.0.0 */\nexport interface TableHeaderClassNameOptions {\n className?: string;\n dense?: boolean;\n sticky?: boolean;\n stickyActive?: boolean;\n stickyActiveClassName?: string;\n}\n\n/** @since 6.0.0 */\nexport function tableHeader(options: TableHeaderClassNameOptions = {}): string {\n const { dense, sticky, stickyActive, stickyActiveClassName, className } =\n options;\n\n return cnb(\n styles({\n dense,\n sticky,\n \"sticky-active\": stickyActive,\n }),\n stickyActive && stickyActiveClassName,\n className\n );\n}\n"],"names":["cnb","bem","styles","tableHeader","options","dense","sticky","stickyActive","stickyActiveClassName","className"],"mappings":"AAAA,SAASA,GAAG,QAAQ,YAAY;AAChC,SAASC,GAAG,QAAQ,kBAAkB;AAEtC,MAAMC,SAASD,IAAI;AAWnB,iBAAiB,GACjB,OAAO,SAASE,YAAYC,UAAuC,CAAC,CAAC;IACnE,MAAM,EAAEC,KAAK,EAAEC,MAAM,EAAEC,YAAY,EAAEC,qBAAqB,EAAEC,SAAS,EAAE,GACrEL;IAEF,OAAOJ,IACLE,OAAO;QACLG;QACAC;QACA,iBAAiBC;IACnB,IACAA,gBAAgBC,uBAChBC;AAEJ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/table/tableRowStyles.ts"],"sourcesContent":["import { cnb } from \"cnbuilder\";\nimport { bem } from \"../utils/bem.js\";\n\nconst styles = bem(\"rmd-tr\");\n\n/** @since 6.0.0 */\nexport interface TableRowClassNameOptions {\n className?: string;\n disableHover?: boolean;\n disableBorders?: boolean;\n selected?: boolean;\n clickable?: boolean;\n}\n\n/** @since 6.0.0 */\nexport function tableRow(options: TableRowClassNameOptions = {}): string {\n const { disableHover, disableBorders, selected, clickable, className } =\n options;\n return cnb(\n styles({\n bordered: !disableBorders,\n hoverable: !disableHover,\n clickable,\n selected,\n }),\n className\n );\n}\n"],"names":["cnb","bem","styles","tableRow","options","disableHover","disableBorders","selected","clickable","className","bordered","hoverable"],"
|
|
1
|
+
{"version":3,"sources":["../../src/table/tableRowStyles.ts"],"sourcesContent":["import { cnb } from \"cnbuilder\";\nimport { bem } from \"../utils/bem.js\";\n\nconst styles = bem(\"rmd-tr\");\n\n/** @since 6.0.0 */\nexport interface TableRowClassNameOptions {\n className?: string;\n disableHover?: boolean;\n disableBorders?: boolean;\n selected?: boolean;\n clickable?: boolean;\n}\n\n/** @since 6.0.0 */\nexport function tableRow(options: TableRowClassNameOptions = {}): string {\n const { disableHover, disableBorders, selected, clickable, className } =\n options;\n return cnb(\n styles({\n bordered: !disableBorders,\n hoverable: !disableHover,\n clickable,\n selected,\n }),\n className\n );\n}\n"],"names":["cnb","bem","styles","tableRow","options","disableHover","disableBorders","selected","clickable","className","bordered","hoverable"],"mappings":"AAAA,SAASA,GAAG,QAAQ,YAAY;AAChC,SAASC,GAAG,QAAQ,kBAAkB;AAEtC,MAAMC,SAASD,IAAI;AAWnB,iBAAiB,GACjB,OAAO,SAASE,SAASC,UAAoC,CAAC,CAAC;IAC7D,MAAM,EAAEC,YAAY,EAAEC,cAAc,EAAEC,QAAQ,EAAEC,SAAS,EAAEC,SAAS,EAAE,GACpEL;IACF,OAAOJ,IACLE,OAAO;QACLQ,UAAU,CAACJ;QACXK,WAAW,CAACN;QACZG;QACAD;IACF,IACAE;AAEJ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/table/tableStyles.ts"],"sourcesContent":["import { cnb } from \"cnbuilder\";\nimport { bem } from \"../utils/bem.js\";\n\nconst styles = bem(\"rmd-table\");\n\n/** @since 6.0.0 */\nexport interface TableClassNameOptions {\n className?: string;\n\n /** @defaultValue `false` */\n dense?: boolean;\n\n /** @defaultValue `false` */\n fullWidth?: boolean;\n}\n\n/**\n * @since 6.0.0\n */\nexport function table(options: TableClassNameOptions = {}): string {\n const { dense = false, fullWidth = false, className } = options;\n\n return cnb(styles({ dense, \"full-width\": fullWidth }), className);\n}\n"],"names":["cnb","bem","styles","table","options","dense","fullWidth","className"],"
|
|
1
|
+
{"version":3,"sources":["../../src/table/tableStyles.ts"],"sourcesContent":["import { cnb } from \"cnbuilder\";\nimport { bem } from \"../utils/bem.js\";\n\nconst styles = bem(\"rmd-table\");\n\n/** @since 6.0.0 */\nexport interface TableClassNameOptions {\n className?: string;\n\n /** @defaultValue `false` */\n dense?: boolean;\n\n /** @defaultValue `false` */\n fullWidth?: boolean;\n}\n\n/**\n * @since 6.0.0\n */\nexport function table(options: TableClassNameOptions = {}): string {\n const { dense = false, fullWidth = false, className } = options;\n\n return cnb(styles({ dense, \"full-width\": fullWidth }), className);\n}\n"],"names":["cnb","bem","styles","table","options","dense","fullWidth","className"],"mappings":"AAAA,SAASA,GAAG,QAAQ,YAAY;AAChC,SAASC,GAAG,QAAQ,kBAAkB;AAEtC,MAAMC,SAASD,IAAI;AAanB;;CAEC,GACD,OAAO,SAASE,MAAMC,UAAiC,CAAC,CAAC;IACvD,MAAM,EAAEC,QAAQ,KAAK,EAAEC,YAAY,KAAK,EAAEC,SAAS,EAAE,GAAGH;IAExD,OAAOJ,IAAIE,OAAO;QAAEG;QAAO,cAAcC;IAAU,IAAIC;AACzD"}
|
package/dist/table/types.d.ts
CHANGED
|
@@ -1,6 +1,80 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type IntersectionObserverHookOptions } from "../useIntersectionObserver.js";
|
|
2
|
+
export type SortOrder = "ascending" | "descending" | "none" | "other";
|
|
3
|
+
export interface TableRowConfiguration {
|
|
4
|
+
/**
|
|
5
|
+
* Set to `true` if rows should no longer change background color while
|
|
6
|
+
* hovered.
|
|
7
|
+
*
|
|
8
|
+
* @defaultValue `false`
|
|
9
|
+
*/
|
|
10
|
+
disableHover?: boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Set to `true` if the rows in the `TableBody` should no longer have borders
|
|
13
|
+
* applied.
|
|
14
|
+
*
|
|
15
|
+
* @defaultValue `false`
|
|
16
|
+
*/
|
|
17
|
+
disableBorders?: boolean;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* The horizontal alignment for the content within a cell.
|
|
21
|
+
*
|
|
22
|
+
* Note: Table default behavior is to align to the left.
|
|
23
|
+
*/
|
|
24
|
+
export type TableCellHorizontalAlignment = "left" | "center" | "right";
|
|
25
|
+
/**
|
|
26
|
+
* The vertical alignment for the content within a cell.
|
|
27
|
+
*
|
|
28
|
+
* Note: When this is set to `"top"` or `"bottom"`, `padding-top` or
|
|
29
|
+
* `padding-bottom` will also be applied due to how styling tables work.
|
|
30
|
+
*/
|
|
31
|
+
export type TableCellVerticalAlignment = "top" | "middle" | "bottom";
|
|
32
|
+
export interface TableCellConfiguration {
|
|
33
|
+
hAlign?: TableCellHorizontalAlignment;
|
|
34
|
+
vAlign?: TableCellVerticalAlignment;
|
|
35
|
+
/**
|
|
36
|
+
* Set this to `true` to allow `TableCell` content to line wrap.
|
|
37
|
+
*
|
|
38
|
+
* @defaultValue `false`
|
|
39
|
+
*/
|
|
40
|
+
lineWrap?: boolean;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* @internal
|
|
44
|
+
*/
|
|
45
|
+
export interface TableCellConfig extends TableCellConfiguration {
|
|
46
|
+
/**
|
|
47
|
+
* Boolean if all the `TableCell` components should be rendered as a `<th>`
|
|
48
|
+
* instead of a `<td>`. This is really just a convenience prop for the
|
|
49
|
+
* `TableHeader` component so the user of `react-md` doesn't need to keep
|
|
50
|
+
* setting the `type="th"` fot the `TableCell` if using the low-level
|
|
51
|
+
* components.
|
|
52
|
+
*
|
|
53
|
+
* @internal
|
|
54
|
+
*/
|
|
55
|
+
header?: boolean;
|
|
56
|
+
}
|
|
57
|
+
export interface TableConfig extends TableRowConfiguration, TableCellConfig {
|
|
58
|
+
/**
|
|
59
|
+
* Set this to `true` to decrease the height of all cells within the table.
|
|
60
|
+
*
|
|
61
|
+
* @defaultValue `false`
|
|
62
|
+
*/
|
|
63
|
+
dense?: boolean;
|
|
64
|
+
}
|
|
65
|
+
export interface TableConfiguration extends TableConfig {
|
|
66
|
+
/**
|
|
67
|
+
* Set this to `true` to allow the table to span the full width of the
|
|
68
|
+
* container element instead of having the width be determined by the content
|
|
69
|
+
* within the table.
|
|
70
|
+
*
|
|
71
|
+
* @defaultValue `false`
|
|
72
|
+
*/
|
|
73
|
+
fullWidth?: boolean;
|
|
74
|
+
}
|
|
75
|
+
export type TableConfigContext = Required<TableConfig>;
|
|
2
76
|
/** @since 6.0.0 */
|
|
3
|
-
export type
|
|
77
|
+
export type TableStickySectionIntersectionObserverOptions = Pick<IntersectionObserverHookOptions<HTMLTableSectionElement>, "disabled" | "getThreshold" | "getRootMargin">;
|
|
4
78
|
/**
|
|
5
79
|
* This **should be wrapped in `useCallback`** to increase performance.
|
|
6
80
|
*
|
|
@@ -15,17 +89,13 @@ export type TableStickySectionOptions = Pick<IntersectionObserverHookOptions<HTM
|
|
|
15
89
|
* viewport.
|
|
16
90
|
* - Note: This really only works with `px` and `rem` units.
|
|
17
91
|
*
|
|
18
|
-
* @see {@link
|
|
92
|
+
* @see {@link TableStickySectionConfiguration.stickyOptions} for an example usage with custom threshold and
|
|
19
93
|
* margin.
|
|
20
94
|
* @since 6.0.0
|
|
21
95
|
*/
|
|
22
96
|
export type IsStickyTableSectionActive = (entry: IntersectionObserverEntry, isInTableContainer: boolean) => boolean;
|
|
23
97
|
/** @since 6.0.0 */
|
|
24
|
-
export interface
|
|
25
|
-
/**
|
|
26
|
-
* @defaultValue `false`
|
|
27
|
-
*/
|
|
28
|
-
sticky?: boolean;
|
|
98
|
+
export interface TableStickySectionConfiguration {
|
|
29
99
|
/**
|
|
30
100
|
* This can be used when the {@link sticky} prop is set to `true` for
|
|
31
101
|
* additional behavior around the "active" state for sticky headers.
|
|
@@ -58,7 +128,7 @@ export interface TableStickySectionProps {
|
|
|
58
128
|
* @since 6.0.0
|
|
59
129
|
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Intersection_Observer_API}
|
|
60
130
|
*/
|
|
61
|
-
stickyOptions?:
|
|
131
|
+
stickyOptions?: TableStickySectionIntersectionObserverOptions;
|
|
62
132
|
/**
|
|
63
133
|
* An optional className to use when the sticky section is covering other rows
|
|
64
134
|
* (`active`). When this is defined, the default
|
|
@@ -84,3 +154,13 @@ export interface TableStickySectionProps {
|
|
|
84
154
|
*/
|
|
85
155
|
disableStickyStyles?: boolean;
|
|
86
156
|
}
|
|
157
|
+
/** @since 6.0.0 */
|
|
158
|
+
export interface TableSectionConfiguration {
|
|
159
|
+
/** @see {@link TableCellConfiguration.lineWrap} */
|
|
160
|
+
lineWrap?: boolean;
|
|
161
|
+
/**
|
|
162
|
+
* @see {@link TableRowConfiguration.disableHover}
|
|
163
|
+
* @defaultValue `false`
|
|
164
|
+
*/
|
|
165
|
+
hoverable?: boolean;
|
|
166
|
+
}
|
package/dist/table/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/table/types.ts"],"sourcesContent":["import type
|
|
1
|
+
{"version":3,"sources":["../../src/table/types.ts"],"sourcesContent":["import { type IntersectionObserverHookOptions } from \"../useIntersectionObserver.js\";\n\nexport type SortOrder = \"ascending\" | \"descending\" | \"none\" | \"other\";\n\n// interfaces that are \"public\" should be the full word `Configuration` while\n// the private/internal should just be `Config`. \"Great\" naming convention!\n\nexport interface TableRowConfiguration {\n /**\n * Set to `true` if rows should no longer change background color while\n * hovered.\n *\n * @defaultValue `false`\n */\n disableHover?: boolean;\n\n /**\n * Set to `true` if the rows in the `TableBody` should no longer have borders\n * applied.\n *\n * @defaultValue `false`\n */\n disableBorders?: boolean;\n}\n\n/**\n * The horizontal alignment for the content within a cell.\n *\n * Note: Table default behavior is to align to the left.\n */\nexport type TableCellHorizontalAlignment = \"left\" | \"center\" | \"right\";\n\n/**\n * The vertical alignment for the content within a cell.\n *\n * Note: When this is set to `\"top\"` or `\"bottom\"`, `padding-top` or\n * `padding-bottom` will also be applied due to how styling tables work.\n */\nexport type TableCellVerticalAlignment = \"top\" | \"middle\" | \"bottom\";\n\nexport interface TableCellConfiguration {\n hAlign?: TableCellHorizontalAlignment;\n vAlign?: TableCellVerticalAlignment;\n\n /**\n * Set this to `true` to allow `TableCell` content to line wrap.\n *\n * @defaultValue `false`\n */\n lineWrap?: boolean;\n}\n\n/**\n * @internal\n */\nexport interface TableCellConfig extends TableCellConfiguration {\n /**\n * Boolean if all the `TableCell` components should be rendered as a `<th>`\n * instead of a `<td>`. This is really just a convenience prop for the\n * `TableHeader` component so the user of `react-md` doesn't need to keep\n * setting the `type=\"th\"` fot the `TableCell` if using the low-level\n * components.\n *\n * @internal\n */\n header?: boolean;\n}\n\nexport interface TableConfig extends TableRowConfiguration, TableCellConfig {\n /**\n * Set this to `true` to decrease the height of all cells within the table.\n *\n * @defaultValue `false`\n */\n dense?: boolean;\n}\n\nexport interface TableConfiguration extends TableConfig {\n /**\n * Set this to `true` to allow the table to span the full width of the\n * container element instead of having the width be determined by the content\n * within the table.\n *\n * @defaultValue `false`\n */\n fullWidth?: boolean;\n}\n\nexport type TableConfigContext = Required<TableConfig>;\n\n/** @since 6.0.0 */\nexport type TableStickySectionIntersectionObserverOptions = Pick<\n IntersectionObserverHookOptions<HTMLTableSectionElement>,\n \"disabled\" | \"getThreshold\" | \"getRootMargin\"\n>;\n\n/**\n * This **should be wrapped in `useCallback`** to increase performance.\n *\n * The default behavior is to enable the \"active\" state for sticky headers is:\n *\n * - if the `TableHeader` is within a `TableContainer`, add a hidden `<tbody>`\n * after the `<thead>` and enable the active state once 1px overlaps with\n * the container.\n * - otherwise, assume the `TableHeader` is fixed within the viewport and\n * parse the `top` CSS style as `px`. enable the active state once 1px\n * overlaps with this value AND the `TableHeader` exists within the\n * viewport.\n * - Note: This really only works with `px` and `rem` units.\n *\n * @see {@link TableStickySectionConfiguration.stickyOptions} for an example usage with custom threshold and\n * margin.\n * @since 6.0.0\n */\nexport type IsStickyTableSectionActive = (\n entry: IntersectionObserverEntry,\n isInTableContainer: boolean\n) => boolean;\n\n/** @since 6.0.0 */\nexport interface TableStickySectionConfiguration {\n /**\n * This can be used when the {@link sticky} prop is set to `true` for\n * additional behavior around the \"active\" state for sticky headers.\n *\n * @example Disabling Sticky Active State\n * ```ts\n * stickyOptions={{\n * disabled: true,\n * }}\n * ```\n *\n * @example Custom Options\n * ```ts\n * stickyOptions={{\n * getThreshold: useCallback(() => {\n * // you can access the DOM safely from here\n * return [0, 0.25, 0.5, 1];\n * }, []),\n * getRootMargin: useCallback(() => {\n * // you can access the DOM safely from here\n * return \"-1px 0px 150px 0px\";\n * }, []),\n * }}\n * isStickyActive={useCallback((entry) => {\n * // whatever custom logic you want. you can access the DOM safely from here\n * return entry.isIntersecting;\n * }, [])}\n * ```\n *\n * @since 6.0.0\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Intersection_Observer_API}\n */\n stickyOptions?: TableStickySectionIntersectionObserverOptions;\n\n /**\n * An optional className to use when the sticky section is covering other rows\n * (`active`). When this is defined, the default\n * `rmd-thead--sticky-active`/`rmd-tfoot--sticky-active` will no longer be\n * applied.\n */\n stickyActiveClassName?: string;\n\n /**\n * @see {@link IsStickyTableSectionActive} for a description.\n * @see {@link stickyOptions} for an example usage with custom threshold and\n * margin.\n * @since 6.0.0\n */\n isStickyActive?: IsStickyTableSectionActive;\n\n /**\n * Set this to `true` when the {@link sticky} prop is `true` to disable the\n * behavior of adding an additional className when the sticky mode is active.\n *\n * The `TableHeader` would gain the `.rmd-thead--sticky-active` class while\n * the `TableFooter` would gain the `.rmd-tfoot--sticky-active` class.\n *\n * @defaultValue `false`\n */\n disableStickyStyles?: boolean;\n}\n\n/** @since 6.0.0 */\nexport interface TableSectionConfiguration {\n /** @see {@link TableCellConfiguration.lineWrap} */\n lineWrap?: boolean;\n\n /**\n * @see {@link TableRowConfiguration.disableHover}\n * @defaultValue `false`\n */\n hoverable?: boolean;\n}\n"],"names":[],"mappings":"AAuLA,iBAAiB,GACjB,WASC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { type ReactNode, type Ref, type RefCallback } from "react";
|
|
2
|
+
import { type IsStickyTableSectionActive, type TableStickySectionConfiguration } from "./types.js";
|
|
3
|
+
/**
|
|
4
|
+
* @since 6.0.0
|
|
5
|
+
*/
|
|
6
|
+
export declare const isTableHeaderStickyActive: IsStickyTableSectionActive;
|
|
7
|
+
/**
|
|
8
|
+
* @since 6.0.0
|
|
9
|
+
*/
|
|
10
|
+
export declare const isTableFooterStickyActive: IsStickyTableSectionActive;
|
|
11
|
+
/** @since 6.0.0 */
|
|
12
|
+
export interface TableStickySectionOptions extends TableStickySectionConfiguration {
|
|
13
|
+
ref?: Ref<HTMLTableSectionElement>;
|
|
14
|
+
type: "header" | "footer";
|
|
15
|
+
}
|
|
16
|
+
/** @since 6.0.0 */
|
|
17
|
+
export interface TableStickySectionImplementation {
|
|
18
|
+
tbody: ReactNode;
|
|
19
|
+
targetRef: RefCallback<HTMLTableSectionElement>;
|
|
20
|
+
sectionRef: RefCallback<HTMLTableSectionElement>;
|
|
21
|
+
stickyActive: boolean;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* @since 6.0.0
|
|
25
|
+
* @internal
|
|
26
|
+
*/
|
|
27
|
+
export declare function useStickyTableSection(options: TableStickySectionOptions): TableStickySectionImplementation;
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { useCallback, useState } from "react";
|
|
4
|
+
import { useEnsuredRef } from "../useEnsuredRef.js";
|
|
5
|
+
import { useIntersectionObserver } from "../useIntersectionObserver.js";
|
|
6
|
+
import { useTableContainer } from "./TableContainerProvider.js";
|
|
7
|
+
/**
|
|
8
|
+
* @since 6.0.0
|
|
9
|
+
*/ export const isTableHeaderStickyActive = (entry)=>{
|
|
10
|
+
return entry.intersectionRatio < 1 && entry.boundingClientRect.bottom <= window.innerHeight;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* @since 6.0.0
|
|
14
|
+
*/ export const isTableFooterStickyActive = (entry, isInTableContainer)=>{
|
|
15
|
+
const { intersectionRatio, boundingClientRect, isIntersecting } = entry;
|
|
16
|
+
if (isInTableContainer) {
|
|
17
|
+
return !isIntersecting;
|
|
18
|
+
}
|
|
19
|
+
return intersectionRatio < 1 && boundingClientRect.top >= 0;
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* @since 6.0.0
|
|
23
|
+
* @internal
|
|
24
|
+
*/ export function useStickyTableSection(options) {
|
|
25
|
+
const { ref, type, disableStickyStyles, stickyOptions } = options;
|
|
26
|
+
const isHeader = type === "header";
|
|
27
|
+
const isStickyActive = options.isStickyActive ?? (isHeader ? isTableHeaderStickyActive : isTableFooterStickyActive);
|
|
28
|
+
const [sectionRef, sectionRefCallback] = useEnsuredRef(ref);
|
|
29
|
+
const { exists, containerRef } = useTableContainer();
|
|
30
|
+
const [stickyActive, setStickyActive] = useState(false);
|
|
31
|
+
const targetRef = useIntersectionObserver({
|
|
32
|
+
ref: exists ? undefined : sectionRefCallback,
|
|
33
|
+
root: containerRef,
|
|
34
|
+
disabled: disableStickyStyles,
|
|
35
|
+
threshold: exists ? 0 : 1,
|
|
36
|
+
getRootMargin: useCallback(()=>{
|
|
37
|
+
const section = sectionRef.current;
|
|
38
|
+
if (!isHeader) {
|
|
39
|
+
const topOffset = exists && section ? section.offsetHeight - 1 : 1;
|
|
40
|
+
return `0px 0px -${topOffset}px 0px`;
|
|
41
|
+
}
|
|
42
|
+
if (!section) {
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
let topOffset;
|
|
46
|
+
if (exists) {
|
|
47
|
+
topOffset = section.offsetHeight - 1;
|
|
48
|
+
} else {
|
|
49
|
+
const top = parseFloat(window.getComputedStyle(section).top);
|
|
50
|
+
topOffset = Number.isNaN(top) ? 1 : top + 1;
|
|
51
|
+
}
|
|
52
|
+
return `-${topOffset}px 0px 0px`;
|
|
53
|
+
}, [
|
|
54
|
+
exists,
|
|
55
|
+
isHeader,
|
|
56
|
+
sectionRef
|
|
57
|
+
]),
|
|
58
|
+
onUpdate: useCallback(([entry])=>{
|
|
59
|
+
setStickyActive(isStickyActive(entry, exists));
|
|
60
|
+
}, [
|
|
61
|
+
exists,
|
|
62
|
+
isStickyActive
|
|
63
|
+
]),
|
|
64
|
+
// allow the user defined sticky options to override the default behavior
|
|
65
|
+
...stickyOptions
|
|
66
|
+
});
|
|
67
|
+
let tbody;
|
|
68
|
+
if (exists && !disableStickyStyles) {
|
|
69
|
+
// rendering a `<tbody>` since it is valid to have 0-many in a table
|
|
70
|
+
// https://html.spec.whatwg.org/multipage/tables.html#the-table-element
|
|
71
|
+
tbody = /*#__PURE__*/ _jsx("tbody", {
|
|
72
|
+
"aria-hidden": true,
|
|
73
|
+
ref: targetRef
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
return {
|
|
77
|
+
tbody,
|
|
78
|
+
targetRef,
|
|
79
|
+
sectionRef: exists ? sectionRefCallback : targetRef,
|
|
80
|
+
stickyActive
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
//# sourceMappingURL=useStickyTableSection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/table/useStickyTableSection.tsx"],"sourcesContent":["\"use client\";\nimport {\n useCallback,\n useState,\n type ReactNode,\n type Ref,\n type RefCallback,\n} from \"react\";\nimport { useEnsuredRef } from \"../useEnsuredRef.js\";\nimport { useIntersectionObserver } from \"../useIntersectionObserver.js\";\nimport { useTableContainer } from \"./TableContainerProvider.js\";\nimport {\n type IsStickyTableSectionActive,\n type TableStickySectionConfiguration,\n} from \"./types.js\";\n\n/**\n * @since 6.0.0\n */\nexport const isTableHeaderStickyActive: IsStickyTableSectionActive = (\n entry\n) => {\n return (\n entry.intersectionRatio < 1 &&\n entry.boundingClientRect.bottom <= window.innerHeight\n );\n};\n\n/**\n * @since 6.0.0\n */\nexport const isTableFooterStickyActive: IsStickyTableSectionActive = (\n entry,\n isInTableContainer\n) => {\n const { intersectionRatio, boundingClientRect, isIntersecting } = entry;\n if (isInTableContainer) {\n return !isIntersecting;\n }\n\n return intersectionRatio < 1 && boundingClientRect.top >= 0;\n};\n\n/** @since 6.0.0 */\nexport interface TableStickySectionOptions\n extends TableStickySectionConfiguration {\n ref?: Ref<HTMLTableSectionElement>;\n type: \"header\" | \"footer\";\n}\n\n/** @since 6.0.0 */\nexport interface TableStickySectionImplementation {\n tbody: ReactNode;\n targetRef: RefCallback<HTMLTableSectionElement>;\n sectionRef: RefCallback<HTMLTableSectionElement>;\n stickyActive: boolean;\n}\n\n/**\n * @since 6.0.0\n * @internal\n */\nexport function useStickyTableSection(\n options: TableStickySectionOptions\n): TableStickySectionImplementation {\n const { ref, type, disableStickyStyles, stickyOptions } = options;\n\n const isHeader = type === \"header\";\n const isStickyActive =\n options.isStickyActive ??\n (isHeader ? isTableHeaderStickyActive : isTableFooterStickyActive);\n\n const [sectionRef, sectionRefCallback] = useEnsuredRef(ref);\n const { exists, containerRef } = useTableContainer();\n const [stickyActive, setStickyActive] = useState(false);\n const targetRef = useIntersectionObserver({\n ref: exists ? undefined : sectionRefCallback,\n root: containerRef,\n disabled: disableStickyStyles,\n threshold: exists ? 0 : 1,\n getRootMargin: useCallback(() => {\n const section = sectionRef.current;\n if (!isHeader) {\n const topOffset = exists && section ? section.offsetHeight - 1 : 1;\n\n return `0px 0px -${topOffset}px 0px`;\n }\n\n if (!section) {\n return;\n }\n\n let topOffset: number;\n if (exists) {\n topOffset = section.offsetHeight - 1;\n } else {\n const top = parseFloat(window.getComputedStyle(section).top);\n topOffset = Number.isNaN(top) ? 1 : top + 1;\n }\n\n return `-${topOffset}px 0px 0px`;\n }, [exists, isHeader, sectionRef]),\n onUpdate: useCallback(\n ([entry]) => {\n setStickyActive(isStickyActive(entry, exists));\n },\n [exists, isStickyActive]\n ),\n // allow the user defined sticky options to override the default behavior\n ...stickyOptions,\n });\n\n let tbody: ReactNode;\n if (exists && !disableStickyStyles) {\n // rendering a `<tbody>` since it is valid to have 0-many in a table\n // https://html.spec.whatwg.org/multipage/tables.html#the-table-element\n tbody = <tbody aria-hidden ref={targetRef} />;\n }\n\n return {\n tbody,\n targetRef,\n sectionRef: exists ? sectionRefCallback : targetRef,\n stickyActive,\n };\n}\n"],"names":["useCallback","useState","useEnsuredRef","useIntersectionObserver","useTableContainer","isTableHeaderStickyActive","entry","intersectionRatio","boundingClientRect","bottom","window","innerHeight","isTableFooterStickyActive","isInTableContainer","isIntersecting","top","useStickyTableSection","options","ref","type","disableStickyStyles","stickyOptions","isHeader","isStickyActive","sectionRef","sectionRefCallback","exists","containerRef","stickyActive","setStickyActive","targetRef","undefined","root","disabled","threshold","getRootMargin","section","current","topOffset","offsetHeight","parseFloat","getComputedStyle","Number","isNaN","onUpdate","tbody","aria-hidden"],"mappings":"AAAA;;AACA,SACEA,WAAW,EACXC,QAAQ,QAIH,QAAQ;AACf,SAASC,aAAa,QAAQ,sBAAsB;AACpD,SAASC,uBAAuB,QAAQ,gCAAgC;AACxE,SAASC,iBAAiB,QAAQ,8BAA8B;AAMhE;;CAEC,GACD,OAAO,MAAMC,4BAAwD,CACnEC;IAEA,OACEA,MAAMC,iBAAiB,GAAG,KAC1BD,MAAME,kBAAkB,CAACC,MAAM,IAAIC,OAAOC,WAAW;AAEzD,EAAE;AAEF;;CAEC,GACD,OAAO,MAAMC,4BAAwD,CACnEN,OACAO;IAEA,MAAM,EAAEN,iBAAiB,EAAEC,kBAAkB,EAAEM,cAAc,EAAE,GAAGR;IAClE,IAAIO,oBAAoB;QACtB,OAAO,CAACC;IACV;IAEA,OAAOP,oBAAoB,KAAKC,mBAAmBO,GAAG,IAAI;AAC5D,EAAE;AAiBF;;;CAGC,GACD,OAAO,SAASC,sBACdC,OAAkC;IAElC,MAAM,EAAEC,GAAG,EAAEC,IAAI,EAAEC,mBAAmB,EAAEC,aAAa,EAAE,GAAGJ;IAE1D,MAAMK,WAAWH,SAAS;IAC1B,MAAMI,iBACJN,QAAQM,cAAc,IACrBD,CAAAA,WAAWjB,4BAA4BO,yBAAwB;IAElE,MAAM,CAACY,YAAYC,mBAAmB,GAAGvB,cAAcgB;IACvD,MAAM,EAAEQ,MAAM,EAAEC,YAAY,EAAE,GAAGvB;IACjC,MAAM,CAACwB,cAAcC,gBAAgB,GAAG5B,SAAS;IACjD,MAAM6B,YAAY3B,wBAAwB;QACxCe,KAAKQ,SAASK,YAAYN;QAC1BO,MAAML;QACNM,UAAUb;QACVc,WAAWR,SAAS,IAAI;QACxBS,eAAenC,YAAY;YACzB,MAAMoC,UAAUZ,WAAWa,OAAO;YAClC,IAAI,CAACf,UAAU;gBACb,MAAMgB,YAAYZ,UAAUU,UAAUA,QAAQG,YAAY,GAAG,IAAI;gBAEjE,OAAO,CAAC,SAAS,EAAED,UAAU,MAAM,CAAC;YACtC;YAEA,IAAI,CAACF,SAAS;gBACZ;YACF;YAEA,IAAIE;YACJ,IAAIZ,QAAQ;gBACVY,YAAYF,QAAQG,YAAY,GAAG;YACrC,OAAO;gBACL,MAAMxB,MAAMyB,WAAW9B,OAAO+B,gBAAgB,CAACL,SAASrB,GAAG;gBAC3DuB,YAAYI,OAAOC,KAAK,CAAC5B,OAAO,IAAIA,MAAM;YAC5C;YAEA,OAAO,CAAC,CAAC,EAAEuB,UAAU,UAAU,CAAC;QAClC,GAAG;YAACZ;YAAQJ;YAAUE;SAAW;QACjCoB,UAAU5C,YACR,CAAC,CAACM,MAAM;YACNuB,gBAAgBN,eAAejB,OAAOoB;QACxC,GACA;YAACA;YAAQH;SAAe;QAE1B,yEAAyE;QACzE,GAAGF,aAAa;IAClB;IAEA,IAAIwB;IACJ,IAAInB,UAAU,CAACN,qBAAqB;QAClC,oEAAoE;QACpE,uEAAuE;QACvEyB,sBAAQ,KAACA;YAAMC,aAAW;YAAC5B,KAAKY;;IAClC;IAEA,OAAO;QACLe;QACAf;QACAN,YAAYE,SAASD,qBAAqBK;QAC1CF;IACF;AACF"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type TableConfigContext, type TableSectionConfiguration } from "./types.js";
|
|
2
|
+
/**
|
|
3
|
+
* @since 6.0.0
|
|
4
|
+
* @internal
|
|
5
|
+
*/
|
|
6
|
+
export interface TableSectionConfigOptions extends TableSectionConfiguration {
|
|
7
|
+
type: "header" | "footer";
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* @since 6.0.0
|
|
11
|
+
* @internal
|
|
12
|
+
*/
|
|
13
|
+
export declare function useTableSectionConfig(options: TableSectionConfigOptions): Readonly<TableConfigContext>;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useMemo } from "react";
|
|
3
|
+
import { useTableConfig } from "./TableConfigurationProvider.js";
|
|
4
|
+
/**
|
|
5
|
+
* @since 6.0.0
|
|
6
|
+
* @internal
|
|
7
|
+
*/ export function useTableSectionConfig(options) {
|
|
8
|
+
const { type, lineWrap: propLineWrap, hoverable } = options;
|
|
9
|
+
// update the table configuration with the custom overrides for the `<thead>/<tfoot>`
|
|
10
|
+
const { dense, hAlign, vAlign, lineWrap, disableHover, disableBorders } = useTableConfig({
|
|
11
|
+
lineWrap: propLineWrap,
|
|
12
|
+
disableHover: !hoverable
|
|
13
|
+
});
|
|
14
|
+
return useMemo(()=>({
|
|
15
|
+
dense,
|
|
16
|
+
header: type === "header",
|
|
17
|
+
hAlign,
|
|
18
|
+
vAlign,
|
|
19
|
+
lineWrap,
|
|
20
|
+
disableBorders,
|
|
21
|
+
disableHover
|
|
22
|
+
}), [
|
|
23
|
+
dense,
|
|
24
|
+
type,
|
|
25
|
+
hAlign,
|
|
26
|
+
vAlign,
|
|
27
|
+
lineWrap,
|
|
28
|
+
disableBorders,
|
|
29
|
+
disableHover
|
|
30
|
+
]);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
//# sourceMappingURL=useTableSectionConfig.js.map
|