Skip to content

Commit

Permalink
Rename FloatingTooltip component and persistence props to Navlink
Browse files Browse the repository at this point in the history
  • Loading branch information
snehilvj committed Apr 20, 2024
1 parent b83f9c9 commit d67c91f
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 12 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
- Burger component
- Click callback in chart components by subscribing to `clickData` property. This feature might change in future.

### Changed

- TooltipFloating has been renamed to FloatingTooltip as its not a compound component.

# 0.14.1

### Changed
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "dash_mantine_components",
"version": "0.14.1",
"version": "0.14.2",
"description": "Plotly Dash Components based on Mantine",
"main": "index.ts",
"repository": {
Expand Down
13 changes: 11 additions & 2 deletions src/ts/components/core/NavLink.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,16 @@ import {
MantineSize,
} from "@mantine/core";
import { BoxProps } from "props/box";
import { DashBaseProps } from "props/dash";
import { DashBaseProps, PersistenceProps } from "props/dash";
import { StylesApiProps } from "props/styles";
import React, { MouseEvent } from "react";
import { TargetProps, onClick } from "../../utils/anchor";

interface Props extends BoxProps, StylesApiProps, DashBaseProps {
interface Props
extends BoxProps,
StylesApiProps,
DashBaseProps,
PersistenceProps {
/** Main link label */
label?: React.ReactNode;
/** Link description, displayed below the label */
Expand Down Expand Up @@ -55,6 +59,9 @@ const NavLink = (props: Props) => {
refresh,
n_clicks,
children,
persistence,
persisted_props,
persistence_type,
setProps,
...others
} = props;
Expand Down Expand Up @@ -103,6 +110,8 @@ const NavLink = (props: Props) => {

NavLink.defaultProps = {
n_clicks: 0,
persisted_props: ["opened"],
persistence_type: "local",
};

export default NavLink;
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Box, TooltipFloating as MantineTooltipFloating } from "@mantine/core";
import { Box, Tooltip } from "@mantine/core";
import { BoxProps } from "props/box";
import { DashBaseProps } from "props/dash";
import { TooltipBaseProps } from "props/tooltip";
Expand All @@ -11,18 +11,18 @@ interface Props extends TooltipBaseProps, DashBaseProps {
boxWrapperProps?: BoxProps;
}

/** TooltipFloating */
const TooltipFloating = (props: Props) => {
/** FloatingTooltip */
const FloatingTooltip = (props: Props) => {
const { children, boxWrapperProps, setProps, ...others } = props;
const boxProps = { w: "fit-content", ...boxWrapperProps };

return (
<MantineTooltipFloating {...others}>
<Tooltip.Floating {...others}>
<Box {...boxProps}>{children}</Box>
</MantineTooltipFloating>
</Tooltip.Floating>
);
};

TooltipFloating.defaultProps = {};
FloatingTooltip.defaultProps = {};

export default TooltipFloating;
export default FloatingTooltip;
4 changes: 2 additions & 2 deletions src/ts/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,8 @@ import TabsPanel from "./components/core/tabs/TabsPanel";
import TabsTab from "./components/core/tabs/TabsTab";
import Timeline from "./components/core/timeline/Timeline";
import TimelineItem from "./components/core/timeline/TimelineItem";
import FloatingTooltip from "./components/core/tooltip/FloatingTooltip";
import Tooltip from "./components/core/tooltip/Tooltip";
import TooltipFloating from "./components/core/tooltip/TooltipFloating";
import DateInput from "./components/dates/DateInput";
import DatePicker from "./components/dates/DatePicker";
import DateTimePicker from "./components/dates/DateTimePicker";
Expand Down Expand Up @@ -200,6 +200,7 @@ export {
Drawer,
Fieldset,
Flex,
FloatingTooltip,
Grid,
GridCol,
Group,
Expand Down Expand Up @@ -288,7 +289,6 @@ export {
TimelineItem,
Title,
Tooltip,
TooltipFloating,
UnstyledButton,
VisuallyHidden,
};

0 comments on commit d67c91f

Please sign in to comment.