@react-fabric/core 1.0.0-beta.42 → 1.0.0-beta.44

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.
@@ -125,7 +125,9 @@ var ConfirmButton = function ConfirmButton(_ref) {
125
125
  "data-color": color,
126
126
  className: classNames("select-none not-italic rounded-capped shadow-lg outline outline-muted bg-base"),
127
127
  ref: refs.setFloating,
128
- style: floatingStyles
128
+ style: _objectSpread({
129
+ zIndex: "var(--z-popover)"
130
+ }, floatingStyles)
129
131
  }, getFloatingProps()), {}, {
130
132
  children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
131
133
  className: "font-medium ",
@@ -11,7 +11,7 @@ var jsxRuntime = require('react/jsx-runtime');
11
11
  require('@react-fabric/utilities');
12
12
  var nodeCheck = require('../../utils/nodeCheck.js');
13
13
 
14
- var _excluded = ["children", "className", "bodyClassName", "selected", "selectedRibbon", "onClick", "flex", "draggable", "dragKey", "dragData", "ref"];
14
+ var _excluded = ["children", "className", "bodyClassName", "selected", "selectedRibbon", "onClick", "onDragStart", "flex", "draggable", "dragKey", "dragData", "ref"];
15
15
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
16
16
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
17
17
  var Card = function Card(_ref) {
@@ -21,6 +21,7 @@ var Card = function Card(_ref) {
21
21
  selected = _ref.selected,
22
22
  selectedRibbon = _ref.selectedRibbon,
23
23
  onClick = _ref.onClick,
24
+ onDragStart = _ref.onDragStart,
24
25
  flex = _ref.flex,
25
26
  draggable = _ref.draggable,
26
27
  dragKey = _ref.dragKey,
@@ -37,16 +38,18 @@ var Card = function Card(_ref) {
37
38
  header = _useMemo2[0],
38
39
  body = _useMemo2[1],
39
40
  footer = _useMemo2[2];
41
+ var handleDragStart = react.useCallback(function (event) {
42
+ var _event$dataTransfer;
43
+ dragKey && ((_event$dataTransfer = event.dataTransfer) === null || _event$dataTransfer === void 0 ? void 0 : _event$dataTransfer.setData(dragKey, JSON.stringify(dragData)));
44
+ dragKey && (onDragStart === null || onDragStart === void 0 ? void 0 : onDragStart(event, dragKey, dragData));
45
+ }, [onDragStart, dragKey, dragData]);
40
46
  return /*#__PURE__*/jsxRuntime.jsx("div", {
41
47
  className: classNames("fabric-cardWrapper", "rounded-capped relative grid", flex && "flex-1", selected && selectedRibbon && "selected", selected && "outline-2 outline-accent-500 outline-offset-2"),
42
48
  children: /*#__PURE__*/jsxRuntime.jsx(ErrorBoundary.ErrorBoundary, {
43
49
  children: /*#__PURE__*/jsxRuntime.jsxs("div", _objectSpread(_objectSpread({
44
50
  className: classNames("fabric-card", className, "rounded-capped flex flex-col flex-nowrap overflow-hidden", onClick && "clickable"),
45
51
  draggable: draggable,
46
- onDragStart: !draggable ? undefined : function (e) {
47
- var _e$dataTransfer;
48
- return dragKey && ((_e$dataTransfer = e.dataTransfer) === null || _e$dataTransfer === void 0 ? void 0 : _e$dataTransfer.setData(dragKey, JSON.stringify(dragData)));
49
- },
52
+ onDragStart: !draggable ? undefined : handleDragStart,
50
53
  ref: ref
51
54
  }, aria), {}, {
52
55
  children: [header, /*#__PURE__*/jsxRuntime.jsx("div", {
@@ -30,9 +30,9 @@ var loggerM = utilities.useLogger("useMemoDebugger");
30
30
  var loggerE = utilities.useLogger("useEffectDebugger");
31
31
  var loggerLE = utilities.useLogger("useLayoutEffectDebugger");
32
32
  var compareInputs = function compareInputs(oldInputs, newInputs, prefix, logger) {
33
- if (process.env.NODE_ENV === "production" && typeof window !== "undefined" &&
33
+ if (typeof window !== "undefined" &&
34
34
  // @ts-expect-error ignore
35
- window.DEBUG_HOOKS !== true) return;
35
+ window.DEBUG_EFFECTS !== true) return;
36
36
 
37
37
  // Edge-case: different array lengths
38
38
  if (oldInputs.length !== newInputs.length) {
@@ -72,7 +72,7 @@ var Tooltip = function Tooltip(_ref) {
72
72
  floatingStyles = _useFloating.floatingStyles,
73
73
  context = _useFloating.context;
74
74
  var hover = react$1.useHover(context, {
75
- restMs: 250,
75
+ restMs: 500,
76
76
  delay: {
77
77
  open: 1000
78
78
  },
@@ -125,7 +125,9 @@ var ConfirmButton = function ConfirmButton(_ref) {
125
125
  "data-color": color,
126
126
  className: classNames("select-none not-italic rounded-capped shadow-lg outline outline-muted bg-base"),
127
127
  ref: refs.setFloating,
128
- style: floatingStyles
128
+ style: _objectSpread({
129
+ zIndex: "var(--z-popover)"
130
+ }, floatingStyles)
129
131
  }, getFloatingProps()), {}, {
130
132
  children: [/*#__PURE__*/jsxs("div", {
131
133
  className: "font-medium ",
@@ -4,14 +4,14 @@ import _defineProperty from '@babel/runtime/helpers/defineProperty';
4
4
  import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
5
5
  import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
6
6
  import classNames from 'classnames';
7
- import { useMemo, Children } from 'react';
7
+ import { useMemo, Children, useCallback } from 'react';
8
8
  import { ErrorBoundary } from '../../core/boundary/ErrorBoundary.js';
9
9
  import { Header, Footer } from '../../core/headfoot/HeadFoot.js';
10
10
  import { jsx, jsxs } from 'react/jsx-runtime';
11
11
  import '@react-fabric/utilities';
12
12
  import { nodeCheck } from '../../utils/nodeCheck.js';
13
13
 
14
- var _excluded = ["children", "className", "bodyClassName", "selected", "selectedRibbon", "onClick", "flex", "draggable", "dragKey", "dragData", "ref"];
14
+ var _excluded = ["children", "className", "bodyClassName", "selected", "selectedRibbon", "onClick", "onDragStart", "flex", "draggable", "dragKey", "dragData", "ref"];
15
15
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
16
16
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
17
17
  var Card = function Card(_ref) {
@@ -21,6 +21,7 @@ var Card = function Card(_ref) {
21
21
  selected = _ref.selected,
22
22
  selectedRibbon = _ref.selectedRibbon,
23
23
  onClick = _ref.onClick,
24
+ onDragStart = _ref.onDragStart,
24
25
  flex = _ref.flex,
25
26
  draggable = _ref.draggable,
26
27
  dragKey = _ref.dragKey,
@@ -37,16 +38,18 @@ var Card = function Card(_ref) {
37
38
  header = _useMemo2[0],
38
39
  body = _useMemo2[1],
39
40
  footer = _useMemo2[2];
41
+ var handleDragStart = useCallback(function (event) {
42
+ var _event$dataTransfer;
43
+ dragKey && ((_event$dataTransfer = event.dataTransfer) === null || _event$dataTransfer === void 0 ? void 0 : _event$dataTransfer.setData(dragKey, JSON.stringify(dragData)));
44
+ dragKey && (onDragStart === null || onDragStart === void 0 ? void 0 : onDragStart(event, dragKey, dragData));
45
+ }, [onDragStart, dragKey, dragData]);
40
46
  return /*#__PURE__*/jsx("div", {
41
47
  className: classNames("fabric-cardWrapper", "rounded-capped relative grid", flex && "flex-1", selected && selectedRibbon && "selected", selected && "outline-2 outline-accent-500 outline-offset-2"),
42
48
  children: /*#__PURE__*/jsx(ErrorBoundary, {
43
49
  children: /*#__PURE__*/jsxs("div", _objectSpread(_objectSpread({
44
50
  className: classNames("fabric-card", className, "rounded-capped flex flex-col flex-nowrap overflow-hidden", onClick && "clickable"),
45
51
  draggable: draggable,
46
- onDragStart: !draggable ? undefined : function (e) {
47
- var _e$dataTransfer;
48
- return dragKey && ((_e$dataTransfer = e.dataTransfer) === null || _e$dataTransfer === void 0 ? void 0 : _e$dataTransfer.setData(dragKey, JSON.stringify(dragData)));
49
- },
52
+ onDragStart: !draggable ? undefined : handleDragStart,
50
53
  ref: ref
51
54
  }, aria), {}, {
52
55
  children: [header, /*#__PURE__*/jsx("div", {
@@ -30,9 +30,9 @@ var loggerM = useLogger("useMemoDebugger");
30
30
  var loggerE = useLogger("useEffectDebugger");
31
31
  var loggerLE = useLogger("useLayoutEffectDebugger");
32
32
  var compareInputs = function compareInputs(oldInputs, newInputs, prefix, logger) {
33
- if (process.env.NODE_ENV === "production" && typeof window !== "undefined" &&
33
+ if (typeof window !== "undefined" &&
34
34
  // @ts-expect-error ignore
35
- window.DEBUG_HOOKS !== true) return;
35
+ window.DEBUG_EFFECTS !== true) return;
36
36
 
37
37
  // Edge-case: different array lengths
38
38
  if (oldInputs.length !== newInputs.length) {
@@ -72,7 +72,7 @@ var Tooltip = function Tooltip(_ref) {
72
72
  floatingStyles = _useFloating.floatingStyles,
73
73
  context = _useFloating.context;
74
74
  var hover = useHover(context, {
75
- restMs: 250,
75
+ restMs: 500,
76
76
  delay: {
77
77
  open: 1000
78
78
  },
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { type AriaProps, type ChildrenProp, type ColorState, type CssProp, type TestProps } from "../../types";
2
3
  export interface CalloutProps extends AriaProps, ChildrenProp, CssProp, TestProps {
3
4
  /**
@@ -7,7 +8,7 @@ export interface CalloutProps extends AriaProps, ChildrenProp, CssProp, TestProp
7
8
  /**
8
9
  * legend title
9
10
  */
10
- legend?: string;
11
+ legend?: string | React.ReactElement;
11
12
  /**
12
13
  * callout icon
13
14
  */
@@ -1,4 +1,4 @@
1
- import { type MouseEventHandler } from "react";
1
+ import { type DragEvent, type MouseEventHandler } from "react";
2
2
  import { type ContentProps } from "../../core/content/Content";
3
3
  import { type HeadFootProps } from "../../core/headfoot/HeadFoot";
4
4
  import { type AriaProps, type ChildrenProp, type CssProp, type RefProp, type TestProps } from "../../types";
@@ -11,6 +11,10 @@ export interface CardProps extends CssProp, AriaProps, TestProps, RefProp<HTMLDi
11
11
  * click handler
12
12
  */
13
13
  onClick?: MouseEventHandler;
14
+ /**
15
+ * drag start handler
16
+ */
17
+ onDragStart?: (event: DragEvent, dragKey: string, dragData?: KeyValue) => void;
14
18
  /**
15
19
  * body css classname(s)
16
20
  */
@@ -36,4 +40,4 @@ export interface CardProps extends CssProp, AriaProps, TestProps, RefProp<HTMLDi
36
40
  */
37
41
  dragData?: KeyValue;
38
42
  }
39
- export declare const Card: ({ children, className, bodyClassName, selected, selectedRibbon, onClick, flex, draggable, dragKey, dragData, ref, ...aria }: CardProps) => import("react/jsx-runtime").JSX.Element;
43
+ export declare const Card: ({ children, className, bodyClassName, selected, selectedRibbon, onClick, onDragStart, flex, draggable, dragKey, dragData, ref, ...aria }: CardProps) => import("react/jsx-runtime").JSX.Element;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-fabric/core",
3
- "version": "1.0.0-beta.42",
3
+ "version": "1.0.0-beta.44",
4
4
  "description": "RUF: Core package",
5
5
  "author": "Adarsh Pastakia <adarshpastakia@outlook.com>",
6
6
  "license": "MIT",
@@ -36,7 +36,7 @@
36
36
  },
37
37
  "dependencies": {
38
38
  "@floating-ui/react": "^0.26.24",
39
- "@react-fabric/utilities": "^1.0.0-beta.42",
39
+ "@react-fabric/utilities": "^1.0.0-beta.44",
40
40
  "@tailwindcss/postcss": "~4.0.14",
41
41
  "boring-avatars": "^1.10.2",
42
42
  "classnames": "^2.5.1",
@@ -54,5 +54,5 @@
54
54
  "node": ">=18.12.0",
55
55
  "npm": ">=8.19.0"
56
56
  },
57
- "gitHead": "61c9612bb2c7bc9a807f46922881432748c9e7a3"
57
+ "gitHead": "5c05c100917811fa40b30c98b94fd396b1f68ea9"
58
58
  }
@@ -187,7 +187,10 @@ export const ConfirmButton = <Tag extends React.ElementType = "button">({
187
187
  "select-none not-italic rounded-capped shadow-lg outline outline-muted bg-base",
188
188
  )}
189
189
  ref={refs.setFloating}
190
- style={floatingStyles}
190
+ style={{
191
+ zIndex: "var(--z-popover)",
192
+ ...floatingStyles,
193
+ }}
191
194
  {...getFloatingProps()}
192
195
  >
193
196
  <div className="font-medium ">
@@ -44,7 +44,7 @@ export interface CalloutProps
44
44
  /**
45
45
  * legend title
46
46
  */
47
- legend?: string;
47
+ legend?: string | React.ReactElement;
48
48
  /**
49
49
  * callout icon
50
50
  */
@@ -24,9 +24,10 @@
24
24
  import classNames from "classnames";
25
25
  import {
26
26
  Children,
27
- useMemo,
28
27
  type DragEvent,
29
28
  type MouseEventHandler,
29
+ useCallback,
30
+ useMemo,
30
31
  } from "react";
31
32
  import { ErrorBoundary } from "../../core/boundary/ErrorBoundary";
32
33
  import { type ContentProps } from "../../core/content/Content";
@@ -58,6 +59,14 @@ export interface CardProps
58
59
  * click handler
59
60
  */
60
61
  onClick?: MouseEventHandler;
62
+ /**
63
+ * drag start handler
64
+ */
65
+ onDragStart?: (
66
+ event: DragEvent,
67
+ dragKey: string,
68
+ dragData?: KeyValue,
69
+ ) => void;
61
70
  /**
62
71
  * body css classname(s)
63
72
  */
@@ -91,6 +100,7 @@ export const Card = ({
91
100
  selected,
92
101
  selectedRibbon,
93
102
  onClick,
103
+ onDragStart,
94
104
  flex,
95
105
  draggable,
96
106
  dragKey,
@@ -112,6 +122,14 @@ export const Card = ({
112
122
  );
113
123
  }, [children]);
114
124
 
125
+ const handleDragStart = useCallback(
126
+ (event: DragEvent) => {
127
+ dragKey && event.dataTransfer?.setData(dragKey, JSON.stringify(dragData));
128
+ dragKey && onDragStart?.(event, dragKey, dragData);
129
+ },
130
+ [onDragStart, dragKey, dragData],
131
+ );
132
+
115
133
  return (
116
134
  <div
117
135
  className={classNames(
@@ -131,13 +149,7 @@ export const Card = ({
131
149
  onClick && "clickable",
132
150
  )}
133
151
  draggable={draggable}
134
- onDragStart={
135
- !draggable
136
- ? undefined
137
- : (e: DragEvent) =>
138
- dragKey &&
139
- e.dataTransfer?.setData(dragKey, JSON.stringify(dragData))
140
- }
152
+ onDragStart={!draggable ? undefined : handleDragStart}
141
153
  ref={ref}
142
154
  {...aria}
143
155
  >
@@ -44,10 +44,9 @@ const compareInputs = (
44
44
  logger: ReturnType<typeof useLogger>,
45
45
  ) => {
46
46
  if (
47
- process.env.NODE_ENV === "production" &&
48
47
  typeof window !== "undefined" &&
49
48
  // @ts-expect-error ignore
50
- window.DEBUG_HOOKS !== true
49
+ window.DEBUG_EFFECTS !== true
51
50
  )
52
51
  return;
53
52
 
@@ -126,7 +126,7 @@ export const Tooltip = ({
126
126
  });
127
127
 
128
128
  const hover = useHover(context, {
129
- restMs: 250,
129
+ restMs: 500,
130
130
  delay: { open: 1000 },
131
131
  handleClose: copyContent ? safePolygon({ buffer: 1 }) : undefined,
132
132
  });