@crystallize/design-system 1.24.16 → 1.24.18

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.24.18
4
+
5
+ ### Patch Changes
6
+
7
+ - 1e62463: Adjust switch component types
8
+
9
+ ## 1.24.17
10
+
11
+ ### Patch Changes
12
+
13
+ - c1a9ffd: Close the richtext link popup when cliking outside. It was found that when we have just a link the editor is never closed because we keep the focus always on the link. This does not happen when we have more than just a link, because the moment we are not focusing the link but some other part of the editor the popup is closed. Now we check if we click outside the editor then we fource close ir.
14
+
3
15
  ## 1.24.16
4
16
 
5
17
  ### Patch Changes
@@ -6427,7 +6427,7 @@ function withConfirm(delegated) {
6427
6427
  open: true,
6428
6428
  displayOk: true,
6429
6429
  displayCancel: true,
6430
- type: "info",
6430
+ type: "warning",
6431
6431
  ...delegated,
6432
6432
  onInteractOutside: dumbFn,
6433
6433
  onPointerDownOutside: dumbFn
package/dist/index.css CHANGED
@@ -1268,16 +1268,10 @@
1268
1268
  /* src/inline-radio/inline-radio.css */
1269
1269
  .c-inline-radio-group {
1270
1270
  display: inline-flex;
1271
- }
1272
- .c-inline-radio-group > :not([hidden]) ~ :not([hidden]) {
1273
- --tw-space-x-reverse: 0;
1274
- margin-right: calc(0.25rem * var(--tw-space-x-reverse));
1275
- margin-left: calc(0.25rem * calc(1 - var(--tw-space-x-reverse)));
1276
- }
1277
- .c-inline-radio-group {
1271
+ gap: 0.25rem;
1278
1272
  border-radius: 0.25rem;
1279
1273
  --tw-bg-opacity: 1;
1280
- background-color: rgb(var(--c-color-gray-100-800) / var(--tw-bg-opacity));
1274
+ background-color: rgb(var(--c-color-purple-100-800) / var(--tw-bg-opacity));
1281
1275
  padding: 3px;
1282
1276
  }
1283
1277
  .c-inline-radio-group-xs {
@@ -1304,20 +1298,29 @@
1304
1298
  cursor: pointer;
1305
1299
  align-items: center;
1306
1300
  justify-content: center;
1307
- border-radius: 3px;
1308
- border-style: none;
1301
+ border-radius: 0.375rem;
1309
1302
  background-color: transparent;
1303
+ padding-left: 1rem;
1304
+ padding-right: 1rem;
1310
1305
  font-size: 0.875rem;
1311
1306
  line-height: 1.25rem;
1312
1307
  font-weight: 500;
1313
1308
  line-height: 1 !important;
1314
1309
  color: rgb(var(--c-color-gray));
1310
+ border-width: 1px;
1311
+ border-style: solid;
1312
+ border-color: transparent;
1313
+ }
1314
+ .c-inline-radio:hover {
1315
+ --tw-border-opacity: 1;
1316
+ border-color: rgb(var(--c-color-purple-200-700) / var(--tw-border-opacity));
1315
1317
  }
1316
1318
  .c-inline-radio[aria-checked=true] {
1319
+ border-color: transparent;
1317
1320
  --tw-bg-opacity: 1;
1318
1321
  background-color: rgb(var(--c-color-elevate) / var(--tw-bg-opacity));
1319
- --tw-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
1320
- --tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);
1322
+ --tw-shadow: 0 2px 4px rgba(130,138,144,0.15);
1323
+ --tw-shadow-colored: 0 2px 4px var(--tw-shadow-color);
1321
1324
  box-shadow:
1322
1325
  var(--tw-ring-offset-shadow, 0 0 #0000),
1323
1326
  var(--tw-ring-shadow, 0 0 #0000),
package/dist/index.d.ts CHANGED
@@ -477,7 +477,7 @@ type SwitchStylesProps = VariantProps<typeof switchStyles>;
477
477
  declare const switchStyles: (props?: ({
478
478
  size?: "xs" | "sm" | null | undefined;
479
479
  } & class_variance_authority_dist_types.ClassProp) | undefined) => string;
480
- type CustomSwitchProps = SwitchStylesProps & Exclude<SwitchProps, 'checked'> & {
480
+ type CustomSwitchProps = SwitchStylesProps & Omit<SwitchProps, 'checked'> & {
481
481
  checked?: boolean | null;
482
482
  };
483
483
  declare function Switch({ size, checked, ...props }: CustomSwitchProps): JSX.Element;
package/dist/index.js CHANGED
@@ -7339,7 +7339,7 @@ function withConfirm(delegated) {
7339
7339
  open: true,
7340
7340
  displayOk: true,
7341
7341
  displayCancel: true,
7342
- type: "info",
7342
+ type: "warning",
7343
7343
  ...delegated,
7344
7344
  onInteractOutside: dumbFn,
7345
7345
  onPointerDownOutside: dumbFn
@@ -37936,6 +37936,19 @@ function useFloatingLinkEditorToolbar(editor, anchorElem) {
37936
37936
  import_lexical8.COMMAND_PRIORITY_CRITICAL
37937
37937
  );
37938
37938
  }, [editor, updateToolbar]);
37939
+ (0, import_react126.useEffect)(() => {
37940
+ if (!isLink) {
37941
+ return;
37942
+ }
37943
+ const onClick = (e) => {
37944
+ const rootElement = activeEditor.getRootElement()?.parentElement;
37945
+ const target = e.target;
37946
+ const isClickOutside = !!rootElement && target?.checkVisibility() && !rootElement.contains(target);
37947
+ isClickOutside && setIsLink(false);
37948
+ };
37949
+ document.addEventListener("click", onClick);
37950
+ return () => document.removeEventListener("click", onClick);
37951
+ }, [isLink, activeEditor]);
37939
37952
  return isLink ? (0, import_react_dom3.createPortal)(
37940
37953
  /* @__PURE__ */ (0, import_jsx_runtime145.jsx)(FloatingLinkEditor, {
37941
37954
  editor: activeEditor,
@@ -40557,7 +40570,7 @@ var switchStyles = (0, import_class_variance_authority24.cva)(["c-switch-root"],
40557
40570
  function Switch2({ size, checked, ...props }) {
40558
40571
  return /* @__PURE__ */ (0, import_jsx_runtime155.jsx)(RadixSwitch.Root, {
40559
40572
  ...props,
40560
- checked,
40573
+ checked: checked === null ? false : checked,
40561
40574
  className: switchStyles({ size }),
40562
40575
  children: /* @__PURE__ */ (0, import_jsx_runtime155.jsx)(RadixSwitch.Thumb, {
40563
40576
  className: (0, import_class_variance_authority24.cx)("c-switch-thumb", checked === null ? "middle-position" : "")
package/dist/index.mjs CHANGED
@@ -17,7 +17,7 @@ import {
17
17
  showError,
18
18
  showInfo,
19
19
  showWarning
20
- } from "./chunk-J5RWIXT3.mjs";
20
+ } from "./chunk-GAFUHKHL.mjs";
21
21
  import "./chunk-NIH5ZMPE.mjs";
22
22
 
23
23
  // src/card/card.tsx
@@ -480,7 +480,7 @@ function Tag({
480
480
  // src/rich-text-editor/index.tsx
481
481
  import { lazy, Suspense } from "react";
482
482
  import { jsx as jsx15 } from "react/jsx-runtime";
483
- var LazyRichTextEditor = lazy(() => import("./rich-text-editor-N3CKGEBD.mjs"));
483
+ var LazyRichTextEditor = lazy(() => import("./rich-text-editor-REO7ES7Q.mjs"));
484
484
  var RichTextEditor = (props) => {
485
485
  return /* @__PURE__ */ jsx15(Suspense, {
486
486
  fallback: null,
@@ -584,7 +584,7 @@ var switchStyles = cva7(["c-switch-root"], {
584
584
  function Switch({ size, checked, ...props }) {
585
585
  return /* @__PURE__ */ jsx17(RadixSwitch.Root, {
586
586
  ...props,
587
- checked,
587
+ checked: checked === null ? false : checked,
588
588
  className: switchStyles({ size }),
589
589
  children: /* @__PURE__ */ jsx17(RadixSwitch.Thumb, {
590
590
  className: cx9("c-switch-thumb", checked === null ? "middle-position" : "")
@@ -6,7 +6,7 @@ import {
6
6
  Icon,
7
7
  IconButton,
8
8
  InputWithLabel
9
- } from "./chunk-J5RWIXT3.mjs";
9
+ } from "./chunk-GAFUHKHL.mjs";
10
10
  import "./chunk-NIH5ZMPE.mjs";
11
11
 
12
12
  // src/rich-text-editor/rich-text-editor.tsx
@@ -1362,6 +1362,19 @@ function useFloatingLinkEditorToolbar(editor, anchorElem) {
1362
1362
  COMMAND_PRIORITY_CRITICAL
1363
1363
  );
1364
1364
  }, [editor, updateToolbar]);
1365
+ useEffect4(() => {
1366
+ if (!isLink) {
1367
+ return;
1368
+ }
1369
+ const onClick = (e) => {
1370
+ const rootElement = activeEditor.getRootElement()?.parentElement;
1371
+ const target = e.target;
1372
+ const isClickOutside = !!rootElement && target?.checkVisibility() && !rootElement.contains(target);
1373
+ isClickOutside && setIsLink(false);
1374
+ };
1375
+ document.addEventListener("click", onClick);
1376
+ return () => document.removeEventListener("click", onClick);
1377
+ }, [isLink, activeEditor]);
1365
1378
  return isLink ? createPortal2(
1366
1379
  /* @__PURE__ */ jsx8(FloatingLinkEditor, {
1367
1380
  editor: activeEditor,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crystallize/design-system",
3
- "version": "1.24.16",
3
+ "version": "1.24.18",
4
4
  "types": "./dist/index.d.ts",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
@@ -94,7 +94,7 @@
94
94
  "tailwindcss": "^3.3.5",
95
95
  "tsup": "^6.5.0",
96
96
  "typescript": "4.9.4",
97
- "vite": "5.2.8",
97
+ "vite": "5.3.5",
98
98
  "vitest": "0.30.1",
99
99
  "tsconfig": "0.0.0"
100
100
  },
@@ -125,7 +125,7 @@ export function withConfirm(delegated: DialogFuncProps): DialogFuncProps {
125
125
  open: true,
126
126
  displayOk: true,
127
127
  displayCancel: true,
128
- type: 'info',
128
+ type: 'warning',
129
129
  ...delegated,
130
130
  onInteractOutside: dumbFn,
131
131
  onPointerDownOutside: dumbFn,
@@ -1,5 +1,5 @@
1
1
  .c-inline-radio-group {
2
- @apply inline-flex space-x-1 rounded bg-gray-100-800 p-[3px];
2
+ @apply inline-flex gap-1 rounded bg-purple-100-800 p-[3px];
3
3
  }
4
4
 
5
5
  .c-inline-radio-group-xs {
@@ -19,10 +19,11 @@
19
19
  }
20
20
 
21
21
  .c-inline-radio {
22
- @apply m-0 flex cursor-pointer items-center justify-center rounded-[3px] border-none bg-transparent text-sm font-medium !leading-none text-gray;
22
+ @apply m-0 flex cursor-pointer items-center justify-center rounded-md bg-transparent px-4 text-sm font-medium !leading-none text-gray;
23
+ @apply border border-solid border-transparent hover:border-purple-200-700;
23
24
 
24
25
  &[aria-checked='true'] {
25
- @apply bg-elevate shadow-sm;
26
+ @apply border-transparent bg-elevate shadow;
26
27
  }
27
28
 
28
29
  &:focus-visible {
@@ -301,6 +301,23 @@ function useFloatingLinkEditorToolbar(editor: LexicalEditor, anchorElem: HTMLEle
301
301
  );
302
302
  }, [editor, updateToolbar]);
303
303
 
304
+ useEffect(() => {
305
+ if (!isLink) {
306
+ return;
307
+ }
308
+ // Close popup when clicking outside the editor
309
+ const onClick = (e: MouseEvent) => {
310
+ const rootElement = activeEditor.getRootElement()?.parentElement;
311
+ const target = e.target as Element | null;
312
+ const isClickOutside = !!rootElement && target?.checkVisibility() && !rootElement.contains(target);
313
+
314
+ isClickOutside && setIsLink(false);
315
+ };
316
+
317
+ document.addEventListener('click', onClick);
318
+ return () => document.removeEventListener('click', onClick);
319
+ }, [isLink, activeEditor]);
320
+
304
321
  return isLink
305
322
  ? createPortal(
306
323
  <FloatingLinkEditor editor={activeEditor} isLink={isLink} anchorElem={anchorElem} setIsLink={setIsLink} />,
@@ -16,13 +16,13 @@ const switchStyles = cva(['c-switch-root'], {
16
16
  });
17
17
 
18
18
  export type CustomSwitchProps = SwitchStylesProps &
19
- Exclude<SwitchProps, 'checked'> & {
19
+ Omit<SwitchProps, 'checked'> & {
20
20
  checked?: boolean | null;
21
21
  };
22
22
 
23
23
  export function Switch({ size, checked, ...props }: CustomSwitchProps) {
24
24
  return (
25
- <RadixSwitch.Root {...props} checked={checked} className={switchStyles({ size })}>
25
+ <RadixSwitch.Root {...props} checked={checked === null ? false : checked} className={switchStyles({ size })}>
26
26
  <RadixSwitch.Thumb className={cx('c-switch-thumb', checked === null ? 'middle-position' : '')} />
27
27
  </RadixSwitch.Root>
28
28
  );