@crystallize/design-system 1.21.1 → 1.22.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.22.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 497d580: Change toast component data-testid to include the toast type so we can use that to assert on it.
8
+
9
+ ## 1.21.2
10
+
11
+ ### Patch Changes
12
+
13
+ - 2ad694c: Extend the Tag component to support `xxs` size.
14
+
3
15
  ## 1.21.1
4
16
 
5
17
  ### Patch Changes
@@ -5674,18 +5674,14 @@ function confirm(config) {
5674
5674
  const container = document.createDocumentFragment();
5675
5675
  let currentConfig = { ...config, close, open: true };
5676
5676
  let timeoutId;
5677
- function close(...args) {
5677
+ function close() {
5678
5678
  currentConfig = {
5679
5679
  ...currentConfig,
5680
- open: false,
5681
- afterClose: () => {
5682
- if (typeof config.afterClose === "function") {
5683
- config.afterClose();
5684
- }
5685
- destroy.apply(this, args);
5686
- }
5680
+ open: false
5687
5681
  };
5688
5682
  render(currentConfig);
5683
+ config.afterClose?.();
5684
+ destroy();
5689
5685
  }
5690
5686
  function destroy(...args) {
5691
5687
  const triggerCancel = args.some((param) => param && param.triggerCancel);
package/dist/index.css CHANGED
@@ -1773,6 +1773,13 @@
1773
1773
  var(--tw-ring-shadow, 0 0 #0000),
1774
1774
  var(--tw-shadow);
1775
1775
  }
1776
+ .c-tag-xxs {
1777
+ height: 1.25rem;
1778
+ padding-left: 0.5rem;
1779
+ padding-right: 0.5rem;
1780
+ font-size: 0.75rem;
1781
+ line-height: 1rem;
1782
+ }
1776
1783
  .c-tag-xs {
1777
1784
  height: 1.5rem;
1778
1785
  padding-left: 0.5rem;
@@ -2294,7 +2301,6 @@
2294
2301
  margin: 0px auto;
2295
2302
  position: relative;
2296
2303
  line-height: 1.7;
2297
- --c-rte-min-height: 150px;
2298
2304
  }
2299
2305
  .c-rich-text-editor > * {
2300
2306
  box-sizing: border-box;
@@ -2321,7 +2327,7 @@
2321
2327
  color: rgb(var(--c-color-gray-900-50) / var(--tw-text-opacity));
2322
2328
  }
2323
2329
  .c-rich-text-editor .c-rte-editor-scroller {
2324
- min-height: var(--c-rte-min-height);
2330
+ min-height: var(--c-rte-min-height, 150px);
2325
2331
  border: 0;
2326
2332
  resize: none;
2327
2333
  cursor: text;
@@ -2436,7 +2442,6 @@
2436
2442
  .c-rich-text-editor .c-rte-placeholder {
2437
2443
  pointer-events: none;
2438
2444
  position: absolute;
2439
- left: 1.5rem;
2440
2445
  right: 2.5rem;
2441
2446
  top: 0px;
2442
2447
  display: inline-block;
@@ -2449,6 +2454,7 @@
2449
2454
  --tw-text-opacity: 1;
2450
2455
  color: rgb(var(--c-color-gray-300-600) / var(--tw-text-opacity));
2451
2456
  font-style: italic;
2457
+ left: var(--c-rte-content-pl, 1.5rem);
2452
2458
  }
2453
2459
  @keyframes CursorBlink {
2454
2460
  to {
@@ -2469,7 +2475,7 @@
2469
2475
  outline-width: 0px;
2470
2476
  tab-size: 1;
2471
2477
  padding-bottom: 8px;
2472
- min-height: calc(var(--c-rte-min-height) - 8px);
2478
+ min-height: calc(var(--c-rte-min-height, 150px) - 8px);
2473
2479
  padding-top: var(--c-rte-content-pt, 0);
2474
2480
  padding-left: var(--c-rte-content-pl, 1.5rem);
2475
2481
  padding-right: var(--c-rte-content-pr, 1.5rem);
package/dist/index.d.ts CHANGED
@@ -203,23 +203,23 @@ declare namespace DialogBase {
203
203
  type DialogType = typeof DialogBase & DialogFuncProps;
204
204
  declare const Dialog: DialogType;
205
205
  declare function showDialog(delegated: DialogFuncProps): {
206
- destroy: (...args: any[]) => void;
206
+ destroy: () => void;
207
207
  update: (configUpdate: ConfigUpdate) => void;
208
208
  };
209
209
  declare function showWarning(delegated: DialogFuncProps): {
210
- destroy: (...args: any[]) => void;
210
+ destroy: () => void;
211
211
  update: (configUpdate: ConfigUpdate) => void;
212
212
  };
213
213
  declare function showConfirm(delegated: DialogFuncProps): {
214
- destroy: (...args: any[]) => void;
214
+ destroy: () => void;
215
215
  update: (configUpdate: ConfigUpdate) => void;
216
216
  };
217
217
  declare function showError(delegated: DialogFuncProps): {
218
- destroy: (...args: any[]) => void;
218
+ destroy: () => void;
219
219
  update: (configUpdate: ConfigUpdate) => void;
220
220
  };
221
221
  declare function showInfo(delegated: DialogFuncProps): {
222
- destroy: (...args: any[]) => void;
222
+ destroy: () => void;
223
223
  update: (configUpdate: ConfigUpdate) => void;
224
224
  };
225
225
  declare function destroyAll(): void;
@@ -316,7 +316,7 @@ declare function StackIcon({ type, children, size }: StackIconProps): JSX.Elemen
316
316
  type TagStylesProps = VariantProps<typeof tagStyles>;
317
317
  declare const tagStyles: (props?: ({
318
318
  variant?: "default" | "elevate" | null | undefined;
319
- size?: "xs" | "sm" | "md" | "lg" | null | undefined;
319
+ size?: "xs" | "sm" | "md" | "lg" | "xxs" | null | undefined;
320
320
  } & class_variance_authority_dist_types.ClassProp) | undefined) => string;
321
321
  type TagProps = React.ComponentProps<'div'> & TagStylesProps & {
322
322
  prepend?: React.ReactNode;
package/dist/index.js CHANGED
@@ -6540,18 +6540,14 @@ function confirm(config) {
6540
6540
  const container = document.createDocumentFragment();
6541
6541
  let currentConfig = { ...config, close, open: true };
6542
6542
  let timeoutId;
6543
- function close(...args) {
6543
+ function close() {
6544
6544
  currentConfig = {
6545
6545
  ...currentConfig,
6546
- open: false,
6547
- afterClose: () => {
6548
- if (typeof config.afterClose === "function") {
6549
- config.afterClose();
6550
- }
6551
- destroy.apply(this, args);
6552
- }
6546
+ open: false
6553
6547
  };
6554
6548
  render(currentConfig);
6549
+ config.afterClose?.();
6550
+ destroy();
6555
6551
  }
6556
6552
  function destroy(...args) {
6557
6553
  const triggerCancel = args.some((param) => param && param.triggerCancel);
@@ -39117,6 +39113,7 @@ function RichTextEditorWithoutContext({
39117
39113
  slotPreContent,
39118
39114
  /* @__PURE__ */ (0, import_jsx_runtime142.jsxs)("div", {
39119
39115
  className: `c-rte-editor-container ${disabled ? "disabled" : ""}`,
39116
+ "data-testid": "rich-text-editor",
39120
39117
  children: [
39121
39118
  maxLength != null ? /* @__PURE__ */ (0, import_jsx_runtime142.jsx)(MaxLengthPlugin, {
39122
39119
  maxLength
@@ -39579,6 +39576,7 @@ var tagStyles = (0, import_class_variance_authority19.cva)("c-tag", {
39579
39576
  elevate: "c-tag-elevate"
39580
39577
  },
39581
39578
  size: {
39579
+ xxs: "c-tag-xxs",
39582
39580
  xs: "c-tag-xs",
39583
39581
  sm: "c-tag-sm",
39584
39582
  md: "c-tag-md",
@@ -39669,7 +39667,7 @@ var toast = ({ title, message, type = "success", timeout = 6e3 }) => {
39669
39667
  const toastId = Date.now().toString();
39670
39668
  import_sonner.toast.custom(
39671
39669
  (id) => /* @__PURE__ */ (0, import_jsx_runtime144.jsxs)("div", {
39672
- "data-testid": "toast-content",
39670
+ "data-testid": `toast-${type}`,
39673
39671
  className: (0, import_class_variance_authority20.cx)(toastStyles({ type }), withMessage ? "c-toast-with-message" : "c-toast-title-only"),
39674
39672
  children: [
39675
39673
  /* @__PURE__ */ (0, import_jsx_runtime144.jsx)("div", {
package/dist/index.mjs CHANGED
@@ -17,7 +17,7 @@ import {
17
17
  showError,
18
18
  showInfo,
19
19
  showWarning
20
- } from "./chunk-QVHGXWBD.mjs";
20
+ } from "./chunk-PB47BT3T.mjs";
21
21
  import "./chunk-NIH5ZMPE.mjs";
22
22
 
23
23
  // src/card/card.tsx
@@ -321,6 +321,7 @@ var tagStyles = cva5("c-tag", {
321
321
  elevate: "c-tag-elevate"
322
322
  },
323
323
  size: {
324
+ xxs: "c-tag-xxs",
324
325
  xs: "c-tag-xs",
325
326
  sm: "c-tag-sm",
326
327
  md: "c-tag-md",
@@ -367,7 +368,7 @@ function Tag({ children, className, variant, size, prepend, onRemove, ...delegat
367
368
  // src/rich-text-editor/index.tsx
368
369
  import { lazy, Suspense } from "react";
369
370
  import { jsx as jsx12 } from "react/jsx-runtime";
370
- var LazyRichTextEditor = lazy(() => import("./rich-text-editor-VCJEH7QE.mjs"));
371
+ var LazyRichTextEditor = lazy(() => import("./rich-text-editor-UNPP4LX5.mjs"));
371
372
  var RichTextEditor = (props) => {
372
373
  return /* @__PURE__ */ jsx12(Suspense, {
373
374
  fallback: null,
@@ -409,7 +410,7 @@ var toast = ({ title, message, type = "success", timeout = 6e3 }) => {
409
410
  const toastId = Date.now().toString();
410
411
  sonnerToast.custom(
411
412
  (id) => /* @__PURE__ */ jsxs7("div", {
412
- "data-testid": "toast-content",
413
+ "data-testid": `toast-${type}`,
413
414
  className: cx4(toastStyles({ type }), withMessage ? "c-toast-with-message" : "c-toast-title-only"),
414
415
  children: [
415
416
  /* @__PURE__ */ jsx13("div", {
@@ -490,7 +490,6 @@
490
490
  margin: 0px auto;
491
491
  position: relative;
492
492
  line-height: 1.7;
493
- --c-rte-min-height: 150px;
494
493
  }
495
494
  .c-rich-text-editor > * {
496
495
  box-sizing: border-box;
@@ -517,7 +516,7 @@
517
516
  color: rgb(var(--c-color-gray-900-50) / var(--tw-text-opacity));
518
517
  }
519
518
  .c-rich-text-editor .c-rte-editor-scroller {
520
- min-height: var(--c-rte-min-height);
519
+ min-height: var(--c-rte-min-height, 150px);
521
520
  border: 0;
522
521
  resize: none;
523
522
  cursor: text;
@@ -632,7 +631,6 @@
632
631
  .c-rich-text-editor .c-rte-placeholder {
633
632
  pointer-events: none;
634
633
  position: absolute;
635
- left: 1.5rem;
636
634
  right: 2.5rem;
637
635
  top: 0px;
638
636
  display: inline-block;
@@ -645,6 +643,7 @@
645
643
  --tw-text-opacity: 1;
646
644
  color: rgb(var(--c-color-gray-300-600) / var(--tw-text-opacity));
647
645
  font-style: italic;
646
+ left: var(--c-rte-content-pl, 1.5rem);
648
647
  }
649
648
  @keyframes CursorBlink {
650
649
  to {
@@ -665,7 +664,7 @@
665
664
  outline-width: 0px;
666
665
  tab-size: 1;
667
666
  padding-bottom: 8px;
668
- min-height: calc(var(--c-rte-min-height) - 8px);
667
+ min-height: calc(var(--c-rte-min-height, 150px) - 8px);
669
668
  padding-top: var(--c-rte-content-pt, 0);
670
669
  padding-left: var(--c-rte-content-pl, 1.5rem);
671
670
  padding-right: var(--c-rte-content-pr, 1.5rem);
@@ -6,7 +6,7 @@ import {
6
6
  Icon,
7
7
  IconButton,
8
8
  InputWithLabel
9
- } from "./chunk-QVHGXWBD.mjs";
9
+ } from "./chunk-PB47BT3T.mjs";
10
10
  import "./chunk-NIH5ZMPE.mjs";
11
11
 
12
12
  // src/rich-text-editor/rich-text-editor.tsx
@@ -3164,6 +3164,7 @@ function RichTextEditorWithoutContext({
3164
3164
  slotPreContent,
3165
3165
  /* @__PURE__ */ jsxs10("div", {
3166
3166
  className: `c-rte-editor-container ${disabled ? "disabled" : ""}`,
3167
+ "data-testid": "rich-text-editor",
3167
3168
  children: [
3168
3169
  maxLength != null ? /* @__PURE__ */ jsx15(MaxLengthPlugin, {
3169
3170
  maxLength
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crystallize/design-system",
3
- "version": "1.21.1",
3
+ "version": "1.22.0",
4
4
  "types": "./dist/index.d.ts",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
@@ -73,9 +73,10 @@
73
73
  "@storybook/react": "7.6.2",
74
74
  "@storybook/react-vite": "7.6.2",
75
75
  "@storybook/theming": "7.6.2",
76
- "@testing-library/jest-dom": "6.1.5",
77
- "@testing-library/react": "14.1.2",
76
+ "@testing-library/jest-dom": "^5.16.4",
77
+ "@testing-library/react": "^12.1.2",
78
78
  "@testing-library/user-event": "14.5.1",
79
+ "@types/testing-library__jest-dom": "^5.14.5",
79
80
  "@types/prettier": "2.7.2",
80
81
  "@types/react": "17.0.1",
81
82
  "@types/react-dom": "17.0.1",
@@ -9,21 +9,15 @@ export function confirm(config: DialogFuncProps) {
9
9
  let currentConfig = { ...config, close, open: true };
10
10
  let timeoutId: NodeJS.Timeout;
11
11
 
12
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
13
- function close(...args: any[]) {
12
+ function close() {
14
13
  currentConfig = {
15
14
  ...currentConfig,
16
15
  open: false,
17
- afterClose: () => {
18
- if (typeof config.afterClose === 'function') {
19
- config.afterClose();
20
- }
21
-
22
- destroy.apply(this, args);
23
- },
24
16
  };
25
17
 
26
18
  render(currentConfig);
19
+ config.afterClose?.();
20
+ destroy();
27
21
  }
28
22
 
29
23
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -62,7 +62,6 @@ export type DialogFunc = (props: DialogFuncProps) => {
62
62
  export type ModalStaticFunctions = Record<NonNullable<DialogFuncProps['type']>, DialogFunc>;
63
63
 
64
64
  export interface ConfirmDialogProps extends DialogFuncProps {
65
- afterClose?: () => void;
66
65
  close: (...args: unknown[]) => void;
67
66
  autoFocusButton?: null | 'ok' | 'cancel';
68
67
  rootPrefixCls: string;
@@ -17,8 +17,6 @@
17
17
  position: relative;
18
18
  line-height: 1.7;
19
19
 
20
- --c-rte-min-height: 150px;
21
-
22
20
  > * {
23
21
  box-sizing: border-box;
24
22
  }
@@ -26,7 +24,7 @@
26
24
  @apply !font-sans font-normal text-gray-900-50;
27
25
 
28
26
  .c-rte-editor-scroller {
29
- min-height: var(--c-rte-min-height);
27
+ min-height: var(--c-rte-min-height, 150px);
30
28
  border: 0;
31
29
  resize: none;
32
30
  cursor: text;
@@ -148,8 +146,9 @@
148
146
  }
149
147
 
150
148
  .c-rte-placeholder {
151
- @apply pointer-events-none absolute left-6 right-10 top-0 inline-block select-none overflow-hidden text-ellipsis whitespace-nowrap text-[14px] font-normal text-gray-300-600;
149
+ @apply pointer-events-none absolute right-10 top-0 inline-block select-none overflow-hidden text-ellipsis whitespace-nowrap text-[14px] font-normal text-gray-300-600;
152
150
  font-style: italic;
151
+ left: var(--c-rte-content-pl, 1.5rem);
153
152
  }
154
153
 
155
154
  @keyframes CursorBlink {
@@ -163,7 +162,7 @@
163
162
  @apply relative block border-0 px-6 py-2 !pt-0 text-sm outline-0;
164
163
  tab-size: 1;
165
164
  padding-bottom: 8px;
166
- min-height: calc(var(--c-rte-min-height) - 8px);
165
+ min-height: calc(var(--c-rte-min-height, 150px) - 8px);
167
166
 
168
167
  /* Allow for customization from the outside */
169
168
  padding-top: var(--c-rte-content-pt, 0);
@@ -142,7 +142,7 @@ function RichTextEditorWithoutContext({
142
142
  actionsMenuAppend={actionsMenuAppend}
143
143
  />
144
144
  {slotPreContent}
145
- <div className={`c-rte-editor-container ${disabled ? 'disabled' : ''}`}>
145
+ <div className={`c-rte-editor-container ${disabled ? 'disabled' : ''}`} data-testid="rich-text-editor">
146
146
  {maxLength != null ? <MaxLengthPlugin maxLength={maxLength} /> : null}
147
147
  {!autoFocus ? null : <AutoFocusPlugin />}
148
148
  <ClearEditorPlugin />
package/src/tag/tag.css CHANGED
@@ -24,6 +24,10 @@
24
24
  @apply bg-elevate shadow;
25
25
  }
26
26
 
27
+ .c-tag-xxs {
28
+ @apply h-5 px-2 text-xs;
29
+ }
30
+
27
31
  .c-tag-xs {
28
32
  @apply h-6 px-2 text-xs;
29
33
  }
package/src/tag/tag.tsx CHANGED
@@ -11,6 +11,7 @@ const tagStyles = cva('c-tag', {
11
11
  elevate: 'c-tag-elevate',
12
12
  },
13
13
  size: {
14
+ xxs: 'c-tag-xxs',
14
15
  xs: 'c-tag-xs',
15
16
  sm: 'c-tag-sm',
16
17
  md: 'c-tag-md',
@@ -44,7 +44,7 @@ export const toast = ({ title, message, type = 'success', timeout = 6000 }: Toas
44
44
  sonnerToast.custom(
45
45
  id => (
46
46
  <div
47
- data-testid="toast-content"
47
+ data-testid={`toast-${type}`}
48
48
  className={cx(toastStyles({ type }), withMessage ? 'c-toast-with-message' : 'c-toast-title-only')}
49
49
  >
50
50
  <div>{<ToastIcon width={26} height={26} />}</div>