@dbcdk/react-components 0.0.85 → 0.0.86

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.
@@ -45,6 +45,7 @@ export const Input = forwardRef(function Input({ label, error, helpText, orienta
45
45
  offset: 8,
46
46
  delayOpenMs: 0,
47
47
  focusOpenMode: tooltipOpenOnFocus ? 'any' : 'focus-visible',
48
+ closeOnPointerDown: false,
48
49
  });
49
50
  const trailingButtonVariant = variant === 'outlined' || variant === 'standalone' ? 'outlined' : 'default';
50
51
  return (_jsx(InputContainer, { label: label, htmlFor: inputId, fullWidth: fullWidth, error: error, helpText: helpText, orientation: orientation, labelWidth: labelWidth, required: required, modified: modified, children: _jsxs("div", { style: rootStyle, className: [
@@ -40,6 +40,7 @@ className, ...rest }) {
40
40
  offset: 8,
41
41
  delayOpenMs: 0,
42
42
  focusOpenMode: 'any',
43
+ closeOnPointerDown: false,
43
44
  });
44
45
  return (_jsx(InputContainer, { modified: modified, label: label, htmlFor: textareaId, error: error, helpText: helpText, helpTextAddition: showCount ? `${value === null || value === void 0 ? void 0 : value.length} tegn i denne boks` : undefined, orientation: orientation, labelWidth: labelWidth, fullWidth: fullWidth, required: required, children: _jsx("div", { className: [styles.container, modified ? styles.modified : ''].filter(Boolean).join(' '), children: _jsx("div", { ...(tooltipEnabled ? triggerProps : {}), children: inputField }) }) }));
45
46
  };
@@ -10,6 +10,7 @@ type UseTooltipOptions = {
10
10
  delayOpenMs?: number;
11
11
  delayCloseMs?: number;
12
12
  focusOpenMode?: 'focus-visible' | 'any' | 'off';
13
+ closeOnPointerDown?: boolean;
13
14
  };
14
15
  export declare function useTooltipTrigger(options: UseTooltipOptions): {
15
16
  id: string;
@@ -4,7 +4,7 @@ export function useTooltipTrigger(options) {
4
4
  const ctx = useContext(TooltipContext);
5
5
  if (!ctx)
6
6
  throw new Error('useTooltipTrigger must be used within <TooltipProvider>.');
7
- const { content, placement = 'top', offset = 8, open, defaultOpen = false, delayOpenMs = 150, delayCloseMs = 50, focusOpenMode = 'focus-visible', } = options;
7
+ const { content, placement = 'top', offset = 8, open, defaultOpen = false, delayOpenMs = 150, delayCloseMs = 50, focusOpenMode = 'focus-visible', closeOnPointerDown = true, } = options;
8
8
  const id = useId();
9
9
  const triggerElRef = useRef(null);
10
10
  const isControlled = open !== undefined;
@@ -82,7 +82,7 @@ export function useTooltipTrigger(options) {
82
82
  };
83
83
  const onPointerDown = () => {
84
84
  clearTimers();
85
- if (!isControlled)
85
+ if (!isControlled && closeOnPointerDown)
86
86
  setOpen(false);
87
87
  };
88
88
  const onFocus = (e) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dbcdk/react-components",
3
- "version": "0.0.85",
3
+ "version": "0.0.86",
4
4
  "description": "Reusable React components for DBC projects",
5
5
  "license": "ISC",
6
6
  "author": "",