@rowsncolumns/ui 16.0.4 → 16.0.5
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/cell-tooltip/index.d.ts +4 -4
- package/dist/cjs/dialog/index.d.ts.map +1 -1
- package/dist/cjs/dialog/index.js +45 -3
- package/dist/cjs/editor-pm/schema.d.ts +1 -1
- package/dist/esm/cell-tooltip/index.d.ts +4 -4
- package/dist/esm/dialog/index.d.ts.map +1 -1
- package/dist/esm/dialog/index.js +33 -2
- package/dist/esm/editor-pm/schema.d.ts +1 -1
- package/package.json +1 -1
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import type { VariantProps } from "class-variance-authority";
|
|
2
2
|
import React from "react";
|
|
3
3
|
declare const cellTooltipVariants: (props?: ({
|
|
4
|
-
variant?: "link" | "none" | "note" | "error" | "
|
|
4
|
+
variant?: "link" | "none" | "note" | "error" | "invalid" | "custom" | null | undefined;
|
|
5
5
|
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
|
|
6
6
|
export declare const tooltipTitleVariants: (props?: ({
|
|
7
|
-
variant?: "link" | "none" | "note" | "error" | "
|
|
7
|
+
variant?: "link" | "none" | "note" | "error" | "invalid" | "custom" | null | undefined;
|
|
8
8
|
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
|
|
9
9
|
export declare const CellTooltip: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & VariantProps<(props?: ({
|
|
10
|
-
variant?: "link" | "none" | "note" | "error" | "
|
|
10
|
+
variant?: "link" | "none" | "note" | "error" | "invalid" | "custom" | null | undefined;
|
|
11
11
|
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string> & React.RefAttributes<HTMLDivElement>>;
|
|
12
12
|
export declare const CellTooltipTitle: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & VariantProps<(props?: ({
|
|
13
|
-
variant?: "link" | "none" | "note" | "error" | "
|
|
13
|
+
variant?: "link" | "none" | "note" | "error" | "invalid" | "custom" | null | undefined;
|
|
14
14
|
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string> & React.RefAttributes<HTMLDivElement>>;
|
|
15
15
|
export type CellTooltipVariants = VariantProps<typeof cellTooltipVariants>;
|
|
16
16
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../dialog/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,eAAe,MAAM,wBAAwB,CAAC;AAE1D,OAAO,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../dialog/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,eAAe,MAAM,wBAAwB,CAAC;AAE1D,OAAO,KAAK,MAAM,OAAO,CAAC;AA6C1B,eAAO,MAAM,WAAW,oKAYtB,CAAC;AAGH,eAAO,MAAM,iBAAiB,8KAY5B,CAAC;AAkBH,eAAO,MAAM,aAAa;sBAGJ,MAAM;gBACZ,WAAW,GAAG,IAAI;wCA8ChC,CAAC;AAGH,eAAO,MAAM,MAAM,uCAAuB,CAAC;AAC3C,eAAO,MAAM,aAAa,8GAA0B,CAAC;AACrD,eAAO,MAAM,WAAW,4GAAwB,CAAC;AAEjD,eAAO,MAAM,iBAAiB,4KAS5B,CAAC;AAGH,eAAO,MAAM,UAAU,GAAI,0BAGxB;IACD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B,sBAEA,CAAC"}
|
package/dist/cjs/dialog/index.js
CHANGED
|
@@ -1,10 +1,33 @@
|
|
|
1
|
-
import { __assign, __rest } from "tslib";
|
|
1
|
+
import { __assign, __rest, __values } from "tslib";
|
|
2
2
|
import * as DialogPrimitive from "@radix-ui/react-dialog";
|
|
3
3
|
import { useRef } from "react";
|
|
4
4
|
import React from "react";
|
|
5
5
|
import Draggable from "react-draggable";
|
|
6
6
|
import { IconButton } from "./../icon-button";
|
|
7
7
|
import { cn } from "./../utils";
|
|
8
|
+
var FOCUSABLE_SELECTOR = "a[href], button, input, select, textarea, [tabindex], [contenteditable]";
|
|
9
|
+
var TEXT_ENTRY_SELECTOR = 'input:not([type="button"]):not([type="submit"]):not([type="reset"]):not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="hidden"]), textarea, [contenteditable]:not([contenteditable="false"])';
|
|
10
|
+
var firstTabbable = function (container) {
|
|
11
|
+
var e_1, _a;
|
|
12
|
+
try {
|
|
13
|
+
for (var _b = __values(Array.from(container.querySelectorAll(FOCUSABLE_SELECTOR))), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
14
|
+
var element = _c.value;
|
|
15
|
+
if (element.tabIndex >= 0 &&
|
|
16
|
+
!element.hasAttribute("disabled") &&
|
|
17
|
+
element.getClientRects().length > 0) {
|
|
18
|
+
return element;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
23
|
+
finally {
|
|
24
|
+
try {
|
|
25
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
26
|
+
}
|
|
27
|
+
finally { if (e_1) throw e_1.error; }
|
|
28
|
+
}
|
|
29
|
+
return null;
|
|
30
|
+
};
|
|
8
31
|
var DialogPortal = function (_a) {
|
|
9
32
|
var children = _a.children, className = _a.className, container = _a.container, props = __rest(_a, ["children", "className", "container"]);
|
|
10
33
|
return (React.createElement(DialogPrimitive.Portal, __assign({ container: container }, props),
|
|
@@ -27,13 +50,32 @@ var DialogOverlay = React.forwardRef(function (_a, ref) {
|
|
|
27
50
|
});
|
|
28
51
|
DialogOverlay.displayName = DialogPrimitive.Overlay.displayName;
|
|
29
52
|
export var DialogContent = React.forwardRef(function (_a, ref) {
|
|
30
|
-
var className = _a.className, portalClassName = _a.portalClassName, container = _a.container, children = _a.children, props = __rest(_a, ["className", "portalClassName", "container", "children"]);
|
|
53
|
+
var className = _a.className, portalClassName = _a.portalClassName, container = _a.container, children = _a.children, onOpenAutoFocus = _a.onOpenAutoFocus, props = __rest(_a, ["className", "portalClassName", "container", "children", "onOpenAutoFocus"]);
|
|
31
54
|
var nodeRef = useRef(null);
|
|
32
55
|
return (React.createElement(DialogPortal, { className: portalClassName, container: container },
|
|
33
56
|
React.createElement(DialogOverlay, null),
|
|
34
57
|
React.createElement("div", { className: "fixed z-50 grid w-full gap-4 animate-in data-[state=open]:fade-in-90 data-[state=open]:slide-in-from-bottom-10 sm:max-w-lg sm:rounded-lg sm:zoom-in-90 data-[state=open]:sm:slide-in-from-bottom-0 pointer-events-none" },
|
|
35
58
|
React.createElement(Draggable, { handle: ".rnc-drag-handle", nodeRef: nodeRef },
|
|
36
|
-
React.createElement(DialogPrimitive.Content, __assign({ ref: nodeRef, className: cn("bg-rnc-background text-rnc-foreground shadow-lg rounded-sm border border-solid border-rnc-border pointer-events-auto min-w-0", className)
|
|
59
|
+
React.createElement(DialogPrimitive.Content, __assign({ ref: nodeRef, className: cn("bg-rnc-background text-rnc-foreground shadow-lg rounded-sm border border-solid border-rnc-border pointer-events-auto min-w-0 outline-none", className), onOpenAutoFocus: function (event) {
|
|
60
|
+
onOpenAutoFocus === null || onOpenAutoFocus === void 0 ? void 0 : onOpenAutoFocus(event);
|
|
61
|
+
if (event.defaultPrevented)
|
|
62
|
+
return;
|
|
63
|
+
event.preventDefault();
|
|
64
|
+
var content = nodeRef.current;
|
|
65
|
+
if (!content || content.contains(document.activeElement)) {
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
// Radix would focus the first tabbable here. Opened from a menu
|
|
69
|
+
// item, that programmatic focus inherits the menu's
|
|
70
|
+
// :focus-visible state, so a leading tab or button paints a
|
|
71
|
+
// keyboard focus ring after a plain mouse click. Text fields
|
|
72
|
+
// always show their ring when focused, so they keep the old
|
|
73
|
+
// behaviour; anything else lands on the dialog itself and the
|
|
74
|
+
// first Tab press reaches it as before.
|
|
75
|
+
var first = firstTabbable(content);
|
|
76
|
+
var target = first && first.matches(TEXT_ENTRY_SELECTOR) ? first : content;
|
|
77
|
+
target.focus({ preventScroll: true });
|
|
78
|
+
} }, props), children)))));
|
|
37
79
|
});
|
|
38
80
|
// Exports
|
|
39
81
|
export var Dialog = DialogPrimitive.Root;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { Schema } from "prosemirror-model";
|
|
2
|
-
export declare const schema: Schema<"text" | "line" | "mention" | "doc", "link" | "color" | "bold" | "fontFamily" | "fontSize" | "
|
|
2
|
+
export declare const schema: Schema<"text" | "line" | "mention" | "doc", "link" | "color" | "bold" | "fontFamily" | "fontSize" | "italic" | "strikethrough" | "underline" | "superscript" | "subscript">;
|
|
3
3
|
//# sourceMappingURL=schema.d.ts.map
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import type { VariantProps } from "class-variance-authority";
|
|
2
2
|
import React from "react";
|
|
3
3
|
declare const cellTooltipVariants: (props?: ({
|
|
4
|
-
variant?: "link" | "none" | "note" | "error" | "
|
|
4
|
+
variant?: "link" | "none" | "note" | "error" | "invalid" | "custom" | null | undefined;
|
|
5
5
|
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
|
|
6
6
|
export declare const tooltipTitleVariants: (props?: ({
|
|
7
|
-
variant?: "link" | "none" | "note" | "error" | "
|
|
7
|
+
variant?: "link" | "none" | "note" | "error" | "invalid" | "custom" | null | undefined;
|
|
8
8
|
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
|
|
9
9
|
export declare const CellTooltip: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & VariantProps<(props?: ({
|
|
10
|
-
variant?: "link" | "none" | "note" | "error" | "
|
|
10
|
+
variant?: "link" | "none" | "note" | "error" | "invalid" | "custom" | null | undefined;
|
|
11
11
|
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string> & React.RefAttributes<HTMLDivElement>>;
|
|
12
12
|
export declare const CellTooltipTitle: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & VariantProps<(props?: ({
|
|
13
|
-
variant?: "link" | "none" | "note" | "error" | "
|
|
13
|
+
variant?: "link" | "none" | "note" | "error" | "invalid" | "custom" | null | undefined;
|
|
14
14
|
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string> & React.RefAttributes<HTMLDivElement>>;
|
|
15
15
|
export type CellTooltipVariants = VariantProps<typeof cellTooltipVariants>;
|
|
16
16
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../dialog/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,eAAe,MAAM,wBAAwB,CAAC;AAE1D,OAAO,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../dialog/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,eAAe,MAAM,wBAAwB,CAAC;AAE1D,OAAO,KAAK,MAAM,OAAO,CAAC;AA6C1B,eAAO,MAAM,WAAW,oKAYtB,CAAC;AAGH,eAAO,MAAM,iBAAiB,8KAY5B,CAAC;AAkBH,eAAO,MAAM,aAAa;sBAGJ,MAAM;gBACZ,WAAW,GAAG,IAAI;wCA8ChC,CAAC;AAGH,eAAO,MAAM,MAAM,uCAAuB,CAAC;AAC3C,eAAO,MAAM,aAAa,8GAA0B,CAAC;AACrD,eAAO,MAAM,WAAW,4GAAwB,CAAC;AAEjD,eAAO,MAAM,iBAAiB,4KAS5B,CAAC;AAGH,eAAO,MAAM,UAAU,GAAI,0BAGxB;IACD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B,sBAEA,CAAC"}
|
package/dist/esm/dialog/index.js
CHANGED
|
@@ -4,6 +4,18 @@ import React from "react";
|
|
|
4
4
|
import Draggable from "react-draggable";
|
|
5
5
|
import { IconButton } from "./../icon-button";
|
|
6
6
|
import { cn } from "./../utils";
|
|
7
|
+
const FOCUSABLE_SELECTOR = "a[href], button, input, select, textarea, [tabindex], [contenteditable]";
|
|
8
|
+
const TEXT_ENTRY_SELECTOR = 'input:not([type="button"]):not([type="submit"]):not([type="reset"]):not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="hidden"]), textarea, [contenteditable]:not([contenteditable="false"])';
|
|
9
|
+
const firstTabbable = (container) => {
|
|
10
|
+
for (const element of Array.from(container.querySelectorAll(FOCUSABLE_SELECTOR))) {
|
|
11
|
+
if (element.tabIndex >= 0 &&
|
|
12
|
+
!element.hasAttribute("disabled") &&
|
|
13
|
+
element.getClientRects().length > 0) {
|
|
14
|
+
return element;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
return null;
|
|
18
|
+
};
|
|
7
19
|
const DialogPortal = ({ children, className, container, ...props }) => (React.createElement(DialogPrimitive.Portal, { container: container, ...props },
|
|
8
20
|
React.createElement("div", { className: cn("fixed inset-0 z-50 flex items-start justify-center sm:items-center pointer-events-none", className) }, children)));
|
|
9
21
|
DialogPortal.displayName = DialogPrimitive.Portal.displayName;
|
|
@@ -13,13 +25,32 @@ export const DialogDescription = React.forwardRef(({ className, ...props }, ref)
|
|
|
13
25
|
DialogDescription.displayName = DialogPrimitive.Description.displayName;
|
|
14
26
|
const DialogOverlay = React.forwardRef(({ className, ...props }, ref) => (React.createElement(DialogPrimitive.Overlay, { ref: ref, className: cn("fixed inset-0 z-50 bg-rnc-background/80 transition-all duration-100 data-[state=closed]:animate-out data-[state=closed]:fade-out data-[state=open]:fade-in", className), ...props })));
|
|
15
27
|
DialogOverlay.displayName = DialogPrimitive.Overlay.displayName;
|
|
16
|
-
export const DialogContent = React.forwardRef(({ className, portalClassName, container, children, ...props }, ref) => {
|
|
28
|
+
export const DialogContent = React.forwardRef(({ className, portalClassName, container, children, onOpenAutoFocus, ...props }, ref) => {
|
|
17
29
|
const nodeRef = useRef(null);
|
|
18
30
|
return (React.createElement(DialogPortal, { className: portalClassName, container: container },
|
|
19
31
|
React.createElement(DialogOverlay, null),
|
|
20
32
|
React.createElement("div", { className: "fixed z-50 grid w-full gap-4 animate-in data-[state=open]:fade-in-90 data-[state=open]:slide-in-from-bottom-10 sm:max-w-lg sm:rounded-lg sm:zoom-in-90 data-[state=open]:sm:slide-in-from-bottom-0 pointer-events-none" },
|
|
21
33
|
React.createElement(Draggable, { handle: ".rnc-drag-handle", nodeRef: nodeRef },
|
|
22
|
-
React.createElement(DialogPrimitive.Content, { ref: nodeRef, className: cn("bg-rnc-background text-rnc-foreground shadow-lg rounded-sm border border-solid border-rnc-border pointer-events-auto min-w-0", className),
|
|
34
|
+
React.createElement(DialogPrimitive.Content, { ref: nodeRef, className: cn("bg-rnc-background text-rnc-foreground shadow-lg rounded-sm border border-solid border-rnc-border pointer-events-auto min-w-0 outline-none", className), onOpenAutoFocus: (event) => {
|
|
35
|
+
onOpenAutoFocus?.(event);
|
|
36
|
+
if (event.defaultPrevented)
|
|
37
|
+
return;
|
|
38
|
+
event.preventDefault();
|
|
39
|
+
const content = nodeRef.current;
|
|
40
|
+
if (!content || content.contains(document.activeElement)) {
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
// Radix would focus the first tabbable here. Opened from a menu
|
|
44
|
+
// item, that programmatic focus inherits the menu's
|
|
45
|
+
// :focus-visible state, so a leading tab or button paints a
|
|
46
|
+
// keyboard focus ring after a plain mouse click. Text fields
|
|
47
|
+
// always show their ring when focused, so they keep the old
|
|
48
|
+
// behaviour; anything else lands on the dialog itself and the
|
|
49
|
+
// first Tab press reaches it as before.
|
|
50
|
+
const first = firstTabbable(content);
|
|
51
|
+
const target = first && first.matches(TEXT_ENTRY_SELECTOR) ? first : content;
|
|
52
|
+
target.focus({ preventScroll: true });
|
|
53
|
+
}, ...props }, children)))));
|
|
23
54
|
});
|
|
24
55
|
// Exports
|
|
25
56
|
export const Dialog = DialogPrimitive.Root;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { Schema } from "prosemirror-model";
|
|
2
|
-
export declare const schema: Schema<"text" | "line" | "mention" | "doc", "link" | "color" | "bold" | "fontFamily" | "fontSize" | "
|
|
2
|
+
export declare const schema: Schema<"text" | "line" | "mention" | "doc", "link" | "color" | "bold" | "fontFamily" | "fontSize" | "italic" | "strikethrough" | "underline" | "superscript" | "subscript">;
|
|
3
3
|
//# sourceMappingURL=schema.d.ts.map
|