@arkitektbedriftene/fe-lib 0.3.14 → 0.3.17

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.
@@ -1,60 +1,63 @@
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
- import { j as c } from "./jsx-runtime-d0aa4c5b.js";
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-5eab3787.js";
12
- import { LexicalComposer as V } from "@lexical/react/LexicalComposer.js";
13
- import { RichTextPlugin as W } from "@lexical/react/LexicalRichTextPlugin.js";
14
- import J from "@lexical/react/LexicalErrorBoundary.js";
1
+ import { createHeadlessEditor as y } from "@lexical/headless";
2
+ import { $generateHtmlFromNodes as S } from "@lexical/html";
3
+ import { $getRoot as f, ParagraphNode as E, $createParagraphNode as $, $createTextNode as F } from "lexical";
4
+ import { trimTextContentFromAnchor as L } from "@lexical/selection";
5
+ import { AutoLinkNode as w, LinkNode as v } from "@lexical/link";
6
+ import { ListNode as R, ListItemNode as H } from "@lexical/list";
7
+ import { HeadingNode as k, QuoteNode as P } from "@lexical/rich-text";
8
+ import { TableNode as I, TableRowNode as M, TableCellNode as B } from "@lexical/table";
9
+ import { jsx as a, jsxs as h, Fragment as j } from "react/jsx-runtime";
10
+ import { createContext as q, useState as z, useRef as b, useCallback as p, useContext as A, useMemo as D } from "react";
11
+ import { c as d, s as V, B as x, S as W } from "./DropdownMenu-c57acb78.js";
12
+ import { LexicalComposer as J } from "@lexical/react/LexicalComposer.js";
13
+ import { RichTextPlugin as O } from "@lexical/react/LexicalRichTextPlugin.js";
14
+ import Q from "@lexical/react/LexicalErrorBoundary.js";
15
15
  import "react-dom";
16
- const O = ({
16
+ import "@radix-ui/react-toolbar";
17
+ import "./index.esm-d078f232.js";
18
+ import "@radix-ui/react-dropdown-menu";
19
+ const G = ({
17
20
  text: e,
18
21
  maxChars: i,
19
- maxLines: s
22
+ maxLines: n
20
23
  }) => {
21
24
  if (e.length === 0)
22
25
  return 0;
23
- const r = typeof s == "number", o = typeof i == "number";
26
+ const r = typeof n == "number", o = typeof i == "number";
24
27
  if (!r && !o)
25
28
  return e.length;
26
- let n = 0, t = 0;
27
- for (; t < e.length && (!r || n < s) && (!o || t < i); )
29
+ let s = 0, t = 0;
30
+ for (; t < e.length && (!r || s < n) && (!o || t < i); )
28
31
  e[t] === `
29
- ` && n++, t++;
32
+ ` && s++, t++;
30
33
  return e.slice(0, t).length;
31
- }, Q = ({
34
+ }, K = ({
32
35
  editor: e,
33
36
  maxChars: i,
34
- maxLines: s
37
+ maxLines: n
35
38
  }) => {
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) => {
39
+ const r = f(), o = r.getTextContent(), s = G({ text: o, maxChars: i, maxLines: n }), t = o.length - s, m = r.select().anchor;
40
+ L(e, m, t);
41
+ const c = r.getLastChild();
42
+ return c instanceof E && c.getChildrenSize() === 0 && c.remove(), t;
43
+ }, U = (e) => e[0] === "{", Se = (e, i, n) => {
41
44
  let r = 0;
42
- const o = T({
45
+ const o = y({
43
46
  nodes: i,
44
47
  editable: !1
45
48
  });
46
49
  if (e)
47
50
  try {
48
- if (typeof e == "string" && !G(e))
51
+ if (typeof e == "string" && !U(e))
49
52
  o.update(() => {
50
- const t = p(), l = E();
51
- l.append($(e.trim())), t.append(l);
53
+ const t = f(), l = $();
54
+ l.append(F(e.trim())), t.append(l);
52
55
  });
53
56
  else {
54
57
  const t = o.parseEditorState(e, () => {
55
- r = Q({
58
+ r = K({
56
59
  editor: o,
57
- maxLines: s == null ? void 0 : s.maxLines
60
+ maxLines: n == null ? void 0 : n.maxLines
58
61
  });
59
62
  });
60
63
  t.isEmpty() || o.setEditorState(t);
@@ -62,62 +65,62 @@ const O = ({
62
65
  } catch (t) {
63
66
  console.error(t);
64
67
  }
65
- let n = "";
68
+ let s = "";
66
69
  return o.update(() => {
67
- n = y(o);
68
- }), { html: n, trimCount: r };
69
- }, Ce = [
70
+ s = S(o);
71
+ }), { html: s, trimCount: r };
72
+ }, Ee = [
73
+ k,
74
+ P,
70
75
  R,
71
76
  H,
72
77
  w,
73
78
  v,
74
- L,
75
- j,
76
- k,
77
- P,
78
- I
79
- ], K = d({
79
+ I,
80
+ M,
81
+ B
82
+ ], X = d({
80
83
  fontWeight: "bold"
81
- }), U = d({
84
+ }), Y = d({
82
85
  fontStyle: "italic"
83
- }), X = d({
86
+ }), Z = d({
84
87
  textDecoration: "underline"
85
- }), Y = d({
88
+ }), _ = d({
86
89
  listStyleType: "none"
87
- }), Z = d({
90
+ }), ee = d({
88
91
  borderLeft: "4px solid #ccc",
89
92
  color: "#666",
90
93
  fontStyle: "italic",
91
94
  margin: "1.5em 10px",
92
95
  padding: "0.5em 10px"
93
- }), _ = {
94
- quote: Z().className,
96
+ }), te = {
97
+ quote: ee().className,
95
98
  text: {
96
- bold: K().className,
97
- italic: U().className,
98
- underline: X().className
99
+ bold: X().className,
100
+ italic: Y().className,
101
+ underline: Z().className
99
102
  },
100
103
  list: {
101
104
  nested: {
102
- listitem: Y().className
105
+ listitem: _().className
103
106
  }
104
107
  }
105
- }, b = M({ hasFocus: !1, editorRef: { current: null } }), ee = ({ onBlur: e }) => {
106
- const [i, s] = B(!1), r = f(null), o = h(() => {
107
- s(!0), r.current && window.clearTimeout(r.current);
108
- }, []), n = h(() => {
108
+ }, g = q({ hasFocus: !1, editorRef: { current: null } }), oe = ({ onBlur: e }) => {
109
+ const [i, n] = z(!1), r = b(null), o = p(() => {
110
+ n(!0), r.current && window.clearTimeout(r.current);
111
+ }, []), s = p(() => {
109
112
  r.current = window.setTimeout(() => {
110
- s(!1), e == null || e();
113
+ n(!1), e == null || e();
111
114
  }, 0);
112
115
  }, [e]);
113
116
  return {
114
117
  hasFocus: i,
115
118
  attributes: {
116
119
  onFocus: o,
117
- onBlur: n
120
+ onBlur: s
118
121
  }
119
122
  };
120
- }, Ne = () => q(b), te = A("div", {
123
+ }, $e = () => A(g), re = V("div", {
121
124
  border: "1px solid $borderDarker",
122
125
  borderRadius: "$md",
123
126
  position: "relative",
@@ -147,9 +150,9 @@ const O = ({
147
150
  }
148
151
  }
149
152
  ]
150
- }), oe = ({
153
+ }), ne = ({
151
154
  isLoading: e
152
- }) => /* @__PURE__ */ c.jsx(
155
+ }) => /* @__PURE__ */ a(
153
156
  x,
154
157
  {
155
158
  css: {
@@ -159,46 +162,46 @@ const O = ({
159
162
  right: "1rem",
160
163
  display: "flex"
161
164
  },
162
- children: /* @__PURE__ */ c.jsx(D, {})
165
+ children: /* @__PURE__ */ a(W, {})
163
166
  }
164
- ), Te = ({
167
+ ), Fe = ({
165
168
  isLoading: e,
166
169
  children: i,
167
- placeholderText: s,
170
+ placeholderText: n,
168
171
  nodes: r,
169
172
  plugins: o,
170
- toolbar: n,
173
+ toolbar: s,
171
174
  content: t,
172
175
  hideBorder: l,
173
176
  onBlur: m
174
177
  }) => {
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,
178
+ const { hasFocus: c, attributes: C } = oe({ onBlur: m }), u = b(null), N = D(() => ({ hasFocus: c, editorRef: u }), [c]);
179
+ return /* @__PURE__ */ a(g.Provider, { value: N, children: /* @__PURE__ */ h(
180
+ J,
178
181
  {
179
182
  initialConfig: {
180
183
  namespace: "CommentEditor",
181
- onError: (N) => {
182
- console.error(N);
184
+ onError: (T) => {
185
+ console.error(T);
183
186
  },
184
- theme: _,
187
+ theme: te,
185
188
  nodes: r,
186
189
  editable: !0
187
190
  },
188
191
  children: [
189
- /* @__PURE__ */ c.jsxs(
190
- te,
192
+ /* @__PURE__ */ h(
193
+ re,
191
194
  {
192
195
  ref: u,
193
- hasFocus: a,
196
+ hasFocus: c,
194
197
  hideBorder: l,
195
- ...g,
198
+ ...C,
196
199
  children: [
197
- /* @__PURE__ */ c.jsx(
198
- W,
200
+ /* @__PURE__ */ a(
201
+ O,
199
202
  {
200
203
  contentEditable: t,
201
- placeholder: s ? /* @__PURE__ */ c.jsx(
204
+ placeholder: n ? /* @__PURE__ */ a(
202
205
  x,
203
206
  {
204
207
  css: {
@@ -209,29 +212,29 @@ const O = ({
209
212
  pointerEvents: "none",
210
213
  fontSize: "$sm"
211
214
  },
212
- children: s
215
+ children: n
213
216
  }
214
217
  ) : null,
215
- ErrorBoundary: J
218
+ ErrorBoundary: Q
216
219
  }
217
220
  ),
218
221
  o,
219
- /* @__PURE__ */ c.jsx(oe, { isLoading: e }),
220
- n
222
+ /* @__PURE__ */ a(ne, { isLoading: e }),
223
+ s
221
224
  ]
222
225
  }
223
226
  ),
224
- /* @__PURE__ */ c.jsx(c.Fragment, { children: i })
227
+ /* @__PURE__ */ a(j, { children: i })
225
228
  ]
226
229
  }
227
230
  ) });
228
231
  };
229
232
  export {
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
233
+ Fe as RichTextEditor,
234
+ Ee as defaultNodes,
235
+ U as isJSON,
236
+ g as richTextContext,
237
+ Se as stateToHTML,
238
+ oe as useHasFocusWithin,
239
+ $e as useRichTextContext
237
240
  };
@@ -0,0 +1,363 @@
1
+ import * as RDropdown from "@radix-ui/react-dropdown-menu";
2
+ import type { ReactNode } from "react";
3
+ export declare const DropdownMenu: ({ side, align, trigger, children, sideOffset, modal, }: {
4
+ side?: "left" | "right" | "bottom" | "top" | undefined;
5
+ align?: "center" | "start" | "end" | undefined;
6
+ trigger: ReactNode;
7
+ children: ReactNode;
8
+ sideOffset?: number | undefined;
9
+ modal?: boolean | undefined;
10
+ }) => JSX.Element;
11
+ export declare const DropdownMenuSeparator: import("@stitches/react/types/styled-component").StyledComponent<import("react").ForwardRefExoticComponent<RDropdown.DropdownMenuSeparatorProps & import("react").RefAttributes<HTMLDivElement>>, {}, {
12
+ lg: "(min-width: 1200px)";
13
+ print: "print";
14
+ }, import("@stitches/react/types/css-util").CSS<{
15
+ lg: "(min-width: 1200px)";
16
+ print: "print";
17
+ }, {
18
+ colors: {
19
+ gray50: string;
20
+ gray100: string;
21
+ gray200: string;
22
+ gray300: string;
23
+ gray400: string;
24
+ gray500: string;
25
+ gray600: string;
26
+ gray700: string;
27
+ gray800: string;
28
+ gray900: string;
29
+ blue50: string;
30
+ blue100: string;
31
+ blue200: string;
32
+ blue300: string;
33
+ blue400: string;
34
+ blue500: string;
35
+ blue600: string;
36
+ blue700: string;
37
+ blue800: string;
38
+ blue900: string;
39
+ yellow50: string;
40
+ yellow100: string;
41
+ yellow200: string;
42
+ yellow300: string;
43
+ yellow400: string;
44
+ yellow500: string;
45
+ yellow600: string;
46
+ yellow700: string;
47
+ yellow800: string;
48
+ yellow900: string;
49
+ orange500: string;
50
+ red50: string;
51
+ red100: string;
52
+ red200: string;
53
+ red300: string;
54
+ red400: string;
55
+ red500: string;
56
+ red600: string;
57
+ red700: string;
58
+ red800: string;
59
+ red900: string;
60
+ green50: string;
61
+ green100: string;
62
+ green200: string;
63
+ green300: string;
64
+ green400: string;
65
+ green500: string;
66
+ green600: string;
67
+ green700: string;
68
+ green800: string;
69
+ green900: string;
70
+ primaryTextOnLightBg: string;
71
+ primaryBg: string;
72
+ primaryBgHover: string;
73
+ primaryTextOnWhite: string;
74
+ bodyGray: string;
75
+ hoverDarker: string;
76
+ borderDarker: string;
77
+ selectedDarker: string;
78
+ selectedOnBodyGray: string;
79
+ darkGrayBg: string;
80
+ border: string;
81
+ text: string;
82
+ secondaryText: string;
83
+ focusRing: string;
84
+ };
85
+ fontSizes: {
86
+ xs: string;
87
+ sm: string;
88
+ md: string;
89
+ lg: string;
90
+ xl: string;
91
+ "2xl": string;
92
+ "3xl": string;
93
+ };
94
+ fontWeights: {
95
+ normal: string;
96
+ medium: string;
97
+ bold: string;
98
+ };
99
+ space: {
100
+ 1: string;
101
+ 2: string;
102
+ 3: string;
103
+ 4: string;
104
+ 6: string;
105
+ 8: string;
106
+ };
107
+ shadows: {
108
+ xs: string;
109
+ sm: string;
110
+ md: string;
111
+ lg: string;
112
+ overlayCard: string;
113
+ };
114
+ radii: {
115
+ xs: string;
116
+ sm: string;
117
+ md: string;
118
+ mdmd: string;
119
+ full: string;
120
+ };
121
+ zIndices: {
122
+ toast: number;
123
+ overlayCard: number;
124
+ modal: number;
125
+ };
126
+ }, import("@stitches/react/types/config").DefaultThemeMap, {}>>;
127
+ export declare const DropdownMenuItem: import("@stitches/react/types/styled-component").StyledComponent<import("react").ForwardRefExoticComponent<RDropdown.DropdownMenuItemProps & import("react").RefAttributes<HTMLDivElement>>, {}, {
128
+ lg: "(min-width: 1200px)";
129
+ print: "print";
130
+ }, import("@stitches/react/types/css-util").CSS<{
131
+ lg: "(min-width: 1200px)";
132
+ print: "print";
133
+ }, {
134
+ colors: {
135
+ gray50: string;
136
+ gray100: string;
137
+ gray200: string;
138
+ gray300: string;
139
+ gray400: string;
140
+ gray500: string;
141
+ gray600: string;
142
+ gray700: string;
143
+ gray800: string;
144
+ gray900: string;
145
+ blue50: string;
146
+ blue100: string;
147
+ blue200: string;
148
+ blue300: string;
149
+ blue400: string;
150
+ blue500: string;
151
+ blue600: string;
152
+ blue700: string;
153
+ blue800: string;
154
+ blue900: string;
155
+ yellow50: string;
156
+ yellow100: string;
157
+ yellow200: string;
158
+ yellow300: string;
159
+ yellow400: string;
160
+ yellow500: string;
161
+ yellow600: string;
162
+ yellow700: string;
163
+ yellow800: string;
164
+ yellow900: string;
165
+ orange500: string;
166
+ red50: string;
167
+ red100: string;
168
+ red200: string;
169
+ red300: string;
170
+ red400: string;
171
+ red500: string;
172
+ red600: string;
173
+ red700: string;
174
+ red800: string;
175
+ red900: string;
176
+ green50: string;
177
+ green100: string;
178
+ green200: string;
179
+ green300: string;
180
+ green400: string;
181
+ green500: string;
182
+ green600: string;
183
+ green700: string;
184
+ green800: string;
185
+ green900: string;
186
+ primaryTextOnLightBg: string;
187
+ primaryBg: string;
188
+ primaryBgHover: string;
189
+ primaryTextOnWhite: string;
190
+ bodyGray: string;
191
+ hoverDarker: string;
192
+ borderDarker: string;
193
+ selectedDarker: string;
194
+ selectedOnBodyGray: string;
195
+ darkGrayBg: string;
196
+ border: string;
197
+ text: string;
198
+ secondaryText: string;
199
+ focusRing: string;
200
+ };
201
+ fontSizes: {
202
+ xs: string;
203
+ sm: string;
204
+ md: string;
205
+ lg: string;
206
+ xl: string;
207
+ "2xl": string;
208
+ "3xl": string;
209
+ };
210
+ fontWeights: {
211
+ normal: string;
212
+ medium: string;
213
+ bold: string;
214
+ };
215
+ space: {
216
+ 1: string;
217
+ 2: string;
218
+ 3: string;
219
+ 4: string;
220
+ 6: string;
221
+ 8: string;
222
+ };
223
+ shadows: {
224
+ xs: string;
225
+ sm: string;
226
+ md: string;
227
+ lg: string;
228
+ overlayCard: string;
229
+ };
230
+ radii: {
231
+ xs: string;
232
+ sm: string;
233
+ md: string;
234
+ mdmd: string;
235
+ full: string;
236
+ };
237
+ zIndices: {
238
+ toast: number;
239
+ overlayCard: number;
240
+ modal: number;
241
+ };
242
+ }, import("@stitches/react/types/config").DefaultThemeMap, {}>>;
243
+ export declare const DropdownMenuIconItem: import("@stitches/react/types/styled-component").StyledComponent<import("react").ForwardRefExoticComponent<RDropdown.DropdownMenuItemProps & import("react").RefAttributes<HTMLDivElement>>, {}, {
244
+ lg: "(min-width: 1200px)";
245
+ print: "print";
246
+ }, import("@stitches/react/types/css-util").CSS<{
247
+ lg: "(min-width: 1200px)";
248
+ print: "print";
249
+ }, {
250
+ colors: {
251
+ gray50: string;
252
+ gray100: string;
253
+ gray200: string;
254
+ gray300: string;
255
+ gray400: string;
256
+ gray500: string;
257
+ gray600: string;
258
+ gray700: string;
259
+ gray800: string;
260
+ gray900: string;
261
+ blue50: string;
262
+ blue100: string;
263
+ blue200: string;
264
+ blue300: string;
265
+ blue400: string;
266
+ blue500: string;
267
+ blue600: string;
268
+ blue700: string;
269
+ blue800: string;
270
+ blue900: string;
271
+ yellow50: string;
272
+ yellow100: string;
273
+ yellow200: string;
274
+ yellow300: string;
275
+ yellow400: string;
276
+ yellow500: string;
277
+ yellow600: string;
278
+ yellow700: string;
279
+ yellow800: string;
280
+ yellow900: string;
281
+ orange500: string;
282
+ red50: string;
283
+ red100: string;
284
+ red200: string;
285
+ red300: string;
286
+ red400: string;
287
+ red500: string;
288
+ red600: string;
289
+ red700: string;
290
+ red800: string;
291
+ red900: string;
292
+ green50: string;
293
+ green100: string;
294
+ green200: string;
295
+ green300: string;
296
+ green400: string;
297
+ green500: string;
298
+ green600: string;
299
+ green700: string;
300
+ green800: string;
301
+ green900: string;
302
+ primaryTextOnLightBg: string;
303
+ primaryBg: string;
304
+ primaryBgHover: string;
305
+ primaryTextOnWhite: string;
306
+ bodyGray: string;
307
+ hoverDarker: string;
308
+ borderDarker: string;
309
+ selectedDarker: string;
310
+ selectedOnBodyGray: string;
311
+ darkGrayBg: string;
312
+ border: string;
313
+ text: string;
314
+ secondaryText: string;
315
+ focusRing: string;
316
+ };
317
+ fontSizes: {
318
+ xs: string;
319
+ sm: string;
320
+ md: string;
321
+ lg: string;
322
+ xl: string;
323
+ "2xl": string;
324
+ "3xl": string;
325
+ };
326
+ fontWeights: {
327
+ normal: string;
328
+ medium: string;
329
+ bold: string;
330
+ };
331
+ space: {
332
+ 1: string;
333
+ 2: string;
334
+ 3: string;
335
+ 4: string;
336
+ 6: string;
337
+ 8: string;
338
+ };
339
+ shadows: {
340
+ xs: string;
341
+ sm: string;
342
+ md: string;
343
+ lg: string;
344
+ overlayCard: string;
345
+ };
346
+ radii: {
347
+ xs: string;
348
+ sm: string;
349
+ md: string;
350
+ mdmd: string;
351
+ full: string;
352
+ };
353
+ zIndices: {
354
+ toast: number;
355
+ overlayCard: number;
356
+ modal: number;
357
+ };
358
+ }, import("@stitches/react/types/config").DefaultThemeMap, {}>>;
359
+ export declare const DropdownMenuCheckboxItem: ({ value, onChange, children, }: {
360
+ value: boolean;
361
+ onChange: (value: boolean) => void;
362
+ children: ReactNode;
363
+ }) => JSX.Element;