@crisp-ui-kit/crisp 0.54.2 → 0.54.3

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.
Files changed (74) hide show
  1. package/dist/chip.css +7 -1
  2. package/dist/chip.d.ts +2 -1
  3. package/dist/chip.layered.css +7 -1
  4. package/dist/cjs/components/chip/chip.js +3 -2
  5. package/dist/cjs/components/chip/chip.recipe.js +37 -1
  6. package/dist/cjs/components/datatable/datatable.js +489 -111
  7. package/dist/cjs/components/emptystate/emptystate.js +3 -2
  8. package/dist/cjs/components/emptystate/emptystate.recipe.js +26 -1
  9. package/dist/cjs/components/personchip/index.js +17 -0
  10. package/dist/cjs/components/personchip/personchip.js +50 -0
  11. package/dist/cjs/components/table/table.js +2 -2
  12. package/dist/cjs/components/tabs/tabs.js +2 -2
  13. package/dist/cjs/components/tabs/tabs.recipe.js +30 -3
  14. package/dist/cjs/components/text/index.js +7 -0
  15. package/dist/cjs/components/text/text.js +55 -0
  16. package/dist/cjs/components/text/text.recipe.js +34 -0
  17. package/dist/cjs/index.js +2 -0
  18. package/dist/cjs/product/headerbar/headerbar.recipe.js +9 -1
  19. package/dist/cjs/product/recordpage/recordpage.recipe.js +10 -1
  20. package/dist/cjs/product/recordstable/recordstable.js +89 -6
  21. package/dist/cjs/product/richtext/richtext.recipe.js +26 -1
  22. package/dist/emptystate.css +15 -1
  23. package/dist/emptystate.d.ts +2 -2
  24. package/dist/emptystate.layered.css +15 -1
  25. package/dist/esm/components/chip/chip.js +3 -2
  26. package/dist/esm/components/chip/chip.recipe.js +37 -1
  27. package/dist/esm/components/datatable/datatable.js +488 -111
  28. package/dist/esm/components/emptystate/emptystate.js +4 -3
  29. package/dist/esm/components/emptystate/emptystate.recipe.js +26 -1
  30. package/dist/esm/components/emptystate/index.js +1 -1
  31. package/dist/esm/components/personchip/index.js +1 -0
  32. package/dist/esm/components/personchip/personchip.js +47 -0
  33. package/dist/esm/components/table/table.js +2 -2
  34. package/dist/esm/components/tabs/tabs.js +2 -2
  35. package/dist/esm/components/tabs/tabs.recipe.js +30 -3
  36. package/dist/esm/components/text/index.js +2 -0
  37. package/dist/esm/components/text/text.js +19 -0
  38. package/dist/esm/components/text/text.recipe.js +31 -0
  39. package/dist/esm/index.js +2 -0
  40. package/dist/esm/product/headerbar/headerbar.recipe.js +9 -1
  41. package/dist/esm/product/recordpage/recordpage.recipe.js +10 -1
  42. package/dist/esm/product/recordstable/recordstable.js +90 -8
  43. package/dist/esm/product/richtext/richtext.recipe.js +26 -1
  44. package/dist/headerbar.css +1 -1
  45. package/dist/headerbar.layered.css +1 -1
  46. package/dist/recordpage.css +13 -2
  47. package/dist/recordpage.layered.css +13 -2
  48. package/dist/richtext.css +11 -1
  49. package/dist/richtext.layered.css +11 -1
  50. package/dist/styles.css +64 -7
  51. package/dist/styles.layered.css +64 -7
  52. package/dist/tabs.css +7 -1
  53. package/dist/tabs.d.ts +2 -2
  54. package/dist/tabs.layered.css +7 -1
  55. package/dist/text.css +9 -0
  56. package/dist/text.d.ts +7 -0
  57. package/dist/text.layered.css +11 -0
  58. package/dist/types/components/chip/chip.d.ts +32 -0
  59. package/dist/types/components/chip/chip.recipe.d.ts +31 -0
  60. package/dist/types/components/datatable/datatable.d.ts +28 -4
  61. package/dist/types/components/emptystate/emptystate.d.ts +29 -4
  62. package/dist/types/components/emptystate/emptystate.recipe.d.ts +2 -0
  63. package/dist/types/components/emptystate/index.d.ts +1 -1
  64. package/dist/types/components/personchip/index.d.ts +1 -0
  65. package/dist/types/components/personchip/personchip.d.ts +37 -0
  66. package/dist/types/components/table/table.d.ts +36 -0
  67. package/dist/types/components/tabs/tabs.d.ts +4 -2
  68. package/dist/types/components/tabs/tabs.recipe.d.ts +18 -3
  69. package/dist/types/components/text/index.d.ts +2 -0
  70. package/dist/types/components/text/text.d.ts +32 -0
  71. package/dist/types/components/text/text.recipe.d.ts +40 -0
  72. package/dist/types/index.d.ts +2 -0
  73. package/dist/types/product/recordstable/recordstable.d.ts +24 -2
  74. package/package.json +11 -1
package/dist/chip.css CHANGED
@@ -1,5 +1,11 @@
1
1
  .crisp-chip {
2
- display: inline-flex; align-items: center; height: var(--crisp-size-chip); padding-inline: var(--crisp-space-1); border-radius: var(--crisp-radius-chip); font-size: var(--crisp-text-lg); line-height: 20px; font-weight: var(--crisp-weight-medium); white-space: nowrap;
2
+ display: inline-flex; align-items: center; gap: 3px; height: var(--crisp-size-chip); min-width: 0; padding-inline: var(--crisp-space-1); border-radius: var(--crisp-radius-chip); font-size: var(--crisp-text-lg); line-height: 20px; font-weight: var(--crisp-weight-medium); white-space: nowrap;
3
+ }
4
+ .crisp-chip--truncate_true {
5
+ & .crisp-chip-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
6
+ }
7
+ .crisp-chip--truncate_false {
8
+
3
9
  }
4
10
  .crisp-chip--tone_neutral {
5
11
  background: color-mix(in srgb, var(--crisp-fg-primary) 6%, transparent); color: color-mix(in srgb, var(--crisp-fg-primary) 82%, transparent); box-shadow: inset 0 0 0 1px var(--crisp-border-subtle);
package/dist/chip.d.ts CHANGED
@@ -1,7 +1,8 @@
1
1
  import type { RecipeFn } from "../core/types";
2
2
 
3
3
  export interface ChipVariants {
4
+ truncate?: boolean;
4
5
  tone?: "neutral" | "brand" | "success" | "warning" | "danger" | "purple" | "cyan" | "orange";
5
6
  }
6
7
 
7
- export declare const chipRecipe: RecipeFn<{ tone: { neutral: string; brand: string; success: string; warning: string; danger: string; purple: string; cyan: string; orange: string } }>;
8
+ export declare const chipRecipe: RecipeFn<{ truncate: { true: string; false: string }; tone: { neutral: string; brand: string; success: string; warning: string; danger: string; purple: string; cyan: string; orange: string } }>;
@@ -1,6 +1,12 @@
1
1
  @layer crisp-components {
2
2
  .crisp-chip {
3
- display: inline-flex; align-items: center; height: var(--crisp-size-chip); padding-inline: var(--crisp-space-1); border-radius: var(--crisp-radius-chip); font-size: var(--crisp-text-lg); line-height: 20px; font-weight: var(--crisp-weight-medium); white-space: nowrap;
3
+ display: inline-flex; align-items: center; gap: 3px; height: var(--crisp-size-chip); min-width: 0; padding-inline: var(--crisp-space-1); border-radius: var(--crisp-radius-chip); font-size: var(--crisp-text-lg); line-height: 20px; font-weight: var(--crisp-weight-medium); white-space: nowrap;
4
+ }
5
+ .crisp-chip--truncate_true {
6
+ & .crisp-chip-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
7
+ }
8
+ .crisp-chip--truncate_false {
9
+
4
10
  }
5
11
  .crisp-chip--tone_neutral {
6
12
  background: color-mix(in srgb, var(--crisp-fg-primary) 6%, transparent); color: color-mix(in srgb, var(--crisp-fg-primary) 82%, transparent); box-shadow: inset 0 0 0 1px var(--crisp-border-subtle);
@@ -52,7 +52,8 @@ const chip_recipe_1 = require("./chip.recipe");
52
52
  * that surface can be measured; don't guess the icon, its hit target, or its
53
53
  * spacing from the label.
54
54
  */
55
- exports.Chip = React.forwardRef(({ tone, className, asChild, children, ...props }, ref) => {
56
- return ((0, jsx_runtime_1.jsx)(core_1.Primitive.span, { ref: ref, asChild: asChild, className: (0, chip_recipe_1.chipRecipe)({ tone, className }), ...props, children: children }));
55
+ exports.Chip = React.forwardRef(({ tone, truncate, className, asChild, children, ...props }, ref) => {
56
+ const content = truncate && !asChild && typeof children === "string" ? ((0, jsx_runtime_1.jsx)("span", { className: "crisp-chip-label", children: children })) : (children);
57
+ return ((0, jsx_runtime_1.jsx)(core_1.Primitive.span, { ref: ref, asChild: asChild, className: (0, chip_recipe_1.chipRecipe)({ tone, truncate, className }), ...props, children: content }));
57
58
  });
58
59
  exports.Chip.displayName = "Chip";
@@ -20,7 +20,16 @@ const spec = (0, core_1.defineSpec)({
20
20
  base: {
21
21
  display: "inline-flex",
22
22
  alignItems: "center",
23
+ // Measured on Attio's own multi-child chip (Tasks page, "Assigned to"
24
+ // column: a 16px avatar + name in a neutral chip) -- the 3px gap between
25
+ // them. A single plain-text child (the only case before PersonChip) is
26
+ // unaffected, since `gap` does nothing with one flex child.
27
+ gap: "3px",
23
28
  height: tokens_1.contract.size.chip,
29
+ // Lets the chip shrink below its content width inside a flex/grid cell
30
+ // -- `inline-flex` items don't by default -- which `truncate` below
31
+ // depends on and any consumer constraining a Chip's width already needs.
32
+ minWidth: 0,
24
33
  paddingInline: tokens_1.contract.space["1"],
25
34
  borderRadius: tokens_1.contract.radius.chip,
26
35
  fontSize: tokens_1.contract.text.lg,
@@ -29,6 +38,33 @@ const spec = (0, core_1.defineSpec)({
29
38
  whiteSpace: "nowrap",
30
39
  },
31
40
  variants: {
41
+ truncate: {
42
+ // Ellipsis + `min-width: 0`, the same convention crisp's own
43
+ // `.crisp-datatable-entity-name`/`.crisp-datatable-th-label` already
44
+ // use for cramped text -- there is no single-overflowing-chip pattern
45
+ // to measure from Attio itself (its multi-value fields show a "+N"
46
+ // badge instead of truncating one chip's own text: Categories,
47
+ // Companies). Targets `.crisp-chip-label`, the inner span `Chip`
48
+ // wraps its string children in when `truncate` is set, not the root
49
+ // -- the root stays a flex row so a leading icon/avatar never shrinks
50
+ // alongside the text.
51
+ true: {
52
+ decls: {},
53
+ parts: [
54
+ {
55
+ selector: "& .crisp-chip-label",
56
+ decls: {
57
+ minWidth: 0,
58
+ overflow: "hidden",
59
+ textOverflow: "ellipsis",
60
+ whiteSpace: "nowrap",
61
+ display: "block",
62
+ },
63
+ },
64
+ ],
65
+ },
66
+ false: {},
67
+ },
32
68
  tone: {
33
69
  neutral: {
34
70
  background: soft(tokens_1.contract.fgPrimary, 6),
@@ -72,7 +108,7 @@ const spec = (0, core_1.defineSpec)({
72
108
  },
73
109
  },
74
110
  },
75
- defaultVariants: { tone: "neutral" },
111
+ defaultVariants: { tone: "neutral", truncate: false },
76
112
  });
77
113
  exports.spec = spec;
78
114
  const config = (0, core_1.specToRecipe)(spec);