@phillips/seldon 1.277.0 → 1.278.1

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 (47) 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/index.cjs +1 -1
  36. package/dist/index.d.ts +1 -0
  37. package/dist/index.js +104 -98
  38. package/dist/node_modules/ics/dist/index.cjs +1 -1
  39. package/dist/node_modules/ics/dist/index.js +1 -1
  40. package/dist/node_modules/prop-types/node_modules/react-is/index.cjs +1 -1
  41. package/dist/node_modules/prop-types/node_modules/react-is/index.js +1 -1
  42. package/dist/patterns/Subscribe/Subscribe.d.ts +1 -1
  43. package/dist/scss/componentStyles.scss +1 -0
  44. package/dist/scss/components/SlideToActivate/_slideToActivate.scss +284 -0
  45. package/dist/scss/components/SlideToActivate/_slideToActivate.stories.scss +166 -0
  46. package/dist/scss/components/Toast/_toast.scss +5 -6
  47. package/package.json +1 -1
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var e={exports:{}};exports.__module=e;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var e={};exports.__exports=e;
@@ -1,4 +1,4 @@
1
- var e = { exports: {} };
1
+ var r = {};
2
2
  export {
3
- e as __module
3
+ r as __exports
4
4
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var e={};exports.__exports=e;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var e={exports:{}};exports.__module=e;
@@ -1,4 +1,4 @@
1
- var r = {};
1
+ var e = { exports: {} };
2
2
  export {
3
- r as __exports
3
+ e as __module
4
4
  };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("react/jsx-runtime"),S=require("../../node_modules/@radix-ui/react-visually-hidden/dist/index.cjs"),x=require("../../_virtual/index2.cjs"),P=require("react"),de=require("../../utils/index.cjs"),oe=require("./SlideToActivateThumb.cjs"),re=require("./hooks/useSlideToActivate.cjs"),D=require("./slideToActivateUtils.cjs"),n=require("./types.cjs"),le=require("../Text/types.cjs"),ce=require("../../utils/useReducedMotion.cjs"),ue=require("../Text/Text.cjs"),he=require("../Loader/Loader.cjs"),g=P.forwardRef(({labelText:o,onActivation:q,onError:y,onProgress:j,onStatusChange:R,pendingAnnouncement:N=o,successAnnouncement:_="Activated.",errorAnnouncement:M="Action failed. Please try again.",keyboardHint:l=D.DEFAULT_KEYBOARD_HINT,resetOnError:I=!0,isDisabled:c=!1,isComplete:s=!1,showThumbWhenDisabled:w=!0,config:K={},className:U,id:u,...k},B)=>{const{textVariant:C=le.TextVariants.labelMedium,size:h=n.SlideToActivateSizes.default,borderRadius:H=n.SlideToActivateBorderRadii.sharp,direction:m=n.SlideToActivateDirections.ltr,thumbIcon:V,thumbWidth:z,pendingIndicator:v,trackClassName:E,thumbClassName:F}=K,{className:e,...L}=de.getCommonProps({id:u,...k},"SlideToActivate"),O=ce.useReducedMotion(),b=P.useId(),a=c||s,{status:d,announcement:W,trackRef:Y,thumbRef:T,thumbTranslatePx:G,handlePointerDown:J,handlePointerMove:Q,handlePointerUp:X,handlePointerCancel:Z,handleKeyDown:ee,handleKeyUp:te,handleBlur:ie,snapDurationMs:ne}=re.useSlideToActivate({direction:m,isDisabled:a,reduceMotion:O,pendingAnnouncement:N,successAnnouncement:_,errorAnnouncement:M,resetOnError:I,onActivation:q,onError:y,onProgress:j,onStatusChange:R}),i=d==="pending",f=d==="dragging",p=!a&&!i,A=c&&!s,se=m===n.SlideToActivateDirections.rtl,r=s||A&&!w,$=l.trim().length>0;return t.jsx("div",{...L,id:u,ref:B,className:x.default(e,U,{[`${e}--${h}`]:h!==n.SlideToActivateSizes.default,[`${e}--radius-${H}`]:!0,[`${e}--disabled`]:a,[`${e}--disabled-blocked`]:A,[`${e}--disabled-complete`]:s,[`${e}--disabled-hide-thumb`]:r,[`${e}--pending`]:i,[`${e}--rtl`]:se,[`${e}--held`]:f}),"data-status":d,"aria-busy":i?!0:void 0,children:t.jsxs("div",{ref:Y,className:x.default(`${e}__track`,E),onPointerDown:ae=>D.focusThumbFromTrack({event:ae,thumb:T.current,isInteractive:p,isThumbHidden:r}),children:[t.jsx(ue.default,{className:`${e}__label`,element:"span",variant:C,"aria-hidden":i?!0:void 0,children:o}),t.jsx(S.VisuallyHidden,{asChild:!0,children:t.jsx("span",{role:"status","aria-live":"polite","aria-atomic":"true",children:W})}),$?t.jsx(S.VisuallyHidden,{id:b,children:l}):null,i?v!==void 0?v:t.jsx("span",{className:`${e}__pending-indicator`,"aria-hidden":!0,children:t.jsx(he.default,{isCentered:!1})}):null,t.jsx(oe.SlideToActivateThumb,{baseClassName:e,thumbRef:T,thumbClassName:F,thumbWidth:z,thumbIcon:V,thumbTranslatePx:G,labelText:o,descriptionId:$?b:void 0,isHeld:f,isPending:i,isDisabled:a,isThumbHidden:r,isInteractive:p,status:d,snapDurationMs:ne,onPointerDown:J,onPointerMove:Q,onPointerUp:X,onPointerCancel:Z,onKeyDown:ee,onKeyUp:te,onBlur:ie})]})})});g.displayName="SlideToActivate";exports.default=g;
@@ -0,0 +1,14 @@
1
+ import { SlideToActivateProps } from './types';
2
+ export type { SlideToActivateConfig, SlideToActivateProps } from './types';
3
+ /**
4
+ * ## Overview
5
+ *
6
+ * One-shot slide-to-activate control. Thumb latches at the end while
7
+ * `onActivation` is pending, then the parent typically marks it complete
8
+ * via `isComplete` (implies non-interactive).
9
+ *
10
+ * [Storybook Link](https://phillips-seldon.netlify.app/?path=/docs/components-slidetoactivate--overview)
11
+ * [Figma](https://www.figma.com/design/ROSowkNXfQv1nhos5vuyWG/Saleroom?node-id=8259-82408&m=dev)
12
+ */
13
+ declare const SlideToActivate: import('react').ForwardRefExoticComponent<SlideToActivateProps & import('react').RefAttributes<HTMLDivElement>>;
14
+ export default SlideToActivate;
@@ -0,0 +1,147 @@
1
+ import { jsx as i, jsxs as ae } from "react/jsx-runtime";
2
+ import { VisuallyHidden as $ } from "../../node_modules/@radix-ui/react-visually-hidden/dist/index.js";
3
+ import D from "../../_virtual/index2.js";
4
+ import { forwardRef as ne, useId as re } from "react";
5
+ import { getCommonProps as se } from "../../utils/index.js";
6
+ import { SlideToActivateThumb as de } from "./SlideToActivateThumb.js";
7
+ import { useSlideToActivate as le } from "./hooks/useSlideToActivate.js";
8
+ import { DEFAULT_KEYBOARD_HINT as ce, focusThumbFromTrack as me } from "./slideToActivateUtils.js";
9
+ import { SlideToActivateSizes as A, SlideToActivateBorderRadii as ue, SlideToActivateDirections as g } from "./types.js";
10
+ import { TextVariants as he } from "../Text/types.js";
11
+ import { useReducedMotion as pe } from "../../utils/useReducedMotion.js";
12
+ import fe from "../Text/Text.js";
13
+ import be from "../Loader/Loader.js";
14
+ const ve = ne(
15
+ ({
16
+ labelText: r,
17
+ onActivation: N,
18
+ onError: y,
19
+ onProgress: S,
20
+ onStatusChange: R,
21
+ pendingAnnouncement: _ = r,
22
+ successAnnouncement: I = "Activated.",
23
+ errorAnnouncement: w = "Action failed. Please try again.",
24
+ keyboardHint: d = ce,
25
+ resetOnError: K = !0,
26
+ isDisabled: l = !1,
27
+ isComplete: o = !1,
28
+ showThumbWhenDisabled: M = !0,
29
+ config: k = {},
30
+ className: x,
31
+ id: c,
32
+ ...B
33
+ }, C) => {
34
+ const {
35
+ textVariant: U = he.labelMedium,
36
+ size: m = A.default,
37
+ borderRadius: H = ue.sharp,
38
+ direction: u = g.ltr,
39
+ thumbIcon: E,
40
+ thumbWidth: V,
41
+ pendingIndicator: h,
42
+ trackClassName: j,
43
+ thumbClassName: z
44
+ } = k, { className: e, ...F } = se({ id: c, ...B }, "SlideToActivate"), L = pe(), p = re(), a = l || o, {
45
+ status: n,
46
+ announcement: O,
47
+ trackRef: W,
48
+ thumbRef: f,
49
+ thumbTranslatePx: Y,
50
+ handlePointerDown: q,
51
+ handlePointerMove: G,
52
+ handlePointerUp: J,
53
+ handlePointerCancel: Q,
54
+ handleKeyDown: X,
55
+ handleKeyUp: Z,
56
+ handleBlur: ee,
57
+ snapDurationMs: ie
58
+ } = le({
59
+ direction: u,
60
+ isDisabled: a,
61
+ reduceMotion: L,
62
+ pendingAnnouncement: _,
63
+ successAnnouncement: I,
64
+ errorAnnouncement: w,
65
+ resetOnError: K,
66
+ onActivation: N,
67
+ onError: y,
68
+ onProgress: S,
69
+ onStatusChange: R
70
+ }), t = n === "pending", b = n === "dragging", v = !a && !t, T = l && !o, te = u === g.rtl, s = o || T && !M, P = d.trim().length > 0;
71
+ return /* @__PURE__ */ i(
72
+ "div",
73
+ {
74
+ ...F,
75
+ id: c,
76
+ ref: C,
77
+ className: D(e, x, {
78
+ [`${e}--${m}`]: m !== A.default,
79
+ [`${e}--radius-${H}`]: !0,
80
+ [`${e}--disabled`]: a,
81
+ [`${e}--disabled-blocked`]: T,
82
+ [`${e}--disabled-complete`]: o,
83
+ [`${e}--disabled-hide-thumb`]: s,
84
+ [`${e}--pending`]: t,
85
+ [`${e}--rtl`]: te,
86
+ [`${e}--held`]: b
87
+ }),
88
+ "data-status": n,
89
+ "aria-busy": t ? !0 : void 0,
90
+ children: /* @__PURE__ */ ae(
91
+ "div",
92
+ {
93
+ ref: W,
94
+ className: D(`${e}__track`, j),
95
+ onPointerDown: (oe) => me({ event: oe, thumb: f.current, isInteractive: v, isThumbHidden: s }),
96
+ children: [
97
+ /* @__PURE__ */ i(
98
+ fe,
99
+ {
100
+ className: `${e}__label`,
101
+ element: "span",
102
+ variant: U,
103
+ "aria-hidden": t ? !0 : void 0,
104
+ children: r
105
+ }
106
+ ),
107
+ /* @__PURE__ */ i($, { asChild: !0, children: /* @__PURE__ */ i("span", { role: "status", "aria-live": "polite", "aria-atomic": "true", children: O }) }),
108
+ P ? /* @__PURE__ */ i($, { id: p, children: d }) : null,
109
+ t ? h !== void 0 ? h : /* @__PURE__ */ i("span", { className: `${e}__pending-indicator`, "aria-hidden": !0, children: /* @__PURE__ */ i(be, { isCentered: !1 }) }) : null,
110
+ /* @__PURE__ */ i(
111
+ de,
112
+ {
113
+ baseClassName: e,
114
+ thumbRef: f,
115
+ thumbClassName: z,
116
+ thumbWidth: V,
117
+ thumbIcon: E,
118
+ thumbTranslatePx: Y,
119
+ labelText: r,
120
+ descriptionId: P ? p : void 0,
121
+ isHeld: b,
122
+ isPending: t,
123
+ isDisabled: a,
124
+ isThumbHidden: s,
125
+ isInteractive: v,
126
+ status: n,
127
+ snapDurationMs: ie,
128
+ onPointerDown: q,
129
+ onPointerMove: G,
130
+ onPointerUp: J,
131
+ onPointerCancel: Q,
132
+ onKeyDown: X,
133
+ onKeyUp: Z,
134
+ onBlur: ee
135
+ }
136
+ )
137
+ ]
138
+ }
139
+ )
140
+ }
141
+ );
142
+ }
143
+ );
144
+ ve.displayName = "SlideToActivate";
145
+ export {
146
+ ve as default
147
+ };
@@ -0,0 +1,276 @@
1
+ import { TextVariants } from '../Text';
2
+ import { SlideToActivateBorderRadii, SlideToActivateDirections } from './types';
3
+ export declare const actionArgTypes: {
4
+ onActivation: {
5
+ action: string;
6
+ description: string;
7
+ table: {
8
+ type: {
9
+ summary: string;
10
+ };
11
+ };
12
+ };
13
+ onError: {
14
+ action: string;
15
+ description: string;
16
+ table: {
17
+ type: {
18
+ summary: string;
19
+ };
20
+ };
21
+ };
22
+ onProgress: {
23
+ action: string;
24
+ description: string;
25
+ table: {
26
+ type: {
27
+ summary: string;
28
+ };
29
+ };
30
+ };
31
+ };
32
+ /** Controls-tab docs for Playground — ranges, defaults, and behavior notes. */
33
+ export declare const playgroundArgTypes: {
34
+ labelText: {
35
+ control: string;
36
+ description: string;
37
+ table: {
38
+ type: {
39
+ summary: string;
40
+ };
41
+ defaultValue: {
42
+ summary: string;
43
+ };
44
+ };
45
+ };
46
+ textVariant: {
47
+ control: {
48
+ type: string;
49
+ };
50
+ options: TextVariants[];
51
+ description: string;
52
+ table: {
53
+ type: {
54
+ summary: string;
55
+ };
56
+ defaultValue: {
57
+ summary: string;
58
+ };
59
+ };
60
+ };
61
+ direction: {
62
+ control: {
63
+ type: string;
64
+ };
65
+ options: SlideToActivateDirections[];
66
+ description: string;
67
+ table: {
68
+ type: {
69
+ summary: string;
70
+ };
71
+ defaultValue: {
72
+ summary: string;
73
+ };
74
+ };
75
+ };
76
+ size: {
77
+ control: {
78
+ type: string;
79
+ };
80
+ options: import('../..').ButtonSizes[];
81
+ description: string;
82
+ table: {
83
+ type: {
84
+ summary: string;
85
+ };
86
+ defaultValue: {
87
+ summary: string;
88
+ };
89
+ };
90
+ };
91
+ borderRadius: {
92
+ control: {
93
+ type: string;
94
+ };
95
+ options: SlideToActivateBorderRadii[];
96
+ description: string;
97
+ table: {
98
+ type: {
99
+ summary: string;
100
+ };
101
+ defaultValue: {
102
+ summary: string;
103
+ };
104
+ };
105
+ };
106
+ thumbWidth: {
107
+ control: {
108
+ type: string;
109
+ min: number;
110
+ max: number;
111
+ step: number;
112
+ };
113
+ description: string;
114
+ table: {
115
+ type: {
116
+ summary: string;
117
+ };
118
+ defaultValue: {
119
+ summary: string;
120
+ };
121
+ };
122
+ };
123
+ isDisabled: {
124
+ control: string;
125
+ description: string;
126
+ table: {
127
+ type: {
128
+ summary: string;
129
+ };
130
+ defaultValue: {
131
+ summary: string;
132
+ };
133
+ };
134
+ };
135
+ isComplete: {
136
+ control: string;
137
+ description: string;
138
+ table: {
139
+ type: {
140
+ summary: string;
141
+ };
142
+ defaultValue: {
143
+ summary: string;
144
+ };
145
+ };
146
+ };
147
+ showThumbWhenDisabled: {
148
+ control: string;
149
+ description: string;
150
+ table: {
151
+ type: {
152
+ summary: string;
153
+ };
154
+ defaultValue: {
155
+ summary: string;
156
+ };
157
+ };
158
+ };
159
+ pendingAnnouncement: {
160
+ control: string;
161
+ description: string;
162
+ table: {
163
+ type: {
164
+ summary: string;
165
+ };
166
+ defaultValue: {
167
+ summary: string;
168
+ };
169
+ };
170
+ };
171
+ successAnnouncement: {
172
+ control: string;
173
+ description: string;
174
+ table: {
175
+ type: {
176
+ summary: string;
177
+ };
178
+ defaultValue: {
179
+ summary: string;
180
+ };
181
+ };
182
+ };
183
+ errorAnnouncement: {
184
+ control: string;
185
+ description: string;
186
+ table: {
187
+ type: {
188
+ summary: string;
189
+ };
190
+ defaultValue: {
191
+ summary: string;
192
+ };
193
+ };
194
+ };
195
+ keyboardHint: {
196
+ control: string;
197
+ description: string;
198
+ table: {
199
+ type: {
200
+ summary: string;
201
+ };
202
+ defaultValue: {
203
+ summary: string;
204
+ };
205
+ };
206
+ };
207
+ trackClassName: {
208
+ control: string;
209
+ description: string;
210
+ table: {
211
+ type: {
212
+ summary: string;
213
+ };
214
+ };
215
+ };
216
+ thumbClassName: {
217
+ control: string;
218
+ description: string;
219
+ table: {
220
+ type: {
221
+ summary: string;
222
+ };
223
+ };
224
+ };
225
+ thumbIcon: {
226
+ control: boolean;
227
+ description: string;
228
+ table: {
229
+ type: {
230
+ summary: string;
231
+ };
232
+ defaultValue: {
233
+ summary: string;
234
+ };
235
+ };
236
+ };
237
+ pendingIndicator: {
238
+ control: boolean;
239
+ description: string;
240
+ table: {
241
+ type: {
242
+ summary: string;
243
+ };
244
+ defaultValue: {
245
+ summary: string;
246
+ };
247
+ };
248
+ };
249
+ onActivation: {
250
+ action: string;
251
+ description: string;
252
+ table: {
253
+ type: {
254
+ summary: string;
255
+ };
256
+ };
257
+ };
258
+ onError: {
259
+ action: string;
260
+ description: string;
261
+ table: {
262
+ type: {
263
+ summary: string;
264
+ };
265
+ };
266
+ };
267
+ onProgress: {
268
+ action: string;
269
+ description: string;
270
+ table: {
271
+ type: {
272
+ summary: string;
273
+ };
274
+ };
275
+ };
276
+ };