@crystallize/design-system 1.13.2 → 1.15.0

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 CHANGED
@@ -1,5 +1,17 @@
1
1
  # @crystallize/design-system
2
2
 
3
+ ## 1.15.0
4
+
5
+ ### Minor Changes
6
+
7
+ - af5e94e1: Added custom variables for rich text editor padding. This will enable easy override from the consumer.
8
+
9
+ ## 1.14.0
10
+
11
+ ### Minor Changes
12
+
13
+ - 97f6c34: Clean up the visuals of the code block in rich text editor
14
+
3
15
  ## 1.13.2
4
16
 
5
17
  ### Patch Changes
package/dist/index.css CHANGED
@@ -2145,58 +2145,66 @@ button {
2145
2145
 
2146
2146
  /* src/rich-text-editor/plugins/CodeActionMenuPlugin/index.css */
2147
2147
  .c-rte-code-action-menu-container {
2148
- height: 35.8px;
2149
- font-size: 10px;
2150
- color: rgba(0, 0, 0, 0.5);
2148
+ height: 37px;
2151
2149
  position: absolute;
2152
2150
  display: flex;
2153
2151
  align-items: center;
2154
2152
  flex-direction: row;
2155
2153
  user-select: none;
2154
+ border-radius: 0.375rem;
2155
+ background-color: rgb(var(--c-color-gray-100-800) / 0.75);
2156
+ padding-left: 0.75rem;
2157
+ padding-right: 0.75rem;
2158
+ font-size: 0.75rem;
2159
+ line-height: 1rem;
2160
+ --tw-text-opacity: 1;
2161
+ color: rgb(var(--c-color-gray-700-200) / var(--tw-text-opacity));
2156
2162
  }
2157
2163
  .c-rte-code-highlight-language {
2158
2164
  margin-right: 4px;
2159
2165
  }
2160
2166
  .c-rte-code-button {
2167
+ border-radius: 0.125rem;
2168
+ padding: 0.25rem;
2161
2169
  border: 1px solid transparent;
2162
- border-radius: 4px;
2163
- padding: 4px;
2164
2170
  background: none;
2165
2171
  cursor: pointer;
2166
2172
  flex-shrink: 0;
2167
2173
  display: flex;
2168
2174
  align-items: center;
2169
- color: rgba(0, 0, 0, 0.5);
2170
2175
  text-transform: uppercase;
2171
2176
  }
2172
2177
  .c-rte-code-button:hover {
2173
- border: 1px solid rgba(0, 0, 0, 0.3);
2178
+ border-color: rgb(var(--c-color-gray-900-50) / 0.3);
2174
2179
  opacity: 0.9;
2175
2180
  }
2176
2181
  .c-rte-code-button:active {
2177
- background-color: rgba(223, 232, 250);
2178
- border: 1px solid rgba(0, 0, 0, 0.45);
2182
+ border-color: rgb(var(--c-color-gray-900-50) / 0.5);
2183
+ --tw-bg-opacity: 1;
2184
+ background-color: rgb(var(--c-color-gray-50-900) / var(--tw-bg-opacity));
2179
2185
  }
2180
2186
  .c-rte-code-button__icon {
2181
2187
  height: 16px;
2182
2188
  width: 16px;
2183
2189
  opacity: 0.6;
2184
2190
  display: flex;
2185
- color: rgba(0, 0, 0, 0.5);
2186
2191
  background-size: contain;
2192
+ color: rgb(var(--c-color-gray));
2187
2193
  }
2188
2194
  .c-rte-prettier-wrapper {
2189
2195
  position: relative;
2190
2196
  }
2191
2197
  .c-rte-code-error-tips {
2192
- padding: 5px;
2193
- border-radius: 4px;
2194
- color: #fff;
2195
- background: #222;
2196
- margin-top: 4px;
2197
2198
  position: absolute;
2199
+ right: 0px;
2198
2200
  top: 26px;
2199
- right: 0;
2201
+ margin-top: 0.5rem;
2202
+ border-radius: 0.25rem;
2203
+ --tw-bg-opacity: 1;
2204
+ background-color: rgb(var(--c-color-gray-200-700) / var(--tw-bg-opacity));
2205
+ padding: 0.75rem;
2206
+ --tw-text-opacity: 1;
2207
+ color: rgb(var(--c-color-gray-900-50) / var(--tw-text-opacity));
2200
2208
  }
2201
2209
 
2202
2210
  /* src/rich-text-editor/plugins/DraggableBlockPlugin/index.css */
@@ -2250,11 +2258,12 @@ button {
2250
2258
  overflow: auto;
2251
2259
  border-top-left-radius: 0.375rem;
2252
2260
  border-top-right-radius: 0.375rem;
2253
- padding-top: 0.25rem;
2254
- padding-bottom: 0.25rem;
2255
2261
  padding-left: 1rem;
2256
2262
  padding-right: 0.5rem;
2257
2263
  vertical-align: middle;
2264
+ padding-top: var(--c-rte-toolbar-pt, 0.25rem);
2265
+ padding-left: var(--c-rte-toolbar-pl, 0.5rem);
2266
+ padding-right: var(--c-rte-toolbar-pr, 0.5rem);
2258
2267
  }
2259
2268
  .c-rte-toolbar__inner {
2260
2269
  display: flex;
@@ -2511,23 +2520,7 @@ button {
2511
2520
  right: 2px;
2512
2521
  top: 2px;
2513
2522
  }
2514
- .c-rich-text-editor .c-rte-contenteditable-root {
2515
- position: relative;
2516
- display: block;
2517
- border-width: 0px;
2518
- padding-left: 1.5rem;
2519
- padding-right: 1.5rem;
2520
- padding-top: 0.5rem;
2521
- padding-bottom: 0.5rem;
2522
- padding-top: 0px !important;
2523
- font-size: 0.875rem;
2524
- line-height: 1.25rem;
2525
- outline-width: 0px;
2526
- tab-size: 1;
2527
- padding-bottom: 8px;
2528
- min-height: calc(var(--c-rte-min-height) - 8px);
2529
- }
2530
- .c-rich-text-editor pre {
2523
+ .c-rich-text-editor [contenteditable] pre {
2531
2524
  line-height: 1.1;
2532
2525
  color: #fff;
2533
2526
  margin: 0;
@@ -2539,41 +2532,21 @@ button {
2539
2532
  font-size: 0.875rem;
2540
2533
  line-height: 1.25rem;
2541
2534
  }
2542
- .c-rich-text-editor pre::-webkit-scrollbar {
2535
+ .c-rich-text-editor [contenteditable] pre::-webkit-scrollbar {
2543
2536
  background: transparent;
2544
2537
  width: 10px;
2545
2538
  }
2546
- .c-rich-text-editor pre::-webkit-scrollbar-thumb {
2539
+ .c-rich-text-editor [contenteditable] pre::-webkit-scrollbar-thumb {
2547
2540
  background: #999;
2548
2541
  }
2549
- .c-rich-text-editor [role=separator] {
2550
- height: 1px;
2551
- --tw-bg-opacity: 1;
2552
- background-color: rgb(var(--c-color-gray-200-700) / var(--tw-bg-opacity));
2553
- }
2554
- .c-rich-text-editor .ltr {
2555
- text-align: left;
2556
- }
2557
- .c-rich-text-editor .rtl {
2558
- text-align: right;
2559
- }
2560
- .c-rich-text-editor button.item i {
2561
- opacity: 0.6;
2562
- }
2563
- .c-rich-text-editor button.item.dropdown-item-active {
2564
- background-color: rgba(223, 232, 250, 0.3);
2565
- }
2566
- .c-rich-text-editor button.item.dropdown-item-active i {
2567
- opacity: 1;
2568
- }
2569
- .c-rich-text-editor hr {
2542
+ .c-rich-text-editor [contenteditable] hr {
2570
2543
  padding: 4px 0;
2571
2544
  border: 1px solid red;
2572
2545
  border: none;
2573
2546
  margin: 1em 0;
2574
2547
  cursor: pointer;
2575
2548
  }
2576
- .c-rich-text-editor hr:after {
2549
+ .c-rich-text-editor [contenteditable] hr:after {
2577
2550
  content: "";
2578
2551
  display: block;
2579
2552
  height: 1px;
@@ -2582,10 +2555,24 @@ button {
2582
2555
  --tw-bg-opacity: 1;
2583
2556
  background-color: rgb(var(--c-color-purple-100-800) / var(--tw-bg-opacity));
2584
2557
  }
2585
- .c-rich-text-editor hr.selected {
2558
+ .c-rich-text-editor [contenteditable] hr.selected {
2586
2559
  outline: 2px solid rgb(60, 132, 244);
2587
2560
  user-select: none;
2588
2561
  }
2562
+ .c-rich-text-editor [role=separator] {
2563
+ height: 1px;
2564
+ --tw-bg-opacity: 1;
2565
+ background-color: rgb(var(--c-color-gray-200-700) / var(--tw-bg-opacity));
2566
+ }
2567
+ .c-rich-text-editor .ltr {
2568
+ text-align: left;
2569
+ }
2570
+ .c-rich-text-editor .rtl {
2571
+ text-align: right;
2572
+ }
2573
+ .c-rich-text-editor button.item i {
2574
+ opacity: 0.6;
2575
+ }
2589
2576
  .c-rich-text-editor .TableNode__contentEditable {
2590
2577
  min-height: 20px;
2591
2578
  border: 0px;
@@ -2643,6 +2630,26 @@ button {
2643
2630
  visibility: hidden;
2644
2631
  }
2645
2632
  }
2633
+ .c-rte-contenteditable-root {
2634
+ position: relative;
2635
+ display: block;
2636
+ border-width: 0px;
2637
+ padding-left: 1.5rem;
2638
+ padding-right: 1.5rem;
2639
+ padding-top: 0.5rem;
2640
+ padding-bottom: 0.5rem;
2641
+ padding-top: 0px !important;
2642
+ font-size: 0.875rem;
2643
+ line-height: 1.25rem;
2644
+ outline-width: 0px;
2645
+ tab-size: 1;
2646
+ padding-bottom: 8px;
2647
+ min-height: calc(var(--c-rte-min-height) - 8px);
2648
+ padding-top: var(--c-rte-content-pt, 0);
2649
+ padding-left: var(--c-rte-content-pl, 1.5rem);
2650
+ padding-right: var(--c-rte-content-pr, 1.5rem);
2651
+ padding-bottom: var(--c-rte-content-pb, 8px);
2652
+ }
2646
2653
 
2647
2654
  /* src/rich-text-editor/plugins/FloatingLinkEditorPlugin/index.css */
2648
2655
  .c-rte-link-editor {
package/dist/index.js CHANGED
@@ -4665,7 +4665,7 @@ function PrettierButton({ lang, editor, getCodeDOMNode }) {
4665
4665
 
4666
4666
  // src/rich-text-editor/plugins/CodeActionMenuPlugin/index.tsx
4667
4667
  var import_jsx_runtime86 = require("react/jsx-runtime");
4668
- var CODE_PADDING = 8;
4668
+ var CODE_PADDING = 0;
4669
4669
  function CodeActionMenuContainer({ anchorElem }) {
4670
4670
  const [editor] = (0, import_LexicalComposerContext.useLexicalComposerContext)();
4671
4671
  const [lang, setLang] = (0, import_react71.useState)("");
package/dist/index.mjs CHANGED
@@ -4617,7 +4617,7 @@ function PrettierButton({ lang, editor, getCodeDOMNode }) {
4617
4617
 
4618
4618
  // src/rich-text-editor/plugins/CodeActionMenuPlugin/index.tsx
4619
4619
  import { Fragment as Fragment2, jsx as jsx86, jsxs as jsxs65 } from "react/jsx-runtime";
4620
- var CODE_PADDING = 8;
4620
+ var CODE_PADDING = 0;
4621
4621
  function CodeActionMenuContainer({ anchorElem }) {
4622
4622
  const [editor] = useLexicalComposerContext();
4623
4623
  const [lang, setLang] = useState3("");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crystallize/design-system",
3
- "version": "1.13.2",
3
+ "version": "1.15.0",
4
4
  "types": "./dist/index.d.ts",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
@@ -20,23 +20,23 @@
20
20
  }
21
21
  },
22
22
  "dependencies": {
23
- "@lexical/clipboard": "0.9.0",
24
- "@lexical/code": "0.9.0",
25
- "@lexical/file": "0.9.0",
26
- "@lexical/hashtag": "0.9.0",
27
- "@lexical/html": "0.9.0",
28
- "@lexical/link": "0.9.0",
29
- "@lexical/list": "0.9.0",
30
- "@lexical/mark": "0.9.0",
31
- "@lexical/markdown": "0.9.0",
32
- "@lexical/overflow": "0.9.0",
33
- "@lexical/react": "0.9.0",
34
- "@lexical/rich-text": "0.9.0",
35
- "@lexical/selection": "0.9.0",
36
- "@lexical/table": "0.9.0",
37
- "@lexical/text": "0.9.0",
38
- "@lexical/utils": "0.9.0",
39
- "@lexical/yjs": "0.9.0",
23
+ "@lexical/clipboard": "0.10.0",
24
+ "@lexical/code": "0.10.0",
25
+ "@lexical/file": "0.10.0",
26
+ "@lexical/hashtag": "0.10.0",
27
+ "@lexical/html": "0.10.0",
28
+ "@lexical/link": "0.10.0",
29
+ "@lexical/list": "0.10.0",
30
+ "@lexical/mark": "0.10.0",
31
+ "@lexical/markdown": "0.10.0",
32
+ "@lexical/overflow": "0.10.0",
33
+ "@lexical/react": "0.10.0",
34
+ "@lexical/rich-text": "0.10.0",
35
+ "@lexical/selection": "0.10.0",
36
+ "@lexical/table": "0.10.0",
37
+ "@lexical/text": "0.10.0",
38
+ "@lexical/utils": "0.10.0",
39
+ "@lexical/yjs": "0.10.0",
40
40
  "@radix-ui/react-checkbox": "1.0.1",
41
41
  "@radix-ui/react-dialog": "1.0.2",
42
42
  "@radix-ui/react-dropdown-menu": "2.0.1",
@@ -46,7 +46,7 @@
46
46
  "@radix-ui/react-select": "1.1.2",
47
47
  "@radix-ui/react-slider": "^1.1.0",
48
48
  "class-variance-authority": "^0.4.0",
49
- "lexical": "0.9.0",
49
+ "lexical": "0.10.0",
50
50
  "prettier": "2.8.4",
51
51
  "use-debounce": "8.0.4"
52
52
  },
@@ -1,12 +1,12 @@
1
1
  .c-rte-code-action-menu-container {
2
- height: 35.8px;
3
- font-size: 10px;
4
- color: rgba(0, 0, 0, 0.5);
2
+ height: 37px;
5
3
  position: absolute;
6
4
  display: flex;
7
5
  align-items: center;
8
6
  flex-direction: row;
9
7
  user-select: none;
8
+
9
+ @apply rounded-md bg-gray-100-800/75 px-3 text-xs text-gray-700-200;
10
10
  }
11
11
 
12
12
  .c-rte-code-highlight-language {
@@ -14,25 +14,21 @@
14
14
  }
15
15
 
16
16
  .c-rte-code-button {
17
+ @apply rounded-sm p-1;
17
18
  border: 1px solid transparent;
18
- border-radius: 4px;
19
- padding: 4px;
20
19
  background: none;
21
20
  cursor: pointer;
22
21
  flex-shrink: 0;
23
22
  display: flex;
24
23
  align-items: center;
25
- color: rgba(0, 0, 0, 0.5);
26
24
  text-transform: uppercase;
27
25
 
28
26
  &:hover {
29
- border: 1px solid rgba(0, 0, 0, 0.3);
30
- opacity: 0.9;
27
+ @apply border-gray-900-50/30 opacity-90;
31
28
  }
32
29
 
33
30
  &:active {
34
- background-color: rgba(223, 232, 250);
35
- border: 1px solid rgba(0, 0, 0, 0.45);
31
+ @apply border-gray-900-50/50 bg-gray-50-900;
36
32
  }
37
33
 
38
34
  &__icon {
@@ -40,8 +36,8 @@
40
36
  width: 16px;
41
37
  opacity: 0.6;
42
38
  display: flex;
43
- color: rgba(0, 0, 0, 0.5);
44
39
  background-size: contain;
40
+ @apply text-gray;
45
41
  }
46
42
  }
47
43
 
@@ -50,12 +46,5 @@
50
46
  }
51
47
 
52
48
  .c-rte-code-error-tips {
53
- padding: 5px;
54
- border-radius: 4px;
55
- color: #fff;
56
- background: #222;
57
- margin-top: 4px;
58
- position: absolute;
59
- top: 26px;
60
- right: 0;
49
+ @apply absolute right-0 top-[26px] mt-2 rounded bg-gray-200-700 p-3 text-gray-900-50;
61
50
  }
@@ -16,7 +16,7 @@ import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext
16
16
  import { CopyButton } from './components/CopyButton';
17
17
  import { canBePrettier, PrettierButton } from './components/PrettierButton';
18
18
 
19
- const CODE_PADDING = 8;
19
+ const CODE_PADDING = 0;
20
20
 
21
21
  interface Position {
22
22
  top: string;
@@ -1,5 +1,10 @@
1
1
  .c-rte-toolbar {
2
- @apply flex h-12 w-full justify-between overflow-auto rounded-tl-md rounded-tr-md py-1 pl-4 pr-2 align-middle;
2
+ @apply flex h-12 w-full justify-between overflow-auto rounded-tl-md rounded-tr-md pl-4 pr-2 align-middle;
3
+
4
+ /* Allow for customization from the outside */
5
+ padding-top: var(--c-rte-toolbar-pt, 0.25rem);
6
+ padding-left: var(--c-rte-toolbar-pl, 0.5rem);
7
+ padding-right: var(--c-rte-toolbar-pr, 0.5rem);
3
8
 
4
9
  &__inner {
5
10
  @apply flex;
@@ -53,30 +53,47 @@
53
53
  top: 2px;
54
54
  }
55
55
 
56
- .c-rte-contenteditable-root {
57
- @apply relative block border-0 px-6 py-2 !pt-0 text-sm outline-0;
58
- tab-size: 1;
59
- padding-bottom: 8px;
60
- min-height: calc(var(--c-rte-min-height) - 8px);
61
- }
62
-
63
- pre {
64
- line-height: 1.1;
65
- color: #fff;
66
- margin: 0;
67
- padding: 10px;
68
- overflow: auto;
69
- max-height: 180px;
70
- @apply bg-purple-50-900 text-sm;
71
- }
72
-
73
- pre::-webkit-scrollbar {
74
- background: transparent;
75
- width: 10px;
76
- }
56
+ [contenteditable] {
57
+ pre {
58
+ line-height: 1.1;
59
+ color: #fff;
60
+ margin: 0;
61
+ padding: 10px;
62
+ overflow: auto;
63
+ max-height: 180px;
64
+ @apply bg-purple-50-900 text-sm;
65
+
66
+ &::-webkit-scrollbar {
67
+ background: transparent;
68
+ width: 10px;
69
+ }
70
+
71
+ &::-webkit-scrollbar-thumb {
72
+ background: #999;
73
+ }
74
+ }
77
75
 
78
- pre::-webkit-scrollbar-thumb {
79
- background: #999;
76
+ hr {
77
+ padding: 4px 0;
78
+ border: 1px solid red;
79
+ border: none;
80
+ margin: 1em 0;
81
+ cursor: pointer;
82
+
83
+ &:after {
84
+ content: '';
85
+ display: block;
86
+ height: 1px;
87
+ background-color: #ccc;
88
+ line-height: 1px;
89
+ @apply bg-purple-100-800;
90
+ }
91
+
92
+ &.selected {
93
+ outline: 2px solid rgb(60, 132, 244);
94
+ user-select: none;
95
+ }
96
+ }
80
97
  }
81
98
 
82
99
  [role='separator'] {
@@ -95,36 +112,6 @@
95
112
  opacity: 0.6;
96
113
  }
97
114
 
98
- button.item.dropdown-item-active {
99
- background-color: rgba(223, 232, 250, 0.3);
100
- }
101
-
102
- button.item.dropdown-item-active i {
103
- opacity: 1;
104
- }
105
-
106
- hr {
107
- padding: 4px 0;
108
- border: 1px solid red;
109
- border: none;
110
- margin: 1em 0;
111
- cursor: pointer;
112
- }
113
-
114
- hr:after {
115
- content: '';
116
- display: block;
117
- height: 1px;
118
- background-color: #ccc;
119
- line-height: 1px;
120
- @apply bg-purple-100-800;
121
- }
122
-
123
- hr.selected {
124
- outline: 2px solid rgb(60, 132, 244);
125
- user-select: none;
126
- }
127
-
128
115
  .TableNode__contentEditable {
129
116
  min-height: 20px;
130
117
  border: 0px;
@@ -173,3 +160,16 @@
173
160
  }
174
161
  }
175
162
  }
163
+
164
+ .c-rte-contenteditable-root {
165
+ @apply relative block border-0 px-6 py-2 !pt-0 text-sm outline-0;
166
+ tab-size: 1;
167
+ padding-bottom: 8px;
168
+ min-height: calc(var(--c-rte-min-height) - 8px);
169
+
170
+ /* Allow for customization from the outside */
171
+ padding-top: var(--c-rte-content-pt, 0);
172
+ padding-left: var(--c-rte-content-pl, 1.5rem);
173
+ padding-right: var(--c-rte-content-pr, 1.5rem);
174
+ padding-bottom: var(--c-rte-content-pb, 8px);
175
+ }