@phillips/seldon 1.276.0 → 1.278.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.
Files changed (65) hide show
  1. package/dist/_virtual/index10.cjs +1 -1
  2. package/dist/_virtual/index10.js +2 -2
  3. package/dist/_virtual/index9.cjs +1 -1
  4. package/dist/_virtual/index9.js +2 -2
  5. package/dist/components/SlideToActivate/SlideToActivate.cjs +1 -0
  6. package/dist/components/SlideToActivate/SlideToActivate.d.ts +14 -0
  7. package/dist/components/SlideToActivate/SlideToActivate.js +147 -0
  8. package/dist/components/SlideToActivate/SlideToActivate.stories.argTypes.d.ts +276 -0
  9. package/dist/components/SlideToActivate/SlideToActivate.stories.d.ts +499 -0
  10. package/dist/components/SlideToActivate/SlideToActivate.stories.demo.d.ts +8 -0
  11. package/dist/components/SlideToActivate/SlideToActivate.test.d.ts +1 -0
  12. package/dist/components/SlideToActivate/SlideToActivateThumb.cjs +1 -0
  13. package/dist/components/SlideToActivate/SlideToActivateThumb.d.ts +28 -0
  14. package/dist/components/SlideToActivate/SlideToActivateThumb.js +76 -0
  15. package/dist/components/SlideToActivate/hooks/useSlideDragHandlers.cjs +1 -0
  16. package/dist/components/SlideToActivate/hooks/useSlideDragHandlers.d.ts +20 -0
  17. package/dist/components/SlideToActivate/hooks/useSlideDragHandlers.js +90 -0
  18. package/dist/components/SlideToActivate/hooks/useSlideKeyboardActivate.cjs +1 -0
  19. package/dist/components/SlideToActivate/hooks/useSlideKeyboardActivate.d.ts +14 -0
  20. package/dist/components/SlideToActivate/hooks/useSlideKeyboardActivate.js +44 -0
  21. package/dist/components/SlideToActivate/hooks/useSlideToActivate.cjs +1 -0
  22. package/dist/components/SlideToActivate/hooks/useSlideToActivate.d.ts +33 -0
  23. package/dist/components/SlideToActivate/hooks/useSlideToActivate.js +122 -0
  24. package/dist/components/SlideToActivate/index.d.ts +4 -0
  25. package/dist/components/SlideToActivate/slideToActivateReducer.cjs +1 -0
  26. package/dist/components/SlideToActivate/slideToActivateReducer.d.ts +37 -0
  27. package/dist/components/SlideToActivate/slideToActivateReducer.js +38 -0
  28. package/dist/components/SlideToActivate/slideToActivateUtils.cjs +1 -0
  29. package/dist/components/SlideToActivate/slideToActivateUtils.d.ts +19 -0
  30. package/dist/components/SlideToActivate/slideToActivateUtils.js +23 -0
  31. package/dist/components/SlideToActivate/slideToActivateUtils.test.d.ts +1 -0
  32. package/dist/components/SlideToActivate/types.cjs +1 -0
  33. package/dist/components/SlideToActivate/types.d.ts +105 -0
  34. package/dist/components/SlideToActivate/types.js +9 -0
  35. package/dist/components/Toast/ToastContextProvider.cjs +1 -1
  36. package/dist/components/Toast/ToastContextProvider.js +1 -1
  37. package/dist/index.cjs +1 -1
  38. package/dist/index.d.ts +1 -0
  39. package/dist/index.js +104 -98
  40. package/dist/node_modules/ics/dist/index.cjs +1 -1
  41. package/dist/node_modules/ics/dist/index.js +1 -1
  42. package/dist/node_modules/prop-types/node_modules/react-is/index.cjs +1 -1
  43. package/dist/node_modules/prop-types/node_modules/react-is/index.js +1 -1
  44. package/dist/node_modules/react-zoom-pan-pinch/dist/index.esm.cjs +3 -2
  45. package/dist/node_modules/react-zoom-pan-pinch/dist/index.esm.js +85 -78
  46. package/dist/node_modules/uuid/dist/rng.cjs +1 -0
  47. package/dist/node_modules/uuid/dist/rng.js +7 -0
  48. package/dist/node_modules/uuid/dist/v4.cjs +1 -0
  49. package/dist/node_modules/uuid/dist/v4.js +15 -0
  50. package/dist/scss/_vars.scss +6 -5
  51. package/dist/scss/_vars.scss.cjs +6 -5
  52. package/dist/scss/_vars.scss.js +6 -5
  53. package/dist/scss/componentStyles.scss +1 -0
  54. package/dist/scss/components/SlideToActivate/_slideToActivate.scss +284 -0
  55. package/dist/scss/components/SlideToActivate/_slideToActivate.stories.scss +166 -0
  56. package/dist/scss/components/Toast/_toast.scss +5 -6
  57. package/package.json +6 -7
  58. package/dist/node_modules/uuid/dist/esm-browser/native.cjs +0 -1
  59. package/dist/node_modules/uuid/dist/esm-browser/native.js +0 -4
  60. package/dist/node_modules/uuid/dist/esm-browser/rng.cjs +0 -1
  61. package/dist/node_modules/uuid/dist/esm-browser/rng.js +0 -13
  62. package/dist/node_modules/uuid/dist/esm-browser/v4.cjs +0 -1
  63. package/dist/node_modules/uuid/dist/esm-browser/v4.js +0 -15
  64. /package/dist/node_modules/uuid/dist/{esm-browser/stringify.cjs → stringify.cjs} +0 -0
  65. /package/dist/node_modules/uuid/dist/{esm-browser/stringify.js → stringify.js} +0 -0
@@ -0,0 +1,90 @@
1
+ import { useRef as a, useCallback as d, useEffect as b } from "react";
2
+ import { SlideToActivateDirections as x } from "../types.js";
3
+ import { clampProgress as M, isGestureBusy as X } from "../slideToActivateUtils.js";
4
+ const w = 0.95, O = 8, U = 1, G = (o, l) => {
5
+ try {
6
+ return o.setPointerCapture(l), typeof o.hasPointerCapture == "function" ? o.hasPointerCapture(l) : !1;
7
+ } catch {
8
+ return !1;
9
+ }
10
+ }, k = ({
11
+ direction: o,
12
+ isDisabled: l,
13
+ stateRef: e,
14
+ measureTravel: f,
15
+ dispatch: E,
16
+ emitProgress: I,
17
+ runActivation: S,
18
+ snapToIdle: C
19
+ }) => {
20
+ const L = a(0), y = a(0), m = a(!1), u = a(null), D = a(null), h = a(null), i = d(() => {
21
+ h.current?.(), h.current = null;
22
+ }, []);
23
+ b(() => () => i(), [i]);
24
+ const g = d(
25
+ (r, n) => {
26
+ if (n !== u.current || e.current.status !== "dragging")
27
+ return;
28
+ let s = e.current.maxTravel;
29
+ if (s <= 0 && (f(), s = e.current.maxTravel, s <= 0))
30
+ return;
31
+ const p = r - L.current, c = o === x.rtl ? -p : p;
32
+ if (!m.current) {
33
+ if (Math.abs(c) < O)
34
+ return;
35
+ m.current = !0;
36
+ }
37
+ const t = M(y.current + c * U / s);
38
+ I(t);
39
+ },
40
+ [o, I, f, e]
41
+ ), P = d(() => {
42
+ i();
43
+ const r = D.current, n = u.current;
44
+ try {
45
+ r && n !== null && r.hasPointerCapture(n) && r.releasePointerCapture(n);
46
+ } catch {
47
+ }
48
+ if (u.current = null, D.current = null, e.current.status === "dragging") {
49
+ if (e.current.progress >= w || e.current.progress >= 1) {
50
+ S();
51
+ return;
52
+ }
53
+ C();
54
+ }
55
+ }, [i, S, C, e]), v = d(
56
+ (r) => {
57
+ r.pointerId === u.current && (r.cancelable && r.preventDefault(), g(r.clientX, r.pointerId));
58
+ },
59
+ [g]
60
+ );
61
+ return {
62
+ handlePointerDown: d(
63
+ (r) => {
64
+ if (l || X(e.current.status) || e.current.progress >= 1)
65
+ return;
66
+ r.preventDefault(), f();
67
+ const n = r.currentTarget;
68
+ n.focus(), D.current = n, u.current = r.pointerId;
69
+ const s = G(n, r.pointerId);
70
+ if (L.current = r.clientX, y.current = e.current.progress, m.current = !1, E({ type: "dragStarted" }), i(), !s) {
71
+ const p = (t) => {
72
+ t.cancelable && t.preventDefault(), g(t.clientX, t.pointerId);
73
+ }, c = (t) => {
74
+ t.pointerId === u.current && P();
75
+ };
76
+ document.addEventListener("pointermove", p, { passive: !1 }), document.addEventListener("pointerup", c), document.addEventListener("pointercancel", c), h.current = () => {
77
+ document.removeEventListener("pointermove", p), document.removeEventListener("pointerup", c), document.removeEventListener("pointercancel", c);
78
+ };
79
+ }
80
+ },
81
+ [g, i, E, P, l, f, e]
82
+ ),
83
+ handlePointerMove: v,
84
+ handlePointerUp: P,
85
+ handlePointerCancel: P
86
+ };
87
+ };
88
+ export {
89
+ k as useSlideDragHandlers
90
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react"),y=require("../slideToActivateUtils.cjs"),f=({isDisabled:u,stateRef:c,runActivation:l})=>{const n=t.useRef(null),r=t.useCallback(()=>{n.current=null},[]);t.useEffect(()=>{u&&r()},[r,u]);const a=t.useCallback(e=>{if(!(u||y.isGestureBusy(c.current.status)||c.current.progress>=1)){if(e.key==="Escape"){e.preventDefault(),r();return}if(!(e.key!=="Enter"&&e.key!==" ")){if(e.repeat||n.current){e.preventDefault();return}e.preventDefault(),n.current=e.key}}},[r,u,c]),o=t.useCallback(e=>{e.key===n.current&&(e.preventDefault(),n.current=null,!(u||c.current.status==="pending")&&l())},[u,l,c]),s=t.useCallback(()=>{r()},[r]);return{handleKeyDown:a,handleKeyUp:o,handleBlur:s,cancelKeyboardGesture:r}};exports.useSlideKeyboardActivate=f;
@@ -0,0 +1,14 @@
1
+ import { MutableRefObject, KeyboardEvent as ReactKeyboardEvent } from 'react';
2
+ import { SlideToActivateState } from '../slideToActivateReducer';
3
+ interface UseSlideKeyboardActivateOptions {
4
+ isDisabled: boolean;
5
+ stateRef: MutableRefObject<SlideToActivateState>;
6
+ runActivation: () => Promise<void>;
7
+ }
8
+ export declare const useSlideKeyboardActivate: ({ isDisabled, stateRef, runActivation }: UseSlideKeyboardActivateOptions) => {
9
+ handleKeyDown: (event: ReactKeyboardEvent<HTMLButtonElement>) => void;
10
+ handleKeyUp: (event: ReactKeyboardEvent<HTMLButtonElement>) => void;
11
+ handleBlur: () => void;
12
+ cancelKeyboardGesture: () => void;
13
+ };
14
+ export {};
@@ -0,0 +1,44 @@
1
+ import { useRef as y, useCallback as c, useEffect as a } from "react";
2
+ import { isGestureBusy as s } from "../slideToActivateUtils.js";
3
+ const m = ({ isDisabled: u, stateRef: n, runActivation: o }) => {
4
+ const t = y(null), e = c(() => {
5
+ t.current = null;
6
+ }, []);
7
+ a(() => {
8
+ u && e();
9
+ }, [e, u]);
10
+ const f = c(
11
+ (r) => {
12
+ if (!(u || s(n.current.status) || n.current.progress >= 1)) {
13
+ if (r.key === "Escape") {
14
+ r.preventDefault(), e();
15
+ return;
16
+ }
17
+ if (!(r.key !== "Enter" && r.key !== " ")) {
18
+ if (r.repeat || t.current) {
19
+ r.preventDefault();
20
+ return;
21
+ }
22
+ r.preventDefault(), t.current = r.key;
23
+ }
24
+ }
25
+ },
26
+ [e, u, n]
27
+ ), l = c(
28
+ (r) => {
29
+ r.key === t.current && (r.preventDefault(), t.current = null, !(u || n.current.status === "pending") && o());
30
+ },
31
+ [u, o, n]
32
+ ), p = c(() => {
33
+ e();
34
+ }, [e]);
35
+ return {
36
+ handleKeyDown: f,
37
+ handleKeyUp: l,
38
+ handleBlur: p,
39
+ cancelKeyboardGesture: e
40
+ };
41
+ };
42
+ export {
43
+ m as useSlideKeyboardActivate
44
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react"),b=require("../slideToActivateReducer.cjs"),S=require("../slideToActivateUtils.cjs"),F=require("../types.cjs"),O=require("./useSlideDragHandlers.cjs"),j=require("./useSlideKeyboardActivate.cjs"),B=({direction:d,isDisabled:s,reduceMotion:p,pendingAnnouncement:h,successAnnouncement:A,errorAnnouncement:m,resetOnError:k,onActivation:C,onError:y,onProgress:v,onStatusChange:P})=>{const[a,K]=e.useReducer(b.slideToActivateReducer,b.initialSlideToActivateState),n=e.useRef(a),t=e.useCallback(r=>{n.current=b.slideToActivateReducer(n.current,r),K(r)},[]),R=e.useRef(null),g=e.useRef(null),c=e.useRef(null),l=e.useRef(!0),i=e.useCallback(()=>{const r=R.current,f=g.current;!r||!f||t({type:"measured",maxTravel:S.measureMaxTravel({track:r,thumb:f,direction:d})})},[d,t]);e.useLayoutEffect(()=>{i()},[i]),e.useEffect(()=>{const r=R.current;if(!r||typeof ResizeObserver>"u")return;const f=new ResizeObserver(()=>i());return f.observe(r),()=>f.disconnect()},[i]);const o=e.useCallback(r=>{t({type:"progressChanged",progress:r}),v?.(r)},[t,v]),u=e.useCallback(()=>{c.current&&(clearTimeout(c.current),c.current=null)},[]);e.useEffect(()=>(l.current=!0,()=>{l.current=!1,u()}),[u]);const T=e.useCallback(()=>{u(),o(0),t({type:"snapStarted",immediate:p}),!p&&(c.current=setTimeout(()=>{l.current&&(t({type:"snapCompleted"}),c.current=null)},S.SNAP_MS))},[u,t,o,p]),q=e.useCallback(async()=>{if(n.current.status!=="pending"){o(1),t({type:"activationStarted",announcement:h});try{if(await C?.(),!l.current)return;u(),t({type:"activationSucceeded",announcement:A})}catch(r){if(!l.current)return;y?y(r):console.error(r),k?(t({type:"activationFailed",announcement:m}),T()):t({type:"activationFailedHeld",announcement:m})}}},[u,t,o,m,C,y,h,k,T,A]),M=e.useRef(s);e.useEffect(()=>{M.current&&!s&&(u(),t({type:"reset"}),v?.(0)),M.current=s},[u,t,s,v]);const w=e.useRef(!1);e.useEffect(()=>{if(!w.current){w.current=!0;return}P?.(a.status)},[a.status,P]);const{handleKeyDown:N,handleKeyUp:_,handleBlur:x,cancelKeyboardGesture:D}=j.useSlideKeyboardActivate({isDisabled:s,stateRef:n,runActivation:q}),{handlePointerDown:E,handlePointerMove:H,handlePointerUp:U,handlePointerCancel:z}=O.useSlideDragHandlers({direction:d,isDisabled:s,stateRef:n,measureTravel:()=>{D(),i()},dispatch:t,emitProgress:o,runActivation:q,snapToIdle:T});return{progress:a.progress,status:a.status,announcement:a.announcement,trackRef:R,thumbRef:g,thumbTranslatePx:a.progress*a.maxTravel*(d===F.SlideToActivateDirections.rtl?-1:1),handlePointerDown:E,handlePointerMove:H,handlePointerUp:U,handlePointerCancel:z,handleKeyDown:N,handleKeyUp:_,handleBlur:x,snapDurationMs:p?0:S.SNAP_MS}};exports.SNAP_MS=S.SNAP_MS;exports.useSlideToActivate=B;
@@ -0,0 +1,33 @@
1
+ import { SlideToActivateStatus } from '../slideToActivateUtils';
2
+ import { SlideToActivateDirections } from '../types';
3
+ export type { SlideToActivateStatus } from '../slideToActivateUtils';
4
+ export { SNAP_MS } from '../slideToActivateUtils';
5
+ export interface UseSlideToActivateOptions {
6
+ direction: SlideToActivateDirections | `${SlideToActivateDirections}`;
7
+ isDisabled: boolean;
8
+ reduceMotion: boolean;
9
+ pendingAnnouncement: string;
10
+ successAnnouncement: string;
11
+ errorAnnouncement: string;
12
+ resetOnError: boolean;
13
+ onActivation?: () => void | Promise<void>;
14
+ onError?: (error: unknown) => void;
15
+ onProgress?: (progress: number) => void;
16
+ onStatusChange?: (status: SlideToActivateStatus) => void;
17
+ }
18
+ export declare const useSlideToActivate: ({ direction, isDisabled, reduceMotion, pendingAnnouncement, successAnnouncement, errorAnnouncement, resetOnError, onActivation, onError, onProgress, onStatusChange, }: UseSlideToActivateOptions) => {
19
+ progress: number;
20
+ status: SlideToActivateStatus;
21
+ announcement: string;
22
+ trackRef: import('react').RefObject<HTMLDivElement>;
23
+ thumbRef: import('react').RefObject<HTMLButtonElement>;
24
+ thumbTranslatePx: number;
25
+ handlePointerDown: (event: import('react').PointerEvent<HTMLButtonElement>) => void;
26
+ handlePointerMove: (event: import('react').PointerEvent<HTMLButtonElement>) => void;
27
+ handlePointerUp: () => void;
28
+ handlePointerCancel: () => void;
29
+ handleKeyDown: (event: import('react').KeyboardEvent<HTMLButtonElement>) => void;
30
+ handleKeyUp: (event: import('react').KeyboardEvent<HTMLButtonElement>) => void;
31
+ handleBlur: () => void;
32
+ snapDurationMs: number;
33
+ };
@@ -0,0 +1,122 @@
1
+ import { useReducer as O, useRef as a, useCallback as c, useLayoutEffect as _, useEffect as y } from "react";
2
+ import { slideToActivateReducer as A, initialSlideToActivateState as j } from "../slideToActivateReducer.js";
3
+ import { measureMaxTravel as q, SNAP_MS as D } from "../slideToActivateUtils.js";
4
+ import { SlideToActivateDirections as E } from "../types.js";
5
+ import { useSlideDragHandlers as J } from "./useSlideDragHandlers.js";
6
+ import { useSlideKeyboardActivate as Q } from "./useSlideKeyboardActivate.js";
7
+ const ee = ({
8
+ direction: m,
9
+ isDisabled: u,
10
+ reduceMotion: d,
11
+ pendingAnnouncement: b,
12
+ successAnnouncement: w,
13
+ errorAnnouncement: T,
14
+ resetOnError: k,
15
+ onActivation: x,
16
+ onError: h,
17
+ onProgress: v,
18
+ onStatusChange: K
19
+ }) => {
20
+ const [r, F] = O(A, j), s = a(r), e = c((t) => {
21
+ s.current = A(s.current, t), F(t);
22
+ }, []), R = a(null), g = a(null), o = a(null), i = a(!0), l = c(() => {
23
+ const t = R.current, p = g.current;
24
+ !t || !p || e({ type: "measured", maxTravel: q({ track: t, thumb: p, direction: m }) });
25
+ }, [m, e]);
26
+ _(() => {
27
+ l();
28
+ }, [l]), y(() => {
29
+ const t = R.current;
30
+ if (!t || typeof ResizeObserver > "u")
31
+ return;
32
+ const p = new ResizeObserver(() => l());
33
+ return p.observe(t), () => p.disconnect();
34
+ }, [l]);
35
+ const f = c(
36
+ (t) => {
37
+ e({ type: "progressChanged", progress: t }), v?.(t);
38
+ },
39
+ [e, v]
40
+ ), n = c(() => {
41
+ o.current && (clearTimeout(o.current), o.current = null);
42
+ }, []);
43
+ y(() => (i.current = !0, () => {
44
+ i.current = !1, n();
45
+ }), [n]);
46
+ const S = c(() => {
47
+ n(), f(0), e({ type: "snapStarted", immediate: d }), !d && (o.current = setTimeout(() => {
48
+ i.current && (e({ type: "snapCompleted" }), o.current = null);
49
+ }, D));
50
+ }, [n, e, f, d]), C = c(async () => {
51
+ if (s.current.status !== "pending") {
52
+ f(1), e({ type: "activationStarted", announcement: b });
53
+ try {
54
+ if (await x?.(), !i.current)
55
+ return;
56
+ n(), e({ type: "activationSucceeded", announcement: w });
57
+ } catch (t) {
58
+ if (!i.current)
59
+ return;
60
+ h ? h(t) : console.error(t), k ? (e({ type: "activationFailed", announcement: T }), S()) : e({ type: "activationFailedHeld", announcement: T });
61
+ }
62
+ }
63
+ }, [
64
+ n,
65
+ e,
66
+ f,
67
+ T,
68
+ x,
69
+ h,
70
+ b,
71
+ k,
72
+ S,
73
+ w
74
+ ]), P = a(u);
75
+ y(() => {
76
+ P.current && !u && (n(), e({ type: "reset" }), v?.(0)), P.current = u;
77
+ }, [n, e, u, v]);
78
+ const z = a(!1);
79
+ y(() => {
80
+ if (!z.current) {
81
+ z.current = !0;
82
+ return;
83
+ }
84
+ K?.(r.status);
85
+ }, [r.status, K]);
86
+ const { handleKeyDown: H, handleKeyUp: M, handleBlur: U, cancelKeyboardGesture: B } = Q({
87
+ isDisabled: u,
88
+ stateRef: s,
89
+ runActivation: C
90
+ }), { handlePointerDown: G, handlePointerMove: I, handlePointerUp: L, handlePointerCancel: N } = J({
91
+ direction: m,
92
+ isDisabled: u,
93
+ stateRef: s,
94
+ measureTravel: () => {
95
+ B(), l();
96
+ },
97
+ dispatch: e,
98
+ emitProgress: f,
99
+ runActivation: C,
100
+ snapToIdle: S
101
+ });
102
+ return {
103
+ progress: r.progress,
104
+ status: r.status,
105
+ announcement: r.announcement,
106
+ trackRef: R,
107
+ thumbRef: g,
108
+ thumbTranslatePx: r.progress * r.maxTravel * (m === E.rtl ? -1 : 1),
109
+ handlePointerDown: G,
110
+ handlePointerMove: I,
111
+ handlePointerUp: L,
112
+ handlePointerCancel: N,
113
+ handleKeyDown: H,
114
+ handleKeyUp: M,
115
+ handleBlur: U,
116
+ snapDurationMs: d ? 0 : D
117
+ };
118
+ };
119
+ export {
120
+ D as SNAP_MS,
121
+ ee as useSlideToActivate
122
+ };
@@ -0,0 +1,4 @@
1
+ export { default as SlideToActivate } from './SlideToActivate';
2
+ export type { SlideToActivateConfig, SlideToActivateProps } from './types';
3
+ export type { SlideToActivateStatus } from './slideToActivateUtils';
4
+ export { SlideToActivateDirections, SlideToActivateSizes, SlideToActivateBorderRadii } from './types';
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a={status:"idle",progress:0,maxTravel:0,announcement:""};function u(e,n){switch(n.type){case"measured":return n.maxTravel===e.maxTravel?e:{...e,maxTravel:n.maxTravel};case"dragStarted":return e.status==="dragging"?e:{...e,status:"dragging"};case"progressChanged":return n.progress===e.progress?e:{...e,progress:n.progress};case"activationStarted":return{...e,status:"pending",announcement:n.announcement};case"activationSucceeded":return{...e,status:"idle",announcement:n.announcement};case"activationFailed":return{...e,announcement:n.announcement};case"activationFailedHeld":return{...e,status:"idle",announcement:n.announcement};case"snapStarted":{const r=n.immediate?"idle":"snapping";return r===e.status?e:{...e,status:r}}case"snapCompleted":return e.status==="idle"?e:{...e,status:"idle"};case"reset":return e.status==="idle"&&e.progress===0?e:{...e,status:"idle",progress:0};default:return e}}exports.initialSlideToActivateState=a;exports.slideToActivateReducer=u;
@@ -0,0 +1,37 @@
1
+ import { SlideToActivateStatus } from './slideToActivateUtils';
2
+ export interface SlideToActivateState {
3
+ status: SlideToActivateStatus;
4
+ progress: number;
5
+ maxTravel: number;
6
+ announcement: string;
7
+ }
8
+ export declare const initialSlideToActivateState: SlideToActivateState;
9
+ export type SlideToActivateAction = {
10
+ type: 'measured';
11
+ maxTravel: number;
12
+ } | {
13
+ type: 'dragStarted';
14
+ } | {
15
+ type: 'progressChanged';
16
+ progress: number;
17
+ } | {
18
+ type: 'activationStarted';
19
+ announcement: string;
20
+ } | {
21
+ type: 'activationSucceeded';
22
+ announcement: string;
23
+ } | {
24
+ type: 'activationFailed';
25
+ announcement: string;
26
+ } | {
27
+ type: 'activationFailedHeld';
28
+ announcement: string;
29
+ } | {
30
+ type: 'snapStarted';
31
+ immediate: boolean;
32
+ } | {
33
+ type: 'snapCompleted';
34
+ } | {
35
+ type: 'reset';
36
+ };
37
+ export declare function slideToActivateReducer(state: SlideToActivateState, action: SlideToActivateAction): SlideToActivateState;
@@ -0,0 +1,38 @@
1
+ const u = {
2
+ status: "idle",
3
+ progress: 0,
4
+ maxTravel: 0,
5
+ announcement: ""
6
+ };
7
+ function a(e, n) {
8
+ switch (n.type) {
9
+ case "measured":
10
+ return n.maxTravel === e.maxTravel ? e : { ...e, maxTravel: n.maxTravel };
11
+ case "dragStarted":
12
+ return e.status === "dragging" ? e : { ...e, status: "dragging" };
13
+ case "progressChanged":
14
+ return n.progress === e.progress ? e : { ...e, progress: n.progress };
15
+ case "activationStarted":
16
+ return { ...e, status: "pending", announcement: n.announcement };
17
+ case "activationSucceeded":
18
+ return { ...e, status: "idle", announcement: n.announcement };
19
+ case "activationFailed":
20
+ return { ...e, announcement: n.announcement };
21
+ case "activationFailedHeld":
22
+ return { ...e, status: "idle", announcement: n.announcement };
23
+ case "snapStarted": {
24
+ const r = n.immediate ? "idle" : "snapping";
25
+ return r === e.status ? e : { ...e, status: r };
26
+ }
27
+ case "snapCompleted":
28
+ return e.status === "idle" ? e : { ...e, status: "idle" };
29
+ case "reset":
30
+ return e.status === "idle" && e.progress === 0 ? e : { ...e, status: "idle", progress: 0 };
31
+ default:
32
+ return e;
33
+ }
34
+ }
35
+ export {
36
+ u as initialSlideToActivateState,
37
+ a as slideToActivateReducer
38
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=200,o="Press Space or Enter to activate. Press Escape to cancel.",i=t=>Math.min(1,Math.max(0,t)),u=t=>t==="pending"||t==="snapping",l=({track:t,thumb:e,direction:s})=>{const r=t.getBoundingClientRect(),a=e.getBoundingClientRect(),c=s==="rtl"?Math.max(0,r.right-a.right):Math.max(0,a.left-r.left);return Math.max(0,r.width-a.width-c*2)},g=({event:t,thumb:e,isInteractive:s,isThumbHidden:r})=>{!s||r||!e||e.contains(t.target)||(t.preventDefault(),e.focus())};exports.DEFAULT_KEYBOARD_HINT=o;exports.SNAP_MS=n;exports.clampProgress=i;exports.focusThumbFromTrack=g;exports.isGestureBusy=u;exports.measureMaxTravel=l;
@@ -0,0 +1,19 @@
1
+ import { PointerEvent as ReactPointerEvent } from 'react';
2
+ export type SlideToActivateStatus = 'idle' | 'dragging' | 'pending' | 'snapping';
3
+ export declare const SNAP_MS = 200;
4
+ export declare const DEFAULT_KEYBOARD_HINT = "Press Space or Enter to activate. Press Escape to cancel.";
5
+ export declare const clampProgress: (value: number) => number;
6
+ /** True while a new gesture should not start. */
7
+ export declare const isGestureBusy: (status: SlideToActivateStatus) => status is "pending" | "snapping";
8
+ export declare const measureMaxTravel: ({ track, thumb, direction, }: {
9
+ track: HTMLElement;
10
+ thumb: HTMLElement;
11
+ direction: "ltr" | "rtl";
12
+ }) => number;
13
+ /** Clicking the track (outside the thumb) focuses the thumb instead of leaving focus stuck on nothing. */
14
+ export declare const focusThumbFromTrack: ({ event, thumb, isInteractive, isThumbHidden, }: {
15
+ event: ReactPointerEvent<HTMLDivElement>;
16
+ thumb: HTMLButtonElement | null;
17
+ isInteractive: boolean;
18
+ isThumbHidden: boolean;
19
+ }) => void;
@@ -0,0 +1,23 @@
1
+ const r = 200, o = "Press Space or Enter to activate. Press Escape to cancel.", i = (t) => Math.min(1, Math.max(0, t)), g = (t) => t === "pending" || t === "snapping", h = ({
2
+ track: t,
3
+ thumb: e,
4
+ direction: c
5
+ }) => {
6
+ const n = t.getBoundingClientRect(), a = e.getBoundingClientRect(), s = c === "rtl" ? Math.max(0, n.right - a.right) : Math.max(0, a.left - n.left);
7
+ return Math.max(0, n.width - a.width - s * 2);
8
+ }, l = ({
9
+ event: t,
10
+ thumb: e,
11
+ isInteractive: c,
12
+ isThumbHidden: n
13
+ }) => {
14
+ !c || n || !e || e.contains(t.target) || (t.preventDefault(), e.focus());
15
+ };
16
+ export {
17
+ o as DEFAULT_KEYBOARD_HINT,
18
+ r as SNAP_MS,
19
+ i as clampProgress,
20
+ l as focusThumbFromTrack,
21
+ g as isGestureBusy,
22
+ h as measureMaxTravel
23
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("../Button/types.cjs");var e=(t=>(t.ltr="ltr",t.rtl="rtl",t))(e||{});const s=l.ButtonSizes;var r=(t=>(t.sharp="sharp",t.rounded="rounded",t.pill="pill",t))(r||{});exports.SlideToActivateBorderRadii=r;exports.SlideToActivateDirections=e;exports.SlideToActivateSizes=s;
@@ -0,0 +1,105 @@
1
+ import { HTMLAttributes, ReactNode } from 'react';
2
+ import { ButtonSizes } from '../Button/types';
3
+ import { TextVariants } from '../Text';
4
+ import { SlideToActivateStatus } from './slideToActivateUtils';
5
+ export declare enum SlideToActivateDirections {
6
+ ltr = "ltr",
7
+ rtl = "rtl"
8
+ }
9
+ /** Matches Button's size scale (default 44 / small 32) — reused rather than redeclared. */
10
+ export declare const SlideToActivateSizes: typeof ButtonSizes;
11
+ export type SlideToActivateSizes = ButtonSizes;
12
+ /**
13
+ * Shared corner radius for track, thumb face, and focus ring.
14
+ * `sharp` is 0 to match Saleroom Bid Status; `rounded` / `pill` for branded variants.
15
+ */
16
+ export declare enum SlideToActivateBorderRadii {
17
+ sharp = "sharp",
18
+ rounded = "rounded",
19
+ pill = "pill"
20
+ }
21
+ /** Visual and behavioural tuning props, grouped to reduce top-level prop count. */
22
+ export interface SlideToActivateConfig {
23
+ /** Text variant for the track label. Default `labelMedium`. */
24
+ textVariant?: TextVariants;
25
+ /** Control height; matches Button default (44) / small (32). */
26
+ size?: SlideToActivateSizes | `${SlideToActivateSizes}`;
27
+ /** Corner radius shared by track, thumb face, and focus ring. Default `sharp` (0 — Figma Bid Status). */
28
+ borderRadius?: SlideToActivateBorderRadii | `${SlideToActivateBorderRadii}`;
29
+ /** Swipe direction. Default `ltr`. */
30
+ direction?: SlideToActivateDirections | `${SlideToActivateDirections}`;
31
+ /**
32
+ * Icon rendered inside the thumb (decorative). Defaults to a double ChevronRight
33
+ * matching the Saleroom Figma Bid Status control. Pass `null` to hide.
34
+ */
35
+ thumbIcon?: ReactNode;
36
+ /** When set, thumb becomes a pill of this width (px); otherwise square like Button. */
37
+ thumbWidth?: number;
38
+ /** Pending UI while awaiting `onActivation`. Defaults to Seldon `Loader`. */
39
+ pendingIndicator?: ReactNode;
40
+ trackClassName?: string;
41
+ thumbClassName?: string;
42
+ }
43
+ export interface SlideToActivateProps extends Omit<HTMLAttributes<HTMLDivElement>, 'children' | 'onProgress'> {
44
+ /** Visible label; also used as the accessible name. Consumer owns idle/pending copy. */
45
+ labelText: string;
46
+ /**
47
+ * Called when activation threshold/edge is reached on release (or via keyboard).
48
+ *
49
+ * After this resolves, the component enters `idle` with `progress=1` — the thumb stays
50
+ * latched at the end and re-activation is blocked by the `progress >= 1` guard. Pass
51
+ * `isComplete` to present the settled visual state (implies non-interactive).
52
+ */
53
+ onActivation?: () => void | Promise<void>;
54
+ /** Called on `onActivation` rejection when provided; otherwise the error is `console.error`ed. */
55
+ onError?: (error: unknown) => void;
56
+ /** Fired while dragging with progress in `[0, 1]`. */
57
+ onProgress?: (progress: number) => void;
58
+ /**
59
+ * Screen-reader announcement while `onActivation` is pending, via a persistent `aria-live`
60
+ * region (separate from the visible label). Default: `labelText`.
61
+ */
62
+ pendingAnnouncement?: string;
63
+ /** Screen-reader announcement once `onActivation` resolves. Default `'Activated.'`. */
64
+ successAnnouncement?: string;
65
+ /**
66
+ * Screen-reader announcement when `onActivation` rejects. Default
67
+ * `'Action failed. Please try again.'`.
68
+ */
69
+ errorAnnouncement?: string;
70
+ /**
71
+ * Visually hidden keyboard instructions exposed via `aria-describedby` on the thumb.
72
+ * Default: `'Press Space or Enter to activate. Press Escape to cancel.'`.
73
+ * Pass an empty string to omit the description.
74
+ */
75
+ keyboardHint?: string;
76
+ /**
77
+ * Called on every status transition after mount. Useful for syncing external state to
78
+ * the component's gesture lifecycle (e.g. dimming sibling elements while `dragging`).
79
+ */
80
+ onStatusChange?: (status: SlideToActivateStatus) => void;
81
+ /**
82
+ * When `false`, the component does not snap back to idle after `onActivation` rejects —
83
+ * the thumb stays latched and status returns to `idle`. Consumer is responsible for the
84
+ * reset (typically `isComplete`). Default `true`.
85
+ */
86
+ resetOnError?: boolean;
87
+ /**
88
+ * Blocks pointer and keyboard activation with the "blocked" visual
89
+ * (grey track/label). Ignored for interaction when `isComplete` is also set —
90
+ * complete appearance wins.
91
+ */
92
+ isDisabled?: boolean;
93
+ /**
94
+ * Settled success state: dark track, white label, hidden thumb, and non-interactive.
95
+ * Implies disabled — no need to also pass `isDisabled`.
96
+ */
97
+ isComplete?: boolean;
98
+ /**
99
+ * When `false` and `isDisabled` is `true`, the thumb is hidden.
100
+ * Ignored when `isComplete` is `true` (thumb is always hidden then). Default `true`.
101
+ */
102
+ showThumbWhenDisabled?: boolean;
103
+ /** Visual and behavioural tuning. All properties are optional with sensible defaults. */
104
+ config?: SlideToActivateConfig;
105
+ }
@@ -0,0 +1,9 @@
1
+ import { ButtonSizes as l } from "../Button/types.js";
2
+ var p = /* @__PURE__ */ ((r) => (r.ltr = "ltr", r.rtl = "rtl", r))(p || {});
3
+ const u = l;
4
+ var t = /* @__PURE__ */ ((r) => (r.sharp = "sharp", r.rounded = "rounded", r.pill = "pill", r))(t || {});
5
+ export {
6
+ t as SlideToActivateBorderRadii,
7
+ p as SlideToActivateDirections,
8
+ u as SlideToActivateSizes
9
+ };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),c=require("../../node_modules/@radix-ui/react-toast/dist/index.cjs"),s=require("react"),v=require("./Toast.cjs"),T=require("../../utils/index.cjs"),j=require("../../node_modules/uuid/dist/esm-browser/v4.cjs"),d=s.createContext(void 0),p=({children:u})=>{const[i,n]=s.useState([]),l=s.useCallback(e=>{const t=j.default();n(r=>[...r,{...e,id:t}])},[]),a=s.useCallback(e=>{n(t=>t.filter(r=>r.id!==e))},[]),x={toasts:i,addToast:l,removeToast:a};return o.jsx(d.Provider,{value:x,children:o.jsxs(c.Provider,{children:[u,o.jsx(c.Viewport,{className:`${T.px}-toast-viewport`}),i.map(e=>o.jsx(v.default,{...e,onOpenChange:t=>!t&&a(e.id),title:e.title??""},e.id))]})})};exports.ToastContext=d;exports.ToastProvider=p;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),c=require("../../node_modules/@radix-ui/react-toast/dist/index.cjs"),s=require("react"),v=require("./Toast.cjs"),T=require("../../utils/index.cjs"),j=require("../../node_modules/uuid/dist/v4.cjs"),d=s.createContext(void 0),p=({children:u})=>{const[i,n]=s.useState([]),l=s.useCallback(e=>{const t=j.default();n(r=>[...r,{...e,id:t}])},[]),a=s.useCallback(e=>{n(t=>t.filter(r=>r.id!==e))},[]),x={toasts:i,addToast:l,removeToast:a};return o.jsx(d.Provider,{value:x,children:o.jsxs(c.Provider,{children:[u,o.jsx(c.Viewport,{className:`${T.px}-toast-viewport`}),i.map(e=>o.jsx(v.default,{...e,onOpenChange:t=>!t&&a(e.id),title:e.title??""},e.id))]})})};exports.ToastContext=d;exports.ToastProvider=p;
@@ -3,7 +3,7 @@ import { Provider as l, Viewport as v } from "../../node_modules/@radix-ui/react
3
3
  import { useState as f, useCallback as m, createContext as x } from "react";
4
4
  import T from "./Toast.js";
5
5
  import { px as u } from "../../utils/index.js";
6
- import C from "../../node_modules/uuid/dist/esm-browser/v4.js";
6
+ import C from "../../node_modules/uuid/dist/v4.js";
7
7
  const h = x(void 0), N = ({ children: n }) => {
8
8
  const [s, i] = f([]), c = m((o) => {
9
9
  const t = C();