art-bd-ui 1.0.43 → 1.0.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.
- package/dist/cjs/components/popovers/popover/popover.js +22 -2
- package/dist/cjs/components/quiz/runner/question/question.js +2 -0
- package/dist/cjs/components/ui/date-pickers/date-input/date-input.js +3 -3
- package/dist/cjs/components/ui/date-pickers/date-range-picker/date-range-picker.js +2 -2
- package/dist/cjs/components/ui/rich-editor/bubble-menus/box-bubble-menu.js +21 -77
- package/dist/cjs/components/ui/rich-editor/bubble-menus/columns-bubble-menu.js +0 -1
- package/dist/cjs/components/ui/rich-editor/bubble-menus/controls/align-dropdown.js +32 -0
- package/dist/cjs/components/ui/rich-editor/bubble-menus/controls/bg-shadow-mini-popover.js +20 -0
- package/dist/cjs/components/ui/rich-editor/bubble-menus/controls/border-mini-popover.js +137 -0
- package/dist/cjs/components/ui/rich-editor/bubble-menus/controls/dimensions-dropdown.js +65 -0
- package/dist/cjs/components/ui/rich-editor/bubble-menus/controls/edge-trigger-button.js +16 -0
- package/dist/cjs/components/ui/rich-editor/bubble-menus/controls/edge-trigger-cluster.js +88 -0
- package/dist/cjs/components/ui/rich-editor/bubble-menus/controls/glyphs.js +117 -0
- package/dist/cjs/components/ui/rich-editor/bubble-menus/controls/shared.js +18 -0
- package/dist/cjs/components/ui/rich-editor/bubble-menus/controls/spacing-popover.js +97 -0
- package/dist/cjs/components/ui/rich-editor/bubble-menus/controls/style-popover.js +30 -0
- package/dist/cjs/components/ui/rich-editor/bubble-menus/controls/uniform-per-side-toggle.js +31 -0
- package/dist/cjs/components/ui/rich-editor/bubble-menus/floating-bubble-controls.js +1 -3
- package/dist/cjs/components/ui/rich-editor/bubble-menus/layout-bubble-menu.js +162 -128
- package/dist/cjs/components/ui/rich-editor/bubble-menus/layout-item-bubble-menu.js +55 -89
- package/dist/cjs/components/ui/rich-editor/bubble-menus/shared.js +2 -4
- package/dist/cjs/components/ui/rich-editor/extensions/box/editor.js +30 -0
- package/dist/cjs/components/ui/rich-editor/extensions/box/extension.js +20 -0
- package/dist/cjs/components/ui/rich-editor/extensions/box/node-view.js +21 -2
- package/dist/cjs/components/ui/rich-editor/extensions/box/utils.js +41 -16
- package/dist/cjs/components/ui/rich-editor/extensions/layout/editor.js +159 -35
- package/dist/cjs/components/ui/rich-editor/extensions/layout/extension.js +44 -74
- package/dist/cjs/components/ui/rich-editor/extensions/layout/interactions.js +158 -0
- package/dist/cjs/components/ui/rich-editor/extensions/layout/node-view.js +90 -38
- package/dist/cjs/components/ui/rich-editor/extensions/layout/use-layout-edge-trigger-state.js +88 -0
- package/dist/cjs/components/ui/rich-editor/extensions/layout/use-layout-item-update.js +16 -0
- package/dist/cjs/components/ui/rich-editor/extensions/layout/utils.js +16 -0
- package/dist/cjs/components/ui/rich-editor/extensions/node-interactions/commands.js +148 -0
- package/dist/cjs/components/ui/rich-editor/extensions/node-interactions/extension.js +16 -0
- package/dist/cjs/components/ui/rich-editor/extensions/node-interactions/hook.js +53 -0
- package/dist/cjs/components/ui/rich-editor/extensions/node-interactions/node-selection-frame.js +18 -0
- package/dist/cjs/components/ui/rich-editor/extensions/node-interactions/plugin.js +298 -0
- package/dist/cjs/components/ui/rich-editor/extensions/slash/default-suggestions.js +16 -4
- package/dist/cjs/components/ui/rich-editor/extensions/slash/slash.js +1 -1
- package/dist/cjs/components/ui/rich-editor/extensions.js +12 -11
- package/dist/cjs/components/ui/rich-editor/toolbar/color-constants.js +52 -36
- package/dist/cjs/components/ui/rich-editor/toolbar/color-swatch.js +48 -4
- package/dist/cjs/components/ui/rich-editor/toolbar/text-color-picker.js +1 -1
- package/dist/esm/components/popovers/popover/popover.js +22 -2
- package/dist/esm/components/quiz/runner/question/question.js +2 -0
- package/dist/esm/components/ui/date-pickers/date-input/date-input.js +3 -3
- package/dist/esm/components/ui/date-pickers/date-range-picker/date-range-picker.js +2 -2
- package/dist/esm/components/ui/rich-editor/bubble-menus/box-bubble-menu.js +21 -77
- package/dist/esm/components/ui/rich-editor/bubble-menus/columns-bubble-menu.js +0 -1
- package/dist/esm/components/ui/rich-editor/bubble-menus/controls/align-dropdown.js +30 -0
- package/dist/esm/components/ui/rich-editor/bubble-menus/controls/bg-shadow-mini-popover.js +18 -0
- package/dist/esm/components/ui/rich-editor/bubble-menus/controls/border-mini-popover.js +135 -0
- package/dist/esm/components/ui/rich-editor/bubble-menus/controls/dimensions-dropdown.js +61 -0
- package/dist/esm/components/ui/rich-editor/bubble-menus/controls/edge-trigger-button.js +14 -0
- package/dist/esm/components/ui/rich-editor/bubble-menus/controls/edge-trigger-cluster.js +86 -0
- package/dist/esm/components/ui/rich-editor/bubble-menus/controls/glyphs.js +104 -0
- package/dist/esm/components/ui/rich-editor/bubble-menus/controls/shared.js +15 -0
- package/dist/esm/components/ui/rich-editor/bubble-menus/controls/spacing-popover.js +94 -0
- package/dist/esm/components/ui/rich-editor/bubble-menus/controls/style-popover.js +25 -0
- package/dist/esm/components/ui/rich-editor/bubble-menus/controls/uniform-per-side-toggle.js +29 -0
- package/dist/esm/components/ui/rich-editor/bubble-menus/floating-bubble-controls.js +2 -4
- package/dist/esm/components/ui/rich-editor/bubble-menus/layout-bubble-menu.js +163 -130
- package/dist/esm/components/ui/rich-editor/bubble-menus/layout-item-bubble-menu.js +56 -90
- package/dist/esm/components/ui/rich-editor/bubble-menus/shared.js +2 -3
- package/dist/esm/components/ui/rich-editor/extensions/box/editor.js +30 -0
- package/dist/esm/components/ui/rich-editor/extensions/box/extension.js +20 -0
- package/dist/esm/components/ui/rich-editor/extensions/box/node-view.js +22 -3
- package/dist/esm/components/ui/rich-editor/extensions/box/utils.js +41 -16
- package/dist/esm/components/ui/rich-editor/extensions/layout/editor.js +160 -35
- package/dist/esm/components/ui/rich-editor/extensions/layout/extension.js +45 -74
- package/dist/esm/components/ui/rich-editor/extensions/layout/interactions.js +149 -0
- package/dist/esm/components/ui/rich-editor/extensions/layout/node-view.js +92 -39
- package/dist/esm/components/ui/rich-editor/extensions/layout/use-layout-edge-trigger-state.js +85 -0
- package/dist/esm/components/ui/rich-editor/extensions/layout/use-layout-item-update.js +14 -0
- package/dist/esm/components/ui/rich-editor/extensions/layout/utils.js +16 -0
- package/dist/esm/components/ui/rich-editor/extensions/node-interactions/commands.js +144 -0
- package/dist/esm/components/ui/rich-editor/extensions/node-interactions/extension.js +14 -0
- package/dist/esm/components/ui/rich-editor/extensions/node-interactions/hook.js +51 -0
- package/dist/esm/components/ui/rich-editor/extensions/node-interactions/node-selection-frame.js +16 -0
- package/dist/esm/components/ui/rich-editor/extensions/node-interactions/plugin.js +291 -0
- package/dist/esm/components/ui/rich-editor/extensions/slash/default-suggestions.js +16 -4
- package/dist/esm/components/ui/rich-editor/extensions/slash/slash.js +1 -1
- package/dist/esm/components/ui/rich-editor/extensions.js +9 -8
- package/dist/esm/components/ui/rich-editor/toolbar/color-constants.js +51 -37
- package/dist/esm/components/ui/rich-editor/toolbar/color-swatch.js +49 -5
- package/dist/esm/components/ui/rich-editor/toolbar/text-color-picker.js +1 -1
- package/dist/styles.css +244 -47
- package/dist/types/index.d.ts +18 -15
- package/package.json +1 -1
|
@@ -45,8 +45,28 @@ const PopoverTrigger = (_a) => {
|
|
|
45
45
|
return jsxRuntime.jsx(index.Trigger, Object.assign({ "data-slot": "popover-trigger" }, props));
|
|
46
46
|
};
|
|
47
47
|
const PopoverContent = (_a) => {
|
|
48
|
-
var { className, align = "center", arrow = false, withClose = false, sideOffset = 4, size, matchTriggerWidth = false, children } = _a, props = tslib_es6.__rest(_a, ["className", "align", "arrow", "withClose", "sideOffset", "size", "matchTriggerWidth", "children"]);
|
|
49
|
-
|
|
48
|
+
var { className, align = "center", arrow = false, withClose = false, sideOffset = 4, size, matchTriggerWidth = false, persistent = false, children, onPointerDownOutside, onFocusOutside } = _a, props = tslib_es6.__rest(_a, ["className", "align", "arrow", "withClose", "sideOffset", "size", "matchTriggerWidth", "persistent", "children", "onPointerDownOutside", "onFocusOutside"]);
|
|
49
|
+
const handlePointerDownOutside = (event) => {
|
|
50
|
+
if (persistent) {
|
|
51
|
+
const target = event.target;
|
|
52
|
+
const currentTarget = event.currentTarget;
|
|
53
|
+
if (target && currentTarget.contains(target)) {
|
|
54
|
+
event.preventDefault();
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
onPointerDownOutside === null || onPointerDownOutside === void 0 ? void 0 : onPointerDownOutside(event);
|
|
58
|
+
};
|
|
59
|
+
const handleFocusOutside = (event) => {
|
|
60
|
+
if (persistent) {
|
|
61
|
+
const target = event.target;
|
|
62
|
+
const currentTarget = event.currentTarget;
|
|
63
|
+
if (target && currentTarget.contains(target)) {
|
|
64
|
+
event.preventDefault();
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
onFocusOutside === null || onFocusOutside === void 0 ? void 0 : onFocusOutside(event);
|
|
68
|
+
};
|
|
69
|
+
return (jsxRuntime.jsx(index.Portal, { children: jsxRuntime.jsxs(index.Content, Object.assign({ "data-slot": "popover-content", align: align, sideOffset: sideOffset, className: utils.cn(popoverContentVariants({ size, matchTriggerWidth }), className), onPointerDownOutside: handlePointerDownOutside, onFocusOutside: handleFocusOutside }, props, { children: [children, withClose && (jsxRuntime.jsx(index.Close, { asChild: true, children: jsxRuntime.jsx(iconClose.IconClose, {}) })), arrow && jsxRuntime.jsx(index.Arrow, { className: "fill-popover" })] })) }));
|
|
50
70
|
};
|
|
51
71
|
const PopoverAnchor = (_a) => {
|
|
52
72
|
var props = tslib_es6.__rest(_a, []);
|
|
@@ -45,6 +45,8 @@ require('../../../forms/dropzone/dropzone.js');
|
|
|
45
45
|
require('../../../forms/input-number/input-number.js');
|
|
46
46
|
require('../../../forms/label/label.js');
|
|
47
47
|
require('../../../forms/switch/switch.js');
|
|
48
|
+
require('../../../ui/rich-editor/extensions/node-interactions/plugin.js');
|
|
49
|
+
require('../../../ui/rich-editor/extensions/node-interactions/extension.js');
|
|
48
50
|
require('../../../ui/rich-editor/bubble-menus/text-selection-bubble-menu.js');
|
|
49
51
|
require('../../../../node_modules/@tiptap/extension-drag-handle/dist/index.js');
|
|
50
52
|
require('../../../ui/rich-editor/extensions/slash/slash.js');
|
|
@@ -43,7 +43,7 @@ function parseDateWithLocale(text, locale) {
|
|
|
43
43
|
return parsed || undefined;
|
|
44
44
|
}
|
|
45
45
|
const DateInput = React.forwardRef((_a, ref) => {
|
|
46
|
-
var { value, onChange, onMonthChange, disabled = false, locale = "en", placeholder = locale === "en" ? "Select date (e.g. 9/1/2025)" : "Введіть Дату (напр. 01.09.2025)", className } = _a, rest = tslib_es6.__rest(_a, ["value", "onChange", "onMonthChange", "disabled", "locale", "placeholder", "className"]);
|
|
46
|
+
var { value, onChange, onMonthChange, disabled = false, locale = "en", placeholder = locale === "en" ? "Select date (e.g. 9/1/2025)" : "Введіть Дату (напр. 01.09.2025)", className, calendarProps } = _a, rest = tslib_es6.__rest(_a, ["value", "onChange", "onMonthChange", "disabled", "locale", "placeholder", "className", "calendarProps"]);
|
|
47
47
|
const [open, setOpen] = React.useState(false);
|
|
48
48
|
const [inputValue, setInputValue] = React.useState(value ? formatDate(value, locale) : "");
|
|
49
49
|
const [month, setMonth] = React.useState(value !== null && value !== void 0 ? value : new Date());
|
|
@@ -103,13 +103,13 @@ const DateInput = React.forwardRef((_a, ref) => {
|
|
|
103
103
|
if (e.target instanceof HTMLElement && e.target.closest("input")) {
|
|
104
104
|
e.preventDefault();
|
|
105
105
|
}
|
|
106
|
-
}, children: jsxRuntime.jsx(calendar.Calendar, { mode: "single", selected: value, month: month, onSelect: (date) => {
|
|
106
|
+
}, children: jsxRuntime.jsx(calendar.Calendar, Object.assign({}, calendarProps, { mode: "single", selected: value, month: month, onSelect: (date) => {
|
|
107
107
|
onChange === null || onChange === void 0 ? void 0 : onChange(date);
|
|
108
108
|
if (date) {
|
|
109
109
|
setInputValue(formatDate(date, locale));
|
|
110
110
|
}
|
|
111
111
|
setOpen(false);
|
|
112
|
-
}, onMonthChange: handleMonthChange, locale: getDateFnsLocale(locale), disabled: disabled }) })] }));
|
|
112
|
+
}, onMonthChange: handleMonthChange, locale: getDateFnsLocale(locale), disabled: disabled })) })] }));
|
|
113
113
|
});
|
|
114
114
|
DateInput.displayName = "DateInput";
|
|
115
115
|
|
|
@@ -17,7 +17,7 @@ var enUS = require('../../../../node_modules/date-fns/locale/en-US.js');
|
|
|
17
17
|
const setDefaultTime = (date) => new Date(date.setHours(0, 0, 0, 0));
|
|
18
18
|
const getDate = (date) => date || setDefaultTime(new Date());
|
|
19
19
|
const getDateFnsLocale = (locale) => (locale === "ua" ? uk.uk : enUS.enUS);
|
|
20
|
-
const DateRangePicker = React.forwardRef(({ value: range, onChange, granularity = "day", hourCycle = 24, locale = "en", placeholder = "Select date range", className, numberOfMonths = 1, }, ref) => {
|
|
20
|
+
const DateRangePicker = React.forwardRef(({ value: range, onChange, granularity = "day", hourCycle = 24, locale = "en", placeholder = "Select date range", className, numberOfMonths = 1, calendarProps, }, ref) => {
|
|
21
21
|
const buttonRef = React.useRef(null);
|
|
22
22
|
const [hoveredDate, setHoveredDate] = React.useState(null);
|
|
23
23
|
const loc = getDateFnsLocale(locale);
|
|
@@ -31,7 +31,7 @@ const DateRangePicker = React.forwardRef(({ value: range, onChange, granularity
|
|
|
31
31
|
value: range,
|
|
32
32
|
focus: () => { var _a; return (_a = buttonRef.current) === null || _a === void 0 ? void 0 : _a.focus(); },
|
|
33
33
|
}), [range]);
|
|
34
|
-
return (jsxRuntime.jsxs(popover.Popover, { children: [jsxRuntime.jsx(popover.PopoverTrigger, { asChild: true, children: jsxRuntime.jsx(button.Button, { ref: buttonRef, variant: "outline", leftIcon: "calendar", className: utils.cn("w-full justify-start text-left font-normal", !(range === null || range === void 0 ? void 0 : range.from) && "text-muted-foreground", className), children: displayValue }) }), jsxRuntime.jsxs(popover.PopoverContent, { className: "w-auto p-0 relative", children: [jsxRuntime.jsx(calendar.Calendar, { mode: "range", selected: range, onSelect: onChange, numberOfMonths: numberOfMonths, locale: loc, required: true, onDayMouseEnter: setHoveredDate, onDayMouseLeave: () => setHoveredDate(null), modifiers: modifiers }), granularity !== "day" && (jsxRuntime.jsxs(flex.Flex, { direction: "col", gap: 4, className: "border-t border-border p-3", children: [jsxRuntime.jsxs(flex.Flex, { direction: "col", gap: 1, children: [jsxRuntime.jsx(text.Text, { children: "Start time" }), jsxRuntime.jsx(timePicker.TimePicker, { value: range === null || range === void 0 ? void 0 : range.from, onChange: (value) => {
|
|
34
|
+
return (jsxRuntime.jsxs(popover.Popover, { children: [jsxRuntime.jsx(popover.PopoverTrigger, { asChild: true, children: jsxRuntime.jsx(button.Button, { ref: buttonRef, variant: "outline", leftIcon: "calendar", className: utils.cn("w-full justify-start text-left font-normal", !(range === null || range === void 0 ? void 0 : range.from) && "text-muted-foreground", className), children: displayValue }) }), jsxRuntime.jsxs(popover.PopoverContent, { className: "w-auto p-0 relative", children: [jsxRuntime.jsx(calendar.Calendar, Object.assign({}, calendarProps, { mode: "range", selected: range, onSelect: onChange, numberOfMonths: numberOfMonths, locale: loc, required: true, onDayMouseEnter: setHoveredDate, onDayMouseLeave: () => setHoveredDate(null), modifiers: modifiers })), granularity !== "day" && (jsxRuntime.jsxs(flex.Flex, { direction: "col", gap: 4, className: "border-t border-border p-3", children: [jsxRuntime.jsxs(flex.Flex, { direction: "col", gap: 1, children: [jsxRuntime.jsx(text.Text, { children: "Start time" }), jsxRuntime.jsx(timePicker.TimePicker, { value: range === null || range === void 0 ? void 0 : range.from, onChange: (value) => {
|
|
35
35
|
if (value) {
|
|
36
36
|
onChange === null || onChange === void 0 ? void 0 : onChange({
|
|
37
37
|
from: value,
|
|
@@ -1,67 +1,50 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
-
var React = require('react');
|
|
5
4
|
var index = require('../../../../node_modules/@tiptap/react/dist/index.js');
|
|
6
5
|
var index$1 = require('../../../../node_modules/@tiptap/react/dist/menus/index.js');
|
|
7
6
|
var index$2 = require('../../../../node_modules/prosemirror-state/dist/index.js');
|
|
8
7
|
var shared = require('./shared.js');
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
var colorConstants = require('../toolbar/color-constants.js');
|
|
8
|
+
require('react');
|
|
9
|
+
require('../../../../node_modules/tslib/tslib.es6.js');
|
|
12
10
|
var button = require('../../../buttons/button/button.js');
|
|
13
|
-
|
|
11
|
+
require('../../../popovers/popover/popover.js');
|
|
14
12
|
var separator = require('../../../utility/separator/separator.js');
|
|
15
13
|
var tooltip = require('../../../popovers/tooltip/tooltip.js');
|
|
16
|
-
|
|
17
|
-
var
|
|
18
|
-
var
|
|
19
|
-
var circle = require('../../../../node_modules/lucide-react/dist/esm/icons/circle.js');
|
|
20
|
-
var slidersVertical = require('../../../../node_modules/lucide-react/dist/esm/icons/sliders-vertical.js');
|
|
14
|
+
require('../toolbar/color-constants.js');
|
|
15
|
+
var stylePopover = require('./controls/style-popover.js');
|
|
16
|
+
var spacingPopover = require('./controls/spacing-popover.js');
|
|
21
17
|
var trash2 = require('../../../../node_modules/lucide-react/dist/esm/icons/trash-2.js');
|
|
22
18
|
|
|
23
|
-
const SHADOW_LABELS = {
|
|
24
|
-
none: "None",
|
|
25
|
-
sm: "SM",
|
|
26
|
-
md: "MD",
|
|
27
|
-
lg: "LG",
|
|
28
|
-
xl: "XL",
|
|
29
|
-
};
|
|
30
|
-
const BORDER_STYLE_OPTIONS = ["none", "solid", "dashed", "dotted"];
|
|
31
19
|
function BoxBubbleMenu({ editor }) {
|
|
32
|
-
var _a, _b, _c, _d, _e, _f;
|
|
33
|
-
const [borderPopoverOpen, setBorderPopoverOpen] = React.useState(false);
|
|
34
|
-
const [bgPopoverOpen, setBgPopoverOpen] = React.useState(false);
|
|
35
|
-
const [customRadiusOpen, setCustomRadiusOpen] = React.useState(false);
|
|
36
|
-
const [customPaddingOpen, setCustomPaddingOpen] = React.useState(false);
|
|
20
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
37
21
|
const attrs = index.useEditorState({
|
|
38
22
|
editor,
|
|
39
|
-
selector: ({ editor:
|
|
40
|
-
if (!
|
|
23
|
+
selector: ({ editor: currentEditor }) => {
|
|
24
|
+
if (!currentEditor.isActive("box"))
|
|
41
25
|
return null;
|
|
42
|
-
return
|
|
26
|
+
return currentEditor.getAttributes("box");
|
|
43
27
|
},
|
|
44
28
|
});
|
|
45
29
|
if (!attrs)
|
|
46
30
|
return null;
|
|
47
31
|
const update = (patch) => editor.chain().focus().updateBoxAttrs(patch).run();
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
32
|
+
return (jsxRuntime.jsx(index$1.BubbleMenu, { editor: editor, pluginKey: shared.boxBubbleMenuPluginKey, ref: (menuElement) => {
|
|
33
|
+
if (menuElement) {
|
|
34
|
+
menuElement.style.zIndex = "40";
|
|
35
|
+
}
|
|
36
|
+
}, shouldShow: ({ state, editor: bubbleEditor }) => {
|
|
51
37
|
const { selection } = state;
|
|
52
38
|
return bubbleEditor.isActive("box") && selection instanceof index$2.TextSelection && selection.empty;
|
|
53
39
|
}, updateDelay: 0, getReferencedVirtualElement: () => {
|
|
54
40
|
const { $from } = editor.state.selection;
|
|
55
|
-
for (let depth = $from.depth; depth > 0; depth
|
|
41
|
+
for (let depth = $from.depth; depth > 0; depth -= 1) {
|
|
56
42
|
const node = $from.node(depth);
|
|
57
43
|
if (node.type.name === "box") {
|
|
58
|
-
const
|
|
59
|
-
const dom = editor.view.nodeDOM(
|
|
44
|
+
const position = $from.before(depth);
|
|
45
|
+
const dom = editor.view.nodeDOM(position);
|
|
60
46
|
if (dom instanceof HTMLElement) {
|
|
61
|
-
return {
|
|
62
|
-
contextElement: dom,
|
|
63
|
-
getBoundingClientRect: () => dom.getBoundingClientRect(),
|
|
64
|
-
};
|
|
47
|
+
return { contextElement: dom, getBoundingClientRect: () => dom.getBoundingClientRect() };
|
|
65
48
|
}
|
|
66
49
|
}
|
|
67
50
|
}
|
|
@@ -70,47 +53,8 @@ function BoxBubbleMenu({ editor }) {
|
|
|
70
53
|
placement: "top-start",
|
|
71
54
|
offset: 6,
|
|
72
55
|
shift: { padding: 8 },
|
|
73
|
-
flip: {
|
|
74
|
-
|
|
75
|
-
},
|
|
76
|
-
}, className: "relative z-30 rounded-xl border bg-popover p-1 shadow-md", children: jsxRuntime.jsxs("div", { className: "flex flex-wrap items-center gap-1", children: [jsxRuntime.jsxs(popover.Popover, { open: borderPopoverOpen, onOpenChange: setBorderPopoverOpen, children: [jsxRuntime.jsxs(tooltip.Tooltip, { delayDuration: 300, children: [jsxRuntime.jsx(tooltip.TooltipTrigger, { asChild: true, children: jsxRuntime.jsx(popover.PopoverTrigger, { asChild: true, children: jsxRuntime.jsx(button.Button, { type: "button", variant: "ghost", size: "icon-sm", className: "size-8", "aria-label": "Border", children: jsxRuntime.jsx("span", { className: "size-4 rounded-sm border-2", style: { borderColor: (_a = attrs.borderColor) !== null && _a !== void 0 ? _a : "currentColor" }, "aria-hidden": true }) }) }) }), jsxRuntime.jsx(tooltip.TooltipContent, { children: "Border" })] }), jsxRuntime.jsxs(popover.PopoverContent, { className: "w-56 p-3 space-y-3", align: "start", children: [jsxRuntime.jsx("p", { className: "text-xs font-medium text-muted-foreground", children: "Border color" }), jsxRuntime.jsx(colorSwatch.ColorGrid, { colors: colorConstants.UNIFIED_BACKGROUND_COLORS, onColorSelect: (color) => {
|
|
77
|
-
update({
|
|
78
|
-
borderColor: color,
|
|
79
|
-
borderStyle: attrs.borderStyle || "solid",
|
|
80
|
-
borderWidth: attrs.borderWidth || "1px",
|
|
81
|
-
});
|
|
82
|
-
}, currentColor: (_b = attrs.borderColor) !== null && _b !== void 0 ? _b : undefined, columns: 5, size: "sm" }), jsxRuntime.jsx(button.Button, { variant: "outline", size: "sm", className: "w-full", onClick: () => update({ borderColor: null, borderWidth: null, borderStyle: null }), children: "Remove border" }), jsxRuntime.jsx(separator.Separator, {}), jsxRuntime.jsxs("div", { className: "space-y-1.5", children: [jsxRuntime.jsx("p", { className: "text-xs font-medium text-muted-foreground", children: "Border width" }), jsxRuntime.jsx("div", { className: "flex gap-1", children: ["1px", "2px", "3px", "4px"].map((w) => (jsxRuntime.jsx(button.Button, { type: "button", variant: attrs.borderWidth === w ? "default" : "outline", size: "sm", className: "h-7 flex-1 px-1 text-xs", onClick: () => update({
|
|
83
|
-
borderWidth: w,
|
|
84
|
-
borderStyle: attrs.borderStyle || "solid",
|
|
85
|
-
borderColor: attrs.borderColor || "#e2e8f0",
|
|
86
|
-
}), children: w }, w))) })] }), jsxRuntime.jsxs("div", { className: "space-y-1.5", children: [jsxRuntime.jsx("p", { className: "text-xs font-medium text-muted-foreground", children: "Border style" }), jsxRuntime.jsx("div", { className: "flex gap-1", children: BORDER_STYLE_OPTIONS.map((s) => (jsxRuntime.jsx(button.Button, { type: "button", variant: attrs.borderStyle === s ? "default" : "outline", size: "sm", className: "h-7 flex-1 px-1 text-xs capitalize", onClick: () => update({
|
|
87
|
-
borderStyle: s,
|
|
88
|
-
borderWidth: attrs.borderWidth || "1px",
|
|
89
|
-
borderColor: attrs.borderColor || "#e2e8f0",
|
|
90
|
-
}), children: s }, s))) })] })] })] }), jsxRuntime.jsx(separator.Separator, { orientation: "vertical", className: "mx-0.5 h-5" }), jsxRuntime.jsxs(tooltip.Tooltip, { delayDuration: 300, children: [jsxRuntime.jsx(tooltip.TooltipTrigger, { asChild: true, children: jsxRuntime.jsx(button.Button, { type: "button", variant: activeRadius === "none" ? "secondary" : "ghost", size: "icon-sm", className: "size-8", onClick: () => update({ borderRadius: utils.BOX_BORDER_RADIUS_PRESETS.none }), "aria-label": "Square corners", children: jsxRuntime.jsx(square.default, { className: "size-3.5" }) }) }), jsxRuntime.jsx(tooltip.TooltipContent, { children: "Square corners" })] }), jsxRuntime.jsxs(tooltip.Tooltip, { delayDuration: 300, children: [jsxRuntime.jsx(tooltip.TooltipTrigger, { asChild: true, children: jsxRuntime.jsx(button.Button, { type: "button", variant: activeRadius === "rounded" ? "secondary" : "ghost", size: "icon-sm", className: "size-8", onClick: () => update({ borderRadius: utils.BOX_BORDER_RADIUS_PRESETS.rounded }), "aria-label": "Rounded corners", children: jsxRuntime.jsx(squareRoundCorner.default, { className: "size-3.5" }) }) }), jsxRuntime.jsx(tooltip.TooltipContent, { children: "Rounded corners (8px)" })] }), jsxRuntime.jsxs(tooltip.Tooltip, { delayDuration: 300, children: [jsxRuntime.jsx(tooltip.TooltipTrigger, { asChild: true, children: jsxRuntime.jsx(button.Button, { type: "button", variant: activeRadius === "pill" ? "secondary" : "ghost", size: "icon-sm", className: "size-8", onClick: () => update({ borderRadius: utils.BOX_BORDER_RADIUS_PRESETS.pill }), "aria-label": "Pill corners", children: jsxRuntime.jsx(circle.default, { className: "size-3.5" }) }) }), jsxRuntime.jsx(tooltip.TooltipContent, { children: "Pill corners (9999px)" })] }), jsxRuntime.jsxs(popover.Popover, { open: customRadiusOpen, onOpenChange: setCustomRadiusOpen, children: [jsxRuntime.jsxs(tooltip.Tooltip, { delayDuration: 300, children: [jsxRuntime.jsx(tooltip.TooltipTrigger, { asChild: true, children: jsxRuntime.jsx(popover.PopoverTrigger, { asChild: true, children: jsxRuntime.jsx(button.Button, { type: "button", variant: activeRadius === undefined && attrs.borderRadius ? "secondary" : "ghost", size: "icon-sm", className: "size-8", "aria-label": "Custom radius", children: jsxRuntime.jsx(slidersVertical.default, { className: "size-3.5" }) }) }) }), jsxRuntime.jsx(tooltip.TooltipContent, { children: "Custom radius" })] }), jsxRuntime.jsxs(popover.PopoverContent, { className: "w-44 p-3", align: "start", children: [jsxRuntime.jsx("p", { className: "mb-2 text-xs font-medium text-muted-foreground", children: "Border radius (CSS value)" }), jsxRuntime.jsx("input", { type: "text", className: "w-full rounded-md border border-input bg-background px-2 py-1 text-sm focus:outline-none focus:ring-2 focus:ring-ring", placeholder: "e.g. 12px or 4px 8px", defaultValue: (_c = attrs.borderRadius) !== null && _c !== void 0 ? _c : "", onKeyDown: (e) => {
|
|
91
|
-
if (e.key === "Enter") {
|
|
92
|
-
update({ borderRadius: e.currentTarget.value || null });
|
|
93
|
-
setCustomRadiusOpen(false);
|
|
94
|
-
}
|
|
95
|
-
}, onBlur: (e) => {
|
|
96
|
-
update({ borderRadius: e.currentTarget.value || null });
|
|
97
|
-
} })] })] }), jsxRuntime.jsx(separator.Separator, { orientation: "vertical", className: "mx-0.5 h-5" }), Object.keys(utils.BOX_SHADOW_PRESETS).map((key) => (jsxRuntime.jsxs(tooltip.Tooltip, { delayDuration: 300, children: [jsxRuntime.jsx(tooltip.TooltipTrigger, { asChild: true, children: jsxRuntime.jsx(button.Button, { type: "button", variant: activeShadow === key ? "secondary" : "ghost", size: "sm", className: "h-8 px-2 text-xs", onClick: () => update({ boxShadow: utils.BOX_SHADOW_PRESETS[key] }), "aria-label": `Shadow ${key}`, children: SHADOW_LABELS[key] }) }), jsxRuntime.jsx(tooltip.TooltipContent, { children: key === "none" ? "No shadow" : `Shadow ${key.toUpperCase()}` })] }, key))), jsxRuntime.jsx(separator.Separator, { orientation: "vertical", className: "mx-0.5 h-5" }), jsxRuntime.jsxs(popover.Popover, { open: customPaddingOpen, onOpenChange: setCustomPaddingOpen, children: [jsxRuntime.jsxs(tooltip.Tooltip, { delayDuration: 300, children: [jsxRuntime.jsx(tooltip.TooltipTrigger, { asChild: true, children: jsxRuntime.jsx(popover.PopoverTrigger, { asChild: true, children: jsxRuntime.jsx(button.Button, { type: "button", variant: "ghost", size: "sm", className: "h-8 px-2 text-xs font-mono", "aria-label": "Padding", children: (_d = attrs.padding) !== null && _d !== void 0 ? _d : "16px" }) }) }), jsxRuntime.jsx(tooltip.TooltipContent, { children: "Padding" })] }), jsxRuntime.jsxs(popover.PopoverContent, { className: "w-44 p-3", align: "start", children: [jsxRuntime.jsx("p", { className: "mb-2 text-xs font-medium text-muted-foreground", children: "Padding (CSS value)" }), jsxRuntime.jsx("input", { type: "text", className: "w-full rounded-md border border-input bg-background px-2 py-1 text-sm focus:outline-none focus:ring-2 focus:ring-ring", placeholder: "e.g. 16px or 8px 16px", defaultValue: (_e = attrs.padding) !== null && _e !== void 0 ? _e : "16px", onKeyDown: (e) => {
|
|
98
|
-
if (e.key === "Enter") {
|
|
99
|
-
update({ padding: e.currentTarget.value || null });
|
|
100
|
-
setCustomPaddingOpen(false);
|
|
101
|
-
}
|
|
102
|
-
}, onBlur: (e) => {
|
|
103
|
-
update({ padding: e.currentTarget.value || null });
|
|
104
|
-
} }), jsxRuntime.jsx("div", { className: "mt-2 flex flex-wrap gap-1", children: ["0px", "8px", "16px", "24px", "32px"].map((p) => (jsxRuntime.jsx(button.Button, { type: "button", variant: attrs.padding === p ? "default" : "outline", size: "sm", className: "h-6 px-1.5 text-xs", onClick: () => {
|
|
105
|
-
update({ padding: p });
|
|
106
|
-
setCustomPaddingOpen(false);
|
|
107
|
-
}, children: p }, p))) })] })] }), jsxRuntime.jsx(separator.Separator, { orientation: "vertical", className: "mx-0.5 h-5" }), jsxRuntime.jsxs(popover.Popover, { open: bgPopoverOpen, onOpenChange: setBgPopoverOpen, children: [jsxRuntime.jsxs(tooltip.Tooltip, { delayDuration: 300, children: [jsxRuntime.jsx(tooltip.TooltipTrigger, { asChild: true, children: jsxRuntime.jsx(popover.PopoverTrigger, { asChild: true, children: jsxRuntime.jsx(button.Button, { type: "button", variant: "ghost", size: "icon-sm", className: "size-8", "aria-label": "Background color", children: jsxRuntime.jsx("span", { className: utils$1.cn("size-4 rounded-sm border border-border/90", !attrs.backgroundColor && "bg-muted"), style: attrs.backgroundColor ? { backgroundColor: attrs.backgroundColor } : undefined, "aria-hidden": true }) }) }) }), jsxRuntime.jsx(tooltip.TooltipContent, { children: "Background color" })] }), jsxRuntime.jsxs(popover.PopoverContent, { className: "w-[248px] p-3 space-y-3", align: "start", children: [jsxRuntime.jsx("p", { className: "text-xs font-medium text-muted-foreground", children: "Background color" }), jsxRuntime.jsx(colorSwatch.ColorGrid, { colors: colorConstants.UNIFIED_BACKGROUND_COLORS, onColorSelect: (color) => {
|
|
108
|
-
update({ backgroundColor: color });
|
|
109
|
-
setBgPopoverOpen(false);
|
|
110
|
-
}, currentColor: (_f = attrs.backgroundColor) !== null && _f !== void 0 ? _f : undefined, columns: 5, size: "md" }), jsxRuntime.jsx(separator.Separator, {}), jsxRuntime.jsx(button.Button, { variant: "outline", size: "sm", className: "w-full", onClick: () => {
|
|
111
|
-
update({ backgroundColor: null });
|
|
112
|
-
setBgPopoverOpen(false);
|
|
113
|
-
}, children: "Remove background" })] })] }), jsxRuntime.jsx(separator.Separator, { orientation: "vertical", className: "mx-0.5 h-5" }), jsxRuntime.jsxs(tooltip.Tooltip, { delayDuration: 300, children: [jsxRuntime.jsx(tooltip.TooltipTrigger, { asChild: true, children: jsxRuntime.jsx(button.Button, { type: "button", variant: "ghost", size: "icon-sm", className: "size-8 text-destructive hover:text-destructive", onClick: () => editor.chain().focus().removeBox().run(), "aria-label": "Remove box", children: jsxRuntime.jsx(trash2.default, { className: "size-4" }) }) }), jsxRuntime.jsx(tooltip.TooltipContent, { children: "Remove box" })] })] }) }));
|
|
56
|
+
flip: { fallbackPlacements: ["bottom-start", "top-end", "bottom-end"] },
|
|
57
|
+
}, className: "relative z-30 rounded-2xl border bg-popover/95 p-1.5 shadow-lg backdrop-blur-sm", children: jsxRuntime.jsxs("div", { className: "flex flex-wrap items-center gap-1", children: [jsxRuntime.jsx(spacingPopover.SpacingPopover, { padding: (_a = attrs.padding) !== null && _a !== void 0 ? _a : null, paddingTop: (_b = attrs.paddingTop) !== null && _b !== void 0 ? _b : null, paddingRight: (_c = attrs.paddingRight) !== null && _c !== void 0 ? _c : null, paddingBottom: (_d = attrs.paddingBottom) !== null && _d !== void 0 ? _d : null, paddingLeft: (_e = attrs.paddingLeft) !== null && _e !== void 0 ? _e : null, defaultPadding: "16px", onChange: (patch) => update(patch) }), jsxRuntime.jsx(stylePopover.StylePopover, { borderColor: (_f = attrs.borderColor) !== null && _f !== void 0 ? _f : null, borderWidth: (_g = attrs.borderWidth) !== null && _g !== void 0 ? _g : null, borderStyle: (_h = attrs.borderStyle) !== null && _h !== void 0 ? _h : null, borderRadius: (_j = attrs.borderRadius) !== null && _j !== void 0 ? _j : null, boxShadow: (_k = attrs.boxShadow) !== null && _k !== void 0 ? _k : null, backgroundColor: (_l = attrs.backgroundColor) !== null && _l !== void 0 ? _l : null, onChange: (patch) => update(patch) }), jsxRuntime.jsx(separator.Separator, { orientation: "vertical", className: "mx-0.5 h-6" }), jsxRuntime.jsxs(tooltip.Tooltip, { delayDuration: 300, children: [jsxRuntime.jsx(tooltip.TooltipTrigger, { asChild: true, children: jsxRuntime.jsx(button.Button, { type: "button", variant: "ghost", size: "icon-sm", className: "size-8 rounded-lg text-destructive hover:text-destructive", onClick: () => editor.chain().focus().removeBox().run(), "aria-label": "Remove box", children: jsxRuntime.jsx(trash2.default, { className: "size-4" }) }) }), jsxRuntime.jsx(tooltip.TooltipContent, { children: "Remove box" })] })] }) }));
|
|
114
58
|
}
|
|
115
59
|
|
|
116
60
|
exports.BoxBubbleMenu = BoxBubbleMenu;
|
|
@@ -30,7 +30,6 @@ function ColumnsBubbleMenu({ editor }) {
|
|
|
30
30
|
return (jsxRuntime.jsx(index$2.BubbleMenu, { editor: editor, pluginKey: shared.columnsBubbleMenuPluginKey, shouldShow: ({ state, editor: bubbleEditor }) => {
|
|
31
31
|
const { selection } = state;
|
|
32
32
|
return (bubbleEditor.isActive("column") &&
|
|
33
|
-
!bubbleEditor.isActive("box") &&
|
|
34
33
|
!bubbleEditor.isActive("layout") &&
|
|
35
34
|
selection instanceof index$3.TextSelection &&
|
|
36
35
|
selection.empty);
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
+
var React = require('react');
|
|
5
|
+
var glyphs = require('./glyphs.js');
|
|
6
|
+
var shared = require('./shared.js');
|
|
7
|
+
var popover = require('../../../../popovers/popover/popover.js');
|
|
8
|
+
var separator = require('../../../../utility/separator/separator.js');
|
|
9
|
+
var tooltip = require('../../../../popovers/tooltip/tooltip.js');
|
|
10
|
+
|
|
11
|
+
const JUSTIFY_OPTIONS = [
|
|
12
|
+
{ value: "flex-start", label: "Start", mode: "start" },
|
|
13
|
+
{ value: "center", label: "Center", mode: "center" },
|
|
14
|
+
{ value: "flex-end", label: "End", mode: "end" },
|
|
15
|
+
{ value: "space-between", label: "Space between", mode: "space-between" },
|
|
16
|
+
{ value: "space-around", label: "Space around", mode: "space-around" },
|
|
17
|
+
];
|
|
18
|
+
const ALIGN_OPTIONS = [
|
|
19
|
+
{ value: "flex-start", label: "Start", mode: "start" },
|
|
20
|
+
{ value: "center", label: "Center", mode: "center" },
|
|
21
|
+
{ value: "flex-end", label: "End", mode: "end" },
|
|
22
|
+
{ value: "stretch", label: "Stretch", mode: "stretch" },
|
|
23
|
+
];
|
|
24
|
+
function AlignDropdown({ justifyContent, alignItems, flexDirection = "row", isGrid = false, onChange, }) {
|
|
25
|
+
const [open, setOpen] = React.useState(false);
|
|
26
|
+
const mainAxis = flexDirection === "column" ? "vertical" : "horizontal";
|
|
27
|
+
const crossAxis = flexDirection === "column" ? "horizontal" : "vertical";
|
|
28
|
+
const isActive = Boolean(justifyContent || alignItems);
|
|
29
|
+
return (jsxRuntime.jsxs(popover.Popover, { open: open, onOpenChange: setOpen, children: [jsxRuntime.jsxs(tooltip.Tooltip, { delayDuration: 300, children: [jsxRuntime.jsx(tooltip.TooltipTrigger, { asChild: true, children: jsxRuntime.jsx(popover.PopoverTrigger, { asChild: true, children: jsxRuntime.jsx(shared.BubbleIconTriggerButton, { active: isActive, "aria-label": "Alignment", children: jsxRuntime.jsx(glyphs.AlignmentTriggerGlyph, {}) }) }) }), jsxRuntime.jsx(tooltip.TooltipContent, { children: "Alignment" })] }), jsxRuntime.jsxs(popover.PopoverContent, { className: "w-[292px] space-y-3 p-4", align: "start", children: [!isGrid ? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs("div", { className: "space-y-2", children: [jsxRuntime.jsx("p", { className: "text-xs font-medium text-muted-foreground", children: "Main axis" }), jsxRuntime.jsx("div", { className: "grid grid-cols-5 gap-1.5", children: JUSTIFY_OPTIONS.map(({ value, label, mode }) => (jsxRuntime.jsx(shared.PreviewButton, { selected: justifyContent === value, className: "size-10 p-0", onClick: () => onChange({ justifyContent: value }), "aria-label": `Main axis ${label}`, title: `Main axis ${label}`, children: jsxRuntime.jsx(glyphs.AlignmentPreviewGlyph, { axis: mainAxis, mode: mode }) }, value))) })] }), jsxRuntime.jsx(separator.Separator, {})] })) : null, jsxRuntime.jsxs("div", { className: "space-y-2", children: [jsxRuntime.jsx("p", { className: "text-xs font-medium text-muted-foreground", children: isGrid ? "Item alignment" : "Cross axis" }), jsxRuntime.jsx("div", { className: "grid grid-cols-4 gap-1.5", children: ALIGN_OPTIONS.map(({ value, label, mode }) => (jsxRuntime.jsx(shared.PreviewButton, { selected: alignItems === value, className: "size-10 p-0", onClick: () => onChange({ alignItems: value }), "aria-label": `${isGrid ? "Item" : "Cross axis"} ${label}`, title: `${isGrid ? "Item" : "Cross axis"} ${label}`, children: jsxRuntime.jsx(glyphs.AlignmentPreviewGlyph, { axis: crossAxis, mode: mode }) }, value))) })] })] })] }));
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
exports.AlignDropdown = AlignDropdown;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
+
var utils = require('../../extensions/box/utils.js');
|
|
5
|
+
var colorSwatch = require('../../toolbar/color-swatch.js');
|
|
6
|
+
var colorConstants = require('../../toolbar/color-constants.js');
|
|
7
|
+
var glyphs = require('./glyphs.js');
|
|
8
|
+
var shared = require('./shared.js');
|
|
9
|
+
var stylePopover = require('./style-popover.js');
|
|
10
|
+
var button = require('../../../../buttons/button/button.js');
|
|
11
|
+
var separator = require('../../../../utility/separator/separator.js');
|
|
12
|
+
|
|
13
|
+
function BgShadowMiniPopover({ backgroundColor, boxShadow, mixedFields, onChange }) {
|
|
14
|
+
const activeShadowPreset = (mixedFields === null || mixedFields === void 0 ? void 0 : mixedFields.boxShadow)
|
|
15
|
+
? undefined
|
|
16
|
+
: Object.keys(utils.BOX_SHADOW_PRESETS).find((key) => utils.BOX_SHADOW_PRESETS[key] === boxShadow);
|
|
17
|
+
return (jsxRuntime.jsxs("div", { className: "space-y-3 p-3", children: [jsxRuntime.jsxs("div", { className: "flex items-center justify-between", children: [jsxRuntime.jsx("p", { className: "text-xs font-medium text-muted-foreground", children: "Background" }), jsxRuntime.jsx(button.Button, { type: "button", variant: "ghost", size: "sm", className: "h-6 px-2 text-xs text-muted-foreground", onClick: () => onChange({ backgroundColor: null, boxShadow: null }), children: "Reset" })] }), jsxRuntime.jsx(colorSwatch.ColorGrid, { colors: colorConstants.UNIFIED_BACKGROUND_COLORS, currentColor: (mixedFields === null || mixedFields === void 0 ? void 0 : mixedFields.backgroundColor) ? undefined : (backgroundColor !== null && backgroundColor !== void 0 ? backgroundColor : undefined), onColorSelect: (color) => onChange({ backgroundColor: color }), columns: 5, size: "sm" }), jsxRuntime.jsx(separator.Separator, {}), jsxRuntime.jsxs("div", { className: "space-y-2", children: [jsxRuntime.jsx("p", { className: "text-xs font-medium text-muted-foreground", children: "Shadow" }), jsxRuntime.jsx("div", { className: "grid grid-cols-5 gap-1.5", children: stylePopover.SHADOW_OPTIONS.map(({ key, label }) => (jsxRuntime.jsx(shared.PreviewButton, { selected: activeShadowPreset === key, className: "px-0.5 py-1", onClick: () => onChange({ boxShadow: utils.BOX_SHADOW_PRESETS[key] }), "aria-label": label, title: label, children: jsxRuntime.jsx(glyphs.ShadowPreviewGlyph, { preset: key, className: "h-6 w-6" }) }, key))) })] })] }));
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
exports.BgShadowMiniPopover = BgShadowMiniPopover;
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
+
var React = require('react');
|
|
5
|
+
var utils = require('../../extensions/box/utils.js');
|
|
6
|
+
var colorSwatch = require('../../toolbar/color-swatch.js');
|
|
7
|
+
var colorConstants = require('../../toolbar/color-constants.js');
|
|
8
|
+
var glyphs = require('./glyphs.js');
|
|
9
|
+
var shared = require('./shared.js');
|
|
10
|
+
var stylePopover = require('./style-popover.js');
|
|
11
|
+
var uniformPerSideToggle = require('./uniform-per-side-toggle.js');
|
|
12
|
+
var button = require('../../../../buttons/button/button.js');
|
|
13
|
+
var separator = require('../../../../utility/separator/separator.js');
|
|
14
|
+
var chevronDown = require('../../../../../node_modules/lucide-react/dist/esm/icons/chevron-down.js');
|
|
15
|
+
|
|
16
|
+
function expandBorderRadius(value) {
|
|
17
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
18
|
+
const parts = (value !== null && value !== void 0 ? value : "").trim().split(/\s+/).filter(Boolean);
|
|
19
|
+
if (parts.length <= 1) {
|
|
20
|
+
const uniform = (_a = parts[0]) !== null && _a !== void 0 ? _a : "";
|
|
21
|
+
return { top: uniform, right: uniform, bottom: uniform, left: uniform };
|
|
22
|
+
}
|
|
23
|
+
if (parts.length === 2) {
|
|
24
|
+
return {
|
|
25
|
+
top: (_b = parts[0]) !== null && _b !== void 0 ? _b : "",
|
|
26
|
+
right: (_c = parts[1]) !== null && _c !== void 0 ? _c : "",
|
|
27
|
+
bottom: (_d = parts[0]) !== null && _d !== void 0 ? _d : "",
|
|
28
|
+
left: (_e = parts[1]) !== null && _e !== void 0 ? _e : "",
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
if (parts.length === 3) {
|
|
32
|
+
return {
|
|
33
|
+
top: (_f = parts[0]) !== null && _f !== void 0 ? _f : "",
|
|
34
|
+
right: (_g = parts[1]) !== null && _g !== void 0 ? _g : "",
|
|
35
|
+
bottom: (_h = parts[2]) !== null && _h !== void 0 ? _h : "",
|
|
36
|
+
left: (_j = parts[1]) !== null && _j !== void 0 ? _j : "",
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
return {
|
|
40
|
+
top: (_k = parts[0]) !== null && _k !== void 0 ? _k : "",
|
|
41
|
+
right: (_l = parts[1]) !== null && _l !== void 0 ? _l : "",
|
|
42
|
+
bottom: (_m = parts[2]) !== null && _m !== void 0 ? _m : "",
|
|
43
|
+
left: (_o = parts[3]) !== null && _o !== void 0 ? _o : "",
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
function collapseBorderRadius({ top, right, bottom, left }) {
|
|
47
|
+
const normalized = {
|
|
48
|
+
top: top || "0px",
|
|
49
|
+
right: right || "0px",
|
|
50
|
+
bottom: bottom || "0px",
|
|
51
|
+
left: left || "0px",
|
|
52
|
+
};
|
|
53
|
+
if (normalized.top === normalized.right &&
|
|
54
|
+
normalized.right === normalized.bottom &&
|
|
55
|
+
normalized.bottom === normalized.left) {
|
|
56
|
+
return normalized.top;
|
|
57
|
+
}
|
|
58
|
+
if (normalized.top === normalized.bottom && normalized.right === normalized.left) {
|
|
59
|
+
return `${normalized.top} ${normalized.right}`;
|
|
60
|
+
}
|
|
61
|
+
if (normalized.right === normalized.left) {
|
|
62
|
+
return `${normalized.top} ${normalized.right} ${normalized.bottom}`;
|
|
63
|
+
}
|
|
64
|
+
return `${normalized.top} ${normalized.right} ${normalized.bottom} ${normalized.left}`;
|
|
65
|
+
}
|
|
66
|
+
function BorderMiniPopover({ borderColor, borderWidth, borderStyle, borderRadius, mixedFields, onChange, }) {
|
|
67
|
+
const [showColorGrid, setShowColorGrid] = React.useState(false);
|
|
68
|
+
const [showStyleOptions, setShowStyleOptions] = React.useState(false);
|
|
69
|
+
const [showWidthOptions, setShowWidthOptions] = React.useState(false);
|
|
70
|
+
const [radiusMode, setRadiusMode] = React.useState(() => (borderRadius !== null && borderRadius !== void 0 ? borderRadius : "").trim().split(/\s+/).filter(Boolean).length > 1 ? "per-side" : "uniform");
|
|
71
|
+
React.useEffect(() => {
|
|
72
|
+
if ((borderRadius !== null && borderRadius !== void 0 ? borderRadius : "").trim().split(/\s+/).filter(Boolean).length > 1) {
|
|
73
|
+
setRadiusMode("per-side");
|
|
74
|
+
}
|
|
75
|
+
}, [borderRadius]);
|
|
76
|
+
const currentBorderStyleGlyph = (mixedFields === null || mixedFields === void 0 ? void 0 : mixedFields.borderStyle) || borderStyle === "none" || borderStyle == null
|
|
77
|
+
? "none"
|
|
78
|
+
: borderStyle === "solid" || borderStyle === "dashed" || borderStyle === "dotted"
|
|
79
|
+
? borderStyle
|
|
80
|
+
: "solid";
|
|
81
|
+
const resolvedBorderStyle = borderStyle && borderStyle !== "none" ? borderStyle : "solid";
|
|
82
|
+
const expandedRadius = expandBorderRadius((mixedFields === null || mixedFields === void 0 ? void 0 : mixedFields.borderRadius) ? null : borderRadius);
|
|
83
|
+
const activeRadiusPreset = (mixedFields === null || mixedFields === void 0 ? void 0 : mixedFields.borderRadius)
|
|
84
|
+
? undefined
|
|
85
|
+
: Object.keys(utils.BOX_BORDER_RADIUS_PRESETS).find((key) => utils.BOX_BORDER_RADIUS_PRESETS[key] === borderRadius);
|
|
86
|
+
const uniformRadiusValue = (mixedFields === null || mixedFields === void 0 ? void 0 : mixedFields.borderRadius)
|
|
87
|
+
? ""
|
|
88
|
+
: activeRadiusPreset
|
|
89
|
+
? utils.BOX_BORDER_RADIUS_PRESETS[activeRadiusPreset]
|
|
90
|
+
: expandedRadius.top === expandedRadius.right &&
|
|
91
|
+
expandedRadius.right === expandedRadius.bottom &&
|
|
92
|
+
expandedRadius.bottom === expandedRadius.left
|
|
93
|
+
? expandedRadius.top
|
|
94
|
+
: "";
|
|
95
|
+
return (jsxRuntime.jsxs("div", { className: "space-y-3 p-3", children: [jsxRuntime.jsxs("div", { className: "flex items-center justify-between", children: [jsxRuntime.jsx("p", { className: "text-xs font-medium text-muted-foreground", children: "Border" }), jsxRuntime.jsx(button.Button, { type: "button", variant: "ghost", size: "sm", className: "h-6 px-2 text-xs text-muted-foreground", onClick: () => onChange({
|
|
96
|
+
borderColor: null,
|
|
97
|
+
borderWidth: null,
|
|
98
|
+
borderStyle: null,
|
|
99
|
+
borderRadius: null,
|
|
100
|
+
}), children: "Reset" })] }), jsxRuntime.jsxs("div", { className: "space-y-2", children: [jsxRuntime.jsxs(button.Button, { type: "button", variant: "outline", size: "sm", className: "h-8 w-full justify-between px-2 text-xs", onClick: () => setShowColorGrid((state) => !state), children: [jsxRuntime.jsxs("span", { className: "flex items-center gap-2", children: [jsxRuntime.jsx("span", { className: "size-3 rounded-full border border-border", style: (mixedFields === null || mixedFields === void 0 ? void 0 : mixedFields.borderColor) ? undefined : { backgroundColor: borderColor !== null && borderColor !== void 0 ? borderColor : "transparent" } }), (mixedFields === null || mixedFields === void 0 ? void 0 : mixedFields.borderColor) ? "Mixed color" : borderColor ? "Border color" : "No color"] }), jsxRuntime.jsx(chevronDown.default, { className: "size-3.5" })] }), showColorGrid ? (jsxRuntime.jsx(colorSwatch.ColorGrid, { colors: colorConstants.BORDER_COLORS, currentColor: (mixedFields === null || mixedFields === void 0 ? void 0 : mixedFields.borderColor) ? undefined : (borderColor !== null && borderColor !== void 0 ? borderColor : undefined), onColorSelect: (color) => onChange({
|
|
101
|
+
borderColor: color,
|
|
102
|
+
borderStyle: resolvedBorderStyle,
|
|
103
|
+
borderWidth: borderWidth || "1px",
|
|
104
|
+
}), columns: 5, size: "sm" })) : null, jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-2", children: [jsxRuntime.jsxs("div", { className: "space-y-1.5", children: [jsxRuntime.jsxs(button.Button, { type: "button", variant: "outline", size: "sm", className: "h-8 w-full justify-between px-2 text-xs", onClick: () => {
|
|
105
|
+
setShowStyleOptions((state) => !state);
|
|
106
|
+
setShowWidthOptions(false);
|
|
107
|
+
}, children: [jsxRuntime.jsxs("span", { className: "flex items-center gap-1.5", children: [jsxRuntime.jsx(glyphs.BorderStyleGlyph, { borderStyle: currentBorderStyleGlyph }), (mixedFields === null || mixedFields === void 0 ? void 0 : mixedFields.borderStyle) ? "Mixed" : (borderStyle !== null && borderStyle !== void 0 ? borderStyle : "None")] }), jsxRuntime.jsx(chevronDown.default, { className: "size-3.5" })] }), showStyleOptions ? (jsxRuntime.jsx("div", { className: "grid grid-cols-4 gap-1", children: stylePopover.BORDER_STYLE_OPTIONS.map((styleOption) => (jsxRuntime.jsx(shared.PreviewButton, { selected: !(mixedFields === null || mixedFields === void 0 ? void 0 : mixedFields.borderStyle) &&
|
|
108
|
+
!(mixedFields === null || mixedFields === void 0 ? void 0 : mixedFields.borderWidth) &&
|
|
109
|
+
!(mixedFields === null || mixedFields === void 0 ? void 0 : mixedFields.borderColor) &&
|
|
110
|
+
(styleOption === "none"
|
|
111
|
+
? !borderStyle && !borderWidth && !borderColor
|
|
112
|
+
: borderStyle === styleOption), className: "px-1 py-1.5", onClick: () => onChange({
|
|
113
|
+
borderStyle: styleOption === "none" ? null : styleOption,
|
|
114
|
+
borderWidth: styleOption === "none" ? null : borderWidth || "1px",
|
|
115
|
+
borderColor: styleOption === "none" ? null : borderColor || colorConstants.DEFAULT_BORDER_COLOR,
|
|
116
|
+
}), "aria-label": `Border style ${styleOption}`, title: `Border style ${styleOption}`, children: jsxRuntime.jsx(glyphs.BorderStyleGlyph, { borderStyle: styleOption, borderWidth: borderWidth || "2px" }) }, styleOption))) })) : null] }), jsxRuntime.jsxs("div", { className: "space-y-1.5", children: [jsxRuntime.jsxs(button.Button, { type: "button", variant: "outline", size: "sm", className: "h-8 w-full justify-between px-2 text-xs", onClick: () => {
|
|
117
|
+
setShowWidthOptions((state) => !state);
|
|
118
|
+
setShowStyleOptions(false);
|
|
119
|
+
}, children: [jsxRuntime.jsx("span", { children: (mixedFields === null || mixedFields === void 0 ? void 0 : mixedFields.borderWidth) ? "Mixed" : (borderWidth !== null && borderWidth !== void 0 ? borderWidth : "1px") }), jsxRuntime.jsx(chevronDown.default, { className: "size-3.5" })] }), showWidthOptions ? (jsxRuntime.jsx("div", { className: "grid grid-cols-4 gap-1", children: stylePopover.BORDER_WIDTH_OPTIONS.map((widthOption) => (jsxRuntime.jsxs(shared.PreviewButton, { selected: !(mixedFields === null || mixedFields === void 0 ? void 0 : mixedFields.borderWidth) && borderWidth === widthOption, className: "px-1 py-1.5", onClick: () => onChange({
|
|
120
|
+
borderWidth: widthOption,
|
|
121
|
+
borderStyle: resolvedBorderStyle,
|
|
122
|
+
borderColor: borderColor || colorConstants.DEFAULT_BORDER_COLOR,
|
|
123
|
+
}), "aria-label": `Border width ${widthOption}`, title: `Border width ${widthOption}`, children: [jsxRuntime.jsx(glyphs.BorderStyleGlyph, { borderStyle: "solid", borderWidth: widthOption }), jsxRuntime.jsx("span", { children: widthOption.replace("px", "") })] }, widthOption))) })) : null] })] })] }), jsxRuntime.jsx(separator.Separator, {}), jsxRuntime.jsxs("div", { className: "space-y-2", children: [jsxRuntime.jsx("p", { className: "text-xs font-medium text-muted-foreground", children: "Radius" }), jsxRuntime.jsx(uniformPerSideToggle.UniformPerSideToggle, { mode: radiusMode, onModeChange: setRadiusMode, uniformValue: uniformRadiusValue, perSideValues: expandedRadius, onUniformChange: (value) => onChange({ borderRadius: value || null }), onPerSideChange: (side, value) => onChange({
|
|
124
|
+
borderRadius: collapseBorderRadius(Object.assign(Object.assign({}, expandedRadius), { [side]: value || "0px" })),
|
|
125
|
+
}), presets: stylePopover.RADIUS_OPTIONS.map(({ key, label }) => ({
|
|
126
|
+
value: utils.BOX_BORDER_RADIUS_PRESETS[key],
|
|
127
|
+
label,
|
|
128
|
+
icon: jsxRuntime.jsx(glyphs.RadiusPreviewGlyph, { variant: key }),
|
|
129
|
+
})), placeholder: "Custom radius, e.g. 12px", uniformLabel: "All corners", perSideLabels: {
|
|
130
|
+
top: "Top left",
|
|
131
|
+
right: "Top right",
|
|
132
|
+
bottom: "Bottom right",
|
|
133
|
+
left: "Bottom left",
|
|
134
|
+
}, centerPreview: jsxRuntime.jsx(glyphs.RadiusPreviewGlyph, { variant: activeRadiusPreset !== null && activeRadiusPreset !== void 0 ? activeRadiusPreset : "rounded", className: "h-4 w-4" }) })] })] }));
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
exports.BorderMiniPopover = BorderMiniPopover;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
+
var React = require('react');
|
|
5
|
+
require('../../../../../node_modules/tslib/tslib.es6.js');
|
|
6
|
+
var button = require('../../../../buttons/button/button.js');
|
|
7
|
+
require('../../../../popovers/popover/popover.js');
|
|
8
|
+
var separator = require('../../../../utility/separator/separator.js');
|
|
9
|
+
require('../../../../popovers/tooltip/tooltip.js');
|
|
10
|
+
var chevronDown = require('../../../../../node_modules/lucide-react/dist/esm/icons/chevron-down.js');
|
|
11
|
+
var chevronRight = require('../../../../../node_modules/lucide-react/dist/esm/icons/chevron-right.js');
|
|
12
|
+
|
|
13
|
+
function hasDimensionStyles({ width, height, minWidth, maxWidth, minHeight, maxHeight, }) {
|
|
14
|
+
return Boolean(width || height || minWidth || maxWidth || minHeight || maxHeight);
|
|
15
|
+
}
|
|
16
|
+
function detectUnit(value) {
|
|
17
|
+
return (value === null || value === void 0 ? void 0 : value.endsWith("%")) ? "%" : "px";
|
|
18
|
+
}
|
|
19
|
+
function stripUnit(value) {
|
|
20
|
+
if (!value)
|
|
21
|
+
return "";
|
|
22
|
+
if (value.endsWith("%"))
|
|
23
|
+
return value.slice(0, -1);
|
|
24
|
+
if (value.endsWith("px"))
|
|
25
|
+
return value.slice(0, -2);
|
|
26
|
+
return value;
|
|
27
|
+
}
|
|
28
|
+
function DimRow({ label, value, unit, onUnitChange, onChange }) {
|
|
29
|
+
const numericValue = stripUnit(value);
|
|
30
|
+
const percentValue = unit === "%" && numericValue ? Math.min(100, Math.max(0, Number.parseInt(numericValue, 10))) : 0;
|
|
31
|
+
return (jsxRuntime.jsxs("div", { className: "space-y-2 rounded-lg border border-border/60 bg-muted/20 p-2.5", children: [jsxRuntime.jsxs("div", { className: "flex items-center gap-1.5", children: [jsxRuntime.jsx("span", { className: "w-10 shrink-0 text-xs font-medium text-muted-foreground", children: label }), jsxRuntime.jsx(button.Button, { type: "button", variant: !value ? "secondary" : "outline", size: "sm", className: "h-6 px-1.5 text-xs", onClick: () => onChange(null), children: "Auto" }), jsxRuntime.jsx(button.Button, { type: "button", variant: value === "100%" ? "secondary" : "outline", size: "sm", className: "h-6 px-1.5 text-xs", onClick: () => {
|
|
32
|
+
onUnitChange("%");
|
|
33
|
+
onChange("100%");
|
|
34
|
+
}, children: "Full" }), jsxRuntime.jsxs("div", { className: "ml-auto flex overflow-hidden rounded-md border border-input bg-background", children: [jsxRuntime.jsx("button", { type: "button", className: `px-1.5 py-1 text-xs transition-colors ${unit === "px" ? "bg-secondary font-medium" : "text-muted-foreground hover:text-foreground"}`, onClick: () => onUnitChange("px"), children: "px" }), jsxRuntime.jsx("button", { type: "button", className: `border-l border-input px-1.5 py-1 text-xs transition-colors ${unit === "%" ? "bg-secondary font-medium" : "text-muted-foreground hover:text-foreground"}`, onClick: () => onUnitChange("%"), children: "%" })] })] }), unit === "%" ? (jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [jsxRuntime.jsx("input", { type: "range", min: 0, max: 100, step: 10, value: percentValue, className: "flex-1 accent-primary", onChange: (event) => onChange(`${event.target.value}%`) }), jsxRuntime.jsxs("span", { className: "w-9 text-right text-xs font-mono tabular-nums", children: [percentValue, "%"] })] })) : (jsxRuntime.jsx("input", { type: "text", className: "h-8 w-full rounded-md border border-input bg-background px-2 text-sm focus:outline-none focus:ring-1 focus:ring-ring", placeholder: "e.g. 320", defaultValue: numericValue, onKeyDown: (event) => {
|
|
35
|
+
if (event.key === "Enter") {
|
|
36
|
+
onChange(event.currentTarget.value ? `${event.currentTarget.value}px` : null);
|
|
37
|
+
event.currentTarget.blur();
|
|
38
|
+
}
|
|
39
|
+
}, onBlur: (event) => onChange(event.currentTarget.value ? `${event.currentTarget.value}px` : null) }, `${label}-${numericValue || "empty"}`))] }));
|
|
40
|
+
}
|
|
41
|
+
function DimensionsControls({ width, height, minWidth, maxWidth, minHeight, maxHeight, onChange, }) {
|
|
42
|
+
const [widthUnit, setWidthUnit] = React.useState(() => detectUnit(width));
|
|
43
|
+
const [heightUnit, setHeightUnit] = React.useState(() => detectUnit(height));
|
|
44
|
+
const [showAdvanced, setShowAdvanced] = React.useState(false);
|
|
45
|
+
const advancedFields = [
|
|
46
|
+
{ label: "Min W", key: "minWidth", value: minWidth },
|
|
47
|
+
{ label: "Max W", key: "maxWidth", value: maxWidth },
|
|
48
|
+
{ label: "Min H", key: "minHeight", value: minHeight },
|
|
49
|
+
{ label: "Max H", key: "maxHeight", value: maxHeight },
|
|
50
|
+
];
|
|
51
|
+
return (jsxRuntime.jsxs("div", { className: "space-y-3", children: [jsxRuntime.jsx(DimRow, { label: "Width", value: width, unit: widthUnit, onUnitChange: setWidthUnit, onChange: (value) => onChange({ width: value }) }), jsxRuntime.jsx(DimRow, { label: "Height", value: height, unit: heightUnit, onUnitChange: setHeightUnit, onChange: (value) => onChange({ height: value }) }), jsxRuntime.jsx(separator.Separator, {}), jsxRuntime.jsxs("button", { type: "button", className: "flex w-full items-center gap-1 text-xs font-medium text-muted-foreground transition-colors hover:text-foreground", onClick: () => setShowAdvanced((state) => !state), children: [showAdvanced ? jsxRuntime.jsx(chevronDown.default, { className: "size-3.5" }) : jsxRuntime.jsx(chevronRight.default, { className: "size-3.5" }), "Advanced constraints"] }), showAdvanced ? (jsxRuntime.jsx("div", { className: "grid grid-cols-2 gap-2", children: advancedFields.map(({ label, key, value }) => (jsxRuntime.jsxs("div", { className: "space-y-1", children: [jsxRuntime.jsx("p", { className: "text-xs text-muted-foreground", children: label }), jsxRuntime.jsx("input", { type: "text", className: "h-8 w-full rounded-md border border-input bg-background px-2 text-sm focus:outline-none focus:ring-1 focus:ring-ring", defaultValue: value !== null && value !== void 0 ? value : "", placeholder: "none", onKeyDown: (event) => {
|
|
52
|
+
if (event.key === "Enter") {
|
|
53
|
+
onChange({ [key]: event.currentTarget.value || null });
|
|
54
|
+
event.currentTarget.blur();
|
|
55
|
+
}
|
|
56
|
+
}, onBlur: (event) => onChange({ [key]: event.currentTarget.value || null }) }, `${key}-${value !== null && value !== void 0 ? value : "empty"}`)] }, key))) })) : null] }));
|
|
57
|
+
}
|
|
58
|
+
function WidthMiniPopover({ width, mixed = false, onChange }) {
|
|
59
|
+
const [widthUnit, setWidthUnit] = React.useState(() => detectUnit(width !== null && width !== void 0 ? width : null));
|
|
60
|
+
return (jsxRuntime.jsxs("div", { className: "space-y-3 p-3", children: [jsxRuntime.jsxs("div", { className: "flex items-center justify-between", children: [jsxRuntime.jsx("p", { className: "text-xs font-medium text-muted-foreground", children: "Width" }), jsxRuntime.jsx(button.Button, { type: "button", variant: "ghost", size: "sm", className: "h-6 px-2 text-xs text-muted-foreground", onClick: () => onChange({ width: null }), children: "Reset" })] }), mixed ? jsxRuntime.jsx("p", { className: "text-xs text-muted-foreground", children: "Selected items currently have mixed widths." }) : null, jsxRuntime.jsx(DimRow, { label: "Width", value: mixed ? null : (width !== null && width !== void 0 ? width : null), unit: widthUnit, onUnitChange: setWidthUnit, onChange: (value) => onChange({ width: value }) })] }));
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
exports.DimensionsControls = DimensionsControls;
|
|
64
|
+
exports.WidthMiniPopover = WidthMiniPopover;
|
|
65
|
+
exports.hasDimensionStyles = hasDimensionStyles;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
+
var popover = require('../../../../popovers/popover/popover.js');
|
|
5
|
+
var tooltip = require('../../../../popovers/tooltip/tooltip.js');
|
|
6
|
+
var button = require('../../../../buttons/button/button.js');
|
|
7
|
+
var utils = require('../../../../../lib/utils.js');
|
|
8
|
+
|
|
9
|
+
function EdgeTriggerButton({ active = false, preview, tooltip: tooltip$1, open, onOpenChange, popoverWidth, children, }) {
|
|
10
|
+
return (jsxRuntime.jsxs(popover.Popover, { open: open, onOpenChange: onOpenChange, children: [jsxRuntime.jsxs(tooltip.Tooltip, { delayDuration: 300, children: [jsxRuntime.jsx(tooltip.TooltipTrigger, { asChild: true, children: jsxRuntime.jsx(popover.PopoverTrigger, { asChild: true, children: jsxRuntime.jsx(button.Button, { type: "button", variant: open || active ? "secondary" : "ghost", size: "icon-sm", contentEditable: false, className: utils.cn("size-6 rounded-md p-0", open || active ? "shadow-xs" : ""), "aria-label": tooltip$1, onMouseDown: (event) => {
|
|
11
|
+
event.preventDefault();
|
|
12
|
+
event.stopPropagation();
|
|
13
|
+
}, children: preview }) }) }), jsxRuntime.jsx(tooltip.TooltipContent, { children: tooltip$1 })] }), jsxRuntime.jsx(popover.PopoverContent, { persistent: true, align: "end", side: "bottom", sideOffset: 6, className: utils.cn("p-0", popoverWidth), children: children })] }));
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
exports.EdgeTriggerButton = EdgeTriggerButton;
|