@temp-spotwork/ui 1.8.0 → 1.8.2

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 +6 -0
  2. package/dist/components/atoms/icons/iconMap.js +96 -92
  3. package/dist/components/atoms/icons/icons.stories.js +6 -4
  4. package/dist/components/atoms/icons/iconsSVGs/Small/Edit.d.ts +4 -0
  5. package/dist/components/atoms/icons/iconsSVGs/Small/Edit.js +23 -0
  6. package/dist/components/atoms/icons/iconsSVGs/Small/MapPinOutline.d.ts +4 -0
  7. package/dist/components/atoms/icons/iconsSVGs/Small/MapPinOutline.js +37 -0
  8. package/dist/components/atoms/icons/iconsSVGs/Small/index.d.ts +3 -1
  9. package/dist/components/atoms/icons/iconsSVGs/Small/index.js +60 -56
  10. package/dist/components/atoms/small-large-text/small-large-text.js +3 -2
  11. package/dist/components/molecules/alert/alert.js +8 -7
  12. package/dist/components/molecules/dataviz/marker-progress-bar/MarkerProgressBar.stories.d.ts +17 -0
  13. package/dist/components/molecules/dataviz/marker-progress-bar/MarkerProgressBar.stories.js +68 -0
  14. package/dist/components/molecules/dataviz/marker-progress-bar/index.d.ts +2 -0
  15. package/dist/components/molecules/dataviz/marker-progress-bar/index.js +4 -0
  16. package/dist/components/molecules/dataviz/marker-progress-bar/marker-progress-bar.d.ts +31 -0
  17. package/dist/components/molecules/dataviz/marker-progress-bar/marker-progress-bar.js +97 -0
  18. package/dist/components/molecules/dataviz/marker-progress-bar/styles.d.ts +11 -0
  19. package/dist/components/molecules/dataviz/marker-progress-bar/styles.js +25 -0
  20. package/dist/components/molecules/dialog/dialog.js +3 -2
  21. package/dist/components/molecules/drawer/drawer.js +11 -10
  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
@@ -4,7 +4,7 @@ import "../../styles/tailwind-config/index.js";
4
4
  import { Typography as G } from "../../styles/typography/typography.js";
5
5
  import "../../styles/colors/colors.js";
6
6
  import "../../styles/colors/colormap.js";
7
- import { t as s } from "../../../bundle-mjs-BjFsLjkg.js";
7
+ import { t as p } from "../../../bundle-mjs-BjFsLjkg.js";
8
8
  import { Icons as H } from "../../atoms/icons/icons.js";
9
9
  import "../../atoms/icons/iconsSVGs/Large/Profile.js";
10
10
  import "../../atoms/icons/iconsSVGs/Small/Profile.js";
@@ -25,12 +25,13 @@ import "../../atoms/form/timeselect/timeselect.js";
25
25
  import { Button as b } 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
- function tr({
33
- children: p,
33
+ function ir({
34
+ children: s,
34
35
  width: c,
35
36
  open: d,
36
37
  title: t,
@@ -65,11 +66,11 @@ function tr({
65
66
  // Calculate max height based on whether action buttons are present
66
67
  maxHeight: o ? `calc(100vh - ${15 + 6.1 + 7.6}rem)` : `calc(100vh - ${15 + 6.1}rem)`
67
68
  },
68
- className: s("overflow-auto", n && "p-xl", !o && "rounded-b-xl"),
69
- children: p
69
+ className: p("overflow-auto", n && "p-xl", !o && "rounded-b-xl"),
70
+ children: s
70
71
  }
71
72
  ),
72
- o && /* @__PURE__ */ r("div", { className: s("flex justify-center p-xl", f && "border-t border-bcolor-subdued"), children: l && /* @__PURE__ */ r("div", { className: "flex gap-xl", children: l.map((a) => /* @__PURE__ */ r(b, { size: "large", ...a }, a.text)) }) })
73
+ o && /* @__PURE__ */ r("div", { className: p("flex justify-center p-xl", f && "border-t border-bcolor-subdued"), children: l && /* @__PURE__ */ r("div", { className: "flex gap-xl", children: l.map((a) => /* @__PURE__ */ r(b, { size: "large", ...a }, a.text)) }) })
73
74
  ] })
74
75
  ]
75
76
  }
@@ -77,5 +78,5 @@ function tr({
77
78
  ] }) });
78
79
  }
79
80
  export {
80
- tr as Alert
81
+ ir as Alert
81
82
  };
@@ -0,0 +1,17 @@
1
+ import { Meta, StoryObj } from '@storybook/react';
2
+ import { MarkerProgressBar } from '.';
3
+
4
+ declare const meta: Meta<typeof MarkerProgressBar>;
5
+ export default meta;
6
+ type Story = StoryObj<typeof meta>;
7
+ /** Not started — gray track, pin at origin */
8
+ export declare const Subdued: Story;
9
+ /** On the way — green fill to marker (~43% on 215px track in Figma) */
10
+ export declare const Success: Story;
11
+ export declare const Complete: Story;
12
+ /** Running late — orange fill */
13
+ export declare const Warning: Story;
14
+ /** Off course — was closer (70%), now regressed (37%) with stripe (Figma) */
15
+ export declare const AlertWithRegression: Story;
16
+ /** Location off — gray track only */
17
+ export declare const Disabled: Story;
@@ -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,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';