visits-style 1.4.11 → 1.4.13

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.
@@ -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
- export default function Tooltip({ children, position, label, color, className, offset, clientPoint, disabled, }: TooltipProps): import("react/jsx-runtime").JSX.Element;
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';
@@ -22,6 +22,8 @@ export interface Props extends SelectHTMLAttributes<HTMLSelectElement> {
22
22
  optional?: boolean;
23
23
  /** エラーが発生しても、エラーメッセージを出さないようにする */
24
24
  noErrorMessage?: boolean;
25
+ /** 矢印をカスタムしたい場合 */
26
+ arrow?: ReactNode;
25
27
  }
26
28
  declare const Select: React.ForwardRefExoticComponent<Props & React.RefAttributes<HTMLSelectElement>>;
27
29
  export default Select;
package/dist/index.cjs.js CHANGED
@@ -336,6 +336,7 @@ const Select = React.forwardRef(({
336
336
  outline,
337
337
  optional,
338
338
  noErrorMessage,
339
+ arrow,
339
340
  ...rest
340
341
  }, ref) => {
341
342
  const list = React.useMemo(() => options.map((item) => typeof item === "string" ? /* @__PURE__ */ jsxRuntime.jsx("option", { value: item, children: render ? render(item) : item }, item) : /* @__PURE__ */ jsxRuntime.jsx("option", { value: item.id, children: render ? render(item.name) : item.name }, item.id)), [options, render]);
@@ -344,7 +345,7 @@ const Select = React.forwardRef(({
344
345
  placeholder && /* @__PURE__ */ jsxRuntime.jsx("option", { value: "", disabled: !optional, children: placeholder }),
345
346
  list
346
347
  ] }),
347
- /* @__PURE__ */ jsxRuntime.jsx(ChevronDown, {}),
348
+ arrow || /* @__PURE__ */ jsxRuntime.jsx(ChevronDown, {}),
348
349
  /* @__PURE__ */ jsxRuntime.jsx(HelpMessage, { help, error, noErrorMessage })
349
350
  ] });
350
351
  });
@@ -674,7 +675,7 @@ const Portal = React__default.default.forwardRef(({
674
675
  Portal.displayName = "Portal";
675
676
  const Portal$1 = Portal;
676
677
 
677
- function Tooltip$1({
678
+ const Tooltip$1 = React.forwardRef(({
678
679
  children,
679
680
  position = "bottom",
680
681
  label,
@@ -686,7 +687,7 @@ function Tooltip$1({
686
687
  },
687
688
  clientPoint = false,
688
689
  disabled
689
- }) {
690
+ }, ref) => {
690
691
  const [open, setOpen] = React.useState(false);
691
692
  const nodeId = react.useId();
692
693
  const {
@@ -711,6 +712,12 @@ function Tooltip$1({
711
712
  }), react.useClientPoint(context, {
712
713
  enabled: clientPoint
713
714
  })]);
715
+ React.useImperativeHandle(ref, () => ({
716
+ floating: refs.floating,
717
+ reference: refs.reference,
718
+ open: () => setOpen(true),
719
+ close: () => setOpen(false)
720
+ }));
714
721
  const child = typeof children === "string" ? /* @__PURE__ */ jsxRuntime.jsx("span", { children }) : children;
715
722
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
716
723
  React.cloneElement(React.Children.only(child), {
@@ -719,7 +726,8 @@ function Tooltip$1({
719
726
  }),
720
727
  /* @__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
728
  ] });
722
- }
729
+ });
730
+ const Tooltip$2 = Tooltip$1;
723
731
  const TooltipWrapper = /* @__PURE__ */ styledComponents.styled.div.withConfig({
724
732
  displayName: "Tooltip__TooltipWrapper",
725
733
  componentId: "sc-1xyhucq-0"
@@ -1540,7 +1548,7 @@ exports.TextButton = TextButton;
1540
1548
  exports.TextInput = TextInput$1;
1541
1549
  exports.Textarea = Textarea$1;
1542
1550
  exports.Toast = Toast;
1543
- exports.Tooltip = Tooltip$1;
1551
+ exports.Tooltip = Tooltip$2;
1544
1552
  exports.arrow = Arrow;
1545
1553
  exports.boxShadow = boxShadow;
1546
1554
  exports.defaultTheme = theme$1;
package/dist/index.es.js CHANGED
@@ -328,6 +328,7 @@ const Select = forwardRef(({
328
328
  outline,
329
329
  optional,
330
330
  noErrorMessage,
331
+ arrow,
331
332
  ...rest
332
333
  }, ref) => {
333
334
  const list = useMemo(() => options.map((item) => typeof item === "string" ? /* @__PURE__ */ jsx("option", { value: item, children: render ? render(item) : item }, item) : /* @__PURE__ */ jsx("option", { value: item.id, children: render ? render(item.name) : item.name }, item.id)), [options, render]);
@@ -336,7 +337,7 @@ const Select = forwardRef(({
336
337
  placeholder && /* @__PURE__ */ jsx("option", { value: "", disabled: !optional, children: placeholder }),
337
338
  list
338
339
  ] }),
339
- /* @__PURE__ */ jsx(ChevronDown, {}),
340
+ arrow || /* @__PURE__ */ jsx(ChevronDown, {}),
340
341
  /* @__PURE__ */ jsx(HelpMessage, { help, error, noErrorMessage })
341
342
  ] });
342
343
  });
@@ -666,7 +667,7 @@ const Portal = React.forwardRef(({
666
667
  Portal.displayName = "Portal";
667
668
  const Portal$1 = Portal;
668
669
 
669
- function Tooltip$1({
670
+ const Tooltip$1 = forwardRef(({
670
671
  children,
671
672
  position = "bottom",
672
673
  label,
@@ -678,7 +679,7 @@ function Tooltip$1({
678
679
  },
679
680
  clientPoint = false,
680
681
  disabled
681
- }) {
682
+ }, ref) => {
682
683
  const [open, setOpen] = useState(false);
683
684
  const nodeId = useId();
684
685
  const {
@@ -703,6 +704,12 @@ function Tooltip$1({
703
704
  }), useClientPoint(context, {
704
705
  enabled: clientPoint
705
706
  })]);
707
+ useImperativeHandle(ref, () => ({
708
+ floating: refs.floating,
709
+ reference: refs.reference,
710
+ open: () => setOpen(true),
711
+ close: () => setOpen(false)
712
+ }));
706
713
  const child = typeof children === "string" ? /* @__PURE__ */ jsx("span", { children }) : children;
707
714
  return /* @__PURE__ */ jsxs(Fragment, { children: [
708
715
  cloneElement(Children.only(child), {
@@ -711,7 +718,8 @@ function Tooltip$1({
711
718
  }),
712
719
  /* @__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
720
  ] });
714
- }
721
+ });
722
+ const Tooltip$2 = Tooltip$1;
715
723
  const TooltipWrapper = /* @__PURE__ */ styled.div.withConfig({
716
724
  displayName: "Tooltip__TooltipWrapper",
717
725
  componentId: "sc-1xyhucq-0"
@@ -1494,4 +1502,4 @@ const normalized = /* @__PURE__ */ css(["*,::after,::before{box-sizing:border-bo
1494
1502
  }) => theme.link);
1495
1503
  const normalized$1 = normalized;
1496
1504
 
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$1 as Tooltip, Arrow as arrow, boxShadow, theme$1 as defaultTheme, findColorInvert, hamburger as hambuger, mediaDesktop, mediaFullHD, mediaMobile, mediaTablet, mediaUntilFullHD, normalized$1 as normalizeStyle, setSize };
1505
+ 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.11",
5
+ "version": "1.4.13",
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.25.0",
30
+ "@floating-ui/react": "^0.26.6",
31
31
  "eslint-config-react-app": "^7.0.1",
32
32
  "polished": "^4.2.2"
33
33
  }