@trycourier/react-designer 0.0.0-canary-20251205150115 → 0.0.0-canary-20251207101348
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/index.js +54 -54
- package/dist/cjs/index.js.map +4 -4
- package/dist/cjs/styles.css +69 -9
- package/dist/components/ui/VariableEditor/VariableInput.d.ts +11 -0
- package/dist/components/ui/VariableEditor/VariableTextarea.d.ts +9 -0
- package/dist/components/ui/VariableEditor/index.d.ts +6 -0
- package/dist/components/ui/VariableEditor/shared.d.ts +51 -0
- package/dist/esm/index.js +53 -53
- package/dist/esm/index.js.map +4 -4
- package/dist/esm/styles.css +69 -9
- package/dist/styles.css +69 -9
- package/package.json +1 -1
package/dist/cjs/styles.css
CHANGED
|
@@ -1015,6 +1015,10 @@ body {
|
|
|
1015
1015
|
.courier-m-6 {
|
|
1016
1016
|
margin: 1.5rem;
|
|
1017
1017
|
}
|
|
1018
|
+
.\!courier-my-1 {
|
|
1019
|
+
margin-top: 0.25rem !important;
|
|
1020
|
+
margin-bottom: 0.25rem !important;
|
|
1021
|
+
}
|
|
1018
1022
|
.-courier-mx-4 {
|
|
1019
1023
|
margin-left: -1rem;
|
|
1020
1024
|
margin-right: -1rem;
|
|
@@ -1228,6 +1232,9 @@ body {
|
|
|
1228
1232
|
.courier-h-\[1px\] {
|
|
1229
1233
|
height: 1px;
|
|
1230
1234
|
}
|
|
1235
|
+
.courier-h-\[25px\] {
|
|
1236
|
+
height: 25px;
|
|
1237
|
+
}
|
|
1231
1238
|
.courier-h-\[300px\] {
|
|
1232
1239
|
height: 300px;
|
|
1233
1240
|
}
|
|
@@ -1270,6 +1277,9 @@ body {
|
|
|
1270
1277
|
.courier-min-h-\[120px\] {
|
|
1271
1278
|
min-height: 120px;
|
|
1272
1279
|
}
|
|
1280
|
+
.courier-min-h-\[20px\] {
|
|
1281
|
+
min-height: 20px;
|
|
1282
|
+
}
|
|
1273
1283
|
.courier-min-h-\[44px\] {
|
|
1274
1284
|
min-height: 44px;
|
|
1275
1285
|
}
|
|
@@ -1676,9 +1686,6 @@ body {
|
|
|
1676
1686
|
.courier-border-dotted {
|
|
1677
1687
|
border-style: dotted;
|
|
1678
1688
|
}
|
|
1679
|
-
.\!courier-border-none {
|
|
1680
|
-
border-style: none !important;
|
|
1681
|
-
}
|
|
1682
1689
|
.courier-border-none {
|
|
1683
1690
|
border-style: none;
|
|
1684
1691
|
}
|
|
@@ -2051,6 +2058,9 @@ body {
|
|
|
2051
2058
|
.courier-pb-0 {
|
|
2052
2059
|
padding-bottom: 0px;
|
|
2053
2060
|
}
|
|
2061
|
+
.courier-pb-1 {
|
|
2062
|
+
padding-bottom: 0.25rem;
|
|
2063
|
+
}
|
|
2054
2064
|
.courier-pb-2 {
|
|
2055
2065
|
padding-bottom: 0.5rem;
|
|
2056
2066
|
}
|
|
@@ -2063,6 +2073,9 @@ body {
|
|
|
2063
2073
|
.courier-pb-6 {
|
|
2064
2074
|
padding-bottom: 1.5rem;
|
|
2065
2075
|
}
|
|
2076
|
+
.courier-pb-px {
|
|
2077
|
+
padding-bottom: 1px;
|
|
2078
|
+
}
|
|
2066
2079
|
.courier-pl-0 {
|
|
2067
2080
|
padding-left: 0px;
|
|
2068
2081
|
}
|
|
@@ -2184,6 +2197,9 @@ body {
|
|
|
2184
2197
|
.courier-leading-none {
|
|
2185
2198
|
line-height: 1;
|
|
2186
2199
|
}
|
|
2200
|
+
.courier-leading-normal {
|
|
2201
|
+
line-height: 1.5;
|
|
2202
|
+
}
|
|
2187
2203
|
.courier-leading-relaxed {
|
|
2188
2204
|
line-height: 1.625;
|
|
2189
2205
|
}
|
|
@@ -4332,6 +4348,24 @@ body {
|
|
|
4332
4348
|
font-size: 0.8rem;
|
|
4333
4349
|
padding: 0;
|
|
4334
4350
|
}
|
|
4351
|
+
/* Variable Textarea placeholder styles */
|
|
4352
|
+
.variable-textarea-placeholder .ProseMirror p.is-editor-empty:first-child::before,
|
|
4353
|
+
.variable-textarea-placeholder .ProseMirror p.is-empty:first-child::before {
|
|
4354
|
+
content: attr(data-placeholder);
|
|
4355
|
+
float: left;
|
|
4356
|
+
color: var(--muted-foreground);
|
|
4357
|
+
pointer-events: none;
|
|
4358
|
+
height: 0;
|
|
4359
|
+
}
|
|
4360
|
+
/* Variable Input placeholder styles */
|
|
4361
|
+
.variable-input-placeholder .ProseMirror p.is-editor-empty:first-child::before,
|
|
4362
|
+
.variable-input-placeholder .ProseMirror p.is-empty:first-child::before {
|
|
4363
|
+
content: attr(data-placeholder);
|
|
4364
|
+
float: left;
|
|
4365
|
+
color: var(--muted-foreground);
|
|
4366
|
+
pointer-events: none;
|
|
4367
|
+
height: 0;
|
|
4368
|
+
}
|
|
4335
4369
|
.file\:courier-border-0::file-selector-button {
|
|
4336
4370
|
border-width: 0px;
|
|
4337
4371
|
}
|
|
@@ -4366,12 +4400,6 @@ body {
|
|
|
4366
4400
|
.last\:courier-mt-0:last-child {
|
|
4367
4401
|
margin-top: 0px;
|
|
4368
4402
|
}
|
|
4369
|
-
.read-only\:courier-cursor-default:read-only {
|
|
4370
|
-
cursor: default;
|
|
4371
|
-
}
|
|
4372
|
-
.read-only\:courier-border-transparent:read-only {
|
|
4373
|
-
border-color: transparent;
|
|
4374
|
-
}
|
|
4375
4403
|
.hover\:courier-border-accent-foreground:hover {
|
|
4376
4404
|
border-color: var(--accent-foreground);
|
|
4377
4405
|
}
|
|
@@ -4811,6 +4839,38 @@ body {
|
|
|
4811
4839
|
.\[\&\>svg\]\:courier-shrink-0>svg {
|
|
4812
4840
|
flex-shrink: 0;
|
|
4813
4841
|
}
|
|
4842
|
+
.\[\&_\.ProseMirror\]\:courier-flex .ProseMirror {
|
|
4843
|
+
display: flex;
|
|
4844
|
+
}
|
|
4845
|
+
.\[\&_\.ProseMirror\]\:courier-h-\[25px\] .ProseMirror {
|
|
4846
|
+
height: 25px;
|
|
4847
|
+
}
|
|
4848
|
+
.\[\&_\.ProseMirror\]\:courier-min-h-\[20px\] .ProseMirror {
|
|
4849
|
+
min-height: 20px;
|
|
4850
|
+
}
|
|
4851
|
+
.\[\&_\.ProseMirror\]\:courier-flex-1 .ProseMirror {
|
|
4852
|
+
flex: 1 1 0%;
|
|
4853
|
+
}
|
|
4854
|
+
.\[\&_\.ProseMirror\]\:courier-items-end .ProseMirror {
|
|
4855
|
+
align-items: flex-end;
|
|
4856
|
+
}
|
|
4857
|
+
.\[\&_\.ProseMirror\]\:courier-border-none .ProseMirror {
|
|
4858
|
+
border-style: none;
|
|
4859
|
+
}
|
|
4860
|
+
.\[\&_\.ProseMirror\]\:courier-p-0 .ProseMirror {
|
|
4861
|
+
padding: 0px;
|
|
4862
|
+
}
|
|
4863
|
+
.\[\&_\.ProseMirror\]\:courier-outline-none .ProseMirror {
|
|
4864
|
+
outline: 2px solid transparent;
|
|
4865
|
+
outline-offset: 2px;
|
|
4866
|
+
}
|
|
4867
|
+
.\[\&_\.tiptap\]\:courier-border-none .tiptap {
|
|
4868
|
+
border-style: none;
|
|
4869
|
+
}
|
|
4870
|
+
.\[\&_\.tiptap\]\:courier-outline-none .tiptap {
|
|
4871
|
+
outline: 2px solid transparent;
|
|
4872
|
+
outline-offset: 2px;
|
|
4873
|
+
}
|
|
4814
4874
|
.\[\&_svg\]\:courier-pointer-events-none svg {
|
|
4815
4875
|
pointer-events: none;
|
|
4816
4876
|
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { type VariableEditorBaseProps } from "./shared";
|
|
3
|
+
export interface VariableInputProps extends VariableEditorBaseProps {
|
|
4
|
+
/** Whether the input is read-only */
|
|
5
|
+
readOnly?: boolean;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* A single-line input that renders {{variable}} patterns as styled chips.
|
|
9
|
+
* Uses a minimal TipTap editor under the hood for rich content rendering.
|
|
10
|
+
*/
|
|
11
|
+
export declare const VariableInput: React.ForwardRefExoticComponent<VariableInputProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { type VariableEditorBaseProps } from "./shared";
|
|
3
|
+
export interface VariableTextareaProps extends VariableEditorBaseProps {
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* A textarea-like input that renders {{variable}} patterns as styled chips.
|
|
7
|
+
* Uses a minimal TipTap editor under the hood for rich content rendering.
|
|
8
|
+
*/
|
|
9
|
+
export declare const VariableTextarea: React.ForwardRefExoticComponent<VariableTextareaProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { VariableTextarea } from "./VariableTextarea";
|
|
2
|
+
export type { VariableTextareaProps } from "./VariableTextarea";
|
|
3
|
+
export { VariableInput } from "./VariableInput";
|
|
4
|
+
export type { VariableInputProps } from "./VariableInput";
|
|
5
|
+
export { parseStringToContent, contentToString, SimpleVariableNode, SimpleVariableView, VariableChipIcon, } from "./shared";
|
|
6
|
+
export type { VariableEditorBaseProps } from "./shared";
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { Node } from "@tiptap/core";
|
|
2
|
+
import type { Content, JSONContent } from "@tiptap/core";
|
|
3
|
+
import type { NodeViewProps } from "@tiptap/react";
|
|
4
|
+
import * as React from "react";
|
|
5
|
+
/**
|
|
6
|
+
* Simple variable icon for the chip
|
|
7
|
+
*/
|
|
8
|
+
export declare const VariableChipIcon: React.FC<{
|
|
9
|
+
color?: string;
|
|
10
|
+
}>;
|
|
11
|
+
/**
|
|
12
|
+
* Standalone variable view component
|
|
13
|
+
* Does not depend on external jotai stores
|
|
14
|
+
*/
|
|
15
|
+
export declare const SimpleVariableView: React.FC<NodeViewProps>;
|
|
16
|
+
/**
|
|
17
|
+
* Custom VariableNode that uses SimpleVariableView
|
|
18
|
+
* Used in VariableInput and VariableTextarea components
|
|
19
|
+
*/
|
|
20
|
+
export declare const SimpleVariableNode: Node<any, any>;
|
|
21
|
+
/**
|
|
22
|
+
* Parses a string with {{variable}} syntax into TipTap JSON content
|
|
23
|
+
*/
|
|
24
|
+
export declare function parseStringToContent(text: string): Content;
|
|
25
|
+
/**
|
|
26
|
+
* Converts TipTap JSON content back to string with {{variable}} syntax
|
|
27
|
+
*/
|
|
28
|
+
export declare function contentToString(doc: JSONContent): string;
|
|
29
|
+
/**
|
|
30
|
+
* Base props shared between VariableInput and VariableTextarea
|
|
31
|
+
*/
|
|
32
|
+
export interface VariableEditorBaseProps {
|
|
33
|
+
/** The current value with {{variable}} syntax */
|
|
34
|
+
value?: string;
|
|
35
|
+
/** Called when the value changes */
|
|
36
|
+
onChange?: (value: string) => void;
|
|
37
|
+
/** List of available variable names for autocomplete */
|
|
38
|
+
variables?: string[];
|
|
39
|
+
/** Placeholder text */
|
|
40
|
+
placeholder?: string;
|
|
41
|
+
/** Additional CSS classes */
|
|
42
|
+
className?: string;
|
|
43
|
+
/** Whether the input is disabled */
|
|
44
|
+
disabled?: boolean;
|
|
45
|
+
/** Whether to disable variable autocomplete suggestions */
|
|
46
|
+
disableVariableAutocomplete?: boolean;
|
|
47
|
+
/** Called when the input gains focus */
|
|
48
|
+
onFocus?: () => void;
|
|
49
|
+
/** Called when the input loses focus */
|
|
50
|
+
onBlur?: () => void;
|
|
51
|
+
}
|