@spscommerce/ds-react 8.45.5 → 8.45.6
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/index.js +26 -12
- package/lib/index.umd.cjs +3 -3
- package/package.json +14 -14
package/lib/index.js
CHANGED
|
@@ -1145,7 +1145,7 @@ function cr(e, t = []) {
|
|
|
1145
1145
|
if (i)
|
|
1146
1146
|
s.contains(i) || s.appendChild(i);
|
|
1147
1147
|
else {
|
|
1148
|
-
i = document.createElement("div"), i.setAttribute("data-portalid", e);
|
|
1148
|
+
i = document.createElement("div"), i.setAttribute("data-portalid", e), i.setAttribute("data-react-aria-top-layer", "true");
|
|
1149
1149
|
for (const d of t)
|
|
1150
1150
|
i.classList.add(d);
|
|
1151
1151
|
s.appendChild(i);
|
|
@@ -19910,7 +19910,8 @@ function zd({
|
|
|
19910
19910
|
className: m,
|
|
19911
19911
|
onKeyDown: y,
|
|
19912
19912
|
tabIndex: -1,
|
|
19913
|
-
ref: f
|
|
19913
|
+
ref: f,
|
|
19914
|
+
"data-react-aria-top-layer": "true"
|
|
19914
19915
|
},
|
|
19915
19916
|
/* @__PURE__ */ o.createElement(
|
|
19916
19917
|
"div",
|
|
@@ -20005,7 +20006,8 @@ function jd({
|
|
|
20005
20006
|
"aria-labelledby": `${u.current}-title`,
|
|
20006
20007
|
className: m,
|
|
20007
20008
|
tabIndex: -1,
|
|
20008
|
-
ref: f
|
|
20009
|
+
ref: f,
|
|
20010
|
+
"data-react-aria-top-layer": "true"
|
|
20009
20011
|
},
|
|
20010
20012
|
/* @__PURE__ */ o.createElement("div", { ...c, className: `sps-slide-in-panel__dialog ${r ? "open" : ""}` }, /* @__PURE__ */ o.createElement("div", { className: "sps-slide-in-panel__titlebar" }, /* @__PURE__ */ o.createElement("div", { className: "sps-slide-in-panel__title", id: `${u.current}-title` }, l || p("slideInPanel.defaultTitle", { defaultValue: "Slide In Panel" })), s && /* @__PURE__ */ o.createElement("div", { className: "sps-button sps-button--icon", onClick: s }, /* @__PURE__ */ o.createElement("button", { "aria-label": p("slideInPanel.close", { defaultValue: "Close" }), type: "button" }, /* @__PURE__ */ o.createElement("i", { className: "sps-icon sps-icon-x" })))), /* @__PURE__ */ o.createElement("div", { className: "sps-slide-in-panel__body" }, /* @__PURE__ */ o.createElement(
|
|
20011
20013
|
xt.Provider,
|
|
@@ -31200,16 +31202,28 @@ function eu(e) {
|
|
|
31200
31202
|
] = It(t, [
|
|
31201
31203
|
{ type: Qp }
|
|
31202
31204
|
]);
|
|
31203
|
-
return /* @__PURE__ */ o.createElement(
|
|
31204
|
-
|
|
31205
|
+
return /* @__PURE__ */ o.createElement(
|
|
31206
|
+
"div",
|
|
31205
31207
|
{
|
|
31206
|
-
className:
|
|
31207
|
-
|
|
31208
|
-
|
|
31209
|
-
|
|
31210
|
-
|
|
31211
|
-
}
|
|
31212
|
-
|
|
31208
|
+
className: p,
|
|
31209
|
+
ref: u,
|
|
31210
|
+
"data-testid": l,
|
|
31211
|
+
"data-react-aria-top-layer": "true",
|
|
31212
|
+
...c
|
|
31213
|
+
},
|
|
31214
|
+
/* @__PURE__ */ o.createElement("div", { className: "sps-focused-task__title" }, /* @__PURE__ */ o.createElement(
|
|
31215
|
+
ke,
|
|
31216
|
+
{
|
|
31217
|
+
className: "sps-focused-task__close-btn",
|
|
31218
|
+
kind: Me.ICON,
|
|
31219
|
+
icon: Be.X,
|
|
31220
|
+
onClick: s,
|
|
31221
|
+
title: m("focusedTask.close", { defaultValue: "Close" })
|
|
31222
|
+
}
|
|
31223
|
+
)),
|
|
31224
|
+
/* @__PURE__ */ o.createElement("div", { className: "sps-focused-task__body" }, /* @__PURE__ */ o.createElement(xt.Provider, { value: { parentElementRef: u } }, a && g)),
|
|
31225
|
+
f
|
|
31226
|
+
);
|
|
31213
31227
|
}
|
|
31214
31228
|
Object.assign(eu, {
|
|
31215
31229
|
props: fC,
|
package/lib/index.umd.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(x,E){typeof exports=="object"&&typeof module<"u"?E(exports,require("react"),require("@spscommerce/utils"),require("moment-timezone"),require("@spscommerce/ds-shared"),require("@spscommerce/i18n"),require("react-dom"),require("@spscommerce/ds-colors"),require("@sps-woodland/tabs"),require("@sps-woodland/illustrations")):typeof define=="function"&&define.amd?define(["exports","react","@spscommerce/utils","moment-timezone","@spscommerce/ds-shared","@spscommerce/i18n","react-dom","@spscommerce/ds-colors","@sps-woodland/tabs","@sps-woodland/illustrations"],E):(x=typeof globalThis<"u"?globalThis:x||self,E(x.DSReact={},x.React,x.utils,x.moment$3,x.dsShared,x.i18n,x.ReactDOM,x.dsColors,x.tabs,x.illustrations))})(this,(function(x,E,S,Me,F,he,Ln,Nr,Im,gi){"use strict";function hi(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const o=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,o.get?o:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const r=hi(E),un=hi(Me);function bi(e){var t,n,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]&&(n=bi(e[t]))&&(o&&(o+=" "),o+=n)}else for(n in e)e[n]&&(o&&(o+=" "),o+=n);return o}function $(){for(var e,t,n=0,o="",a=arguments.length;n<a;n++)(e=arguments[n])&&(t=bi(e))&&(o&&(o+=" "),o+=t);return o}const xm="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";let He=(e=21)=>{let t="",n=crypto.getRandomValues(new Uint8Array(e|=0));for(;e--;)t+=xm[n[e]&63];return t};function Rt(e){return E.useRef(e||He())}function We(e,t){const n=Rt(e),o=E.useRef(`${n.current}_ctrl`);return E.useEffect(()=>{t&&(t.id=o.current,t.update())},[t]),{wrapperId:n.current||void 0,controlId:o.current}}function Ir(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var xr,vi;function km(){if(vi)return xr;vi=1;var e="[object Object]";function t(p){var f=!1;if(p!=null&&typeof p.toString!="function")try{f=!!(p+"")}catch{}return f}function n(p,f){return function(g){return p(f(g))}}var o=Function.prototype,a=Object.prototype,s=o.toString,i=a.hasOwnProperty,l=s.call(Object),d=a.toString,c=n(Object.getPrototypeOf,Object);function u(p){return!!p&&typeof p=="object"}function m(p){if(!u(p)||d.call(p)!=e||t(p))return!1;var f=c(p);if(f===null)return!0;var g=i.call(f,"constructor")&&f.constructor;return typeof g=="function"&&g instanceof g&&s.call(g)==l}return xr=m,xr}var Mm=km();const yi=Ir(Mm),Ze=new Set,mn=new Set,wt=new Set,So=new Set;function Ei(e){Ze.has(e)||wt.has(e)||So.has(e)||mn.add(e)}function Ti(e){Ze.has(e)||wt.has(e)||mn.has(e)||So.add(e)}const Fe=un.default||un,fn="MM/DD/YYYY",Lm="MM/DD/YYYY hh:mm A",_m="MM/DD/YYYY HH:mm",Om="hh:mm A",Pm="HH:mm",Bm=/^(\d{1,2})\/(\d{1,2})\/(\d{4})$/,_n=Symbol("Date Parse Error");function Sn(e){return Fe.isMoment(e)?e.year()*1e4+(e.month()+1)*100+e.date():e.year*1e4+e.month*100+e.date}const Y=Object.freeze({createFrom(e,t){if(!e)return null;if(typeof e=="string"){if(t){const n=Fe(e,t,!0);if(n.isValid())return Object.freeze({year:n.year(),month:n.month()+1,date:n.date()})}else{const n=Bm.exec(e);if(n){const[,o,a,s]=n;return Object.freeze({year:Number(s),month:Number(o),date:Number(a)})}}return Object.freeze({[_n]:!0,year:void 0,month:void 0,date:void 0})}return Object.freeze({year:e.year(),month:e.month()+1,date:e.date()})},createMomentFrom(e,t){if(!e)return null;let n=null;return typeof e=="string"?t?n=Fe(e,t,!0):n=Fe(e):Fe.isMoment(e)?n=e:n=Y.toMoment(e),n!==null&&Fe.isMoment(n)&&n.isValid()?n:Object.freeze({[_n]:!0,year:void 0,month:void 0,date:void 0})},getRangeSeparator(e){return e?.includes("-")?"/":"-"},createRangeFrom(e,t){if(!e)return null;if(t){const n=Y.getRangeSeparator(t),o=new RegExp(`[^\\d]*${n}[^\\d]*`);return e.split(o).slice(0,2).map(a=>Y.createFrom(a,t))}else return e.split(/[^\d]*-[^\d]*/).slice(0,2).map(n=>Y.createFrom(n))},isValid(e){return e?Fe.isMoment(e)?e.isValid():typeof e=="object"&&typeof e.year=="number"&&typeof e.month=="number"&&typeof e.date=="number"&&Y.toMoment(e)?.isValid():!1},nullifyInvalidDate(e){return Y.isValid(e)?e:null},toMoment(e){return e?Fe.isMoment(e)?e:Fe({...e,month:e.month-1}):null},toString(e,t){const n=Y.toMoment(e);return n&&n.isValid()?n.format(t||fn):""},toStringRange(e,t){if(!e)return"";const n=Y.getRangeSeparator(t);return e.slice(0,2).map(o=>Y.toString(o,t)).join(n)},toDateTimeString(e,t=!1,n){return e&&Fe.isMoment(e)&&e.isValid()?n?t?e.format(`${n} ${Pm}`):e.format(`${n} ${Om}`):t?e.format(_m):e.format(Lm):""},toDateTimeStringRange(e,t=!1,n){if(!e)return"";const o=Y.getRangeSeparator(n);return e.map(a=>Y.toDateTimeString(a,t,n)).join(o)},create(){const e=new Date;return Object.freeze({year:e.getFullYear(),month:e.getMonth()+1,date:e.getDate()})},isSameDate(e,t){return e&&t&&e.year===t.year&&e.month===t.month&&e.date===t.date},isSameMonth(e,t){return e&&t&&e.year===t.year&&e.month===t.month},isAfter(e,t){return!e||!t?null:Sn(e)>Sn(t)},isBefore(e,t){return!e||!t?null:Sn(e)<Sn(t)},isInRange(e,t,n=!0){if(!e||!t||!t[0]||!t[1])return null;const o=Sn(e),[a,s]=t.map(Sn);return a&&s&&(n&&o>=a&&o<=s||!n&&o>a&&o<s)},prevMonth(e){return Object.freeze({year:e.month===1?e.year-1:e.year,month:e.month-1||12,date:e.date})},nextMonth(e){return Object.freeze({year:e.month===12?e.year+1:e.year,month:e.month+1>12?1:e.month+1,date:e.date})},createRangeFromPreset(e,t){if(typeof e.definition=="function")return e.definition();const n=Fe(),o=n.clone().subtract(Fe.duration(e.definition));return[Y.createFrom(o,t),Y.createFrom(n,t)]},createDateTimeRangeFromPreset(e){if(typeof e.definition=="function")return e.definition();const t=Fe().subtract(Fe.duration(e.definition)).startOf("day"),n=Fe().endOf("day");return[t,n]},splitMomentInDateTimeParts(e,t=!1,n,o=!1){let a="";t?a=o?"23:59":"00:00":a=o?"11:59":"12:00";const s=o?"PM":"AM";return e&&Fe.isMoment(e)&&e.isValid()?Y.toDateTimeString(e,t,n).split(" "):["",a,t?void 0:s]},getCurrentMoment(){return Fe()},validateTimeString(e,t=!1){if(!e)return!0;const n=e.split(":"),o=n[0]||"0",a=n[1]||"0",s=Number.isNaN(Number(o))?NaN:parseInt(o,10),i=Number.isNaN(Number(a))?NaN:parseInt(a,10),l=n.length<=2&&o.length<=2&&a.length<=2;return t?l&&s>=0&&s<=23&&i>=0&&i<=59:l&&(!Number.isNaN(s)&&o.length===1||s>=1)&&s<=12&&i>=0&&i<=59},padIncompleteTimeString(e,t=!1){if(!e)return"";const n=e.split(":"),o=parseInt(n[0]||"0",10),a=parseInt(n[1]||"0",10);if(t){const s=o<10?`0${o}`:`${o}`,i=a<10?`0${a}`:`${a}`;return`${s}:${i}`}else{const s=o===0?"12":o<10?`0${o}`:`${o}`,i=a<10?`0${a}`:`${a}`;return`${s}:${i}`}}}),kr=["01:00","02:00","03:00","04:00","05:00","06:00","07:00","08:00","09:00","10:00","11:00","12:00"],Mr=["00:00","01:00","02:00","03:00","04:00","05:00","06:00","07:00","08:00","09:00","10:00","11:00","12:00","13:00","14:00","15:00","16:00","17:00","18:00","19:00","20:00","21:00","22:00","23:00"];let go=fn;function wi(e){go=e}const On=function(t){if(Array.isArray(t)){const n=On(t[0]),o=On(t[1]);return n||o}if(t&&t.hasOwnProperty("year")){if(t[_n])return{dateFormat:go};if(!Y.isValid(t))return{dateValidity:!0}}return null};Ze.add("dateFormat"),Ze.add("dateValidity");const Ci=function(t){if(Array.isArray(t)){const n=On(t);if(n)return n;if(t&&Y.isBefore(t[1],t[0]))return{dateRangeOrder:!0}}return null};Ze.add("dateRangeOrder");const Di=function({minDate:t,maxDate:n}){function o(a){const s=Y.isBefore(a,t),i=Y.isAfter(a,n),l={minExceeded:s?Y.toString(t,go):null,maxExceeded:i?Y.toString(n,go):null};return s||i?{dateConstraint:l}:null}return function(s){if(!s)return null;if(Array.isArray(s)){const i=o(s[0]),l=o(s[1]);return i||l}return s.hasOwnProperty("year")?o(s):null}};Ze.add("dateConstraint");const Rm=Object.freeze(Object.defineProperty({__proto__:null,date:On,dateConstraint:Di,dateRange:Ci,setDateFormat:wi},Symbol.toStringTag,{value:"Module"}));function Mt(e,t){for(const n of[].concat(e)){const o=t(n);if(o)return o}return null}const Fm=function(t){function n(o){return Number(o)>=t?null:{min:t}}return o=>Mt(o,n)};Ze.add("min");const Am=function(t){function n(o){return Number(o)<=t?null:{max:t}}return o=>Mt(o,n)};mn.add("max");const $m=function(t){return typeof t>"u"||t===null||t===""||Number.isNaN(t)||t?.length===0?{required:!0}:null};mn.add("required");const Vm=function(t){function n(o){return o===void 0||o.toString().length<t?{minLength:t}:null}return o=>Mt(o,n)};Ze.add("minLength");const Km=function(t){function n(o){return o==null||Array.isArray(o)&&o.length<t?{minLengthArray:t}:null}return o=>n(o)};Ze.add("minLengthArray");const Hm=function(t){function n(o){return o===void 0||o.toString().length<=t?null:{maxLength:t}}return o=>Mt(o,n)};wt.add("maxLength");const Wm=function(t){function n(o){return o==null||Array.isArray(o)&&o.length<=t?null:{maxLengthArray:t}}return o=>n(o)};Ze.add("maxLengthArray");const Gm=function(t){const n=t instanceof RegExp?t:new RegExp(t);function o(a){return n.test(a)?null:{pattern:t}}return a=>Mt(a,o)};Ze.add("pattern");const Um=function(e){function t(n){return new RegExp("^\\p{L}*$","u").test(n)?null:{alpha:!0}}return Mt(e,t)};wt.add("alpha");const zm=function(e){function t(n){return/^[0-9,. ]*$/.test(n)?null:{numeric:!0}}return Mt(e,t)};wt.add("numeric");const jm=function(e){function t(n){return/^-?[0-9,. ]*$/.test(n)?null:{positiveOrNegativeNumber:!0}}return Mt(e,t)};wt.add("positiveOrNegativeNumber");const Ym=function(e){function t(n){return/^[^0-9]*$/.test(n)?null:{nonNumeric:!0}}return Mt(e,t)};wt.add("nonNumeric");const ho=Object.freeze({...Rm,min:Fm,max:Am,required:$m,minLength:Vm,minLengthArray:Km,maxLength:Hm,maxLengthArray:Wm,pattern:Gm,alpha:Um,numeric:zm,nonNumeric:Ym,positiveOrNegativeNumber:jm,OnBlurErrorKeys:Ze});function bo(e,t=[]){const n=t.reduce((o,a)=>Object.assign(o,a(e)||{}),{});return Object.keys(n).length?n:null}var Ct=(e=>(e[e.ON_CHANGE=0]="ON_CHANGE",e[e.ON_BLUR=1]="ON_BLUR",e[e.ON_SUBMIT=2]="ON_SUBMIT",e))(Ct||{});function qm(e,t={},n=[]){for(const[o,a]of Object.entries(t))a===0?Ei(o):a===2&&Ti(o);return r.useCallback(e,n)}class Yt{constructor(t,n){this.path=t,this.update=n,this.validators=[],this.#e=null,this.#t=null,this.#n=null,this.preventativeErrors=[],this.submitted=!1}#e;#t;#n;get errors(){return this.#e===null&&this.#t===null&&this.#n===null?null:{...this.#e??{},...this.#t??{},...this.#n??{}}}setValidators(t){return this.update(this.path,null,void 0,t),this}validate(t,n,o=!1){if(this.validators&&this.validators.length>0){const a=bo(t,this.validators);let s={onSubmit:{},onChange:{},onBlur:{}};a&&(s=Object.keys(a).reduce((i,l)=>(So.has(l)?i.onSubmit[l]=a[l]:mn.has(l)?i.onChange[l]=a[l]:i.onBlur[l]=a[l],i),s)),(typeof n>"u"||n===Ct.ON_CHANGE)&&(this.#t=Object.keys(s.onChange).length===0?null:s.onChange),(typeof n>"u"||n===Ct.ON_BLUR)&&(this.#n=Object.keys(s.onBlur).length===0?null:s.onBlur),(typeof n>"u"||n===Ct.ON_SUBMIT)&&(this.#e=Object.keys(s.onSubmit).length===0?null:s.onSubmit,this.#t=Object.keys(s.onChange).length===0?null:s.onChange,this.#n=Object.keys(s.onBlur).length===0?null:s.onBlur),o||this.update(),this.isFocused()&&this.onFocus&&this.onFocus()}else this.errors&&(this.#e=null,this.#n=null,this.#t=null,o||this.update());return this}isValid(){return!this.errors||this.isPristine()}hasErrors(){return!!this.errors}isVisibilyInvalid(){return!this.isValid()}hasError(t){return this.errors&&Object.prototype.hasOwnProperty.call(this.errors,t)}hasPreventativeError(t){return this.preventativeErrors.includes(t)}hasPreventativeErrors(){return this.preventativeErrors.length>0}isRequired(){return this.validators&&this.validators.indexOf(ho.required)>-1}isSubmitted(){return this.submitted}onFocus(){}onBlur(){}}class Pn extends Yt{constructor(){super(...arguments),this.id=He(),this.focused=!1,this.pristine=!0}setValue(t){if(this.preventativeErrors=[],this.validators&&this.validators.length>0){const n=bo(t,this.validators);if(n&&Object.keys(n).filter(a=>wt.has(a)).length>0){this.preventativeErrors=Object.keys(n);return}}this.update(this.path,t)}isPristine(){return this.pristine}markAsPristine(){return this.pristine=!0,this.update(),this}markAsDirty(){return this.pristine=!1,this.update(),this}isFocused(){return this.focused}markAsFocused(){return this.focused=!0,this.update(),this.onFocus&&this.onFocus(),this}markAsBlurred(){return this.update(this.path,null,!0),this.onBlur&&this.onBlur(),this.preventativeErrors=[],this}markAsSubmitted(){return this.submitted=!0,this.update(this.path,null,!1,void 0,!0),this}}class qt extends Pn{constructor(t,n,o){const a=o?n:t,s=o||n;super(a,s),o&&this.inferMembers(t)}isFocused(){return super.isFocused()||this.rollup("isFocused")}isValid(){return super.isValid()&&this.rollup("isValid")}hasErrors(){return super.hasErrors()||Object.keys(this.fields).some(t=>this.fields[t].hasErrors())}contentsAreValid(){return this.rollup("isValid")&&this.rollup("contentsAreValid")}isPristine(){return super.isPristine()&&this.rollup("isPristine")}markAsPristine(){super.markAsPristine();for(const t of Object.keys(this.fields))this.fields[t].markAsPristine();return this}markAsDirty(){super.markAsDirty();for(const t of Object.keys(this.fields))this.fields[t].markAsDirty();return this}markAsBlurred(){super.markAsBlurred();for(const t of Object.keys(this.fields))this.fields[t].markAsBlurred();return this}markAsSubmitted(){super.markAsSubmitted();for(const t of Object.keys(this.fields))this.fields[t].markAsSubmitted();return this}inferSpsControl(t,n){return vo(t,[...this.path,n],this.update)}rollup(t){return Object.keys(this.fields).reduce((n,o)=>n&&(!this.fields[o][t]||this.fields[o][t]()),!0)}}class Ni extends qt{inferMembers(t){this.fields={};for(const n of Object.keys(t))this.fields[n]=this.inferSpsControl(t[n],n)}}class Ii extends qt{inferMembers(t){this.fields=t.map((n,o)=>this.inferSpsControl(n,String(o)))}}function vo(e,t,n){return e instanceof Yt?(e.path=t,e.update=n,e):Array.isArray(e)?new Ii(e,t,n):yi(e)?new Ni(e,t,n):new Pn(t,n)}function Bn(e,t){return t.length===0||!e?e:Bn(e.fields[t[0]],t.slice(1,t.length))}function Lr(e,t){if(t.length===0||!e)return[e];const n=t[0];if(t=t.slice(1,t.length),n==="*"){const o=Array.isArray(e.fields)?e.fields:Object.keys(e.fields).map(a=>e.fields[a]);return t.length===0?o:o.reduce((a,s)=>[...a,...Lr(s,t)],[])}return Lr(e.fields[n],t)}function _r(e,t,n){for(const o of Object.keys(t)){const a=t[o];for(const s of Lr(e,o.split(".")))s&&a&&n(s,a)}}function yo(e,t,n,o=!1,a=!1){_r(t,n,(s,i)=>{s.validators=typeof i=="function"?i(e):i,o&&s.validate(S.getPath(e,s.path),void 0,a)})}function Or(e,t){const n=t[0];return t=t.slice(1),Array.isArray(e)?e.map((o,a)=>a===Number(n)?Or(o,t):o):yi(e)?Object.keys(e).reduce((o,a)=>Object.assign(o,{[a]:a===n?Or(e[a],t):e[a]}),{}):e}function Jm(e){if(typeof e!="object"||e===null||Array.isArray(e))throw new TypeError("The initial value of useSpsForm() hook must be an object.")}function xi(e,t={}){Jm(e);const[,n]=E.useState({}),o=E.useRef(!1);o.current=!1;const a=E.useRef(t),s=E.useCallback(p=>{const f=m.current;let g;if(p)if(p.path)if(p.markAsBlurred){const h=Bn(f.formMeta,p.path);if(h){h.focused=!1;const y=S.getPath(f.formValue,p.path);h.validate(y,Ct.ON_BLUR)}}else if(p.newValidators){if(a.current){const h=p.path.join(".");a.current={...a.current,[h]:p.newValidators},yo(f.formValue,f.formMeta,a.current,!0)}}else if(p.markAsSubmitted){const h=Bn(f.formMeta,p.path);if(h){h.submitted=!0;const y=S.getPath(f.formValue,p.path);h.validate(y,Ct.ON_SUBMIT)}}else g=Or(f.formValue,p.path),S.setPath(g,p.path,p.value);else g=p.value;if(p?.updateFormOptions?.validators&&(a.current={...a.current,...p.updateFormOptions.validators},yo(f.formValue,f.formMeta,a.current,p.updateFormOptions?.runValidators??!0)),g){f.formMeta.submitted=!1,S.deepFreeze(g);const h=S.diff(f.formValue,g);for(const{type:v,key:b,parentPath:N,objects:[,w]}of h){const T=Bn(f.formMeta,N);if(typeof b!="symbol"&&T){let L;switch(v){case S.DiffChange.ADDITION:T.fields[b]=vo(w[b],[...N,b],l);break;case S.DiffChange.DELETION:Array.isArray(T.fields)?T.fields[b]=void 0:delete T.fields[b];break;case S.DiffChange.ALTERATION:L=vo(w[b],[...N,b],l),(L instanceof qt&&!(T.fields[b]instanceof qt)||!(L instanceof qt)&&T.fields[b]instanceof qt)&&(L.pristine=!1,T.fields[b]=L);break}}}const y=new Set;if(h.filter(v=>v.type===S.DiffChange.DELETION).reduce((v,b)=>(v.has(b.parentPath)||v.add(b.parentPath),v),y),Array.from(y).forEach(v=>{const b=Bn(f.formMeta,v);Array.isArray(b.fields)&&(b.fields=b.fields.filter(N=>N!==void 0))}),a.current){yo(g,f.formMeta,a.current);const v=new Set;t&&_r(f.formMeta,t,(b,N)=>{typeof N=="function"&&(b.validate(S.getPath(g,b.path)),v.add(b))});for(const{type:b,key:N,parentPath:w,objects:[,T]}of h)if(typeof N!="symbol"){let L=f.formMeta,R=g;if(L){for(const _ of w)L=L.fields[_],R=R[_],v.has(L)||L.validate(R,Ct.ON_CHANGE);if(b===S.DiffChange.ADDITION||b===S.DiffChange.ALTERATION){const _=L.fields[N];if(!v.has(_)&&(L.fields[N].validate(T[N],Ct.ON_CHANGE),b===S.DiffChange.ADDITION&&_.fields))for(const[P,A]of Object.entries(_.fields))A.validate(T[N][P],Ct.ON_CHANGE)}}}}}m.current={...f,formValue:g||f.formValue},o.current||n({})},[]),i=E.useCallback((p,f)=>{p||f?s({value:p,updateFormOptions:f}):s()},[s]),l=E.useCallback((p,f,g=!1,h,y=!1)=>{p?s({path:p,value:f,markAsBlurred:g,newValidators:h,markAsSubmitted:y}):i()},[s,i]),d=E.useMemo(()=>{S.deepFreeze(e);const p=vo(e,[],l);return t&&yo(e,p,t,!1,!0),p},[]),c=E.useCallback(()=>(m.current.formMeta.markAsDirty(),a.current&&_r(m.current.formMeta,a.current,(p,f)=>{(typeof f=="function"||Array.isArray(f))&&p.validate(S.getPath(m.current.formValue,p.path))}),m.current.formMeta.isValid()),[]),u=E.useCallback(()=>m.current.formValue,[]),m=E.useRef({formValue:e,formMeta:d,updateForm:i,validateForm:c,getCurrentFormValue:u});return m.current}const Le=r.forwardRef((e,t)=>{const{className:n,children:o,focusInputOnClick:a,formControl:s,formMeta:i,inputRef:l,onClick:d,...c}=e,u=r.useRef(),p=l||(t||u);function f(){p&&p!==t&&p.current&&p.current.focus()}function g(){p&&p!==t&&p.current&&i&&i instanceof Pn&&i.markAsFocused()}function h(){p&&p!==t&&p.current&&i&&i instanceof Pn&&i.markAsBlurred()}const y=$("sps-form-group",(s&&s.isRequired()||i&&i.isRequired())&&"sps-form-group--required",(s&&!s.isValid()||i&&i.isVisibilyInvalid())&&"sps-form-group--error",i&&i.hasPreventativeErrors()&&"sps-form-group--preventative-error",n);function v(b){a&&f(),d&&d(b)}return r.useEffect(()=>{function b(N){N.target.classList.contains("sps-form-control__clear-btn")&&N.preventDefault()}return document.addEventListener("mousedown",b),()=>{document.removeEventListener("mousedown",b)}},[]),r.createElement("div",{...c,className:y,ref:t,tabIndex:-1,onClick:v,onFocus:g,onBlur:h},o)});Object.assign(Le,{displayName:"SpsFormComponentWrapper"});const ki=e=>typeof e=="object"&&e!=null&&e.nodeType===1,Mi=(e,t)=>(!t||e!=="hidden")&&e!=="visible"&&e!=="clip",Eo=(e,t)=>{if(e.clientHeight<e.scrollHeight||e.clientWidth<e.scrollWidth){const n=getComputedStyle(e,null);return Mi(n.overflowY,t)||Mi(n.overflowX,t)||(o=>{const a=(s=>{if(!s.ownerDocument||!s.ownerDocument.defaultView)return null;try{return s.ownerDocument.defaultView.frameElement}catch{return null}})(o);return!!a&&(a.clientHeight<o.scrollHeight||a.clientWidth<o.scrollWidth)})(e)}return!1},To=(e,t,n,o,a,s,i,l)=>s<e&&i>t||s>e&&i<t?0:s<=e&&l<=n||i>=t&&l>=n?s-e-o:i>t&&l<n||s<e&&l>n?i-t+a:0,Xm=e=>{const t=e.parentElement;return t??(e.getRootNode().host||null)},Li=(e,t)=>{var n,o,a,s;if(typeof document>"u")return[];const{scrollMode:i,block:l,inline:d,boundary:c,skipOverflowHiddenElements:u}=t,m=typeof c=="function"?c:B=>B!==c;if(!ki(e))throw new TypeError("Invalid target");const p=document.scrollingElement||document.documentElement,f=[];let g=e;for(;ki(g)&&m(g);){if(g=Xm(g),g===p){f.push(g);break}g!=null&&g===document.body&&Eo(g)&&!Eo(document.documentElement)||g!=null&&Eo(g,u)&&f.push(g)}const h=(o=(n=window.visualViewport)==null?void 0:n.width)!=null?o:innerWidth,y=(s=(a=window.visualViewport)==null?void 0:a.height)!=null?s:innerHeight,{scrollX:v,scrollY:b}=window,{height:N,width:w,top:T,right:L,bottom:R,left:_}=e.getBoundingClientRect(),{top:P,right:A,bottom:U,left:X}=(B=>{const M=window.getComputedStyle(B);return{top:parseFloat(M.scrollMarginTop)||0,right:parseFloat(M.scrollMarginRight)||0,bottom:parseFloat(M.scrollMarginBottom)||0,left:parseFloat(M.scrollMarginLeft)||0}})(e);let H=l==="start"||l==="nearest"?T-P:l==="end"?R+U:T+N/2-P+U,C=d==="center"?_+w/2-X+A:d==="end"?L+A:_-X;const K=[];for(let B=0;B<f.length;B++){const M=f[B],{height:q,width:I,top:D,right:k,bottom:G,left:Z}=M.getBoundingClientRect();if(i==="if-needed"&&T>=0&&_>=0&&R<=y&&L<=h&&(M===p&&!Eo(M)||T>=D&&R<=G&&_>=Z&&L<=k))return K;const te=getComputedStyle(M),ne=parseInt(te.borderLeftWidth,10),V=parseInt(te.borderTopWidth,10),j=parseInt(te.borderRightWidth,10),J=parseInt(te.borderBottomWidth,10);let W=0,Q=0;const z="offsetWidth"in M?M.offsetWidth-M.clientWidth-ne-j:0,ee="offsetHeight"in M?M.offsetHeight-M.clientHeight-V-J:0,me="offsetWidth"in M?M.offsetWidth===0?0:I/M.offsetWidth:0,ue="offsetHeight"in M?M.offsetHeight===0?0:q/M.offsetHeight:0;if(p===M)W=l==="start"?H:l==="end"?H-y:l==="nearest"?To(b,b+y,y,V,J,b+H,b+H+N,N):H-y/2,Q=d==="start"?C:d==="center"?C-h/2:d==="end"?C-h:To(v,v+h,h,ne,j,v+C,v+C+w,w),W=Math.max(0,W+b),Q=Math.max(0,Q+v);else{W=l==="start"?H-D-V:l==="end"?H-G+J+ee:l==="nearest"?To(D,G,q,V,J+ee,H,H+N,N):H-(D+q/2)+ee/2,Q=d==="start"?C-Z-ne:d==="center"?C-(Z+I/2)+z/2:d==="end"?C-k+j+z:To(Z,k,I,ne,j+z,C,C+w,w);const{scrollLeft:ge,scrollTop:ze}=M;W=ue===0?0:Math.max(0,Math.min(ze+W/ue,M.scrollHeight-q/ue+ee)),Q=me===0?0:Math.max(0,Math.min(ge+Q/me,M.scrollWidth-I/me+z)),H+=ze-W,C+=ge-Q}K.push({el:M,top:W,left:Q})}return K},Zm=e=>e===!1?{block:"end",inline:"nearest"}:(t=>t===Object(t)&&Object.keys(t).length!==0)(e)?e:{block:"start",inline:"nearest"};function wo(e,t){if(!e.isConnected||!(a=>{let s=a;for(;s&&s.parentNode;){if(s.parentNode===document)return!0;s=s.parentNode instanceof ShadowRoot?s.parentNode.host:s.parentNode}return!1})(e))return;const n=(a=>{const s=window.getComputedStyle(a);return{top:parseFloat(s.scrollMarginTop)||0,right:parseFloat(s.scrollMarginRight)||0,bottom:parseFloat(s.scrollMarginBottom)||0,left:parseFloat(s.scrollMarginLeft)||0}})(e);if((a=>typeof a=="object"&&typeof a.behavior=="function")(t))return t.behavior(Li(e,t));const o=typeof t=="boolean"||t==null?void 0:t.behavior;for(const{el:a,top:s,left:i}of Li(e,Zm(t))){const l=s-n.top+n.bottom,d=i-n.left+n.right;a.scroll({top:l,left:d,behavior:o})}}const Pr=Object.freeze(Object.defineProperty({__proto__:null,default:wo},Symbol.toStringTag,{value:"Module"})),Qm={alt:"string",size:"SpinnerSize",title:"string"};function Br(e){const{alt:t,className:n,size:o=F.SpinnerSize.MEDIUM,"data-testid":a,title:s,unsafelyReplaceClassName:i,...l}=e,{t:d}=he.useWoodlandLanguage(),c=t||s||d("spinner.defaultAltText",{defaultValue:"Loading..."}),u=$(i||"sps-spinner",`sps-spinner--${o}`,n);return r.createElement("i",{className:u,"data-testid":a,title:c,...l})}Object.assign(Br,{props:Qm,displayName:"SpsSpinner"});const ef=60;function Co(e){return typeof e>"u"?"inherit":`${e}px`}function Rr(e){switch(e){case F.Position.TOP_LEFT:return F.Position.BOTTOM_LEFT;case F.Position.TOP_MIDDLE:return F.Position.BOTTOM_MIDDLE;case F.Position.TOP_RIGHT:return F.Position.BOTTOM_RIGHT;case F.Position.RIGHT_TOP:return F.Position.LEFT_TOP;case F.Position.RIGHT_MIDDLE:return F.Position.LEFT_MIDDLE;case F.Position.RIGHT_BOTTOM:return F.Position.LEFT_BOTTOM;case F.Position.BOTTOM_RIGHT:return F.Position.TOP_RIGHT;case F.Position.BOTTOM_MIDDLE:return F.Position.TOP_MIDDLE;case F.Position.BOTTOM_LEFT:return F.Position.TOP_LEFT;case F.Position.LEFT_BOTTOM:return F.Position.RIGHT_BOTTOM;case F.Position.LEFT_MIDDLE:return F.Position.RIGHT_MIDDLE;case F.Position.LEFT_TOP:return F.Position.RIGHT_TOP}}function tf(e,t,n,o,a,s,i,l){const d=i&&i.current,c=d?d.scrollTop:window.pageYOffset,u=l?0:c,m=d?d.scrollLeft:window.pageXOffset,p=l?0:m,[f,g]=e.split(" ");let h,y,v,b;switch(f){case"top":v=t.height-n.top-u-s[0];break;case"left":y=t.width-n.left-p-s[0];break;case"right":b=n.right+p-s[0];break;case"bottom":h=n.bottom+u-s[0];break;default:throw new Error(`Invalid position ${e}`)}switch(g){case"left":b=n.left+p+s[1];break;case"top":h=n.top+u+s[1];break;case"middle":f==="top"||f==="bottom"?b=n.left+p+n.width/2-a/2+s[1]:(f==="left"||f==="right")&&(h=n.top+u+n.height/2-o.height/2+s[1]);break;case"bottom":v=t.height-n.bottom-u+s[1];break;case"right":y=t.width-n.right-p+s[1];break;default:throw new Error(`Invalid position ${e}`)}return[h,y,v,b]}function Jt(e,t,n,{altPosition:o,setMinWidth:a=!1,setWidth:s=!1,parentElementRef:i,fixed:l=!1,offsets:d=[0,0]}){if(e.current&&t.current){const c=e.current.getBoundingClientRect(),u=t.current.getBoundingClientRect(),m=Math.max(document.documentElement.clientHeight,window.innerHeight||0),p=document.documentElement.getBoundingClientRect().width;let g=(i?.current??document.documentElement).getBoundingClientRect();l&&(g={x:0,y:0,width:p,height:m,top:0,left:0,bottom:m,right:p,toJSON(){return{width:p,height:m,top:0,left:0,bottom:m,right:p}}});const[h,y]=n.split(" ");let v=n;if(o&&(h==="top"&&u.top-c.height<ef||h==="right"&&u.right+c.width>p||h==="bottom"&&u.bottom+c.height>m||h==="left"&&u.left-c.width<0)&&(v=o),y==="left"&&u.left+c.width+(d?.[1]??0)>document.documentElement.getBoundingClientRect().right)switch(h){case"bottom":v=F.Position.BOTTOM_RIGHT;break;case"top":v=F.Position.TOP_RIGHT;break}const b=a?Math.max(u.width,c.width):c.width,N=s?u.width:b,[w,T,L,R]=tf(v,g,u,c,N,d,i,l),_={top:Co(w),right:Co(T),bottom:Co(L),left:Co(R)};return l&&(_.position="fixed",_.zIndex=F.ZStratum.BAR),a&&(_.minWidth=`${u.width}px`),s&&(_.width=`${u.width}px`),[_,v===o]}return[{},!1]}const rt=E.createContext(null);function gn(e,t=[]){const n=E.useContext(rt);return E.useMemo(()=>o=>{const s=n&&n.parentElementRef&&n.parentElementRef.current||document.body;let i=null,l=s.lastElementChild;for(;l&&l!==s.firstElementChild;){if(l.hasAttribute("data-portalid")&&l.getAttribute("data-portalid")===e){i=l;break}l=l.previousElementSibling}if(i)s.contains(i)||s.appendChild(i);else{i=document.createElement("div"),i.setAttribute("data-portalid",e);for(const d of t)i.classList.add(d);s.appendChild(i)}return Ln.createPortal(o,i)},[n])}const Fr=["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","1","2","3","4","5","6","7","8","9","0"];async function _i(e,t,n,o,a,s){const i=typeof e.options=="function"?e.options(t.value):e.options||[],l=i instanceof Promise,d=m=>m.replace(/([.?*+^$[\]\\(){}|-])/g,"");n({pending:l}),s.current=l?i:null;const c=l?await i||[]:i||[];if(l&&s.current!==i)return;let u=Array.from(c).filter(Boolean).map(m=>new F.SpsOptionListOption(m,typeof m=="function"?{textKey:"label",captionKey:"caption"}:{textKey:e.textKey,captionKey:e.captionKey}));if(e.nullOption&&u.unshift(new F.SpsOptionListOption(null,{text:e.nullOption})),t.value&&!e.disableDefaultOptionsFiltering){const m=d(t.value);n({replacementPattern:new RegExp(`(${m})`,"ig")}),u=u.filter(p=>{const f=new RegExp(m,"i"),g=d(p.text);return e.filterByTextAndCaptionKey?f.test(g)||f.test(d(p.caption)):f.test(g)})}else n({replacementPattern:null});if(e.disabledOptions)for(const m of u)e.disabledOptions.includes(m.value)&&(m.disabled=!0);o(Object.freeze(u)),e.onOptionListChanged&&e.onOptionListChanged(u.length),a(u.some(m=>m.value&&!!m.value.icon)),n({pending:!1})}function nf(e,t,n){const[o,a]=r.useState(Object.freeze([])),[s,i]=r.useState(!1),l=r.useRef(null),d=r.useRef(e.options);(typeof e.options!="function"||e.disableOptionsMemoization)&&(d.current=e.options);const c=r.useMemo(()=>typeof d.current=="function"?S.debounce(_i,typeof e.searchDebounce<"u"?e.searchDebounce:500):_i,[d.current,e.disabledOptions]);return r.useEffect(()=>{c(e,t,n,a,i,l)},[d.current,t.value,e.disabledOptions]),[o,s]}class Lt{constructor(t,n){this.target=t,this.isPgStoppedInternal=!1,this.currentTarget=t,this.nativeEvent=new CustomEvent("change",n),Object.defineProperty(this.nativeEvent,"target",{value:t,writable:!1,configurable:!1,enumerable:!0})}get bubbles(){return this.nativeEvent.bubbles}get cancelable(){return this.nativeEvent.cancelable}get defaultPrevented(){return this.nativeEvent.defaultPrevented}get eventPhase(){return this.nativeEvent.eventPhase}get isTrusted(){return this.nativeEvent.isTrusted}get timeStamp(){return this.nativeEvent.timeStamp}get type(){return this.nativeEvent.type}preventDefault(){this.nativeEvent.preventDefault()}isDefaultPrevented(){return this.defaultPrevented}stopPropagation(){this.nativeEvent.stopPropagation(),this.isPgStoppedInternal=!0}isPropagationStopped(){return this.isPgStoppedInternal}persist(){throw new Error("This is not a real React ChangeEvent. React does not permit the creation of SyntheticEvents in userland.")}}function of(e,t){return{...e,...t}}function Dt(e){return E.useReducer(of,e)}function rf({hideInlineSearch:e,showInlineSearch:t,options:n,onSearchChange:o,search:a="",searchPlaceholder:s,searchInputRef:i}){const{t:l}=he.useWoodlandLanguage(),d=s??l("select.searchPlaceholder",{defaultValue:"Search…"}),[c,u]=Dt({isAsync:typeof n=="function",pending:!1,value:a,replacementPattern:null}),m=r.useCallback(y=>{u({value:y.target.value}),o&&o(y)},[o]),p=r.useCallback(y=>{y.nativeEvent.stopImmediatePropagation(),y.stopPropagation()},[]),f=r.useCallback(y=>{y.nativeEvent.stopImmediatePropagation(),u({value:""}),o&&o(new Lt({value:""})),i?.current&&i.current.focus()},[o,i]),g=y=>{y&&(["Tab","Escape","Enter","Up","ArrowUp","Down","ArrowDown"].includes(y.key)||y.stopPropagation())};return r.useEffect(()=>{u({value:a})},[a]),[(c.isAsync||t)&&!e?r.createElement("div",{className:"sps-option-list__search sps-form-group sps-text-input"},r.createElement("div",{className:"sps-form-control"},!c.value&&r.createElement("i",{className:"sps-icon sps-icon-filter sps-text-input__icon"}),r.createElement("input",{type:"text",className:"sps-text-input__input",placeholder:d,ref:i,value:c.value,onChange:m,onClick:p,onKeyDown:g}),c.value&&r.createElement("i",{className:"sps-icon sps-icon-x-circle sps-form-control__clear-btn",onClick:f}))):r.createElement(r.Fragment,null),c,u]}const af=wo||Pr,sf=["Tab","Escape","Enter","Up","ArrowUp","Down","ArrowDown"];function lf(e,t,n){return n?(e&&e[n])===(t&&t[n]):e===t}function Oi(e,t,n){return typeof n.value=="function"&&n.disabled?!0:t?!!e?.find(o=>o[t]&&o[t]===n?.value?.[t]):!1}const Rn=r.forwardRef((e,t)=>{const{captionKey:n,comparisonKey:o,disabledOptions:a,options:s,tall:i,textKey:l,valueKey:d,zeroState:c,hideInlineSearch:u,showInlineSearch:m,onSearchChange:p,search:f,searchDebounce:g,searchPlaceholder:h,onSpecialActionSelect:y,attachTo:v,className:b,conformWidth:N,id:w,ignoreWidthStyles:T,isOpen:L,keepOpen:R,keyDown:_,nullOption:P,onOptionListChanged:A,onOptionSelected:U,onPositionFlip:X,onSelfToggle:H,optionRole:C,positionOverride:K,selectedOption:B,specialAction:M,unsafelyReplaceClassName:q,loading:I,filterByTextAndCaptionKey:D,maxHeightPx:k,maxHeightRem:G,disableOptionsMemoization:Z,disableDefaultOptionsFiltering:te,"data-testid":ne,typeaheadEvent:V,...j}=e,J=r.useMemo(()=>M?new F.SpsOptionListOption(M,{textKey:"label",captionKey:"caption"}):null,[M]),[W,Q]=r.useState(-1),[z,ee]=r.useState(L),me=t||r.useRef(null),ue=r.useRef(null),ge=r.useRef(null),ze=gn("sps-option-list-portal"),$e=r.useContext(rt),[Xe,nt]=K||[F.Position.BOTTOM_LEFT,F.Position.TOP_LEFT],[[mt,xe],ot]=r.useState([{},!1]),Ve=r.useRef(null),[ft,_e,oe]=rf({...e,searchInputRef:Ve}),[de,je]=nf(e,_e,oe);r.useEffect(()=>{V&&Ye(V)},[V]),r.useEffect(()=>{ot(z?Jt(me,v,Xe,{altPosition:nt,setMinWidth:!T,setWidth:!T&&N,...$e}):[{},!1])},[z,Xe,nt,de]),r.useEffect(()=>{let se;return z&&(se=()=>{z&&ot(Jt(me,v,Xe,{altPosition:nt,setMinWidth:!T,setWidth:!T&&N,...$e}))},document.addEventListener("scroll",se)),()=>{se&&document.removeEventListener("scroll",se)}},[z]),r.useEffect(()=>{Q(-1)},[_e]);const mo=$(q||"sps-option-list","z-stratum-dropdown",z&&"sps-option-list--open",_e.isAsync&&"sps-option-list--searchable",xe&&"sps-option-list--opens-upward",M&&M.label&&"sps-option-list--has-special-action",b),Dr=$(q||"sps-option-list__options",i&&"sps-option-list__options--tall"),xt=r.useCallback(()=>{z||(ee(!0),Ve.current&&Ve.current.focus(),Q(-1),H&&H(!0))},[z,H]),jt=r.useCallback(()=>{z&&(ee(!1),Q(-1),H&&H(!1))},[z,H]),yt=r.useCallback((se,ce)=>{ce||se&&!se.disabled&&(typeof se.value=="function"?(se.value(),y&&y()):typeof U=="function"&&U(se.value),R||jt())},[U,jt]),fo=r.useCallback((se,ce,ke)=>{se.stopPropagation(),yt(ce,ke)},[yt]),ae=r.useRef(a||[]);ae.current=a||[];const we=r.useCallback(se=>{switch(se.key){case"Tab":case"Escape":jt();break;case"Enter":if(W>-1){const ce=de[W]||J;se.preventDefault();const ke=!!ce&&Oi(ae.current,o||"",ce);!ke&&ce&&typeof U=="function"&&typeof ce.value=="function"?ce.value():ce&&yt(ce,ke)}break;case"Up":case"ArrowUp":{let ce=W;xe?W<=-1?ce=de.length-1:W===0?M&&(ce=de.length):W<de.length&&(ce=W-1):W>-1&&(ce=W-1),ce!==W&&(se.preventDefault(),Q(ce));break}case"Down":case"ArrowDown":{xt();let ce=W;xe?W!==-1&&(W>=de.length?ce=0:W===de.length-1?ce=-1:ce=W+1):W<de.length-1+ +!!M&&(ce=W+1),ce!==W&&(se.preventDefault(),Q(ce));break}default:xt()}},[jt,xt,W,yt,U,xe,de]),Ke=r.useCallback(se=>{xt();const ce=de.findIndex(ke=>{if(ke.textKey){const Tt=ke.textKey;return ke.value[Tt].toLowerCase().charAt([0])===se.key.toLocaleLowerCase()}return ke.value.toString().toLowerCase().charAt([0])===se.key.toLocaleLowerCase()});ce>-1&&Q(ce)},[de]),Ye=r.useCallback(se=>{se&&(sf.includes(se.key)?we(se):Fr.includes(se.key)&&!u&&Ke(se))},[jt,xt,W,yt,U,xe,de]);r.useEffect(()=>{if($e!==null&&document.getElementsByClassName("sps-modal__body").length>0){const se=()=>{H&&H(!1)},ce=document.getElementsByClassName("sps-modal__body")[0];return ce.addEventListener("scroll",se),()=>{ce.removeEventListener("scroll",se)}}},[]),r.useEffect(()=>{z&&ge.current&&af(ge.current,{scrollMode:"if-needed",block:"nearest",inline:"nearest"})},[W,z]),r.useEffect(()=>{ee(L),L?Ve.current&&Ve.current.focus():Q(-1)},[L]),r.useEffect(()=>{_&&Ye(_)},[_]),r.useEffect(()=>{!z&&ue.current&&(p&&_e.value&&p(new Lt({value:""})),oe({value:""}),ue.current.scrollTop=0),z&&X&&X(xe)},[z]);const Ie=k?k/16:G,Et=Ie?{maxHeight:`${Ie}rem`}:{};function kt(se,ce){return ce?r.createElement(r.Fragment,null,se.split(ce).map((ke,Tt)=>ce.test(ke)?r.createElement("u",{key:Tt},ke):r.createElement(r.Fragment,{key:Tt},ke))):r.createElement(r.Fragment,null,se)}return ze(r.createElement("div",{className:mo,id:w,"aria-activedescendant":W>-1?`${w}-option-${W}`:"",tabIndex:-1,ref:me,style:mt,onMouseLeave:()=>Q(-1),"data-testid":ne,...j},ft,r.createElement("div",{className:Dr,ref:ue,"data-testid":`${ne}-options`,style:Et},!I&&!_e.pending&&c&&de.length===0&&r.createElement("div",{className:"sps-option-list__zero-state"},c),(I||_e.pending)&&r.createElement("div",{className:"sps-option-list__loading"},r.createElement(Br,null)),!I&&!_e.pending&&de.map((se,ce)=>{const ke=`${w}-option-${ce}`,Tt=lf(se.value,B,o),Nm=Oi(ae.current,o||"",se);return r.createElement("a",{key:ke,id:ke,role:C,"aria-selected":Tt,href:se.href,className:$("sps-option-list__option",se.caption&&"sps-option-list__option--has-caption",se.disabled&&"sps-option-list__option--disabled",se.bold&&"sps-option-list__option--bold",(Tt||Nm)&&"sps-option-list__option--selected",W===ce&&"sps-option-list__option--highlighted"),onClick:GC=>fo(GC,se,Nm),onMouseOver:()=>Q(ce),tabIndex:-1,ref:W===ce?ge:null,"data-testid":`${ne}-option-${ce}`},se.value&&se.value.icon&&r.createElement("i",{className:$("sps-icon","sps-option-list__option-icon",`sps-icon-${String(se.value.icon)}`)}),(!se.value||!se.value.icon&&je)&&r.createElement("span",{className:"sps-option-list__option-icon-spacer"}),r.createElement("span",null,kt(se.text,_e.replacementPattern)),se.caption&&r.createElement("div",{className:"sps-option-list__option-caption"},r.createElement("span",null,kt(se.caption,_e.replacementPattern))))})),J&&M?.label&&r.createElement("a",{className:$("sps-option-list__option","sps-option-list__special-action",W===de.length&&"sps-option-list__option--highlighted",M.disabled&&"sps-option-list__special-action--disabled"),href:J.href,target:J.href&&M.newTab?"_blank":"_self",onClick:se=>fo(se,J),onMouseOver:()=>Q(de.length),"data-testid":`${ne}-special-action`},M.icon&&r.createElement("i",{className:$("sps-icon","sps-option-list__option-icon",`sps-icon-${String(M.icon)}`)}),!M.icon&&je&&r.createElement("span",{className:"sps-option-list__option-icon-spacer"}),r.createElement("span",null,M.label))))});Object.assign(Rn,{displayName:"SpsOptionList"});function hn(e){return{key:e.key,preventDefault:()=>{}}}function cf(e,t,n=[]){return r.useMemo(()=>{function o(a){return r.createElement(e,{...a,...t},a.children)}return o},n)}function qe(e){return typeof e=="function"?e():e}const Pi=function({children:e,elements:t}){if(t.length===0)return r.createElement(r.Fragment,null,e);const[n,o]=Array.isArray(t[0])?t[0]:[t[0]];return r.createElement(n,{...o??{}},r.createElement(Pi,{elements:t.slice(1)},e))},Bi=function({children:e,providers:t=[],...n}){return r.createElement("div",{...n},r.createElement(Pi,{elements:t},e))},df=function({children:e,className:t,...n}){return r.createElement(Bi,{className:`sps-app ${t}`,...n},e)};function at(e=[],t=[]){const n=Array.isArray(e)?S.flatten(e):[e],o=t.map(s=>Array.isArray(s)?s:[s]),a=new Array(o.length+1).fill(null).map(()=>[]);for(const s of n){let i=!1;for(let l=0;l<o.length;l+=1)for(const{type:d,props:c={}}of o[l])if(s.type===d&&Object.keys(c).every(m=>c[m]===s.props[m])){i=!0,a[l].push(s);break}i||a[a.length-1].push(s)}return a}function Ri(e,t,n){const o=Object.entries(t).filter(([,s])=>typeof s!="string"&&s.deprecated).map(([s])=>s),a=o.map(s=>n[s]);r.useEffect(()=>{a.find(s=>typeof s<"u")&&console.warn(`The following prop(s) of ${e} are deprecated: ${o.join(", ")}`)},a)}function Ar(e,t){const n=E.useRef(!1);E.useEffect(()=>()=>{n.current=!1},[]),E.useEffect(()=>{if(n.current)return e();n.current=!0},t)}function $r(e,t,n){const o=r.useRef(t(...n));r.useEffect(()=>(document.addEventListener(e,o.current,{capture:!0}),()=>document.removeEventListener(e,o.current)),[]),r.useEffect(()=>{document.removeEventListener(e,o.current),o.current=t(...n),document.addEventListener(e,o.current,{capture:!0})},n)}function Fi(e,t,n){return function(a){!e.current?.contains(a.target)&&!t.current?.contains(a.target)&&n()}}function bn(e,t,n){const o=r.useRef(!1),[a,s]=r.useState(!1),i=r.useCallback(()=>{o.current?o.current=!1:s(!0)},[]),l=r.useCallback((d=!1)=>{s(!1),o.current=d,n&&n()},[]);return $r("mousedown",Fi,[e,t,l]),$r("pointerdown",Fi,[e,t,l]),{showPopup:a,doShowPopup:i,doHidePopup:l}}const Ai=e=>{const t=/(auto|scroll)/,n=(l,d)=>l.parentNode===null?d:n(l.parentNode,d.concat([l])),o=(l,d)=>getComputedStyle(l,null).getPropertyValue(d),a=l=>o(l,"overflow")+o(l,"overflow-y"),s=l=>t.test(a(l));return(l=>{if(!(l instanceof HTMLElement||l instanceof SVGElement))return;const d=n(l.parentNode,[]);for(let c=0;c<d.length;c+=1)if(s(d[c]))return d[c];return null})(e)};let Vr=0;function Fn({isOpen:e,rootRef:t}){r.useLayoutEffect(()=>{let n,o,a;if(e&&t.current){Vr+=1,n=Ai(t.current)||document.body,o=n===document.body?window.innerWidth-document.documentElement.clientWidth:n.offsetWidth-n.clientWidth,n.style.overflow="hidden";const s=window.getComputedStyle(n).paddingRight;if(n.style.paddingRight=s&&s!=="0px"?`calc(${s} + ${o}px)`:`${o}px`,n===document.body){if(a=document.getElementsByClassName("sps-navbar-container").item(0),a&&window.getComputedStyle(a).position==="fixed"){const i=window.getComputedStyle(a).paddingRight;a.style.paddingRight=i&&i!=="0px"?`calc(${i} + ${o}px)`:`${o}px`}else if(a=document.getElementsByTagName("nav").item(0)?.parentElement,a&&window.getComputedStyle(a).position==="fixed"){const l=window.getComputedStyle(a).paddingRight;a.style.paddingRight=l&&l!=="0px"?`calc(${l} + ${o}px)`:`${o}px`}}}return()=>{n&&(Vr-=1,Vr===0&&(n.style.overflow=null,n.style.paddingRight=null,a&&(a.style.paddingRight=null)))}},[e])}const pf={debounce:"number",disabled:"boolean",conformWidth:"boolean",formMeta:"SpsFormFieldMeta<string>",icon:"SpsIcon",onChange:"React.ChangeEventHandler",onSelectionChange:"(newValue: string) => void",placeholder:"string",suggestions:{type:`
|
|
1
|
+
(function(x,E){typeof exports=="object"&&typeof module<"u"?E(exports,require("react"),require("@spscommerce/utils"),require("moment-timezone"),require("@spscommerce/ds-shared"),require("@spscommerce/i18n"),require("react-dom"),require("@spscommerce/ds-colors"),require("@sps-woodland/tabs"),require("@sps-woodland/illustrations")):typeof define=="function"&&define.amd?define(["exports","react","@spscommerce/utils","moment-timezone","@spscommerce/ds-shared","@spscommerce/i18n","react-dom","@spscommerce/ds-colors","@sps-woodland/tabs","@sps-woodland/illustrations"],E):(x=typeof globalThis<"u"?globalThis:x||self,E(x.DSReact={},x.React,x.utils,x.moment$3,x.dsShared,x.i18n,x.ReactDOM,x.dsColors,x.tabs,x.illustrations))})(this,(function(x,E,S,Me,F,he,Ln,Nr,Im,gi){"use strict";function hi(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const o=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,o.get?o:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const r=hi(E),un=hi(Me);function bi(e){var t,n,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]&&(n=bi(e[t]))&&(o&&(o+=" "),o+=n)}else for(n in e)e[n]&&(o&&(o+=" "),o+=n);return o}function $(){for(var e,t,n=0,o="",a=arguments.length;n<a;n++)(e=arguments[n])&&(t=bi(e))&&(o&&(o+=" "),o+=t);return o}const xm="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";let He=(e=21)=>{let t="",n=crypto.getRandomValues(new Uint8Array(e|=0));for(;e--;)t+=xm[n[e]&63];return t};function Rt(e){return E.useRef(e||He())}function We(e,t){const n=Rt(e),o=E.useRef(`${n.current}_ctrl`);return E.useEffect(()=>{t&&(t.id=o.current,t.update())},[t]),{wrapperId:n.current||void 0,controlId:o.current}}function Ir(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var xr,vi;function km(){if(vi)return xr;vi=1;var e="[object Object]";function t(p){var f=!1;if(p!=null&&typeof p.toString!="function")try{f=!!(p+"")}catch{}return f}function n(p,f){return function(g){return p(f(g))}}var o=Function.prototype,a=Object.prototype,s=o.toString,i=a.hasOwnProperty,l=s.call(Object),d=a.toString,c=n(Object.getPrototypeOf,Object);function u(p){return!!p&&typeof p=="object"}function m(p){if(!u(p)||d.call(p)!=e||t(p))return!1;var f=c(p);if(f===null)return!0;var g=i.call(f,"constructor")&&f.constructor;return typeof g=="function"&&g instanceof g&&s.call(g)==l}return xr=m,xr}var Mm=km();const yi=Ir(Mm),Ze=new Set,mn=new Set,wt=new Set,So=new Set;function Ei(e){Ze.has(e)||wt.has(e)||So.has(e)||mn.add(e)}function Ti(e){Ze.has(e)||wt.has(e)||mn.has(e)||So.add(e)}const Fe=un.default||un,fn="MM/DD/YYYY",Lm="MM/DD/YYYY hh:mm A",_m="MM/DD/YYYY HH:mm",Om="hh:mm A",Pm="HH:mm",Bm=/^(\d{1,2})\/(\d{1,2})\/(\d{4})$/,_n=Symbol("Date Parse Error");function Sn(e){return Fe.isMoment(e)?e.year()*1e4+(e.month()+1)*100+e.date():e.year*1e4+e.month*100+e.date}const Y=Object.freeze({createFrom(e,t){if(!e)return null;if(typeof e=="string"){if(t){const n=Fe(e,t,!0);if(n.isValid())return Object.freeze({year:n.year(),month:n.month()+1,date:n.date()})}else{const n=Bm.exec(e);if(n){const[,o,a,s]=n;return Object.freeze({year:Number(s),month:Number(o),date:Number(a)})}}return Object.freeze({[_n]:!0,year:void 0,month:void 0,date:void 0})}return Object.freeze({year:e.year(),month:e.month()+1,date:e.date()})},createMomentFrom(e,t){if(!e)return null;let n=null;return typeof e=="string"?t?n=Fe(e,t,!0):n=Fe(e):Fe.isMoment(e)?n=e:n=Y.toMoment(e),n!==null&&Fe.isMoment(n)&&n.isValid()?n:Object.freeze({[_n]:!0,year:void 0,month:void 0,date:void 0})},getRangeSeparator(e){return e?.includes("-")?"/":"-"},createRangeFrom(e,t){if(!e)return null;if(t){const n=Y.getRangeSeparator(t),o=new RegExp(`[^\\d]*${n}[^\\d]*`);return e.split(o).slice(0,2).map(a=>Y.createFrom(a,t))}else return e.split(/[^\d]*-[^\d]*/).slice(0,2).map(n=>Y.createFrom(n))},isValid(e){return e?Fe.isMoment(e)?e.isValid():typeof e=="object"&&typeof e.year=="number"&&typeof e.month=="number"&&typeof e.date=="number"&&Y.toMoment(e)?.isValid():!1},nullifyInvalidDate(e){return Y.isValid(e)?e:null},toMoment(e){return e?Fe.isMoment(e)?e:Fe({...e,month:e.month-1}):null},toString(e,t){const n=Y.toMoment(e);return n&&n.isValid()?n.format(t||fn):""},toStringRange(e,t){if(!e)return"";const n=Y.getRangeSeparator(t);return e.slice(0,2).map(o=>Y.toString(o,t)).join(n)},toDateTimeString(e,t=!1,n){return e&&Fe.isMoment(e)&&e.isValid()?n?t?e.format(`${n} ${Pm}`):e.format(`${n} ${Om}`):t?e.format(_m):e.format(Lm):""},toDateTimeStringRange(e,t=!1,n){if(!e)return"";const o=Y.getRangeSeparator(n);return e.map(a=>Y.toDateTimeString(a,t,n)).join(o)},create(){const e=new Date;return Object.freeze({year:e.getFullYear(),month:e.getMonth()+1,date:e.getDate()})},isSameDate(e,t){return e&&t&&e.year===t.year&&e.month===t.month&&e.date===t.date},isSameMonth(e,t){return e&&t&&e.year===t.year&&e.month===t.month},isAfter(e,t){return!e||!t?null:Sn(e)>Sn(t)},isBefore(e,t){return!e||!t?null:Sn(e)<Sn(t)},isInRange(e,t,n=!0){if(!e||!t||!t[0]||!t[1])return null;const o=Sn(e),[a,s]=t.map(Sn);return a&&s&&(n&&o>=a&&o<=s||!n&&o>a&&o<s)},prevMonth(e){return Object.freeze({year:e.month===1?e.year-1:e.year,month:e.month-1||12,date:e.date})},nextMonth(e){return Object.freeze({year:e.month===12?e.year+1:e.year,month:e.month+1>12?1:e.month+1,date:e.date})},createRangeFromPreset(e,t){if(typeof e.definition=="function")return e.definition();const n=Fe(),o=n.clone().subtract(Fe.duration(e.definition));return[Y.createFrom(o,t),Y.createFrom(n,t)]},createDateTimeRangeFromPreset(e){if(typeof e.definition=="function")return e.definition();const t=Fe().subtract(Fe.duration(e.definition)).startOf("day"),n=Fe().endOf("day");return[t,n]},splitMomentInDateTimeParts(e,t=!1,n,o=!1){let a="";t?a=o?"23:59":"00:00":a=o?"11:59":"12:00";const s=o?"PM":"AM";return e&&Fe.isMoment(e)&&e.isValid()?Y.toDateTimeString(e,t,n).split(" "):["",a,t?void 0:s]},getCurrentMoment(){return Fe()},validateTimeString(e,t=!1){if(!e)return!0;const n=e.split(":"),o=n[0]||"0",a=n[1]||"0",s=Number.isNaN(Number(o))?NaN:parseInt(o,10),i=Number.isNaN(Number(a))?NaN:parseInt(a,10),l=n.length<=2&&o.length<=2&&a.length<=2;return t?l&&s>=0&&s<=23&&i>=0&&i<=59:l&&(!Number.isNaN(s)&&o.length===1||s>=1)&&s<=12&&i>=0&&i<=59},padIncompleteTimeString(e,t=!1){if(!e)return"";const n=e.split(":"),o=parseInt(n[0]||"0",10),a=parseInt(n[1]||"0",10);if(t){const s=o<10?`0${o}`:`${o}`,i=a<10?`0${a}`:`${a}`;return`${s}:${i}`}else{const s=o===0?"12":o<10?`0${o}`:`${o}`,i=a<10?`0${a}`:`${a}`;return`${s}:${i}`}}}),kr=["01:00","02:00","03:00","04:00","05:00","06:00","07:00","08:00","09:00","10:00","11:00","12:00"],Mr=["00:00","01:00","02:00","03:00","04:00","05:00","06:00","07:00","08:00","09:00","10:00","11:00","12:00","13:00","14:00","15:00","16:00","17:00","18:00","19:00","20:00","21:00","22:00","23:00"];let go=fn;function wi(e){go=e}const On=function(t){if(Array.isArray(t)){const n=On(t[0]),o=On(t[1]);return n||o}if(t&&t.hasOwnProperty("year")){if(t[_n])return{dateFormat:go};if(!Y.isValid(t))return{dateValidity:!0}}return null};Ze.add("dateFormat"),Ze.add("dateValidity");const Ci=function(t){if(Array.isArray(t)){const n=On(t);if(n)return n;if(t&&Y.isBefore(t[1],t[0]))return{dateRangeOrder:!0}}return null};Ze.add("dateRangeOrder");const Di=function({minDate:t,maxDate:n}){function o(a){const s=Y.isBefore(a,t),i=Y.isAfter(a,n),l={minExceeded:s?Y.toString(t,go):null,maxExceeded:i?Y.toString(n,go):null};return s||i?{dateConstraint:l}:null}return function(s){if(!s)return null;if(Array.isArray(s)){const i=o(s[0]),l=o(s[1]);return i||l}return s.hasOwnProperty("year")?o(s):null}};Ze.add("dateConstraint");const Rm=Object.freeze(Object.defineProperty({__proto__:null,date:On,dateConstraint:Di,dateRange:Ci,setDateFormat:wi},Symbol.toStringTag,{value:"Module"}));function Mt(e,t){for(const n of[].concat(e)){const o=t(n);if(o)return o}return null}const Fm=function(t){function n(o){return Number(o)>=t?null:{min:t}}return o=>Mt(o,n)};Ze.add("min");const Am=function(t){function n(o){return Number(o)<=t?null:{max:t}}return o=>Mt(o,n)};mn.add("max");const $m=function(t){return typeof t>"u"||t===null||t===""||Number.isNaN(t)||t?.length===0?{required:!0}:null};mn.add("required");const Vm=function(t){function n(o){return o===void 0||o.toString().length<t?{minLength:t}:null}return o=>Mt(o,n)};Ze.add("minLength");const Km=function(t){function n(o){return o==null||Array.isArray(o)&&o.length<t?{minLengthArray:t}:null}return o=>n(o)};Ze.add("minLengthArray");const Hm=function(t){function n(o){return o===void 0||o.toString().length<=t?null:{maxLength:t}}return o=>Mt(o,n)};wt.add("maxLength");const Wm=function(t){function n(o){return o==null||Array.isArray(o)&&o.length<=t?null:{maxLengthArray:t}}return o=>n(o)};Ze.add("maxLengthArray");const Gm=function(t){const n=t instanceof RegExp?t:new RegExp(t);function o(a){return n.test(a)?null:{pattern:t}}return a=>Mt(a,o)};Ze.add("pattern");const Um=function(e){function t(n){return new RegExp("^\\p{L}*$","u").test(n)?null:{alpha:!0}}return Mt(e,t)};wt.add("alpha");const zm=function(e){function t(n){return/^[0-9,. ]*$/.test(n)?null:{numeric:!0}}return Mt(e,t)};wt.add("numeric");const jm=function(e){function t(n){return/^-?[0-9,. ]*$/.test(n)?null:{positiveOrNegativeNumber:!0}}return Mt(e,t)};wt.add("positiveOrNegativeNumber");const Ym=function(e){function t(n){return/^[^0-9]*$/.test(n)?null:{nonNumeric:!0}}return Mt(e,t)};wt.add("nonNumeric");const ho=Object.freeze({...Rm,min:Fm,max:Am,required:$m,minLength:Vm,minLengthArray:Km,maxLength:Hm,maxLengthArray:Wm,pattern:Gm,alpha:Um,numeric:zm,nonNumeric:Ym,positiveOrNegativeNumber:jm,OnBlurErrorKeys:Ze});function bo(e,t=[]){const n=t.reduce((o,a)=>Object.assign(o,a(e)||{}),{});return Object.keys(n).length?n:null}var Ct=(e=>(e[e.ON_CHANGE=0]="ON_CHANGE",e[e.ON_BLUR=1]="ON_BLUR",e[e.ON_SUBMIT=2]="ON_SUBMIT",e))(Ct||{});function qm(e,t={},n=[]){for(const[o,a]of Object.entries(t))a===0?Ei(o):a===2&&Ti(o);return r.useCallback(e,n)}class Yt{constructor(t,n){this.path=t,this.update=n,this.validators=[],this.#e=null,this.#t=null,this.#n=null,this.preventativeErrors=[],this.submitted=!1}#e;#t;#n;get errors(){return this.#e===null&&this.#t===null&&this.#n===null?null:{...this.#e??{},...this.#t??{},...this.#n??{}}}setValidators(t){return this.update(this.path,null,void 0,t),this}validate(t,n,o=!1){if(this.validators&&this.validators.length>0){const a=bo(t,this.validators);let s={onSubmit:{},onChange:{},onBlur:{}};a&&(s=Object.keys(a).reduce((i,l)=>(So.has(l)?i.onSubmit[l]=a[l]:mn.has(l)?i.onChange[l]=a[l]:i.onBlur[l]=a[l],i),s)),(typeof n>"u"||n===Ct.ON_CHANGE)&&(this.#t=Object.keys(s.onChange).length===0?null:s.onChange),(typeof n>"u"||n===Ct.ON_BLUR)&&(this.#n=Object.keys(s.onBlur).length===0?null:s.onBlur),(typeof n>"u"||n===Ct.ON_SUBMIT)&&(this.#e=Object.keys(s.onSubmit).length===0?null:s.onSubmit,this.#t=Object.keys(s.onChange).length===0?null:s.onChange,this.#n=Object.keys(s.onBlur).length===0?null:s.onBlur),o||this.update(),this.isFocused()&&this.onFocus&&this.onFocus()}else this.errors&&(this.#e=null,this.#n=null,this.#t=null,o||this.update());return this}isValid(){return!this.errors||this.isPristine()}hasErrors(){return!!this.errors}isVisibilyInvalid(){return!this.isValid()}hasError(t){return this.errors&&Object.prototype.hasOwnProperty.call(this.errors,t)}hasPreventativeError(t){return this.preventativeErrors.includes(t)}hasPreventativeErrors(){return this.preventativeErrors.length>0}isRequired(){return this.validators&&this.validators.indexOf(ho.required)>-1}isSubmitted(){return this.submitted}onFocus(){}onBlur(){}}class Pn extends Yt{constructor(){super(...arguments),this.id=He(),this.focused=!1,this.pristine=!0}setValue(t){if(this.preventativeErrors=[],this.validators&&this.validators.length>0){const n=bo(t,this.validators);if(n&&Object.keys(n).filter(a=>wt.has(a)).length>0){this.preventativeErrors=Object.keys(n);return}}this.update(this.path,t)}isPristine(){return this.pristine}markAsPristine(){return this.pristine=!0,this.update(),this}markAsDirty(){return this.pristine=!1,this.update(),this}isFocused(){return this.focused}markAsFocused(){return this.focused=!0,this.update(),this.onFocus&&this.onFocus(),this}markAsBlurred(){return this.update(this.path,null,!0),this.onBlur&&this.onBlur(),this.preventativeErrors=[],this}markAsSubmitted(){return this.submitted=!0,this.update(this.path,null,!1,void 0,!0),this}}class qt extends Pn{constructor(t,n,o){const a=o?n:t,s=o||n;super(a,s),o&&this.inferMembers(t)}isFocused(){return super.isFocused()||this.rollup("isFocused")}isValid(){return super.isValid()&&this.rollup("isValid")}hasErrors(){return super.hasErrors()||Object.keys(this.fields).some(t=>this.fields[t].hasErrors())}contentsAreValid(){return this.rollup("isValid")&&this.rollup("contentsAreValid")}isPristine(){return super.isPristine()&&this.rollup("isPristine")}markAsPristine(){super.markAsPristine();for(const t of Object.keys(this.fields))this.fields[t].markAsPristine();return this}markAsDirty(){super.markAsDirty();for(const t of Object.keys(this.fields))this.fields[t].markAsDirty();return this}markAsBlurred(){super.markAsBlurred();for(const t of Object.keys(this.fields))this.fields[t].markAsBlurred();return this}markAsSubmitted(){super.markAsSubmitted();for(const t of Object.keys(this.fields))this.fields[t].markAsSubmitted();return this}inferSpsControl(t,n){return vo(t,[...this.path,n],this.update)}rollup(t){return Object.keys(this.fields).reduce((n,o)=>n&&(!this.fields[o][t]||this.fields[o][t]()),!0)}}class Ni extends qt{inferMembers(t){this.fields={};for(const n of Object.keys(t))this.fields[n]=this.inferSpsControl(t[n],n)}}class Ii extends qt{inferMembers(t){this.fields=t.map((n,o)=>this.inferSpsControl(n,String(o)))}}function vo(e,t,n){return e instanceof Yt?(e.path=t,e.update=n,e):Array.isArray(e)?new Ii(e,t,n):yi(e)?new Ni(e,t,n):new Pn(t,n)}function Bn(e,t){return t.length===0||!e?e:Bn(e.fields[t[0]],t.slice(1,t.length))}function Lr(e,t){if(t.length===0||!e)return[e];const n=t[0];if(t=t.slice(1,t.length),n==="*"){const o=Array.isArray(e.fields)?e.fields:Object.keys(e.fields).map(a=>e.fields[a]);return t.length===0?o:o.reduce((a,s)=>[...a,...Lr(s,t)],[])}return Lr(e.fields[n],t)}function _r(e,t,n){for(const o of Object.keys(t)){const a=t[o];for(const s of Lr(e,o.split(".")))s&&a&&n(s,a)}}function yo(e,t,n,o=!1,a=!1){_r(t,n,(s,i)=>{s.validators=typeof i=="function"?i(e):i,o&&s.validate(S.getPath(e,s.path),void 0,a)})}function Or(e,t){const n=t[0];return t=t.slice(1),Array.isArray(e)?e.map((o,a)=>a===Number(n)?Or(o,t):o):yi(e)?Object.keys(e).reduce((o,a)=>Object.assign(o,{[a]:a===n?Or(e[a],t):e[a]}),{}):e}function Jm(e){if(typeof e!="object"||e===null||Array.isArray(e))throw new TypeError("The initial value of useSpsForm() hook must be an object.")}function xi(e,t={}){Jm(e);const[,n]=E.useState({}),o=E.useRef(!1);o.current=!1;const a=E.useRef(t),s=E.useCallback(p=>{const f=m.current;let g;if(p)if(p.path)if(p.markAsBlurred){const h=Bn(f.formMeta,p.path);if(h){h.focused=!1;const y=S.getPath(f.formValue,p.path);h.validate(y,Ct.ON_BLUR)}}else if(p.newValidators){if(a.current){const h=p.path.join(".");a.current={...a.current,[h]:p.newValidators},yo(f.formValue,f.formMeta,a.current,!0)}}else if(p.markAsSubmitted){const h=Bn(f.formMeta,p.path);if(h){h.submitted=!0;const y=S.getPath(f.formValue,p.path);h.validate(y,Ct.ON_SUBMIT)}}else g=Or(f.formValue,p.path),S.setPath(g,p.path,p.value);else g=p.value;if(p?.updateFormOptions?.validators&&(a.current={...a.current,...p.updateFormOptions.validators},yo(f.formValue,f.formMeta,a.current,p.updateFormOptions?.runValidators??!0)),g){f.formMeta.submitted=!1,S.deepFreeze(g);const h=S.diff(f.formValue,g);for(const{type:v,key:b,parentPath:N,objects:[,w]}of h){const T=Bn(f.formMeta,N);if(typeof b!="symbol"&&T){let L;switch(v){case S.DiffChange.ADDITION:T.fields[b]=vo(w[b],[...N,b],l);break;case S.DiffChange.DELETION:Array.isArray(T.fields)?T.fields[b]=void 0:delete T.fields[b];break;case S.DiffChange.ALTERATION:L=vo(w[b],[...N,b],l),(L instanceof qt&&!(T.fields[b]instanceof qt)||!(L instanceof qt)&&T.fields[b]instanceof qt)&&(L.pristine=!1,T.fields[b]=L);break}}}const y=new Set;if(h.filter(v=>v.type===S.DiffChange.DELETION).reduce((v,b)=>(v.has(b.parentPath)||v.add(b.parentPath),v),y),Array.from(y).forEach(v=>{const b=Bn(f.formMeta,v);Array.isArray(b.fields)&&(b.fields=b.fields.filter(N=>N!==void 0))}),a.current){yo(g,f.formMeta,a.current);const v=new Set;t&&_r(f.formMeta,t,(b,N)=>{typeof N=="function"&&(b.validate(S.getPath(g,b.path)),v.add(b))});for(const{type:b,key:N,parentPath:w,objects:[,T]}of h)if(typeof N!="symbol"){let L=f.formMeta,R=g;if(L){for(const _ of w)L=L.fields[_],R=R[_],v.has(L)||L.validate(R,Ct.ON_CHANGE);if(b===S.DiffChange.ADDITION||b===S.DiffChange.ALTERATION){const _=L.fields[N];if(!v.has(_)&&(L.fields[N].validate(T[N],Ct.ON_CHANGE),b===S.DiffChange.ADDITION&&_.fields))for(const[P,A]of Object.entries(_.fields))A.validate(T[N][P],Ct.ON_CHANGE)}}}}}m.current={...f,formValue:g||f.formValue},o.current||n({})},[]),i=E.useCallback((p,f)=>{p||f?s({value:p,updateFormOptions:f}):s()},[s]),l=E.useCallback((p,f,g=!1,h,y=!1)=>{p?s({path:p,value:f,markAsBlurred:g,newValidators:h,markAsSubmitted:y}):i()},[s,i]),d=E.useMemo(()=>{S.deepFreeze(e);const p=vo(e,[],l);return t&&yo(e,p,t,!1,!0),p},[]),c=E.useCallback(()=>(m.current.formMeta.markAsDirty(),a.current&&_r(m.current.formMeta,a.current,(p,f)=>{(typeof f=="function"||Array.isArray(f))&&p.validate(S.getPath(m.current.formValue,p.path))}),m.current.formMeta.isValid()),[]),u=E.useCallback(()=>m.current.formValue,[]),m=E.useRef({formValue:e,formMeta:d,updateForm:i,validateForm:c,getCurrentFormValue:u});return m.current}const Le=r.forwardRef((e,t)=>{const{className:n,children:o,focusInputOnClick:a,formControl:s,formMeta:i,inputRef:l,onClick:d,...c}=e,u=r.useRef(),p=l||(t||u);function f(){p&&p!==t&&p.current&&p.current.focus()}function g(){p&&p!==t&&p.current&&i&&i instanceof Pn&&i.markAsFocused()}function h(){p&&p!==t&&p.current&&i&&i instanceof Pn&&i.markAsBlurred()}const y=$("sps-form-group",(s&&s.isRequired()||i&&i.isRequired())&&"sps-form-group--required",(s&&!s.isValid()||i&&i.isVisibilyInvalid())&&"sps-form-group--error",i&&i.hasPreventativeErrors()&&"sps-form-group--preventative-error",n);function v(b){a&&f(),d&&d(b)}return r.useEffect(()=>{function b(N){N.target.classList.contains("sps-form-control__clear-btn")&&N.preventDefault()}return document.addEventListener("mousedown",b),()=>{document.removeEventListener("mousedown",b)}},[]),r.createElement("div",{...c,className:y,ref:t,tabIndex:-1,onClick:v,onFocus:g,onBlur:h},o)});Object.assign(Le,{displayName:"SpsFormComponentWrapper"});const ki=e=>typeof e=="object"&&e!=null&&e.nodeType===1,Mi=(e,t)=>(!t||e!=="hidden")&&e!=="visible"&&e!=="clip",Eo=(e,t)=>{if(e.clientHeight<e.scrollHeight||e.clientWidth<e.scrollWidth){const n=getComputedStyle(e,null);return Mi(n.overflowY,t)||Mi(n.overflowX,t)||(o=>{const a=(s=>{if(!s.ownerDocument||!s.ownerDocument.defaultView)return null;try{return s.ownerDocument.defaultView.frameElement}catch{return null}})(o);return!!a&&(a.clientHeight<o.scrollHeight||a.clientWidth<o.scrollWidth)})(e)}return!1},To=(e,t,n,o,a,s,i,l)=>s<e&&i>t||s>e&&i<t?0:s<=e&&l<=n||i>=t&&l>=n?s-e-o:i>t&&l<n||s<e&&l>n?i-t+a:0,Xm=e=>{const t=e.parentElement;return t??(e.getRootNode().host||null)},Li=(e,t)=>{var n,o,a,s;if(typeof document>"u")return[];const{scrollMode:i,block:l,inline:d,boundary:c,skipOverflowHiddenElements:u}=t,m=typeof c=="function"?c:B=>B!==c;if(!ki(e))throw new TypeError("Invalid target");const p=document.scrollingElement||document.documentElement,f=[];let g=e;for(;ki(g)&&m(g);){if(g=Xm(g),g===p){f.push(g);break}g!=null&&g===document.body&&Eo(g)&&!Eo(document.documentElement)||g!=null&&Eo(g,u)&&f.push(g)}const h=(o=(n=window.visualViewport)==null?void 0:n.width)!=null?o:innerWidth,y=(s=(a=window.visualViewport)==null?void 0:a.height)!=null?s:innerHeight,{scrollX:v,scrollY:b}=window,{height:N,width:w,top:T,right:L,bottom:R,left:_}=e.getBoundingClientRect(),{top:P,right:A,bottom:U,left:X}=(B=>{const M=window.getComputedStyle(B);return{top:parseFloat(M.scrollMarginTop)||0,right:parseFloat(M.scrollMarginRight)||0,bottom:parseFloat(M.scrollMarginBottom)||0,left:parseFloat(M.scrollMarginLeft)||0}})(e);let H=l==="start"||l==="nearest"?T-P:l==="end"?R+U:T+N/2-P+U,C=d==="center"?_+w/2-X+A:d==="end"?L+A:_-X;const K=[];for(let B=0;B<f.length;B++){const M=f[B],{height:q,width:I,top:D,right:k,bottom:G,left:Z}=M.getBoundingClientRect();if(i==="if-needed"&&T>=0&&_>=0&&R<=y&&L<=h&&(M===p&&!Eo(M)||T>=D&&R<=G&&_>=Z&&L<=k))return K;const te=getComputedStyle(M),ne=parseInt(te.borderLeftWidth,10),V=parseInt(te.borderTopWidth,10),j=parseInt(te.borderRightWidth,10),J=parseInt(te.borderBottomWidth,10);let W=0,Q=0;const z="offsetWidth"in M?M.offsetWidth-M.clientWidth-ne-j:0,ee="offsetHeight"in M?M.offsetHeight-M.clientHeight-V-J:0,me="offsetWidth"in M?M.offsetWidth===0?0:I/M.offsetWidth:0,ue="offsetHeight"in M?M.offsetHeight===0?0:q/M.offsetHeight:0;if(p===M)W=l==="start"?H:l==="end"?H-y:l==="nearest"?To(b,b+y,y,V,J,b+H,b+H+N,N):H-y/2,Q=d==="start"?C:d==="center"?C-h/2:d==="end"?C-h:To(v,v+h,h,ne,j,v+C,v+C+w,w),W=Math.max(0,W+b),Q=Math.max(0,Q+v);else{W=l==="start"?H-D-V:l==="end"?H-G+J+ee:l==="nearest"?To(D,G,q,V,J+ee,H,H+N,N):H-(D+q/2)+ee/2,Q=d==="start"?C-Z-ne:d==="center"?C-(Z+I/2)+z/2:d==="end"?C-k+j+z:To(Z,k,I,ne,j+z,C,C+w,w);const{scrollLeft:ge,scrollTop:ze}=M;W=ue===0?0:Math.max(0,Math.min(ze+W/ue,M.scrollHeight-q/ue+ee)),Q=me===0?0:Math.max(0,Math.min(ge+Q/me,M.scrollWidth-I/me+z)),H+=ze-W,C+=ge-Q}K.push({el:M,top:W,left:Q})}return K},Zm=e=>e===!1?{block:"end",inline:"nearest"}:(t=>t===Object(t)&&Object.keys(t).length!==0)(e)?e:{block:"start",inline:"nearest"};function wo(e,t){if(!e.isConnected||!(a=>{let s=a;for(;s&&s.parentNode;){if(s.parentNode===document)return!0;s=s.parentNode instanceof ShadowRoot?s.parentNode.host:s.parentNode}return!1})(e))return;const n=(a=>{const s=window.getComputedStyle(a);return{top:parseFloat(s.scrollMarginTop)||0,right:parseFloat(s.scrollMarginRight)||0,bottom:parseFloat(s.scrollMarginBottom)||0,left:parseFloat(s.scrollMarginLeft)||0}})(e);if((a=>typeof a=="object"&&typeof a.behavior=="function")(t))return t.behavior(Li(e,t));const o=typeof t=="boolean"||t==null?void 0:t.behavior;for(const{el:a,top:s,left:i}of Li(e,Zm(t))){const l=s-n.top+n.bottom,d=i-n.left+n.right;a.scroll({top:l,left:d,behavior:o})}}const Pr=Object.freeze(Object.defineProperty({__proto__:null,default:wo},Symbol.toStringTag,{value:"Module"})),Qm={alt:"string",size:"SpinnerSize",title:"string"};function Br(e){const{alt:t,className:n,size:o=F.SpinnerSize.MEDIUM,"data-testid":a,title:s,unsafelyReplaceClassName:i,...l}=e,{t:d}=he.useWoodlandLanguage(),c=t||s||d("spinner.defaultAltText",{defaultValue:"Loading..."}),u=$(i||"sps-spinner",`sps-spinner--${o}`,n);return r.createElement("i",{className:u,"data-testid":a,title:c,...l})}Object.assign(Br,{props:Qm,displayName:"SpsSpinner"});const ef=60;function Co(e){return typeof e>"u"?"inherit":`${e}px`}function Rr(e){switch(e){case F.Position.TOP_LEFT:return F.Position.BOTTOM_LEFT;case F.Position.TOP_MIDDLE:return F.Position.BOTTOM_MIDDLE;case F.Position.TOP_RIGHT:return F.Position.BOTTOM_RIGHT;case F.Position.RIGHT_TOP:return F.Position.LEFT_TOP;case F.Position.RIGHT_MIDDLE:return F.Position.LEFT_MIDDLE;case F.Position.RIGHT_BOTTOM:return F.Position.LEFT_BOTTOM;case F.Position.BOTTOM_RIGHT:return F.Position.TOP_RIGHT;case F.Position.BOTTOM_MIDDLE:return F.Position.TOP_MIDDLE;case F.Position.BOTTOM_LEFT:return F.Position.TOP_LEFT;case F.Position.LEFT_BOTTOM:return F.Position.RIGHT_BOTTOM;case F.Position.LEFT_MIDDLE:return F.Position.RIGHT_MIDDLE;case F.Position.LEFT_TOP:return F.Position.RIGHT_TOP}}function tf(e,t,n,o,a,s,i,l){const d=i&&i.current,c=d?d.scrollTop:window.pageYOffset,u=l?0:c,m=d?d.scrollLeft:window.pageXOffset,p=l?0:m,[f,g]=e.split(" ");let h,y,v,b;switch(f){case"top":v=t.height-n.top-u-s[0];break;case"left":y=t.width-n.left-p-s[0];break;case"right":b=n.right+p-s[0];break;case"bottom":h=n.bottom+u-s[0];break;default:throw new Error(`Invalid position ${e}`)}switch(g){case"left":b=n.left+p+s[1];break;case"top":h=n.top+u+s[1];break;case"middle":f==="top"||f==="bottom"?b=n.left+p+n.width/2-a/2+s[1]:(f==="left"||f==="right")&&(h=n.top+u+n.height/2-o.height/2+s[1]);break;case"bottom":v=t.height-n.bottom-u+s[1];break;case"right":y=t.width-n.right-p+s[1];break;default:throw new Error(`Invalid position ${e}`)}return[h,y,v,b]}function Jt(e,t,n,{altPosition:o,setMinWidth:a=!1,setWidth:s=!1,parentElementRef:i,fixed:l=!1,offsets:d=[0,0]}){if(e.current&&t.current){const c=e.current.getBoundingClientRect(),u=t.current.getBoundingClientRect(),m=Math.max(document.documentElement.clientHeight,window.innerHeight||0),p=document.documentElement.getBoundingClientRect().width;let g=(i?.current??document.documentElement).getBoundingClientRect();l&&(g={x:0,y:0,width:p,height:m,top:0,left:0,bottom:m,right:p,toJSON(){return{width:p,height:m,top:0,left:0,bottom:m,right:p}}});const[h,y]=n.split(" ");let v=n;if(o&&(h==="top"&&u.top-c.height<ef||h==="right"&&u.right+c.width>p||h==="bottom"&&u.bottom+c.height>m||h==="left"&&u.left-c.width<0)&&(v=o),y==="left"&&u.left+c.width+(d?.[1]??0)>document.documentElement.getBoundingClientRect().right)switch(h){case"bottom":v=F.Position.BOTTOM_RIGHT;break;case"top":v=F.Position.TOP_RIGHT;break}const b=a?Math.max(u.width,c.width):c.width,N=s?u.width:b,[w,T,L,R]=tf(v,g,u,c,N,d,i,l),_={top:Co(w),right:Co(T),bottom:Co(L),left:Co(R)};return l&&(_.position="fixed",_.zIndex=F.ZStratum.BAR),a&&(_.minWidth=`${u.width}px`),s&&(_.width=`${u.width}px`),[_,v===o]}return[{},!1]}const rt=E.createContext(null);function gn(e,t=[]){const n=E.useContext(rt);return E.useMemo(()=>o=>{const s=n&&n.parentElementRef&&n.parentElementRef.current||document.body;let i=null,l=s.lastElementChild;for(;l&&l!==s.firstElementChild;){if(l.hasAttribute("data-portalid")&&l.getAttribute("data-portalid")===e){i=l;break}l=l.previousElementSibling}if(i)s.contains(i)||s.appendChild(i);else{i=document.createElement("div"),i.setAttribute("data-portalid",e),i.setAttribute("data-react-aria-top-layer","true");for(const d of t)i.classList.add(d);s.appendChild(i)}return Ln.createPortal(o,i)},[n])}const Fr=["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","1","2","3","4","5","6","7","8","9","0"];async function _i(e,t,n,o,a,s){const i=typeof e.options=="function"?e.options(t.value):e.options||[],l=i instanceof Promise,d=m=>m.replace(/([.?*+^$[\]\\(){}|-])/g,"");n({pending:l}),s.current=l?i:null;const c=l?await i||[]:i||[];if(l&&s.current!==i)return;let u=Array.from(c).filter(Boolean).map(m=>new F.SpsOptionListOption(m,typeof m=="function"?{textKey:"label",captionKey:"caption"}:{textKey:e.textKey,captionKey:e.captionKey}));if(e.nullOption&&u.unshift(new F.SpsOptionListOption(null,{text:e.nullOption})),t.value&&!e.disableDefaultOptionsFiltering){const m=d(t.value);n({replacementPattern:new RegExp(`(${m})`,"ig")}),u=u.filter(p=>{const f=new RegExp(m,"i"),g=d(p.text);return e.filterByTextAndCaptionKey?f.test(g)||f.test(d(p.caption)):f.test(g)})}else n({replacementPattern:null});if(e.disabledOptions)for(const m of u)e.disabledOptions.includes(m.value)&&(m.disabled=!0);o(Object.freeze(u)),e.onOptionListChanged&&e.onOptionListChanged(u.length),a(u.some(m=>m.value&&!!m.value.icon)),n({pending:!1})}function nf(e,t,n){const[o,a]=r.useState(Object.freeze([])),[s,i]=r.useState(!1),l=r.useRef(null),d=r.useRef(e.options);(typeof e.options!="function"||e.disableOptionsMemoization)&&(d.current=e.options);const c=r.useMemo(()=>typeof d.current=="function"?S.debounce(_i,typeof e.searchDebounce<"u"?e.searchDebounce:500):_i,[d.current,e.disabledOptions]);return r.useEffect(()=>{c(e,t,n,a,i,l)},[d.current,t.value,e.disabledOptions]),[o,s]}class Lt{constructor(t,n){this.target=t,this.isPgStoppedInternal=!1,this.currentTarget=t,this.nativeEvent=new CustomEvent("change",n),Object.defineProperty(this.nativeEvent,"target",{value:t,writable:!1,configurable:!1,enumerable:!0})}get bubbles(){return this.nativeEvent.bubbles}get cancelable(){return this.nativeEvent.cancelable}get defaultPrevented(){return this.nativeEvent.defaultPrevented}get eventPhase(){return this.nativeEvent.eventPhase}get isTrusted(){return this.nativeEvent.isTrusted}get timeStamp(){return this.nativeEvent.timeStamp}get type(){return this.nativeEvent.type}preventDefault(){this.nativeEvent.preventDefault()}isDefaultPrevented(){return this.defaultPrevented}stopPropagation(){this.nativeEvent.stopPropagation(),this.isPgStoppedInternal=!0}isPropagationStopped(){return this.isPgStoppedInternal}persist(){throw new Error("This is not a real React ChangeEvent. React does not permit the creation of SyntheticEvents in userland.")}}function of(e,t){return{...e,...t}}function Dt(e){return E.useReducer(of,e)}function rf({hideInlineSearch:e,showInlineSearch:t,options:n,onSearchChange:o,search:a="",searchPlaceholder:s,searchInputRef:i}){const{t:l}=he.useWoodlandLanguage(),d=s??l("select.searchPlaceholder",{defaultValue:"Search…"}),[c,u]=Dt({isAsync:typeof n=="function",pending:!1,value:a,replacementPattern:null}),m=r.useCallback(y=>{u({value:y.target.value}),o&&o(y)},[o]),p=r.useCallback(y=>{y.nativeEvent.stopImmediatePropagation(),y.stopPropagation()},[]),f=r.useCallback(y=>{y.nativeEvent.stopImmediatePropagation(),u({value:""}),o&&o(new Lt({value:""})),i?.current&&i.current.focus()},[o,i]),g=y=>{y&&(["Tab","Escape","Enter","Up","ArrowUp","Down","ArrowDown"].includes(y.key)||y.stopPropagation())};return r.useEffect(()=>{u({value:a})},[a]),[(c.isAsync||t)&&!e?r.createElement("div",{className:"sps-option-list__search sps-form-group sps-text-input"},r.createElement("div",{className:"sps-form-control"},!c.value&&r.createElement("i",{className:"sps-icon sps-icon-filter sps-text-input__icon"}),r.createElement("input",{type:"text",className:"sps-text-input__input",placeholder:d,ref:i,value:c.value,onChange:m,onClick:p,onKeyDown:g}),c.value&&r.createElement("i",{className:"sps-icon sps-icon-x-circle sps-form-control__clear-btn",onClick:f}))):r.createElement(r.Fragment,null),c,u]}const af=wo||Pr,sf=["Tab","Escape","Enter","Up","ArrowUp","Down","ArrowDown"];function lf(e,t,n){return n?(e&&e[n])===(t&&t[n]):e===t}function Oi(e,t,n){return typeof n.value=="function"&&n.disabled?!0:t?!!e?.find(o=>o[t]&&o[t]===n?.value?.[t]):!1}const Rn=r.forwardRef((e,t)=>{const{captionKey:n,comparisonKey:o,disabledOptions:a,options:s,tall:i,textKey:l,valueKey:d,zeroState:c,hideInlineSearch:u,showInlineSearch:m,onSearchChange:p,search:f,searchDebounce:g,searchPlaceholder:h,onSpecialActionSelect:y,attachTo:v,className:b,conformWidth:N,id:w,ignoreWidthStyles:T,isOpen:L,keepOpen:R,keyDown:_,nullOption:P,onOptionListChanged:A,onOptionSelected:U,onPositionFlip:X,onSelfToggle:H,optionRole:C,positionOverride:K,selectedOption:B,specialAction:M,unsafelyReplaceClassName:q,loading:I,filterByTextAndCaptionKey:D,maxHeightPx:k,maxHeightRem:G,disableOptionsMemoization:Z,disableDefaultOptionsFiltering:te,"data-testid":ne,typeaheadEvent:V,...j}=e,J=r.useMemo(()=>M?new F.SpsOptionListOption(M,{textKey:"label",captionKey:"caption"}):null,[M]),[W,Q]=r.useState(-1),[z,ee]=r.useState(L),me=t||r.useRef(null),ue=r.useRef(null),ge=r.useRef(null),ze=gn("sps-option-list-portal"),$e=r.useContext(rt),[Xe,nt]=K||[F.Position.BOTTOM_LEFT,F.Position.TOP_LEFT],[[mt,xe],ot]=r.useState([{},!1]),Ve=r.useRef(null),[ft,_e,oe]=rf({...e,searchInputRef:Ve}),[de,je]=nf(e,_e,oe);r.useEffect(()=>{V&&Ye(V)},[V]),r.useEffect(()=>{ot(z?Jt(me,v,Xe,{altPosition:nt,setMinWidth:!T,setWidth:!T&&N,...$e}):[{},!1])},[z,Xe,nt,de]),r.useEffect(()=>{let se;return z&&(se=()=>{z&&ot(Jt(me,v,Xe,{altPosition:nt,setMinWidth:!T,setWidth:!T&&N,...$e}))},document.addEventListener("scroll",se)),()=>{se&&document.removeEventListener("scroll",se)}},[z]),r.useEffect(()=>{Q(-1)},[_e]);const mo=$(q||"sps-option-list","z-stratum-dropdown",z&&"sps-option-list--open",_e.isAsync&&"sps-option-list--searchable",xe&&"sps-option-list--opens-upward",M&&M.label&&"sps-option-list--has-special-action",b),Dr=$(q||"sps-option-list__options",i&&"sps-option-list__options--tall"),xt=r.useCallback(()=>{z||(ee(!0),Ve.current&&Ve.current.focus(),Q(-1),H&&H(!0))},[z,H]),jt=r.useCallback(()=>{z&&(ee(!1),Q(-1),H&&H(!1))},[z,H]),yt=r.useCallback((se,ce)=>{ce||se&&!se.disabled&&(typeof se.value=="function"?(se.value(),y&&y()):typeof U=="function"&&U(se.value),R||jt())},[U,jt]),fo=r.useCallback((se,ce,ke)=>{se.stopPropagation(),yt(ce,ke)},[yt]),ae=r.useRef(a||[]);ae.current=a||[];const we=r.useCallback(se=>{switch(se.key){case"Tab":case"Escape":jt();break;case"Enter":if(W>-1){const ce=de[W]||J;se.preventDefault();const ke=!!ce&&Oi(ae.current,o||"",ce);!ke&&ce&&typeof U=="function"&&typeof ce.value=="function"?ce.value():ce&&yt(ce,ke)}break;case"Up":case"ArrowUp":{let ce=W;xe?W<=-1?ce=de.length-1:W===0?M&&(ce=de.length):W<de.length&&(ce=W-1):W>-1&&(ce=W-1),ce!==W&&(se.preventDefault(),Q(ce));break}case"Down":case"ArrowDown":{xt();let ce=W;xe?W!==-1&&(W>=de.length?ce=0:W===de.length-1?ce=-1:ce=W+1):W<de.length-1+ +!!M&&(ce=W+1),ce!==W&&(se.preventDefault(),Q(ce));break}default:xt()}},[jt,xt,W,yt,U,xe,de]),Ke=r.useCallback(se=>{xt();const ce=de.findIndex(ke=>{if(ke.textKey){const Tt=ke.textKey;return ke.value[Tt].toLowerCase().charAt([0])===se.key.toLocaleLowerCase()}return ke.value.toString().toLowerCase().charAt([0])===se.key.toLocaleLowerCase()});ce>-1&&Q(ce)},[de]),Ye=r.useCallback(se=>{se&&(sf.includes(se.key)?we(se):Fr.includes(se.key)&&!u&&Ke(se))},[jt,xt,W,yt,U,xe,de]);r.useEffect(()=>{if($e!==null&&document.getElementsByClassName("sps-modal__body").length>0){const se=()=>{H&&H(!1)},ce=document.getElementsByClassName("sps-modal__body")[0];return ce.addEventListener("scroll",se),()=>{ce.removeEventListener("scroll",se)}}},[]),r.useEffect(()=>{z&&ge.current&&af(ge.current,{scrollMode:"if-needed",block:"nearest",inline:"nearest"})},[W,z]),r.useEffect(()=>{ee(L),L?Ve.current&&Ve.current.focus():Q(-1)},[L]),r.useEffect(()=>{_&&Ye(_)},[_]),r.useEffect(()=>{!z&&ue.current&&(p&&_e.value&&p(new Lt({value:""})),oe({value:""}),ue.current.scrollTop=0),z&&X&&X(xe)},[z]);const Ie=k?k/16:G,Et=Ie?{maxHeight:`${Ie}rem`}:{};function kt(se,ce){return ce?r.createElement(r.Fragment,null,se.split(ce).map((ke,Tt)=>ce.test(ke)?r.createElement("u",{key:Tt},ke):r.createElement(r.Fragment,{key:Tt},ke))):r.createElement(r.Fragment,null,se)}return ze(r.createElement("div",{className:mo,id:w,"aria-activedescendant":W>-1?`${w}-option-${W}`:"",tabIndex:-1,ref:me,style:mt,onMouseLeave:()=>Q(-1),"data-testid":ne,...j},ft,r.createElement("div",{className:Dr,ref:ue,"data-testid":`${ne}-options`,style:Et},!I&&!_e.pending&&c&&de.length===0&&r.createElement("div",{className:"sps-option-list__zero-state"},c),(I||_e.pending)&&r.createElement("div",{className:"sps-option-list__loading"},r.createElement(Br,null)),!I&&!_e.pending&&de.map((se,ce)=>{const ke=`${w}-option-${ce}`,Tt=lf(se.value,B,o),Nm=Oi(ae.current,o||"",se);return r.createElement("a",{key:ke,id:ke,role:C,"aria-selected":Tt,href:se.href,className:$("sps-option-list__option",se.caption&&"sps-option-list__option--has-caption",se.disabled&&"sps-option-list__option--disabled",se.bold&&"sps-option-list__option--bold",(Tt||Nm)&&"sps-option-list__option--selected",W===ce&&"sps-option-list__option--highlighted"),onClick:GC=>fo(GC,se,Nm),onMouseOver:()=>Q(ce),tabIndex:-1,ref:W===ce?ge:null,"data-testid":`${ne}-option-${ce}`},se.value&&se.value.icon&&r.createElement("i",{className:$("sps-icon","sps-option-list__option-icon",`sps-icon-${String(se.value.icon)}`)}),(!se.value||!se.value.icon&&je)&&r.createElement("span",{className:"sps-option-list__option-icon-spacer"}),r.createElement("span",null,kt(se.text,_e.replacementPattern)),se.caption&&r.createElement("div",{className:"sps-option-list__option-caption"},r.createElement("span",null,kt(se.caption,_e.replacementPattern))))})),J&&M?.label&&r.createElement("a",{className:$("sps-option-list__option","sps-option-list__special-action",W===de.length&&"sps-option-list__option--highlighted",M.disabled&&"sps-option-list__special-action--disabled"),href:J.href,target:J.href&&M.newTab?"_blank":"_self",onClick:se=>fo(se,J),onMouseOver:()=>Q(de.length),"data-testid":`${ne}-special-action`},M.icon&&r.createElement("i",{className:$("sps-icon","sps-option-list__option-icon",`sps-icon-${String(M.icon)}`)}),!M.icon&&je&&r.createElement("span",{className:"sps-option-list__option-icon-spacer"}),r.createElement("span",null,M.label))))});Object.assign(Rn,{displayName:"SpsOptionList"});function hn(e){return{key:e.key,preventDefault:()=>{}}}function cf(e,t,n=[]){return r.useMemo(()=>{function o(a){return r.createElement(e,{...a,...t},a.children)}return o},n)}function qe(e){return typeof e=="function"?e():e}const Pi=function({children:e,elements:t}){if(t.length===0)return r.createElement(r.Fragment,null,e);const[n,o]=Array.isArray(t[0])?t[0]:[t[0]];return r.createElement(n,{...o??{}},r.createElement(Pi,{elements:t.slice(1)},e))},Bi=function({children:e,providers:t=[],...n}){return r.createElement("div",{...n},r.createElement(Pi,{elements:t},e))},df=function({children:e,className:t,...n}){return r.createElement(Bi,{className:`sps-app ${t}`,...n},e)};function at(e=[],t=[]){const n=Array.isArray(e)?S.flatten(e):[e],o=t.map(s=>Array.isArray(s)?s:[s]),a=new Array(o.length+1).fill(null).map(()=>[]);for(const s of n){let i=!1;for(let l=0;l<o.length;l+=1)for(const{type:d,props:c={}}of o[l])if(s.type===d&&Object.keys(c).every(m=>c[m]===s.props[m])){i=!0,a[l].push(s);break}i||a[a.length-1].push(s)}return a}function Ri(e,t,n){const o=Object.entries(t).filter(([,s])=>typeof s!="string"&&s.deprecated).map(([s])=>s),a=o.map(s=>n[s]);r.useEffect(()=>{a.find(s=>typeof s<"u")&&console.warn(`The following prop(s) of ${e} are deprecated: ${o.join(", ")}`)},a)}function Ar(e,t){const n=E.useRef(!1);E.useEffect(()=>()=>{n.current=!1},[]),E.useEffect(()=>{if(n.current)return e();n.current=!0},t)}function $r(e,t,n){const o=r.useRef(t(...n));r.useEffect(()=>(document.addEventListener(e,o.current,{capture:!0}),()=>document.removeEventListener(e,o.current)),[]),r.useEffect(()=>{document.removeEventListener(e,o.current),o.current=t(...n),document.addEventListener(e,o.current,{capture:!0})},n)}function Fi(e,t,n){return function(a){!e.current?.contains(a.target)&&!t.current?.contains(a.target)&&n()}}function bn(e,t,n){const o=r.useRef(!1),[a,s]=r.useState(!1),i=r.useCallback(()=>{o.current?o.current=!1:s(!0)},[]),l=r.useCallback((d=!1)=>{s(!1),o.current=d,n&&n()},[]);return $r("mousedown",Fi,[e,t,l]),$r("pointerdown",Fi,[e,t,l]),{showPopup:a,doShowPopup:i,doHidePopup:l}}const Ai=e=>{const t=/(auto|scroll)/,n=(l,d)=>l.parentNode===null?d:n(l.parentNode,d.concat([l])),o=(l,d)=>getComputedStyle(l,null).getPropertyValue(d),a=l=>o(l,"overflow")+o(l,"overflow-y"),s=l=>t.test(a(l));return(l=>{if(!(l instanceof HTMLElement||l instanceof SVGElement))return;const d=n(l.parentNode,[]);for(let c=0;c<d.length;c+=1)if(s(d[c]))return d[c];return null})(e)};let Vr=0;function Fn({isOpen:e,rootRef:t}){r.useLayoutEffect(()=>{let n,o,a;if(e&&t.current){Vr+=1,n=Ai(t.current)||document.body,o=n===document.body?window.innerWidth-document.documentElement.clientWidth:n.offsetWidth-n.clientWidth,n.style.overflow="hidden";const s=window.getComputedStyle(n).paddingRight;if(n.style.paddingRight=s&&s!=="0px"?`calc(${s} + ${o}px)`:`${o}px`,n===document.body){if(a=document.getElementsByClassName("sps-navbar-container").item(0),a&&window.getComputedStyle(a).position==="fixed"){const i=window.getComputedStyle(a).paddingRight;a.style.paddingRight=i&&i!=="0px"?`calc(${i} + ${o}px)`:`${o}px`}else if(a=document.getElementsByTagName("nav").item(0)?.parentElement,a&&window.getComputedStyle(a).position==="fixed"){const l=window.getComputedStyle(a).paddingRight;a.style.paddingRight=l&&l!=="0px"?`calc(${l} + ${o}px)`:`${o}px`}}}return()=>{n&&(Vr-=1,Vr===0&&(n.style.overflow=null,n.style.paddingRight=null,a&&(a.style.paddingRight=null)))}},[e])}const pf={debounce:"number",disabled:"boolean",conformWidth:"boolean",formMeta:"SpsFormFieldMeta<string>",icon:"SpsIcon",onChange:"React.ChangeEventHandler",onSelectionChange:"(newValue: string) => void",placeholder:"string",suggestions:{type:`
|
|
2
2
|
Eventually<Iterable<string>>
|
|
3
3
|
| ((filter?: string) => Eventually<Iterable<string>>)
|
|
4
4
|
`,required:!0},textKey:"string",captionKey:"string",tallOptionList:"boolean",value:"string",zeroState:"string",loading:"boolean",maxHeightOptionListPx:"number",maxHeightOptionListRem:"number",disableOptionsMemoization:"boolean",inputNotClearable:"boolean",autoFocusOnSelection:"boolean"};function Nt({className:e,debounce:t=0,disabled:n,conformWidth:o,formControl:a,formMeta:s,onChange:i,onSelectionChange:l,icon:d,id:c,placeholder:u="",suggestions:m,unsafelyReplaceClassName:p,textKey:f,captionKey:g,tallOptionList:h,value:y="",zeroState:v,loading:b,maxHeightOptionListPx:N,maxHeightOptionListRem:w,disableOptionsMemoization:T,inputNotClearable:L,autoFocusOnSelection:R,"data-testid":_,...P}){const A=s||a,{wrapperId:U,controlId:X}=We(c,A),[H,C]=Dt({keyDown:null,opensUpward:!1}),K=r.useRef(null),B=r.useRef(null),M=r.useRef(null),{showPopup:q,doShowPopup:I,doHidePopup:D}=bn(K,M);function k(J,W,Q=!1){A&&(A.setValue(J),A.markAsDirty()),l&&Q?l(J):i&&i(W||new Lt({value:J}))}function G(J){B.current&&(B.current.value="",k("")),J.stopPropagation()}function Z(J){k(J.target.value,J)}function te(J){n||(["Up","ArrowUp","Down","ArrowDown","Enter"].indexOf(J.key)>-1&&J.preventDefault(),J.stopPropagation(),C({keyDown:hn(J)})),J.key==="Tab"&&D()}function ne(J){J?I():D()}function V(J){C({opensUpward:J})}const j=$(p||"sps-autocomplete",q&&"sps-autocomplete--open",q&&"z-stratum-dropdown",H.opensUpward&&"sps-autocomplete--opens-upward",n&&"sps-form-control--disabled",e);return r.useEffect(()=>{let J;return q&&(J=()=>{D()},window.addEventListener("resize",J)),()=>{J&&window.removeEventListener("resize",J)}},[q]),Fn({isOpen:q,rootRef:K}),r.createElement(Le,{id:U,className:j,formControl:a,formMeta:s,inputRef:B,ref:K,focusInputOnClick:!0,onClick:J=>J.nativeEvent.stopImmediatePropagation(),"data-testid":`${_}`},r.createElement("div",{className:"sps-text-input"},r.createElement("div",{className:"sps-form-control"},d&&r.createElement("i",{className:$("sps-text-input__icon","sps-icon",`sps-icon-${d}`)}),r.createElement("input",{type:"text",ref:B,value:y,className:"sps-text-input__input",placeholder:u,onFocus:I,onClick:I,onChange:Z,onKeyDown:te,disabled:n,id:X,"data-testid":`${_}__input`,...P}),y&&!n&&!L&&r.createElement("i",{"aria-label":"clear",className:"sps-icon sps-icon-x-circle sps-form-control__clear-btn",onClick:J=>G(J)}))),r.createElement(Rn,{id:`${U}_options`,ref:M,attachTo:K,isOpen:q,options:m,hideInlineSearch:!0,keyDown:H.keyDown,onOptionSelected:J=>{const W=f&&typeof J=="object"&&J!==null?J[f]??"":J;k(W,void 0,!0),R&&B.current?.focus()},onPositionFlip:V,onSelfToggle:ne,offsets:[1,0],search:y,searchDebounce:t,textKey:f,captionKey:g,tall:h,zeroState:v,loading:b,maxHeightPx:N,maxHeightRem:w,disableOptionsMemoization:T,conformWidth:o}))}Object.assign(Nt,{props:pf,displayName:"SpsAutocomplete"});const $i={basic:{label:"Basic",examples:{basic:{react:S.code`
|
|
@@ -5156,7 +5156,7 @@ Valid keys: `+JSON.stringify(Object.keys(D),null," "));var ee=z(j,Q,te,ne,V+"."
|
|
|
5156
5156
|
import { FeedbackBlockKind } from "@spscommerce/ds-shared";
|
|
5157
5157
|
`,jsx:S.code`
|
|
5158
5158
|
<SpsMicroBlock kind={FeedbackBlockKind.TIP} message="Pro Tip: Don't be a loser."/>
|
|
5159
|
-
`}}}},gE={kind:"ModalKind",size:"ModalSize",title:"string",onClose:"() => void",focusElementOnOpen:"React.MutableRefObject<HTMLElement>",fullHeight:"boolean"};function or({children:e}){return r.createElement("div",{className:"sps-modal__footer"},e)}Object.assign(or,{props:{},propTypes:{},displayName:"SpsModalFooter"});function ds({children:e,className:t,id:n,kind:o=F.ModalKind.GENERAL,size:a=F.ModalSize.SMALL,onClose:s,focusElementOnOpen:i,title:l,fullHeight:d=!1,...c}){const u=Rt(n),m=$("sps-modal","z-stratum-dialog",`sps-modal--${o}`,`sps-modal--${a}`,t),{t:p}=he.useWoodlandLanguage(),f=r.useRef(null),g=r.useRef(document.body.style.paddingRight||""),h=r.useRef(document.body.style.overflow||"");h.current==="hidden"&&(h.current="",g.current=""),r.useLayoutEffect(()=>{let w=!1;if(document.body.style.overflow!=="hidden"){const T=`${window.innerWidth-document.body.clientWidth}px`;document.body.style.paddingRight=T,document.body.style.overflow="hidden",w=!0}return()=>{w&&(document.body.style.overflow=h.current,document.body.style.paddingRight=g.current)}},[]),r.useEffect(()=>{i&&i.current?i.current.focus():f.current&&f.current.focus()},[i]);const y=r.useCallback(w=>{if(w&&w.key==="Escape"&&s&&s(),w&&w.key==="Tab"&&f.current){const T=f.current.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'),L=T[0],R=T[T.length-1];T.length===0?w.preventDefault():w.shiftKey&&w.target===L?(w.preventDefault(),R.focus()):!w.shiftKey&&w.target===R&&(w.preventDefault(),L.focus())}},[s]),[[v],b]=at(e,[{type:or}]),N={general:"Action",info:"Info",success:"Success",warning:"Warning","serious-warning":"Warning"};return r.createElement("div",{id:u.current,role:"dialog","aria-modal":!0,"aria-labelledby":`${u.current}-title`,className:m,onKeyDown:y,tabIndex:-1,ref:f},r.createElement("div",{...c,className:$("sps-modal__dialog",{"sps-modal__dialog-full-height":d})},r.createElement("div",{className:"sps-modal__titlebar"},r.createElement("div",{className:"sps-modal__title",id:`${u.current}-title`},l||p(`modal.defaultTitle.${o}`,{defaultValue:`${N[o]}`})),s&&r.createElement("div",{className:"sps-button sps-button--icon",onClick:s},r.createElement("button",{"aria-label":p("modal.close",{defaultValue:"Close modal"}),type:"button"},r.createElement("i",{className:"sps-icon sps-icon-x"})))),r.createElement("div",{className:"sps-modal__body"},r.createElement(rt.Provider,{value:{parentElementRef:f,fixed:!0}},b)),v||r.createElement("div",{className:"sps-modal__footer"},r.createElement(Ne,{kind:o===F.ModalKind.SERIOUS_WARNING?F.ButtonKind.DELETE:F.ButtonKind.KEY,onClick:s},p("modal.defaultButtonLabel",{defaultValue:"Okay"})))))}Object.assign(ds,{props:gE,displayName:"SpsModal"});const hE={title:"string",show:"boolean",closeOnEscapePressed:"boolean",onClose:"() => void",focusElementOnOpen:"React.MutableRefObject<HTMLElement>"};function ps({children:e,className:t,id:n,show:o,closeOnEscapePressed:a=!0,onClose:s,focusElementOnOpen:i,title:l,noBackground:d,...c}){const u=Rt(n),m=$("sps-slide-in-panel","z-stratum-dialog",o?"open":"",d?"no-background":"",t),{t:p}=he.useWoodlandLanguage(),f=r.useRef(null),g=r.useRef(document.body.style.paddingRight||""),h=r.useRef(document.body.style.overflow||"");h.current==="hidden"&&(h.current="",g.current=""),r.useLayoutEffect(()=>{let b=!1;if(o&&document.body.style.overflow!=="hidden"){const N=`${window.innerWidth-document.body.clientWidth}px`;document.body.style.paddingRight=N,document.body.style.overflow="hidden",b=!0}return()=>{b&&(document.body.style.overflow=h.current,document.body.style.paddingRight=g.current)}},[o]),r.useEffect(()=>{i&&i.current?i.current.focus():f.current&&f.current.focus()},[i]);const y=r.useCallback(b=>{if(a&&b&&b.key==="Escape"&&s&&s(),b&&b.key==="Tab"&&f.current){const N=f.current.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'),w=N[0],T=N[N.length-1];N.length===0?b.preventDefault():b.shiftKey&&b.target===w?(b.preventDefault(),T.focus()):!b.shiftKey&&b.target===T&&(b.preventDefault(),w.focus())}},[s]);r.useEffect(()=>(window.addEventListener("keydown",y),()=>{window.removeEventListener("keydown",y)}),[y]);const[v]=at(e);return r.createElement("div",{id:u.current,role:"dialog","aria-labelledby":`${u.current}-title`,className:m,tabIndex:-1,ref:f},r.createElement("div",{...c,className:`sps-slide-in-panel__dialog ${o?"open":""}`},r.createElement("div",{className:"sps-slide-in-panel__titlebar"},r.createElement("div",{className:"sps-slide-in-panel__title",id:`${u.current}-title`},l||p("slideInPanel.defaultTitle",{defaultValue:"Slide In Panel"})),s&&r.createElement("div",{className:"sps-button sps-button--icon",onClick:s},r.createElement("button",{"aria-label":p("slideInPanel.close",{defaultValue:"Close"}),type:"button"},r.createElement("i",{className:"sps-icon sps-icon-x"})))),r.createElement("div",{className:"sps-slide-in-panel__body"},r.createElement(rt.Provider,{value:{parentElementRef:f,fixed:!0}},v))))}Object.assign(ps,{props:hE,displayName:"SpsSlideInPanel"});const mp={generalUsage:{label:"General Usage",description:()=>r.createElement(r.Fragment,null),examples:{noCloseButton:{description:()=>r.createElement(r.Fragment,null,r.createElement("p",null,"Click on the button below to show the slide-in panel.")),react:S.code`
|
|
5159
|
+
`}}}},gE={kind:"ModalKind",size:"ModalSize",title:"string",onClose:"() => void",focusElementOnOpen:"React.MutableRefObject<HTMLElement>",fullHeight:"boolean"};function or({children:e}){return r.createElement("div",{className:"sps-modal__footer"},e)}Object.assign(or,{props:{},propTypes:{},displayName:"SpsModalFooter"});function ds({children:e,className:t,id:n,kind:o=F.ModalKind.GENERAL,size:a=F.ModalSize.SMALL,onClose:s,focusElementOnOpen:i,title:l,fullHeight:d=!1,...c}){const u=Rt(n),m=$("sps-modal","z-stratum-dialog",`sps-modal--${o}`,`sps-modal--${a}`,t),{t:p}=he.useWoodlandLanguage(),f=r.useRef(null),g=r.useRef(document.body.style.paddingRight||""),h=r.useRef(document.body.style.overflow||"");h.current==="hidden"&&(h.current="",g.current=""),r.useLayoutEffect(()=>{let w=!1;if(document.body.style.overflow!=="hidden"){const T=`${window.innerWidth-document.body.clientWidth}px`;document.body.style.paddingRight=T,document.body.style.overflow="hidden",w=!0}return()=>{w&&(document.body.style.overflow=h.current,document.body.style.paddingRight=g.current)}},[]),r.useEffect(()=>{i&&i.current?i.current.focus():f.current&&f.current.focus()},[i]);const y=r.useCallback(w=>{if(w&&w.key==="Escape"&&s&&s(),w&&w.key==="Tab"&&f.current){const T=f.current.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'),L=T[0],R=T[T.length-1];T.length===0?w.preventDefault():w.shiftKey&&w.target===L?(w.preventDefault(),R.focus()):!w.shiftKey&&w.target===R&&(w.preventDefault(),L.focus())}},[s]),[[v],b]=at(e,[{type:or}]),N={general:"Action",info:"Info",success:"Success",warning:"Warning","serious-warning":"Warning"};return r.createElement("div",{id:u.current,role:"dialog","aria-modal":!0,"aria-labelledby":`${u.current}-title`,className:m,onKeyDown:y,tabIndex:-1,ref:f,"data-react-aria-top-layer":"true"},r.createElement("div",{...c,className:$("sps-modal__dialog",{"sps-modal__dialog-full-height":d})},r.createElement("div",{className:"sps-modal__titlebar"},r.createElement("div",{className:"sps-modal__title",id:`${u.current}-title`},l||p(`modal.defaultTitle.${o}`,{defaultValue:`${N[o]}`})),s&&r.createElement("div",{className:"sps-button sps-button--icon",onClick:s},r.createElement("button",{"aria-label":p("modal.close",{defaultValue:"Close modal"}),type:"button"},r.createElement("i",{className:"sps-icon sps-icon-x"})))),r.createElement("div",{className:"sps-modal__body"},r.createElement(rt.Provider,{value:{parentElementRef:f,fixed:!0}},b)),v||r.createElement("div",{className:"sps-modal__footer"},r.createElement(Ne,{kind:o===F.ModalKind.SERIOUS_WARNING?F.ButtonKind.DELETE:F.ButtonKind.KEY,onClick:s},p("modal.defaultButtonLabel",{defaultValue:"Okay"})))))}Object.assign(ds,{props:gE,displayName:"SpsModal"});const hE={title:"string",show:"boolean",closeOnEscapePressed:"boolean",onClose:"() => void",focusElementOnOpen:"React.MutableRefObject<HTMLElement>"};function ps({children:e,className:t,id:n,show:o,closeOnEscapePressed:a=!0,onClose:s,focusElementOnOpen:i,title:l,noBackground:d,...c}){const u=Rt(n),m=$("sps-slide-in-panel","z-stratum-dialog",o?"open":"",d?"no-background":"",t),{t:p}=he.useWoodlandLanguage(),f=r.useRef(null),g=r.useRef(document.body.style.paddingRight||""),h=r.useRef(document.body.style.overflow||"");h.current==="hidden"&&(h.current="",g.current=""),r.useLayoutEffect(()=>{let b=!1;if(o&&document.body.style.overflow!=="hidden"){const N=`${window.innerWidth-document.body.clientWidth}px`;document.body.style.paddingRight=N,document.body.style.overflow="hidden",b=!0}return()=>{b&&(document.body.style.overflow=h.current,document.body.style.paddingRight=g.current)}},[o]),r.useEffect(()=>{i&&i.current?i.current.focus():f.current&&f.current.focus()},[i]);const y=r.useCallback(b=>{if(a&&b&&b.key==="Escape"&&s&&s(),b&&b.key==="Tab"&&f.current){const N=f.current.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'),w=N[0],T=N[N.length-1];N.length===0?b.preventDefault():b.shiftKey&&b.target===w?(b.preventDefault(),T.focus()):!b.shiftKey&&b.target===T&&(b.preventDefault(),w.focus())}},[s]);r.useEffect(()=>(window.addEventListener("keydown",y),()=>{window.removeEventListener("keydown",y)}),[y]);const[v]=at(e);return r.createElement("div",{id:u.current,role:"dialog","aria-labelledby":`${u.current}-title`,className:m,tabIndex:-1,ref:f,"data-react-aria-top-layer":"true"},r.createElement("div",{...c,className:`sps-slide-in-panel__dialog ${o?"open":""}`},r.createElement("div",{className:"sps-slide-in-panel__titlebar"},r.createElement("div",{className:"sps-slide-in-panel__title",id:`${u.current}-title`},l||p("slideInPanel.defaultTitle",{defaultValue:"Slide In Panel"})),s&&r.createElement("div",{className:"sps-button sps-button--icon",onClick:s},r.createElement("button",{"aria-label":p("slideInPanel.close",{defaultValue:"Close"}),type:"button"},r.createElement("i",{className:"sps-icon sps-icon-x"})))),r.createElement("div",{className:"sps-slide-in-panel__body"},r.createElement(rt.Provider,{value:{parentElementRef:f,fixed:!0}},v))))}Object.assign(ps,{props:hE,displayName:"SpsSlideInPanel"});const mp={generalUsage:{label:"General Usage",description:()=>r.createElement(r.Fragment,null),examples:{noCloseButton:{description:()=>r.createElement(r.Fragment,null,r.createElement("p",null,"Click on the button below to show the slide-in panel.")),react:S.code`
|
|
5160
5160
|
import { SpsButton, SpsSlideInPanel } from "@spscommerce/ds-react";
|
|
5161
5161
|
import { ButtonKind } from "@spscommerce/ds-shared";
|
|
5162
5162
|
function Component() {
|
|
@@ -9764,7 +9764,7 @@ ${t.join("").replace("]","\\]").replace(" ","\\s")}]+`);return e.split(n).filter
|
|
|
9764
9764
|
</>
|
|
9765
9765
|
)
|
|
9766
9766
|
}
|
|
9767
|
-
`}}}},Xw={};function ii(e){const{children:t,className:n,unsafelyReplaceClassName:o,...a}=e,s=$(o||"sps-list-action-bar-container","z-stratum-bar",n);return r.createElement("div",{className:s,...a},r.createElement("div",{className:"sps-list-action-bar"},r.createElement("div",{className:"sps-list-action-bar__actions"},t)))}Object.assign(ii,{props:Xw,displayName:"SpsFocusedTaskActions"});const Zw={fullWidth:"boolean",isOpen:"boolean",onClose:"() => void"};function li(e){const{children:t,className:n,fullWidth:o,isOpen:a,onClose:s,title:i,"data-testid":l,unsafelyReplaceClassName:d,...c}=e,u=r.useRef(null),{t:m}=he.useWoodlandLanguage();r.useEffect(()=>{document.body.style.overflow=a?"hidden":""},[a]),r.useEffect(()=>()=>{document.body.style.overflow=""},[]);const p=$(d||"sps-focused-task","z-stratum-dialog",o&&"sps-focused-task--full-width",a&&"sps-focused-task--open",n),[f,g]=at(t,[{type:ii}]);return r.createElement("div",{className:p,ref:u,"data-testid":l,...c},r.createElement("div",{className:"sps-focused-task__title"},r.createElement(Ne,{className:"sps-focused-task__close-btn",kind:F.ButtonKind.ICON,icon:F.SpsIcon.X,onClick:s,title:m("focusedTask.close",{defaultValue:"Close"})})),r.createElement("div",{className:"sps-focused-task__body"},r.createElement(rt.Provider,{value:{parentElementRef:u}},a&&g)),f)}Object.assign(li,{props:Zw,displayName:"SpsFocusedTask"});const Qw={basic:{examples:{basic:{react:S.code`
|
|
9767
|
+
`}}}},Xw={};function ii(e){const{children:t,className:n,unsafelyReplaceClassName:o,...a}=e,s=$(o||"sps-list-action-bar-container","z-stratum-bar",n);return r.createElement("div",{className:s,...a},r.createElement("div",{className:"sps-list-action-bar"},r.createElement("div",{className:"sps-list-action-bar__actions"},t)))}Object.assign(ii,{props:Xw,displayName:"SpsFocusedTaskActions"});const Zw={fullWidth:"boolean",isOpen:"boolean",onClose:"() => void"};function li(e){const{children:t,className:n,fullWidth:o,isOpen:a,onClose:s,title:i,"data-testid":l,unsafelyReplaceClassName:d,...c}=e,u=r.useRef(null),{t:m}=he.useWoodlandLanguage();r.useEffect(()=>{document.body.style.overflow=a?"hidden":""},[a]),r.useEffect(()=>()=>{document.body.style.overflow=""},[]);const p=$(d||"sps-focused-task","z-stratum-dialog",o&&"sps-focused-task--full-width",a&&"sps-focused-task--open",n),[f,g]=at(t,[{type:ii}]);return r.createElement("div",{className:p,ref:u,"data-testid":l,"data-react-aria-top-layer":"true",...c},r.createElement("div",{className:"sps-focused-task__title"},r.createElement(Ne,{className:"sps-focused-task__close-btn",kind:F.ButtonKind.ICON,icon:F.SpsIcon.X,onClick:s,title:m("focusedTask.close",{defaultValue:"Close"})})),r.createElement("div",{className:"sps-focused-task__body"},r.createElement(rt.Provider,{value:{parentElementRef:u}},a&&g)),f)}Object.assign(li,{props:Zw,displayName:"SpsFocusedTask"});const Qw={basic:{examples:{basic:{react:S.code`
|
|
9768
9768
|
import {
|
|
9769
9769
|
SpsButton,
|
|
9770
9770
|
SpsFocusedTask,
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spscommerce/ds-react",
|
|
3
3
|
"description": "SPS Design System React components",
|
|
4
|
-
"version": "8.45.
|
|
4
|
+
"version": "8.45.6",
|
|
5
5
|
"author": "SPS Commerce",
|
|
6
6
|
"license": "UNLICENSED",
|
|
7
7
|
"repository": "https://github.com/spscommerce/woodland/tree/main/packages/@spscommerce/ds-react",
|
|
@@ -46,12 +46,12 @@
|
|
|
46
46
|
"moment-timezone": "^0.6.0",
|
|
47
47
|
"react": "^16.14.0 || ^17.0.0 || ^18.0.0 || ^19.0.0",
|
|
48
48
|
"react-dom": "^16.14.0 || ^17.0.0 || ^18.0.0 || ^19.0.0",
|
|
49
|
-
"@sps-woodland/illustrations": "8.45.
|
|
50
|
-
"@sps-woodland/tabs": "8.45.
|
|
51
|
-
"@spscommerce/ds-colors": "8.45.
|
|
52
|
-
"@spscommerce/ds-shared": "8.45.
|
|
53
|
-
"@spscommerce/i18n": "8.45.
|
|
54
|
-
"@spscommerce/positioning": "8.45.
|
|
49
|
+
"@sps-woodland/illustrations": "8.45.6",
|
|
50
|
+
"@sps-woodland/tabs": "8.45.6",
|
|
51
|
+
"@spscommerce/ds-colors": "8.45.6",
|
|
52
|
+
"@spscommerce/ds-shared": "8.45.6",
|
|
53
|
+
"@spscommerce/i18n": "8.45.6",
|
|
54
|
+
"@spscommerce/positioning": "8.45.6"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
57
|
"@react-stately/collections": "3.12.10",
|
|
@@ -71,13 +71,13 @@
|
|
|
71
71
|
"raf-stub": "3.0.0",
|
|
72
72
|
"react": "16.14.0",
|
|
73
73
|
"react-dom": "16.14.0",
|
|
74
|
-
"@sps-woodland/illustrations": "8.45.
|
|
75
|
-
"@sps-woodland/tabs": "8.45.
|
|
76
|
-
"@spscommerce/ds-colors": "8.45.
|
|
77
|
-
"@spscommerce/ds-shared": "8.45.
|
|
78
|
-
"@spscommerce/i18n": "8.45.
|
|
79
|
-
"@spscommerce/positioning": "8.45.
|
|
80
|
-
"test": "8.45.
|
|
74
|
+
"@sps-woodland/illustrations": "8.45.6",
|
|
75
|
+
"@sps-woodland/tabs": "8.45.6",
|
|
76
|
+
"@spscommerce/ds-colors": "8.45.6",
|
|
77
|
+
"@spscommerce/ds-shared": "8.45.6",
|
|
78
|
+
"@spscommerce/i18n": "8.45.6",
|
|
79
|
+
"@spscommerce/positioning": "8.45.6",
|
|
80
|
+
"test": "8.45.6"
|
|
81
81
|
},
|
|
82
82
|
"scripts": {
|
|
83
83
|
"build": "pnpm run build:js && pnpm run build:types",
|