@livepreso/react-plugin-textfield 0.5.2 → 0.6.1
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/.rush/temp/shrinkwrap-deps.json +2 -2
- package/CHANGELOG.json +37 -0
- package/CHANGELOG.md +15 -1
- package/components/BorderEdgeToggle.js +72 -0
- package/components/BubbleMenu.js +107 -19
- package/components/BubbleMenu.module.scss +0 -1
- package/components/InsertTokenDialog.js +1 -1
- package/components/InsertTokenDialog.module.scss +1 -1
- package/components/LinkEditDialog.js +2 -2
- package/components/LinkEditDialog.module.scss +1 -1
- package/components/TableDensityPicker.js +48 -0
- package/components/{color-picker/ColorPicker.module.scss → TableDensityPicker.module.scss} +4 -3
- package/components/TableToolbar.js +4 -0
- package/components/VerticalAlignToggle.js +8 -8
- package/components/color-picker/ColorPickerCombo.js +5 -5
- package/components/color-picker/ColorPickerCombo.module.scss +1 -1
- package/components/editor-toolbars/EditorMenu.js +2 -1
- package/components/editor-toolbars/EditorMenu.module.scss +1 -1
- package/components/editor-toolbars/EditorToolbar.js +10 -7
- package/components/editor-toolbars/EditorToolbar.module.scss +11 -68
- package/components/editor-toolbars/SimpleButton.module.scss +1 -1
- package/components/editor-toolbars/SubMenu.js +59 -3
- package/components/table-creator/TableCreatorCombo.js +4 -4
- package/components/table-creator/TableCreatorCombo.module.scss +1 -1
- package/components/tiptap/Table.js +172 -5
- package/components/tiptap/TableCells.js +33 -0
- package/components/tiptap/token/Token.module.scss +1 -1
- package/components/tiptap/token/TokenList.module.scss +1 -1
- package/components/utils.js +0 -49
- package/configs/table-toolbar-configuration.js +87 -8
- package/configs/toolbar-configuration.js +3 -3
- package/constants.js +16 -1
- package/index.js +7 -1
- package/index.module.scss +63 -22
- package/package.json +5 -6
- package/utils/generate-border-icon.js +22 -0
- package/utils/generate-vertical-alignment-icon.js +1 -1
- package/components/Popover.js +0 -43
- package/components/Popover.module.scss +0 -80
- package/components/Select/Select.js +0 -71
- package/components/Select/Select.module.scss +0 -100
- package/components/Select/SelectGroup.js +0 -37
- package/components/Select/index.js +0 -1
- package/components/Tooltip.js +0 -34
- package/components/Tooltip.module.scss +0 -87
- package/components/color-picker/ColorPicker.js +0 -28
- package/components/color-picker/ColorPickerChip.js +0 -22
- package/components/color-picker/ColorPickerChip.module.scss +0 -25
- package/components/editor-toolbars/ToolbarButton.js +0 -26
- package/components/editor-toolbars/ToolbarToggle.js +0 -35
- package/components/editor-toolbars/ToolbarToggleGroup.js +0 -43
- package/components/style.module.scss +0 -63
- package/icons/AddColumnLeft.js +0 -15
- package/icons/AddColumnRight.js +0 -15
- package/icons/AddRowAbove.js +0 -15
- package/icons/AddRowBelow.js +0 -15
- package/icons/AlignHorizontalCenter.js +0 -13
- package/icons/AlignHorizontalLeft.js +0 -13
- package/icons/AlignHorizontalRight.js +0 -13
- package/icons/AlignVerticalBottom.js +0 -13
- package/icons/AlignVerticalCenter.js +0 -13
- package/icons/AlignVerticalTop.js +0 -13
- package/icons/Backspace.js +0 -13
- package/icons/Bold.js +0 -14
- package/icons/BorderAll.js +0 -13
- package/icons/BorderBottom.js +0 -13
- package/icons/BorderClear.js +0 -13
- package/icons/BorderHorizontal.js +0 -13
- package/icons/BorderInner.js +0 -13
- package/icons/BorderLeft.js +0 -13
- package/icons/BorderOuter.js +0 -13
- package/icons/BorderRight.js +0 -13
- package/icons/BorderTop.js +0 -13
- package/icons/BorderVertical.js +0 -13
- package/icons/Close.js +0 -13
- package/icons/Delete.js +0 -13
- package/icons/EvenlyDistribute.js +0 -14
- package/icons/FitWidth.js +0 -13
- package/icons/FitWidthArrows.js +0 -21
- package/icons/FormatAlignCenter.js +0 -13
- package/icons/FormatAlignJustify.js +0 -13
- package/icons/FormatAlignLeft.js +0 -13
- package/icons/FormatAlignRight.js +0 -13
- package/icons/FormatBold.js +0 -13
- package/icons/FormatClear.js +0 -13
- package/icons/FormatColorFill.js +0 -13
- package/icons/FormatColorText.js +0 -13
- package/icons/FormatItalic.js +0 -13
- package/icons/FormatLineSpacing.js +0 -13
- package/icons/FormatListBulleted.js +0 -13
- package/icons/FormatListNumbered.js +0 -13
- package/icons/FormatStrikethrough.js +0 -13
- package/icons/FormatUnderlined.js +0 -13
- package/icons/HelpCenter.js +0 -13
- package/icons/HorizontalRule.js +0 -13
- package/icons/Italic.js +0 -14
- package/icons/ItalicIcon.js +0 -18
- package/icons/Link.js +0 -13
- package/icons/LinkOff.js +0 -13
- package/icons/MergeCells.js +0 -14
- package/icons/MoreVert.js +0 -13
- package/icons/Redo.js +0 -13
- package/icons/RemoveColumnOutline.js +0 -28
- package/icons/RemoveRowOutline.js +0 -25
- package/icons/SplitCells.js +0 -14
- package/icons/SplitScene.js +0 -13
- package/icons/Subscript.js +0 -13
- package/icons/Superscript.js +0 -13
- package/icons/Underline.js +0 -14
- package/icons/Undo.js +0 -13
- package/icons/VerticalAlignBottom.js +0 -13
- package/icons/VerticalAlignCenter.js +0 -13
- package/icons/VerticalAlignTop.js +0 -13
- package/icons/WandStars.js +0 -13
- package/icons/add_column_left.svg +0 -6
- package/icons/add_column_right.svg +0 -6
- package/icons/add_row_above.svg +0 -6
- package/icons/add_row_below.svg +0 -6
- package/icons/align_horizontal_center.svg +0 -1
- package/icons/align_horizontal_left.svg +0 -1
- package/icons/align_horizontal_right.svg +0 -1
- package/icons/align_vertical_bottom.svg +0 -1
- package/icons/align_vertical_center.svg +0 -1
- package/icons/align_vertical_top.svg +0 -1
- package/icons/backspace.svg +0 -1
- package/icons/bold.svg +0 -1
- package/icons/border_all.svg +0 -1
- package/icons/border_bottom.svg +0 -1
- package/icons/border_clear.svg +0 -1
- package/icons/border_horizontal.svg +0 -1
- package/icons/border_inner.svg +0 -1
- package/icons/border_left.svg +0 -1
- package/icons/border_outer.svg +0 -1
- package/icons/border_right.svg +0 -1
- package/icons/border_top.svg +0 -1
- package/icons/border_vertical.svg +0 -1
- package/icons/close.svg +0 -1
- package/icons/delete.svg +0 -1
- package/icons/evenly_distribute.svg +0 -5
- package/icons/fit_width.svg +0 -1
- package/icons/fit_width_arrows.svg +0 -12
- package/icons/format_align_center.svg +0 -1
- package/icons/format_align_justify.svg +0 -1
- package/icons/format_align_left.svg +0 -1
- package/icons/format_align_right.svg +0 -1
- package/icons/format_bold.svg +0 -1
- package/icons/format_clear.svg +0 -1
- package/icons/format_color_fill.svg +0 -1
- package/icons/format_italic.svg +0 -1
- package/icons/format_line_spacing.svg +0 -1
- package/icons/format_list_bulleted.svg +0 -1
- package/icons/format_list_numbered.svg +0 -1
- package/icons/format_strikethrough.svg +0 -1
- package/icons/format_underlined.svg +0 -1
- package/icons/help_center.svg +0 -1
- package/icons/horizontal_rule.svg +0 -1
- package/icons/index.js +0 -199
- package/icons/italic.svg +0 -1
- package/icons/link.svg +0 -1
- package/icons/link_off.svg +0 -1
- package/icons/merge_cells.svg +0 -5
- package/icons/more_vert.svg +0 -1
- package/icons/redo.svg +0 -1
- package/icons/remove_column_outline.svg +0 -20
- package/icons/remove_row_outline.svg +0 -17
- package/icons/split_cells.svg +0 -5
- package/icons/split_scene.svg +0 -1
- package/icons/subscript.svg +0 -1
- package/icons/superscript.svg +0 -1
- package/icons/underline.svg +0 -1
- package/icons/undo.svg +0 -1
- package/icons/vertical_align_bottom.svg +0 -1
- package/icons/vertical_align_center.svg +0 -1
- package/icons/vertical_align_top.svg +0 -1
- package/icons/wand_stars.svg +0 -1
- package/scripts/extract-svg.js +0 -290
- package/variables.scss +0 -6
package/index.js
CHANGED
|
@@ -65,6 +65,10 @@ function EditableTextField({
|
|
|
65
65
|
disableSpellcheck = false,
|
|
66
66
|
mode,
|
|
67
67
|
tokenConfig = {},
|
|
68
|
+
// Scroll overflowing content rather than clipping it.
|
|
69
|
+
// Toolbars anchor and reposition against scrollable limits
|
|
70
|
+
// (ie. toolbar anchors to the top instead of scrolling with the content)
|
|
71
|
+
isScrollable = false,
|
|
68
72
|
// Faint prompt shown while the field is empty and editable. Destructured here
|
|
69
73
|
// so it drives the Placeholder extension rather than landing on the DOM node.
|
|
70
74
|
placeholder,
|
|
@@ -73,7 +77,7 @@ function EditableTextField({
|
|
|
73
77
|
// stopPropagation = false,
|
|
74
78
|
...other
|
|
75
79
|
}) {
|
|
76
|
-
const { isPresomanager } = useModes();
|
|
80
|
+
const { isPresomanager, isScreenshot } = useModes();
|
|
77
81
|
const { isUserTemplateLibrary } = useSlide();
|
|
78
82
|
const [textColor, setTextColor] = useState(null);
|
|
79
83
|
const initialValue = useRef(value);
|
|
@@ -271,6 +275,8 @@ function EditableTextField({
|
|
|
271
275
|
// The 'interactive' class disables the LivePreso custom context,
|
|
272
276
|
// this is additional to preventing slide navigation swiping etc.
|
|
273
277
|
...(isEditable ? [style.editable, "interactive"] : []),
|
|
278
|
+
// Screenshots should clip instead of scroll.
|
|
279
|
+
...(isScrollable && !isScreenshot ? [style.scrollable] : []),
|
|
274
280
|
].filter(Boolean);
|
|
275
281
|
|
|
276
282
|
const toolbarOptions = {
|
package/index.module.scss
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
@import "
|
|
1
|
+
@import "@livepreso/react-plugin-ui/styles/tokens.module.scss";
|
|
2
2
|
|
|
3
3
|
:global(.sp-presenter-overlay) {
|
|
4
4
|
* {
|
|
@@ -7,30 +7,11 @@
|
|
|
7
7
|
|
|
8
8
|
overflow: hidden;
|
|
9
9
|
|
|
10
|
-
--sp-toolbar-color-white: #ffffff;
|
|
11
|
-
--sp-toolbar-bg-color: var(--sp-toolbar-color-white);
|
|
12
|
-
--sp-toolbar-color: #{$toolbar-color};
|
|
13
|
-
--sp-toolbar-modal-bg-color: rgba(255, 255, 255, 0.75);
|
|
14
|
-
--sp-toolbar-separator-color: rgba(0, 0, 0, 0.12);
|
|
15
|
-
--sp-toolbar-highlight-color: rgba(0, 0, 0, 0.38);
|
|
16
|
-
--sp-toolbar-interactive-color: #{$interactive-color};
|
|
17
|
-
--sp-toolbar-focus-color: #006ce7;
|
|
18
|
-
--sp-toolbar-active-color: #{$active-color};
|
|
19
|
-
--sp-toolbar-hover-color: #cce2fa;
|
|
20
|
-
--sp-toolbar-select-trigger: #f7f7f7;
|
|
21
|
-
// Buttons
|
|
22
|
-
--sp-toolbar-button: #{$button-color};
|
|
23
|
-
--sp-toolbar-button-hover: #{$button-hover-color};
|
|
24
|
-
--sp-toolbar-button-primary: var(--sp-toolbar-focus-color);
|
|
25
|
-
--sp-toolbar-button-primary-hover: #0060ce;
|
|
26
|
-
// tokens (for the dialog)
|
|
27
|
-
--sp-token-background-color: #{$active-color};
|
|
28
|
-
--sp-token-color: #{$toolbar-color};
|
|
29
|
-
|
|
30
10
|
a,
|
|
31
11
|
button,
|
|
32
12
|
fieldset,
|
|
33
|
-
input
|
|
13
|
+
input,
|
|
14
|
+
textarea {
|
|
34
15
|
all: unset;
|
|
35
16
|
}
|
|
36
17
|
|
|
@@ -41,16 +22,45 @@
|
|
|
41
22
|
right: 0;
|
|
42
23
|
bottom: 0;
|
|
43
24
|
}
|
|
25
|
+
|
|
26
|
+
.border-icon-container {
|
|
27
|
+
position: relative;
|
|
28
|
+
width: 100%;
|
|
29
|
+
height: 100%;
|
|
30
|
+
|
|
31
|
+
.border-icon {
|
|
32
|
+
position: absolute;
|
|
33
|
+
inset: 0;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
44
36
|
}
|
|
45
37
|
|
|
38
|
+
:global(.sp-presenter-overlay) .text-field,
|
|
46
39
|
.text-field {
|
|
47
40
|
overflow: hidden;
|
|
48
41
|
|
|
49
42
|
table {
|
|
50
43
|
border-collapse: collapse;
|
|
51
44
|
}
|
|
45
|
+
|
|
46
|
+
// Applied by the `isScrollable` prop.
|
|
47
|
+
&.scrollable {
|
|
48
|
+
overflow-y: auto;
|
|
49
|
+
|
|
50
|
+
// .editable pins content to the field's height; scrolling needs growth.
|
|
51
|
+
> div {
|
|
52
|
+
height: auto;
|
|
53
|
+
min-height: 100%;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
:global(.tiptap) {
|
|
57
|
+
height: auto;
|
|
58
|
+
min-height: 100%;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
52
61
|
}
|
|
53
62
|
|
|
63
|
+
:global(.sp-presenter-overlay) .editable,
|
|
54
64
|
.editable {
|
|
55
65
|
outline: 1px solid $interactive-color;
|
|
56
66
|
|
|
@@ -104,6 +114,37 @@
|
|
|
104
114
|
}
|
|
105
115
|
}
|
|
106
116
|
|
|
117
|
+
// Default padding per table density - overridable by a deck's own CSS.
|
|
118
|
+
table.tiptap-table-density-spacious {
|
|
119
|
+
th,
|
|
120
|
+
td {
|
|
121
|
+
padding: 16px 20px;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
table.tiptap-table-density-normal {
|
|
126
|
+
th,
|
|
127
|
+
td {
|
|
128
|
+
padding: 8px 12px;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
table.tiptap-table-density-dense {
|
|
133
|
+
th,
|
|
134
|
+
td {
|
|
135
|
+
padding: 4px 8px;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
// !FEATURE CURRENTLY NOT IN USE!
|
|
140
|
+
// This style partners with fullWidthToggle from table-toolbar-configuration.js
|
|
141
|
+
// `!important` needed to beat the inline width/min-width the resizable
|
|
142
|
+
// table's own colgroup logic (updateColumns) reasserts on every update.
|
|
143
|
+
table.tiptap-table-full-width {
|
|
144
|
+
width: 100% !important;
|
|
145
|
+
min-width: 100% !important;
|
|
146
|
+
}
|
|
147
|
+
|
|
107
148
|
// Loz: I think I broke this...
|
|
108
149
|
.column-resize-handle {
|
|
109
150
|
background-color: $interactive-color;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@livepreso/react-plugin-textfield",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.1",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"publishConfig": {
|
|
@@ -16,13 +16,11 @@
|
|
|
16
16
|
"react-dom": "~19.2.0",
|
|
17
17
|
"@babel/parser": "^7.26.10",
|
|
18
18
|
"@babel/traverse": "^7.26.10",
|
|
19
|
-
"@svgr/core": "^8.1.0",
|
|
20
|
-
"@svgr/plugin-jsx": "^8.1.0",
|
|
21
19
|
"@livepreso/eslint-config": "1.0.0"
|
|
22
20
|
},
|
|
23
21
|
"peerDependencies": {
|
|
24
|
-
"react": ">= 18.0.0 <= 19",
|
|
25
|
-
"react-dom": ">=
|
|
22
|
+
"react": ">= 18.0.0 <= 19.x",
|
|
23
|
+
"react-dom": ">= 18.0.0 <= 19.x"
|
|
26
24
|
},
|
|
27
25
|
"dependencies": {
|
|
28
26
|
"@floating-ui/react-dom": "~2.1.6",
|
|
@@ -58,7 +56,8 @@
|
|
|
58
56
|
"@tiptap/extension-mention": "~3.20.0",
|
|
59
57
|
"@tiptap/suggestion": "~3.20.0",
|
|
60
58
|
"fuse.js": "~7.1.0",
|
|
61
|
-
"@livepreso/content-react": "2.3.
|
|
59
|
+
"@livepreso/content-react": "2.3.1",
|
|
60
|
+
"@livepreso/react-plugin-ui": "1.1.0"
|
|
62
61
|
},
|
|
63
62
|
"scripts": {
|
|
64
63
|
"build": ""
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import icons from "@livepreso/react-plugin-ui/icons";
|
|
3
|
+
import { getCellBorderSides } from "../components/tiptap/Table";
|
|
4
|
+
import { BORDER_SIDES } from "../constants";
|
|
5
|
+
import style from "../index.module.scss";
|
|
6
|
+
|
|
7
|
+
export function generateBorderIcon(editor) {
|
|
8
|
+
const sides = getCellBorderSides(editor);
|
|
9
|
+
|
|
10
|
+
if (sides.length === BORDER_SIDES.length) return <icons.BorderOuter />;
|
|
11
|
+
if (sides.length === 0) return <icons.BorderClear />;
|
|
12
|
+
|
|
13
|
+
return (
|
|
14
|
+
<div className={style.borderIconContainer}>
|
|
15
|
+
{sides.map((side) => {
|
|
16
|
+
const Component =
|
|
17
|
+
icons[`Border${side.charAt(0).toUpperCase()}${side.slice(1)}`];
|
|
18
|
+
return <Component key={side} className={style.borderIcon} />;
|
|
19
|
+
})}
|
|
20
|
+
</div>
|
|
21
|
+
);
|
|
22
|
+
}
|
package/components/Popover.js
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
|
|
3
|
-
import style from "./Popover.module.scss";
|
|
4
|
-
import { Popover as PopoverBase } from "radix-ui";
|
|
5
|
-
|
|
6
|
-
export function Popover({
|
|
7
|
-
tooltip,
|
|
8
|
-
colors = [],
|
|
9
|
-
active,
|
|
10
|
-
onChange,
|
|
11
|
-
// Use this when the popover appears within a dropdown menu (or similar)
|
|
12
|
-
// to prevent it closing when the mouse moved outside of the trigger.
|
|
13
|
-
preventInteractOutside = false,
|
|
14
|
-
trigger = "open",
|
|
15
|
-
triggerClassName,
|
|
16
|
-
children,
|
|
17
|
-
}) {
|
|
18
|
-
const div = window.Bridge.UI.overlay;
|
|
19
|
-
|
|
20
|
-
return (
|
|
21
|
-
<PopoverBase.Root>
|
|
22
|
-
<PopoverBase.Trigger className={triggerClassName} asChild>
|
|
23
|
-
{trigger}
|
|
24
|
-
</PopoverBase.Trigger>
|
|
25
|
-
|
|
26
|
-
<PopoverBase.Portal container={div}>
|
|
27
|
-
<PopoverBase.Content
|
|
28
|
-
collisionBoundary={div}
|
|
29
|
-
onOpenAutoFocus={(e) => e.preventDefault()} // Prevents focus moving to the content on open
|
|
30
|
-
onCloseAutoFocus={(e) => e.preventDefault()} // Prevents focus moving to the trigger on close
|
|
31
|
-
onInteractOutside={(e) =>
|
|
32
|
-
preventInteractOutside && e.preventDefault()
|
|
33
|
-
} // Prevents closing when inside DropdownMenu
|
|
34
|
-
className={style.content}
|
|
35
|
-
sideOffset={5}
|
|
36
|
-
>
|
|
37
|
-
<div className={style.contentContainer}>{children}</div>
|
|
38
|
-
<PopoverBase.Arrow className={style.arrow} />
|
|
39
|
-
</PopoverBase.Content>
|
|
40
|
-
</PopoverBase.Portal>
|
|
41
|
-
</PopoverBase.Root>
|
|
42
|
-
);
|
|
43
|
-
}
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
@import "./style.module.scss";
|
|
2
|
-
|
|
3
|
-
:global(.sp-presenter-overlay) {
|
|
4
|
-
.content {
|
|
5
|
-
@extend %root;
|
|
6
|
-
padding: 2px;
|
|
7
|
-
animation-duration: 400ms;
|
|
8
|
-
animation-timing-function: cubic-bezier(0.16, 1, 0.3, 1);
|
|
9
|
-
will-change: transform, opacity;
|
|
10
|
-
|
|
11
|
-
&-container {
|
|
12
|
-
overflow: hidden;
|
|
13
|
-
border-radius: 5px;
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
.content:focus {
|
|
18
|
-
@extend %focus;
|
|
19
|
-
}
|
|
20
|
-
.content[data-state="open"][data-side="top"] {
|
|
21
|
-
animation-name: slideDownAndFade;
|
|
22
|
-
}
|
|
23
|
-
.content[data-state="open"][data-side="right"] {
|
|
24
|
-
animation-name: slideLeftAndFade;
|
|
25
|
-
}
|
|
26
|
-
.content[data-state="open"][data-side="bottom"] {
|
|
27
|
-
animation-name: slideUpAndFade;
|
|
28
|
-
}
|
|
29
|
-
.content[data-state="open"][data-side="left"] {
|
|
30
|
-
animation-name: slideRightAndFade;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
.arrow {
|
|
34
|
-
fill: white;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
@keyframes slideUpAndFade {
|
|
39
|
-
from {
|
|
40
|
-
opacity: 0;
|
|
41
|
-
transform: translateY(2px);
|
|
42
|
-
}
|
|
43
|
-
to {
|
|
44
|
-
opacity: 1;
|
|
45
|
-
transform: translateY(0);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
@keyframes slideRightAndFade {
|
|
50
|
-
from {
|
|
51
|
-
opacity: 0;
|
|
52
|
-
transform: translateX(-2px);
|
|
53
|
-
}
|
|
54
|
-
to {
|
|
55
|
-
opacity: 1;
|
|
56
|
-
transform: translateX(0);
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
@keyframes slideDownAndFade {
|
|
61
|
-
from {
|
|
62
|
-
opacity: 0;
|
|
63
|
-
transform: translateY(-2px);
|
|
64
|
-
}
|
|
65
|
-
to {
|
|
66
|
-
opacity: 1;
|
|
67
|
-
transform: translateY(0);
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
@keyframes slideLeftAndFade {
|
|
72
|
-
from {
|
|
73
|
-
opacity: 0;
|
|
74
|
-
transform: translateX(2px);
|
|
75
|
-
}
|
|
76
|
-
to {
|
|
77
|
-
opacity: 1;
|
|
78
|
-
transform: translateX(0);
|
|
79
|
-
}
|
|
80
|
-
}
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import React, { Fragment } from "react";
|
|
2
|
-
|
|
3
|
-
import classNames from "classnames";
|
|
4
|
-
import { Select as SelectBase } from "radix-ui";
|
|
5
|
-
|
|
6
|
-
import { ChevronDownIcon, ChevronUpIcon } from "@radix-ui/react-icons";
|
|
7
|
-
|
|
8
|
-
import style from "./Select.module.scss";
|
|
9
|
-
import { SelectGroup } from "./SelectGroup";
|
|
10
|
-
|
|
11
|
-
export function Select({
|
|
12
|
-
className,
|
|
13
|
-
options = [],
|
|
14
|
-
placeholder = "Select an option",
|
|
15
|
-
label = "Options",
|
|
16
|
-
onValueChange,
|
|
17
|
-
value,
|
|
18
|
-
}) {
|
|
19
|
-
const div = window.Bridge.UI.overlay;
|
|
20
|
-
|
|
21
|
-
const isGroupedOptions = Array.isArray(options[0]);
|
|
22
|
-
|
|
23
|
-
return (
|
|
24
|
-
<SelectBase.Root
|
|
25
|
-
value={value}
|
|
26
|
-
onValueChange={(value) => onValueChange(value)}
|
|
27
|
-
>
|
|
28
|
-
<SelectBase.Trigger
|
|
29
|
-
className={classNames(style.trigger, className)}
|
|
30
|
-
aria-label={label}
|
|
31
|
-
>
|
|
32
|
-
<SelectBase.Value placeholder={placeholder} />
|
|
33
|
-
<SelectBase.Icon className={style.icon}>
|
|
34
|
-
<ChevronDownIcon />
|
|
35
|
-
</SelectBase.Icon>
|
|
36
|
-
</SelectBase.Trigger>
|
|
37
|
-
|
|
38
|
-
<SelectBase.Portal container={div}>
|
|
39
|
-
<SelectBase.Content
|
|
40
|
-
collisionBoundary={div}
|
|
41
|
-
className={style.content}
|
|
42
|
-
onCloseAutoFocus={(e) => e.preventDefault()}
|
|
43
|
-
position="popper"
|
|
44
|
-
>
|
|
45
|
-
<SelectBase.ScrollUpButton className={style.scrollButton}>
|
|
46
|
-
<ChevronUpIcon />
|
|
47
|
-
</SelectBase.ScrollUpButton>
|
|
48
|
-
<SelectBase.Viewport className={style.viewport}>
|
|
49
|
-
{isGroupedOptions ? (
|
|
50
|
-
options.map((group, idx) => {
|
|
51
|
-
return (
|
|
52
|
-
<Fragment key={group.map(({ value }) => value).join("_")}>
|
|
53
|
-
{idx > 0 && (
|
|
54
|
-
<SelectBase.Separator className={style.separator} />
|
|
55
|
-
)}
|
|
56
|
-
<SelectGroup options={group} />
|
|
57
|
-
</Fragment>
|
|
58
|
-
);
|
|
59
|
-
})
|
|
60
|
-
) : (
|
|
61
|
-
<SelectGroup options={options} />
|
|
62
|
-
)}
|
|
63
|
-
</SelectBase.Viewport>
|
|
64
|
-
<SelectBase.ScrollDownButton className={style.scrollButton}>
|
|
65
|
-
<ChevronDownIcon />
|
|
66
|
-
</SelectBase.ScrollDownButton>
|
|
67
|
-
</SelectBase.Content>
|
|
68
|
-
</SelectBase.Portal>
|
|
69
|
-
</SelectBase.Root>
|
|
70
|
-
);
|
|
71
|
-
}
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
@import "../style.module.scss";
|
|
2
|
-
|
|
3
|
-
:global(.sp-presenter-overlay) {
|
|
4
|
-
button.trigger {
|
|
5
|
-
@extend %item;
|
|
6
|
-
display: inline-flex;
|
|
7
|
-
align-items: center;
|
|
8
|
-
justify-content: space-between;
|
|
9
|
-
gap: 5px;
|
|
10
|
-
border-radius: 4px;
|
|
11
|
-
padding: 0 15px;
|
|
12
|
-
height: $item-height;
|
|
13
|
-
min-width: 120px;
|
|
14
|
-
background-color: var(--sp-toolbar-select-trigger);
|
|
15
|
-
|
|
16
|
-
&:hover {
|
|
17
|
-
@extend %hover;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
&:focus {
|
|
21
|
-
@extend %focus;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
&[data-placeholder] {
|
|
25
|
-
color: var(--sp-toolbar-highlight-color);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
.icon {
|
|
29
|
-
color: var(--sp-toolbar-color);
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
.content {
|
|
34
|
-
@extend %root;
|
|
35
|
-
position: relative;
|
|
36
|
-
z-index: 3100;
|
|
37
|
-
max-height: var(--radix-select-content-available-height);
|
|
38
|
-
|
|
39
|
-
.group {
|
|
40
|
-
&:first-child {
|
|
41
|
-
.item:first-child {
|
|
42
|
-
padding-top: 8px;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
&:last-child {
|
|
47
|
-
.item:last-child {
|
|
48
|
-
padding-bottom: 8px;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
.item {
|
|
54
|
-
@extend %item-vertical;
|
|
55
|
-
position: relative;
|
|
56
|
-
display: flex;
|
|
57
|
-
align-items: center;
|
|
58
|
-
padding-right: 35px;
|
|
59
|
-
padding-left: 25px;
|
|
60
|
-
user-select: none;
|
|
61
|
-
|
|
62
|
-
&:hover,
|
|
63
|
-
&[data-highlighted] {
|
|
64
|
-
@extend %hover;
|
|
65
|
-
outline: 0;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
&:focus {
|
|
69
|
-
@extend %focus;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
&[data-disabled] {
|
|
73
|
-
@extend %disabled;
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
.item-indicator {
|
|
78
|
-
position: absolute;
|
|
79
|
-
left: 0;
|
|
80
|
-
width: 25px;
|
|
81
|
-
display: inline-flex;
|
|
82
|
-
align-items: center;
|
|
83
|
-
justify-content: center;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
.scroll-button {
|
|
87
|
-
display: flex;
|
|
88
|
-
align-items: center;
|
|
89
|
-
justify-content: center;
|
|
90
|
-
height: 25px;
|
|
91
|
-
background-color: white;
|
|
92
|
-
color: var(--sp-toolbar-color);
|
|
93
|
-
cursor: default;
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
.separator {
|
|
98
|
-
@extend %separator-horizontal;
|
|
99
|
-
}
|
|
100
|
-
}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
|
|
3
|
-
import classNames from "classnames";
|
|
4
|
-
import { Select as SelectBase } from "radix-ui";
|
|
5
|
-
|
|
6
|
-
import { CheckIcon } from "@radix-ui/react-icons";
|
|
7
|
-
|
|
8
|
-
import style from "./Select.module.scss";
|
|
9
|
-
|
|
10
|
-
export function SelectGroup({ options = [] }) {
|
|
11
|
-
return (
|
|
12
|
-
<SelectBase.Group className={style.group}>
|
|
13
|
-
{options.map(({ label, value }, index) => (
|
|
14
|
-
<SelectItem key={`option-${index}`} value={value}>
|
|
15
|
-
{label}
|
|
16
|
-
</SelectItem>
|
|
17
|
-
))}
|
|
18
|
-
</SelectBase.Group>
|
|
19
|
-
);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
const SelectItem = React.forwardRef(
|
|
23
|
-
({ children, className, ...props }, forwardedRef) => {
|
|
24
|
-
return (
|
|
25
|
-
<SelectBase.Item
|
|
26
|
-
className={classNames(style.item, className)}
|
|
27
|
-
{...props}
|
|
28
|
-
ref={forwardedRef}
|
|
29
|
-
>
|
|
30
|
-
<SelectBase.ItemText>{children}</SelectBase.ItemText>
|
|
31
|
-
<SelectBase.ItemIndicator className={style.itemIndicator}>
|
|
32
|
-
<CheckIcon />
|
|
33
|
-
</SelectBase.ItemIndicator>
|
|
34
|
-
</SelectBase.Item>
|
|
35
|
-
);
|
|
36
|
-
},
|
|
37
|
-
);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { Select } from "./Select";
|
package/components/Tooltip.js
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
// your-tooltip.jsx
|
|
2
|
-
import React from "react";
|
|
3
|
-
import { Tooltip as TooltipPrimitive } from "radix-ui";
|
|
4
|
-
import style from "./Tooltip.module.scss";
|
|
5
|
-
|
|
6
|
-
export function Tooltip({
|
|
7
|
-
children,
|
|
8
|
-
content,
|
|
9
|
-
open,
|
|
10
|
-
defaultOpen,
|
|
11
|
-
onOpenChange,
|
|
12
|
-
...props
|
|
13
|
-
}) {
|
|
14
|
-
return (
|
|
15
|
-
<TooltipPrimitive.Root
|
|
16
|
-
open={open}
|
|
17
|
-
defaultOpen={defaultOpen}
|
|
18
|
-
onOpenChange={onOpenChange}
|
|
19
|
-
>
|
|
20
|
-
<TooltipPrimitive.Trigger asChild>
|
|
21
|
-
<span>{children}</span>
|
|
22
|
-
</TooltipPrimitive.Trigger>
|
|
23
|
-
<TooltipPrimitive.Content
|
|
24
|
-
side="top"
|
|
25
|
-
align="center"
|
|
26
|
-
{...props}
|
|
27
|
-
className={style.content}
|
|
28
|
-
>
|
|
29
|
-
{content}
|
|
30
|
-
<TooltipPrimitive.Arrow width={11} height={5} className={style.arrow} />
|
|
31
|
-
</TooltipPrimitive.Content>
|
|
32
|
-
</TooltipPrimitive.Root>
|
|
33
|
-
);
|
|
34
|
-
}
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
@import "./style.module.scss";
|
|
2
|
-
|
|
3
|
-
$background_colour: var(--sp-toolbar-color);
|
|
4
|
-
|
|
5
|
-
:global(.sp-presenter-overlay) {
|
|
6
|
-
.content {
|
|
7
|
-
position: relative;
|
|
8
|
-
top: -12px;
|
|
9
|
-
border-radius: 4px;
|
|
10
|
-
padding: 6px 10px;
|
|
11
|
-
font-size: 12px;
|
|
12
|
-
line-height: 1;
|
|
13
|
-
color: var(--sp-toolbar-color-white);
|
|
14
|
-
background-color: $background_colour;
|
|
15
|
-
box-shadow:
|
|
16
|
-
hsl(206 22% 7% / 35%) 0px 10px 38px -10px,
|
|
17
|
-
hsl(206 22% 7% / 20%) 0px 10px 20px -15px;
|
|
18
|
-
user-select: none;
|
|
19
|
-
animation-duration: 400ms;
|
|
20
|
-
animation-timing-function: cubic-bezier(0.16, 1, 0.3, 1);
|
|
21
|
-
will-change: transform, opacity;
|
|
22
|
-
|
|
23
|
-
&[data-state="delayed-open"] {
|
|
24
|
-
animation-name: slideUpAndFade;
|
|
25
|
-
}
|
|
26
|
-
&[data-state="delayed-open"][data-side="top"] {
|
|
27
|
-
animation-name: slideUpAndFade;
|
|
28
|
-
}
|
|
29
|
-
&[data-state="delayed-open"][data-side="right"] {
|
|
30
|
-
animation-name: slideRightAndFade;
|
|
31
|
-
}
|
|
32
|
-
&[data-state="delayed-open"][data-side="bottom"] {
|
|
33
|
-
animation-name: slideDownAndFade;
|
|
34
|
-
}
|
|
35
|
-
&[data-state="delayed-open"][data-side="left"] {
|
|
36
|
-
animation-name: slideLeftAndFade;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
.arrow {
|
|
41
|
-
fill: $background_colour;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
@keyframes slideUpAndFade {
|
|
46
|
-
from {
|
|
47
|
-
opacity: 0;
|
|
48
|
-
transform: translateY(2px);
|
|
49
|
-
}
|
|
50
|
-
to {
|
|
51
|
-
opacity: 1;
|
|
52
|
-
transform: translateY(0);
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
@keyframes slideRightAndFade {
|
|
57
|
-
from {
|
|
58
|
-
opacity: 0;
|
|
59
|
-
transform: translateX(-2px);
|
|
60
|
-
}
|
|
61
|
-
to {
|
|
62
|
-
opacity: 1;
|
|
63
|
-
transform: translateX(0);
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
@keyframes slideDownAndFade {
|
|
68
|
-
from {
|
|
69
|
-
opacity: 0;
|
|
70
|
-
transform: translateY(-2px);
|
|
71
|
-
}
|
|
72
|
-
to {
|
|
73
|
-
opacity: 1;
|
|
74
|
-
transform: translateY(0);
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
@keyframes slideLeftAndFade {
|
|
79
|
-
from {
|
|
80
|
-
opacity: 0;
|
|
81
|
-
transform: translateX(2px);
|
|
82
|
-
}
|
|
83
|
-
to {
|
|
84
|
-
opacity: 1;
|
|
85
|
-
transform: translateX(0);
|
|
86
|
-
}
|
|
87
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
|
|
3
|
-
import style from "./ColorPicker.module.scss";
|
|
4
|
-
import { ColorPickerChip } from "./ColorPickerChip";
|
|
5
|
-
|
|
6
|
-
export function ColorPicker({
|
|
7
|
-
className,
|
|
8
|
-
colors = [],
|
|
9
|
-
onChange = () => {},
|
|
10
|
-
value,
|
|
11
|
-
}) {
|
|
12
|
-
function handleChange(color) {
|
|
13
|
-
onChange(color);
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
return (
|
|
17
|
-
<div className={style.options}>
|
|
18
|
-
{colors.map((color, idx) => (
|
|
19
|
-
<ColorPickerChip
|
|
20
|
-
key={`${color}_${idx}`}
|
|
21
|
-
selected={value === color}
|
|
22
|
-
color={color}
|
|
23
|
-
onClick={() => handleChange(color)}
|
|
24
|
-
/>
|
|
25
|
-
))}
|
|
26
|
-
</div>
|
|
27
|
-
);
|
|
28
|
-
}
|