@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,499 @@
1
+ import { ButtonSizes } from '../Button/types';
2
+ import { TextVariants } from '../Text';
3
+ import { SlideToActivateBorderRadii, SlideToActivateDirections, SlideToActivateConfig, SlideToActivateProps } from './types';
4
+ declare const meta: {
5
+ title: string;
6
+ component: import('react').ForwardRefExoticComponent<SlideToActivateProps & import('react').RefAttributes<HTMLDivElement>>;
7
+ };
8
+ export default meta;
9
+ type PlaygroundArgs = Omit<SlideToActivateProps, 'config'> & SlideToActivateConfig;
10
+ export declare const Playground: {
11
+ ({ textVariant, size, borderRadius, direction, thumbIcon, thumbWidth, pendingIndicator, trackClassName, thumbClassName, ...rest }: PlaygroundArgs): import("react/jsx-runtime").JSX.Element;
12
+ args: {
13
+ labelText: string;
14
+ textVariant: TextVariants;
15
+ direction: SlideToActivateDirections;
16
+ size: ButtonSizes;
17
+ borderRadius: SlideToActivateBorderRadii;
18
+ isDisabled: boolean;
19
+ isComplete: boolean;
20
+ showThumbWhenDisabled: boolean;
21
+ successAnnouncement: string;
22
+ errorAnnouncement: string;
23
+ keyboardHint: string;
24
+ };
25
+ parameters: {
26
+ chromatic: {
27
+ disableSnapshot: boolean;
28
+ };
29
+ };
30
+ argTypes: {
31
+ labelText: {
32
+ control: string;
33
+ description: string;
34
+ table: {
35
+ type: {
36
+ summary: string;
37
+ };
38
+ defaultValue: {
39
+ summary: string;
40
+ };
41
+ };
42
+ };
43
+ textVariant: {
44
+ control: {
45
+ type: string;
46
+ };
47
+ options: TextVariants[];
48
+ description: string;
49
+ table: {
50
+ type: {
51
+ summary: string;
52
+ };
53
+ defaultValue: {
54
+ summary: string;
55
+ };
56
+ };
57
+ };
58
+ direction: {
59
+ control: {
60
+ type: string;
61
+ };
62
+ options: SlideToActivateDirections[];
63
+ description: string;
64
+ table: {
65
+ type: {
66
+ summary: string;
67
+ };
68
+ defaultValue: {
69
+ summary: string;
70
+ };
71
+ };
72
+ };
73
+ size: {
74
+ control: {
75
+ type: string;
76
+ };
77
+ options: ButtonSizes[];
78
+ description: string;
79
+ table: {
80
+ type: {
81
+ summary: string;
82
+ };
83
+ defaultValue: {
84
+ summary: string;
85
+ };
86
+ };
87
+ };
88
+ borderRadius: {
89
+ control: {
90
+ type: string;
91
+ };
92
+ options: SlideToActivateBorderRadii[];
93
+ description: string;
94
+ table: {
95
+ type: {
96
+ summary: string;
97
+ };
98
+ defaultValue: {
99
+ summary: string;
100
+ };
101
+ };
102
+ };
103
+ thumbWidth: {
104
+ control: {
105
+ type: string;
106
+ min: number;
107
+ max: number;
108
+ step: number;
109
+ };
110
+ description: string;
111
+ table: {
112
+ type: {
113
+ summary: string;
114
+ };
115
+ defaultValue: {
116
+ summary: string;
117
+ };
118
+ };
119
+ };
120
+ isDisabled: {
121
+ control: string;
122
+ description: string;
123
+ table: {
124
+ type: {
125
+ summary: string;
126
+ };
127
+ defaultValue: {
128
+ summary: string;
129
+ };
130
+ };
131
+ };
132
+ isComplete: {
133
+ control: string;
134
+ description: string;
135
+ table: {
136
+ type: {
137
+ summary: string;
138
+ };
139
+ defaultValue: {
140
+ summary: string;
141
+ };
142
+ };
143
+ };
144
+ showThumbWhenDisabled: {
145
+ control: string;
146
+ description: string;
147
+ table: {
148
+ type: {
149
+ summary: string;
150
+ };
151
+ defaultValue: {
152
+ summary: string;
153
+ };
154
+ };
155
+ };
156
+ pendingAnnouncement: {
157
+ control: string;
158
+ description: string;
159
+ table: {
160
+ type: {
161
+ summary: string;
162
+ };
163
+ defaultValue: {
164
+ summary: string;
165
+ };
166
+ };
167
+ };
168
+ successAnnouncement: {
169
+ control: string;
170
+ description: string;
171
+ table: {
172
+ type: {
173
+ summary: string;
174
+ };
175
+ defaultValue: {
176
+ summary: string;
177
+ };
178
+ };
179
+ };
180
+ errorAnnouncement: {
181
+ control: string;
182
+ description: string;
183
+ table: {
184
+ type: {
185
+ summary: string;
186
+ };
187
+ defaultValue: {
188
+ summary: string;
189
+ };
190
+ };
191
+ };
192
+ keyboardHint: {
193
+ control: string;
194
+ description: string;
195
+ table: {
196
+ type: {
197
+ summary: string;
198
+ };
199
+ defaultValue: {
200
+ summary: string;
201
+ };
202
+ };
203
+ };
204
+ trackClassName: {
205
+ control: string;
206
+ description: string;
207
+ table: {
208
+ type: {
209
+ summary: string;
210
+ };
211
+ };
212
+ };
213
+ thumbClassName: {
214
+ control: string;
215
+ description: string;
216
+ table: {
217
+ type: {
218
+ summary: string;
219
+ };
220
+ };
221
+ };
222
+ thumbIcon: {
223
+ control: boolean;
224
+ description: string;
225
+ table: {
226
+ type: {
227
+ summary: string;
228
+ };
229
+ defaultValue: {
230
+ summary: string;
231
+ };
232
+ };
233
+ };
234
+ pendingIndicator: {
235
+ control: boolean;
236
+ description: string;
237
+ table: {
238
+ type: {
239
+ summary: string;
240
+ };
241
+ defaultValue: {
242
+ summary: string;
243
+ };
244
+ };
245
+ };
246
+ onActivation: {
247
+ action: string;
248
+ description: string;
249
+ table: {
250
+ type: {
251
+ summary: string;
252
+ };
253
+ };
254
+ };
255
+ onError: {
256
+ action: string;
257
+ description: string;
258
+ table: {
259
+ type: {
260
+ summary: string;
261
+ };
262
+ };
263
+ };
264
+ onProgress: {
265
+ action: string;
266
+ description: string;
267
+ table: {
268
+ type: {
269
+ summary: string;
270
+ };
271
+ };
272
+ };
273
+ };
274
+ };
275
+ export declare const WithThumbIconHeldState: {
276
+ (props: SlideToActivateProps): import("react/jsx-runtime").JSX.Element;
277
+ argTypes: {
278
+ onActivation: {
279
+ action: string;
280
+ description: string;
281
+ table: {
282
+ type: {
283
+ summary: string;
284
+ };
285
+ };
286
+ };
287
+ onError: {
288
+ action: string;
289
+ description: string;
290
+ table: {
291
+ type: {
292
+ summary: string;
293
+ };
294
+ };
295
+ };
296
+ onProgress: {
297
+ action: string;
298
+ description: string;
299
+ table: {
300
+ type: {
301
+ summary: string;
302
+ };
303
+ };
304
+ };
305
+ };
306
+ };
307
+ export declare const PillThumb: {
308
+ (props: SlideToActivateProps): import("react/jsx-runtime").JSX.Element;
309
+ argTypes: {
310
+ onActivation: {
311
+ action: string;
312
+ description: string;
313
+ table: {
314
+ type: {
315
+ summary: string;
316
+ };
317
+ };
318
+ };
319
+ onError: {
320
+ action: string;
321
+ description: string;
322
+ table: {
323
+ type: {
324
+ summary: string;
325
+ };
326
+ };
327
+ };
328
+ onProgress: {
329
+ action: string;
330
+ description: string;
331
+ table: {
332
+ type: {
333
+ summary: string;
334
+ };
335
+ };
336
+ };
337
+ };
338
+ };
339
+ export declare const Widths: {
340
+ (props: SlideToActivateProps): import("react/jsx-runtime").JSX.Element;
341
+ argTypes: {
342
+ onActivation: {
343
+ action: string;
344
+ description: string;
345
+ table: {
346
+ type: {
347
+ summary: string;
348
+ };
349
+ };
350
+ };
351
+ onError: {
352
+ action: string;
353
+ description: string;
354
+ table: {
355
+ type: {
356
+ summary: string;
357
+ };
358
+ };
359
+ };
360
+ onProgress: {
361
+ action: string;
362
+ description: string;
363
+ table: {
364
+ type: {
365
+ summary: string;
366
+ };
367
+ };
368
+ };
369
+ };
370
+ };
371
+ export declare const DisabledStates: (props: SlideToActivateProps) => import("react/jsx-runtime").JSX.Element;
372
+ export declare const AsyncActivation: {
373
+ (props: SlideToActivateProps): import("react/jsx-runtime").JSX.Element;
374
+ argTypes: {
375
+ onActivation: {
376
+ action: string;
377
+ description: string;
378
+ table: {
379
+ type: {
380
+ summary: string;
381
+ };
382
+ };
383
+ };
384
+ onError: {
385
+ action: string;
386
+ description: string;
387
+ table: {
388
+ type: {
389
+ summary: string;
390
+ };
391
+ };
392
+ };
393
+ onProgress: {
394
+ action: string;
395
+ description: string;
396
+ table: {
397
+ type: {
398
+ summary: string;
399
+ };
400
+ };
401
+ };
402
+ };
403
+ };
404
+ export declare const Rtl: {
405
+ (props: SlideToActivateProps): import("react/jsx-runtime").JSX.Element;
406
+ argTypes: {
407
+ onActivation: {
408
+ action: string;
409
+ description: string;
410
+ table: {
411
+ type: {
412
+ summary: string;
413
+ };
414
+ };
415
+ };
416
+ onError: {
417
+ action: string;
418
+ description: string;
419
+ table: {
420
+ type: {
421
+ summary: string;
422
+ };
423
+ };
424
+ };
425
+ onProgress: {
426
+ action: string;
427
+ description: string;
428
+ table: {
429
+ type: {
430
+ summary: string;
431
+ };
432
+ };
433
+ };
434
+ };
435
+ };
436
+ export declare const Small: {
437
+ (props: SlideToActivateProps): import("react/jsx-runtime").JSX.Element;
438
+ argTypes: {
439
+ onActivation: {
440
+ action: string;
441
+ description: string;
442
+ table: {
443
+ type: {
444
+ summary: string;
445
+ };
446
+ };
447
+ };
448
+ onError: {
449
+ action: string;
450
+ description: string;
451
+ table: {
452
+ type: {
453
+ summary: string;
454
+ };
455
+ };
456
+ };
457
+ onProgress: {
458
+ action: string;
459
+ description: string;
460
+ table: {
461
+ type: {
462
+ summary: string;
463
+ };
464
+ };
465
+ };
466
+ };
467
+ };
468
+ export declare const CustomStyling: {
469
+ (props: SlideToActivateProps): import("react/jsx-runtime").JSX.Element;
470
+ argTypes: {
471
+ onActivation: {
472
+ action: string;
473
+ description: string;
474
+ table: {
475
+ type: {
476
+ summary: string;
477
+ };
478
+ };
479
+ };
480
+ onError: {
481
+ action: string;
482
+ description: string;
483
+ table: {
484
+ type: {
485
+ summary: string;
486
+ };
487
+ };
488
+ };
489
+ onProgress: {
490
+ action: string;
491
+ description: string;
492
+ table: {
493
+ type: {
494
+ summary: string;
495
+ };
496
+ };
497
+ };
498
+ };
499
+ };
@@ -0,0 +1,8 @@
1
+ import { ReactNode } from 'react';
2
+ import { SlideToActivateProps } from './types';
3
+ export declare const SlideToActivateInteractiveDemo: ({ children, initialLabel, pendingLabel, activatedLabel, ...props }: SlideToActivateProps & {
4
+ children?: ReactNode;
5
+ initialLabel?: string;
6
+ pendingLabel?: string;
7
+ activatedLabel?: string;
8
+ }) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),v=require("../../_virtual/index2.cjs"),_=require("../Icon/Icon.cjs"),P=({baseClassName:o})=>t.jsxs("span",{className:`${o}__thumb-chevrons`,"aria-hidden":!0,children:[t.jsx(_.default,{icon:"ChevronRight",height:22,width:22,color:"currentColor"}),t.jsx(_.default,{icon:"ChevronRight",height:22,width:22,color:"currentColor"})]}),S=({baseClassName:o,thumbRef:p,thumbClassName:s,thumbWidth:n,thumbIcon:i,thumbTranslatePx:x,labelText:m,descriptionId:u,isHeld:l,isPending:h,isDisabled:c,isThumbHidden:r,isInteractive:e,status:$,snapDurationMs:a,onPointerDown:b,onPointerMove:f,onPointerUp:y,onPointerCancel:j,onKeyDown:g,onKeyUp:w,onBlur:T})=>{const d=i===void 0?t.jsx(P,{baseClassName:o}):i;return t.jsx("button",{ref:p,type:"button",className:v.default(`${o}__thumb`,s,{[`${o}__thumb--pill`]:n!==void 0,[`${o}__thumb--held`]:l,[`${o}__thumb--hidden`]:r}),style:{"--seldon-slide-hit-tolerance":"8px",width:n!==void 0?`${n}px`:void 0,transform:`translateY(-50%) translateX(${x}px)`,transition:$==="snapping"&&a>0?`transform ${a}ms ease-out, opacity 100ms ease-out`:"opacity 100ms ease-out"},"aria-label":m,"aria-describedby":e&&u?u:void 0,"aria-busy":h?!0:void 0,"aria-disabled":c||h?!0:void 0,"aria-hidden":r?!0:void 0,disabled:c,tabIndex:r?-1:void 0,onPointerDown:e?b:void 0,onPointerMove:e?f:void 0,onPointerUp:e?y:void 0,onPointerCancel:e?j:void 0,onKeyDown:e?g:void 0,onKeyUp:e?w:void 0,onBlur:e?T:void 0,children:t.jsx("span",{className:`${o}__thumb-face`,"aria-hidden":d?!0:void 0,children:d?t.jsx("span",{className:v.default(`${o}__thumb-icon`,{[`${o}__thumb-icon--held`]:l}),children:d}):null})})};exports.SlideToActivateThumb=S;
@@ -0,0 +1,28 @@
1
+ import { KeyboardEvent, PointerEvent, ReactNode, Ref } from 'react';
2
+ import { SlideToActivateStatus } from './slideToActivateUtils';
3
+ interface SlideToActivateThumbProps {
4
+ baseClassName: string;
5
+ thumbRef: Ref<HTMLButtonElement>;
6
+ thumbClassName?: string;
7
+ thumbWidth?: number;
8
+ thumbIcon?: ReactNode;
9
+ thumbTranslatePx: number;
10
+ labelText: string;
11
+ descriptionId?: string;
12
+ isHeld: boolean;
13
+ isPending: boolean;
14
+ isDisabled: boolean;
15
+ isThumbHidden: boolean;
16
+ isInteractive: boolean;
17
+ status: SlideToActivateStatus;
18
+ snapDurationMs: number;
19
+ onPointerDown?: (event: PointerEvent<HTMLButtonElement>) => void;
20
+ onPointerMove?: (event: PointerEvent<HTMLButtonElement>) => void;
21
+ onPointerUp?: () => void;
22
+ onPointerCancel?: () => void;
23
+ onKeyDown?: (event: KeyboardEvent<HTMLButtonElement>) => void;
24
+ onKeyUp?: (event: KeyboardEvent<HTMLButtonElement>) => void;
25
+ onBlur?: () => void;
26
+ }
27
+ export declare const SlideToActivateThumb: ({ baseClassName, thumbRef, thumbClassName, thumbWidth, thumbIcon, thumbTranslatePx, labelText, descriptionId, isHeld, isPending, isDisabled, isThumbHidden, isInteractive, status, snapDurationMs, onPointerDown, onPointerMove, onPointerUp, onPointerCancel, onKeyDown, onKeyUp, onBlur, }: SlideToActivateThumbProps) => import("react/jsx-runtime").JSX.Element;
28
+ export {};
@@ -0,0 +1,76 @@
1
+ import { jsx as n, jsxs as K } from "react/jsx-runtime";
2
+ import v from "../../_virtual/index2.js";
3
+ import p from "../Icon/Icon.js";
4
+ const R = ({ baseClassName: o }) => /* @__PURE__ */ K("span", { className: `${o}__thumb-chevrons`, "aria-hidden": !0, children: [
5
+ /* @__PURE__ */ n(p, { icon: "ChevronRight", height: 22, width: 22, color: "currentColor" }),
6
+ /* @__PURE__ */ n(p, { icon: "ChevronRight", height: 22, width: 22, color: "currentColor" })
7
+ ] }), B = ({
8
+ baseClassName: o,
9
+ thumbRef: _,
10
+ thumbClassName: m,
11
+ thumbWidth: t,
12
+ thumbIcon: e,
13
+ thumbTranslatePx: $,
14
+ labelText: f,
15
+ descriptionId: h,
16
+ isHeld: l,
17
+ isPending: u,
18
+ isDisabled: c,
19
+ isThumbHidden: i,
20
+ isInteractive: r,
21
+ status: y,
22
+ snapDurationMs: a,
23
+ onPointerDown: b,
24
+ onPointerMove: x,
25
+ onPointerUp: s,
26
+ onPointerCancel: w,
27
+ onKeyDown: g,
28
+ onKeyUp: P,
29
+ onBlur: j
30
+ }) => {
31
+ const d = e === void 0 ? /* @__PURE__ */ n(R, { baseClassName: o }) : e;
32
+ return /* @__PURE__ */ n(
33
+ "button",
34
+ {
35
+ ref: _,
36
+ type: "button",
37
+ className: v(`${o}__thumb`, m, {
38
+ [`${o}__thumb--pill`]: t !== void 0,
39
+ [`${o}__thumb--held`]: l,
40
+ [`${o}__thumb--hidden`]: i
41
+ }),
42
+ style: {
43
+ "--seldon-slide-hit-tolerance": "8px",
44
+ width: t !== void 0 ? `${t}px` : void 0,
45
+ transform: `translateY(-50%) translateX(${$}px)`,
46
+ transition: y === "snapping" && a > 0 ? `transform ${a}ms ease-out, opacity 100ms ease-out` : "opacity 100ms ease-out"
47
+ },
48
+ "aria-label": f,
49
+ "aria-describedby": r && h ? h : void 0,
50
+ "aria-busy": u ? !0 : void 0,
51
+ "aria-disabled": c || u ? !0 : void 0,
52
+ "aria-hidden": i ? !0 : void 0,
53
+ disabled: c,
54
+ tabIndex: i ? -1 : void 0,
55
+ onPointerDown: r ? b : void 0,
56
+ onPointerMove: r ? x : void 0,
57
+ onPointerUp: r ? s : void 0,
58
+ onPointerCancel: r ? w : void 0,
59
+ onKeyDown: r ? g : void 0,
60
+ onKeyUp: r ? P : void 0,
61
+ onBlur: r ? j : void 0,
62
+ children: /* @__PURE__ */ n("span", { className: `${o}__thumb-face`, "aria-hidden": d ? !0 : void 0, children: d ? /* @__PURE__ */ n(
63
+ "span",
64
+ {
65
+ className: v(`${o}__thumb-icon`, {
66
+ [`${o}__thumb-icon--held`]: l
67
+ }),
68
+ children: d
69
+ }
70
+ ) : null })
71
+ }
72
+ );
73
+ };
74
+ export {
75
+ B as SlideToActivateThumb
76
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react"),L=require("../types.cjs"),I=require("../slideToActivateUtils.cjs"),R=.95,k=8,M=1,O=(o,l)=>{try{return o.setPointerCapture(l),typeof o.hasPointerCapture=="function"?o.hasPointerCapture(l):!1}catch{return!1}},T=({direction:o,isDisabled:l,stateRef:r,measureTravel:p,dispatch:C,emitProgress:S,runActivation:m,snapToIdle:E})=>{const b=n.useRef(0),y=n.useRef(0),P=n.useRef(!1),s=n.useRef(null),D=n.useRef(null),h=n.useRef(null),i=n.useCallback(()=>{h.current?.(),h.current=null},[]);n.useEffect(()=>()=>i(),[i]);const f=n.useCallback((e,t)=>{if(t!==s.current||r.current.status!=="dragging")return;let a=r.current.maxTravel;if(a<=0&&(p(),a=r.current.maxTravel,a<=0))return;const d=e-b.current,u=o===L.SlideToActivateDirections.rtl?-d:d;if(!P.current){if(Math.abs(u)<k)return;P.current=!0}const c=I.clampProgress(y.current+u*M/a);S(c)},[o,S,p,r]),g=n.useCallback(()=>{i();const e=D.current,t=s.current;try{e&&t!==null&&e.hasPointerCapture(t)&&e.releasePointerCapture(t)}catch{}if(s.current=null,D.current=null,r.current.status==="dragging"){if(r.current.progress>=R||r.current.progress>=1){m();return}E()}},[i,m,E,r]),v=n.useCallback(e=>{e.pointerId===s.current&&(e.cancelable&&e.preventDefault(),f(e.clientX,e.pointerId))},[f]);return{handlePointerDown:n.useCallback(e=>{if(l||I.isGestureBusy(r.current.status)||r.current.progress>=1)return;e.preventDefault(),p();const t=e.currentTarget;t.focus(),D.current=t,s.current=e.pointerId;const a=O(t,e.pointerId);if(b.current=e.clientX,y.current=r.current.progress,P.current=!1,C({type:"dragStarted"}),i(),!a){const d=c=>{c.cancelable&&c.preventDefault(),f(c.clientX,c.pointerId)},u=c=>{c.pointerId===s.current&&g()};document.addEventListener("pointermove",d,{passive:!1}),document.addEventListener("pointerup",u),document.addEventListener("pointercancel",u),h.current=()=>{document.removeEventListener("pointermove",d),document.removeEventListener("pointerup",u),document.removeEventListener("pointercancel",u)}}},[f,i,C,g,l,p,r]),handlePointerMove:v,handlePointerUp:g,handlePointerCancel:g}};exports.useSlideDragHandlers=T;
@@ -0,0 +1,20 @@
1
+ import { MutableRefObject, PointerEvent as ReactPointerEvent } from 'react';
2
+ import { SlideToActivateAction, SlideToActivateState } from '../slideToActivateReducer';
3
+ import { SlideToActivateDirections } from '../types';
4
+ interface UseSlideDragHandlersOptions {
5
+ direction: SlideToActivateDirections | `${SlideToActivateDirections}`;
6
+ isDisabled: boolean;
7
+ stateRef: MutableRefObject<SlideToActivateState>;
8
+ measureTravel: () => void;
9
+ dispatch: (action: SlideToActivateAction) => void;
10
+ emitProgress: (progress: number) => void;
11
+ runActivation: () => Promise<void>;
12
+ snapToIdle: () => void;
13
+ }
14
+ export declare const useSlideDragHandlers: ({ direction, isDisabled, stateRef, measureTravel, dispatch, emitProgress, runActivation, snapToIdle, }: UseSlideDragHandlersOptions) => {
15
+ handlePointerDown: (event: ReactPointerEvent<HTMLButtonElement>) => void;
16
+ handlePointerMove: (event: ReactPointerEvent<HTMLButtonElement>) => void;
17
+ handlePointerUp: () => void;
18
+ handlePointerCancel: () => void;
19
+ };
20
+ export {};