@arkitektbedriftene/fe-lib 0.3.10 → 0.3.12
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/{Popover-2318823a.js → Badge-3f33be41.js} +486 -448
- package/dist/lib/rich-text/Editor.d.ts +3 -1
- package/dist/lib/ui/components/Badge.d.ts +118 -0
- package/dist/lib/ui/components/Popover.d.ts +120 -1
- package/dist/lib/ui/ui.d.ts +1 -0
- package/dist/rich-text.es.js +75 -72
- package/dist/ui.es.js +15 -14
- package/package.json +1 -1
- package/src/lib/rich-text/Editor.tsx +6 -2
- package/src/lib/ui/components/Badge.tsx +42 -0
- package/src/lib/ui/components/Popover.tsx +1 -1
- package/src/lib/ui/ui.ts +1 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type ReactNode, type ReactElement } from "react";
|
|
2
2
|
import { type InitialConfigType } from "@lexical/react/LexicalComposer";
|
|
3
|
-
export declare const RichTextEditor: ({ isLoading, children, placeholderText, nodes, plugins, toolbar, content, }: {
|
|
3
|
+
export declare const RichTextEditor: ({ isLoading, children, placeholderText, nodes, plugins, toolbar, content, hideBorder, onBlur, }: {
|
|
4
4
|
isLoading: boolean;
|
|
5
5
|
children: ReactNode;
|
|
6
6
|
placeholderText?: string | undefined;
|
|
@@ -8,4 +8,6 @@ export declare const RichTextEditor: ({ isLoading, children, placeholderText, no
|
|
|
8
8
|
plugins?: ReactNode;
|
|
9
9
|
toolbar?: ReactNode;
|
|
10
10
|
content: ReactElement;
|
|
11
|
+
hideBorder?: boolean | undefined;
|
|
12
|
+
onBlur?: (() => void) | undefined;
|
|
11
13
|
}) => JSX.Element;
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
export declare const Badge: import("@stitches/react/types/styled-component").StyledComponent<"span", {
|
|
2
|
+
color?: "warning" | "danger" | "success" | "primary" | "secondary" | undefined;
|
|
3
|
+
}, {
|
|
4
|
+
lg: "(min-width: 1200px)";
|
|
5
|
+
print: "print";
|
|
6
|
+
}, import("@stitches/react/types/css-util").CSS<{
|
|
7
|
+
lg: "(min-width: 1200px)";
|
|
8
|
+
print: "print";
|
|
9
|
+
}, {
|
|
10
|
+
colors: {
|
|
11
|
+
gray50: string;
|
|
12
|
+
gray100: string;
|
|
13
|
+
gray200: string;
|
|
14
|
+
gray300: string;
|
|
15
|
+
gray400: string;
|
|
16
|
+
gray500: string;
|
|
17
|
+
gray600: string;
|
|
18
|
+
gray700: string;
|
|
19
|
+
gray800: string;
|
|
20
|
+
gray900: string;
|
|
21
|
+
blue50: string;
|
|
22
|
+
blue100: string;
|
|
23
|
+
blue200: string;
|
|
24
|
+
blue300: string;
|
|
25
|
+
blue400: string;
|
|
26
|
+
blue500: string;
|
|
27
|
+
blue600: string;
|
|
28
|
+
blue700: string;
|
|
29
|
+
blue800: string;
|
|
30
|
+
blue900: string;
|
|
31
|
+
yellow50: string;
|
|
32
|
+
yellow100: string;
|
|
33
|
+
yellow200: string;
|
|
34
|
+
yellow300: string;
|
|
35
|
+
yellow400: string;
|
|
36
|
+
yellow500: string;
|
|
37
|
+
yellow600: string;
|
|
38
|
+
yellow700: string;
|
|
39
|
+
yellow800: string;
|
|
40
|
+
yellow900: string;
|
|
41
|
+
orange500: string;
|
|
42
|
+
red50: string;
|
|
43
|
+
red100: string;
|
|
44
|
+
red200: string;
|
|
45
|
+
red300: string;
|
|
46
|
+
red400: string;
|
|
47
|
+
red500: string;
|
|
48
|
+
red600: string;
|
|
49
|
+
red700: string;
|
|
50
|
+
red800: string;
|
|
51
|
+
red900: string;
|
|
52
|
+
green50: string;
|
|
53
|
+
green100: string;
|
|
54
|
+
green200: string;
|
|
55
|
+
green300: string;
|
|
56
|
+
green400: string;
|
|
57
|
+
green500: string;
|
|
58
|
+
green600: string;
|
|
59
|
+
green700: string;
|
|
60
|
+
green800: string;
|
|
61
|
+
green900: string;
|
|
62
|
+
primaryTextOnLightBg: string;
|
|
63
|
+
primaryBg: string;
|
|
64
|
+
primaryBgHover: string;
|
|
65
|
+
primaryTextOnWhite: string;
|
|
66
|
+
bodyGray: string;
|
|
67
|
+
hoverDarker: string;
|
|
68
|
+
borderDarker: string;
|
|
69
|
+
selectedDarker: string;
|
|
70
|
+
selectedOnBodyGray: string;
|
|
71
|
+
darkGrayBg: string;
|
|
72
|
+
border: string;
|
|
73
|
+
text: string;
|
|
74
|
+
secondaryText: string;
|
|
75
|
+
focusRing: string;
|
|
76
|
+
};
|
|
77
|
+
fontSizes: {
|
|
78
|
+
xs: string;
|
|
79
|
+
sm: string;
|
|
80
|
+
md: string;
|
|
81
|
+
lg: string;
|
|
82
|
+
xl: string;
|
|
83
|
+
"2xl": string;
|
|
84
|
+
"3xl": string;
|
|
85
|
+
};
|
|
86
|
+
fontWeights: {
|
|
87
|
+
normal: string;
|
|
88
|
+
medium: string;
|
|
89
|
+
bold: string;
|
|
90
|
+
};
|
|
91
|
+
space: {
|
|
92
|
+
1: string;
|
|
93
|
+
2: string;
|
|
94
|
+
3: string;
|
|
95
|
+
4: string;
|
|
96
|
+
6: string;
|
|
97
|
+
8: string;
|
|
98
|
+
};
|
|
99
|
+
shadows: {
|
|
100
|
+
xs: string;
|
|
101
|
+
sm: string;
|
|
102
|
+
md: string;
|
|
103
|
+
lg: string;
|
|
104
|
+
overlayCard: string;
|
|
105
|
+
};
|
|
106
|
+
radii: {
|
|
107
|
+
xs: string;
|
|
108
|
+
sm: string;
|
|
109
|
+
md: string;
|
|
110
|
+
mdmd: string;
|
|
111
|
+
full: string;
|
|
112
|
+
};
|
|
113
|
+
zIndices: {
|
|
114
|
+
toast: number;
|
|
115
|
+
overlayCard: number;
|
|
116
|
+
modal: number;
|
|
117
|
+
};
|
|
118
|
+
}, import("@stitches/react/types/config").DefaultThemeMap, {}>>;
|
|
@@ -19,5 +19,124 @@ export declare const PopoverTrigger: ({ children }: {
|
|
|
19
19
|
}) => JSX.Element;
|
|
20
20
|
export declare const PopoverContent: ({ children, overlayCardProps }: {
|
|
21
21
|
children: React.ReactNode;
|
|
22
|
-
overlayCardProps
|
|
22
|
+
overlayCardProps?: (Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
23
|
+
ref?: import("react").RefObject<HTMLDivElement> | ((instance: HTMLDivElement | null) => void) | null | undefined;
|
|
24
|
+
}, "css"> & import("@stitches/react/types/styled-component").TransformProps<{}, {
|
|
25
|
+
lg: "(min-width: 1200px)";
|
|
26
|
+
print: "print";
|
|
27
|
+
}> & {
|
|
28
|
+
css?: import("@stitches/react/types/css-util").CSS<{
|
|
29
|
+
lg: "(min-width: 1200px)";
|
|
30
|
+
print: "print";
|
|
31
|
+
}, {
|
|
32
|
+
colors: {
|
|
33
|
+
gray50: string;
|
|
34
|
+
gray100: string;
|
|
35
|
+
gray200: string;
|
|
36
|
+
gray300: string;
|
|
37
|
+
gray400: string;
|
|
38
|
+
gray500: string;
|
|
39
|
+
gray600: string;
|
|
40
|
+
gray700: string;
|
|
41
|
+
gray800: string;
|
|
42
|
+
gray900: string;
|
|
43
|
+
blue50: string;
|
|
44
|
+
blue100: string;
|
|
45
|
+
blue200: string;
|
|
46
|
+
blue300: string;
|
|
47
|
+
blue400: string;
|
|
48
|
+
blue500: string;
|
|
49
|
+
blue600: string;
|
|
50
|
+
blue700: string;
|
|
51
|
+
blue800: string;
|
|
52
|
+
blue900: string;
|
|
53
|
+
yellow50: string;
|
|
54
|
+
yellow100: string;
|
|
55
|
+
yellow200: string;
|
|
56
|
+
yellow300: string;
|
|
57
|
+
yellow400: string;
|
|
58
|
+
yellow500: string;
|
|
59
|
+
yellow600: string;
|
|
60
|
+
yellow700: string;
|
|
61
|
+
yellow800: string;
|
|
62
|
+
yellow900: string;
|
|
63
|
+
orange500: string;
|
|
64
|
+
red50: string;
|
|
65
|
+
red100: string;
|
|
66
|
+
red200: string;
|
|
67
|
+
red300: string;
|
|
68
|
+
red400: string;
|
|
69
|
+
red500: string;
|
|
70
|
+
red600: string;
|
|
71
|
+
red700: string;
|
|
72
|
+
red800: string;
|
|
73
|
+
red900: string;
|
|
74
|
+
green50: string;
|
|
75
|
+
green100: string;
|
|
76
|
+
green200: string;
|
|
77
|
+
green300: string;
|
|
78
|
+
green400: string;
|
|
79
|
+
green500: string;
|
|
80
|
+
green600: string;
|
|
81
|
+
green700: string;
|
|
82
|
+
green800: string;
|
|
83
|
+
green900: string;
|
|
84
|
+
primaryTextOnLightBg: string;
|
|
85
|
+
primaryBg: string;
|
|
86
|
+
primaryBgHover: string;
|
|
87
|
+
primaryTextOnWhite: string;
|
|
88
|
+
bodyGray: string;
|
|
89
|
+
hoverDarker: string;
|
|
90
|
+
borderDarker: string;
|
|
91
|
+
selectedDarker: string;
|
|
92
|
+
selectedOnBodyGray: string;
|
|
93
|
+
darkGrayBg: string;
|
|
94
|
+
border: string;
|
|
95
|
+
text: string;
|
|
96
|
+
secondaryText: string;
|
|
97
|
+
focusRing: string;
|
|
98
|
+
};
|
|
99
|
+
fontSizes: {
|
|
100
|
+
xs: string;
|
|
101
|
+
sm: string;
|
|
102
|
+
md: string;
|
|
103
|
+
lg: string;
|
|
104
|
+
xl: string;
|
|
105
|
+
"2xl": string;
|
|
106
|
+
"3xl": string;
|
|
107
|
+
};
|
|
108
|
+
fontWeights: {
|
|
109
|
+
normal: string;
|
|
110
|
+
medium: string;
|
|
111
|
+
bold: string;
|
|
112
|
+
};
|
|
113
|
+
space: {
|
|
114
|
+
1: string;
|
|
115
|
+
2: string;
|
|
116
|
+
3: string;
|
|
117
|
+
4: string;
|
|
118
|
+
6: string;
|
|
119
|
+
8: string;
|
|
120
|
+
};
|
|
121
|
+
shadows: {
|
|
122
|
+
xs: string;
|
|
123
|
+
sm: string;
|
|
124
|
+
md: string;
|
|
125
|
+
lg: string;
|
|
126
|
+
overlayCard: string;
|
|
127
|
+
};
|
|
128
|
+
radii: {
|
|
129
|
+
xs: string;
|
|
130
|
+
sm: string;
|
|
131
|
+
md: string;
|
|
132
|
+
mdmd: string;
|
|
133
|
+
full: string;
|
|
134
|
+
};
|
|
135
|
+
zIndices: {
|
|
136
|
+
toast: number;
|
|
137
|
+
overlayCard: number;
|
|
138
|
+
modal: number;
|
|
139
|
+
};
|
|
140
|
+
}, import("@stitches/react/types/config").DefaultThemeMap, {}> | undefined;
|
|
141
|
+
}) | undefined;
|
|
23
142
|
}) => JSX.Element | null;
|
package/dist/lib/ui/ui.d.ts
CHANGED
package/dist/rich-text.es.js
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import { createHeadlessEditor as
|
|
2
|
-
import { $generateHtmlFromNodes as
|
|
3
|
-
import { $getRoot as
|
|
4
|
-
import { trimTextContentFromAnchor as
|
|
5
|
-
import { AutoLinkNode as
|
|
6
|
-
import { ListNode as
|
|
7
|
-
import { HeadingNode as
|
|
8
|
-
import { TableNode as
|
|
1
|
+
import { createHeadlessEditor as T } from "@lexical/headless";
|
|
2
|
+
import { $generateHtmlFromNodes as y } from "@lexical/html";
|
|
3
|
+
import { $getRoot as p, ParagraphNode as S, $createParagraphNode as E, $createTextNode as $ } from "lexical";
|
|
4
|
+
import { trimTextContentFromAnchor as F } from "@lexical/selection";
|
|
5
|
+
import { AutoLinkNode as L, LinkNode as j } from "@lexical/link";
|
|
6
|
+
import { ListNode as w, ListItemNode as v } from "@lexical/list";
|
|
7
|
+
import { HeadingNode as R, QuoteNode as H } from "@lexical/rich-text";
|
|
8
|
+
import { TableNode as k, TableRowNode as P, TableCellNode as I } from "@lexical/table";
|
|
9
9
|
import { j as c } from "./jsx-runtime-d0aa4c5b.js";
|
|
10
|
-
import { createContext as
|
|
11
|
-
import { c as d, s as
|
|
12
|
-
import { LexicalComposer as
|
|
13
|
-
import { RichTextPlugin as
|
|
14
|
-
import
|
|
10
|
+
import { createContext as M, useState as B, useRef as f, useCallback as h, useContext as q, useMemo as z } from "react";
|
|
11
|
+
import { c as d, s as A, B as x, S as D } from "./Badge-3f33be41.js";
|
|
12
|
+
import { LexicalComposer as V } from "@lexical/react/LexicalComposer";
|
|
13
|
+
import { RichTextPlugin as W } from "@lexical/react/LexicalRichTextPlugin";
|
|
14
|
+
import J from "@lexical/react/LexicalErrorBoundary";
|
|
15
15
|
import "react-dom";
|
|
16
|
-
const
|
|
16
|
+
const O = ({
|
|
17
17
|
text: e,
|
|
18
18
|
maxChars: i,
|
|
19
19
|
maxLines: s
|
|
@@ -28,31 +28,31 @@ const W = ({
|
|
|
28
28
|
e[t] === `
|
|
29
29
|
` && n++, t++;
|
|
30
30
|
return e.slice(0, t).length;
|
|
31
|
-
},
|
|
31
|
+
}, Q = ({
|
|
32
32
|
editor: e,
|
|
33
33
|
maxChars: i,
|
|
34
34
|
maxLines: s
|
|
35
35
|
}) => {
|
|
36
|
-
const r =
|
|
37
|
-
|
|
38
|
-
const
|
|
39
|
-
return
|
|
40
|
-
},
|
|
36
|
+
const r = p(), o = r.getTextContent(), n = O({ text: o, maxChars: i, maxLines: s }), t = o.length - n, m = r.select().anchor;
|
|
37
|
+
F(e, m, t);
|
|
38
|
+
const a = r.getLastChild();
|
|
39
|
+
return a instanceof S && a.getChildrenSize() === 0 && a.remove(), t;
|
|
40
|
+
}, G = (e) => e[0] === "{", ge = (e, i, s) => {
|
|
41
41
|
let r = 0;
|
|
42
|
-
const o =
|
|
42
|
+
const o = T({
|
|
43
43
|
nodes: i,
|
|
44
44
|
editable: !1
|
|
45
45
|
});
|
|
46
46
|
if (e)
|
|
47
47
|
try {
|
|
48
|
-
if (typeof e == "string" && !
|
|
48
|
+
if (typeof e == "string" && !G(e))
|
|
49
49
|
o.update(() => {
|
|
50
|
-
const t =
|
|
51
|
-
|
|
50
|
+
const t = p(), l = E();
|
|
51
|
+
l.append($(e.trim())), t.append(l);
|
|
52
52
|
});
|
|
53
53
|
else {
|
|
54
54
|
const t = o.parseEditorState(e, () => {
|
|
55
|
-
r =
|
|
55
|
+
r = Q({
|
|
56
56
|
editor: o,
|
|
57
57
|
maxLines: s == null ? void 0 : s.maxLines
|
|
58
58
|
});
|
|
@@ -64,48 +64,48 @@ const W = ({
|
|
|
64
64
|
}
|
|
65
65
|
let n = "";
|
|
66
66
|
return o.update(() => {
|
|
67
|
-
n =
|
|
67
|
+
n = y(o);
|
|
68
68
|
}), { html: n, trimCount: r };
|
|
69
|
-
},
|
|
69
|
+
}, Ce = [
|
|
70
|
+
R,
|
|
71
|
+
H,
|
|
70
72
|
w,
|
|
71
73
|
v,
|
|
72
74
|
L,
|
|
73
75
|
j,
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
k
|
|
79
|
-
], Q = d({
|
|
76
|
+
k,
|
|
77
|
+
P,
|
|
78
|
+
I
|
|
79
|
+
], K = d({
|
|
80
80
|
fontWeight: "bold"
|
|
81
|
-
}),
|
|
81
|
+
}), U = d({
|
|
82
82
|
fontStyle: "italic"
|
|
83
|
-
}),
|
|
83
|
+
}), X = d({
|
|
84
84
|
textDecoration: "underline"
|
|
85
|
-
}),
|
|
85
|
+
}), Y = d({
|
|
86
86
|
listStyleType: "none"
|
|
87
|
-
}),
|
|
87
|
+
}), Z = d({
|
|
88
88
|
borderLeft: "4px solid #ccc",
|
|
89
89
|
color: "#666",
|
|
90
90
|
fontStyle: "italic",
|
|
91
91
|
margin: "1.5em 10px",
|
|
92
92
|
padding: "0.5em 10px"
|
|
93
|
-
}),
|
|
94
|
-
quote:
|
|
93
|
+
}), _ = {
|
|
94
|
+
quote: Z().className,
|
|
95
95
|
text: {
|
|
96
|
-
bold:
|
|
97
|
-
italic:
|
|
98
|
-
underline:
|
|
96
|
+
bold: K().className,
|
|
97
|
+
italic: U().className,
|
|
98
|
+
underline: X().className
|
|
99
99
|
},
|
|
100
100
|
list: {
|
|
101
101
|
nested: {
|
|
102
|
-
listitem:
|
|
102
|
+
listitem: Y().className
|
|
103
103
|
}
|
|
104
104
|
}
|
|
105
|
-
},
|
|
106
|
-
const [i, s] =
|
|
105
|
+
}, b = M({ hasFocus: !1, editorRef: { current: null } }), ee = ({ onBlur: e }) => {
|
|
106
|
+
const [i, s] = B(!1), r = f(null), o = h(() => {
|
|
107
107
|
s(!0), r.current && window.clearTimeout(r.current);
|
|
108
|
-
}, []), n =
|
|
108
|
+
}, []), n = h(() => {
|
|
109
109
|
r.current = window.setTimeout(() => {
|
|
110
110
|
s(!1), e == null || e();
|
|
111
111
|
}, 0);
|
|
@@ -117,7 +117,7 @@ const W = ({
|
|
|
117
117
|
onBlur: n
|
|
118
118
|
}
|
|
119
119
|
};
|
|
120
|
-
},
|
|
120
|
+
}, Ne = () => q(b), te = A("div", {
|
|
121
121
|
border: "1px solid $borderDarker",
|
|
122
122
|
borderRadius: "$md",
|
|
123
123
|
position: "relative",
|
|
@@ -147,10 +147,10 @@ const W = ({
|
|
|
147
147
|
}
|
|
148
148
|
}
|
|
149
149
|
]
|
|
150
|
-
}),
|
|
150
|
+
}), oe = ({
|
|
151
151
|
isLoading: e
|
|
152
152
|
}) => /* @__PURE__ */ c.jsx(
|
|
153
|
-
|
|
153
|
+
x,
|
|
154
154
|
{
|
|
155
155
|
css: {
|
|
156
156
|
visibility: e ? "visible" : "hidden",
|
|
@@ -159,44 +159,47 @@ const W = ({
|
|
|
159
159
|
right: "1rem",
|
|
160
160
|
display: "flex"
|
|
161
161
|
},
|
|
162
|
-
children: /* @__PURE__ */ c.jsx(
|
|
162
|
+
children: /* @__PURE__ */ c.jsx(D, {})
|
|
163
163
|
}
|
|
164
|
-
),
|
|
164
|
+
), Te = ({
|
|
165
165
|
isLoading: e,
|
|
166
166
|
children: i,
|
|
167
167
|
placeholderText: s,
|
|
168
168
|
nodes: r,
|
|
169
169
|
plugins: o,
|
|
170
170
|
toolbar: n,
|
|
171
|
-
content: t
|
|
171
|
+
content: t,
|
|
172
|
+
hideBorder: l,
|
|
173
|
+
onBlur: m
|
|
172
174
|
}) => {
|
|
173
|
-
const { hasFocus: a, attributes:
|
|
174
|
-
return /* @__PURE__ */ c.jsx(
|
|
175
|
-
|
|
175
|
+
const { hasFocus: a, attributes: g } = ee({ onBlur: m }), u = f(null), C = z(() => ({ hasFocus: a, editorRef: u }), [a]);
|
|
176
|
+
return /* @__PURE__ */ c.jsx(b.Provider, { value: C, children: /* @__PURE__ */ c.jsxs(
|
|
177
|
+
V,
|
|
176
178
|
{
|
|
177
179
|
initialConfig: {
|
|
178
180
|
namespace: "CommentEditor",
|
|
179
|
-
onError: (
|
|
180
|
-
console.error(
|
|
181
|
+
onError: (N) => {
|
|
182
|
+
console.error(N);
|
|
181
183
|
},
|
|
182
|
-
theme:
|
|
184
|
+
theme: _,
|
|
183
185
|
nodes: r,
|
|
184
186
|
editable: !0
|
|
185
187
|
},
|
|
186
188
|
children: [
|
|
187
189
|
/* @__PURE__ */ c.jsxs(
|
|
188
|
-
|
|
190
|
+
te,
|
|
189
191
|
{
|
|
190
|
-
ref:
|
|
192
|
+
ref: u,
|
|
191
193
|
hasFocus: a,
|
|
192
|
-
|
|
194
|
+
hideBorder: l,
|
|
195
|
+
...g,
|
|
193
196
|
children: [
|
|
194
197
|
/* @__PURE__ */ c.jsx(
|
|
195
|
-
|
|
198
|
+
W,
|
|
196
199
|
{
|
|
197
200
|
contentEditable: t,
|
|
198
201
|
placeholder: s ? /* @__PURE__ */ c.jsx(
|
|
199
|
-
|
|
202
|
+
x,
|
|
200
203
|
{
|
|
201
204
|
css: {
|
|
202
205
|
position: "absolute",
|
|
@@ -209,11 +212,11 @@ const W = ({
|
|
|
209
212
|
children: s
|
|
210
213
|
}
|
|
211
214
|
) : null,
|
|
212
|
-
ErrorBoundary:
|
|
215
|
+
ErrorBoundary: J
|
|
213
216
|
}
|
|
214
217
|
),
|
|
215
218
|
o,
|
|
216
|
-
/* @__PURE__ */ c.jsx(
|
|
219
|
+
/* @__PURE__ */ c.jsx(oe, { isLoading: e }),
|
|
217
220
|
n
|
|
218
221
|
]
|
|
219
222
|
}
|
|
@@ -224,11 +227,11 @@ const W = ({
|
|
|
224
227
|
) });
|
|
225
228
|
};
|
|
226
229
|
export {
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
230
|
+
Te as RichTextEditor,
|
|
231
|
+
Ce as defaultNodes,
|
|
232
|
+
G as isJSON,
|
|
233
|
+
b as richTextContext,
|
|
234
|
+
ge as stateToHTML,
|
|
235
|
+
ee as useHasFocusWithin,
|
|
236
|
+
Ne as useRichTextContext
|
|
234
237
|
};
|
package/dist/ui.es.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { P as t, a as n, b as p } from "./
|
|
2
|
-
import { A as v,
|
|
1
|
+
import { P as t, a as n, b as p } from "./Badge-3f33be41.js";
|
|
2
|
+
import { A as v, e as j, B as u, d as C, O as P, S as b, c as h, g as y, k as B, s as O } from "./Badge-3f33be41.js";
|
|
3
3
|
import { j as o } from "./jsx-runtime-d0aa4c5b.js";
|
|
4
4
|
import { useState as i } from "react";
|
|
5
5
|
import "react-dom";
|
|
6
|
-
const
|
|
7
|
-
const [
|
|
6
|
+
const c = ({ children: s, content: e }) => {
|
|
7
|
+
const [r, a] = i(!1);
|
|
8
8
|
return /* @__PURE__ */ o.jsxs(
|
|
9
9
|
t,
|
|
10
10
|
{
|
|
11
|
-
open:
|
|
11
|
+
open: r,
|
|
12
12
|
onOpenChange: a,
|
|
13
13
|
trigger: "hover",
|
|
14
14
|
placement: "top",
|
|
@@ -23,23 +23,24 @@ const g = ({ children: s, content: r }) => {
|
|
|
23
23
|
fontSize: "$sm",
|
|
24
24
|
padding: "$1 $2"
|
|
25
25
|
}
|
|
26
|
-
}, children:
|
|
26
|
+
}, children: e })
|
|
27
27
|
]
|
|
28
28
|
}
|
|
29
29
|
);
|
|
30
30
|
};
|
|
31
31
|
export {
|
|
32
32
|
v as Alert,
|
|
33
|
-
j as
|
|
34
|
-
u as
|
|
35
|
-
C as
|
|
33
|
+
j as Badge,
|
|
34
|
+
u as Box,
|
|
35
|
+
C as Button,
|
|
36
|
+
P as OverlayCard,
|
|
36
37
|
t as Popover,
|
|
37
38
|
p as PopoverContent,
|
|
38
39
|
n as PopoverTrigger,
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
40
|
+
b as Spinner,
|
|
41
|
+
c as Tooltip,
|
|
42
|
+
h as css,
|
|
43
|
+
y as globalCss,
|
|
44
|
+
B as keyframes,
|
|
44
45
|
O as styled
|
|
45
46
|
};
|
package/package.json
CHANGED
|
@@ -2,7 +2,6 @@ import { useRef, type ReactNode, useMemo, type ReactElement } from "react";
|
|
|
2
2
|
import { Box, Spinner, styled } from "../ui/ui";
|
|
3
3
|
import { type InitialConfigType, LexicalComposer } from "@lexical/react/LexicalComposer";
|
|
4
4
|
import { RichTextPlugin } from "@lexical/react/LexicalRichTextPlugin";
|
|
5
|
-
import { ContentEditable } from "@lexical/react/LexicalContentEditable";
|
|
6
5
|
import LexicalErrorBoundary from "@lexical/react/LexicalErrorBoundary";
|
|
7
6
|
import { lexicalTheme } from "./theme";
|
|
8
7
|
import { useHasFocusWithin, richTextContext } from "./editorContext";
|
|
@@ -70,6 +69,8 @@ export const RichTextEditor = ({
|
|
|
70
69
|
plugins,
|
|
71
70
|
toolbar,
|
|
72
71
|
content,
|
|
72
|
+
hideBorder,
|
|
73
|
+
onBlur,
|
|
73
74
|
}: {
|
|
74
75
|
isLoading: boolean;
|
|
75
76
|
children: ReactNode;
|
|
@@ -78,8 +79,10 @@ export const RichTextEditor = ({
|
|
|
78
79
|
plugins?: ReactNode;
|
|
79
80
|
toolbar?: ReactNode;
|
|
80
81
|
content: ReactElement;
|
|
82
|
+
hideBorder?: boolean;
|
|
83
|
+
onBlur?: () => void;
|
|
81
84
|
}) => {
|
|
82
|
-
const { hasFocus, attributes } = useHasFocusWithin({});
|
|
85
|
+
const { hasFocus, attributes } = useHasFocusWithin({ onBlur });
|
|
83
86
|
const editorRef = useRef<HTMLDivElement>(null);
|
|
84
87
|
const contextValue = useMemo(() => ({ hasFocus, editorRef }), [hasFocus]);
|
|
85
88
|
|
|
@@ -99,6 +102,7 @@ export const RichTextEditor = ({
|
|
|
99
102
|
<Container
|
|
100
103
|
ref={editorRef}
|
|
101
104
|
hasFocus={hasFocus}
|
|
105
|
+
hideBorder={hideBorder}
|
|
102
106
|
{...attributes}
|
|
103
107
|
>
|
|
104
108
|
<RichTextPlugin
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { styled } from "../stitches.config";
|
|
2
|
+
|
|
3
|
+
export const Badge = styled("span", {
|
|
4
|
+
flex: "0 0 auto",
|
|
5
|
+
display: "inline-flex",
|
|
6
|
+
padding: "$1 $2",
|
|
7
|
+
fontSize: "$xs",
|
|
8
|
+
fontWeight: "$medium",
|
|
9
|
+
lineHeight: "1",
|
|
10
|
+
whiteSpace: "nowrap",
|
|
11
|
+
borderRadius: "$sm",
|
|
12
|
+
overflow: "hidden",
|
|
13
|
+
|
|
14
|
+
variants: {
|
|
15
|
+
color: {
|
|
16
|
+
success: {
|
|
17
|
+
backgroundColor: "$green200",
|
|
18
|
+
color: "$green800",
|
|
19
|
+
},
|
|
20
|
+
warning: {
|
|
21
|
+
backgroundColor: "$yellow100",
|
|
22
|
+
color: "$yellow700",
|
|
23
|
+
},
|
|
24
|
+
danger: {
|
|
25
|
+
backgroundColor: "$red200",
|
|
26
|
+
color: "$red800",
|
|
27
|
+
},
|
|
28
|
+
primary: {
|
|
29
|
+
backgroundColor: "$blue200",
|
|
30
|
+
color: "$blue800",
|
|
31
|
+
},
|
|
32
|
+
secondary: {
|
|
33
|
+
backgroundColor: "$gray200",
|
|
34
|
+
color: "$gray800",
|
|
35
|
+
},
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
|
|
39
|
+
defaultVariants: {
|
|
40
|
+
color: "primary",
|
|
41
|
+
},
|
|
42
|
+
});
|
|
@@ -134,7 +134,7 @@ export const PopoverTrigger = ({ children }: { children: React.ReactNode }) => {
|
|
|
134
134
|
);
|
|
135
135
|
};
|
|
136
136
|
|
|
137
|
-
export const PopoverContent = ({ children, overlayCardProps }: { children: React.ReactNode, overlayCardProps
|
|
137
|
+
export const PopoverContent = ({ children, overlayCardProps }: { children: React.ReactNode, overlayCardProps?: OverlayCardProps }) => {
|
|
138
138
|
const {
|
|
139
139
|
getFloatingProps,
|
|
140
140
|
isMounted,
|
package/src/lib/ui/ui.ts
CHANGED