@crystallize/design-system 1.23.3 → 1.23.4

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,11 @@
1
1
  # @crystallize/design-system
2
2
 
3
+ ## 1.23.4
4
+
5
+ ### Patch Changes
6
+
7
+ - c7278f8: Add a new prop to Tag component to show remove button on hover.
8
+
3
9
  ## 1.23.3
4
10
 
5
11
  ### Patch Changes
@@ -712,13 +712,11 @@ var Caret = forwardRef13((delegated, ref) => {
712
712
  ref,
713
713
  width: "8",
714
714
  height: "8",
715
- viewBox: "0 0 17 15",
715
+ viewBox: "0 0 8 8",
716
716
  fill: "none",
717
717
  ...delegated,
718
718
  children: /* @__PURE__ */ jsx19("path", {
719
- d: "M15.463 1.2L8.5 12.685 1.537 1.2h13.925zM1.353.896s0 0 0 0h0z",
720
- stroke: "#5B5178",
721
- strokeWidth: 2.4
719
+ d: "M4.36763 6.81306C4.21367 7.07973 3.82877 7.07973 3.67481 6.81306L0.921902 2.04489C0.767942 1.77822 0.960391 1.44489 1.26831 1.44489L6.77412 1.44489C7.08204 1.44489 7.27449 1.77822 7.12053 2.04489L4.36763 6.81306Z"
722
720
  })
723
721
  });
724
722
  });
package/dist/index.css CHANGED
@@ -1763,6 +1763,26 @@
1763
1763
  white-space: nowrap;
1764
1764
  border-width: 0;
1765
1765
  }
1766
+ .c-tag__remove-button--hover {
1767
+ opacity: 0;
1768
+ transition-property:
1769
+ color,
1770
+ background-color,
1771
+ border-color,
1772
+ text-decoration-color,
1773
+ fill,
1774
+ stroke,
1775
+ opacity,
1776
+ box-shadow,
1777
+ transform,
1778
+ filter,
1779
+ backdrop-filter;
1780
+ transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
1781
+ transition-duration: 150ms;
1782
+ }
1783
+ .c-tag:hover .c-tag__remove-button--hover {
1784
+ opacity: 1;
1785
+ }
1766
1786
  .c-tag-default {
1767
1787
  --tw-border-opacity: 1;
1768
1788
  border-color: rgb(var(--c-color-gray-200-700) / var(--tw-border-opacity));
@@ -3421,8 +3441,6 @@
3421
3441
  /* src/switch/switch.css */
3422
3442
  .c-switch-root {
3423
3443
  position: relative;
3424
- height: 1.5rem;
3425
- width: 2.75rem;
3426
3444
  border-radius: 9999px;
3427
3445
  border-width: 1px;
3428
3446
  border-style: solid;
package/dist/index.d.ts CHANGED
@@ -322,8 +322,9 @@ declare const tagStyles: (props?: ({
322
322
  type TagProps = React.ComponentProps<'div'> & TagStylesProps & {
323
323
  prepend?: React.ReactNode;
324
324
  onRemove?: () => void;
325
+ showRemoveOnHover?: boolean;
325
326
  };
326
- declare function Tag({ children, className, variant, size, prepend, onRemove, ...delegated }: TagProps): JSX.Element;
327
+ declare function Tag({ children, className, variant, size, prepend, onRemove, showRemoveOnHover, ...delegated }: TagProps): JSX.Element;
327
328
 
328
329
  declare const CODE_ALL_NAME_OPTIONS: {
329
330
  readonly javascript: "js";
package/dist/index.js CHANGED
@@ -910,13 +910,11 @@ var init_caret = __esm({
910
910
  ref,
911
911
  width: "8",
912
912
  height: "8",
913
- viewBox: "0 0 17 15",
913
+ viewBox: "0 0 8 8",
914
914
  fill: "none",
915
915
  ...delegated,
916
916
  children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", {
917
- d: "M15.463 1.2L8.5 12.685 1.537 1.2h13.925zM1.353.896s0 0 0 0h0z",
918
- stroke: "#5B5178",
919
- strokeWidth: 2.4
917
+ d: "M4.36763 6.81306C4.21367 7.07973 3.82877 7.07973 3.67481 6.81306L0.921902 2.04489C0.767942 1.77822 0.960391 1.44489 1.26831 1.44489L6.77412 1.44489C7.08204 1.44489 7.27449 1.77822 7.12053 2.04489L4.36763 6.81306Z"
920
918
  })
921
919
  });
922
920
  });
@@ -39705,7 +39703,16 @@ var tagStyles = (0, import_class_variance_authority19.cva)("c-tag", {
39705
39703
  size: "xs"
39706
39704
  }
39707
39705
  });
39708
- function Tag({ children, className, variant, size, prepend, onRemove, ...delegated }) {
39706
+ function Tag({
39707
+ children,
39708
+ className,
39709
+ variant,
39710
+ size,
39711
+ prepend,
39712
+ onRemove,
39713
+ showRemoveOnHover,
39714
+ ...delegated
39715
+ }) {
39709
39716
  return /* @__PURE__ */ (0, import_jsx_runtime129.jsxs)("div", {
39710
39717
  className: tagStyles({ className, variant, size }),
39711
39718
  ...delegated,
@@ -39717,7 +39724,7 @@ function Tag({ children, className, variant, size, prepend, onRemove, ...delegat
39717
39724
  children,
39718
39725
  onRemove && /* @__PURE__ */ (0, import_jsx_runtime129.jsxs)("button", {
39719
39726
  type: "button",
39720
- className: "c-tag__remove-button",
39727
+ className: (0, import_class_variance_authority19.cx)("c-tag__remove-button", showRemoveOnHover ? "c-tag__remove-button--hover" : ""),
39721
39728
  onClick: (e) => {
39722
39729
  e.stopPropagation();
39723
39730
  onRemove();
package/dist/index.mjs CHANGED
@@ -17,7 +17,7 @@ import {
17
17
  showError,
18
18
  showInfo,
19
19
  showWarning
20
- } from "./chunk-NT4RM5NK.mjs";
20
+ } from "./chunk-XAHDYFIZ.mjs";
21
21
  import "./chunk-NIH5ZMPE.mjs";
22
22
 
23
23
  // src/card/card.tsx
@@ -312,7 +312,7 @@ function StackIcon({ type, children, size = 18 }) {
312
312
  }
313
313
 
314
314
  // src/tag/tag.tsx
315
- import { cva as cva5 } from "class-variance-authority";
315
+ import { cva as cva5, cx as cx4 } from "class-variance-authority";
316
316
  import { jsx as jsx11, jsxs as jsxs6 } from "react/jsx-runtime";
317
317
  var tagStyles = cva5("c-tag", {
318
318
  variants: {
@@ -333,7 +333,16 @@ var tagStyles = cva5("c-tag", {
333
333
  size: "xs"
334
334
  }
335
335
  });
336
- function Tag({ children, className, variant, size, prepend, onRemove, ...delegated }) {
336
+ function Tag({
337
+ children,
338
+ className,
339
+ variant,
340
+ size,
341
+ prepend,
342
+ onRemove,
343
+ showRemoveOnHover,
344
+ ...delegated
345
+ }) {
337
346
  return /* @__PURE__ */ jsxs6("div", {
338
347
  className: tagStyles({ className, variant, size }),
339
348
  ...delegated,
@@ -345,7 +354,7 @@ function Tag({ children, className, variant, size, prepend, onRemove, ...delegat
345
354
  children,
346
355
  onRemove && /* @__PURE__ */ jsxs6("button", {
347
356
  type: "button",
348
- className: "c-tag__remove-button",
357
+ className: cx4("c-tag__remove-button", showRemoveOnHover ? "c-tag__remove-button--hover" : ""),
349
358
  onClick: (e) => {
350
359
  e.stopPropagation();
351
360
  onRemove();
@@ -368,7 +377,7 @@ function Tag({ children, className, variant, size, prepend, onRemove, ...delegat
368
377
  // src/rich-text-editor/index.tsx
369
378
  import { lazy, Suspense } from "react";
370
379
  import { jsx as jsx12 } from "react/jsx-runtime";
371
- var LazyRichTextEditor = lazy(() => import("./rich-text-editor-7QQ3AZED.mjs"));
380
+ var LazyRichTextEditor = lazy(() => import("./rich-text-editor-3M2LH5IE.mjs"));
372
381
  var RichTextEditor = (props) => {
373
382
  return /* @__PURE__ */ jsx12(Suspense, {
374
383
  fallback: null,
@@ -382,7 +391,7 @@ var RichTextEditor = (props) => {
382
391
  import { Toaster } from "sonner";
383
392
 
384
393
  // src/toast/toast.tsx
385
- import { cva as cva6, cx as cx4 } from "class-variance-authority";
394
+ import { cva as cva6, cx as cx5 } from "class-variance-authority";
386
395
  import { toast as sonnerToast } from "sonner";
387
396
  import { jsx as jsx13, jsxs as jsxs7 } from "react/jsx-runtime";
388
397
  var toastStyles = cva6("c-toast", {
@@ -411,7 +420,7 @@ var toast = ({ title, message, type = "success", timeout = 6e3 }) => {
411
420
  sonnerToast.custom(
412
421
  (id) => /* @__PURE__ */ jsxs7("div", {
413
422
  "data-testid": `toast-${type}`,
414
- className: cx4(toastStyles({ type }), withMessage ? "c-toast-with-message" : "c-toast-title-only"),
423
+ className: cx5(toastStyles({ type }), withMessage ? "c-toast-with-message" : "c-toast-title-only"),
415
424
  children: [
416
425
  /* @__PURE__ */ jsx13("div", {
417
426
  children: /* @__PURE__ */ jsx13(ToastIcon, {
@@ -6,7 +6,7 @@ import {
6
6
  Icon,
7
7
  IconButton,
8
8
  InputWithLabel
9
- } from "./chunk-NT4RM5NK.mjs";
9
+ } from "./chunk-XAHDYFIZ.mjs";
10
10
  import "./chunk-NIH5ZMPE.mjs";
11
11
 
12
12
  // src/rich-text-editor/rich-text-editor.tsx
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crystallize/design-system",
3
- "version": "1.23.3",
3
+ "version": "1.23.4",
4
4
  "types": "./dist/index.d.ts",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
@@ -6,8 +6,8 @@ type CaretRef = SVGSVGElement;
6
6
 
7
7
  export const Caret = forwardRef<CaretRef, CaretProps>((delegated, ref) => {
8
8
  return (
9
- <svg ref={ref} width="8" height="8" viewBox="0 0 17 15" fill="none" {...delegated}>
10
- <path d="M15.463 1.2L8.5 12.685 1.537 1.2h13.925zM1.353.896s0 0 0 0h0z" stroke="#5B5178" strokeWidth={2.4} />
9
+ <svg ref={ref} width="8" height="8" viewBox="0 0 8 8" fill="none" {...delegated}>
10
+ <path d="M4.36763 6.81306C4.21367 7.07973 3.82877 7.07973 3.67481 6.81306L0.921902 2.04489C0.767942 1.77822 0.960391 1.44489 1.26831 1.44489L6.77412 1.44489C7.08204 1.44489 7.27449 1.77822 7.12053 2.04489L4.36763 6.81306Z" />
11
11
  </svg>
12
12
  );
13
13
  });
@@ -1,5 +1,5 @@
1
1
  .c-switch-root {
2
- @apply relative h-6 w-11 rounded-full border border-solid border-purple-200-700 bg-purple-50-900 pl-0.5 transition-all hover:border-purple-300-600 focus:outline-none enabled:cursor-pointer disabled:opacity-40 data-[state=checked]:border-green-400-500 data-[state=checked]:bg-cyan-100-800;
2
+ @apply relative rounded-full border border-solid border-purple-200-700 bg-purple-50-900 pl-0.5 transition-all hover:border-purple-300-600 focus:outline-none enabled:cursor-pointer disabled:opacity-40 data-[state=checked]:border-green-400-500 data-[state=checked]:bg-cyan-100-800;
3
3
 
4
4
  &-sm {
5
5
  @apply h-6 w-11;
package/src/tag/tag.css CHANGED
@@ -14,6 +14,16 @@
14
14
  &__remove-button-text {
15
15
  @apply sr-only;
16
16
  }
17
+
18
+ &__remove-button--hover {
19
+ @apply opacity-0 transition;
20
+ }
21
+
22
+ &:hover {
23
+ .c-tag__remove-button--hover {
24
+ @apply opacity-100;
25
+ }
26
+ }
17
27
  }
18
28
 
19
29
  .c-tag-default {
package/src/tag/tag.tsx CHANGED
@@ -1,4 +1,4 @@
1
- import { cva, VariantProps } from 'class-variance-authority';
1
+ import { cva, VariantProps, cx } from 'class-variance-authority';
2
2
 
3
3
  import { Icon } from '../iconography';
4
4
  import './tag.css';
@@ -28,9 +28,19 @@ export type TagProps = React.ComponentProps<'div'> &
28
28
  TagStylesProps & {
29
29
  prepend?: React.ReactNode;
30
30
  onRemove?: () => void;
31
+ showRemoveOnHover?: boolean;
31
32
  };
32
33
 
33
- export function Tag({ children, className, variant, size, prepend, onRemove, ...delegated }: TagProps) {
34
+ export function Tag({
35
+ children,
36
+ className,
37
+ variant,
38
+ size,
39
+ prepend,
40
+ onRemove,
41
+ showRemoveOnHover,
42
+ ...delegated
43
+ }: TagProps) {
34
44
  return (
35
45
  <div className={tagStyles({ className, variant, size })} {...delegated}>
36
46
  {!prepend ? null : <span className="c-tag__prepend">{prepend}</span>}
@@ -38,7 +48,7 @@ export function Tag({ children, className, variant, size, prepend, onRemove, ...
38
48
  {onRemove && (
39
49
  <button
40
50
  type="button"
41
- className="c-tag__remove-button"
51
+ className={cx('c-tag__remove-button', showRemoveOnHover ? 'c-tag__remove-button--hover' : '')}
42
52
  onClick={e => {
43
53
  e.stopPropagation();
44
54
  onRemove();