@temp-spotwork/ui 1.8.1 → 1.8.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 (28) hide show
  1. package/dist/components/atoms/icons/iconMap.d.ts +3 -0
  2. package/dist/components/atoms/icons/iconMap.js +90 -88
  3. package/dist/components/atoms/icons/icons.stories.js +6 -4
  4. package/dist/components/atoms/icons/iconsSVGs/Small/MapPinOutline.d.ts +4 -0
  5. package/dist/components/atoms/icons/iconsSVGs/Small/MapPinOutline.js +37 -0
  6. package/dist/components/atoms/icons/iconsSVGs/Small/index.d.ts +2 -1
  7. package/dist/components/atoms/icons/iconsSVGs/Small/index.js +50 -48
  8. package/dist/components/atoms/small-large-text/small-large-text.js +3 -2
  9. package/dist/components/molecules/alert/alert.js +8 -7
  10. package/dist/components/molecules/dataviz/marker-progress-bar/MarkerProgressBar.stories.d.ts +17 -0
  11. package/dist/components/molecules/dataviz/marker-progress-bar/MarkerProgressBar.stories.js +68 -0
  12. package/dist/components/molecules/dataviz/marker-progress-bar/index.d.ts +2 -0
  13. package/dist/components/molecules/dataviz/marker-progress-bar/index.js +4 -0
  14. package/dist/components/molecules/dataviz/marker-progress-bar/marker-progress-bar.d.ts +31 -0
  15. package/dist/components/molecules/dataviz/marker-progress-bar/marker-progress-bar.js +97 -0
  16. package/dist/components/molecules/dataviz/marker-progress-bar/styles.d.ts +11 -0
  17. package/dist/components/molecules/dataviz/marker-progress-bar/styles.js +25 -0
  18. package/dist/components/molecules/dialog/dialog.js +3 -2
  19. package/dist/components/molecules/drawer/drawer.js +11 -10
  20. package/dist/components/molecules/filter/segmented-control/segmented-control.d.ts +4 -0
  21. package/dist/components/molecules/filter/segmented-control/segmented-control.js +37 -27
  22. package/dist/components/molecules/snackbar/Snackbar.stories.js +1 -1
  23. package/dist/components/molecules/snackbar/index.js +1 -1
  24. package/dist/components/molecules/snackbar/snackbar.js +3 -2
  25. package/dist/main.d.ts +2 -0
  26. package/dist/main.js +97 -95
  27. package/dist/{snackbar-B9zd5z5s.js → snackbar-CLpxASgP.js} +5 -4
  28. package/package.json +2 -2
@@ -0,0 +1,68 @@
1
+ import r from "react";
2
+ import { MarkerProgressBar as e } from "./marker-progress-bar.js";
3
+ const a = {
4
+ title: "@spotwork-ui/MarkerProgressBar",
5
+ component: e,
6
+ decorators: [
7
+ (s) => r.createElement("div", { style: { width: 215 } }, r.createElement(s))
8
+ ],
9
+ parameters: {
10
+ layout: "centered"
11
+ },
12
+ tags: ["autodocs"],
13
+ argTypes: {
14
+ progress: {
15
+ control: { type: "range", min: 0, max: 100, step: 1 }
16
+ },
17
+ bestProgress: {
18
+ control: { type: "range", min: 0, max: 100, step: 1 }
19
+ },
20
+ color: {
21
+ control: "select",
22
+ options: ["subdued", "disabled", "success", "warning", "alert"]
23
+ },
24
+ icon: {
25
+ control: "text"
26
+ }
27
+ }
28
+ }, c = {
29
+ args: {
30
+ progress: 0,
31
+ color: "subdued"
32
+ }
33
+ }, n = {
34
+ args: {
35
+ progress: 43,
36
+ color: "success"
37
+ }
38
+ }, l = {
39
+ args: {
40
+ progress: 100,
41
+ color: "success"
42
+ }
43
+ }, g = {
44
+ args: {
45
+ progress: 43,
46
+ color: "warning"
47
+ }
48
+ }, p = {
49
+ args: {
50
+ progress: 37,
51
+ bestProgress: 70,
52
+ color: "alert"
53
+ }
54
+ }, d = {
55
+ args: {
56
+ progress: 0,
57
+ color: "disabled"
58
+ }
59
+ };
60
+ export {
61
+ p as AlertWithRegression,
62
+ l as Complete,
63
+ d as Disabled,
64
+ c as Subdued,
65
+ n as Success,
66
+ g as Warning,
67
+ a as default
68
+ };
@@ -0,0 +1,2 @@
1
+ export { MarkerProgressBar } from './marker-progress-bar';
2
+ export type { MarkerProgressBarProps, MarkerProgressBarColor } from './marker-progress-bar';
@@ -0,0 +1,4 @@
1
+ import { MarkerProgressBar as o } from "./marker-progress-bar.js";
2
+ export {
3
+ o as MarkerProgressBar
4
+ };
@@ -0,0 +1,31 @@
1
+ import { SvgKey } from '../../../atoms/icons/iconMap';
2
+
3
+ /** Semantic track + marker colors from the design system. */
4
+ export type MarkerProgressBarColor = 'subdued' | 'disabled' | 'success' | 'warning' | 'alert';
5
+ export type MarkerProgressBarProps = {
6
+ /**
7
+ * Current marker position along the track, from 0 to 100.
8
+ */
9
+ progress: number;
10
+ /**
11
+ * Track fill + marker chip color.
12
+ * - subdued / disabled → gray track only
13
+ * - success / warning / alert → colored fill + matching marker chip
14
+ */
15
+ color: MarkerProgressBarColor;
16
+ /**
17
+ * Best (closest-to-destination) progress previously reached.
18
+ * When greater than `progress`, a diagonal regression stripe is drawn
19
+ * between the current marker and this peak (Figma Frame 812316).
20
+ */
21
+ bestProgress?: number;
22
+ /**
23
+ * Icon inside the marker. Defaults to outline map pin (Figma).
24
+ */
25
+ icon?: SvgKey;
26
+ /**
27
+ * Optional class name on the root container.
28
+ */
29
+ className?: string;
30
+ };
31
+ export declare function MarkerProgressBar({ progress, color, bestProgress, icon, className, }: MarkerProgressBarProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,97 @@
1
+ import { jsxs as u, jsx as e } from "react/jsx-runtime";
2
+ import { t as f } from "../../../../bundle-mjs-BjFsLjkg.js";
3
+ import { svgs as h } from "../../../atoms/icons/iconMap.js";
4
+ import "../../../styles/colors/colors.js";
5
+ import { glyph as o, surface as l } from "../../../styles/colors/colormap.js";
6
+ import { getRegressionStripeBackground as N, getStyles as k } from "./styles.js";
7
+ const w = {
8
+ subdued: l.disabled,
9
+ disabled: l.disabled,
10
+ success: l.success,
11
+ warning: l.warning,
12
+ alert: l.alert
13
+ }, C = {
14
+ subdued: "subdued",
15
+ disabled: "disabled",
16
+ success: "success",
17
+ warning: "warning",
18
+ alert: "alert"
19
+ }, M = {
20
+ success: o.success,
21
+ warning: o.warning,
22
+ alert: o.alert
23
+ };
24
+ function g(a) {
25
+ return Number.isNaN(a) ? 0 : Math.min(100, Math.max(0, a));
26
+ }
27
+ function R({ icon: a, strokeColor: t }) {
28
+ const n = h[a];
29
+ return /* @__PURE__ */ e("div", { className: k().markerIconSlot, children: /* @__PURE__ */ e(n, { fill: t, hover: void 0, active: void 0 }) });
30
+ }
31
+ function L({
32
+ progress: a,
33
+ color: t,
34
+ bestProgress: n,
35
+ icon: p = "MapPinOutlineSmall",
36
+ className: v
37
+ }) {
38
+ const s = k(), r = g(a), i = n !== void 0 ? g(n) : void 0, c = i !== void 0 && i > r + 0.01, d = M[t], m = c ? i : r, b = o[C[t]];
39
+ return /* @__PURE__ */ u(
40
+ "div",
41
+ {
42
+ className: f(s.root, v),
43
+ "data-testid": "marker-progress-bar",
44
+ role: "progressbar",
45
+ "aria-valuemin": 0,
46
+ "aria-valuemax": 100,
47
+ "aria-valuenow": r,
48
+ ...c ? { "aria-valuetext": `Current ${r}%, best ${i}%` } : {},
49
+ children: [
50
+ /* @__PURE__ */ u("div", { className: s.trackLayer, children: [
51
+ /* @__PURE__ */ e(
52
+ "div",
53
+ {
54
+ "data-testid": "marker-progress-bar-track",
55
+ className: s.trackBackground
56
+ }
57
+ ),
58
+ d && m > 0 ? /* @__PURE__ */ e(
59
+ "div",
60
+ {
61
+ "data-testid": "marker-progress-bar-fill",
62
+ className: s.trackFill,
63
+ style: { width: `${m}%`, background: d }
64
+ }
65
+ ) : null,
66
+ c && d ? /* @__PURE__ */ e(
67
+ "div",
68
+ {
69
+ "data-testid": "marker-progress-bar-regression",
70
+ className: s.regressionStripe,
71
+ style: {
72
+ left: `${r}%`,
73
+ width: `${i - r}%`,
74
+ background: N()
75
+ }
76
+ }
77
+ ) : null
78
+ ] }),
79
+ /* @__PURE__ */ e(
80
+ "div",
81
+ {
82
+ "data-testid": "marker-progress-bar-marker",
83
+ className: s.marker,
84
+ style: {
85
+ left: `clamp(1rem, ${r}%, calc(100% - 1rem))`,
86
+ background: w[t]
87
+ },
88
+ children: /* @__PURE__ */ e(R, { icon: p, strokeColor: b })
89
+ }
90
+ )
91
+ ]
92
+ }
93
+ );
94
+ }
95
+ export {
96
+ L as MarkerProgressBar
97
+ };
@@ -0,0 +1,11 @@
1
+ export declare const getStyles: () => {
2
+ /** Room for marker chip centered on 5px track (Figma 31063:30317). */
3
+ root: string;
4
+ trackLayer: string;
5
+ trackBackground: string;
6
+ trackFill: string;
7
+ regressionStripe: string;
8
+ marker: string;
9
+ markerIconSlot: string;
10
+ };
11
+ export declare function getRegressionStripeBackground(): string;
@@ -0,0 +1,25 @@
1
+ import "../../../styles/colors/colors.js";
2
+ import { woodsmoke as e } from "../../../styles/colors/colormap.js";
3
+ const o = () => ({
4
+ /** Room for marker chip centered on 5px track (Figma 31063:30317). */
5
+ root: "relative w-full h-[2rem]",
6
+ trackLayer: "absolute inset-x-0 top-1/2 -translate-y-1/2 h-[0.5rem]",
7
+ trackBackground: "absolute inset-0 rounded bg-progressBar-trackDefault",
8
+ trackFill: "absolute left-0 top-0 h-full rounded",
9
+ regressionStripe: "absolute top-0 h-full rounded overflow-hidden",
10
+ marker: "absolute top-1/2 -translate-y-1/2 -translate-x-1/2 size-[2rem] rounded-full flex items-center justify-center p-xxs",
11
+ markerIconSlot: "size-[1.5rem] shrink-0 flex items-center justify-center [&>svg]:size-[1.5rem]"
12
+ });
13
+ function s() {
14
+ return `repeating-linear-gradient(
15
+ -45deg,
16
+ ${e[600]} 0,
17
+ ${e[600]} 4px,
18
+ ${e[0]} 4px,
19
+ ${e[0]} 5px
20
+ )`;
21
+ }
22
+ export {
23
+ s as getRegressionStripeBackground,
24
+ o as getStyles
25
+ };
@@ -25,12 +25,13 @@ import "../../atoms/form/timeselect/timeselect.js";
25
25
  import { Button as d } from "../button/button.js";
26
26
  import "../datatables/cell/cell.js";
27
27
  import "../dataviz/donut-chart/donut-chart.js";
28
+ import "../dataviz/marker-progress-bar/marker-progress-bar.js";
28
29
  import "../../../react-spring_web.modern-CKwWSQke.js";
29
30
  import "../form/radiogroup/radiogroup.js";
30
31
  import "../../../purify.es-Bxiq5T7l.js";
31
32
  import "../../../card-Cc2Qkiqr.js";
32
33
  import { useUIElementSize as n } from "./use-ui-element-size.js";
33
- function dr({
34
+ function nr({
34
35
  children: f,
35
36
  width: h,
36
37
  open: x,
@@ -102,5 +103,5 @@ function dr({
102
103
  ] }) });
103
104
  }
104
105
  export {
105
- dr as Dialog
106
+ nr as Dialog
106
107
  };
@@ -25,27 +25,28 @@ import "../../atoms/form/timeselect/timeselect.js";
25
25
  import { Button as L } from "../button/button.js";
26
26
  import "../datatables/cell/cell.js";
27
27
  import "../dataviz/donut-chart/donut-chart.js";
28
+ import "../dataviz/marker-progress-bar/marker-progress-bar.js";
28
29
  import "../form/radiogroup/radiogroup.js";
29
30
  import "../../../purify.es-Bxiq5T7l.js";
30
31
  import "../../../card-Cc2Qkiqr.js";
31
- function Nr({
32
+ function br({
32
33
  children: N,
33
34
  actionBox: b,
34
35
  title: l,
35
36
  open: o,
36
37
  setOpen: e,
37
38
  width: a,
38
- transitionDuration: c = 500,
39
+ transitionDuration: m = 500,
39
40
  hasOverlayBg: C = !1,
40
41
  metadata: d,
41
42
  subheading: f,
42
43
  buttonProps: u,
43
44
  enableWidthTransition: p = !1,
44
- preserveScrollPosition: m = !0,
45
+ preserveScrollPosition: c = !0,
45
46
  scrollBehavior: D = "auto",
46
47
  enableScroll: s = !0
47
48
  }) {
48
- const [n, T] = I(c), i = y(null), h = y(0), R = X(
49
+ const [n, T] = I(m), i = y(null), h = y(0), R = X(
49
50
  () => ({
50
51
  from: { opacity: 0, transform: `translateX(${a})` },
51
52
  enter: { opacity: 1, transform: "translateX(0%)" },
@@ -57,17 +58,17 @@ function Nr({
57
58
  [a, n]
58
59
  ), B = E(o, R);
59
60
  v(() => {
60
- T(c);
61
- }, [c]);
61
+ T(m);
62
+ }, [m]);
62
63
  const _ = F({
63
64
  width: o ? a : 0,
64
65
  config: { duration: n }
65
66
  });
66
67
  v(() => {
67
- o && m && s && i.current && (i.current.scrollTop = h.current);
68
- }, [o, m, s]);
68
+ o && c && s && i.current && (i.current.scrollTop = h.current);
69
+ }, [o, c, s]);
69
70
  const $ = () => {
70
- m && s && i.current && (h.current = i.current.scrollTop), e == null || e(!1);
71
+ c && s && i.current && (h.current = i.current.scrollTop), e == null || e(!1);
71
72
  };
72
73
  return /* @__PURE__ */ r(M, { open: o, onOpenChange: e, children: /* @__PURE__ */ r(q, { children: B(
73
74
  (x, j) => j ? /* @__PURE__ */ t(k, { children: [
@@ -125,5 +126,5 @@ function Nr({
125
126
  ) }) });
126
127
  }
127
128
  export {
128
- Nr as Drawer
129
+ br as Drawer
129
130
  };
@@ -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
  };
@@ -1,6 +1,6 @@
1
1
  import { jsx as t, jsxs as a } from "react/jsx-runtime";
2
2
  import { useState as l } from "react";
3
- import { S as r, P as c, V as d } from "../../../snackbar-B9zd5z5s.js";
3
+ import { S as r, P as c, V as d } from "../../../snackbar-CLpxASgP.js";
4
4
  import { Button as h } from "../button/button.js";
5
5
  const w = {
6
6
  title: "@spotwork-ui/Snackbar",
@@ -1,4 +1,4 @@
1
- import { S as o } from "../../../snackbar-B9zd5z5s.js";
1
+ import { S as o } from "../../../snackbar-CLpxASgP.js";
2
2
  export {
3
3
  o as Snackbar
4
4
  };
@@ -1,5 +1,5 @@
1
1
  import "react/jsx-runtime";
2
- import { S as F } from "../../../snackbar-B9zd5z5s.js";
2
+ import { S as G } from "../../../snackbar-CLpxASgP.js";
3
3
  import "../../styles/tailwind-config/index.js";
4
4
  import "../../styles/typography/typography.js";
5
5
  import "../../styles/colors/colors.js";
@@ -24,11 +24,12 @@ import "../../atoms/form/timeselect/timeselect.js";
24
24
  import "../button/button.js";
25
25
  import "../datatables/cell/cell.js";
26
26
  import "../dataviz/donut-chart/donut-chart.js";
27
+ import "../dataviz/marker-progress-bar/marker-progress-bar.js";
27
28
  import "../../../react-spring_web.modern-CKwWSQke.js";
28
29
  import "../form/radiogroup/radiogroup.js";
29
30
  import "../../../purify.es-Bxiq5T7l.js";
30
31
  import "../../../card-Cc2Qkiqr.js";
31
32
  import "./styles.js";
32
33
  export {
33
- F as Snackbar
34
+ G as Snackbar
34
35
  };
package/dist/main.d.ts CHANGED
@@ -74,6 +74,8 @@ export { DonutChart } from './components/molecules/dataviz/donut-chart';
74
74
  export { DotMatrix } from './components/molecules/dataviz/dot-matrix';
75
75
  export { ProgressBar } from './components/molecules/dataviz/progress-bar';
76
76
  export type { ProgressBarProps } from './components/molecules/dataviz/progress-bar';
77
+ export { MarkerProgressBar } from './components/molecules/dataviz/marker-progress-bar';
78
+ export type { MarkerProgressBarProps, MarkerProgressBarColor, } from './components/molecules/dataviz/marker-progress-bar';
77
79
  export { SingleStackedBar } from './components/molecules/dataviz/single-stacked-bar';
78
80
  export type { SingleStackedBarProps } from './components/molecules/dataviz/single-stacked-bar';
79
81
  export * from './components/molecules/dataviz/legend';