@sps-woodland/buttons 8.23.1 → 8.23.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.
- package/lib/button/Button.d.ts +6 -5
- package/lib/index.js +162 -151
- package/lib/index.umd.cjs +23 -23
- package/lib/style.css +1 -1
- package/package.json +5 -5
package/lib/button/Button.d.ts
CHANGED
@@ -1,9 +1,10 @@
|
|
1
1
|
import * as React from "react";
|
2
|
-
import type { PolymorphicComponentProps
|
2
|
+
import type { PolymorphicComponentProps } from "@sps-woodland/core";
|
3
3
|
import type { IconName } from "@sps-woodland/tokens";
|
4
4
|
import type { AriaButtonProps } from "@react-aria/button";
|
5
5
|
import type { ButtonKind } from "./Button.css";
|
6
|
-
type
|
6
|
+
type ButtonRef = React.RefObject<HTMLButtonElement | HTMLAnchorElement>;
|
7
|
+
type ButtonProps<T extends React.ElementType = "button" | "a"> = PolymorphicComponentProps<AriaButtonProps<"button"> & {
|
7
8
|
disabled?: boolean;
|
8
9
|
href?: string;
|
9
10
|
icon?: IconName;
|
@@ -11,7 +12,7 @@ type ButtonProps<T extends React.ElementType> = PolymorphicComponentProps<AriaBu
|
|
11
12
|
spinning?: boolean;
|
12
13
|
spinningTitle?: string;
|
13
14
|
title?: string;
|
15
|
+
ref?: React.RefObject<HTMLButtonElement | HTMLAnchorElement>;
|
14
16
|
}, T>;
|
15
|
-
declare
|
16
|
-
|
17
|
-
export { frButton as Button };
|
17
|
+
declare const Button: React.ForwardRefExoticComponent<Pick<ButtonProps<"button" | "a">, "color" | "icon" | "kind" | "key" | "disabled" | "spinning" | "content" | "translate" | "hidden" | "style" | "slot" | "title" | "as" | keyof AriaButtonProps<"button"> | "spinningTitle" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "autoCapitalize" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "lang" | "nonce" | "placeholder" | "spellCheck" | "tabIndex" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "rev" | "typeof" | "vocab" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-current" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-flowto" | "aria-grabbed" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocusCapture" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "data-testid"> & React.RefAttributes<ButtonRef>>;
|
18
|
+
export { Button };
|
package/lib/index.js
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
import * as c from "react";
|
2
|
-
import
|
3
|
-
import {
|
2
|
+
import Ee, { useRef as ee, useCallback as z, useEffect as J, useState as $e, useMemo as Be, useContext as Me } from "react";
|
3
|
+
import { I18nContext as Fe, Spinner as Ue, cl as He, Metadata as Re, Icon as Ge } from "@sps-woodland/core";
|
4
4
|
import { useFocusable as Ve, FocusRing as We } from "@react-aria/focus";
|
5
5
|
import { code as y } from "@spscommerce/utils";
|
6
|
-
const Pe = typeof document < "u" ?
|
6
|
+
const Pe = typeof document < "u" ? Ee.useLayoutEffect : () => {
|
7
7
|
};
|
8
8
|
function H(e) {
|
9
9
|
const t = ee(null);
|
@@ -250,7 +250,7 @@ function ut(e) {
|
|
250
250
|
return !Oe() && e.width === 0 && e.height === 0 || e.width === 1 && e.height === 1 && e.pressure === 0 && e.detail === 0 && e.pointerType === "mouse";
|
251
251
|
}
|
252
252
|
let U = "default", ue = "", q = /* @__PURE__ */ new WeakMap();
|
253
|
-
function
|
253
|
+
function be(e) {
|
254
254
|
if (De()) {
|
255
255
|
if (U === "default") {
|
256
256
|
const t = I(e);
|
@@ -275,7 +275,7 @@ function Y(e) {
|
|
275
275
|
e.style.userSelect === "none" && (e.style.userSelect = t), e.getAttribute("style") === "" && e.removeAttribute("style"), q.delete(e);
|
276
276
|
}
|
277
277
|
}
|
278
|
-
const Ce =
|
278
|
+
const Ce = Ee.createContext({
|
279
279
|
register: () => {
|
280
280
|
}
|
281
281
|
});
|
@@ -306,7 +306,7 @@ function mt(e, t, r) {
|
|
306
306
|
t.value = r;
|
307
307
|
}
|
308
308
|
}
|
309
|
-
function
|
309
|
+
function ge(e, t, r) {
|
310
310
|
var o = Ke(e, t, "set");
|
311
311
|
return mt(e, o, r), r;
|
312
312
|
}
|
@@ -321,7 +321,7 @@ function _t(e) {
|
|
321
321
|
var j = /* @__PURE__ */ new WeakMap();
|
322
322
|
class X {
|
323
323
|
continuePropagation() {
|
324
|
-
|
324
|
+
ge(this, j, !1);
|
325
325
|
}
|
326
326
|
get shouldStopPropagation() {
|
327
327
|
return dt(this, j);
|
@@ -330,16 +330,16 @@ class X {
|
|
330
330
|
ft(this, j, {
|
331
331
|
writable: !0,
|
332
332
|
value: void 0
|
333
|
-
}),
|
333
|
+
}), ge(this, j, !0);
|
334
334
|
var d;
|
335
335
|
let u = (d = a == null ? void 0 : a.target) !== null && d !== void 0 ? d : o.currentTarget;
|
336
336
|
const p = u == null ? void 0 : u.getBoundingClientRect();
|
337
|
-
let m, v = 0,
|
338
|
-
o.clientX != null && o.clientY != null && (
|
337
|
+
let m, v = 0, b, E = null;
|
338
|
+
o.clientX != null && o.clientY != null && (b = o.clientX, E = o.clientY), p && (b != null && E != null ? (m = b - p.left, v = E - p.top) : (m = p.width / 2, v = p.height / 2)), this.type = t, this.pointerType = r, this.target = o.currentTarget, this.shiftKey = o.shiftKey, this.metaKey = o.metaKey, this.ctrlKey = o.ctrlKey, this.altKey = o.altKey, this.x = m, this.y = v;
|
339
339
|
}
|
340
340
|
}
|
341
341
|
const ve = Symbol("linkClicked");
|
342
|
-
function
|
342
|
+
function bt(e) {
|
343
343
|
let {
|
344
344
|
onPress: t,
|
345
345
|
onPressChange: r,
|
@@ -350,11 +350,11 @@ function gt(e) {
|
|
350
350
|
isPressed: p,
|
351
351
|
preventFocusOnPress: m,
|
352
352
|
shouldCancelOnPointerExit: v,
|
353
|
-
allowTextSelectionOnPress:
|
353
|
+
allowTextSelectionOnPress: b,
|
354
354
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
355
|
-
ref:
|
355
|
+
ref: E,
|
356
356
|
...x
|
357
|
-
} = _t(e), [_,
|
357
|
+
} = _t(e), [_, $] = $e(!1), w = ee({
|
358
358
|
isPressed: !1,
|
359
359
|
ignoreEmulatedMouseEvents: !1,
|
360
360
|
ignoreClickAfterPress: !1,
|
@@ -364,16 +364,16 @@ function gt(e) {
|
|
364
364
|
target: null,
|
365
365
|
isOverTarget: !1,
|
366
366
|
pointerType: null
|
367
|
-
}), { addGlobalListener: T, removeAllGlobalListeners: S } = it(),
|
368
|
-
let
|
369
|
-
if (u ||
|
367
|
+
}), { addGlobalListener: T, removeAllGlobalListeners: S } = it(), B = H((n, f) => {
|
368
|
+
let P = w.current;
|
369
|
+
if (u || P.didFirePressStart) return !1;
|
370
370
|
let l = !0;
|
371
|
-
if (
|
371
|
+
if (P.isTriggeringEvent = !0, o) {
|
372
372
|
let h = new X("pressstart", f, n);
|
373
373
|
o(h), l = h.shouldStopPropagation;
|
374
374
|
}
|
375
|
-
return r && r(!0),
|
376
|
-
}), k = H((n, f,
|
375
|
+
return r && r(!0), P.isTriggeringEvent = !1, P.didFirePressStart = !0, $(!0), l;
|
376
|
+
}), k = H((n, f, P = !0) => {
|
377
377
|
let l = w.current;
|
378
378
|
if (!l.didFirePressStart) return !1;
|
379
379
|
l.ignoreClickAfterPress = !0, l.didFirePressStart = !1, l.isTriggeringEvent = !0;
|
@@ -382,26 +382,26 @@ function gt(e) {
|
|
382
382
|
let s = new X("pressend", f, n);
|
383
383
|
a(s), h = s.shouldStopPropagation;
|
384
384
|
}
|
385
|
-
if (r && r(!1),
|
385
|
+
if (r && r(!1), $(!1), t && P && !u) {
|
386
386
|
let s = new X("press", f, n);
|
387
387
|
t(s), h && (h = s.shouldStopPropagation);
|
388
388
|
}
|
389
389
|
return l.isTriggeringEvent = !1, h;
|
390
390
|
}), D = H((n, f) => {
|
391
|
-
let
|
391
|
+
let P = w.current;
|
392
392
|
if (u) return !1;
|
393
393
|
if (d) {
|
394
|
-
|
394
|
+
P.isTriggeringEvent = !0;
|
395
395
|
let l = new X("pressup", f, n);
|
396
|
-
return d(l),
|
396
|
+
return d(l), P.isTriggeringEvent = !1, l.shouldStopPropagation;
|
397
397
|
}
|
398
398
|
return !0;
|
399
399
|
}), N = H((n) => {
|
400
400
|
let f = w.current;
|
401
|
-
f.isPressed && f.target && (f.isOverTarget && f.pointerType != null && k(C(f.target, n), f.pointerType, !1), f.isPressed = !1, f.isOverTarget = !1, f.activePointerId = null, f.pointerType = null, S(),
|
401
|
+
f.isPressed && f.target && (f.isOverTarget && f.pointerType != null && k(C(f.target, n), f.pointerType, !1), f.isPressed = !1, f.isOverTarget = !1, f.activePointerId = null, f.pointerType = null, S(), b || Y(f.target));
|
402
402
|
}), A = H((n) => {
|
403
403
|
v && N(n);
|
404
|
-
}), oe =
|
404
|
+
}), oe = Be(() => {
|
405
405
|
let n = w.current, f = {
|
406
406
|
onKeyDown(l) {
|
407
407
|
if (re(l.nativeEvent, l.currentTarget) && l.currentTarget.contains(l.target)) {
|
@@ -409,11 +409,11 @@ function gt(e) {
|
|
409
409
|
ye(l.target, l.key) && l.preventDefault();
|
410
410
|
let s = !0;
|
411
411
|
if (!n.isPressed && !l.repeat) {
|
412
|
-
n.target = l.currentTarget, n.isPressed = !0, s =
|
413
|
-
let
|
414
|
-
re(O,
|
412
|
+
n.target = l.currentTarget, n.isPressed = !0, s = B(l, "keyboard");
|
413
|
+
let g = l.currentTarget, i = (O) => {
|
414
|
+
re(O, g) && !O.repeat && g.contains(O.target) && n.target && D(C(n.target, O), "keyboard");
|
415
415
|
};
|
416
|
-
T(I(l.currentTarget), "keyup", xe(i,
|
416
|
+
T(I(l.currentTarget), "keyup", xe(i, P), !0);
|
417
417
|
}
|
418
418
|
s && l.stopPropagation(), l.metaKey && Q() && ((h = n.metaKeyEvents) === null || h === void 0 || h.set(l.key, l.nativeEvent));
|
419
419
|
} else l.key === "Meta" && (n.metaKeyEvents = /* @__PURE__ */ new Map());
|
@@ -423,13 +423,13 @@ function gt(e) {
|
|
423
423
|
let h = !0;
|
424
424
|
if (u && l.preventDefault(), !n.ignoreClickAfterPress && !n.ignoreEmulatedMouseEvents && !n.isPressed && (n.pointerType === "virtual" || _e(l.nativeEvent))) {
|
425
425
|
!u && !m && R(l.currentTarget);
|
426
|
-
let s =
|
427
|
-
h = s &&
|
426
|
+
let s = B(l, "virtual"), g = D(l, "virtual"), i = k(l, "virtual");
|
427
|
+
h = s && g && i;
|
428
428
|
}
|
429
429
|
n.ignoreEmulatedMouseEvents = !1, n.ignoreClickAfterPress = !1, h && l.stopPropagation();
|
430
430
|
}
|
431
431
|
}
|
432
|
-
},
|
432
|
+
}, P = (l) => {
|
433
433
|
var h;
|
434
434
|
if (n.isPressed && n.target && re(l, n.target)) {
|
435
435
|
var s;
|
@@ -437,10 +437,10 @@ function gt(e) {
|
|
437
437
|
let i = l.target;
|
438
438
|
k(C(n.target, l), "keyboard", n.target.contains(i)), S(), l.key !== "Enter" && pe(n.target) && n.target.contains(i) && !l[ve] && (l[ve] = !0, V(n.target, l, !1)), n.isPressed = !1, (s = n.metaKeyEvents) === null || s === void 0 || s.delete(l.key);
|
439
439
|
} else if (l.key === "Meta" && (!((h = n.metaKeyEvents) === null || h === void 0) && h.size)) {
|
440
|
-
var
|
440
|
+
var g;
|
441
441
|
let i = n.metaKeyEvents;
|
442
442
|
n.metaKeyEvents = void 0;
|
443
|
-
for (let O of i.values()) (
|
443
|
+
for (let O of i.values()) (g = n.target) === null || g === void 0 || g.dispatchEvent(new KeyboardEvent("keyup", O));
|
444
444
|
}
|
445
445
|
};
|
446
446
|
if (typeof PointerEvent < "u") {
|
@@ -452,21 +452,21 @@ function gt(e) {
|
|
452
452
|
}
|
453
453
|
se(i.currentTarget) && i.preventDefault(), n.pointerType = i.pointerType;
|
454
454
|
let O = !0;
|
455
|
-
n.isPressed || (n.isPressed = !0, n.isOverTarget = !0, n.activePointerId = i.pointerId, n.target = i.currentTarget, !u && !m && R(i.currentTarget),
|
455
|
+
n.isPressed || (n.isPressed = !0, n.isOverTarget = !0, n.activePointerId = i.pointerId, n.target = i.currentTarget, !u && !m && R(i.currentTarget), b || be(n.target), O = B(i, n.pointerType), T(I(i.currentTarget), "pointermove", l, !1), T(I(i.currentTarget), "pointerup", h, !1), T(I(i.currentTarget), "pointercancel", g, !1)), O && i.stopPropagation();
|
456
456
|
}, f.onMouseDown = (i) => {
|
457
457
|
i.currentTarget.contains(i.target) && i.button === 0 && (se(i.currentTarget) && i.preventDefault(), i.stopPropagation());
|
458
458
|
}, f.onPointerUp = (i) => {
|
459
459
|
!i.currentTarget.contains(i.target) || n.pointerType === "virtual" || i.button === 0 && M(i, i.currentTarget) && D(i, n.pointerType || i.pointerType);
|
460
460
|
};
|
461
461
|
let l = (i) => {
|
462
|
-
i.pointerId === n.activePointerId && (n.target && M(i, n.target) ? !n.isOverTarget && n.pointerType != null && (n.isOverTarget = !0,
|
462
|
+
i.pointerId === n.activePointerId && (n.target && M(i, n.target) ? !n.isOverTarget && n.pointerType != null && (n.isOverTarget = !0, B(C(n.target, i), n.pointerType)) : n.target && n.isOverTarget && n.pointerType != null && (n.isOverTarget = !1, k(C(n.target, i), n.pointerType, !1), A(i)));
|
463
463
|
}, h = (i) => {
|
464
|
-
i.pointerId === n.activePointerId && n.isPressed && i.button === 0 && n.target && (M(i, n.target) && n.pointerType != null ? k(C(n.target, i), n.pointerType) : n.isOverTarget && n.pointerType != null && k(C(n.target, i), n.pointerType, !1), n.isPressed = !1, n.isOverTarget = !1, n.activePointerId = null, n.pointerType = null, S(),
|
464
|
+
i.pointerId === n.activePointerId && n.isPressed && i.button === 0 && n.target && (M(i, n.target) && n.pointerType != null ? k(C(n.target, i), n.pointerType) : n.isOverTarget && n.pointerType != null && k(C(n.target, i), n.pointerType, !1), n.isPressed = !1, n.isOverTarget = !1, n.activePointerId = null, n.pointerType = null, S(), b || Y(n.target), "ontouchend" in n.target && i.pointerType !== "mouse" && T(n.target, "touchend", s, {
|
465
465
|
once: !0
|
466
466
|
}));
|
467
467
|
}, s = (i) => {
|
468
468
|
Ie(i.target) && i.preventDefault();
|
469
|
-
},
|
469
|
+
}, g = (i) => {
|
470
470
|
N(i);
|
471
471
|
};
|
472
472
|
f.onDragStart = (i) => {
|
@@ -479,15 +479,15 @@ function gt(e) {
|
|
479
479
|
s.stopPropagation();
|
480
480
|
return;
|
481
481
|
}
|
482
|
-
n.isPressed = !0, n.isOverTarget = !0, n.target = s.currentTarget, n.pointerType = _e(s.nativeEvent) ? "virtual" : "mouse", !u && !m && R(s.currentTarget),
|
482
|
+
n.isPressed = !0, n.isOverTarget = !0, n.target = s.currentTarget, n.pointerType = _e(s.nativeEvent) ? "virtual" : "mouse", !u && !m && R(s.currentTarget), B(s, n.pointerType) && s.stopPropagation(), T(I(s.currentTarget), "mouseup", l, !1);
|
483
483
|
}, f.onMouseEnter = (s) => {
|
484
484
|
if (!s.currentTarget.contains(s.target)) return;
|
485
|
-
let
|
486
|
-
n.isPressed && !n.ignoreEmulatedMouseEvents && n.pointerType != null && (n.isOverTarget = !0,
|
485
|
+
let g = !0;
|
486
|
+
n.isPressed && !n.ignoreEmulatedMouseEvents && n.pointerType != null && (n.isOverTarget = !0, g = B(s, n.pointerType)), g && s.stopPropagation();
|
487
487
|
}, f.onMouseLeave = (s) => {
|
488
488
|
if (!s.currentTarget.contains(s.target)) return;
|
489
|
-
let
|
490
|
-
n.isPressed && !n.ignoreEmulatedMouseEvents && n.pointerType != null && (n.isOverTarget = !1,
|
489
|
+
let g = !0;
|
490
|
+
n.isPressed && !n.ignoreEmulatedMouseEvents && n.pointerType != null && (n.isOverTarget = !1, g = k(s, n.pointerType, !1), A(s)), g && s.stopPropagation();
|
491
491
|
}, f.onMouseUp = (s) => {
|
492
492
|
s.currentTarget.contains(s.target) && !n.ignoreEmulatedMouseEvents && s.button === 0 && D(s, n.pointerType || "mouse");
|
493
493
|
};
|
@@ -502,25 +502,25 @@ function gt(e) {
|
|
502
502
|
};
|
503
503
|
f.onTouchStart = (s) => {
|
504
504
|
if (!s.currentTarget.contains(s.target)) return;
|
505
|
-
let
|
506
|
-
if (!
|
507
|
-
n.activePointerId =
|
505
|
+
let g = gt(s.nativeEvent);
|
506
|
+
if (!g) return;
|
507
|
+
n.activePointerId = g.identifier, n.ignoreEmulatedMouseEvents = !0, n.isOverTarget = !0, n.isPressed = !0, n.target = s.currentTarget, n.pointerType = "touch", !u && !m && R(s.currentTarget), b || be(n.target), B(K(n.target, s), n.pointerType) && s.stopPropagation(), T(ie(s.currentTarget), "scroll", h, !0);
|
508
508
|
}, f.onTouchMove = (s) => {
|
509
509
|
if (!s.currentTarget.contains(s.target)) return;
|
510
510
|
if (!n.isPressed) {
|
511
511
|
s.stopPropagation();
|
512
512
|
return;
|
513
513
|
}
|
514
|
-
let
|
515
|
-
|
514
|
+
let g = he(s.nativeEvent, n.activePointerId), i = !0;
|
515
|
+
g && M(g, s.currentTarget) ? !n.isOverTarget && n.pointerType != null && (n.isOverTarget = !0, i = B(K(n.target, s), n.pointerType)) : n.isOverTarget && n.pointerType != null && (n.isOverTarget = !1, i = k(K(n.target, s), n.pointerType, !1), A(K(n.target, s))), i && s.stopPropagation();
|
516
516
|
}, f.onTouchEnd = (s) => {
|
517
517
|
if (!s.currentTarget.contains(s.target)) return;
|
518
518
|
if (!n.isPressed) {
|
519
519
|
s.stopPropagation();
|
520
520
|
return;
|
521
521
|
}
|
522
|
-
let
|
523
|
-
|
522
|
+
let g = he(s.nativeEvent, n.activePointerId), i = !0;
|
523
|
+
g && M(g, s.currentTarget) && n.pointerType != null ? (D(K(n.target, s), n.pointerType), i = k(K(n.target, s), n.pointerType)) : n.isOverTarget && n.pointerType != null && (i = k(K(n.target, s), n.pointerType, !1)), i && s.stopPropagation(), n.isPressed = !1, n.activePointerId = null, n.isOverTarget = !1, n.ignoreEmulatedMouseEvents = !0, n.target && !b && Y(n.target), S();
|
524
524
|
}, f.onTouchCancel = (s) => {
|
525
525
|
s.currentTarget.contains(s.target) && (s.stopPropagation(), n.isPressed && N(K(n.target, s)));
|
526
526
|
};
|
@@ -543,18 +543,18 @@ function gt(e) {
|
|
543
543
|
u,
|
544
544
|
m,
|
545
545
|
S,
|
546
|
-
|
546
|
+
b,
|
547
547
|
N,
|
548
548
|
A,
|
549
549
|
k,
|
550
|
-
|
550
|
+
B,
|
551
551
|
D
|
552
552
|
]);
|
553
553
|
return J(() => () => {
|
554
554
|
var n;
|
555
|
-
|
555
|
+
b || Y((n = w.current.target) !== null && n !== void 0 ? n : void 0);
|
556
556
|
}, [
|
557
|
-
|
557
|
+
b
|
558
558
|
]), {
|
559
559
|
isPressed: p || _,
|
560
560
|
pressProps: G(x, oe)
|
@@ -568,7 +568,7 @@ function re(e, t) {
|
|
568
568
|
return (r === "Enter" || r === " " || r === "Spacebar" || o === "Space") && !(a instanceof ie(a).HTMLInputElement && !Le(a, r) || a instanceof ie(a).HTMLTextAreaElement || a.isContentEditable) && // Links should only trigger with Enter key
|
569
569
|
!((d === "link" || !d && pe(a)) && r !== "Enter");
|
570
570
|
}
|
571
|
-
function
|
571
|
+
function gt(e) {
|
572
572
|
const { targetTouches: t } = e;
|
573
573
|
return t.length > 0 ? t[0] : null;
|
574
574
|
}
|
@@ -659,46 +659,46 @@ function kt() {
|
|
659
659
|
};
|
660
660
|
}
|
661
661
|
function wt(e) {
|
662
|
-
let { onHoverStart: t, onHoverChange: r, onHoverEnd: o, isDisabled: a } = e, [d, u] =
|
662
|
+
let { onHoverStart: t, onHoverChange: r, onHoverEnd: o, isDisabled: a } = e, [d, u] = $e(!1), p = ee({
|
663
663
|
isHovered: !1,
|
664
664
|
ignoreEmulatedMouseEvents: !1,
|
665
665
|
pointerType: "",
|
666
666
|
target: null
|
667
667
|
}).current;
|
668
668
|
J(kt, []);
|
669
|
-
let { hoverProps: m, triggerHoverEnd: v } =
|
670
|
-
let
|
671
|
-
if (p.pointerType =
|
669
|
+
let { hoverProps: m, triggerHoverEnd: v } = Be(() => {
|
670
|
+
let b = (_, $) => {
|
671
|
+
if (p.pointerType = $, a || $ === "touch" || p.isHovered || !_.currentTarget.contains(_.target)) return;
|
672
672
|
p.isHovered = !0;
|
673
673
|
let w = _.currentTarget;
|
674
674
|
p.target = w, t && t({
|
675
675
|
type: "hoverstart",
|
676
676
|
target: w,
|
677
|
-
pointerType:
|
677
|
+
pointerType: $
|
678
678
|
}), r && r(!0), u(!0);
|
679
|
-
},
|
680
|
-
if (p.pointerType = "", p.target = null,
|
679
|
+
}, E = (_, $) => {
|
680
|
+
if (p.pointerType = "", p.target = null, $ === "touch" || !p.isHovered) return;
|
681
681
|
p.isHovered = !1;
|
682
682
|
let w = _.currentTarget;
|
683
683
|
o && o({
|
684
684
|
type: "hoverend",
|
685
685
|
target: w,
|
686
|
-
pointerType:
|
686
|
+
pointerType: $
|
687
687
|
}), r && r(!1), u(!1);
|
688
688
|
}, x = {};
|
689
689
|
return typeof PointerEvent < "u" ? (x.onPointerEnter = (_) => {
|
690
|
-
Z && _.pointerType === "mouse" ||
|
690
|
+
Z && _.pointerType === "mouse" || b(_, _.pointerType);
|
691
691
|
}, x.onPointerLeave = (_) => {
|
692
|
-
!a && _.currentTarget.contains(_.target) &&
|
692
|
+
!a && _.currentTarget.contains(_.target) && E(_, _.pointerType);
|
693
693
|
}) : (x.onTouchStart = () => {
|
694
694
|
p.ignoreEmulatedMouseEvents = !0;
|
695
695
|
}, x.onMouseEnter = (_) => {
|
696
|
-
!p.ignoreEmulatedMouseEvents && !Z &&
|
696
|
+
!p.ignoreEmulatedMouseEvents && !Z && b(_, "mouse"), p.ignoreEmulatedMouseEvents = !1;
|
697
697
|
}, x.onMouseLeave = (_) => {
|
698
|
-
!a && _.currentTarget.contains(_.target) &&
|
698
|
+
!a && _.currentTarget.contains(_.target) && E(_, "mouse");
|
699
699
|
}), {
|
700
700
|
hoverProps: x,
|
701
|
-
triggerHoverEnd:
|
701
|
+
triggerHoverEnd: E
|
702
702
|
};
|
703
703
|
}, [
|
704
704
|
t,
|
@@ -728,12 +728,12 @@ function Tt(e, t) {
|
|
728
728
|
onPressUp: p,
|
729
729
|
onPressChange: m,
|
730
730
|
preventFocusOnPress: v,
|
731
|
-
allowFocusWhenDisabled:
|
731
|
+
allowFocusWhenDisabled: b,
|
732
732
|
// @ts-ignore
|
733
|
-
onClick:
|
733
|
+
onClick: E,
|
734
734
|
href: x,
|
735
735
|
target: _,
|
736
|
-
rel:
|
736
|
+
rel: $,
|
737
737
|
type: w = "button"
|
738
738
|
} = e, T;
|
739
739
|
r === "button" ? T = {
|
@@ -747,9 +747,9 @@ function Tt(e, t) {
|
|
747
747
|
type: r === "input" ? w : void 0,
|
748
748
|
disabled: r === "input" ? o : void 0,
|
749
749
|
"aria-disabled": !o || r === "input" ? void 0 : o,
|
750
|
-
rel: r === "a" ?
|
750
|
+
rel: r === "a" ? $ : void 0
|
751
751
|
};
|
752
|
-
let { pressProps: S, isPressed:
|
752
|
+
let { pressProps: S, isPressed: B } = bt({
|
753
753
|
onPressStart: d,
|
754
754
|
onPressEnd: u,
|
755
755
|
onPressChange: m,
|
@@ -759,24 +759,24 @@ function Tt(e, t) {
|
|
759
759
|
preventFocusOnPress: v,
|
760
760
|
ref: t
|
761
761
|
}), { focusableProps: k } = Ve(e, t);
|
762
|
-
|
762
|
+
b && (k.tabIndex = o ? -1 : k.tabIndex);
|
763
763
|
let D = G(k, S, Qe(e, {
|
764
764
|
labelable: !0
|
765
765
|
}));
|
766
766
|
return {
|
767
|
-
isPressed:
|
767
|
+
isPressed: B,
|
768
768
|
buttonProps: G(T, D, {
|
769
769
|
"aria-haspopup": e["aria-haspopup"],
|
770
770
|
"aria-expanded": e["aria-expanded"],
|
771
771
|
"aria-controls": e["aria-controls"],
|
772
772
|
"aria-pressed": e["aria-pressed"],
|
773
773
|
onClick: (N) => {
|
774
|
-
|
774
|
+
E && (E(N), console.warn("onClick is deprecated, please use onPress"));
|
775
775
|
}
|
776
776
|
})
|
777
777
|
};
|
778
778
|
}
|
779
|
-
function
|
779
|
+
function Et(e, t, r) {
|
780
780
|
return t in e ? Object.defineProperty(e, t, {
|
781
781
|
value: r,
|
782
782
|
enumerable: !0,
|
@@ -798,14 +798,14 @@ function Te(e) {
|
|
798
798
|
for (var t = 1; t < arguments.length; t++) {
|
799
799
|
var r = arguments[t] != null ? arguments[t] : {};
|
800
800
|
t % 2 ? we(Object(r), !0).forEach(function(o) {
|
801
|
-
|
801
|
+
Et(e, o, r[o]);
|
802
802
|
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(r)) : we(Object(r)).forEach(function(o) {
|
803
803
|
Object.defineProperty(e, o, Object.getOwnPropertyDescriptor(r, o));
|
804
804
|
});
|
805
805
|
}
|
806
806
|
return e;
|
807
807
|
}
|
808
|
-
var
|
808
|
+
var $t = (e, t, r) => {
|
809
809
|
for (var o of Object.keys(e)) {
|
810
810
|
var a;
|
811
811
|
if (e[o] !== ((a = t[o]) !== null && a !== void 0 ? a : r[o]))
|
@@ -826,75 +826,79 @@ var Et = (e, t, r) => {
|
|
826
826
|
m && (r += " " + m);
|
827
827
|
}
|
828
828
|
}
|
829
|
-
for (var [v,
|
830
|
-
|
829
|
+
for (var [v, b] of e.compoundVariants)
|
830
|
+
$t(v, o, e.defaultVariants) && (r += " " + b);
|
831
831
|
return r;
|
832
|
-
},
|
833
|
-
|
834
|
-
|
835
|
-
|
836
|
-
|
837
|
-
|
838
|
-
|
839
|
-
|
840
|
-
|
841
|
-
|
842
|
-
|
843
|
-
|
844
|
-
|
845
|
-
|
846
|
-
|
847
|
-
..._
|
848
|
-
}, P) {
|
849
|
-
const w = e ?? (p ? "a" : "button"), T = {
|
850
|
-
onPress: r ?? t,
|
851
|
-
// the button element should be disabled if the button is marked as disabled or spinning
|
852
|
-
isDisabled: u ?? d ?? g,
|
853
|
-
..._
|
854
|
-
}, { "data-testid": S } = _, E = P || c.useRef(null), { buttonProps: k } = Tt(T, E), { hoverProps: D } = wt({ isDisabled: T.isDisabled }), { type: N, ...A } = k, oe = {
|
855
|
-
...G(A, D),
|
856
|
-
ref: E,
|
832
|
+
}, Bt = ne({ defaultClassName: "pkg_sps-woodland_buttons__version_8_23_2__hash_125pcxy0", variantClassNames: { disabled: { true: "pkg_sps-woodland_buttons__version_8_23_2__hash_125pcxy1", false: "pkg_sps-woodland_buttons__version_8_23_2__hash_125pcxy2" }, kind: { default: "pkg_sps-woodland_buttons__version_8_23_2__hash_125pcxy3", link: "pkg_sps-woodland_buttons__version_8_23_2__hash_125pcxy4", confirm: "pkg_sps-woodland_buttons__version_8_23_2__hash_125pcxy5", delete: "pkg_sps-woodland_buttons__version_8_23_2__hash_125pcxy6", key: "pkg_sps-woodland_buttons__version_8_23_2__hash_125pcxy7", icon: "pkg_sps-woodland_buttons__version_8_23_2__hash_125pcxy8" }, spinning: { true: "pkg_sps-woodland_buttons__version_8_23_2__hash_125pcxy9", false: "pkg_sps-woodland_buttons__version_8_23_2__hash_125pcxya" } }, defaultVariants: { disabled: !1, kind: "default", spinning: !1 }, compoundVariants: [[{ kind: "icon", spinning: !0 }, "pkg_sps-woodland_buttons__version_8_23_2__hash_125pcxyb"], [{ kind: "default", spinning: !0 }, "pkg_sps-woodland_buttons__version_8_23_2__hash_125pcxyc"], [{ kind: "confirm", spinning: !0 }, "pkg_sps-woodland_buttons__version_8_23_2__hash_125pcxyd"], [{ kind: "delete", spinning: !0 }, "pkg_sps-woodland_buttons__version_8_23_2__hash_125pcxye"], [{ kind: "key", spinning: !0 }, "pkg_sps-woodland_buttons__version_8_23_2__hash_125pcxyf"], [{ disabled: !0, spinning: !1 }, "pkg_sps-woodland_buttons__version_8_23_2__hash_125pcxyg"]] }), Pt = ne({ defaultClassName: "pkg_sps-woodland_buttons__version_8_23_2__hash_125pcxyh", variantClassNames: { disabled: { true: "pkg_sps-woodland_buttons__version_8_23_2__hash_125pcxyi", false: "pkg_sps-woodland_buttons__version_8_23_2__hash_125pcxyj" }, kind: { icon: "pkg_sps-woodland_buttons__version_8_23_2__hash_125pcxyk", default: "pkg_sps-woodland_buttons__version_8_23_2__hash_125pcxyl", delete: "pkg_sps-woodland_buttons__version_8_23_2__hash_125pcxym", key: "pkg_sps-woodland_buttons__version_8_23_2__hash_125pcxyn", confirm: "pkg_sps-woodland_buttons__version_8_23_2__hash_125pcxyo", link: "pkg_sps-woodland_buttons__version_8_23_2__hash_125pcxyp" }, spinning: { true: "pkg_sps-woodland_buttons__version_8_23_2__hash_125pcxyq", false: "pkg_sps-woodland_buttons__version_8_23_2__hash_125pcxyr" } }, defaultVariants: { disabled: !1, kind: "default", spinning: !1 }, compoundVariants: [] }), xt = "pkg_sps-woodland_buttons__version_8_23_2__hash_125pcxy11", St = ne({ defaultClassName: "pkg_sps-woodland_buttons__version_8_23_2__hash_125pcxy12", variantClassNames: { spinning: { true: "pkg_sps-woodland_buttons__version_8_23_2__hash_125pcxy13", false: "pkg_sps-woodland_buttons__version_8_23_2__hash_125pcxy14" } }, defaultVariants: { spinning: !1 }, compoundVariants: [] }), Nt = ne({ defaultClassName: "pkg_sps-woodland_buttons__version_8_23_2__hash_125pcxys", variantClassNames: { spinning: { true: "pkg_sps-woodland_buttons__version_8_23_2__hash_125pcxyt", false: "pkg_sps-woodland_buttons__version_8_23_2__hash_125pcxyu" }, kind: { icon: "pkg_sps-woodland_buttons__version_8_23_2__hash_125pcxyv", default: "pkg_sps-woodland_buttons__version_8_23_2__hash_125pcxyw", delete: "pkg_sps-woodland_buttons__version_8_23_2__hash_125pcxyx", key: "pkg_sps-woodland_buttons__version_8_23_2__hash_125pcxyy", confirm: "pkg_sps-woodland_buttons__version_8_23_2__hash_125pcxyz", link: "pkg_sps-woodland_buttons__version_8_23_2__hash_125pcxy10" } }, defaultVariants: { spinning: !1 }, compoundVariants: [] });
|
833
|
+
const Ae = c.forwardRef(
|
834
|
+
({
|
835
|
+
as: e,
|
836
|
+
onClick: t,
|
837
|
+
onPress: r,
|
838
|
+
children: o,
|
839
|
+
className: a,
|
840
|
+
isDisabled: d,
|
841
|
+
disabled: u,
|
842
|
+
href: p,
|
843
|
+
icon: m,
|
844
|
+
kind: v = "default",
|
845
|
+
spinning: b,
|
846
|
+
spinningTitle: E,
|
857
847
|
title: x,
|
858
|
-
className: p ? Nt({ spinning: g, kind: v }) : Pt({ disabled: d || u, kind: v, spinning: g }),
|
859
|
-
...p ? { href: p } : { type: N },
|
860
848
|
..._
|
861
|
-
},
|
862
|
-
|
863
|
-
|
864
|
-
|
865
|
-
|
866
|
-
|
867
|
-
|
868
|
-
|
869
|
-
|
870
|
-
|
871
|
-
|
872
|
-
|
873
|
-
|
874
|
-
|
875
|
-
|
876
|
-
|
877
|
-
|
878
|
-
|
879
|
-
|
880
|
-
|
881
|
-
|
882
|
-
|
883
|
-
|
884
|
-
|
885
|
-
|
886
|
-
|
887
|
-
|
888
|
-
|
889
|
-
|
890
|
-
|
891
|
-
|
892
|
-
|
893
|
-
|
894
|
-
|
895
|
-
}
|
896
|
-
|
897
|
-
|
849
|
+
}, $) => {
|
850
|
+
const w = e ?? (p ? "a" : "button"), T = {
|
851
|
+
onPress: r ?? t,
|
852
|
+
// the button element should be disabled if the button is marked as disabled or spinning
|
853
|
+
isDisabled: u ?? d ?? b,
|
854
|
+
..._
|
855
|
+
}, { "data-testid": S } = _, B = c.useRef(null), k = $ || B, { buttonProps: D } = Tt(
|
856
|
+
T,
|
857
|
+
k
|
858
|
+
), { hoverProps: N } = wt({ isDisabled: T.isDisabled }), { type: A, ...oe } = D, n = {
|
859
|
+
...G(oe, N),
|
860
|
+
ref: k,
|
861
|
+
title: x,
|
862
|
+
className: p ? Nt({ spinning: b, kind: v }) : Pt({ disabled: d || u, kind: v, spinning: b }),
|
863
|
+
...p ? { href: p } : { type: A },
|
864
|
+
..._
|
865
|
+
}, { t: f } = c.useContext(Fe), P = m && /* @__PURE__ */ c.createElement(
|
866
|
+
Ge,
|
867
|
+
{
|
868
|
+
className: xt,
|
869
|
+
icon: m,
|
870
|
+
"aria-hidden": "true",
|
871
|
+
"data-testid": `${S}__${m}-icon`
|
872
|
+
}
|
873
|
+
);
|
874
|
+
let l;
|
875
|
+
v === "default" || v === "icon" || v === "link" ? l = "dark" : l = "light";
|
876
|
+
const h = b && /* @__PURE__ */ c.createElement(
|
877
|
+
Ue,
|
878
|
+
{
|
879
|
+
color: l,
|
880
|
+
className: St({ spinning: b }),
|
881
|
+
title: E || f("design-system:button.spinningTitle"),
|
882
|
+
"data-testid": `${S}__spinner`
|
883
|
+
}
|
884
|
+
);
|
885
|
+
return /* @__PURE__ */ c.createElement(We, null, /* @__PURE__ */ c.createElement(
|
886
|
+
"div",
|
887
|
+
{
|
888
|
+
className: He(
|
889
|
+
Bt({
|
890
|
+
disabled: d || u,
|
891
|
+
kind: v,
|
892
|
+
spinning: b
|
893
|
+
}),
|
894
|
+
a
|
895
|
+
)
|
896
|
+
},
|
897
|
+
/* @__PURE__ */ c.createElement(w, { ...n }, P, o ? /* @__PURE__ */ c.createElement("span", null, o) : "", h)
|
898
|
+
));
|
899
|
+
}
|
900
|
+
);
|
901
|
+
Re.set(Ae, {
|
898
902
|
name: "Button",
|
899
903
|
props: {
|
900
904
|
disabled: "boolean",
|
@@ -906,11 +910,18 @@ Fe.set(Ae, {
|
|
906
910
|
},
|
907
911
|
spinning: "boolean",
|
908
912
|
spinningTitle: "string",
|
909
|
-
type: { type: '"button" | "submit"', default: '"button"' }
|
913
|
+
type: { type: '"button" | "submit"', default: '"button"' },
|
914
|
+
as: "button | a",
|
915
|
+
onClick: "() => void",
|
916
|
+
onPress: "() => void",
|
917
|
+
children: "ReactNode",
|
918
|
+
className: "string",
|
919
|
+
isDisabled: "boolean",
|
920
|
+
style: "CSSProperties"
|
910
921
|
},
|
911
922
|
panellable: !0
|
912
923
|
});
|
913
|
-
const
|
924
|
+
const Dt = {
|
914
925
|
components: [Ae],
|
915
926
|
description: () => /* @__PURE__ */ c.createElement(c.Fragment, null, /* @__PURE__ */ c.createElement("div", { className: "sps-body-14" }, "Buttons are used to initiate events or actions. The labels and/or icons describe what the button will do."), /* @__PURE__ */ c.createElement("br", null), /* @__PURE__ */ c.createElement("h5", null, "Variants"), /* @__PURE__ */ c.createElement("div", { className: "sps-body-14" }, /* @__PURE__ */ c.createElement("span", { className: "sps-text-semibold" }, "Default: "), "For tertiary actions or actions of lower importance on a page."), /* @__PURE__ */ c.createElement("div", { className: "sps-body-14" }, /* @__PURE__ */ c.createElement("span", { className: "sps-text-semibold" }, "Key: "), "For primary or important actions on a page."), /* @__PURE__ */ c.createElement("div", { className: "sps-body-14" }, /* @__PURE__ */ c.createElement("span", { className: "sps-text-semibold" }, "Confirm: "), "For the main call to action on a page. There should only be one Confirm button per screen."), /* @__PURE__ */ c.createElement("div", { className: "sps-body-14" }, /* @__PURE__ */ c.createElement("span", { className: "sps-text-semibold" }, "Delete: "), "For deleting information or another destructive action. These should always be paired with a Delete Confirmation Modal."), /* @__PURE__ */ c.createElement("div", { className: "sps-body-14" }, /* @__PURE__ */ c.createElement("span", { className: "sps-text-semibold" }, "Disabled: "), "For actions that are not permitted in a particular state. These can be accompanied by a Tooltip on hover describing why it’s disabled."), /* @__PURE__ */ c.createElement("div", { className: "sps-body-14" }, /* @__PURE__ */ c.createElement("span", { className: "sps-text-semibold" }, "With an Icon: "), "For further illustrating the action. Example: Pencil icon in an Edit button. There can also be Icon Buttons without text.")),
|
916
927
|
examples: {
|
@@ -1474,10 +1485,10 @@ const Ot = {
|
|
1474
1485
|
}
|
1475
1486
|
}
|
1476
1487
|
}
|
1477
|
-
},
|
1478
|
-
Buttons:
|
1488
|
+
}, Lt = {
|
1489
|
+
Buttons: Dt
|
1479
1490
|
};
|
1480
1491
|
export {
|
1481
1492
|
Ae as Button,
|
1482
|
-
|
1493
|
+
Lt as MANIFEST
|
1483
1494
|
};
|
package/lib/index.umd.cjs
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
(function(N,v){typeof exports=="object"&&typeof module<"u"?v(exports,require("react"),require("@sps-woodland/core"),require("@react-aria/focus"),require("@spscommerce/utils")):typeof define=="function"&&define.amd?define(["exports","react","@sps-woodland/core","@react-aria/focus","@spscommerce/utils"],v):(N=typeof globalThis<"u"?globalThis:N||self,v(N.Buttons={},N.React,N.core,N.focus,N.utils))})(this,function(N,v,V,me,y){"use strict";function Ae(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const o=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,o.get?o:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const c=Ae(v),_e=typeof document<"u"?v.useLayoutEffect:()=>{};function W(e){const t=v.useRef(null);return _e(()=>{t.current=e},[e]),v.useCallback((...r)=>{const o=t.current;return o==null?void 0:o(...r)},[])}let be=new Map;function Le(e,t){if(e===t)return e;let r=be.get(e);if(r)return r.forEach(a=>a(t)),t;let o=be.get(t);return o?(o.forEach(a=>a(e)),e):t}function ge(...e){return(...t)=>{for(let r of e)typeof r=="function"&&r(...t)}}const A=e=>{var t;return(t=e==null?void 0:e.ownerDocument)!==null&&t!==void 0?t:document},oe=e=>e&&"window"in e&&e.window===e?e:A(e).defaultView||window;function ve(e){var t,r,o="";if(typeof e=="string"||typeof e=="number")o+=e;else if(typeof e=="object")if(Array.isArray(e)){var a=e.length;for(t=0;t<a;t++)e[t]&&(r=ve(e[t]))&&(o&&(o+=" "),o+=r)}else for(r in e)e[r]&&(o&&(o+=" "),o+=r);return o}function Me(){for(var e,t,r=0,o="",a=arguments.length;r<a;r++)(e=arguments[r])&&(t=ve(e))&&(o&&(o+=" "),o+=t);return o}function j(...e){let t={...e[0]};for(let r=1;r<e.length;r++){let o=e[r];for(let a in o){let d=t[a],u=o[a];typeof d=="function"&&typeof u=="function"&&a[0]==="o"&&a[1]==="n"&&a.charCodeAt(2)>=65&&a.charCodeAt(2)<=90?t[a]=ge(d,u):(a==="className"||a==="UNSAFE_className")&&typeof d=="string"&&typeof u=="string"?t[a]=Me(d,u):a==="id"&&d&&u?t.id=Le(d,u):t[a]=u!==void 0?u:d}}return t}const Fe=new Set(["id"]),Ue=new Set(["aria-label","aria-labelledby","aria-describedby","aria-details"]),He=new Set(["href","hrefLang","target","rel","download","ping","referrerPolicy"]),Ge=/^(data-.*)$/;function Ve(e,t={}){let{labelable:r,isLink:o,propNames:a}=t,d={};for(const u in e)Object.prototype.hasOwnProperty.call(e,u)&&(Fe.has(u)||r&&Ue.has(u)||o&&He.has(u)||a!=null&&a.has(u)||Ge.test(u))&&(d[u]=e[u]);return d}function Y(e){if(We())e.focus({preventScroll:!0});else{let t=je(e);e.focus(),Ye(t)}}let X=null;function We(){if(X==null){X=!1;try{document.createElement("div").focus({get preventScroll(){return X=!0,!0}})}catch{}}return X}function je(e){let t=e.parentNode,r=[],o=document.scrollingElement||document.documentElement;for(;t instanceof HTMLElement&&t!==o;)(t.offsetHeight<t.scrollHeight||t.offsetWidth<t.scrollWidth)&&r.push({element:t,scrollTop:t.scrollTop,scrollLeft:t.scrollLeft}),t=t.parentNode;return o instanceof HTMLElement&&r.push({element:o,scrollTop:o.scrollTop,scrollLeft:o.scrollLeft}),r}function Ye(e){for(let{element:t,scrollTop:r,scrollLeft:o}of e)t.scrollTop=r,t.scrollLeft=o}function q(e){var t;return typeof window>"u"||window.navigator==null?!1:((t=window.navigator.userAgentData)===null||t===void 0?void 0:t.brands.some(r=>e.test(r.brand)))||e.test(window.navigator.userAgent)}function re(e){var t;return typeof window<"u"&&window.navigator!=null?e.test(((t=window.navigator.userAgentData)===null||t===void 0?void 0:t.platform)||window.navigator.platform):!1}function L(e){let t=null;return()=>(t==null&&(t=e()),t)}const z=L(function(){return re(/^Mac/i)}),Re=L(function(){return re(/^iPhone/i)}),he=L(function(){return re(/^iPad/i)||z()&&navigator.maxTouchPoints>1}),ye=L(function(){return Re()||he()}),Xe=L(function(){return q(/AppleWebKit/i)&&!qe()}),qe=L(function(){return q(/Chrome/i)}),ke=L(function(){return q(/Android/i)}),ze=L(function(){return q(/Firefox/i)});function R(e,t,r=!0){var o,a;let{metaKey:d,ctrlKey:u,altKey:p,shiftKey:m}=t;ze()&&(!((a=window.event)===null||a===void 0||(o=a.type)===null||o===void 0)&&o.startsWith("key"))&&e.target==="_blank"&&(z()?d=!0:u=!0);let h=Xe()&&z()&&!he()?new KeyboardEvent("keydown",{keyIdentifier:"Enter",metaKey:d,ctrlKey:u,altKey:p,shiftKey:m}):new MouseEvent("click",{metaKey:d,ctrlKey:u,altKey:p,shiftKey:m,bubbles:!0,cancelable:!0});R.isOpening=r,Y(e),e.dispatchEvent(h),R.isOpening=!1}R.isOpening=!1;let F=new Map,se=new Set;function we(){if(typeof window>"u")return;function e(o){return"propertyName"in o}let t=o=>{if(!e(o)||!o.target)return;let a=F.get(o.target);a||(a=new Set,F.set(o.target,a),o.target.addEventListener("transitioncancel",r,{once:!0})),a.add(o.propertyName)},r=o=>{if(!e(o)||!o.target)return;let a=F.get(o.target);if(a&&(a.delete(o.propertyName),a.size===0&&(o.target.removeEventListener("transitioncancel",r),F.delete(o.target)),F.size===0)){for(let d of se)d();se.clear()}};document.body.addEventListener("transitionrun",t),document.body.addEventListener("transitionend",r)}typeof document<"u"&&(document.readyState!=="loading"?we():document.addEventListener("DOMContentLoaded",we));function Je(e){requestAnimationFrame(()=>{F.size===0?e():se.add(e)})}function Qe(){let e=v.useRef(new Map),t=v.useCallback((a,d,u,p)=>{let m=p!=null&&p.once?(...h)=>{e.current.delete(u),u(...h)}:u;e.current.set(u,{type:d,eventTarget:a,fn:m,options:p}),a.addEventListener(d,u,p)},[]),r=v.useCallback((a,d,u,p)=>{var m;let h=((m=e.current.get(u))===null||m===void 0?void 0:m.fn)||u;a.removeEventListener(d,h,p),e.current.delete(u)},[]),o=v.useCallback(()=>{e.current.forEach((a,d)=>{r(a.eventTarget,a.type,d,a.options)})},[r]);return v.useEffect(()=>o,[o]),{addGlobalListener:t,removeGlobalListener:r,removeAllGlobalListeners:o}}function Ze(e,t){_e(()=>{if(e&&e.ref&&t)return e.ref.current=t.current,()=>{e.ref&&(e.ref.current=null)}})}function Te(e){return e.mozInputSource===0&&e.isTrusted?!0:ke()&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function et(e){return!ke()&&e.width===0&&e.height===0||e.width===1&&e.height===1&&e.pressure===0&&e.detail===0&&e.pointerType==="mouse"}let U="default",ae="",J=new WeakMap;function Ee(e){if(ye()){if(U==="default"){const t=A(e);ae=t.documentElement.style.webkitUserSelect,t.documentElement.style.webkitUserSelect="none"}U="disabled"}else(e instanceof HTMLElement||e instanceof SVGElement)&&(J.set(e,e.style.userSelect),e.style.userSelect="none")}function Q(e){if(ye()){if(U!=="disabled")return;U="restoring",setTimeout(()=>{Je(()=>{if(U==="restoring"){const t=A(e);t.documentElement.style.webkitUserSelect==="none"&&(t.documentElement.style.webkitUserSelect=ae||""),ae="",U="default"}})},300)}else if((e instanceof HTMLElement||e instanceof SVGElement)&&e&&J.has(e)){let t=J.get(e);e.style.userSelect==="none"&&(e.style.userSelect=t),e.getAttribute("style")===""&&e.removeAttribute("style"),J.delete(e)}}const Be=v.createContext({register:()=>{}});Be.displayName="PressResponderContext";function tt(e,t){return t.get?t.get.call(e):t.value}function $e(e,t,r){if(!t.has(e))throw new TypeError("attempted to "+r+" private field on non-instance");return t.get(e)}function nt(e,t){var r=$e(e,t,"get");return tt(e,r)}function ot(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function rt(e,t,r){ot(e,t),t.set(e,r)}function st(e,t,r){if(t.set)t.set.call(e,r);else{if(!t.writable)throw new TypeError("attempted to set read only private field");t.value=r}}function Pe(e,t,r){var o=$e(e,t,"set");return st(e,o,r),r}function at(e){let t=v.useContext(Be);if(t){let{register:r,...o}=t;e=j(o,e),r()}return Ze(t,e.ref),e}var Z=new WeakMap;class ee{continuePropagation(){Pe(this,Z,!1)}get shouldStopPropagation(){return nt(this,Z)}constructor(t,r,o,a){rt(this,Z,{writable:!0,value:void 0}),Pe(this,Z,!0);var d;let u=(d=a==null?void 0:a.target)!==null&&d!==void 0?d:o.currentTarget;const p=u==null?void 0:u.getBoundingClientRect();let m,h=0,b,P=null;o.clientX!=null&&o.clientY!=null&&(b=o.clientX,P=o.clientY),p&&(b!=null&&P!=null?(m=b-p.left,h=P-p.top):(m=p.width/2,h=p.height/2)),this.type=t,this.pointerType=r,this.target=o.currentTarget,this.shiftKey=o.shiftKey,this.metaKey=o.metaKey,this.ctrlKey=o.ctrlKey,this.altKey=o.altKey,this.x=m,this.y=h}}const xe=Symbol("linkClicked");function it(e){let{onPress:t,onPressChange:r,onPressStart:o,onPressEnd:a,onPressUp:d,isDisabled:u,isPressed:p,preventFocusOnPress:m,shouldCancelOnPointerExit:h,allowTextSelectionOnPress:b,ref:P,...S}=at(e),[_,x]=v.useState(!1),T=v.useRef({isPressed:!1,ignoreEmulatedMouseEvents:!1,ignoreClickAfterPress:!1,didFirePressStart:!1,isTriggeringEvent:!1,activePointerId:null,target:null,isOverTarget:!1,pointerType:null}),{addGlobalListener:E,removeAllGlobalListeners:O}=Qe(),$=W((n,f)=>{let B=T.current;if(u||B.didFirePressStart)return!1;let l=!0;if(B.isTriggeringEvent=!0,o){let k=new ee("pressstart",f,n);o(k),l=k.shouldStopPropagation}return r&&r(!0),B.isTriggeringEvent=!1,B.didFirePressStart=!0,x(!0),l}),w=W((n,f,B=!0)=>{let l=T.current;if(!l.didFirePressStart)return!1;l.ignoreClickAfterPress=!0,l.didFirePressStart=!1,l.isTriggeringEvent=!0;let k=!0;if(a){let s=new ee("pressend",f,n);a(s),k=s.shouldStopPropagation}if(r&&r(!1),x(!1),t&&B&&!u){let s=new ee("press",f,n);t(s),k&&(k=s.shouldStopPropagation)}return l.isTriggeringEvent=!1,k}),C=W((n,f)=>{let B=T.current;if(u)return!1;if(d){B.isTriggeringEvent=!0;let l=new ee("pressup",f,n);return d(l),B.isTriggeringEvent=!1,l.shouldStopPropagation}return!0}),D=W(n=>{let f=T.current;f.isPressed&&f.target&&(f.isOverTarget&&f.pointerType!=null&&w(K(f.target,n),f.pointerType,!1),f.isPressed=!1,f.isOverTarget=!1,f.activePointerId=null,f.pointerType=null,O(),b||Q(f.target))}),G=W(n=>{h&&D(n)}),fe=v.useMemo(()=>{let n=T.current,f={onKeyDown(l){if(le(l.nativeEvent,l.currentTarget)&&l.currentTarget.contains(l.target)){var k;Oe(l.target,l.key)&&l.preventDefault();let s=!0;if(!n.isPressed&&!l.repeat){n.target=l.currentTarget,n.isPressed=!0,s=$(l,"keyboard");let g=l.currentTarget,i=I=>{le(I,g)&&!I.repeat&&g.contains(I.target)&&n.target&&C(K(n.target,I),"keyboard")};E(A(l.currentTarget),"keyup",ge(i,B),!0)}s&&l.stopPropagation(),l.metaKey&&z()&&((k=n.metaKeyEvents)===null||k===void 0||k.set(l.key,l.nativeEvent))}else l.key==="Meta"&&(n.metaKeyEvents=new Map)},onClick(l){if(!(l&&!l.currentTarget.contains(l.target))&&l&&l.button===0&&!n.isTriggeringEvent&&!R.isOpening){let k=!0;if(u&&l.preventDefault(),!n.ignoreClickAfterPress&&!n.ignoreEmulatedMouseEvents&&!n.isPressed&&(n.pointerType==="virtual"||Te(l.nativeEvent))){!u&&!m&&Y(l.currentTarget);let s=$(l,"virtual"),g=C(l,"virtual"),i=w(l,"virtual");k=s&&g&&i}n.ignoreEmulatedMouseEvents=!1,n.ignoreClickAfterPress=!1,k&&l.stopPropagation()}}},B=l=>{var k;if(n.isPressed&&n.target&&le(l,n.target)){var s;Oe(l.target,l.key)&&l.preventDefault();let i=l.target;w(K(n.target,l),"keyboard",n.target.contains(i)),O(),l.key!=="Enter"&&ie(n.target)&&n.target.contains(i)&&!l[xe]&&(l[xe]=!0,R(n.target,l,!1)),n.isPressed=!1,(s=n.metaKeyEvents)===null||s===void 0||s.delete(l.key)}else if(l.key==="Meta"&&(!((k=n.metaKeyEvents)===null||k===void 0)&&k.size)){var g;let i=n.metaKeyEvents;n.metaKeyEvents=void 0;for(let I of i.values())(g=n.target)===null||g===void 0||g.dispatchEvent(new KeyboardEvent("keyup",I))}};if(typeof PointerEvent<"u"){f.onPointerDown=i=>{if(i.button!==0||!i.currentTarget.contains(i.target))return;if(et(i.nativeEvent)){n.pointerType="virtual";return}ue(i.currentTarget)&&i.preventDefault(),n.pointerType=i.pointerType;let I=!0;n.isPressed||(n.isPressed=!0,n.isOverTarget=!0,n.activePointerId=i.pointerId,n.target=i.currentTarget,!u&&!m&&Y(i.currentTarget),b||Ee(n.target),I=$(i,n.pointerType),E(A(i.currentTarget),"pointermove",l,!1),E(A(i.currentTarget),"pointerup",k,!1),E(A(i.currentTarget),"pointercancel",g,!1)),I&&i.stopPropagation()},f.onMouseDown=i=>{i.currentTarget.contains(i.target)&&i.button===0&&(ue(i.currentTarget)&&i.preventDefault(),i.stopPropagation())},f.onPointerUp=i=>{!i.currentTarget.contains(i.target)||n.pointerType==="virtual"||i.button===0&&H(i,i.currentTarget)&&C(i,n.pointerType||i.pointerType)};let l=i=>{i.pointerId===n.activePointerId&&(n.target&&H(i,n.target)?!n.isOverTarget&&n.pointerType!=null&&(n.isOverTarget=!0,$(K(n.target,i),n.pointerType)):n.target&&n.isOverTarget&&n.pointerType!=null&&(n.isOverTarget=!1,w(K(n.target,i),n.pointerType,!1),G(i)))},k=i=>{i.pointerId===n.activePointerId&&n.isPressed&&i.button===0&&n.target&&(H(i,n.target)&&n.pointerType!=null?w(K(n.target,i),n.pointerType):n.isOverTarget&&n.pointerType!=null&&w(K(n.target,i),n.pointerType,!1),n.isPressed=!1,n.isOverTarget=!1,n.activePointerId=null,n.pointerType=null,O(),b||Q(n.target),"ontouchend"in n.target&&i.pointerType!=="mouse"&&E(n.target,"touchend",s,{once:!0}))},s=i=>{Ne(i.target)&&i.preventDefault()},g=i=>{D(i)};f.onDragStart=i=>{i.currentTarget.contains(i.target)&&D(i)}}else{f.onMouseDown=s=>{if(s.button!==0||!s.currentTarget.contains(s.target))return;if(ue(s.currentTarget)&&s.preventDefault(),n.ignoreEmulatedMouseEvents){s.stopPropagation();return}n.isPressed=!0,n.isOverTarget=!0,n.target=s.currentTarget,n.pointerType=Te(s.nativeEvent)?"virtual":"mouse",!u&&!m&&Y(s.currentTarget),$(s,n.pointerType)&&s.stopPropagation(),E(A(s.currentTarget),"mouseup",l,!1)},f.onMouseEnter=s=>{if(!s.currentTarget.contains(s.target))return;let g=!0;n.isPressed&&!n.ignoreEmulatedMouseEvents&&n.pointerType!=null&&(n.isOverTarget=!0,g=$(s,n.pointerType)),g&&s.stopPropagation()},f.onMouseLeave=s=>{if(!s.currentTarget.contains(s.target))return;let g=!0;n.isPressed&&!n.ignoreEmulatedMouseEvents&&n.pointerType!=null&&(n.isOverTarget=!1,g=w(s,n.pointerType,!1),G(s)),g&&s.stopPropagation()},f.onMouseUp=s=>{s.currentTarget.contains(s.target)&&!n.ignoreEmulatedMouseEvents&&s.button===0&&C(s,n.pointerType||"mouse")};let l=s=>{if(s.button===0){if(n.isPressed=!1,O(),n.ignoreEmulatedMouseEvents){n.ignoreEmulatedMouseEvents=!1;return}n.target&&H(s,n.target)&&n.pointerType!=null?w(K(n.target,s),n.pointerType):n.target&&n.isOverTarget&&n.pointerType!=null&&w(K(n.target,s),n.pointerType,!1),n.isOverTarget=!1}};f.onTouchStart=s=>{if(!s.currentTarget.contains(s.target))return;let g=lt(s.nativeEvent);if(!g)return;n.activePointerId=g.identifier,n.ignoreEmulatedMouseEvents=!0,n.isOverTarget=!0,n.isPressed=!0,n.target=s.currentTarget,n.pointerType="touch",!u&&!m&&Y(s.currentTarget),b||Ee(n.target),$(M(n.target,s),n.pointerType)&&s.stopPropagation(),E(oe(s.currentTarget),"scroll",k,!0)},f.onTouchMove=s=>{if(!s.currentTarget.contains(s.target))return;if(!n.isPressed){s.stopPropagation();return}let g=Se(s.nativeEvent,n.activePointerId),i=!0;g&&H(g,s.currentTarget)?!n.isOverTarget&&n.pointerType!=null&&(n.isOverTarget=!0,i=$(M(n.target,s),n.pointerType)):n.isOverTarget&&n.pointerType!=null&&(n.isOverTarget=!1,i=w(M(n.target,s),n.pointerType,!1),G(M(n.target,s))),i&&s.stopPropagation()},f.onTouchEnd=s=>{if(!s.currentTarget.contains(s.target))return;if(!n.isPressed){s.stopPropagation();return}let g=Se(s.nativeEvent,n.activePointerId),i=!0;g&&H(g,s.currentTarget)&&n.pointerType!=null?(C(M(n.target,s),n.pointerType),i=w(M(n.target,s),n.pointerType)):n.isOverTarget&&n.pointerType!=null&&(i=w(M(n.target,s),n.pointerType,!1)),i&&s.stopPropagation(),n.isPressed=!1,n.activePointerId=null,n.isOverTarget=!1,n.ignoreEmulatedMouseEvents=!0,n.target&&!b&&Q(n.target),O()},f.onTouchCancel=s=>{s.currentTarget.contains(s.target)&&(s.stopPropagation(),n.isPressed&&D(M(n.target,s)))};let k=s=>{n.isPressed&&s.target.contains(n.target)&&D({currentTarget:n.target,shiftKey:!1,ctrlKey:!1,metaKey:!1,altKey:!1})};f.onDragStart=s=>{s.currentTarget.contains(s.target)&&D(s)}}return f},[E,u,m,O,b,D,G,w,$,C]);return v.useEffect(()=>()=>{var n;b||Q((n=T.current.target)!==null&&n!==void 0?n:void 0)},[b]),{isPressed:p||_,pressProps:j(S,fe)}}function ie(e){return e.tagName==="A"&&e.hasAttribute("href")}function le(e,t){const{key:r,code:o}=e,a=t,d=a.getAttribute("role");return(r==="Enter"||r===" "||r==="Spacebar"||o==="Space")&&!(a instanceof oe(a).HTMLInputElement&&!De(a,r)||a instanceof oe(a).HTMLTextAreaElement||a.isContentEditable)&&!((d==="link"||!d&&ie(a))&&r!=="Enter")}function lt(e){const{targetTouches:t}=e;return t.length>0?t[0]:null}function Se(e,t){const r=e.changedTouches;for(let o=0;o<r.length;o++){const a=r[o];if(a.identifier===t)return a}return null}function M(e,t){let r=0,o=0;return t.targetTouches&&t.targetTouches.length===1&&(r=t.targetTouches[0].clientX,o=t.targetTouches[0].clientY),{currentTarget:e,shiftKey:t.shiftKey,ctrlKey:t.ctrlKey,metaKey:t.metaKey,altKey:t.altKey,clientX:r,clientY:o}}function K(e,t){let r=t.clientX,o=t.clientY;return{currentTarget:e,shiftKey:t.shiftKey,ctrlKey:t.ctrlKey,metaKey:t.metaKey,altKey:t.altKey,clientX:r,clientY:o}}function ut(e){let t=0,r=0;return e.width!==void 0?t=e.width/2:e.radiusX!==void 0&&(t=e.radiusX),e.height!==void 0?r=e.height/2:e.radiusY!==void 0&&(r=e.radiusY),{top:e.clientY-r,right:e.clientX+t,bottom:e.clientY+r,left:e.clientX-t}}function ct(e,t){return!(e.left>t.right||t.left>e.right||e.top>t.bottom||t.top>e.bottom)}function H(e,t){let r=t.getBoundingClientRect(),o=ut(e);return ct(r,o)}function ue(e){return!(e instanceof HTMLElement)||!e.hasAttribute("draggable")}function Ne(e){return e instanceof HTMLInputElement?!1:e instanceof HTMLButtonElement?e.type!=="submit"&&e.type!=="reset":!ie(e)}function Oe(e,t){return e instanceof HTMLInputElement?!De(e,t):Ne(e)}const dt=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]);function De(e,t){return e.type==="checkbox"||e.type==="radio"?t===" ":dt.has(e.type)}let te=!1,ce=0;function de(){te=!0,setTimeout(()=>{te=!1},50)}function Ce(e){e.pointerType==="touch"&&de()}function pt(){if(!(typeof document>"u"))return typeof PointerEvent<"u"?document.addEventListener("pointerup",Ce):document.addEventListener("touchend",de),ce++,()=>{ce--,!(ce>0)&&(typeof PointerEvent<"u"?document.removeEventListener("pointerup",Ce):document.removeEventListener("touchend",de))}}function ft(e){let{onHoverStart:t,onHoverChange:r,onHoverEnd:o,isDisabled:a}=e,[d,u]=v.useState(!1),p=v.useRef({isHovered:!1,ignoreEmulatedMouseEvents:!1,pointerType:"",target:null}).current;v.useEffect(pt,[]);let{hoverProps:m,triggerHoverEnd:h}=v.useMemo(()=>{let b=(_,x)=>{if(p.pointerType=x,a||x==="touch"||p.isHovered||!_.currentTarget.contains(_.target))return;p.isHovered=!0;let T=_.currentTarget;p.target=T,t&&t({type:"hoverstart",target:T,pointerType:x}),r&&r(!0),u(!0)},P=(_,x)=>{if(p.pointerType="",p.target=null,x==="touch"||!p.isHovered)return;p.isHovered=!1;let T=_.currentTarget;o&&o({type:"hoverend",target:T,pointerType:x}),r&&r(!1),u(!1)},S={};return typeof PointerEvent<"u"?(S.onPointerEnter=_=>{te&&_.pointerType==="mouse"||b(_,_.pointerType)},S.onPointerLeave=_=>{!a&&_.currentTarget.contains(_.target)&&P(_,_.pointerType)}):(S.onTouchStart=()=>{p.ignoreEmulatedMouseEvents=!0},S.onMouseEnter=_=>{!p.ignoreEmulatedMouseEvents&&!te&&b(_,"mouse"),p.ignoreEmulatedMouseEvents=!1},S.onMouseLeave=_=>{!a&&_.currentTarget.contains(_.target)&&P(_,"mouse")}),{hoverProps:S,triggerHoverEnd:P}},[t,r,o,a,p]);return v.useEffect(()=>{a&&h({currentTarget:p.target},p.pointerType)},[a]),{hoverProps:m,isHovered:d}}function mt(e,t){let{elementType:r="button",isDisabled:o,onPress:a,onPressStart:d,onPressEnd:u,onPressUp:p,onPressChange:m,preventFocusOnPress:h,allowFocusWhenDisabled:b,onClick:P,href:S,target:_,rel:x,type:T="button"}=e,E;r==="button"?E={type:T,disabled:o}:E={role:"button",tabIndex:o?void 0:0,href:r==="a"&&o?void 0:S,target:r==="a"?_:void 0,type:r==="input"?T:void 0,disabled:r==="input"?o:void 0,"aria-disabled":!o||r==="input"?void 0:o,rel:r==="a"?x:void 0};let{pressProps:O,isPressed:$}=it({onPressStart:d,onPressEnd:u,onPressChange:m,onPress:a,onPressUp:p,isDisabled:o,preventFocusOnPress:h,ref:t}),{focusableProps:w}=me.useFocusable(e,t);b&&(w.tabIndex=o?-1:w.tabIndex);let C=j(w,O,Ve(e,{labelable:!0}));return{isPressed:$,buttonProps:j(E,C,{"aria-haspopup":e["aria-haspopup"],"aria-expanded":e["aria-expanded"],"aria-controls":e["aria-controls"],"aria-pressed":e["aria-pressed"],onClick:D=>{P&&(P(D),console.warn("onClick is deprecated, please use onPress"))}})}}function _t(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Ke(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,o)}return r}function Ie(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Ke(Object(r),!0).forEach(function(o){_t(e,o,r[o])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Ke(Object(r)).forEach(function(o){Object.defineProperty(e,o,Object.getOwnPropertyDescriptor(r,o))})}return e}var bt=(e,t,r)=>{for(var o of Object.keys(e)){var a;if(e[o]!==((a=t[o])!==null&&a!==void 0?a:r[o]))return!1}return!0},ne=e=>t=>{var r=e.defaultClassName,o=Ie(Ie({},e.defaultVariants),t);for(var a in o){var d,u=(d=o[a])!==null&&d!==void 0?d:e.defaultVariants[a];if(u!=null){var p=u;typeof p=="boolean"&&(p=p===!0?"true":"false");var m=e.variantClassNames[a][p];m&&(r+=" "+m)}}for(var[h,b]of e.compoundVariants)bt(h,o,e.defaultVariants)&&(r+=" "+b);return r},gt=ne({defaultClassName:"pkg_sps-woodland_buttons__version_8_23_1__hash_125pcxy0",variantClassNames:{disabled:{true:"pkg_sps-woodland_buttons__version_8_23_1__hash_125pcxy1",false:"pkg_sps-woodland_buttons__version_8_23_1__hash_125pcxy2"},kind:{default:"pkg_sps-woodland_buttons__version_8_23_1__hash_125pcxy3",link:"pkg_sps-woodland_buttons__version_8_23_1__hash_125pcxy4",confirm:"pkg_sps-woodland_buttons__version_8_23_1__hash_125pcxy5",delete:"pkg_sps-woodland_buttons__version_8_23_1__hash_125pcxy6",key:"pkg_sps-woodland_buttons__version_8_23_1__hash_125pcxy7",icon:"pkg_sps-woodland_buttons__version_8_23_1__hash_125pcxy8"},spinning:{true:"pkg_sps-woodland_buttons__version_8_23_1__hash_125pcxy9",false:"pkg_sps-woodland_buttons__version_8_23_1__hash_125pcxya"}},defaultVariants:{disabled:!1,kind:"default",spinning:!1},compoundVariants:[[{kind:"icon",spinning:!0},"pkg_sps-woodland_buttons__version_8_23_1__hash_125pcxyb"],[{kind:"default",spinning:!0},"pkg_sps-woodland_buttons__version_8_23_1__hash_125pcxyc"],[{kind:"confirm",spinning:!0},"pkg_sps-woodland_buttons__version_8_23_1__hash_125pcxyd"],[{kind:"delete",spinning:!0},"pkg_sps-woodland_buttons__version_8_23_1__hash_125pcxye"],[{kind:"key",spinning:!0},"pkg_sps-woodland_buttons__version_8_23_1__hash_125pcxyf"],[{disabled:!0,spinning:!1},"pkg_sps-woodland_buttons__version_8_23_1__hash_125pcxyg"]]}),vt=ne({defaultClassName:"pkg_sps-woodland_buttons__version_8_23_1__hash_125pcxyh",variantClassNames:{disabled:{true:"pkg_sps-woodland_buttons__version_8_23_1__hash_125pcxyi",false:"pkg_sps-woodland_buttons__version_8_23_1__hash_125pcxyj"},kind:{icon:"pkg_sps-woodland_buttons__version_8_23_1__hash_125pcxyk",default:"pkg_sps-woodland_buttons__version_8_23_1__hash_125pcxyl",delete:"pkg_sps-woodland_buttons__version_8_23_1__hash_125pcxym",key:"pkg_sps-woodland_buttons__version_8_23_1__hash_125pcxyn",confirm:"pkg_sps-woodland_buttons__version_8_23_1__hash_125pcxyo",link:"pkg_sps-woodland_buttons__version_8_23_1__hash_125pcxyp"},spinning:{true:"pkg_sps-woodland_buttons__version_8_23_1__hash_125pcxyq",false:"pkg_sps-woodland_buttons__version_8_23_1__hash_125pcxyr"}},defaultVariants:{disabled:!1,kind:"default",spinning:!1},compoundVariants:[]}),ht="pkg_sps-woodland_buttons__version_8_23_1__hash_125pcxy11",yt=ne({defaultClassName:"pkg_sps-woodland_buttons__version_8_23_1__hash_125pcxy12",variantClassNames:{spinning:{true:"pkg_sps-woodland_buttons__version_8_23_1__hash_125pcxy13",false:"pkg_sps-woodland_buttons__version_8_23_1__hash_125pcxy14"}},defaultVariants:{spinning:!1},compoundVariants:[]}),kt=ne({defaultClassName:"pkg_sps-woodland_buttons__version_8_23_1__hash_125pcxys",variantClassNames:{spinning:{true:"pkg_sps-woodland_buttons__version_8_23_1__hash_125pcxyt",false:"pkg_sps-woodland_buttons__version_8_23_1__hash_125pcxyu"},kind:{icon:"pkg_sps-woodland_buttons__version_8_23_1__hash_125pcxyv",default:"pkg_sps-woodland_buttons__version_8_23_1__hash_125pcxyw",delete:"pkg_sps-woodland_buttons__version_8_23_1__hash_125pcxyx",key:"pkg_sps-woodland_buttons__version_8_23_1__hash_125pcxyy",confirm:"pkg_sps-woodland_buttons__version_8_23_1__hash_125pcxyz",link:"pkg_sps-woodland_buttons__version_8_23_1__hash_125pcxy10"}},defaultVariants:{spinning:!1},compoundVariants:[]});function wt({as:e,onClick:t,onPress:r,children:o,className:a,isDisabled:d,disabled:u,href:p,icon:m,kind:h="default",spinning:b,spinningTitle:P,title:S,..._},x){const T=e??(p?"a":"button"),E={onPress:r??t,isDisabled:u??d??b,..._},{"data-testid":O}=_,$=x||c.useRef(null),{buttonProps:w}=mt(E,$),{hoverProps:C}=ft({isDisabled:E.isDisabled}),{type:D,...G}=w,fe={...j(G,C),ref:$,title:S,className:p?kt({spinning:b,kind:h}):vt({disabled:d||u,kind:h,spinning:b}),...p?{href:p}:{type:D},..._},{t:n}=c.useContext(V.I18nContext),f=m&&c.createElement(V.Icon,{className:ht,icon:m,"aria-hidden":"true","data-testid":`${O}__${m}-icon`});let B;h==="default"||h==="icon"||h==="link"?B="dark":B="light";const l=b&&c.createElement(V.Spinner,{color:B,className:yt({spinning:b}),title:P||n("design-system:button.spinningTitle"),"data-testid":`${O}__spinner`});return c.createElement(me.FocusRing,null,c.createElement("div",{className:V.cl(gt({disabled:d||u,kind:h,spinning:b}),a)},c.createElement(T,{...fe},f,o?c.createElement("span",null,o):"",l)))}const pe=c.forwardRef(wt);V.Metadata.set(pe,{name:"Button",props:{disabled:"boolean",href:"string",icon:"IconName",kind:{type:'"default" | "link" | "icon" | "confirm" | "delete" | "key"',default:'"default"'},spinning:"boolean",spinningTitle:"string",type:{type:'"button" | "submit"',default:'"button"'}},panellable:!0});const Tt={Buttons:{components:[pe],description:()=>c.createElement(c.Fragment,null,c.createElement("div",{className:"sps-body-14"},"Buttons are used to initiate events or actions. The labels and/or icons describe what the button will do."),c.createElement("br",null),c.createElement("h5",null,"Variants"),c.createElement("div",{className:"sps-body-14"},c.createElement("span",{className:"sps-text-semibold"},"Default: "),"For tertiary actions or actions of lower importance on a page."),c.createElement("div",{className:"sps-body-14"},c.createElement("span",{className:"sps-text-semibold"},"Key: "),"For primary or important actions on a page."),c.createElement("div",{className:"sps-body-14"},c.createElement("span",{className:"sps-text-semibold"},"Confirm: "),"For the main call to action on a page. There should only be one Confirm button per screen."),c.createElement("div",{className:"sps-body-14"},c.createElement("span",{className:"sps-text-semibold"},"Delete: "),"For deleting information or another destructive action. These should always be paired with a Delete Confirmation Modal."),c.createElement("div",{className:"sps-body-14"},c.createElement("span",{className:"sps-text-semibold"},"Disabled: "),"For actions that are not permitted in a particular state. These can be accompanied by a Tooltip on hover describing why it’s disabled."),c.createElement("div",{className:"sps-body-14"},c.createElement("span",{className:"sps-text-semibold"},"With an Icon: "),"For further illustrating the action. Example: Pencil icon in an Edit button. There can also be Icon Buttons without text.")),examples:{basic:{label:"Basic Buttons",description:({NavigateTo:e})=>c.createElement(c.Fragment,null,c.createElement("p",null,"The most common type of button that can be used in most cases. Example: Basic Buttons in a ",c.createElement(e,{to:"modals"},"Modal"),".")),examples:{withoutIcons:{description:"Without Icons",react:y.code`
|
1
|
+
(function(N,v){typeof exports=="object"&&typeof module<"u"?v(exports,require("react"),require("@sps-woodland/core"),require("@react-aria/focus"),require("@spscommerce/utils")):typeof define=="function"&&define.amd?define(["exports","react","@sps-woodland/core","@react-aria/focus","@spscommerce/utils"],v):(N=typeof globalThis<"u"?globalThis:N||self,v(N.Buttons={},N.React,N.core,N.focus,N.utils))})(this,function(N,v,V,me,k){"use strict";function Ae(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const o=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,o.get?o:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const c=Ae(v),_e=typeof document<"u"?v.useLayoutEffect:()=>{};function W(e){const t=v.useRef(null);return _e(()=>{t.current=e},[e]),v.useCallback((...r)=>{const o=t.current;return o==null?void 0:o(...r)},[])}let be=new Map;function Le(e,t){if(e===t)return e;let r=be.get(e);if(r)return r.forEach(a=>a(t)),t;let o=be.get(t);return o?(o.forEach(a=>a(e)),e):t}function ge(...e){return(...t)=>{for(let r of e)typeof r=="function"&&r(...t)}}const A=e=>{var t;return(t=e==null?void 0:e.ownerDocument)!==null&&t!==void 0?t:document},oe=e=>e&&"window"in e&&e.window===e?e:A(e).defaultView||window;function ve(e){var t,r,o="";if(typeof e=="string"||typeof e=="number")o+=e;else if(typeof e=="object")if(Array.isArray(e)){var a=e.length;for(t=0;t<a;t++)e[t]&&(r=ve(e[t]))&&(o&&(o+=" "),o+=r)}else for(r in e)e[r]&&(o&&(o+=" "),o+=r);return o}function Me(){for(var e,t,r=0,o="",a=arguments.length;r<a;r++)(e=arguments[r])&&(t=ve(e))&&(o&&(o+=" "),o+=t);return o}function j(...e){let t={...e[0]};for(let r=1;r<e.length;r++){let o=e[r];for(let a in o){let d=t[a],u=o[a];typeof d=="function"&&typeof u=="function"&&a[0]==="o"&&a[1]==="n"&&a.charCodeAt(2)>=65&&a.charCodeAt(2)<=90?t[a]=ge(d,u):(a==="className"||a==="UNSAFE_className")&&typeof d=="string"&&typeof u=="string"?t[a]=Me(d,u):a==="id"&&d&&u?t.id=Le(d,u):t[a]=u!==void 0?u:d}}return t}const Fe=new Set(["id"]),Ue=new Set(["aria-label","aria-labelledby","aria-describedby","aria-details"]),He=new Set(["href","hrefLang","target","rel","download","ping","referrerPolicy"]),Ge=/^(data-.*)$/;function Ve(e,t={}){let{labelable:r,isLink:o,propNames:a}=t,d={};for(const u in e)Object.prototype.hasOwnProperty.call(e,u)&&(Fe.has(u)||r&&Ue.has(u)||o&&He.has(u)||a!=null&&a.has(u)||Ge.test(u))&&(d[u]=e[u]);return d}function Y(e){if(We())e.focus({preventScroll:!0});else{let t=je(e);e.focus(),Ye(t)}}let X=null;function We(){if(X==null){X=!1;try{document.createElement("div").focus({get preventScroll(){return X=!0,!0}})}catch{}}return X}function je(e){let t=e.parentNode,r=[],o=document.scrollingElement||document.documentElement;for(;t instanceof HTMLElement&&t!==o;)(t.offsetHeight<t.scrollHeight||t.offsetWidth<t.scrollWidth)&&r.push({element:t,scrollTop:t.scrollTop,scrollLeft:t.scrollLeft}),t=t.parentNode;return o instanceof HTMLElement&&r.push({element:o,scrollTop:o.scrollTop,scrollLeft:o.scrollLeft}),r}function Ye(e){for(let{element:t,scrollTop:r,scrollLeft:o}of e)t.scrollTop=r,t.scrollLeft=o}function q(e){var t;return typeof window>"u"||window.navigator==null?!1:((t=window.navigator.userAgentData)===null||t===void 0?void 0:t.brands.some(r=>e.test(r.brand)))||e.test(window.navigator.userAgent)}function re(e){var t;return typeof window<"u"&&window.navigator!=null?e.test(((t=window.navigator.userAgentData)===null||t===void 0?void 0:t.platform)||window.navigator.platform):!1}function L(e){let t=null;return()=>(t==null&&(t=e()),t)}const z=L(function(){return re(/^Mac/i)}),Re=L(function(){return re(/^iPhone/i)}),he=L(function(){return re(/^iPad/i)||z()&&navigator.maxTouchPoints>1}),ye=L(function(){return Re()||he()}),Xe=L(function(){return q(/AppleWebKit/i)&&!qe()}),qe=L(function(){return q(/Chrome/i)}),ke=L(function(){return q(/Android/i)}),ze=L(function(){return q(/Firefox/i)});function R(e,t,r=!0){var o,a;let{metaKey:d,ctrlKey:u,altKey:p,shiftKey:m}=t;ze()&&(!((a=window.event)===null||a===void 0||(o=a.type)===null||o===void 0)&&o.startsWith("key"))&&e.target==="_blank"&&(z()?d=!0:u=!0);let h=Xe()&&z()&&!he()?new KeyboardEvent("keydown",{keyIdentifier:"Enter",metaKey:d,ctrlKey:u,altKey:p,shiftKey:m}):new MouseEvent("click",{metaKey:d,ctrlKey:u,altKey:p,shiftKey:m,bubbles:!0,cancelable:!0});R.isOpening=r,Y(e),e.dispatchEvent(h),R.isOpening=!1}R.isOpening=!1;let F=new Map,se=new Set;function we(){if(typeof window>"u")return;function e(o){return"propertyName"in o}let t=o=>{if(!e(o)||!o.target)return;let a=F.get(o.target);a||(a=new Set,F.set(o.target,a),o.target.addEventListener("transitioncancel",r,{once:!0})),a.add(o.propertyName)},r=o=>{if(!e(o)||!o.target)return;let a=F.get(o.target);if(a&&(a.delete(o.propertyName),a.size===0&&(o.target.removeEventListener("transitioncancel",r),F.delete(o.target)),F.size===0)){for(let d of se)d();se.clear()}};document.body.addEventListener("transitionrun",t),document.body.addEventListener("transitionend",r)}typeof document<"u"&&(document.readyState!=="loading"?we():document.addEventListener("DOMContentLoaded",we));function Je(e){requestAnimationFrame(()=>{F.size===0?e():se.add(e)})}function Qe(){let e=v.useRef(new Map),t=v.useCallback((a,d,u,p)=>{let m=p!=null&&p.once?(...h)=>{e.current.delete(u),u(...h)}:u;e.current.set(u,{type:d,eventTarget:a,fn:m,options:p}),a.addEventListener(d,u,p)},[]),r=v.useCallback((a,d,u,p)=>{var m;let h=((m=e.current.get(u))===null||m===void 0?void 0:m.fn)||u;a.removeEventListener(d,h,p),e.current.delete(u)},[]),o=v.useCallback(()=>{e.current.forEach((a,d)=>{r(a.eventTarget,a.type,d,a.options)})},[r]);return v.useEffect(()=>o,[o]),{addGlobalListener:t,removeGlobalListener:r,removeAllGlobalListeners:o}}function Ze(e,t){_e(()=>{if(e&&e.ref&&t)return e.ref.current=t.current,()=>{e.ref&&(e.ref.current=null)}})}function Te(e){return e.mozInputSource===0&&e.isTrusted?!0:ke()&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function et(e){return!ke()&&e.width===0&&e.height===0||e.width===1&&e.height===1&&e.pressure===0&&e.detail===0&&e.pointerType==="mouse"}let U="default",ae="",J=new WeakMap;function Ee(e){if(ye()){if(U==="default"){const t=A(e);ae=t.documentElement.style.webkitUserSelect,t.documentElement.style.webkitUserSelect="none"}U="disabled"}else(e instanceof HTMLElement||e instanceof SVGElement)&&(J.set(e,e.style.userSelect),e.style.userSelect="none")}function Q(e){if(ye()){if(U!=="disabled")return;U="restoring",setTimeout(()=>{Je(()=>{if(U==="restoring"){const t=A(e);t.documentElement.style.webkitUserSelect==="none"&&(t.documentElement.style.webkitUserSelect=ae||""),ae="",U="default"}})},300)}else if((e instanceof HTMLElement||e instanceof SVGElement)&&e&&J.has(e)){let t=J.get(e);e.style.userSelect==="none"&&(e.style.userSelect=t),e.getAttribute("style")===""&&e.removeAttribute("style"),J.delete(e)}}const Be=v.createContext({register:()=>{}});Be.displayName="PressResponderContext";function tt(e,t){return t.get?t.get.call(e):t.value}function $e(e,t,r){if(!t.has(e))throw new TypeError("attempted to "+r+" private field on non-instance");return t.get(e)}function nt(e,t){var r=$e(e,t,"get");return tt(e,r)}function ot(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function rt(e,t,r){ot(e,t),t.set(e,r)}function st(e,t,r){if(t.set)t.set.call(e,r);else{if(!t.writable)throw new TypeError("attempted to set read only private field");t.value=r}}function Pe(e,t,r){var o=$e(e,t,"set");return st(e,o,r),r}function at(e){let t=v.useContext(Be);if(t){let{register:r,...o}=t;e=j(o,e),r()}return Ze(t,e.ref),e}var Z=new WeakMap;class ee{continuePropagation(){Pe(this,Z,!1)}get shouldStopPropagation(){return nt(this,Z)}constructor(t,r,o,a){rt(this,Z,{writable:!0,value:void 0}),Pe(this,Z,!0);var d;let u=(d=a==null?void 0:a.target)!==null&&d!==void 0?d:o.currentTarget;const p=u==null?void 0:u.getBoundingClientRect();let m,h=0,b,B=null;o.clientX!=null&&o.clientY!=null&&(b=o.clientX,B=o.clientY),p&&(b!=null&&B!=null?(m=b-p.left,h=B-p.top):(m=p.width/2,h=p.height/2)),this.type=t,this.pointerType=r,this.target=o.currentTarget,this.shiftKey=o.shiftKey,this.metaKey=o.metaKey,this.ctrlKey=o.ctrlKey,this.altKey=o.altKey,this.x=m,this.y=h}}const xe=Symbol("linkClicked");function it(e){let{onPress:t,onPressChange:r,onPressStart:o,onPressEnd:a,onPressUp:d,isDisabled:u,isPressed:p,preventFocusOnPress:m,shouldCancelOnPointerExit:h,allowTextSelectionOnPress:b,ref:B,...S}=at(e),[_,$]=v.useState(!1),T=v.useRef({isPressed:!1,ignoreEmulatedMouseEvents:!1,ignoreClickAfterPress:!1,didFirePressStart:!1,isTriggeringEvent:!1,activePointerId:null,target:null,isOverTarget:!1,pointerType:null}),{addGlobalListener:E,removeAllGlobalListeners:O}=Qe(),P=W((n,f)=>{let x=T.current;if(u||x.didFirePressStart)return!1;let l=!0;if(x.isTriggeringEvent=!0,o){let y=new ee("pressstart",f,n);o(y),l=y.shouldStopPropagation}return r&&r(!0),x.isTriggeringEvent=!1,x.didFirePressStart=!0,$(!0),l}),w=W((n,f,x=!0)=>{let l=T.current;if(!l.didFirePressStart)return!1;l.ignoreClickAfterPress=!0,l.didFirePressStart=!1,l.isTriggeringEvent=!0;let y=!0;if(a){let s=new ee("pressend",f,n);a(s),y=s.shouldStopPropagation}if(r&&r(!1),$(!1),t&&x&&!u){let s=new ee("press",f,n);t(s),y&&(y=s.shouldStopPropagation)}return l.isTriggeringEvent=!1,y}),C=W((n,f)=>{let x=T.current;if(u)return!1;if(d){x.isTriggeringEvent=!0;let l=new ee("pressup",f,n);return d(l),x.isTriggeringEvent=!1,l.shouldStopPropagation}return!0}),D=W(n=>{let f=T.current;f.isPressed&&f.target&&(f.isOverTarget&&f.pointerType!=null&&w(K(f.target,n),f.pointerType,!1),f.isPressed=!1,f.isOverTarget=!1,f.activePointerId=null,f.pointerType=null,O(),b||Q(f.target))}),G=W(n=>{h&&D(n)}),fe=v.useMemo(()=>{let n=T.current,f={onKeyDown(l){if(le(l.nativeEvent,l.currentTarget)&&l.currentTarget.contains(l.target)){var y;Oe(l.target,l.key)&&l.preventDefault();let s=!0;if(!n.isPressed&&!l.repeat){n.target=l.currentTarget,n.isPressed=!0,s=P(l,"keyboard");let g=l.currentTarget,i=I=>{le(I,g)&&!I.repeat&&g.contains(I.target)&&n.target&&C(K(n.target,I),"keyboard")};E(A(l.currentTarget),"keyup",ge(i,x),!0)}s&&l.stopPropagation(),l.metaKey&&z()&&((y=n.metaKeyEvents)===null||y===void 0||y.set(l.key,l.nativeEvent))}else l.key==="Meta"&&(n.metaKeyEvents=new Map)},onClick(l){if(!(l&&!l.currentTarget.contains(l.target))&&l&&l.button===0&&!n.isTriggeringEvent&&!R.isOpening){let y=!0;if(u&&l.preventDefault(),!n.ignoreClickAfterPress&&!n.ignoreEmulatedMouseEvents&&!n.isPressed&&(n.pointerType==="virtual"||Te(l.nativeEvent))){!u&&!m&&Y(l.currentTarget);let s=P(l,"virtual"),g=C(l,"virtual"),i=w(l,"virtual");y=s&&g&&i}n.ignoreEmulatedMouseEvents=!1,n.ignoreClickAfterPress=!1,y&&l.stopPropagation()}}},x=l=>{var y;if(n.isPressed&&n.target&&le(l,n.target)){var s;Oe(l.target,l.key)&&l.preventDefault();let i=l.target;w(K(n.target,l),"keyboard",n.target.contains(i)),O(),l.key!=="Enter"&&ie(n.target)&&n.target.contains(i)&&!l[xe]&&(l[xe]=!0,R(n.target,l,!1)),n.isPressed=!1,(s=n.metaKeyEvents)===null||s===void 0||s.delete(l.key)}else if(l.key==="Meta"&&(!((y=n.metaKeyEvents)===null||y===void 0)&&y.size)){var g;let i=n.metaKeyEvents;n.metaKeyEvents=void 0;for(let I of i.values())(g=n.target)===null||g===void 0||g.dispatchEvent(new KeyboardEvent("keyup",I))}};if(typeof PointerEvent<"u"){f.onPointerDown=i=>{if(i.button!==0||!i.currentTarget.contains(i.target))return;if(et(i.nativeEvent)){n.pointerType="virtual";return}ue(i.currentTarget)&&i.preventDefault(),n.pointerType=i.pointerType;let I=!0;n.isPressed||(n.isPressed=!0,n.isOverTarget=!0,n.activePointerId=i.pointerId,n.target=i.currentTarget,!u&&!m&&Y(i.currentTarget),b||Ee(n.target),I=P(i,n.pointerType),E(A(i.currentTarget),"pointermove",l,!1),E(A(i.currentTarget),"pointerup",y,!1),E(A(i.currentTarget),"pointercancel",g,!1)),I&&i.stopPropagation()},f.onMouseDown=i=>{i.currentTarget.contains(i.target)&&i.button===0&&(ue(i.currentTarget)&&i.preventDefault(),i.stopPropagation())},f.onPointerUp=i=>{!i.currentTarget.contains(i.target)||n.pointerType==="virtual"||i.button===0&&H(i,i.currentTarget)&&C(i,n.pointerType||i.pointerType)};let l=i=>{i.pointerId===n.activePointerId&&(n.target&&H(i,n.target)?!n.isOverTarget&&n.pointerType!=null&&(n.isOverTarget=!0,P(K(n.target,i),n.pointerType)):n.target&&n.isOverTarget&&n.pointerType!=null&&(n.isOverTarget=!1,w(K(n.target,i),n.pointerType,!1),G(i)))},y=i=>{i.pointerId===n.activePointerId&&n.isPressed&&i.button===0&&n.target&&(H(i,n.target)&&n.pointerType!=null?w(K(n.target,i),n.pointerType):n.isOverTarget&&n.pointerType!=null&&w(K(n.target,i),n.pointerType,!1),n.isPressed=!1,n.isOverTarget=!1,n.activePointerId=null,n.pointerType=null,O(),b||Q(n.target),"ontouchend"in n.target&&i.pointerType!=="mouse"&&E(n.target,"touchend",s,{once:!0}))},s=i=>{Ne(i.target)&&i.preventDefault()},g=i=>{D(i)};f.onDragStart=i=>{i.currentTarget.contains(i.target)&&D(i)}}else{f.onMouseDown=s=>{if(s.button!==0||!s.currentTarget.contains(s.target))return;if(ue(s.currentTarget)&&s.preventDefault(),n.ignoreEmulatedMouseEvents){s.stopPropagation();return}n.isPressed=!0,n.isOverTarget=!0,n.target=s.currentTarget,n.pointerType=Te(s.nativeEvent)?"virtual":"mouse",!u&&!m&&Y(s.currentTarget),P(s,n.pointerType)&&s.stopPropagation(),E(A(s.currentTarget),"mouseup",l,!1)},f.onMouseEnter=s=>{if(!s.currentTarget.contains(s.target))return;let g=!0;n.isPressed&&!n.ignoreEmulatedMouseEvents&&n.pointerType!=null&&(n.isOverTarget=!0,g=P(s,n.pointerType)),g&&s.stopPropagation()},f.onMouseLeave=s=>{if(!s.currentTarget.contains(s.target))return;let g=!0;n.isPressed&&!n.ignoreEmulatedMouseEvents&&n.pointerType!=null&&(n.isOverTarget=!1,g=w(s,n.pointerType,!1),G(s)),g&&s.stopPropagation()},f.onMouseUp=s=>{s.currentTarget.contains(s.target)&&!n.ignoreEmulatedMouseEvents&&s.button===0&&C(s,n.pointerType||"mouse")};let l=s=>{if(s.button===0){if(n.isPressed=!1,O(),n.ignoreEmulatedMouseEvents){n.ignoreEmulatedMouseEvents=!1;return}n.target&&H(s,n.target)&&n.pointerType!=null?w(K(n.target,s),n.pointerType):n.target&&n.isOverTarget&&n.pointerType!=null&&w(K(n.target,s),n.pointerType,!1),n.isOverTarget=!1}};f.onTouchStart=s=>{if(!s.currentTarget.contains(s.target))return;let g=lt(s.nativeEvent);if(!g)return;n.activePointerId=g.identifier,n.ignoreEmulatedMouseEvents=!0,n.isOverTarget=!0,n.isPressed=!0,n.target=s.currentTarget,n.pointerType="touch",!u&&!m&&Y(s.currentTarget),b||Ee(n.target),P(M(n.target,s),n.pointerType)&&s.stopPropagation(),E(oe(s.currentTarget),"scroll",y,!0)},f.onTouchMove=s=>{if(!s.currentTarget.contains(s.target))return;if(!n.isPressed){s.stopPropagation();return}let g=Se(s.nativeEvent,n.activePointerId),i=!0;g&&H(g,s.currentTarget)?!n.isOverTarget&&n.pointerType!=null&&(n.isOverTarget=!0,i=P(M(n.target,s),n.pointerType)):n.isOverTarget&&n.pointerType!=null&&(n.isOverTarget=!1,i=w(M(n.target,s),n.pointerType,!1),G(M(n.target,s))),i&&s.stopPropagation()},f.onTouchEnd=s=>{if(!s.currentTarget.contains(s.target))return;if(!n.isPressed){s.stopPropagation();return}let g=Se(s.nativeEvent,n.activePointerId),i=!0;g&&H(g,s.currentTarget)&&n.pointerType!=null?(C(M(n.target,s),n.pointerType),i=w(M(n.target,s),n.pointerType)):n.isOverTarget&&n.pointerType!=null&&(i=w(M(n.target,s),n.pointerType,!1)),i&&s.stopPropagation(),n.isPressed=!1,n.activePointerId=null,n.isOverTarget=!1,n.ignoreEmulatedMouseEvents=!0,n.target&&!b&&Q(n.target),O()},f.onTouchCancel=s=>{s.currentTarget.contains(s.target)&&(s.stopPropagation(),n.isPressed&&D(M(n.target,s)))};let y=s=>{n.isPressed&&s.target.contains(n.target)&&D({currentTarget:n.target,shiftKey:!1,ctrlKey:!1,metaKey:!1,altKey:!1})};f.onDragStart=s=>{s.currentTarget.contains(s.target)&&D(s)}}return f},[E,u,m,O,b,D,G,w,P,C]);return v.useEffect(()=>()=>{var n;b||Q((n=T.current.target)!==null&&n!==void 0?n:void 0)},[b]),{isPressed:p||_,pressProps:j(S,fe)}}function ie(e){return e.tagName==="A"&&e.hasAttribute("href")}function le(e,t){const{key:r,code:o}=e,a=t,d=a.getAttribute("role");return(r==="Enter"||r===" "||r==="Spacebar"||o==="Space")&&!(a instanceof oe(a).HTMLInputElement&&!De(a,r)||a instanceof oe(a).HTMLTextAreaElement||a.isContentEditable)&&!((d==="link"||!d&&ie(a))&&r!=="Enter")}function lt(e){const{targetTouches:t}=e;return t.length>0?t[0]:null}function Se(e,t){const r=e.changedTouches;for(let o=0;o<r.length;o++){const a=r[o];if(a.identifier===t)return a}return null}function M(e,t){let r=0,o=0;return t.targetTouches&&t.targetTouches.length===1&&(r=t.targetTouches[0].clientX,o=t.targetTouches[0].clientY),{currentTarget:e,shiftKey:t.shiftKey,ctrlKey:t.ctrlKey,metaKey:t.metaKey,altKey:t.altKey,clientX:r,clientY:o}}function K(e,t){let r=t.clientX,o=t.clientY;return{currentTarget:e,shiftKey:t.shiftKey,ctrlKey:t.ctrlKey,metaKey:t.metaKey,altKey:t.altKey,clientX:r,clientY:o}}function ut(e){let t=0,r=0;return e.width!==void 0?t=e.width/2:e.radiusX!==void 0&&(t=e.radiusX),e.height!==void 0?r=e.height/2:e.radiusY!==void 0&&(r=e.radiusY),{top:e.clientY-r,right:e.clientX+t,bottom:e.clientY+r,left:e.clientX-t}}function ct(e,t){return!(e.left>t.right||t.left>e.right||e.top>t.bottom||t.top>e.bottom)}function H(e,t){let r=t.getBoundingClientRect(),o=ut(e);return ct(r,o)}function ue(e){return!(e instanceof HTMLElement)||!e.hasAttribute("draggable")}function Ne(e){return e instanceof HTMLInputElement?!1:e instanceof HTMLButtonElement?e.type!=="submit"&&e.type!=="reset":!ie(e)}function Oe(e,t){return e instanceof HTMLInputElement?!De(e,t):Ne(e)}const dt=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]);function De(e,t){return e.type==="checkbox"||e.type==="radio"?t===" ":dt.has(e.type)}let te=!1,ce=0;function de(){te=!0,setTimeout(()=>{te=!1},50)}function Ce(e){e.pointerType==="touch"&&de()}function pt(){if(!(typeof document>"u"))return typeof PointerEvent<"u"?document.addEventListener("pointerup",Ce):document.addEventListener("touchend",de),ce++,()=>{ce--,!(ce>0)&&(typeof PointerEvent<"u"?document.removeEventListener("pointerup",Ce):document.removeEventListener("touchend",de))}}function ft(e){let{onHoverStart:t,onHoverChange:r,onHoverEnd:o,isDisabled:a}=e,[d,u]=v.useState(!1),p=v.useRef({isHovered:!1,ignoreEmulatedMouseEvents:!1,pointerType:"",target:null}).current;v.useEffect(pt,[]);let{hoverProps:m,triggerHoverEnd:h}=v.useMemo(()=>{let b=(_,$)=>{if(p.pointerType=$,a||$==="touch"||p.isHovered||!_.currentTarget.contains(_.target))return;p.isHovered=!0;let T=_.currentTarget;p.target=T,t&&t({type:"hoverstart",target:T,pointerType:$}),r&&r(!0),u(!0)},B=(_,$)=>{if(p.pointerType="",p.target=null,$==="touch"||!p.isHovered)return;p.isHovered=!1;let T=_.currentTarget;o&&o({type:"hoverend",target:T,pointerType:$}),r&&r(!1),u(!1)},S={};return typeof PointerEvent<"u"?(S.onPointerEnter=_=>{te&&_.pointerType==="mouse"||b(_,_.pointerType)},S.onPointerLeave=_=>{!a&&_.currentTarget.contains(_.target)&&B(_,_.pointerType)}):(S.onTouchStart=()=>{p.ignoreEmulatedMouseEvents=!0},S.onMouseEnter=_=>{!p.ignoreEmulatedMouseEvents&&!te&&b(_,"mouse"),p.ignoreEmulatedMouseEvents=!1},S.onMouseLeave=_=>{!a&&_.currentTarget.contains(_.target)&&B(_,"mouse")}),{hoverProps:S,triggerHoverEnd:B}},[t,r,o,a,p]);return v.useEffect(()=>{a&&h({currentTarget:p.target},p.pointerType)},[a]),{hoverProps:m,isHovered:d}}function mt(e,t){let{elementType:r="button",isDisabled:o,onPress:a,onPressStart:d,onPressEnd:u,onPressUp:p,onPressChange:m,preventFocusOnPress:h,allowFocusWhenDisabled:b,onClick:B,href:S,target:_,rel:$,type:T="button"}=e,E;r==="button"?E={type:T,disabled:o}:E={role:"button",tabIndex:o?void 0:0,href:r==="a"&&o?void 0:S,target:r==="a"?_:void 0,type:r==="input"?T:void 0,disabled:r==="input"?o:void 0,"aria-disabled":!o||r==="input"?void 0:o,rel:r==="a"?$:void 0};let{pressProps:O,isPressed:P}=it({onPressStart:d,onPressEnd:u,onPressChange:m,onPress:a,onPressUp:p,isDisabled:o,preventFocusOnPress:h,ref:t}),{focusableProps:w}=me.useFocusable(e,t);b&&(w.tabIndex=o?-1:w.tabIndex);let C=j(w,O,Ve(e,{labelable:!0}));return{isPressed:P,buttonProps:j(E,C,{"aria-haspopup":e["aria-haspopup"],"aria-expanded":e["aria-expanded"],"aria-controls":e["aria-controls"],"aria-pressed":e["aria-pressed"],onClick:D=>{B&&(B(D),console.warn("onClick is deprecated, please use onPress"))}})}}function _t(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Ke(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,o)}return r}function Ie(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Ke(Object(r),!0).forEach(function(o){_t(e,o,r[o])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Ke(Object(r)).forEach(function(o){Object.defineProperty(e,o,Object.getOwnPropertyDescriptor(r,o))})}return e}var bt=(e,t,r)=>{for(var o of Object.keys(e)){var a;if(e[o]!==((a=t[o])!==null&&a!==void 0?a:r[o]))return!1}return!0},ne=e=>t=>{var r=e.defaultClassName,o=Ie(Ie({},e.defaultVariants),t);for(var a in o){var d,u=(d=o[a])!==null&&d!==void 0?d:e.defaultVariants[a];if(u!=null){var p=u;typeof p=="boolean"&&(p=p===!0?"true":"false");var m=e.variantClassNames[a][p];m&&(r+=" "+m)}}for(var[h,b]of e.compoundVariants)bt(h,o,e.defaultVariants)&&(r+=" "+b);return r},gt=ne({defaultClassName:"pkg_sps-woodland_buttons__version_8_23_2__hash_125pcxy0",variantClassNames:{disabled:{true:"pkg_sps-woodland_buttons__version_8_23_2__hash_125pcxy1",false:"pkg_sps-woodland_buttons__version_8_23_2__hash_125pcxy2"},kind:{default:"pkg_sps-woodland_buttons__version_8_23_2__hash_125pcxy3",link:"pkg_sps-woodland_buttons__version_8_23_2__hash_125pcxy4",confirm:"pkg_sps-woodland_buttons__version_8_23_2__hash_125pcxy5",delete:"pkg_sps-woodland_buttons__version_8_23_2__hash_125pcxy6",key:"pkg_sps-woodland_buttons__version_8_23_2__hash_125pcxy7",icon:"pkg_sps-woodland_buttons__version_8_23_2__hash_125pcxy8"},spinning:{true:"pkg_sps-woodland_buttons__version_8_23_2__hash_125pcxy9",false:"pkg_sps-woodland_buttons__version_8_23_2__hash_125pcxya"}},defaultVariants:{disabled:!1,kind:"default",spinning:!1},compoundVariants:[[{kind:"icon",spinning:!0},"pkg_sps-woodland_buttons__version_8_23_2__hash_125pcxyb"],[{kind:"default",spinning:!0},"pkg_sps-woodland_buttons__version_8_23_2__hash_125pcxyc"],[{kind:"confirm",spinning:!0},"pkg_sps-woodland_buttons__version_8_23_2__hash_125pcxyd"],[{kind:"delete",spinning:!0},"pkg_sps-woodland_buttons__version_8_23_2__hash_125pcxye"],[{kind:"key",spinning:!0},"pkg_sps-woodland_buttons__version_8_23_2__hash_125pcxyf"],[{disabled:!0,spinning:!1},"pkg_sps-woodland_buttons__version_8_23_2__hash_125pcxyg"]]}),vt=ne({defaultClassName:"pkg_sps-woodland_buttons__version_8_23_2__hash_125pcxyh",variantClassNames:{disabled:{true:"pkg_sps-woodland_buttons__version_8_23_2__hash_125pcxyi",false:"pkg_sps-woodland_buttons__version_8_23_2__hash_125pcxyj"},kind:{icon:"pkg_sps-woodland_buttons__version_8_23_2__hash_125pcxyk",default:"pkg_sps-woodland_buttons__version_8_23_2__hash_125pcxyl",delete:"pkg_sps-woodland_buttons__version_8_23_2__hash_125pcxym",key:"pkg_sps-woodland_buttons__version_8_23_2__hash_125pcxyn",confirm:"pkg_sps-woodland_buttons__version_8_23_2__hash_125pcxyo",link:"pkg_sps-woodland_buttons__version_8_23_2__hash_125pcxyp"},spinning:{true:"pkg_sps-woodland_buttons__version_8_23_2__hash_125pcxyq",false:"pkg_sps-woodland_buttons__version_8_23_2__hash_125pcxyr"}},defaultVariants:{disabled:!1,kind:"default",spinning:!1},compoundVariants:[]}),ht="pkg_sps-woodland_buttons__version_8_23_2__hash_125pcxy11",yt=ne({defaultClassName:"pkg_sps-woodland_buttons__version_8_23_2__hash_125pcxy12",variantClassNames:{spinning:{true:"pkg_sps-woodland_buttons__version_8_23_2__hash_125pcxy13",false:"pkg_sps-woodland_buttons__version_8_23_2__hash_125pcxy14"}},defaultVariants:{spinning:!1},compoundVariants:[]}),kt=ne({defaultClassName:"pkg_sps-woodland_buttons__version_8_23_2__hash_125pcxys",variantClassNames:{spinning:{true:"pkg_sps-woodland_buttons__version_8_23_2__hash_125pcxyt",false:"pkg_sps-woodland_buttons__version_8_23_2__hash_125pcxyu"},kind:{icon:"pkg_sps-woodland_buttons__version_8_23_2__hash_125pcxyv",default:"pkg_sps-woodland_buttons__version_8_23_2__hash_125pcxyw",delete:"pkg_sps-woodland_buttons__version_8_23_2__hash_125pcxyx",key:"pkg_sps-woodland_buttons__version_8_23_2__hash_125pcxyy",confirm:"pkg_sps-woodland_buttons__version_8_23_2__hash_125pcxyz",link:"pkg_sps-woodland_buttons__version_8_23_2__hash_125pcxy10"}},defaultVariants:{spinning:!1},compoundVariants:[]});const pe=c.forwardRef(({as:e,onClick:t,onPress:r,children:o,className:a,isDisabled:d,disabled:u,href:p,icon:m,kind:h="default",spinning:b,spinningTitle:B,title:S,..._},$)=>{const T=e??(p?"a":"button"),E={onPress:r??t,isDisabled:u??d??b,..._},{"data-testid":O}=_,P=c.useRef(null),w=$||P,{buttonProps:C}=mt(E,w),{hoverProps:D}=ft({isDisabled:E.isDisabled}),{type:G,...fe}=C,n={...j(fe,D),ref:w,title:S,className:p?kt({spinning:b,kind:h}):vt({disabled:d||u,kind:h,spinning:b}),...p?{href:p}:{type:G},..._},{t:f}=c.useContext(V.I18nContext),x=m&&c.createElement(V.Icon,{className:ht,icon:m,"aria-hidden":"true","data-testid":`${O}__${m}-icon`});let l;h==="default"||h==="icon"||h==="link"?l="dark":l="light";const y=b&&c.createElement(V.Spinner,{color:l,className:yt({spinning:b}),title:B||f("design-system:button.spinningTitle"),"data-testid":`${O}__spinner`});return c.createElement(me.FocusRing,null,c.createElement("div",{className:V.cl(gt({disabled:d||u,kind:h,spinning:b}),a)},c.createElement(T,{...n},x,o?c.createElement("span",null,o):"",y)))});V.Metadata.set(pe,{name:"Button",props:{disabled:"boolean",href:"string",icon:"IconName",kind:{type:'"default" | "link" | "icon" | "confirm" | "delete" | "key"',default:'"default"'},spinning:"boolean",spinningTitle:"string",type:{type:'"button" | "submit"',default:'"button"'},as:"button | a",onClick:"() => void",onPress:"() => void",children:"ReactNode",className:"string",isDisabled:"boolean",style:"CSSProperties"},panellable:!0});const wt={Buttons:{components:[pe],description:()=>c.createElement(c.Fragment,null,c.createElement("div",{className:"sps-body-14"},"Buttons are used to initiate events or actions. The labels and/or icons describe what the button will do."),c.createElement("br",null),c.createElement("h5",null,"Variants"),c.createElement("div",{className:"sps-body-14"},c.createElement("span",{className:"sps-text-semibold"},"Default: "),"For tertiary actions or actions of lower importance on a page."),c.createElement("div",{className:"sps-body-14"},c.createElement("span",{className:"sps-text-semibold"},"Key: "),"For primary or important actions on a page."),c.createElement("div",{className:"sps-body-14"},c.createElement("span",{className:"sps-text-semibold"},"Confirm: "),"For the main call to action on a page. There should only be one Confirm button per screen."),c.createElement("div",{className:"sps-body-14"},c.createElement("span",{className:"sps-text-semibold"},"Delete: "),"For deleting information or another destructive action. These should always be paired with a Delete Confirmation Modal."),c.createElement("div",{className:"sps-body-14"},c.createElement("span",{className:"sps-text-semibold"},"Disabled: "),"For actions that are not permitted in a particular state. These can be accompanied by a Tooltip on hover describing why it’s disabled."),c.createElement("div",{className:"sps-body-14"},c.createElement("span",{className:"sps-text-semibold"},"With an Icon: "),"For further illustrating the action. Example: Pencil icon in an Edit button. There can also be Icon Buttons without text.")),examples:{basic:{label:"Basic Buttons",description:({NavigateTo:e})=>c.createElement(c.Fragment,null,c.createElement("p",null,"The most common type of button that can be used in most cases. Example: Basic Buttons in a ",c.createElement(e,{to:"modals"},"Modal"),".")),examples:{withoutIcons:{description:"Without Icons",react:k.code`
|
2
2
|
import { Button } from "@sps-woodland/buttons";
|
3
3
|
import { sprinkles } from "@sps-woodland/tokens";
|
4
4
|
|
@@ -13,7 +13,7 @@
|
|
13
13
|
</>
|
14
14
|
)
|
15
15
|
}
|
16
|
-
`},withIcons:{description:"With Icons",react:
|
16
|
+
`},withIcons:{description:"With Icons",react:k.code`
|
17
17
|
import { Button } from "@sps-woodland/buttons";
|
18
18
|
import { sprinkles } from "@sps-woodland/tokens";
|
19
19
|
|
@@ -28,7 +28,7 @@
|
|
28
28
|
</>
|
29
29
|
)
|
30
30
|
}
|
31
|
-
`},spinning:{description:"Spinning",react:
|
31
|
+
`},spinning:{description:"Spinning",react:k.code`
|
32
32
|
import { Button } from "@sps-woodland/buttons";
|
33
33
|
import { sprinkles } from "@sps-woodland/tokens";
|
34
34
|
|
@@ -42,7 +42,7 @@
|
|
42
42
|
</>
|
43
43
|
)
|
44
44
|
}
|
45
|
-
`}}},dropdown:{label:"Dropdown Buttons",description:"Use these for actions that need to select an option to proceed. Example: Download button with optiosn related to the file format (PDF, PPT, etc.).",examples:{withoutIcons:{description:"Without Icons",react:
|
45
|
+
`}}},dropdown:{label:"Dropdown Buttons",description:"Use these for actions that need to select an option to proceed. Example: Download button with optiosn related to the file format (PDF, PPT, etc.).",examples:{withoutIcons:{description:"Without Icons",react:k.code`
|
46
46
|
import { SpsDropdown } from "@spscommerce/ds-react";
|
47
47
|
|
48
48
|
function Component() {
|
@@ -80,7 +80,7 @@
|
|
80
80
|
</>
|
81
81
|
)
|
82
82
|
}
|
83
|
-
`},withIcons:{description:"With Icons",react:
|
83
|
+
`},withIcons:{description:"With Icons",react:k.code`
|
84
84
|
import { SpsDropdown } from "@spscommerce/ds-react";
|
85
85
|
|
86
86
|
function Component() {
|
@@ -123,7 +123,7 @@
|
|
123
123
|
</>
|
124
124
|
)
|
125
125
|
}
|
126
|
-
`},spinning:{description:"Spinning",react:
|
126
|
+
`},spinning:{description:"Spinning",react:k.code`
|
127
127
|
import { SpsDropdown } from "@spscommerce/ds-react";
|
128
128
|
|
129
129
|
function Component() {
|
@@ -159,7 +159,7 @@
|
|
159
159
|
</>
|
160
160
|
)
|
161
161
|
}
|
162
|
-
`}}},splitButtons:{label:"Split Buttons",description:"Use when there is 1 primary action and other related actions can be taken.",examples:{withoutIcons:{description:"Without Icons",react:
|
162
|
+
`}}},splitButtons:{label:"Split Buttons",description:"Use when there is 1 primary action and other related actions can be taken.",examples:{withoutIcons:{description:"Without Icons",react:k.code`
|
163
163
|
import { SpsSplitButton } from "@spscommerce/ds-react";
|
164
164
|
|
165
165
|
function Component() {
|
@@ -185,7 +185,7 @@
|
|
185
185
|
</>
|
186
186
|
)
|
187
187
|
}
|
188
|
-
`},withIcons:{description:"With Icons",react:
|
188
|
+
`},withIcons:{description:"With Icons",react:k.code`
|
189
189
|
import { SpsSplitButton } from "@spscommerce/ds-react";
|
190
190
|
|
191
191
|
function Component() {
|
@@ -223,7 +223,7 @@
|
|
223
223
|
</>
|
224
224
|
)
|
225
225
|
}
|
226
|
-
`}}},iconButtons:{label:"Icon Buttons",description:({NavigateTo:e,Link:t})=>c.createElement(c.Fragment,null,c.createElement("p",null,"Use these for quick actions that can clearly be articulated by the use of an icon. Example: A Print button in the"," ",c.createElement(e,{to:"list-action-bar"},"List Action Bar"),". Do not use an icon that doesn't have a universally understood meaning; instead use a Basic Button or a Basic Button with an icon. ",c.createElement(t,{to:"/style-and-layout/icons/"},"View All Icons"))),examples:{standard:{description:"Standard Icon Buttons",react:
|
226
|
+
`}}},iconButtons:{label:"Icon Buttons",description:({NavigateTo:e,Link:t})=>c.createElement(c.Fragment,null,c.createElement("p",null,"Use these for quick actions that can clearly be articulated by the use of an icon. Example: A Print button in the"," ",c.createElement(e,{to:"list-action-bar"},"List Action Bar"),". Do not use an icon that doesn't have a universally understood meaning; instead use a Basic Button or a Basic Button with an icon. ",c.createElement(t,{to:"/style-and-layout/icons/"},"View All Icons"))),examples:{standard:{description:"Standard Icon Buttons",react:k.code`
|
227
227
|
import { Button } from "@sps-woodland/buttons";
|
228
228
|
import { sprinkles } from "@sps-woodland/tokens";
|
229
229
|
|
@@ -242,7 +242,7 @@
|
|
242
242
|
</>
|
243
243
|
)
|
244
244
|
}
|
245
|
-
`},dropdown:{description:({NavigateTo:e})=>c.createElement(c.Fragment,null,c.createElement("h5",null,"Dropdown Icon Buttons"),c.createElement("p",null,"Use these when there are several options available for action. Example: Dropdown Icon Button in a ",c.createElement(e,{to:"content-rows"},"Content Row"),".")),react:
|
245
|
+
`},dropdown:{description:({NavigateTo:e})=>c.createElement(c.Fragment,null,c.createElement("h5",null,"Dropdown Icon Buttons"),c.createElement("p",null,"Use these when there are several options available for action. Example: Dropdown Icon Button in a ",c.createElement(e,{to:"content-rows"},"Content Row"),".")),react:k.code`
|
246
246
|
import { SpsDropdown } from "@spscommerce/ds-react";
|
247
247
|
|
248
248
|
function Component() {
|
@@ -256,7 +256,7 @@
|
|
256
256
|
</>
|
257
257
|
)
|
258
258
|
}
|
259
|
-
`},spinner:{description:"Spinner",react:
|
259
|
+
`},spinner:{description:"Spinner",react:k.code`
|
260
260
|
import { Button } from "@sps-woodland/buttons";
|
261
261
|
|
262
262
|
function Component() {
|
@@ -266,7 +266,7 @@
|
|
266
266
|
</>
|
267
267
|
)
|
268
268
|
}
|
269
|
-
`}}},textButtons:{label:"Text Buttons",description:({NavigateTo:e})=>c.createElement("p",null,"Use for less important actions, or ones that aren't taken as frequently. They should not appear inline with other copy. Example: Advanced Search button in the"," ",c.createElement(e,{to:"list-toolbar"},"List Toolbar")),examples:{withoutIcons:{description:"Without Icons",react:
|
269
|
+
`}}},textButtons:{label:"Text Buttons",description:({NavigateTo:e})=>c.createElement("p",null,"Use for less important actions, or ones that aren't taken as frequently. They should not appear inline with other copy. Example: Advanced Search button in the"," ",c.createElement(e,{to:"list-toolbar"},"List Toolbar")),examples:{withoutIcons:{description:"Without Icons",react:k.code`
|
270
270
|
import { Button } from "@sps-woodland/buttons";
|
271
271
|
import { sprinkles } from "@sps-woodland/tokens";
|
272
272
|
|
@@ -279,7 +279,7 @@
|
|
279
279
|
</>
|
280
280
|
)
|
281
281
|
}
|
282
|
-
`},withIcons:{description:"With Icons",react:
|
282
|
+
`},withIcons:{description:"With Icons",react:k.code`
|
283
283
|
import { Button } from "@sps-woodland/buttons";
|
284
284
|
import { sprinkles } from "@sps-woodland/tokens";
|
285
285
|
|
@@ -292,7 +292,7 @@
|
|
292
292
|
</>
|
293
293
|
)
|
294
294
|
}
|
295
|
-
`},spinner:{description:"Spinner",react:
|
295
|
+
`},spinner:{description:"Spinner",react:k.code`
|
296
296
|
import { Button } from "@sps-woodland/buttons";
|
297
297
|
|
298
298
|
function Component() {
|
@@ -302,7 +302,7 @@
|
|
302
302
|
</>
|
303
303
|
)
|
304
304
|
}
|
305
|
-
`}}},submitButtons:{label:"Submit Buttons",description:({NavigateTo:e})=>c.createElement("p",null,"Use to submit a form. There can be a number of visual variations, for example a"," ",c.createElement(e,{to:"modals"},"Modal")," uses Basic Button (Key) as its Submit Button."),examples:{basic:{react:
|
305
|
+
`}}},submitButtons:{label:"Submit Buttons",description:({NavigateTo:e})=>c.createElement("p",null,"Use to submit a form. There can be a number of visual variations, for example a"," ",c.createElement(e,{to:"modals"},"Modal")," uses Basic Button (Key) as its Submit Button."),examples:{basic:{react:k.code`
|
306
306
|
import { Button } from "@sps-woodland/buttons";
|
307
307
|
import { sprinkles } from "@sps-woodland/tokens";
|
308
308
|
|
@@ -321,7 +321,7 @@
|
|
321
321
|
</SpsForm>
|
322
322
|
)
|
323
323
|
}
|
324
|
-
`}}},link:{label:"Button as a Link",description:"Used to link to another page, such as an external website. They may open in the same window or in a new one. It should only be used when a Text Button doesn't provide enough visual emphasis.",examples:{basic:{react:
|
324
|
+
`}}},link:{label:"Button as a Link",description:"Used to link to another page, such as an external website. They may open in the same window or in a new one. It should only be used when a Text Button doesn't provide enough visual emphasis.",examples:{basic:{react:k.code`
|
325
325
|
import { Button } from "@sps-woodland/buttons";
|
326
326
|
|
327
327
|
function Component() {
|
@@ -333,7 +333,7 @@
|
|
333
333
|
</>
|
334
334
|
)
|
335
335
|
}
|
336
|
-
`}}},buttonGroups:{label:"Button Groups",description:({NavigateTo:e})=>c.createElement("p",null,"Use button groups when there are a number of actions that can be taken in a view. When there are multiple button types in a group, they are separated using dividers. Example: Button groups in ",c.createElement(e,{to:"List Action Bar"},"List Action Bar"),"."),examples:{basic:{description:"Basic Button Groups",react:
|
336
|
+
`}}},buttonGroups:{label:"Button Groups",description:({NavigateTo:e})=>c.createElement("p",null,"Use button groups when there are a number of actions that can be taken in a view. When there are multiple button types in a group, they are separated using dividers. Example: Button groups in ",c.createElement(e,{to:"List Action Bar"},"List Action Bar"),"."),examples:{basic:{description:"Basic Button Groups",react:k.code`
|
337
337
|
import { Button } from "@sps-woodland/buttons";
|
338
338
|
import { sprinkles } from "@sps-woodland/tokens";
|
339
339
|
|
@@ -345,7 +345,7 @@
|
|
345
345
|
</>
|
346
346
|
)
|
347
347
|
}
|
348
|
-
`},icon:{description:"Icon Button Groups",react:
|
348
|
+
`},icon:{description:"Icon Button Groups",react:k.code`
|
349
349
|
import { Button } from "@sps-woodland/buttons";
|
350
350
|
|
351
351
|
function Component() {
|
@@ -356,7 +356,7 @@
|
|
356
356
|
</>
|
357
357
|
)
|
358
358
|
}
|
359
|
-
`},textAndIcons:{description:"Text Buttons + Icon Buttons Group",react:
|
359
|
+
`},textAndIcons:{description:"Text Buttons + Icon Buttons Group",react:k.code`
|
360
360
|
import { Button } from "@sps-woodland/buttons";
|
361
361
|
import { sprinkles } from "@sps-woodland/tokens";
|
362
362
|
import { VericalRule } from "@sps-woodland/core";
|
@@ -371,7 +371,7 @@
|
|
371
371
|
</>
|
372
372
|
)
|
373
373
|
}
|
374
|
-
`},textAndBasic:{description:"Text Buttons + Basic Buttons Group",react:
|
374
|
+
`},textAndBasic:{description:"Text Buttons + Basic Buttons Group",react:k.code`
|
375
375
|
import { Button } from "@sps-woodland/buttons";
|
376
376
|
import { sprinkles } from "@sps-woodland/tokens";
|
377
377
|
import { VericalRule } from "@sps-woodland/core";
|
@@ -387,7 +387,7 @@
|
|
387
387
|
</>
|
388
388
|
)
|
389
389
|
}
|
390
|
-
`},iconsAndBasic:{description:"Icon Buttons + Basic Buttons Group",react:
|
390
|
+
`},iconsAndBasic:{description:"Icon Buttons + Basic Buttons Group",react:k.code`
|
391
391
|
import { Button } from "@sps-woodland/buttons";
|
392
392
|
import { sprinkles } from "@sps-woodland/tokens";
|
393
393
|
import { VericalRule } from "@sps-woodland/core";
|
@@ -404,7 +404,7 @@
|
|
404
404
|
</>
|
405
405
|
)
|
406
406
|
}
|
407
|
-
`},textIconsAndBasic:{description:"Text Buttons + Icon Buttons + Basic Buttons Group",react:
|
407
|
+
`},textIconsAndBasic:{description:"Text Buttons + Icon Buttons + Basic Buttons Group",react:k.code`
|
408
408
|
import { Button } from "@sps-woodland/buttons";
|
409
409
|
import { sprinkles } from "@sps-woodland/tokens";
|
410
410
|
import { VericalRule } from "@sps-woodland/core";
|
@@ -423,4 +423,4 @@
|
|
423
423
|
</>
|
424
424
|
)
|
425
425
|
}
|
426
|
-
`}}}}}};N.Button=pe,N.MANIFEST=
|
426
|
+
`}}}}}};N.Button=pe,N.MANIFEST=wt,Object.defineProperty(N,Symbol.toStringTag,{value:"Module"})});
|
package/lib/style.css
CHANGED
@@ -1 +1 @@
|
|
1
|
-
.pkg_sps-
|
1
|
+
.pkg_sps-woodland_buttons__version_8_23_2__hash_125pcxy0{border-width:.0625rem;border-style:solid;border-radius:.25rem;cursor:pointer;display:inline-block;font-size:.75rem;font-weight:600;line-height:.875rem;padding:0;position:relative}.pkg_sps-woodland_buttons__version_8_23_2__hash_125pcxy3{background:#e9e9ea;border-color:#d2d4d4;color:#4b5356}.pkg_sps-woodland_buttons__version_8_23_2__hash_125pcxy3:hover{background:#d2d4d4}.pkg_sps-woodland_buttons__version_8_23_2__hash_125pcxy4{background:none transparent;border:0;color:#027db8}.pkg_sps-woodland_buttons__version_8_23_2__hash_125pcxy4:hover{background:none transparent;color:#08638d;text-decoration:none}.pkg_sps-woodland_buttons__version_8_23_2__hash_125pcxy5{background:#027db8;border-color:#08638d;color:#fff}.pkg_sps-woodland_buttons__version_8_23_2__hash_125pcxy5:hover{background:#08638d}.pkg_sps-woodland_buttons__version_8_23_2__hash_125pcxy6{background:#de012e;border-color:#a30d2d;color:#fff}.pkg_sps-woodland_buttons__version_8_23_2__hash_125pcxy6:hover{background:#a30d2d}.pkg_sps-woodland_buttons__version_8_23_2__hash_125pcxy7{background:#4b5356;border-color:#1f282c;color:#fff}.pkg_sps-woodland_buttons__version_8_23_2__hash_125pcxy7:hover{background:#1f282c}.pkg_sps-woodland_buttons__version_8_23_2__hash_125pcxy8{background:transparent;border-color:transparent;color:#4b5356}.pkg_sps-woodland_buttons__version_8_23_2__hash_125pcxy8:hover{background-color:#d2d4d4;border-color:#d2d4d4}.pkg_sps-woodland_buttons__version_8_23_2__hash_125pcxy9{color:transparent!important;cursor:not-allowed}.pkg_sps-woodland_buttons__version_8_23_2__hash_125pcxyb{background:#e9e9ea;border-color:#d2d4d4}.pkg_sps-woodland_buttons__version_8_23_2__hash_125pcxyb:hover,.pkg_sps-woodland_buttons__version_8_23_2__hash_125pcxyc:hover{background:#e9e9ea}.pkg_sps-woodland_buttons__version_8_23_2__hash_125pcxyd:hover{background:#027db8}.pkg_sps-woodland_buttons__version_8_23_2__hash_125pcxye:hover{background:#de012e}.pkg_sps-woodland_buttons__version_8_23_2__hash_125pcxyf:hover{background:#4b5356}.pkg_sps-woodland_buttons__version_8_23_2__hash_125pcxyg{background:#fff!important;border-color:#d2d4d4!important;color:#717779!important;cursor:not-allowed}.pkg_sps-woodland_buttons__version_8_23_2__hash_125pcxyg:hover{background:#fff}.pkg_sps-woodland_buttons__version_8_23_2__hash_125pcxyh{background:none transparent;border:0 none;color:inherit;display:block;font-size:inherit;font-weight:inherit;margin:0;text-decoration:none;padding:.5rem 1rem}.pkg_sps-woodland_buttons__version_8_23_2__hash_125pcxyh:hover{text-decoration:none}.pkg_sps-woodland_buttons__version_8_23_2__hash_125pcxyi{cursor:not-allowed!important}.pkg_sps-woodland_buttons__version_8_23_2__hash_125pcxyk{padding:.25rem .5rem}.pkg_sps-woodland_buttons__version_8_23_2__hash_125pcxyp{padding-top:.5rem;padding-bottom:.5rem;padding-right:0;padding-left:0}.pkg_sps-woodland_buttons__version_8_23_2__hash_125pcxyq{cursor:not-allowed!important}.pkg_sps-woodland_buttons__version_8_23_2__hash_125pcxys{background:none transparent;border:0 none;color:inherit;cursor:inherit;display:block;font-size:inherit;font-weight:inherit;margin:0;padding:.5rem 1rem;text-decoration:none}.pkg_sps-woodland_buttons__version_8_23_2__hash_125pcxys:hover{text-decoration:none;color:inherit}.pkg_sps-woodland_buttons__version_8_23_2__hash_125pcxyt{cursor:not-allowed}.pkg_sps-woodland_buttons__version_8_23_2__hash_125pcxyv{padding:.25rem .5rem}.pkg_sps-woodland_buttons__version_8_23_2__hash_125pcxy11{line-height:0!important;position:relative}.pkg_sps-woodland_buttons__version_8_23_2__hash_125pcxy11:before{font-size:.875rem;line-height:0;position:relative;top:.125rem}.pkg_sps-woodland_buttons__version_8_23_2__hash_125pcxy11:not(:last-child){margin-right:.5rem}.pkg_sps-woodland_buttons__version_8_23_2__hash_125pcxy12{left:50%;margin:-.875rem -.4375rem;position:absolute}.pkg_sps-woodland_buttons__version_8_23_2__hash_125pcxy13{cursor:not-allowed;display:inline}.pkg_sps-woodland_buttons__version_8_23_2__hash_125pcxy14{display:none}.pkg_sps-woodland_buttons__version_8_23_2__hash_125pcxy12>i{border-width:.125rem;height:.875rem;width:.875rem}
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "@sps-woodland/buttons",
|
3
3
|
"description": "SPS Woodland Design System button components",
|
4
|
-
"version": "8.23.
|
4
|
+
"version": "8.23.2",
|
5
5
|
"author": "SPS Commerce",
|
6
6
|
"license": "UNLICENSED",
|
7
7
|
"repository": "https://github.com/SPSCommerce/woodland/tree/main/packages/@sps-woodland/buttons",
|
@@ -30,8 +30,8 @@
|
|
30
30
|
"@spscommerce/utils": "^7.0.0",
|
31
31
|
"react": "^16.9.0",
|
32
32
|
"react-dom": "^16.9.0",
|
33
|
-
"@sps-woodland/core": "8.23.
|
34
|
-
"@sps-woodland/tokens": "8.23.
|
33
|
+
"@sps-woodland/core": "8.23.2",
|
34
|
+
"@sps-woodland/tokens": "8.23.2"
|
35
35
|
},
|
36
36
|
"devDependencies": {
|
37
37
|
"@react-aria/button": "^3.3.5",
|
@@ -42,8 +42,8 @@
|
|
42
42
|
"@vanilla-extract/recipes": "^0.2.5",
|
43
43
|
"react": "^16.9.0",
|
44
44
|
"react-dom": "^16.9.0",
|
45
|
-
"@sps-woodland/core": "8.23.
|
46
|
-
"@sps-woodland/tokens": "8.23.
|
45
|
+
"@sps-woodland/core": "8.23.2",
|
46
|
+
"@sps-woodland/tokens": "8.23.2"
|
47
47
|
},
|
48
48
|
"dependencies": {
|
49
49
|
"@react-aria/button": "^3.7.0",
|