@temp-spotwork/ui 1.8.2 → 1.9.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.
@@ -1,6 +1,7 @@
1
1
  import { ReactNode } from 'react';
2
2
  import { AvatarProps } from '../../atoms/avatar';
3
3
  import { ButtonProps } from '../button';
4
+ import { GlyphColor } from '../../styles/colors/colormap';
4
5
  import { ProgressBarProps } from '../dataviz/progress-bar';
5
6
 
6
7
  export type CollapsibleCardProps = {
@@ -13,13 +14,22 @@ export type CollapsibleCardProps = {
13
14
  */
14
15
  setOpen: () => void;
15
16
  /**
16
- * The avatar to be displayed on the card (object).
17
+ * The avatar to be displayed on the card (object). Omit it when using `leadingContent` instead.
17
18
  */
18
- avatar: AvatarProps;
19
+ avatar?: AvatarProps;
20
+ /**
21
+ * Optional interactive content (e.g. a select-all checkbox) rendered before the title, in the
22
+ * avatar's place. Clicks inside it don't toggle the card open/closed.
23
+ */
24
+ leadingContent?: ReactNode;
19
25
  /**
20
26
  * The title of the card.
21
27
  */
22
28
  title: string;
29
+ /**
30
+ * Text color for the title. Defaults to 'active'.
31
+ */
32
+ titleColor?: GlyphColor;
23
33
  /**
24
34
  * An optional subtitle for the card.
25
35
  */
@@ -41,4 +51,4 @@ export type CollapsibleCardProps = {
41
51
  */
42
52
  expandedContent: ReactNode;
43
53
  };
44
- export declare function CollapsibleCard({ open, setOpen, avatar, title, subtitle, buttonGroup, dataViz, expandedContent, additionalHeaderRightSideContent, }: CollapsibleCardProps): import("react/jsx-runtime").JSX.Element;
54
+ export declare function CollapsibleCard({ open, setOpen, avatar, leadingContent, title, titleColor, subtitle, buttonGroup, dataViz, expandedContent, additionalHeaderRightSideContent, }: CollapsibleCardProps): import("react/jsx-runtime").JSX.Element;
@@ -1,21 +1,23 @@
1
1
  import { jsxs as r, jsx as e } from "react/jsx-runtime";
2
- import { Avatar as h } from "../../atoms/avatar/avatar.js";
3
- import { Icons as w } from "../../atoms/icons/icons.js";
2
+ import { Avatar as w } from "../../atoms/avatar/avatar.js";
3
+ import { Icons as x } from "../../atoms/icons/icons.js";
4
4
  import "../../atoms/icons/iconsSVGs/Large/Profile.js";
5
5
  import "../../atoms/icons/iconsSVGs/Small/Profile.js";
6
- import { Button as x } from "../button/button.js";
7
- import { Typography as c } from "../../styles/typography/typography.js";
8
- import { ProgressBar as p } from "../dataviz/progress-bar/progress-bar.js";
9
- function b({
10
- open: l,
11
- setOpen: i,
12
- avatar: d,
13
- title: n,
14
- subtitle: s,
15
- buttonGroup: o,
16
- dataViz: a,
17
- expandedContent: f,
18
- additionalHeaderRightSideContent: t
6
+ import { Button as v } from "../button/button.js";
7
+ import { Typography as n } from "../../styles/typography/typography.js";
8
+ import { ProgressBar as C } from "../dataviz/progress-bar/progress-bar.js";
9
+ function D({
10
+ open: i,
11
+ setOpen: o,
12
+ avatar: c,
13
+ leadingContent: m,
14
+ title: f,
15
+ titleColor: t = "active",
16
+ subtitle: a,
17
+ buttonGroup: s,
18
+ dataViz: d,
19
+ expandedContent: h,
20
+ additionalHeaderRightSideContent: p
19
21
  }) {
20
22
  return /* @__PURE__ */ r(
21
23
  "div",
@@ -27,24 +29,26 @@ function b({
27
29
  "div",
28
30
  {
29
31
  className: "flex flex-row gap-[1rem] items-center cursor-pointer min-w-0 grow",
30
- onClick: i,
32
+ onClick: o,
31
33
  children: [
32
- /* @__PURE__ */ e("div", { children: /* @__PURE__ */ e(h, { ...d }) }),
34
+ m && // The whole header toggles the card; stop clicks on interactive leading content from bubbling into it.
35
+ /* @__PURE__ */ e("div", { onClick: (l) => l.stopPropagation(), children: m }),
36
+ c && /* @__PURE__ */ e("div", { children: /* @__PURE__ */ e(w, { ...c }) }),
33
37
  /* @__PURE__ */ r("div", { className: "flex flex-col justify-between min-w-0", children: [
34
38
  /* @__PURE__ */ e(
35
- c,
39
+ n,
36
40
  {
37
41
  swStyle: 8,
38
- children: n,
39
- color: "active",
42
+ children: f,
43
+ color: t,
40
44
  className: "whitespace-nowrap overflow-hidden text-ellipsis"
41
45
  }
42
46
  ),
43
- s && !l && /* @__PURE__ */ e(
44
- c,
47
+ a && !i && /* @__PURE__ */ e(
48
+ n,
45
49
  {
46
50
  swStyle: 1,
47
- children: s,
51
+ children: a,
48
52
  color: "subdued",
49
53
  className: "whitespace-nowrap overflow-hidden text-ellipsis"
50
54
  }
@@ -54,34 +58,34 @@ function b({
54
58
  }
55
59
  ),
56
60
  /* @__PURE__ */ r("div", { className: "flex flex-row gap-[2rem] items-center flex-shrink-0", children: [
57
- t,
58
- !l && a && /* @__PURE__ */ e(
61
+ p,
62
+ !i && d && /* @__PURE__ */ e(
59
63
  "div",
60
64
  {
61
65
  className: "w-[16rem] flex-shrink-0 cursor-pointer",
62
- onClick: i,
63
- children: /* @__PURE__ */ e(p, { hasTotalCount: !0, ...a })
66
+ onClick: o,
67
+ children: /* @__PURE__ */ e(C, { hasTotalCount: !0, ...d })
64
68
  }
65
69
  ),
66
70
  /* @__PURE__ */ r("div", { className: "flex flex-row gap-[1rem]", children: [
67
- o == null ? void 0 : o.map((m) => /* @__PURE__ */ e(x, { ...m }, m.text)),
71
+ s == null ? void 0 : s.map((l) => /* @__PURE__ */ e(v, { ...l }, l.text)),
68
72
  /* @__PURE__ */ e(
69
- w,
73
+ x,
70
74
  {
71
- id: l ? "ChevronUp" : "ChevronDown",
72
- icon: l ? "ChevronUp" : "ChevronDown",
75
+ id: i ? "ChevronUp" : "ChevronDown",
76
+ icon: i ? "ChevronUp" : "ChevronDown",
73
77
  button: !0,
74
- handleClick: i
78
+ handleClick: o
75
79
  }
76
80
  )
77
81
  ] })
78
82
  ] })
79
83
  ] }),
80
- l && f
84
+ i && h
81
85
  ]
82
86
  }
83
87
  );
84
88
  }
85
89
  export {
86
- b as CollapsibleCard
90
+ D as CollapsibleCard
87
91
  };
@@ -1,6 +1,10 @@
1
1
  export type SegmentedControlOption = {
2
2
  id: string;
3
3
  label: string;
4
+ /**
5
+ * Optional count/status badge rendered after the label (design-system Badge)
6
+ */
7
+ badgeText?: string;
4
8
  };
5
9
  export type SegmentedControlProps = {
6
10
  /**
@@ -1,36 +1,46 @@
1
- import { jsx as e } from "react/jsx-runtime";
2
- import { Typography as i } from "../../../styles/typography/typography.js";
3
- import { getStyles as p, getContainerStyles as f } from "./styles.js";
4
- import { t as n } from "../../../../bundle-mjs-BjFsLjkg.js";
5
- function C({
1
+ import { jsx as o, jsxs as p } from "react/jsx-runtime";
2
+ import { Typography as d } from "../../../styles/typography/typography.js";
3
+ import { getStyles as g, getContainerStyles as u } from "./styles.js";
4
+ import { t as i } from "../../../../bundle-mjs-BjFsLjkg.js";
5
+ import { Badge as v } from "../../../atoms/badge/badge.js";
6
+ function w({
6
7
  segments: a,
7
- handleClick: l,
8
- inline: o = !1,
9
- activeSegment: t
8
+ handleClick: m,
9
+ inline: s = !1,
10
+ activeSegment: c
10
11
  }) {
11
- const s = p(o);
12
- return /* @__PURE__ */ e(
12
+ const n = g(s);
13
+ return /* @__PURE__ */ o(
13
14
  "div",
14
15
  {
15
- className: n(
16
- s.container,
17
- s.segmentsBorder
16
+ className: i(
17
+ n.container,
18
+ n.segmentsBorder
18
19
  ),
19
- children: a.map(({ id: r, label: c }) => {
20
- const m = f(o, r === t);
21
- return /* @__PURE__ */ e(
20
+ children: a.map(({ id: r, label: l, badgeText: e }) => {
21
+ const t = r === c, f = u(s, t);
22
+ return /* @__PURE__ */ p(
22
23
  "div",
23
24
  {
24
- className: n("cursor-pointer", m.container),
25
- onClick: () => l(r),
26
- children: /* @__PURE__ */ e(
27
- i,
28
- {
29
- children: c,
30
- color: r === t ? "active" : "default",
31
- swStyle: 1
32
- }
33
- )
25
+ className: i("cursor-pointer", f.container),
26
+ onClick: () => m(r),
27
+ children: [
28
+ /* @__PURE__ */ o(
29
+ d,
30
+ {
31
+ children: l,
32
+ color: t ? "active" : "default",
33
+ swStyle: 1
34
+ }
35
+ ),
36
+ e != null && e !== "" && /* @__PURE__ */ o(
37
+ v,
38
+ {
39
+ text: e,
40
+ color: t ? "affirmativeInverted" : "affirmative"
41
+ }
42
+ )
43
+ ]
34
44
  },
35
45
  r
36
46
  );
@@ -39,5 +49,5 @@ function C({
39
49
  );
40
50
  }
41
51
  export {
42
- C as SegmentedControl
52
+ w as SegmentedControl
43
53
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@temp-spotwork/ui",
3
3
  "private": false,
4
- "version": "1.8.2",
4
+ "version": "1.9.0",
5
5
  "type": "module",
6
6
  "main": "dist/main.js",
7
7
  "types": "dist/main.d.ts",