@salt-ds/core 1.8.2 → 1.9.0
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-cjs/accordion/Accordion.js +1 -1
- package/dist-cjs/accordion/AccordionContext.js +1 -1
- package/dist-cjs/accordion/AccordionGroup.js +1 -1
- package/dist-cjs/accordion/AccordionGroup.js.map +1 -1
- package/dist-cjs/accordion/AccordionHeader.js +1 -1
- package/dist-cjs/accordion/AccordionHeader.js.map +1 -1
- package/dist-cjs/accordion/AccordionPanel.js +1 -1
- package/dist-cjs/accordion/AccordionPanel.js.map +1 -1
- package/dist-cjs/aria-announcer/useAriaAnnouncer.js +1 -1
- package/dist-cjs/avatar/Avatar.js +1 -1
- package/dist-cjs/avatar/useAvatarImage.js +1 -1
- package/dist-cjs/banner/Banner.js +1 -1
- package/dist-cjs/banner/BannerActions.js +17 -15
- package/dist-cjs/banner/BannerActions.js.map +1 -1
- package/dist-cjs/banner/BannerContent.js +17 -15
- package/dist-cjs/banner/BannerContent.js.map +1 -1
- package/dist-cjs/border-item/BorderItem.js +1 -1
- package/dist-cjs/border-item/BorderItem.js.map +1 -1
- package/dist-cjs/border-layout/BorderLayout.js +1 -1
- package/dist-cjs/button/Button.css.js +1 -1
- package/dist-cjs/button/Button.js +1 -1
- package/dist-cjs/button/Button.js.map +1 -1
- package/dist-cjs/card/Card.js +1 -1
- package/dist-cjs/card/InteractableCard.js +1 -1
- package/dist-cjs/checkbox/Checkbox.js +1 -1
- package/dist-cjs/checkbox/CheckboxGroup.js +1 -1
- package/dist-cjs/checkbox/CheckboxIcon.js +1 -1
- package/dist-cjs/flex-item/FlexItem.js +1 -1
- package/dist-cjs/flex-item/FlexItem.js.map +1 -1
- package/dist-cjs/flex-layout/FlexLayout.js +1 -1
- package/dist-cjs/flex-layout/FlexLayout.js.map +1 -1
- package/dist-cjs/form-field/FormField.css.js +1 -1
- package/dist-cjs/form-field/FormField.js +1 -1
- package/dist-cjs/form-field/FormFieldHelperText.js +1 -1
- package/dist-cjs/form-field/FormFieldLabel.js +1 -1
- package/dist-cjs/form-field-context/FormFieldContext.js +1 -1
- package/dist-cjs/grid-item/GridItem.js +1 -1
- package/dist-cjs/grid-item/GridItem.js.map +1 -1
- package/dist-cjs/grid-layout/GridLayout.js +1 -1
- package/dist-cjs/index.js +5 -1
- package/dist-cjs/index.js.map +1 -1
- package/dist-cjs/input/Input.js +1 -1
- package/dist-cjs/link/Link.js +1 -1
- package/dist-cjs/multiline-input/MultilineInput.js +1 -1
- package/dist-cjs/panel/Panel.js +1 -1
- package/dist-cjs/radio-button/RadioButton.js +1 -1
- package/dist-cjs/radio-button/RadioButtonGroup.js +1 -1
- package/dist-cjs/radio-button/RadioButtonIcon.js +1 -1
- package/dist-cjs/radio-button/internal/RadioGroupContext.js +1 -1
- package/dist-cjs/salt-provider/SaltProvider.js +1 -1
- package/dist-cjs/spinner/Spinner.js +1 -1
- package/dist-cjs/spinner/Spinner.js.map +1 -1
- package/dist-cjs/spinner/svgSpinners/SpinnerSVG.js +1 -1
- package/dist-cjs/stack-layout/StackLayout.js +1 -1
- package/dist-cjs/status-adornment/StatusAdornment.js +1 -1
- package/dist-cjs/status-indicator/StatusIndicator.js +1 -1
- package/dist-cjs/status-indicator/ValidationStatus.js.map +1 -1
- package/dist-cjs/text/Display.js +1 -1
- package/dist-cjs/text/Text.js +1 -1
- package/dist-cjs/theme/Density.js.map +1 -1
- package/dist-cjs/theme/Mode.js.map +1 -1
- package/dist-cjs/toast/Toast.js +1 -1
- package/dist-cjs/toast/ToastContent.js +1 -1
- package/dist-cjs/toast/ToastContent.js.map +1 -1
- package/dist-cjs/toggle-button/ToggleButton.js +1 -1
- package/dist-cjs/toggle-button-group/ToggleButtonGroup.js +1 -1
- package/dist-cjs/toggle-button-group/ToggleButtonGroupContext.js +1 -1
- package/dist-cjs/tooltip/Tooltip.js +19 -53
- package/dist-cjs/tooltip/Tooltip.js.map +1 -1
- package/dist-cjs/tooltip/TooltipBase.js +62 -0
- package/dist-cjs/tooltip/TooltipBase.js.map +1 -0
- package/dist-cjs/tooltip/useAriaAnnounce.js +1 -1
- package/dist-cjs/tooltip/useTooltip.js +16 -9
- package/dist-cjs/tooltip/useTooltip.js.map +1 -1
- package/dist-cjs/utils/useFloatingUI/useFloatingUI.js +124 -0
- package/dist-cjs/utils/useFloatingUI/useFloatingUI.js.map +1 -0
- package/dist-cjs/viewport/ViewportProvider.js +1 -1
- package/dist-es/accordion/Accordion.js +1 -1
- package/dist-es/accordion/AccordionContext.js +1 -1
- package/dist-es/accordion/AccordionGroup.js +1 -1
- package/dist-es/accordion/AccordionGroup.js.map +1 -1
- package/dist-es/accordion/AccordionHeader.js +1 -1
- package/dist-es/accordion/AccordionHeader.js.map +1 -1
- package/dist-es/accordion/AccordionPanel.js +1 -1
- package/dist-es/accordion/AccordionPanel.js.map +1 -1
- package/dist-es/aria-announcer/useAriaAnnouncer.js +1 -1
- package/dist-es/avatar/Avatar.js +1 -1
- package/dist-es/avatar/useAvatarImage.js +1 -1
- package/dist-es/banner/Banner.js +1 -1
- package/dist-es/banner/BannerActions.js +17 -15
- package/dist-es/banner/BannerActions.js.map +1 -1
- package/dist-es/banner/BannerContent.js +17 -15
- package/dist-es/banner/BannerContent.js.map +1 -1
- package/dist-es/border-item/BorderItem.js +1 -1
- package/dist-es/border-item/BorderItem.js.map +1 -1
- package/dist-es/border-layout/BorderLayout.js +1 -1
- package/dist-es/button/Button.css.js +1 -1
- package/dist-es/button/Button.js +1 -1
- package/dist-es/button/Button.js.map +1 -1
- package/dist-es/card/Card.js +1 -1
- package/dist-es/card/InteractableCard.js +1 -1
- package/dist-es/checkbox/Checkbox.js +1 -1
- package/dist-es/checkbox/CheckboxGroup.js +1 -1
- package/dist-es/checkbox/CheckboxIcon.js +1 -1
- package/dist-es/flex-item/FlexItem.js +1 -1
- package/dist-es/flex-item/FlexItem.js.map +1 -1
- package/dist-es/flex-layout/FlexLayout.js +1 -1
- package/dist-es/flex-layout/FlexLayout.js.map +1 -1
- package/dist-es/form-field/FormField.css.js +1 -1
- package/dist-es/form-field/FormField.js +1 -1
- package/dist-es/form-field/FormFieldHelperText.js +1 -1
- package/dist-es/form-field/FormFieldLabel.js +1 -1
- package/dist-es/form-field-context/FormFieldContext.js +1 -1
- package/dist-es/grid-item/GridItem.js +1 -1
- package/dist-es/grid-item/GridItem.js.map +1 -1
- package/dist-es/grid-layout/GridLayout.js +1 -1
- package/dist-es/index.js +1 -1
- package/dist-es/input/Input.js +1 -1
- package/dist-es/link/Link.js +1 -1
- package/dist-es/multiline-input/MultilineInput.js +1 -1
- package/dist-es/panel/Panel.js +1 -1
- package/dist-es/radio-button/RadioButton.js +1 -1
- package/dist-es/radio-button/RadioButtonGroup.js +1 -1
- package/dist-es/radio-button/RadioButtonIcon.js +1 -1
- package/dist-es/radio-button/internal/RadioGroupContext.js +1 -1
- package/dist-es/salt-provider/SaltProvider.js +1 -1
- package/dist-es/spinner/Spinner.js +1 -1
- package/dist-es/spinner/Spinner.js.map +1 -1
- package/dist-es/spinner/svgSpinners/SpinnerSVG.js +1 -1
- package/dist-es/stack-layout/StackLayout.js +1 -1
- package/dist-es/status-adornment/StatusAdornment.js +1 -1
- package/dist-es/status-indicator/StatusIndicator.js +1 -1
- package/dist-es/status-indicator/ValidationStatus.js.map +1 -1
- package/dist-es/text/Display.js +1 -1
- package/dist-es/text/Text.js +1 -1
- package/dist-es/theme/Density.js.map +1 -1
- package/dist-es/theme/Mode.js.map +1 -1
- package/dist-es/toast/Toast.js +1 -1
- package/dist-es/toast/ToastContent.js +1 -1
- package/dist-es/toast/ToastContent.js.map +1 -1
- package/dist-es/toggle-button/ToggleButton.js +1 -1
- package/dist-es/toggle-button-group/ToggleButtonGroup.js +1 -1
- package/dist-es/toggle-button-group/ToggleButtonGroupContext.js +1 -1
- package/dist-es/tooltip/Tooltip.js +19 -53
- package/dist-es/tooltip/Tooltip.js.map +1 -1
- package/dist-es/tooltip/TooltipBase.js +58 -0
- package/dist-es/tooltip/TooltipBase.js.map +1 -0
- package/dist-es/tooltip/useAriaAnnounce.js +1 -1
- package/dist-es/tooltip/useTooltip.js +16 -9
- package/dist-es/tooltip/useTooltip.js.map +1 -1
- package/dist-es/utils/useFloatingUI/useFloatingUI.js +115 -0
- package/dist-es/utils/useFloatingUI/useFloatingUI.js.map +1 -0
- package/dist-es/viewport/ViewportProvider.js +1 -1
- package/dist-types/accordion/AccordionGroup.d.ts +8 -3
- package/dist-types/accordion/AccordionHeader.d.ts +8 -3
- package/dist-types/accordion/AccordionPanel.d.ts +8 -3
- package/dist-types/aria-announcer/AriaAnnouncerContext.d.ts +0 -1
- package/dist-types/banner/BannerActions.d.ts +9 -2
- package/dist-types/banner/BannerContent.d.ts +9 -2
- package/dist-types/border-item/BorderItem.d.ts +1 -1
- package/dist-types/button/Button.d.ts +1 -1
- package/dist-types/checkbox/CheckboxIcon.d.ts +0 -1
- package/dist-types/checkbox/internal/CheckboxGroupContext.d.ts +0 -1
- package/dist-types/flex-item/FlexItem.d.ts +1 -1
- package/dist-types/flex-layout/FlexLayout.d.ts +2 -2
- package/dist-types/form-field/FormFieldHelperText.d.ts +0 -1
- package/dist-types/form-field/FormFieldLabel.d.ts +0 -1
- package/dist-types/form-field-context/FormFieldContext.d.ts +0 -1
- package/dist-types/grid-item/GridItem.d.ts +1 -1
- package/dist-types/spinner/Spinner.d.ts +1 -1
- package/dist-types/status-adornment/ErrorAdornment.d.ts +0 -1
- package/dist-types/status-adornment/StatusAdornment.d.ts +0 -1
- package/dist-types/status-adornment/SuccessAdornment.d.ts +0 -1
- package/dist-types/status-adornment/WarningAdornment.d.ts +0 -1
- package/dist-types/status-indicator/StatusIndicator.d.ts +0 -1
- package/dist-types/status-indicator/ValidationStatus.d.ts +1 -1
- package/dist-types/text/Display.d.ts +0 -1
- package/dist-types/text/Headings.d.ts +0 -1
- package/dist-types/text/Label.d.ts +0 -1
- package/dist-types/theme/Density.d.ts +1 -1
- package/dist-types/theme/Mode.d.ts +1 -1
- package/dist-types/toast/ToastContent.d.ts +8 -2
- package/dist-types/tooltip/TooltipBase.d.ts +12 -0
- package/dist-types/tooltip/useTooltip.d.ts +12 -5
- package/dist-types/utils/useFloatingUI/index.d.ts +1 -0
- package/dist-types/utils/useFloatingUI/useFloatingUI.d.ts +77 -0
- package/package.json +1 -1
- package/dist-cjs/utils/useFloatingUI.js +0 -38
- package/dist-cjs/utils/useFloatingUI.js.map +0 -1
- package/dist-es/utils/useFloatingUI.js +0 -33
- package/dist-es/utils/useFloatingUI.js.map +0 -1
- package/dist-types/utils/useFloatingUI.d.ts +0 -34
|
@@ -1,21 +1,17 @@
|
|
|
1
1
|
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
2
2
|
import { clsx } from 'clsx';
|
|
3
3
|
import { forwardRef, isValidElement, cloneElement } from 'react';
|
|
4
|
-
import { FloatingPortal, FloatingArrow } from '@floating-ui/react';
|
|
5
|
-
import { useWindow } from '@salt-ds/window';
|
|
6
|
-
import { useComponentCssInjection } from '@salt-ds/styles';
|
|
7
|
-
import { StatusIndicator } from '../status-indicator/StatusIndicator.js';
|
|
8
4
|
import { makePrefixer } from '../utils/makePrefixer.js';
|
|
9
|
-
import '../utils/useFloatingUI.js';
|
|
5
|
+
import { useFloatingComponent } from '../utils/useFloatingUI/useFloatingUI.js';
|
|
10
6
|
import { useForkRef } from '../utils/useForkRef.js';
|
|
11
7
|
import '../utils/useId.js';
|
|
12
|
-
import
|
|
8
|
+
import '../salt-provider/SaltProvider.js';
|
|
13
9
|
import '../viewport/ViewportProvider.js';
|
|
14
10
|
import { mergeProps } from '../utils/mergeProps.js';
|
|
15
11
|
import { useTooltip } from './useTooltip.js';
|
|
16
|
-
import css_248z from './Tooltip.css.js';
|
|
17
12
|
import '../form-field-context/FormFieldContext.js';
|
|
18
13
|
import { useFormFieldProps } from '../form-field-context/useFormFieldProps.js';
|
|
14
|
+
import { TooltipBase } from './TooltipBase.js';
|
|
19
15
|
|
|
20
16
|
const withBaseName = makePrefixer("saltTooltip");
|
|
21
17
|
const Tooltip = forwardRef(
|
|
@@ -23,7 +19,7 @@ const Tooltip = forwardRef(
|
|
|
23
19
|
const {
|
|
24
20
|
children,
|
|
25
21
|
className,
|
|
26
|
-
disabled: disabledProp,
|
|
22
|
+
disabled: disabledProp = false,
|
|
27
23
|
hideArrow = false,
|
|
28
24
|
hideIcon = false,
|
|
29
25
|
open: openProp,
|
|
@@ -35,18 +31,12 @@ const Tooltip = forwardRef(
|
|
|
35
31
|
...rest
|
|
36
32
|
} = props;
|
|
37
33
|
const {
|
|
38
|
-
a11yProps,
|
|
39
34
|
disabled: formFieldDisabled,
|
|
40
35
|
validationStatus: formFieldValidationStatus
|
|
41
36
|
} = useFormFieldProps();
|
|
42
37
|
const disabled = formFieldDisabled != null ? formFieldDisabled : disabledProp;
|
|
43
38
|
const status = formFieldValidationStatus != null ? formFieldValidationStatus : statusProp;
|
|
44
|
-
const
|
|
45
|
-
useComponentCssInjection({
|
|
46
|
-
testId: "salt-tooltip",
|
|
47
|
-
css: css_248z,
|
|
48
|
-
window: targetWindow
|
|
49
|
-
});
|
|
39
|
+
const { Component: FloatingComponent } = useFloatingComponent();
|
|
50
40
|
const hookProps = {
|
|
51
41
|
open: openProp,
|
|
52
42
|
placement,
|
|
@@ -60,7 +50,8 @@ const Tooltip = forwardRef(
|
|
|
60
50
|
floating,
|
|
61
51
|
reference,
|
|
62
52
|
getTriggerProps,
|
|
63
|
-
getTooltipProps
|
|
53
|
+
getTooltipProps,
|
|
54
|
+
getTooltipPosition
|
|
64
55
|
} = useTooltip(hookProps);
|
|
65
56
|
const triggerRef = useForkRef(
|
|
66
57
|
isValidElement(children) ? children.ref : null,
|
|
@@ -73,43 +64,18 @@ const Tooltip = forwardRef(
|
|
|
73
64
|
...mergeProps(getTriggerProps(), children.props),
|
|
74
65
|
ref: triggerRef
|
|
75
66
|
}),
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
className: withBaseName("container"),
|
|
89
|
-
children: [
|
|
90
|
-
!hideIcon && /* @__PURE__ */ jsx(StatusIndicator, {
|
|
91
|
-
status,
|
|
92
|
-
size: 1,
|
|
93
|
-
className: withBaseName("icon")
|
|
94
|
-
}),
|
|
95
|
-
/* @__PURE__ */ jsx("span", {
|
|
96
|
-
id: a11yProps == null ? void 0 : a11yProps["aria-describedby"],
|
|
97
|
-
className: withBaseName("content"),
|
|
98
|
-
children: content
|
|
99
|
-
})
|
|
100
|
-
]
|
|
101
|
-
}),
|
|
102
|
-
!hideArrow && /* @__PURE__ */ jsx(FloatingArrow, {
|
|
103
|
-
...arrowProps,
|
|
104
|
-
className: withBaseName("arrow"),
|
|
105
|
-
strokeWidth: 1,
|
|
106
|
-
fill: "var(--salt-container-primary-background)",
|
|
107
|
-
stroke: "var(--tooltip-status-borderColor)",
|
|
108
|
-
height: 5,
|
|
109
|
-
width: 10
|
|
110
|
-
})
|
|
111
|
-
]
|
|
112
|
-
})
|
|
67
|
+
/* @__PURE__ */ jsx(FloatingComponent, {
|
|
68
|
+
className: clsx(withBaseName(), withBaseName(status), className),
|
|
69
|
+
open: open && !disabled,
|
|
70
|
+
ref: floatingRef,
|
|
71
|
+
...getTooltipProps(),
|
|
72
|
+
...getTooltipPosition(),
|
|
73
|
+
children: /* @__PURE__ */ jsx(TooltipBase, {
|
|
74
|
+
hideIcon,
|
|
75
|
+
status,
|
|
76
|
+
content,
|
|
77
|
+
hideArrow,
|
|
78
|
+
arrowProps
|
|
113
79
|
})
|
|
114
80
|
})
|
|
115
81
|
]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tooltip.js","sources":["../src/tooltip/Tooltip.tsx"],"sourcesContent":["import { clsx } from \"clsx\";\nimport {\n cloneElement,\n forwardRef,\n HTMLAttributes,\n isValidElement,\n ReactNode,\n
|
|
1
|
+
{"version":3,"file":"Tooltip.js","sources":["../src/tooltip/Tooltip.tsx"],"sourcesContent":["import { clsx } from \"clsx\";\nimport {\n cloneElement,\n forwardRef,\n HTMLAttributes,\n isValidElement,\n ReactNode,\n} from \"react\";\n\nimport { ValidationStatus } from \"../status-indicator\";\nimport {\n makePrefixer,\n mergeProps,\n UseFloatingUIProps,\n useForkRef,\n useFloatingComponent,\n} from \"../utils\";\n\nimport { useTooltip, UseTooltipProps } from \"./useTooltip\";\nimport { useFormFieldProps } from \"../form-field-context\";\nimport { TooltipBase } from \"./TooltipBase\";\n\nconst withBaseName = makePrefixer(\"saltTooltip\");\n\nexport interface TooltipProps\n extends Pick<UseFloatingUIProps, \"open\" | \"onOpenChange\" | \"placement\">,\n Omit<HTMLAttributes<HTMLDivElement>, \"content\"> {\n /**\n * The children will be the Tooltip's trigger.\n */\n children: ReactNode;\n /**\n * Whether to hide the Tooltip arrow. Defaults to `false`.\n */\n hideArrow?: boolean;\n /**\n * Whether to hide the status icon within the Tooltip. Defaults to `false`.\n */\n hideIcon?: boolean;\n /**\n * Content displayed inside the Tooltip. Can be a string or a React component.\n */\n content: ReactNode;\n /**\n * A string to determine the status of the Tooltip. Defaults to `info`.\n */\n status?: ValidationStatus;\n /**\n * Delay in milliseconds before the Tooltip is shown.\n */\n enterDelay?: number;\n /**\n * Delay in milliseconds before the Tooltip is hidden. Defaults to 300ms.\n */\n leaveDelay?: number;\n /**\n * Option to not display the Tooltip. Can be used in conditional situations like text truncation. Defaults to 0.\n */\n disabled?: boolean;\n /**\n * Option to remove the hover listener.\n */\n disableHoverListener?: boolean;\n /**\n * Option to remove the focus listener.\n */\n disableFocusListener?: boolean;\n}\n\nexport const Tooltip = forwardRef<HTMLDivElement, TooltipProps>(\n function Tooltip(props, ref) {\n const {\n children,\n className,\n disabled: disabledProp = false,\n hideArrow = false,\n hideIcon = false,\n open: openProp,\n content,\n status: statusProp = \"info\",\n placement = \"right\",\n enterDelay = 300,\n leaveDelay = 0,\n ...rest\n } = props;\n\n const {\n disabled: formFieldDisabled,\n validationStatus: formFieldValidationStatus,\n } = useFormFieldProps();\n\n const disabled = formFieldDisabled ?? disabledProp;\n const status = formFieldValidationStatus ?? statusProp;\n\n const { Component: FloatingComponent } = useFloatingComponent();\n\n const hookProps: UseTooltipProps = {\n open: openProp,\n placement,\n enterDelay,\n leaveDelay,\n ...rest,\n };\n\n const {\n arrowProps,\n open,\n floating,\n reference,\n getTriggerProps,\n getTooltipProps,\n getTooltipPosition,\n } = useTooltip(hookProps);\n\n const triggerRef = useForkRef(\n // @ts-ignore\n isValidElement(children) ? children.ref : null,\n reference\n );\n\n const floatingRef = useForkRef(floating, ref);\n\n return (\n <>\n {isValidElement(children) &&\n cloneElement(children, {\n ...mergeProps(getTriggerProps(), children.props),\n ref: triggerRef,\n })}\n\n <FloatingComponent\n className={clsx(withBaseName(), withBaseName(status), className)}\n open={open && !disabled}\n ref={floatingRef}\n {...getTooltipProps()}\n {...getTooltipPosition()}\n >\n <TooltipBase\n hideIcon={hideIcon}\n status={status}\n content={content}\n hideArrow={hideArrow}\n arrowProps={arrowProps}\n />\n </FloatingComponent>\n </>\n );\n }\n);\n"],"names":["Tooltip"],"mappings":";;;;;;;;;;;;;;;AAsBA,MAAM,YAAA,GAAe,aAAa,aAAa,CAAA,CAAA;AA+CxC,MAAM,OAAU,GAAA,UAAA;AAAA,EACrB,SAASA,QAAQ,CAAA,KAAA,EAAO,GAAK,EAAA;AAC3B,IAAM,MAAA;AAAA,MACJ,QAAA;AAAA,MACA,SAAA;AAAA,MACA,UAAU,YAAe,GAAA,KAAA;AAAA,MACzB,SAAY,GAAA,KAAA;AAAA,MACZ,QAAW,GAAA,KAAA;AAAA,MACX,IAAM,EAAA,QAAA;AAAA,MACN,OAAA;AAAA,MACA,QAAQ,UAAa,GAAA,MAAA;AAAA,MACrB,SAAY,GAAA,OAAA;AAAA,MACZ,UAAa,GAAA,GAAA;AAAA,MACb,UAA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CAAA,iBAAA,EAAA;AAAA,UACC,WAAW,IAAK,CAAA,YAAA,IAAgB,YAAa,CAAA,MAAM,GAAG,SAAS,CAAA;AAAA,UAC/D,IAAA,EAAM,QAAQ,CAAC,QAAA;AAAA,UACf,GAAK,EAAA,WAAA;AAAA,UACJ,GAAG,eAAgB,EAAA;AAAA,UACnB,GAAG,kBAAmB,EAAA;AAAA,UAEvB,QAAC,kBAAA,GAAA,CAAA,WAAA,EAAA;AAAA,YACC,QAAA;AAAA,YACA,MAAA;AAAA,YACA,OAAA;AAAA,YACA,SAAA;AAAA,YACA,UAAA;AAAA,WACF,CAAA;AAAA,SACF,CAAA;AAAA,OAAA;AAAA,KACF,CAAA,CAAA;AAAA,GAEJ;AACF;;;;"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { StatusIndicator } from '../status-indicator/StatusIndicator.js';
|
|
3
|
+
import { FloatingArrow } from '@floating-ui/react';
|
|
4
|
+
import 'react';
|
|
5
|
+
import { makePrefixer } from '../utils/makePrefixer.js';
|
|
6
|
+
import '../utils/useFloatingUI/useFloatingUI.js';
|
|
7
|
+
import '../utils/useId.js';
|
|
8
|
+
import '../salt-provider/SaltProvider.js';
|
|
9
|
+
import '../viewport/ViewportProvider.js';
|
|
10
|
+
import 'clsx';
|
|
11
|
+
import '../form-field-context/FormFieldContext.js';
|
|
12
|
+
import { useFormFieldProps } from '../form-field-context/useFormFieldProps.js';
|
|
13
|
+
import css_248z from './Tooltip.css.js';
|
|
14
|
+
import { useWindow } from '@salt-ds/window';
|
|
15
|
+
import { useComponentCssInjection } from '@salt-ds/styles';
|
|
16
|
+
|
|
17
|
+
const withBaseName = makePrefixer("saltTooltip");
|
|
18
|
+
const TooltipBase = (props) => {
|
|
19
|
+
const targetWindow = useWindow();
|
|
20
|
+
useComponentCssInjection({
|
|
21
|
+
testId: "salt-tooltip",
|
|
22
|
+
css: css_248z,
|
|
23
|
+
window: targetWindow
|
|
24
|
+
});
|
|
25
|
+
const { a11yProps } = useFormFieldProps();
|
|
26
|
+
const { arrowProps, content, hideArrow, hideIcon, status } = props;
|
|
27
|
+
return /* @__PURE__ */ jsxs(Fragment, {
|
|
28
|
+
children: [
|
|
29
|
+
/* @__PURE__ */ jsxs("div", {
|
|
30
|
+
className: withBaseName("container"),
|
|
31
|
+
children: [
|
|
32
|
+
!hideIcon && /* @__PURE__ */ jsx(StatusIndicator, {
|
|
33
|
+
status,
|
|
34
|
+
size: 1,
|
|
35
|
+
className: withBaseName("icon")
|
|
36
|
+
}),
|
|
37
|
+
/* @__PURE__ */ jsx("span", {
|
|
38
|
+
id: a11yProps == null ? void 0 : a11yProps["aria-describedby"],
|
|
39
|
+
className: withBaseName("content"),
|
|
40
|
+
children: content
|
|
41
|
+
})
|
|
42
|
+
]
|
|
43
|
+
}),
|
|
44
|
+
!hideArrow && /* @__PURE__ */ jsx(FloatingArrow, {
|
|
45
|
+
...arrowProps,
|
|
46
|
+
className: withBaseName("arrow"),
|
|
47
|
+
strokeWidth: 1,
|
|
48
|
+
fill: "var(--salt-container-primary-background)",
|
|
49
|
+
stroke: "var(--tooltip-status-borderColor)",
|
|
50
|
+
height: 5,
|
|
51
|
+
width: 10
|
|
52
|
+
})
|
|
53
|
+
]
|
|
54
|
+
});
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
export { TooltipBase };
|
|
58
|
+
//# sourceMappingURL=TooltipBase.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TooltipBase.js","sources":["../src/tooltip/TooltipBase.tsx"],"sourcesContent":["import { StatusIndicator, ValidationStatus } from \"../status-indicator\";\nimport { FloatingArrow, FloatingArrowProps } from \"@floating-ui/react\";\nimport { TooltipProps } from \"./Tooltip\";\nimport { makePrefixer } from \"../utils\";\nimport { useFormFieldProps } from \"../form-field-context\";\n\nimport tooltipCss from \"./Tooltip.css\";\nimport { useWindow } from \"@salt-ds/window\";\nimport { useComponentCssInjection } from \"@salt-ds/styles\";\n\nconst withBaseName = makePrefixer(\"saltTooltip\");\n\ninterface TooltipBaseProps extends Omit<TooltipProps, \"children\"> {\n arrowProps: FloatingArrowProps;\n /**\n * A string to determine the status of the Tooltip. Defaults to `info`.\n */\n status: ValidationStatus;\n}\n\nexport const TooltipBase = (props: TooltipBaseProps) => {\n const targetWindow = useWindow();\n useComponentCssInjection({\n testId: \"salt-tooltip\",\n css: tooltipCss,\n window: targetWindow,\n });\n\n const { a11yProps } = useFormFieldProps();\n\n const { arrowProps, content, hideArrow, hideIcon, status } = props;\n return (\n <>\n <div className={withBaseName(\"container\")}>\n {!hideIcon && (\n <StatusIndicator\n status={status}\n size={1}\n className={withBaseName(\"icon\")}\n />\n )}\n <span\n id={a11yProps?.[\"aria-describedby\"]}\n className={withBaseName(\"content\")}\n >\n {content}\n </span>\n </div>\n {!hideArrow && (\n <FloatingArrow\n {...arrowProps}\n className={withBaseName(\"arrow\")}\n strokeWidth={1}\n fill=\"var(--salt-container-primary-background)\"\n stroke=\"var(--tooltip-status-borderColor)\"\n height={5}\n width={10}\n />\n )}\n </>\n );\n};\n"],"names":["tooltipCss"],"mappings":";;;;;;;;;;;;;;;;AAUA,MAAM,YAAA,GAAe,aAAa,aAAa,CAAA,CAAA;AAUlC,MAAA,WAAA,GAAc,CAAC,KAA4B,KAAA;AACtD,EAAA,MAAM,eAAe,SAAU,EAAA,CAAA;AAC/B,EAAyB,wBAAA,CAAA;AAAA,IACvB,MAAQ,EAAA,cAAA;AAAA,IACR,GAAK,EAAAA,QAAA;AAAA,IACL,MAAQ,EAAA,YAAA;AAAA,GACT,CAAA,CAAA;AAED,EAAM,MAAA,EAAE,SAAU,EAAA,GAAI,iBAAkB,EAAA,CAAA;AAExC,EAAA,MAAM,EAAE,UAAY,EAAA,OAAA,EAAS,SAAW,EAAA,QAAA,EAAU,QAAW,GAAA,KAAA,CAAA;AAC7D,EACE,uBAAA,IAAA,CAAA,QAAA,EAAA;AAAA,IACE,QAAA,EAAA;AAAA,sBAAC,IAAA,CAAA,KAAA,EAAA;AAAA,QAAI,SAAA,EAAW,aAAa,WAAW,CAAA;AAAA,QACrC,QAAA,EAAA;AAAA,UAAA,CAAC,4BACC,GAAA,CAAA,eAAA,EAAA;AAAA,YACC,MAAA;AAAA,YACA,IAAM,EAAA,CAAA;AAAA,YACN,SAAA,EAAW,aAAa,MAAM,CAAA;AAAA,WAChC,CAAA;AAAA,0BAED,GAAA,CAAA,MAAA,EAAA;AAAA,YACC,IAAI,SAAY,IAAA,IAAA,GAAA,KAAA,CAAA,GAAA,SAAA,CAAA,kBAAA,CAAA;AAAA,YAChB,SAAA,EAAW,aAAa,SAAS,CAAA;AAAA,YAEhC,QAAA,EAAA,OAAA;AAAA,WACH,CAAA;AAAA,SAAA;AAAA,OACF,CAAA;AAAA,MACC,CAAC,6BACC,GAAA,CAAA,aAAA,EAAA;AAAA,QACE,GAAG,UAAA;AAAA,QACJ,SAAA,EAAW,aAAa,OAAO,CAAA;AAAA,QAC/B,WAAa,EAAA,CAAA;AAAA,QACb,IAAK,EAAA,0CAAA;AAAA,QACL,MAAO,EAAA,mCAAA;AAAA,QACP,MAAQ,EAAA,CAAA;AAAA,QACR,KAAO,EAAA,EAAA;AAAA,OACT,CAAA;AAAA,KAAA;AAAA,GAEJ,CAAA,CAAA;AAEJ;;;;"}
|
|
@@ -2,7 +2,7 @@ import { useRef, useEffect } from 'react';
|
|
|
2
2
|
import '../aria-announcer/AriaAnnouncerContext.js';
|
|
3
3
|
import 'react/jsx-runtime';
|
|
4
4
|
import { useAriaAnnouncer } from '../aria-announcer/useAriaAnnouncer.js';
|
|
5
|
-
import '../utils/useFloatingUI.js';
|
|
5
|
+
import '../utils/useFloatingUI/useFloatingUI.js';
|
|
6
6
|
import '../utils/useId.js';
|
|
7
7
|
import { useIsomorphicLayoutEffect } from '../utils/useIsomorphicLayoutEffect.js';
|
|
8
8
|
import '../salt-provider/SaltProvider.js';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { offset, flip, shift, limitShift, arrow, useInteractions, useHover, safePolygon, useFocus, useRole, useDismiss } from '@floating-ui/react';
|
|
2
2
|
import { useRef } from 'react';
|
|
3
3
|
import { useControlled } from '../utils/useControlled.js';
|
|
4
|
-
import { useFloatingUI } from '../utils/useFloatingUI.js';
|
|
4
|
+
import { useFloatingUI } from '../utils/useFloatingUI/useFloatingUI.js';
|
|
5
5
|
import '../utils/useId.js';
|
|
6
6
|
import '../salt-provider/SaltProvider.js';
|
|
7
7
|
import '../viewport/ViewportProvider.js';
|
|
@@ -37,7 +37,8 @@ function useTooltip(props) {
|
|
|
37
37
|
strategy,
|
|
38
38
|
middlewareData: { arrow: { x: arrowX, y: arrowY } = {} },
|
|
39
39
|
placement,
|
|
40
|
-
context
|
|
40
|
+
context,
|
|
41
|
+
elements
|
|
41
42
|
} = useFloatingUI({
|
|
42
43
|
open,
|
|
43
44
|
onOpenChange: handleOpenChange,
|
|
@@ -80,24 +81,30 @@ function useTooltip(props) {
|
|
|
80
81
|
const getTooltipProps = () => {
|
|
81
82
|
return getFloatingProps({
|
|
82
83
|
"data-placement": placement,
|
|
83
|
-
ref: floating
|
|
84
|
-
style: {
|
|
85
|
-
top: y != null ? y : 0,
|
|
86
|
-
left: x != null ? x : 0,
|
|
87
|
-
position: strategy
|
|
88
|
-
}
|
|
84
|
+
ref: floating
|
|
89
85
|
});
|
|
90
86
|
};
|
|
91
87
|
const getTriggerProps = () => getReferenceProps({
|
|
92
88
|
ref: reference
|
|
93
89
|
});
|
|
90
|
+
const getTooltipPosition = () => {
|
|
91
|
+
var _a, _b;
|
|
92
|
+
return {
|
|
93
|
+
top: y != null ? y : 0,
|
|
94
|
+
left: x != null ? x : 0,
|
|
95
|
+
position: strategy,
|
|
96
|
+
width: (_a = elements.floating) == null ? void 0 : _a.offsetWidth,
|
|
97
|
+
height: (_b = elements.floating) == null ? void 0 : _b.offsetHeight
|
|
98
|
+
};
|
|
99
|
+
};
|
|
94
100
|
return {
|
|
95
101
|
arrowProps,
|
|
96
102
|
open,
|
|
97
103
|
floating,
|
|
98
104
|
reference,
|
|
99
105
|
getTooltipProps,
|
|
100
|
-
getTriggerProps
|
|
106
|
+
getTriggerProps,
|
|
107
|
+
getTooltipPosition
|
|
101
108
|
};
|
|
102
109
|
}
|
|
103
110
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useTooltip.js","sources":["../src/tooltip/useTooltip.ts"],"sourcesContent":["import {\n arrow,\n flip,\n offset,\n safePolygon,\n shift,\n useDismiss,\n useFocus,\n useHover,\n useInteractions,\n useRole,\n limitShift,\n} from \"@floating-ui/react\";\nimport { HTMLProps, useRef } from \"react\";\nimport { useControlled, UseFloatingUIProps, useFloatingUI } from \"../utils\";\nimport { useAriaAnnounce } from \"./useAriaAnnounce\";\n\nexport interface UseTooltipProps\n extends Partial<\n Pick<UseFloatingUIProps, \"onOpenChange\" | \"open\" | \"placement\">\n > {\n /**\n * Do not respond to focus events.\n */\n disableFocusListener?: boolean;\n /**\n * Do not respond to hover events.\n */\n disableHoverListener?: boolean;\n /**\n * The number of milliseconds to wait before showing the tooltip.\n * This prop won't impact the enter touch delay (`enterTouchDelay`).\n */\n enterDelay?: number;\n /**\n * The number of milliseconds to wait before hiding the tooltip.\n * This prop won't impact the leave touch delay (`leaveTouchDelay`).\n */\n leaveDelay?: number;\n}\n\nexport function useTooltip(props?: UseTooltipProps) {\n const {\n enterDelay,\n leaveDelay,\n open: openProp,\n onOpenChange,\n placement: placementProp,\n disableHoverListener,\n disableFocusListener,\n } = props || {};\n\n const arrowRef = useRef<SVGSVGElement | null>(null);\n\n const [open, setOpen] = useControlled({\n controlled: openProp,\n default: false,\n name: \"Tooltip\",\n state: \"open\",\n });\n const handleOpenChange = (open: boolean) => {\n setOpen(open);\n onOpenChange?.(open);\n };\n\n const {\n floating,\n reference,\n x,\n y,\n strategy,\n middlewareData: { arrow: { x: arrowX, y: arrowY } = {} },\n placement,\n context,\n } = useFloatingUI({\n open,\n onOpenChange: handleOpenChange,\n placement: placementProp,\n middleware: [\n offset(8),\n flip(),\n shift({ limiter: limitShift() }),\n arrow({ element: arrowRef }),\n ],\n });\n\n const { getReferenceProps, getFloatingProps } = useInteractions([\n useHover(context, {\n delay: {\n open: enterDelay,\n close: leaveDelay,\n },\n enabled: !disableHoverListener,\n handleClose: safePolygon(),\n }),\n useFocus(context, { enabled: !disableFocusListener }),\n useRole(context, { role: \"tooltip\" }),\n useDismiss(context),\n useAriaAnnounce(context, {\n delay: {\n open: enterDelay,\n close: leaveDelay,\n },\n }),\n ]);\n\n const arrowProps = {\n ref: arrowRef,\n context,\n style: {\n position: strategy,\n left: arrowX ?? 0,\n top: arrowY ?? 0,\n },\n };\n\n const getTooltipProps = (): HTMLProps<HTMLDivElement> => {\n return getFloatingProps({\n // @ts-ignore\n \"data-placement\": placement,\n ref: floating,\n
|
|
1
|
+
{"version":3,"file":"useTooltip.js","sources":["../src/tooltip/useTooltip.ts"],"sourcesContent":["import {\n arrow,\n flip,\n offset,\n safePolygon,\n shift,\n useDismiss,\n useFocus,\n useHover,\n useInteractions,\n useRole,\n limitShift,\n} from \"@floating-ui/react\";\nimport { HTMLProps, useRef } from \"react\";\nimport { useControlled, UseFloatingUIProps, useFloatingUI } from \"../utils\";\nimport { useAriaAnnounce } from \"./useAriaAnnounce\";\n\nexport interface UseTooltipProps\n extends Partial<\n Pick<UseFloatingUIProps, \"onOpenChange\" | \"open\" | \"placement\">\n > {\n /**\n * Do not respond to focus events.\n */\n disableFocusListener?: boolean;\n /**\n * Do not respond to hover events.\n */\n disableHoverListener?: boolean;\n /**\n * The number of milliseconds to wait before showing the tooltip.\n * This prop won't impact the enter touch delay (`enterTouchDelay`).\n */\n enterDelay?: number;\n /**\n * The number of milliseconds to wait before hiding the tooltip.\n * This prop won't impact the leave touch delay (`leaveTouchDelay`).\n */\n leaveDelay?: number;\n}\n\nexport function useTooltip(props?: UseTooltipProps) {\n const {\n enterDelay,\n leaveDelay,\n open: openProp,\n onOpenChange,\n placement: placementProp,\n disableHoverListener,\n disableFocusListener,\n } = props || {};\n\n const arrowRef = useRef<SVGSVGElement | null>(null);\n\n const [open, setOpen] = useControlled({\n controlled: openProp,\n default: false,\n name: \"Tooltip\",\n state: \"open\",\n });\n const handleOpenChange = (open: boolean) => {\n setOpen(open);\n onOpenChange?.(open);\n };\n\n const {\n floating,\n reference,\n x,\n y,\n strategy,\n middlewareData: { arrow: { x: arrowX, y: arrowY } = {} },\n placement,\n context,\n elements,\n } = useFloatingUI({\n open,\n onOpenChange: handleOpenChange,\n placement: placementProp,\n middleware: [\n offset(8),\n flip(),\n shift({ limiter: limitShift() }),\n arrow({ element: arrowRef }),\n ],\n });\n\n const { getReferenceProps, getFloatingProps } = useInteractions([\n useHover(context, {\n delay: {\n open: enterDelay,\n close: leaveDelay,\n },\n enabled: !disableHoverListener,\n handleClose: safePolygon(),\n }),\n useFocus(context, { enabled: !disableFocusListener }),\n useRole(context, { role: \"tooltip\" }),\n useDismiss(context),\n useAriaAnnounce(context, {\n delay: {\n open: enterDelay,\n close: leaveDelay,\n },\n }),\n ]);\n\n const arrowProps = {\n ref: arrowRef,\n context,\n style: {\n position: strategy,\n left: arrowX ?? 0,\n top: arrowY ?? 0,\n },\n };\n\n const getTooltipProps = (): HTMLProps<HTMLDivElement> => {\n return getFloatingProps({\n // @ts-ignore\n \"data-placement\": placement,\n ref: floating,\n });\n };\n\n const getTriggerProps = () =>\n getReferenceProps({\n ref: reference,\n });\n\n const getTooltipPosition = () => ({\n top: y ?? 0,\n left: x ?? 0,\n position: strategy,\n width: elements.floating?.offsetWidth,\n height: elements.floating?.offsetHeight,\n });\n\n return {\n arrowProps,\n open,\n floating,\n reference,\n getTooltipProps,\n getTriggerProps,\n getTooltipPosition,\n };\n}\n"],"names":["open"],"mappings":";;;;;;;;;;AAyCO,SAAS,WAAW,KAAyB,EAAA;AAClD,EAAM,MAAA;AAAA,IACJ,UAAA;AAAA,IACA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AA,OAAA;AAAA,MAChC,KAAK,CAAK,IAAA,IAAA,GAAA,CAAA,GAAA,CAAA;AAAA,MACV,MAAM,CAAK,IAAA,IAAA,GAAA,CAAA,GAAA,CAAA;AAAA,MACX,QAAU,EAAA,QAAA;AAAA,MACV,KAAA,EAAA,CAAO,EAAS,GAAA,QAAA,CAAA,QAAA,KAAT,IAAmB,GAAA,KAAA,CAAA,GAAA,EAAA,CAAA,WAAA;AAAA,MAC1B,MAAA,EAAA,CAAQ,EAAS,GAAA,QAAA,CAAA,QAAA,KAAT,IAAmB,GAAA,KAAA,CAAA,GAAA,EAAA,CAAA,YAAA;AAAA,KAC7B,CAAA;AAAA,GAAA,CAAA;AAEA,EAAO,OAAA;AAAA,IACL,UAAA;AAAA,IACA,IAAA;AAAA,IACA,QAAA;AAAA,IACA,SAAA;AAAA,IACA,eAAA;AAAA,IACA,eAAA;AAAA,IACA,kBAAA;AAAA,GACF,CAAA;AACF;;;;"}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { FloatingPortal, flip, shift, limitShift, platform, useFloating, autoUpdate } from '@floating-ui/react';
|
|
3
|
+
import { forwardRef, createContext, useMemo, useContext } from 'react';
|
|
4
|
+
import { SaltProvider } from '../../salt-provider/SaltProvider.js';
|
|
5
|
+
|
|
6
|
+
const DefaultFloatingComponent = forwardRef(function DefaultFloatingComponent2(props, ref) {
|
|
7
|
+
const { open, top, left, position, ...rest } = props;
|
|
8
|
+
const style = {
|
|
9
|
+
top,
|
|
10
|
+
left,
|
|
11
|
+
position
|
|
12
|
+
};
|
|
13
|
+
return open ? /* @__PURE__ */ jsx(FloatingPortal, {
|
|
14
|
+
children: /* @__PURE__ */ jsx(SaltProvider, {
|
|
15
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
16
|
+
style,
|
|
17
|
+
...rest,
|
|
18
|
+
ref
|
|
19
|
+
})
|
|
20
|
+
})
|
|
21
|
+
}) : null;
|
|
22
|
+
});
|
|
23
|
+
const FloatingComponentContext = createContext({
|
|
24
|
+
Component: DefaultFloatingComponent
|
|
25
|
+
});
|
|
26
|
+
if (process.env.NODE_ENV !== "production") {
|
|
27
|
+
FloatingComponentContext.displayName = "FloatingComponentContext";
|
|
28
|
+
}
|
|
29
|
+
function FloatingComponentProvider(props) {
|
|
30
|
+
const { Component, children } = props;
|
|
31
|
+
const value = useMemo(() => ({ Component }), [Component]);
|
|
32
|
+
return /* @__PURE__ */ jsx(FloatingComponentContext.Provider, {
|
|
33
|
+
value,
|
|
34
|
+
children
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
function useFloatingComponent() {
|
|
38
|
+
return useContext(FloatingComponentContext);
|
|
39
|
+
}
|
|
40
|
+
const defaultGetMiddleware = (defaultMiddleware) => defaultMiddleware;
|
|
41
|
+
const defaultFloatingPlaform = {
|
|
42
|
+
platform,
|
|
43
|
+
middleware: defaultGetMiddleware,
|
|
44
|
+
animationFrame: false
|
|
45
|
+
};
|
|
46
|
+
const FloatingPlatformContext = createContext(
|
|
47
|
+
defaultFloatingPlaform
|
|
48
|
+
);
|
|
49
|
+
function FloatingPlatformProvider(props) {
|
|
50
|
+
const {
|
|
51
|
+
platform: platformProp,
|
|
52
|
+
middleware,
|
|
53
|
+
animationFrame,
|
|
54
|
+
children
|
|
55
|
+
} = props;
|
|
56
|
+
const floatingPlatformContextValue = useMemo(
|
|
57
|
+
() => ({
|
|
58
|
+
platform: platformProp != null ? platformProp : platform,
|
|
59
|
+
middleware: middleware != null ? middleware : defaultGetMiddleware,
|
|
60
|
+
animationFrame: animationFrame != null ? animationFrame : false
|
|
61
|
+
}),
|
|
62
|
+
[platformProp, middleware, animationFrame]
|
|
63
|
+
);
|
|
64
|
+
return /* @__PURE__ */ jsx(FloatingPlatformContext.Provider, {
|
|
65
|
+
value: floatingPlatformContextValue,
|
|
66
|
+
children
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
function useFloatingPlatform() {
|
|
70
|
+
return useContext(FloatingPlatformContext);
|
|
71
|
+
}
|
|
72
|
+
const DEFAULT_FLOATING_UI_MIDDLEWARE = [
|
|
73
|
+
flip(),
|
|
74
|
+
shift({ limiter: limitShift() })
|
|
75
|
+
];
|
|
76
|
+
function useFloatingUI(props) {
|
|
77
|
+
const {
|
|
78
|
+
placement,
|
|
79
|
+
strategy,
|
|
80
|
+
middleware = DEFAULT_FLOATING_UI_MIDDLEWARE,
|
|
81
|
+
open = false,
|
|
82
|
+
onOpenChange
|
|
83
|
+
} = props;
|
|
84
|
+
const handleOpenChange = (open2) => {
|
|
85
|
+
update();
|
|
86
|
+
onOpenChange == null ? void 0 : onOpenChange(open2);
|
|
87
|
+
};
|
|
88
|
+
const {
|
|
89
|
+
platform: contextPlaform,
|
|
90
|
+
middleware: contextMiddleware,
|
|
91
|
+
animationFrame
|
|
92
|
+
} = useFloatingPlatform();
|
|
93
|
+
const { reference, floating, refs, update, ...rest } = useFloating({
|
|
94
|
+
placement,
|
|
95
|
+
strategy,
|
|
96
|
+
middleware: contextMiddleware(middleware),
|
|
97
|
+
open,
|
|
98
|
+
onOpenChange: handleOpenChange,
|
|
99
|
+
whileElementsMounted: (...args) => {
|
|
100
|
+
const cleanup = autoUpdate(...args, { animationFrame });
|
|
101
|
+
return cleanup;
|
|
102
|
+
},
|
|
103
|
+
platform: contextPlaform
|
|
104
|
+
});
|
|
105
|
+
return {
|
|
106
|
+
reference,
|
|
107
|
+
floating,
|
|
108
|
+
refs,
|
|
109
|
+
update,
|
|
110
|
+
...rest
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
export { DEFAULT_FLOATING_UI_MIDDLEWARE, FloatingComponentProvider, FloatingPlatformProvider, useFloatingComponent, useFloatingPlatform, useFloatingUI };
|
|
115
|
+
//# sourceMappingURL=useFloatingUI.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useFloatingUI.js","sources":["../src/utils/useFloatingUI/useFloatingUI.tsx"],"sourcesContent":["import {\n Middleware,\n Placement,\n Platform,\n Strategy,\n autoUpdate,\n flip,\n limitShift,\n platform,\n shift,\n useFloating,\n FloatingPortal,\n} from \"@floating-ui/react\";\n\nimport {\n createContext,\n ReactNode,\n useContext,\n useMemo,\n forwardRef,\n PropsWithChildren,\n Ref,\n ForwardRefExoticComponent,\n} from \"react\";\n\nimport { SaltProvider } from \"../../salt-provider\";\n\ntype CombinedFloatingComponentProps = PropsWithChildren<FloatingComponentProps>;\nexport interface FloatingComponentProps {\n /**\n * Whether the floating component is open (used for determinig whether to show the component)\n * We pass this as a prop rather than not rendering the component to allow more advanced use-cases e.g.\n * for caching windows and reusing them, rather than always spawning a new one\n */\n open: boolean;\n /**\n * Position props for the floating component\n */\n top: number;\n left: number;\n width?: number;\n height?: number;\n position: Strategy;\n}\n\nconst DefaultFloatingComponent = forwardRef<\n HTMLElement,\n CombinedFloatingComponentProps\n>(function DefaultFloatingComponent(props, ref) {\n const { open, top, left, position, ...rest } = props;\n const style = {\n top,\n left,\n position,\n };\n return open ? (\n <FloatingPortal>\n <SaltProvider>\n <div style={style} {...rest} ref={ref as Ref<HTMLDivElement>} />\n </SaltProvider>\n </FloatingPortal>\n ) : null;\n});\n\nexport interface FloatingComponentContextType {\n Component: ForwardRefExoticComponent<CombinedFloatingComponentProps>;\n}\n\nconst FloatingComponentContext = createContext<FloatingComponentContextType>({\n Component: DefaultFloatingComponent,\n});\n\nif (process.env.NODE_ENV !== \"production\") {\n FloatingComponentContext.displayName = \"FloatingComponentContext\";\n}\n\nexport interface FloatingComponentProviderProps\n extends FloatingComponentContextType {\n children: ReactNode;\n}\n\nexport function FloatingComponentProvider(\n props: FloatingComponentProviderProps\n) {\n const { Component, children } = props;\n const value = useMemo(() => ({ Component }), [Component]);\n\n return (\n <FloatingComponentContext.Provider value={value}>\n {children}\n </FloatingComponentContext.Provider>\n );\n}\n\nexport function useFloatingComponent() {\n return useContext(FloatingComponentContext);\n}\n\nexport interface UseFloatingUIProps {\n /**\n * Sets position relative to trigger.\n */\n placement?: Placement;\n strategy?: Strategy;\n /**\n * Function to update the default middleware used to extend or replace it\n */\n middleware?: Middleware[];\n /**\n * Sets visible state.\n */\n open?: boolean;\n /**\n * Callback function triggered when open state changes.\n */\n onOpenChange?: (open: boolean) => void;\n}\n\ntype GetMiddleware = (middleware: Middleware[]) => Middleware[];\n\nconst defaultGetMiddleware: GetMiddleware = (defaultMiddleware) =>\n defaultMiddleware;\n\ninterface FloatingPlatformContextType {\n platform: Platform;\n middleware: GetMiddleware;\n animationFrame: boolean;\n}\n\nconst defaultFloatingPlaform: FloatingPlatformContextType = {\n platform,\n middleware: defaultGetMiddleware,\n animationFrame: false,\n};\n\nconst FloatingPlatformContext = createContext<FloatingPlatformContextType>(\n defaultFloatingPlaform\n);\n\nexport interface FloatingPlatformProviderProps {\n platform?: Platform;\n middleware?: GetMiddleware;\n children: ReactNode;\n animationFrame?: boolean;\n}\n\nexport function FloatingPlatformProvider(props: FloatingPlatformProviderProps) {\n const {\n platform: platformProp,\n middleware,\n animationFrame,\n children,\n } = props;\n\n const floatingPlatformContextValue = useMemo<FloatingPlatformContextType>(\n () => ({\n platform: platformProp ?? platform,\n middleware: middleware ?? defaultGetMiddleware,\n animationFrame: animationFrame ?? false,\n }),\n [platformProp, middleware, animationFrame]\n );\n\n return (\n <FloatingPlatformContext.Provider value={floatingPlatformContextValue}>\n {children}\n </FloatingPlatformContext.Provider>\n );\n}\n\nexport function useFloatingPlatform() {\n return useContext(FloatingPlatformContext);\n}\n\nexport const DEFAULT_FLOATING_UI_MIDDLEWARE = [\n flip(),\n shift({ limiter: limitShift() }),\n];\n\nexport function useFloatingUI(\n props: UseFloatingUIProps\n): ReturnType<typeof useFloating> {\n const {\n placement,\n strategy,\n middleware = DEFAULT_FLOATING_UI_MIDDLEWARE,\n open = false,\n onOpenChange,\n } = props;\n\n const handleOpenChange = (open: boolean) => {\n update();\n onOpenChange?.(open);\n };\n\n const {\n platform: contextPlaform,\n middleware: contextMiddleware,\n animationFrame,\n } = useFloatingPlatform();\n\n const { reference, floating, refs, update, ...rest } = useFloating({\n placement,\n strategy,\n middleware: contextMiddleware(middleware),\n open,\n onOpenChange: handleOpenChange,\n whileElementsMounted: (...args) => {\n const cleanup = autoUpdate(...args, { animationFrame });\n\n return cleanup;\n },\n platform: contextPlaform,\n });\n\n return {\n reference,\n floating,\n refs,\n update,\n ...rest,\n };\n}\n"],"names":["DefaultFloatingComponent","open"],"mappings":";;;;;AA6CA,MAAM,wBAA2B,GAAA,UAAA,CAG/B,SAASA,yBAAAA,CAAyB,OAAO,GAAK,EAAA;AAC9C,EAAA,MAAM,EAAE,IAAM,EAAA,GAAA,EAAK,IAAM,EAAA,QAAA,EAAA,GAAa,MAAS,GAAA,KAAA,CAAA;AAC/C,EAAA,MAAM,KAAQ,GAAA;AAAA,IACZ,GAAA;AAAA,IACA,IAAA;AAAA,IACA,QAAA;AAAA,GACF,CAAA;AACA,EAAA,OAAO,uBACJ,GAAA,CAAA,cAAA,EAAA;AAAA,IACC,QAAC,kBAAA,GAAA,CAAA,YAAA,EAAA;AAAA,MACC,QAAC,kBAAA,GAAA,CAAA,KAAA,EAAA;AAAA,QAAI,KAAA;AAAA,QAAe,GAAG,IAAA;AAAA,QAAM,GAAA;AAAA,OAAiC,CAAA;AAAA,KAChE,CAAA;AAAA,GACF,CACE,GAAA,IAAA,CAAA;AACN,CAAC,CAAA,CAAA;AAMD,MAAM,2BAA2B,aAA4C,CAAA;AAAA,EAC3E,SAAW,EAAA,wBAAA;AACb,CAAC,CAAA,CAAA;AAED,IAAI,OAAA,CAAQ,GAAI,CAAA,QAAA,KAAa,YAAc,EAAA;AACzC,EAAA,wBAAA,CAAyB,WAAc,GAAA,0BAAA,CAAA;AACzC,CAAA;AAOO,SAAS,0BACd,KACA,EAAA;AACA,EAAM,MAAA,EAAE,SAAW,EAAA,QAAA,EAAa,GAAA,KAAA,CAAA;AAChC,EAAM,MAAA,KAAA,GAAQ,Q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
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx } from 'react/jsx-runtime';
|
|
2
2
|
import { createContext, useContext, useState } from 'react';
|
|
3
|
-
import '../utils/useFloatingUI.js';
|
|
3
|
+
import '../utils/useFloatingUI/useFloatingUI.js';
|
|
4
4
|
import '../utils/useId.js';
|
|
5
5
|
import { useIsomorphicLayoutEffect } from '../utils/useIsomorphicLayoutEffect.js';
|
|
6
6
|
import '../salt-provider/SaltProvider.js';
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
-
import { ComponentPropsWithoutRef } from "react";
|
|
2
|
-
export
|
|
3
|
-
|
|
1
|
+
import { ComponentPropsWithoutRef, ReactNode } from "react";
|
|
2
|
+
export interface AccordionGroupProps extends ComponentPropsWithoutRef<"div"> {
|
|
3
|
+
/**
|
|
4
|
+
* The child Accordions to be rendered
|
|
5
|
+
*/
|
|
6
|
+
children?: ReactNode;
|
|
7
|
+
}
|
|
8
|
+
export declare const AccordionGroup: import("react").ForwardRefExoticComponent<AccordionGroupProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
-
import { ComponentPropsWithoutRef } from "react";
|
|
2
|
-
export
|
|
3
|
-
|
|
1
|
+
import { ComponentPropsWithoutRef, ReactNode } from "react";
|
|
2
|
+
export interface AccordionHeaderProps extends ComponentPropsWithoutRef<"button"> {
|
|
3
|
+
/**
|
|
4
|
+
* The content of the Accordion Header
|
|
5
|
+
*/
|
|
6
|
+
children?: ReactNode;
|
|
7
|
+
}
|
|
8
|
+
export declare const AccordionHeader: import("react").ForwardRefExoticComponent<AccordionHeaderProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
-
import { ComponentPropsWithoutRef } from "react";
|
|
2
|
-
export
|
|
3
|
-
|
|
1
|
+
import { ComponentPropsWithoutRef, ReactNode } from "react";
|
|
2
|
+
export interface AccordionPanelProps extends ComponentPropsWithoutRef<"div"> {
|
|
3
|
+
/**
|
|
4
|
+
* The content of the Accordion Panel
|
|
5
|
+
*/
|
|
6
|
+
children?: ReactNode;
|
|
7
|
+
}
|
|
8
|
+
export declare const AccordionPanel: import("react").ForwardRefExoticComponent<AccordionPanelProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -1,2 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { ComponentPropsWithoutRef, ReactNode } from "react";
|
|
2
|
+
interface BannerActionsProps extends ComponentPropsWithoutRef<"div"> {
|
|
3
|
+
/**
|
|
4
|
+
* The content of BannerActions
|
|
5
|
+
*/
|
|
6
|
+
children: ReactNode;
|
|
7
|
+
}
|
|
8
|
+
export declare const BannerActions: import("react").ForwardRefExoticComponent<BannerActionsProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
9
|
+
export {};
|
|
@@ -1,2 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { ComponentPropsWithoutRef, ReactNode } from "react";
|
|
2
|
+
interface BannerContentProps extends ComponentPropsWithoutRef<"div"> {
|
|
3
|
+
/**
|
|
4
|
+
* The content of BannerContent
|
|
5
|
+
*/
|
|
6
|
+
children: ReactNode;
|
|
7
|
+
}
|
|
8
|
+
export declare const BannerContent: import("react").ForwardRefExoticComponent<BannerContentProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
9
|
+
export {};
|
|
@@ -2,7 +2,7 @@ import { ElementType, ReactElement } from "react";
|
|
|
2
2
|
import { GridItemProps } from "../grid-item";
|
|
3
3
|
import { PolymorphicComponentPropWithRef } from "../utils";
|
|
4
4
|
export declare const BORDER_POSITION: readonly ["north", "west", "center", "east", "south"];
|
|
5
|
-
export declare type BorderPosition = typeof BORDER_POSITION[number];
|
|
5
|
+
export declare type BorderPosition = (typeof BORDER_POSITION)[number];
|
|
6
6
|
export declare type BorderItemProps<T extends ElementType> = PolymorphicComponentPropWithRef<T, {
|
|
7
7
|
/**
|
|
8
8
|
* Aligns a grid item inside a cell along the inline (row) axis. Defaults to "stretch"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ComponentPropsWithoutRef } from "react";
|
|
2
2
|
export declare const ButtonVariantValues: readonly ["primary", "secondary", "cta"];
|
|
3
|
-
export declare type ButtonVariant = typeof ButtonVariantValues[number];
|
|
3
|
+
export declare type ButtonVariant = (typeof ButtonVariantValues)[number];
|
|
4
4
|
export interface ButtonProps extends ComponentPropsWithoutRef<"button"> {
|
|
5
5
|
/**
|
|
6
6
|
* If `true`, the button will be disabled.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ElementType, ReactElement, CSSProperties } from "react";
|
|
2
2
|
import { ResponsiveProp, PolymorphicComponentPropWithRef } from "../utils";
|
|
3
3
|
export declare const FLEX_ITEM_ALIGNMENTS: readonly ["start", "end", "center", "stretch"];
|
|
4
|
-
export declare type flexItemAlignment = typeof FLEX_ITEM_ALIGNMENTS[number];
|
|
4
|
+
export declare type flexItemAlignment = (typeof FLEX_ITEM_ALIGNMENTS)[number];
|
|
5
5
|
export declare type FlexItemProps<T extends ElementType> = PolymorphicComponentPropWithRef<T, {
|
|
6
6
|
/**
|
|
7
7
|
* Allows the alignment specified by parent to be overridden for individual items, default is "start".
|
|
@@ -4,8 +4,8 @@ export declare type LayoutSeparator = "start" | "center" | "end";
|
|
|
4
4
|
export declare type LayoutDirection = "row" | "column";
|
|
5
5
|
export declare const FLEX_ALIGNMENT_BASE: readonly ["start", "end", "center"];
|
|
6
6
|
export declare const FLEX_CONTENT_ALIGNMENT_BASE: readonly ["start", "end", "center", "space-between", "space-around", "space-evenly"];
|
|
7
|
-
export declare type FlexAlignment = typeof FLEX_ALIGNMENT_BASE[number];
|
|
8
|
-
export declare type FlexContentAlignment = typeof FLEX_CONTENT_ALIGNMENT_BASE[number];
|
|
7
|
+
export declare type FlexAlignment = (typeof FLEX_ALIGNMENT_BASE)[number];
|
|
8
|
+
export declare type FlexContentAlignment = (typeof FLEX_CONTENT_ALIGNMENT_BASE)[number];
|
|
9
9
|
export declare type FlexLayoutProps<T extends ElementType> = PolymorphicComponentPropWithRef<T, {
|
|
10
10
|
/**
|
|
11
11
|
* Defines the default behavior for how flex items are laid out along the cross axis on the current line, default is "stretch".
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ElementType, ReactElement } from "react";
|
|
2
2
|
import { ResponsiveProp, PolymorphicComponentPropWithRef } from "../utils";
|
|
3
3
|
export declare const GRID_ALIGNMENT_BASE: readonly ["start", "end", "center", "stretch"];
|
|
4
|
-
declare type GridAlignment = typeof GRID_ALIGNMENT_BASE[number];
|
|
4
|
+
declare type GridAlignment = (typeof GRID_ALIGNMENT_BASE)[number];
|
|
5
5
|
declare type GridProperty = number | "auto";
|
|
6
6
|
export declare type GridItemProps<T extends ElementType> = PolymorphicComponentPropWithRef<T, {
|
|
7
7
|
/**
|