datocms-react-ui 3.1.0-next.3 → 3.1.0-next.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/dist/styles.css CHANGED
@@ -3073,6 +3073,22 @@ textarea:focus {
3073
3073
  border-bottom: 0;
3074
3074
  }
3075
3075
  }
3076
+ /* The whole strip opens and closes the group, not only the title: the
3077
+ toggle stretches over the header, and the actions stay above it. */
3078
+ .Page__group__header--collapsible {
3079
+ position: relative;
3080
+
3081
+ .Page__collapseToggle:not(:disabled)::after {
3082
+ position: absolute;
3083
+ inset: 0;
3084
+ content: "";
3085
+ }
3086
+
3087
+ .Page__group__actions {
3088
+ position: relative;
3089
+ z-index: 1;
3090
+ }
3091
+ }
3076
3092
  .Page__group__title {
3077
3093
  flex: 1;
3078
3094
  min-width: 0;
@@ -3081,6 +3097,11 @@ textarea:focus {
3081
3097
  font-weight: var(--font-weight-strong);
3082
3098
  line-height: 1.2;
3083
3099
  }
3100
+ .Page__group__count {
3101
+ margin-left: var(--spacing-s);
3102
+ font-weight: var(--font-weight-regular);
3103
+ color: var(--color--ink-subtle);
3104
+ }
3084
3105
  .Page__group__actions {
3085
3106
  display: flex;
3086
3107
  flex: none;
@@ -38,6 +38,11 @@ export type PageGroupProps = {
38
38
  * step that is done in a wizard).
39
39
  */
40
40
  status?: React.ReactNode;
41
+ /**
42
+ * A number after the title, for example the number of rows of a closed
43
+ * group. The group does not show it when it is 0.
44
+ */
45
+ count?: number;
41
46
  /**
42
47
  * The body has no padding. Use it for a Table or a CardList: its rows go
43
48
  * from edge to edge of the card. Put the other parts of the body in a
@@ -61,7 +66,7 @@ export type PageGroupProps = {
61
66
  * more than one part (for example a summary and a chart), so the parts read
62
67
  * as one thing. The parts inside the card have no card of their own.
63
68
  */
64
- export declare function PageGroup({ title, titleLevel, actions, footer, tone, status, flush, children, className, id, collapse, }: PageGroupProps): React.JSX.Element;
69
+ export declare function PageGroup({ title, titleLevel, actions, footer, tone, status, count, flush, children, className, id, collapse, }: PageGroupProps): React.JSX.Element;
65
70
  export type PageGroupInsetProps = {
66
71
  children: React.ReactNode;
67
72
  className?: string;
@@ -12,22 +12,26 @@ import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
12
12
  * more than one part (for example a summary and a chart), so the parts read
13
13
  * as one thing. The parts inside the card have no card of their own.
14
14
  */
15
- function PageGroup({ title, titleLevel = 2, actions, footer, tone, status, flush, children, className, id, collapse }) {
15
+ function PageGroup({ title, titleLevel = 2, actions, footer, tone, status, count, flush, children, className, id, collapse }) {
16
16
  const { tc } = useTranslation();
17
17
  const open = collapse ? collapse.open : true;
18
+ const titleContent = /* @__PURE__ */ jsxs(Fragment$1, { children: [tc(title), count !== void 0 && count > 0 && /* @__PURE__ */ jsx("span", {
19
+ className: "Page__group__count",
20
+ children: count
21
+ })] });
18
22
  return /* @__PURE__ */ jsxs("div", {
19
23
  className: classNames("Page__group", { [`Page__group--${tone}`]: tone }, className),
20
24
  id,
21
25
  children: [/* @__PURE__ */ jsxs("header", {
22
- className: "Page__group__header",
26
+ className: classNames("Page__group__header", { "Page__group__header--collapsible": collapse }),
23
27
  children: [
24
28
  /* @__PURE__ */ jsx(Heading, {
25
29
  level: titleLevel,
26
30
  className: "Page__group__title",
27
31
  children: collapse ? /* @__PURE__ */ jsx(PageCollapseToggle, {
28
32
  collapse,
29
- children: tc(title)
30
- }) : tc(title)
33
+ children: titleContent
34
+ }) : titleContent
31
35
  }),
32
36
  status,
33
37
  actions && /* @__PURE__ */ jsx("div", {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "datocms-react-ui",
3
- "version": "3.1.0-next.3",
3
+ "version": "3.1.0-next.4",
4
4
  "description": "React components to use inside DatoCMS plugins",
5
5
  "keywords": [
6
6
  "datocms",