visits-style 1.4.10 → 1.4.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/Tooltip/index.d.ts +10 -3
- package/dist/components/index.d.ts +1 -1
- package/dist/index.cjs.js +13 -6
- package/dist/index.es.js +13 -6
- package/package.json +2 -2
|
@@ -1,6 +1,12 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import type { Placement } from '@floating-ui/core';
|
|
1
|
+
import React, { MutableRefObject } from 'react';
|
|
2
|
+
import type { Placement, ReferenceElement } from '@floating-ui/core';
|
|
3
3
|
import { ColorType } from '../../types';
|
|
4
|
+
export interface TooltipRef {
|
|
5
|
+
floating: MutableRefObject<HTMLElement | null>;
|
|
6
|
+
reference: MutableRefObject<ReferenceElement | null>;
|
|
7
|
+
open: () => void;
|
|
8
|
+
close: () => void;
|
|
9
|
+
}
|
|
4
10
|
export interface TooltipProps {
|
|
5
11
|
/** 吹き出しとして表示したい内容 */
|
|
6
12
|
label: React.ReactNode;
|
|
@@ -27,4 +33,5 @@ export interface TooltipProps {
|
|
|
27
33
|
disabled?: boolean;
|
|
28
34
|
className?: string;
|
|
29
35
|
}
|
|
30
|
-
|
|
36
|
+
declare const Tooltip: React.ForwardRefExoticComponent<TooltipProps & React.RefAttributes<TooltipRef>>;
|
|
37
|
+
export default Tooltip;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export * from '../forms';
|
|
2
2
|
export { default as Accordion, type Props as AccordionProps } from './Accordion';
|
|
3
3
|
export { default as AppBar, type Props as AppBarProps } from './AppBar';
|
|
4
|
-
export { default as Tooltip, type TooltipProps } from './Tooltip';
|
|
4
|
+
export { default as Tooltip, type TooltipProps, type TooltipRef } from './Tooltip';
|
|
5
5
|
export { default as Popover, type Props as PopoverProps, type PopoverRef } from './Popover';
|
|
6
6
|
export { default as Portal, type Props as PortalProps } from './Portal';
|
|
7
7
|
export { default as Modal, type Props as ModalProps } from './Modal';
|
package/dist/index.cjs.js
CHANGED
|
@@ -674,7 +674,7 @@ const Portal = React__default.default.forwardRef(({
|
|
|
674
674
|
Portal.displayName = "Portal";
|
|
675
675
|
const Portal$1 = Portal;
|
|
676
676
|
|
|
677
|
-
|
|
677
|
+
const Tooltip$1 = React.forwardRef(({
|
|
678
678
|
children,
|
|
679
679
|
position = "bottom",
|
|
680
680
|
label,
|
|
@@ -686,7 +686,7 @@ function Tooltip$1({
|
|
|
686
686
|
},
|
|
687
687
|
clientPoint = false,
|
|
688
688
|
disabled
|
|
689
|
-
}) {
|
|
689
|
+
}, ref) => {
|
|
690
690
|
const [open, setOpen] = React.useState(false);
|
|
691
691
|
const nodeId = react.useId();
|
|
692
692
|
const {
|
|
@@ -711,15 +711,22 @@ function Tooltip$1({
|
|
|
711
711
|
}), react.useClientPoint(context, {
|
|
712
712
|
enabled: clientPoint
|
|
713
713
|
})]);
|
|
714
|
+
React.useImperativeHandle(ref, () => ({
|
|
715
|
+
floating: refs.floating,
|
|
716
|
+
reference: refs.reference,
|
|
717
|
+
open: () => setOpen(true),
|
|
718
|
+
close: () => setOpen(false)
|
|
719
|
+
}));
|
|
714
720
|
const child = typeof children === "string" ? /* @__PURE__ */ jsxRuntime.jsx("span", { children }) : children;
|
|
715
721
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
716
722
|
React.cloneElement(React.Children.only(child), {
|
|
717
723
|
ref: refs.setReference,
|
|
718
724
|
...getReferenceProps()
|
|
719
725
|
}),
|
|
720
|
-
/* @__PURE__ */ jsxRuntime.jsx(Portal$1, { children: open ? /* @__PURE__ */ jsxRuntime.jsx(TooltipWrapper, { className, ref: refs.setFloating, role: "tooltip", $color: color, style: floatingStyles, ...getFloatingProps(), children: label }) : null })
|
|
726
|
+
/* @__PURE__ */ jsxRuntime.jsx(Portal$1, { children: open && !disabled ? /* @__PURE__ */ jsxRuntime.jsx(TooltipWrapper, { className, ref: refs.setFloating, role: "tooltip", $color: color, style: floatingStyles, ...getFloatingProps(), children: label }) : null })
|
|
721
727
|
] });
|
|
722
|
-
}
|
|
728
|
+
});
|
|
729
|
+
const Tooltip$2 = Tooltip$1;
|
|
723
730
|
const TooltipWrapper = /* @__PURE__ */ styledComponents.styled.div.withConfig({
|
|
724
731
|
displayName: "Tooltip__TooltipWrapper",
|
|
725
732
|
componentId: "sc-1xyhucq-0"
|
|
@@ -835,7 +842,7 @@ const Popover = React.forwardRef(({
|
|
|
835
842
|
onClick: stopPropagation$1
|
|
836
843
|
})
|
|
837
844
|
}),
|
|
838
|
-
/* @__PURE__ */ jsxRuntime.jsx(Portal$1, { children: open ? /* @__PURE__ */ jsxRuntime.jsx(react.FloatingOverlay, { "data-testid": "visits-style-shadow", onClick: handleBlur, style: {
|
|
845
|
+
/* @__PURE__ */ jsxRuntime.jsx(Portal$1, { children: open && !disabled ? /* @__PURE__ */ jsxRuntime.jsx(react.FloatingOverlay, { "data-testid": "visits-style-shadow", onClick: handleBlur, style: {
|
|
839
846
|
zIndex
|
|
840
847
|
}, children: /* @__PURE__ */ jsxRuntime.jsx(Tooltip, { role: "tooltip", ref: refs.setFloating, color, style: floatingStyles, ...getFloatingProps({
|
|
841
848
|
...rest,
|
|
@@ -1540,7 +1547,7 @@ exports.TextButton = TextButton;
|
|
|
1540
1547
|
exports.TextInput = TextInput$1;
|
|
1541
1548
|
exports.Textarea = Textarea$1;
|
|
1542
1549
|
exports.Toast = Toast;
|
|
1543
|
-
exports.Tooltip = Tooltip$
|
|
1550
|
+
exports.Tooltip = Tooltip$2;
|
|
1544
1551
|
exports.arrow = Arrow;
|
|
1545
1552
|
exports.boxShadow = boxShadow;
|
|
1546
1553
|
exports.defaultTheme = theme$1;
|
package/dist/index.es.js
CHANGED
|
@@ -666,7 +666,7 @@ const Portal = React.forwardRef(({
|
|
|
666
666
|
Portal.displayName = "Portal";
|
|
667
667
|
const Portal$1 = Portal;
|
|
668
668
|
|
|
669
|
-
|
|
669
|
+
const Tooltip$1 = forwardRef(({
|
|
670
670
|
children,
|
|
671
671
|
position = "bottom",
|
|
672
672
|
label,
|
|
@@ -678,7 +678,7 @@ function Tooltip$1({
|
|
|
678
678
|
},
|
|
679
679
|
clientPoint = false,
|
|
680
680
|
disabled
|
|
681
|
-
}) {
|
|
681
|
+
}, ref) => {
|
|
682
682
|
const [open, setOpen] = useState(false);
|
|
683
683
|
const nodeId = useId();
|
|
684
684
|
const {
|
|
@@ -703,15 +703,22 @@ function Tooltip$1({
|
|
|
703
703
|
}), useClientPoint(context, {
|
|
704
704
|
enabled: clientPoint
|
|
705
705
|
})]);
|
|
706
|
+
useImperativeHandle(ref, () => ({
|
|
707
|
+
floating: refs.floating,
|
|
708
|
+
reference: refs.reference,
|
|
709
|
+
open: () => setOpen(true),
|
|
710
|
+
close: () => setOpen(false)
|
|
711
|
+
}));
|
|
706
712
|
const child = typeof children === "string" ? /* @__PURE__ */ jsx("span", { children }) : children;
|
|
707
713
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
708
714
|
cloneElement(Children.only(child), {
|
|
709
715
|
ref: refs.setReference,
|
|
710
716
|
...getReferenceProps()
|
|
711
717
|
}),
|
|
712
|
-
/* @__PURE__ */ jsx(Portal$1, { children: open ? /* @__PURE__ */ jsx(TooltipWrapper, { className, ref: refs.setFloating, role: "tooltip", $color: color, style: floatingStyles, ...getFloatingProps(), children: label }) : null })
|
|
718
|
+
/* @__PURE__ */ jsx(Portal$1, { children: open && !disabled ? /* @__PURE__ */ jsx(TooltipWrapper, { className, ref: refs.setFloating, role: "tooltip", $color: color, style: floatingStyles, ...getFloatingProps(), children: label }) : null })
|
|
713
719
|
] });
|
|
714
|
-
}
|
|
720
|
+
});
|
|
721
|
+
const Tooltip$2 = Tooltip$1;
|
|
715
722
|
const TooltipWrapper = /* @__PURE__ */ styled.div.withConfig({
|
|
716
723
|
displayName: "Tooltip__TooltipWrapper",
|
|
717
724
|
componentId: "sc-1xyhucq-0"
|
|
@@ -827,7 +834,7 @@ const Popover = forwardRef(({
|
|
|
827
834
|
onClick: stopPropagation$1
|
|
828
835
|
})
|
|
829
836
|
}),
|
|
830
|
-
/* @__PURE__ */ jsx(Portal$1, { children: open ? /* @__PURE__ */ jsx(FloatingOverlay, { "data-testid": "visits-style-shadow", onClick: handleBlur, style: {
|
|
837
|
+
/* @__PURE__ */ jsx(Portal$1, { children: open && !disabled ? /* @__PURE__ */ jsx(FloatingOverlay, { "data-testid": "visits-style-shadow", onClick: handleBlur, style: {
|
|
831
838
|
zIndex
|
|
832
839
|
}, children: /* @__PURE__ */ jsx(Tooltip, { role: "tooltip", ref: refs.setFloating, color, style: floatingStyles, ...getFloatingProps({
|
|
833
840
|
...rest,
|
|
@@ -1494,4 +1501,4 @@ const normalized = /* @__PURE__ */ css(["*,::after,::before{box-sizing:border-bo
|
|
|
1494
1501
|
}) => theme.link);
|
|
1495
1502
|
const normalized$1 = normalized;
|
|
1496
1503
|
|
|
1497
|
-
export { Accordion, AppBar, Box, Button, ButtonGroup, Checkbox$1 as Checkbox, Col$1 as Col, Container, index$3 as Content, index as Divider, Field, Approved as IconApproved, ChevronDown as IconArrowDown, ChevronLeftRound as IconChevronLeftRound, ChevronRightRound as IconChevronRightRound, Close as IconClose, FileRound as IconFileRound, Pencil as IconPencil, PencilSimple as IconPencilSimple, Plus as IconPlus, Refresh as IconRefresh, User as IconUser, Modal, index$2 as Placeholder, Popover$1 as Popover, Portal$1 as Portal, Progress, Radio$1 as Radio, Row, Select$1 as Select, Spinner$1 as Spinner, Switch$1 as Switch, index$1 as Table, Tag, TextButton, TextInput$1 as TextInput, Textarea$1 as Textarea, Toast, Tooltip$
|
|
1504
|
+
export { Accordion, AppBar, Box, Button, ButtonGroup, Checkbox$1 as Checkbox, Col$1 as Col, Container, index$3 as Content, index as Divider, Field, Approved as IconApproved, ChevronDown as IconArrowDown, ChevronLeftRound as IconChevronLeftRound, ChevronRightRound as IconChevronRightRound, Close as IconClose, FileRound as IconFileRound, Pencil as IconPencil, PencilSimple as IconPencilSimple, Plus as IconPlus, Refresh as IconRefresh, User as IconUser, Modal, index$2 as Placeholder, Popover$1 as Popover, Portal$1 as Portal, Progress, Radio$1 as Radio, Row, Select$1 as Select, Spinner$1 as Spinner, Switch$1 as Switch, index$1 as Table, Tag, TextButton, TextInput$1 as TextInput, Textarea$1 as Textarea, Toast, Tooltip$2 as Tooltip, Arrow as arrow, boxShadow, theme$1 as defaultTheme, findColorInvert, hamburger as hambuger, mediaDesktop, mediaFullHD, mediaMobile, mediaTablet, mediaUntilFullHD, normalized$1 as normalizeStyle, setSize };
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "visits-style",
|
|
3
3
|
"repository": "https://github.com/visits-works/visits-style",
|
|
4
4
|
"homepage": "https://github.com/visits-works/visits-style",
|
|
5
|
-
"version": "1.4.
|
|
5
|
+
"version": "1.4.12",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "./dist/index.cjs.js",
|
|
8
8
|
"module": "./dist/index.es.js",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"styled-components": ">=6.0.5"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@floating-ui/react": "^0.
|
|
30
|
+
"@floating-ui/react": "^0.26.4",
|
|
31
31
|
"eslint-config-react-app": "^7.0.1",
|
|
32
32
|
"polished": "^4.2.2"
|
|
33
33
|
}
|