@crystallize/design-system 1.24.43 → 1.24.45
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/CHANGELOG.md +12 -0
- package/dist/{chunk-ZT2DX3UW.mjs → chunk-ASHS3SWM.mjs} +299 -153
- package/dist/index.d.ts +4 -0
- package/dist/index.js +839 -649
- package/dist/index.mjs +2 -2
- package/dist/{rich-text-editor-FTDWUJL3.mjs → rich-text-editor-LL7UCSDS.mjs} +22 -10
- package/package.json +1 -1
- package/src/iconography/index.ts +8 -0
- package/src/iconography/transition-in-disabled.tsx +22 -0
- package/src/iconography/transition-in.tsx +30 -0
- package/src/iconography/transition-out-disabled.tsx +24 -0
- package/src/iconography/transition-out.tsx +30 -0
- package/src/rich-text-editor/plugins/CodeActionMenuPlugin/components/PrettierButton/index.tsx +28 -18
package/dist/index.mjs
CHANGED
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
showError,
|
|
18
18
|
showInfo,
|
|
19
19
|
showWarning
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-ASHS3SWM.mjs";
|
|
21
21
|
import "./chunk-NIH5ZMPE.mjs";
|
|
22
22
|
|
|
23
23
|
// src/card/card.tsx
|
|
@@ -488,7 +488,7 @@ function Tag({
|
|
|
488
488
|
// src/rich-text-editor/index.tsx
|
|
489
489
|
import { lazy, Suspense } from "react";
|
|
490
490
|
import { jsx as jsx15 } from "react/jsx-runtime";
|
|
491
|
-
var LazyRichTextEditor = lazy(() => import("./rich-text-editor-
|
|
491
|
+
var LazyRichTextEditor = lazy(() => import("./rich-text-editor-LL7UCSDS.mjs"));
|
|
492
492
|
var RichTextEditor = (props) => {
|
|
493
493
|
return /* @__PURE__ */ jsx15(Suspense, {
|
|
494
494
|
fallback: null,
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
Icon,
|
|
7
7
|
IconButton,
|
|
8
8
|
InputWithLabel
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-ASHS3SWM.mjs";
|
|
10
10
|
import "./chunk-NIH5ZMPE.mjs";
|
|
11
11
|
|
|
12
12
|
// src/rich-text-editor/rich-text-editor.tsx
|
|
@@ -675,11 +675,12 @@ var PRETTIER_PARSER_MODULES = {
|
|
|
675
675
|
};
|
|
676
676
|
async function loadPrettierParserByLang(lang) {
|
|
677
677
|
const dynamicImport = PRETTIER_PARSER_MODULES[lang];
|
|
678
|
-
|
|
678
|
+
const parser = await dynamicImport();
|
|
679
|
+
return parser?.default || parser;
|
|
679
680
|
}
|
|
680
681
|
async function loadPrettierFormat() {
|
|
681
|
-
const
|
|
682
|
-
return format;
|
|
682
|
+
const prettier = await import("./standalone-AR2ENVE7.mjs");
|
|
683
|
+
return prettier?.default?.format || prettier?.format;
|
|
683
684
|
}
|
|
684
685
|
var PRETTIER_OPTIONS_BY_LANG = {
|
|
685
686
|
css: {
|
|
@@ -712,6 +713,19 @@ function PrettierButton({ lang, editor, getCodeDOMNode }) {
|
|
|
712
713
|
const tr = useTr();
|
|
713
714
|
async function handleClick() {
|
|
714
715
|
const codeDOMNode = getCodeDOMNode();
|
|
716
|
+
if (!codeDOMNode) {
|
|
717
|
+
return;
|
|
718
|
+
}
|
|
719
|
+
let content = "";
|
|
720
|
+
editor.update(() => {
|
|
721
|
+
const codeNode = $getNearestNodeFromDOMNode2(codeDOMNode);
|
|
722
|
+
if ($isCodeNode3(codeNode)) {
|
|
723
|
+
content = codeNode.getTextContent();
|
|
724
|
+
}
|
|
725
|
+
});
|
|
726
|
+
if (content === "") {
|
|
727
|
+
return;
|
|
728
|
+
}
|
|
715
729
|
try {
|
|
716
730
|
const format = await loadPrettierFormat();
|
|
717
731
|
const options = getPrettierOptions(lang);
|
|
@@ -719,16 +733,14 @@ function PrettierButton({ lang, editor, getCodeDOMNode }) {
|
|
|
719
733
|
if (!codeDOMNode) {
|
|
720
734
|
return;
|
|
721
735
|
}
|
|
736
|
+
const parsed = await format(content, options);
|
|
737
|
+
const formattedCode = parsed.replace(/[\r\n]+$/, "");
|
|
722
738
|
editor.update(() => {
|
|
723
739
|
const codeNode = $getNearestNodeFromDOMNode2(codeDOMNode);
|
|
724
740
|
if ($isCodeNode3(codeNode)) {
|
|
725
|
-
|
|
726
|
-
let parsed = "";
|
|
727
|
-
parsed = format(content, options);
|
|
728
|
-
parsed = parsed.replace(/[\r\n]+$/, "");
|
|
729
|
-
if (parsed !== "") {
|
|
741
|
+
if (formattedCode !== "") {
|
|
730
742
|
const selection = codeNode.select(0);
|
|
731
|
-
selection.insertText(
|
|
743
|
+
selection.insertText(formattedCode);
|
|
732
744
|
setSyntaxError("");
|
|
733
745
|
setTipsVisible(false);
|
|
734
746
|
}
|
package/package.json
CHANGED
package/src/iconography/index.ts
CHANGED
|
@@ -116,6 +116,10 @@ import { Target } from './target';
|
|
|
116
116
|
import { Topics } from './topics';
|
|
117
117
|
import { TopicsBranch } from './topics-branch';
|
|
118
118
|
import { TopicsLeaf } from './topics-leaf';
|
|
119
|
+
import { TransitionIn } from './transition-in';
|
|
120
|
+
import { TransitionInDisabled } from './transition-in-disabled';
|
|
121
|
+
import { TransitionOut } from './transition-out';
|
|
122
|
+
import { TransitionOutDisabled } from './transition-out-disabled';
|
|
119
123
|
import { Unpublish } from './unpublish';
|
|
120
124
|
import { Usage } from './usage';
|
|
121
125
|
import { UsageMeter } from './usage-meter';
|
|
@@ -257,6 +261,10 @@ export const Icon = {
|
|
|
257
261
|
Topics,
|
|
258
262
|
TopicsBranch,
|
|
259
263
|
TopicsLeaf,
|
|
264
|
+
TransitionIn,
|
|
265
|
+
TransitionInDisabled,
|
|
266
|
+
TransitionOut,
|
|
267
|
+
TransitionOutDisabled,
|
|
260
268
|
UsageMeter,
|
|
261
269
|
Unpublish,
|
|
262
270
|
User,
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { forwardRef, SVGProps } from 'react';
|
|
2
|
+
|
|
3
|
+
import { stroke } from './variables';
|
|
4
|
+
|
|
5
|
+
type TransitionInDisabledProps = SVGProps<SVGSVGElement>;
|
|
6
|
+
|
|
7
|
+
type TransitionInDisabledRef = SVGSVGElement;
|
|
8
|
+
|
|
9
|
+
export const TransitionInDisabled = forwardRef<TransitionInDisabledRef, TransitionInDisabledProps>((delegated, ref) => {
|
|
10
|
+
return (
|
|
11
|
+
<svg ref={ref} width="22" height="22" viewBox="0 0 22 22" fill="none" {...delegated}>
|
|
12
|
+
<rect width="7" height="1" x="12.95" y="18.77" fill={stroke} rx=".5" transform="rotate(-135 12.95 18.77)" />
|
|
13
|
+
<rect width="7" height="1" x="8" y="18.063" fill={stroke} rx=".5" transform="rotate(-45 8 18.063)" />
|
|
14
|
+
<path
|
|
15
|
+
fill={stroke}
|
|
16
|
+
d="M2.702 10.268h1.06a.3.3 0 0 0 0-.6h-1.06c-.27 0-.401-.176-.402-.296v-.944a.3.3 0 0 0-.6 0v.944c0 .539.496.896 1.002.896Zm0-4.968h1.06a.3.3 0 0 0 0-.6h-1.06c-.506 0-1.002.357-1.002.896v.944a.3.3 0 0 0 .6 0v-.944c0-.12.132-.296.402-.296Zm3.18 4.968h2.121a.3.3 0 1 0 0-.6h-2.12a.3.3 0 0 0 0 .6Zm0-4.968h2.121a.3.3 0 1 0 0-.6h-2.12a.3.3 0 0 0 0 .6Zm4.242 4.968h2.121a.3.3 0 0 0 0-.6h-2.12a.3.3 0 1 0 0 .6Zm0-4.968h2.121a.3.3 0 0 0 0-.6h-2.12a.3.3 0 1 0 0 .6Zm4.242 4.968h2.12a.3.3 0 1 0 0-.6h-2.12a.3.3 0 0 0 0 .6Zm0-4.968h2.12a.3.3 0 0 0 0-.6h-2.12a.3.3 0 0 0 0 .6Zm4.242 4.968h1.06c.506 0 1.001-.357 1.001-.896v-.944a.3.3 0 1 0-.6 0v.944c0 .12-.132.296-.4.296h-1.061a.3.3 0 1 0 0 .6Zm0-4.968h1.06c.27 0 .402.176.402.296v.944a.3.3 0 1 0 .6 0v-.944c0-.539-.496-.896-1.002-.896h-1.06a.3.3 0 1 0 0 .6Z"
|
|
17
|
+
/>
|
|
18
|
+
</svg>
|
|
19
|
+
);
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
TransitionInDisabled.displayName = 'TransitionInDisabledIcon';
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { forwardRef, SVGProps } from 'react';
|
|
2
|
+
|
|
3
|
+
import { fill, stroke } from './variables';
|
|
4
|
+
|
|
5
|
+
type TransitionInProps = SVGProps<SVGSVGElement>;
|
|
6
|
+
|
|
7
|
+
type TransitionInRef = SVGSVGElement;
|
|
8
|
+
|
|
9
|
+
export const TransitionIn = forwardRef<TransitionInRef, TransitionInProps>((delegated, ref) => {
|
|
10
|
+
return (
|
|
11
|
+
<svg ref={ref} width="22" height="22" viewBox="0 0 22 22" fill="none" {...delegated}>
|
|
12
|
+
<path
|
|
13
|
+
fill={fill}
|
|
14
|
+
d="M2.565 3.85c-.387-.001-.702.265-.703.594l-.01 3.776c0 .329.313.597.7.598l16.967.044c.387 0 .702-.265.703-.595l.01-3.775c0-.33-.313-.597-.7-.598L2.565 3.85Z"
|
|
15
|
+
/>
|
|
16
|
+
<path
|
|
17
|
+
fill={stroke}
|
|
18
|
+
d="M2.553 8.473c-.252 0-.357-.164-.357-.253l.01-3.775c0-.088.107-.252.358-.251l16.966.044c.252 0 .357.165.357.253l-.01 3.775c0 .089-.106.252-.358.252L2.553 8.473Zm16.964.733c.523.001 1.047-.368 1.049-.938l.01-3.775c.001-.57-.521-.942-1.044-.943L2.566 3.505c-.523 0-1.047.369-1.048.938l-.01 3.775c-.002.57.52.942 1.044.944l16.965.044Z"
|
|
19
|
+
/>
|
|
20
|
+
<path
|
|
21
|
+
fill={stroke}
|
|
22
|
+
fillRule="evenodd"
|
|
23
|
+
d="m13.888 16.014-2.424 2.424a.381.381 0 0 1-.539 0l-2.424-2.424a.38.38 0 1 1 .539-.539l1.774 1.774.033-5.868a.381.381 0 0 1 .762 0l-.033 5.868 1.774-1.774a.38.38 0 1 1 .538.539Z"
|
|
24
|
+
clipRule="evenodd"
|
|
25
|
+
/>
|
|
26
|
+
</svg>
|
|
27
|
+
);
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
TransitionIn.displayName = 'TransitionInIcon';
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { forwardRef, SVGProps } from 'react';
|
|
2
|
+
|
|
3
|
+
import { stroke } from './variables';
|
|
4
|
+
|
|
5
|
+
type TransitionOutDisabledProps = SVGProps<SVGSVGElement>;
|
|
6
|
+
|
|
7
|
+
type TransitionOutDisabledRef = SVGSVGElement;
|
|
8
|
+
|
|
9
|
+
export const TransitionOutDisabled = forwardRef<TransitionOutDisabledRef, TransitionOutDisabledProps>(
|
|
10
|
+
(delegated, ref) => {
|
|
11
|
+
return (
|
|
12
|
+
<svg ref={ref} width="22" height="22" viewBox="0 0 22 22" fill="none" {...delegated}>
|
|
13
|
+
<path
|
|
14
|
+
fill={stroke}
|
|
15
|
+
d="M2.475 18.428h1.06a.3.3 0 0 0 0-.6h-1.06c-.27 0-.401-.176-.401-.296v-.944a.3.3 0 0 0-.601 0v.944c0 .54.497.896 1.002.896Zm0-4.968h1.06a.3.3 0 0 0 0-.6h-1.06c-.505 0-1.002.357-1.002.896v.944a.3.3 0 0 0 .6 0v-.944c0-.12.133-.296.402-.296Zm3.18 4.968h2.122a.3.3 0 1 0 0-.6H5.656a.3.3 0 0 0 0 .6Zm0-4.968h2.122a.3.3 0 1 0 0-.6H5.656a.3.3 0 0 0 0 .6Zm4.243 4.968h2.12a.3.3 0 0 0 0-.6h-2.12a.3.3 0 1 0 0 .6Zm0-4.968h2.12a.3.3 0 0 0 0-.6h-2.12a.3.3 0 1 0 0 .6Zm4.241 4.968h2.121a.3.3 0 1 0 0-.6H14.14a.3.3 0 0 0 0 .6Zm0-4.968h2.121a.3.3 0 1 0 0-.6H14.14a.3.3 0 0 0 0 .6Zm4.242 4.968h1.06c.506 0 1.002-.357 1.002-.896v-.944a.3.3 0 1 0-.6 0v.944c0 .12-.132.296-.401.296h-1.06a.3.3 0 1 0 0 .6Zm0-4.968h1.06c.27 0 .402.177.402.296v.944a.3.3 0 0 0 .6 0v-.944c0-.538-.496-.895-1.001-.895h-1.06a.3.3 0 1 0 0 .6Z"
|
|
16
|
+
/>
|
|
17
|
+
<rect width="7" height="1" x="8.707" y="4" fill={stroke} rx=".5" transform="rotate(45 8.707 4)" />
|
|
18
|
+
<rect width="7" height="1" x="13.657" y="4.707" fill={stroke} rx=".5" transform="rotate(135 13.657 4.707)" />
|
|
19
|
+
</svg>
|
|
20
|
+
);
|
|
21
|
+
},
|
|
22
|
+
);
|
|
23
|
+
|
|
24
|
+
TransitionOutDisabled.displayName = 'TransitionOutDisabledIcon';
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { forwardRef, SVGProps } from 'react';
|
|
2
|
+
|
|
3
|
+
import { fill, stroke } from './variables';
|
|
4
|
+
|
|
5
|
+
type TransitionOutProps = SVGProps<SVGSVGElement>;
|
|
6
|
+
|
|
7
|
+
type TransitionOutRef = SVGSVGElement;
|
|
8
|
+
|
|
9
|
+
export const TransitionOut = forwardRef<TransitionOutRef, TransitionOutProps>((delegated, ref) => {
|
|
10
|
+
return (
|
|
11
|
+
<svg ref={ref} width="22" height="22" viewBox="0 0 22 22" fill="none" {...delegated}>
|
|
12
|
+
<path
|
|
13
|
+
fill={fill}
|
|
14
|
+
d="M19.44 18.136c.387 0 .701-.267.701-.596l.004-3.775c0-.33-.314-.597-.701-.597l-16.967-.015c-.387 0-.702.266-.702.595l-.003 3.776c0 .33.313.596.7.597l16.967.015Z"
|
|
15
|
+
/>
|
|
16
|
+
<path
|
|
17
|
+
fill={stroke}
|
|
18
|
+
d="M19.443 13.512c.252 0 .357.164.357.252l-.003 3.776c0 .088-.106.252-.358.252l-16.966-.015c-.252 0-.357-.164-.357-.253l.003-3.775c0-.089.106-.252.358-.252l16.966.015Zm-16.965-.703c-.523 0-1.047.37-1.047.94l-.003 3.774c0 .57.522.942 1.045.942l16.966.015c.523 0 1.046-.37 1.046-.94l.004-3.775c0-.57-.522-.941-1.045-.942L2.478 12.81Z"
|
|
19
|
+
/>
|
|
20
|
+
<path
|
|
21
|
+
fill={stroke}
|
|
22
|
+
fillRule="evenodd"
|
|
23
|
+
d="m8.112 5.986 2.424-2.424a.38.38 0 0 1 .539 0l2.424 2.424a.381.381 0 0 1-.539.539L11.186 4.75l-.033 5.868a.381.381 0 0 1-.762 0l.033-5.868L8.65 6.525a.381.381 0 0 1-.538-.539Z"
|
|
24
|
+
clipRule="evenodd"
|
|
25
|
+
/>
|
|
26
|
+
</svg>
|
|
27
|
+
);
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
TransitionOut.displayName = 'TransitionOutIcon';
|
package/src/rich-text-editor/plugins/CodeActionMenuPlugin/components/PrettierButton/index.tsx
CHANGED
|
@@ -30,12 +30,13 @@ type LanguagesType = keyof typeof PRETTIER_PARSER_MODULES;
|
|
|
30
30
|
|
|
31
31
|
async function loadPrettierParserByLang(lang: string) {
|
|
32
32
|
const dynamicImport = PRETTIER_PARSER_MODULES[lang as LanguagesType];
|
|
33
|
-
|
|
33
|
+
const parser = await dynamicImport();
|
|
34
|
+
return parser?.default || parser;
|
|
34
35
|
}
|
|
35
36
|
|
|
36
37
|
async function loadPrettierFormat() {
|
|
37
|
-
const
|
|
38
|
-
return format;
|
|
38
|
+
const prettier = await import('prettier/standalone');
|
|
39
|
+
return prettier?.default?.format || prettier?.format;
|
|
39
40
|
}
|
|
40
41
|
|
|
41
42
|
const PRETTIER_OPTIONS_BY_LANG: Record<string, Options> = {
|
|
@@ -75,6 +76,20 @@ export function PrettierButton({ lang, editor, getCodeDOMNode }: Props) {
|
|
|
75
76
|
|
|
76
77
|
async function handleClick(): Promise<void> {
|
|
77
78
|
const codeDOMNode = getCodeDOMNode();
|
|
79
|
+
if (!codeDOMNode) {
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
let content = '';
|
|
84
|
+
editor.update(() => {
|
|
85
|
+
const codeNode = $getNearestNodeFromDOMNode(codeDOMNode);
|
|
86
|
+
if ($isCodeNode(codeNode)) {
|
|
87
|
+
content = codeNode.getTextContent();
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
if (content === '') {
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
78
93
|
|
|
79
94
|
try {
|
|
80
95
|
const format = await loadPrettierFormat();
|
|
@@ -85,26 +100,21 @@ export function PrettierButton({ lang, editor, getCodeDOMNode }: Props) {
|
|
|
85
100
|
return;
|
|
86
101
|
}
|
|
87
102
|
|
|
103
|
+
const parsed = await format(content, options);
|
|
104
|
+
/**
|
|
105
|
+
* Remove EOF from prettier output. This is useful when
|
|
106
|
+
* using prettier on files, but becomes weird when the code
|
|
107
|
+
* is embedded within a larger portion of text (like we do)
|
|
108
|
+
*/
|
|
109
|
+
const formattedCode = parsed.replace(/[\r\n]+$/, '');
|
|
110
|
+
|
|
88
111
|
editor.update(() => {
|
|
89
112
|
const codeNode = $getNearestNodeFromDOMNode(codeDOMNode);
|
|
90
113
|
|
|
91
114
|
if ($isCodeNode(codeNode)) {
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
let parsed = '';
|
|
95
|
-
|
|
96
|
-
parsed = format(content, options);
|
|
97
|
-
|
|
98
|
-
/**
|
|
99
|
-
* Remove EOF from prettier output. This is useful when
|
|
100
|
-
* using prettier on files, but becomes weird when the code
|
|
101
|
-
* is embedded within a larger portion of text (like we do)
|
|
102
|
-
*/
|
|
103
|
-
parsed = parsed.replace(/[\r\n]+$/, '');
|
|
104
|
-
|
|
105
|
-
if (parsed !== '') {
|
|
115
|
+
if (formattedCode !== '') {
|
|
106
116
|
const selection = codeNode.select(0);
|
|
107
|
-
selection.insertText(
|
|
117
|
+
selection.insertText(formattedCode);
|
|
108
118
|
setSyntaxError('');
|
|
109
119
|
setTipsVisible(false);
|
|
110
120
|
}
|