@ebay/ui-core-react 8.17.2 → 8.17.3
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/ebay-date-textbox/index.js +1 -1
- package/ebay-filter-input/index.js +1 -1
- package/ebay-listbox/README.md +1 -0
- package/ebay-listbox/index.js +1 -1
- package/ebay-listbox/listbox-option.d.ts +1 -0
- package/ebay-listbox/listbox-option.d.ts.map +1 -1
- package/ebay-listbox/listbox.d.ts +1 -0
- package/ebay-listbox/listbox.d.ts.map +1 -1
- package/ebay-listbox-button/README.md +15 -14
- package/ebay-listbox-button/index.js +1 -1
- package/ebay-listbox-button/listbox-button-option.d.ts +1 -0
- package/ebay-listbox-button/listbox-button-option.d.ts.map +1 -1
- package/ebay-listbox-button/listbox-button.d.ts +1 -0
- package/ebay-listbox-button/listbox-button.d.ts.map +1 -1
- package/ebay-number-input/index.js +1 -1
- package/ebay-phone-input/index.js +1 -1
- package/ebay-phone-input/mask.d.ts +20 -5
- package/ebay-phone-input/mask.d.ts.map +1 -1
- package/ebay-phone-input/phone-input.d.ts +1 -0
- package/ebay-phone-input/phone-input.d.ts.map +1 -1
- package/ebay-textbox/index.js +1 -1
- package/ebay-textbox/textbox.d.ts.map +1 -1
- package/listbox-button-Dx-GGxsh.js +2 -0
- package/package.json +1 -1
- package/textbox-DAip4ToD.js +1 -0
- package/listbox-button-lokrqNk6.js +0 -2
- package/textbox-5DvabGMY.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const K=require("../tslib.es6-C4EgNkz1.js"),n=require("react"),x=require("makeup-expander"),Q=require("classnames"),X=require("../utils-C9NL3q0j.js"),b=require("../calendar-B6lRC_bC.js"),l=require("../textbox-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const K=require("../tslib.es6-C4EgNkz1.js"),n=require("react"),x=require("makeup-expander"),Q=require("classnames"),X=require("../utils-C9NL3q0j.js"),b=require("../calendar-B6lRC_bC.js"),l=require("../textbox-DAip4ToD.js");require("../icon-I30uh1Ov.js");const Z=require("../dropdown-B6wMNyjP.js"),$=require("../icons/ebay-icon-calendar-24/index.js"),{default:ee=x}=x?.default?.__esModule?x.default:x,te=600,ne=y=>{var{className:R,inputPlaceholderText:i="YYYY-MM-DD",a11yOpenPopoverText:N="open calendar",range:o,value:v,rangeEnd:S,defaultValue:q,defaultRangeEnd:D,collapseOnSelect:w,children:M,onChange:p=()=>{},onInputChange:A=()=>{},onInputRangeEndChange:L=()=>{}}=y,j=K.__rest(y,["className","inputPlaceholderText","a11yOpenPopoverText","range","value","rangeEnd","defaultValue","defaultRangeEnd","collapseOnSelect","children","onChange","onInputChange","onInputRangeEndChange"]);const m=n.useRef(null),[V,d]=n.useState(q||""),[B,u]=n.useState(D||""),f=l.isControlled(v)?v:V,T=l.isControlled(S)?S:B,s=b.dateArgToISO(f),c=b.dateArgToISO(T),[C,I]=n.useState(!1),[Y,z]=n.useState(1),E=X.filterByType(M,l.EbayTextbox),_=o?E[1]||n.createElement(l.EbayTextbox,null):E[0]||n.createElement(l.EbayTextbox,null),F=o?E[0]||n.createElement(l.EbayTextbox,null):E[1]||n.createElement(l.EbayTextbox,null),{overlayStyles:H,refs:h}=Z.useFloatingDropdown({open:C}),g=h.host,W=()=>{I(!0)},k=()=>{I(!1)};n.useEffect(()=>{if(!g.current)return;m.current=new ee(g.current,{hostSelector:".ebay-date-textbox--main > .icon-btn",contentSelector:".date-textbox__popover",expandOnClick:!0,autoCollapse:!0}),g.current.addEventListener("expander-expand",W),g.current.addEventListener("expander-collapse",k);const e=()=>{z(document.documentElement.clientWidth<te?1:2)};return e(),window.addEventListener("resize",e),()=>{var t;(t=m.current)===null||t===void 0||t.destroy(),window.removeEventListener("resize",e)}},[]);const O=(e,t)=>{const r=new Date(e.target.value),a=isNaN(r.getTime())?null:b.toISO(r);t===0?d(a||""):u(a||""),o?p(e,{rangeStart:t===0?a:s,rangeEnd:t===1?a:c}):p(e,{selected:a})},U=(e,{iso:t})=>{if(d(t),o){const r=s||c,a={rangeStart:t,rangeEnd:r};s&&c?(u(""),a.rangeEnd=null):r&&(r<t?(d(r),u(t),a.rangeStart=r,a.rangeEnd=t):(d(t),u(r),a.rangeStart=t,a.rangeEnd=r)),p(e,a)}else p(e,{selected:t});w&&(m.current.expanded=!1)},P=(e,t)=>{t===0?(d(e.target.value),A(e)):(u(e.target.value),L(e))},[G,J]=Array.isArray(i)?i:[i,i];return n.createElement("span",{className:Q("date-textbox",R),ref:h.setHost},o&&n.cloneElement(F,{value:f,placeholder:G,onInputChange:e=>P(e,0),onBlur:e=>O(e,0)}),n.cloneElement(_,Object.assign(Object.assign({},_.props),{className:"ebay-date-textbox--main",placeholder:J,value:o?T:f,onInputChange:e=>P(e,o?1:0),onBlur:e=>O(e,o?1:0)}),n.createElement(l.EbayTextboxPostfixIcon,{icon:n.createElement($.EbayIconCalendar24,null),buttonAriaLabel:N})),n.createElement("div",{hidden:!C,ref:h.setOverlay,style:H,className:"date-textbox__popover"},n.createElement(b.EbayCalendar,Object.assign({},j,{range:o,interactive:!0,navigable:!0,numMonths:Y,selected:s&&c?[s,c]:s||c||void 0,onSelect:U}))))};exports.EbayDateTextbox=ne;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const q=require("../tslib.es6-C4EgNkz1.js"),z=require("classnames"),e=require("react"),o=require("../textbox-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const q=require("../tslib.es6-C4EgNkz1.js"),z=require("classnames"),e=require("react"),o=require("../textbox-DAip4ToD.js"),N=require("../icons/ebay-icon-search-16/index.js"),_=require("../icons/ebay-icon-clear-16/index.js"),b=["large","small"],T=r=>{var{size:t,a11yClearButton:s,a11yControlsId:d,onClear:p=()=>{},className:f,placeholder:y="Filter",value:c,defaultValue:C,onInputChange:n,inputRef:m}=r,I=q.__rest(r,["size","a11yClearButton","a11yControlsId","onClear","className","placeholder","value","defaultValue","onInputChange","inputRef"]);const l=c!==void 0,[E,i]=e.useState(C||""),x=l?c:E,h=t&&b.includes(t)?t==="small"?"default":"large":void 0,v=(a,{value:u})=>{l||i(u),n&&n(a,{value:u})},g=a=>{l||i(""),n&&n(a,{value:""}),p(a,{value:""})},S=z("filter-input",t&&b.includes(t)&&`filter-input--${t}`,f);return e.createElement("span",{className:S},e.createElement(o.EbayTextbox,Object.assign({},I,{inputRef:m,value:x,onInputChange:v,fluid:!0,type:"search","aria-controls":d,placeholder:y,inputSize:h}),e.createElement(o.EbayTextboxPrefixIcon,{icon:e.createElement(N.EbayIconSearch16,null)}),s&&e.createElement(o.EbayTextboxPostfixIcon,{icon:e.createElement(_.EbayIconClear16,null),buttonAriaLabel:s,className:"filter-input__clear-btn",onClick:a=>g(a)})))};exports.EbayFilterInput=T;
|
package/ebay-listbox/README.md
CHANGED
|
@@ -43,6 +43,7 @@ import "@ebay/skin/listbox.css";
|
|
|
43
43
|
| `listSelection` | string | No | If `manual`, the user will need to press enter to select an item using the keyboard. Otherwise, `auto` will automatically select as the user presses up/down. |
|
|
44
44
|
| `typeaheadTimeoutLength` | number | No | Timeout length to pass to typeahead. |
|
|
45
45
|
| `maxHeight` | string | No | Example: 100px, 200px, 10rem. |
|
|
46
|
+
| `a11ySelectedText` | string | No | Accessible text for selected option. Default is "selected". |
|
|
46
47
|
|
|
47
48
|
### EbayListboxOption
|
|
48
49
|
|
package/ebay-listbox/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const I=require("../tslib.es6-C4EgNkz1.js"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const I=require("../tslib.es6-C4EgNkz1.js"),e=require("react"),H=require("makeup-active-descendant"),K=require("makeup-prevent-scroll-keys"),x=require("makeup-typeahead"),_=require("classnames"),S=require("../utils-C9NL3q0j.js"),B=require("../scroll-OgAngNzq.js"),F=require("../icons/ebay-icon-tick-16/index.js");function z(s){const a=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(s){for(const l in s)if(l!=="default"){const u=Object.getOwnPropertyDescriptor(s,l);Object.defineProperty(a,l,u.get?u:{enumerable:!0,get:()=>s[l]})}}return a.default=s,Object.freeze(a)}const L=z(K),k=s=>{var{children:a,className:l}=s,u=I.__rest(s,["children","className"]);return e.createElement("div",Object.assign({className:_("listbox__description",l)},u),a)},j=s=>{var{className:a,icon:l,text:u,children:m,disabled:y,tabIndex:g,selected:o,a11ySelectedText:E="selected"}=s,N=I.__rest(s,["className","icon","text","children","disabled","tabIndex","selected","a11ySelectedText"]);const r=S.filterByType(m,k),f=u||(r?.length?"":m);return e.createElement("div",Object.assign({},N,{tabIndex:y?-1:g,className:_("listbox__option",a),"aria-disabled":y,"aria-selected":o,role:"option"}),l?e.createElement("span",{className:"listbox__value"},l,f?e.createElement("span",null,f):null,r?.length?r:null,o&&e.createElement("span",{className:"clipped"},E)):e.createElement(e.Fragment,null,e.createElement("span",{className:"listbox__value"},f,o&&e.createElement("span",{className:"clipped"},E)),r?.length?r:null),e.createElement(F.EbayIconTick16,null))},{default:G=x}=x?.default?.__esModule?x.default:x,U=1300,Y=s=>{var a,{name:l,className:u,disabled:m,children:y,tabIndex:g=0,listSelection:o,maxHeight:E,typeaheadTimeoutLength:N,selectClassName:r,a11ySelectedText:f,onChange:q=()=>{},onEscape:R=()=>{}}=s,w=I.__rest(s,["name","className","disabled","children","tabIndex","listSelection","maxHeight","typeaheadTimeoutLength","selectClassName","a11ySelectedText","onChange","onEscape"]);const d=S.filterByType(y,j),T=d.findIndex(n=>n.props.selected),[p,C]=e.useState(d.findIndex(n=>n.props.selected));e.useEffect(()=>{T!==p&&C(T)},[T]);const c=e.useRef(null),b=e.useRef(null),v=e.useRef(null),h=e.useRef(!1);function O(n,t,i){t===p||d[t].props.disabled||(C(t),q(n,{index:t,selected:[d[t].props.value],wasClicked:i}))}function M(n){switch(n.code){case"Esc":case"Escape":R();break;case"Space":case"Enter":O(n,b.current.index,!1);break}const t=v.current.getIndex(c.current.children,n.key,N||U);if(t!==-1){b.current.index=t;const i=c.current.querySelectorAll("[role=option]")[t];c.current.scrollTop=i.offsetTop-c.current.offsetHeight/2}}function P(){h.current=!0}return e.useEffect(()=>{const n=t=>{const i=parseInt(t.detail.toIndex,10),D=c.current?c.current.querySelectorAll("[role=option]")[p]:null,A=h.current;B.scroll(D),h.current&&(h.current=!1),O(t,i,A)};if(d.length&&!m){const t=c.current,i=c.current;b.current=H.createLinear(t,i,i,".listbox__option[role=option]",{activeDescendantClassName:"listbox__option--active",autoInit:p,autoReset:null,autoScroll:o!=="auto"}),L.add(t),v.current=G()}return o==="auto"&&c.current.addEventListener("activeDescendantChange",n),()=>{b.current&&(b.current.reset(),b.current.destroy(),b.current=void 0),v.current&&(v.current.destroy(),v.current=void 0),c.current&&(c.current.removeEventListener("activeDescendantChange",n),L.remove(c.current))}},[p,m,o]),e.createElement(e.Fragment,null,e.createElement("div",Object.assign({},w,{tabIndex:g,ref:c,role:"listbox",onKeyDown:o!=="auto"?M:void 0,className:_("listbox__options",u),style:{maxHeight:E}}),d.map((n,t)=>e.cloneElement(n,Object.assign(Object.assign({key:n.props.value||t},n.props),{onMouseDown:o==="auto"?P:void 0,onClick:i=>{o!=="auto"&&O(i,t,!0)},selected:t===p,a11ySelectedText:f})))),e.createElement("select",{hidden:!0,className:_("listbox__native",r),name:l,disabled:m,value:(a=d[p])===null||a===void 0?void 0:a.props.value,onChange:(()=>{})},d.map((n,t)=>e.createElement("option",{key:n.props.value||t,value:n.props.value,disabled:n.props.disabled}))))};exports.EbayListbox=Y;exports.EbayListboxOption=j;exports.EbayListboxOptionDescription=k;
|
|
@@ -5,6 +5,7 @@ export type EbayListboxOptionProps = ComponentProps<"div"> & {
|
|
|
5
5
|
value: string;
|
|
6
6
|
disabled?: boolean;
|
|
7
7
|
selected?: boolean;
|
|
8
|
+
a11ySelectedText?: string;
|
|
8
9
|
};
|
|
9
10
|
export declare const EbayListboxOption: FC<EbayListboxOptionProps>;
|
|
10
11
|
//# sourceMappingURL=listbox-option.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"listbox-option.d.ts","sourceRoot":"","sources":["../../src/ebay-listbox/listbox-option.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,cAAc,EAAE,EAAE,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAMhE,MAAM,MAAM,sBAAsB,GAAG,cAAc,CAAC,KAAK,CAAC,GAAG;IACzD,IAAI,CAAC,EAAE,YAAY,CAAC;IACpB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"listbox-option.d.ts","sourceRoot":"","sources":["../../src/ebay-listbox/listbox-option.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,cAAc,EAAE,EAAE,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAMhE,MAAM,MAAM,sBAAsB,GAAG,cAAc,CAAC,KAAK,CAAC,GAAG;IACzD,IAAI,CAAC,EAAE,YAAY,CAAC;IACpB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC7B,CAAC;AAEF,eAAO,MAAM,iBAAiB,EAAE,EAAE,CAAC,sBAAsB,CA0CxD,CAAC"}
|
|
@@ -14,6 +14,7 @@ export type EbayListboxProps = Omit<ComponentProps<"div">, "onChange"> & {
|
|
|
14
14
|
typeaheadTimeoutLength?: number;
|
|
15
15
|
maxHeight?: string | number;
|
|
16
16
|
selectClassName?: string;
|
|
17
|
+
a11ySelectedText?: string;
|
|
17
18
|
onChange?: EbayChangeEventHandler<HTMLSpanElement, ChangeEventProps>;
|
|
18
19
|
onEscape?: () => void;
|
|
19
20
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"listbox.d.ts","sourceRoot":"","sources":["../../src/ebay-listbox/listbox.tsx"],"names":[],"mappings":"AAAA,OAAc,EAA6B,EAAE,EAAwC,MAAM,OAAO,CAAC;AAKnG,OAAO,EAAE,cAAc,EAAE,SAAS,EAAoB,MAAM,OAAO,CAAC;AAGpE,OAAO,EAAE,sBAAsB,EAAE,MAAM,WAAW,CAAC;AAInD,MAAM,MAAM,gBAAgB,GAAG;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,UAAU,EAAE,OAAO,CAAC;CACvB,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE,UAAU,CAAC,GAAG;IACrE,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,EAAE,SAAS,CAAC;IACpB,aAAa,CAAC,EAAE,MAAM,GAAG,QAAQ,CAAC;IAClC,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC5B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,EAAE,sBAAsB,CAAC,eAAe,EAAE,gBAAgB,CAAC,CAAC;IACrE,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;CACzB,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,EAAE,CAAC,gBAAgB,
|
|
1
|
+
{"version":3,"file":"listbox.d.ts","sourceRoot":"","sources":["../../src/ebay-listbox/listbox.tsx"],"names":[],"mappings":"AAAA,OAAc,EAA6B,EAAE,EAAwC,MAAM,OAAO,CAAC;AAKnG,OAAO,EAAE,cAAc,EAAE,SAAS,EAAoB,MAAM,OAAO,CAAC;AAGpE,OAAO,EAAE,sBAAsB,EAAE,MAAM,WAAW,CAAC;AAInD,MAAM,MAAM,gBAAgB,GAAG;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,UAAU,EAAE,OAAO,CAAC;CACvB,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE,UAAU,CAAC,GAAG;IACrE,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,EAAE,SAAS,CAAC;IACpB,aAAa,CAAC,EAAE,MAAM,GAAG,QAAQ,CAAC;IAClC,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC5B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,EAAE,sBAAsB,CAAC,eAAe,EAAE,gBAAgB,CAAC,CAAC;IACrE,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;CACzB,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,EAAE,CAAC,gBAAgB,CAmM5C,CAAC"}
|
|
@@ -44,20 +44,21 @@ yarn add @ebay/ui-core-react
|
|
|
44
44
|
|
|
45
45
|
## Attributes
|
|
46
46
|
|
|
47
|
-
| Name
|
|
48
|
-
|
|
|
49
|
-
| `value`
|
|
50
|
-
| `selected`
|
|
51
|
-
| `aria-disabled`
|
|
52
|
-
| `aria-invalid`
|
|
53
|
-
| `fluid`
|
|
54
|
-
| `borderless`
|
|
55
|
-
| `maxHeight`
|
|
56
|
-
| `prefixId`
|
|
57
|
-
| `prefixLabel`
|
|
58
|
-
| `floatingLabel`
|
|
59
|
-
| `unselectedText`
|
|
60
|
-
| `strategy`
|
|
47
|
+
| Name | Type | Required | Description |
|
|
48
|
+
| ------------------ | ------- | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
49
|
+
| `value` | string | No | Allows you to set the selected option to the one with `value` |
|
|
50
|
+
| `selected` | number | No | Allows you to set the selected index option to `selected` |
|
|
51
|
+
| `aria-disabled` | boolean | No | Set to true if the field is disabled |
|
|
52
|
+
| `aria-invalid` | boolean | No | Set to true if the field is invalid |
|
|
53
|
+
| `fluid` | boolean | No | To make the listbox fluid |
|
|
54
|
+
| `borderless` | boolean | No | To make the listbox borderless |
|
|
55
|
+
| `maxHeight` | string | No | example: 100px, 200px, 10rem |
|
|
56
|
+
| `prefixId` | string | No | The id of an external element to use as the a11y prefix label for the listbox button. |
|
|
57
|
+
| `prefixLabel` | string | No | The label to add before selected option on the button. Cannot be used with `prefixId` |
|
|
58
|
+
| `floatingLabel` | string | No | Indicates that the listbox is a floating label type and renders it with a label |
|
|
59
|
+
| `unselectedText` | string | No | The text to be shown when no options are selected. Default is '-'. Cannot be used with `floating-label` |
|
|
60
|
+
| `strategy` | string | No | Swap between `fixed` and `absolute` positioning strategy. Use `fixed` when dropdown is in contained in an overflow and needs to be visible as you scroll the screen. |
|
|
61
|
+
| `a11ySelectedText` | string | No | Accessible text for selected option. Default is "selected". |
|
|
61
62
|
|
|
62
63
|
## Callbacks
|
|
63
64
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("../listbox-button-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("../listbox-button-Dx-GGxsh.js");exports.EbayListboxButton=t.ListboxButton;exports.EbayListboxButtonOption=t.ListboxOption;
|
|
@@ -5,6 +5,7 @@ export type EbayListboxButtonOptionProps = ComponentProps<"input"> & {
|
|
|
5
5
|
icon?: ReactNode;
|
|
6
6
|
onClick?: (event: MouseEvent<HTMLDivElement>, value: ComponentProps<"input">["value"], index: number) => void;
|
|
7
7
|
innerRef?: RefObject<HTMLDivElement> | RefCallback<HTMLDivElement>;
|
|
8
|
+
a11ySelectedText?: string;
|
|
8
9
|
};
|
|
9
10
|
declare const ListboxOption: FC<EbayListboxButtonOptionProps>;
|
|
10
11
|
export default ListboxOption;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"listbox-button-option.d.ts","sourceRoot":"","sources":["../../src/ebay-listbox-button/listbox-button-option.tsx"],"names":[],"mappings":"AAEA,OAAc,EAAE,cAAc,EAAE,EAAE,EAAE,UAAU,EAAE,SAAS,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAIjG,MAAM,MAAM,4BAA4B,GAAG,cAAc,CAAC,OAAO,CAAC,GAAG;IACjE,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,UAAU,CAAC,cAAc,CAAC,EAAE,KAAK,EAAE,cAAc,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAC9G,QAAQ,CAAC,EAAE,SAAS,CAAC,cAAc,CAAC,GAAG,WAAW,CAAC,cAAc,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"listbox-button-option.d.ts","sourceRoot":"","sources":["../../src/ebay-listbox-button/listbox-button-option.tsx"],"names":[],"mappings":"AAEA,OAAc,EAAE,cAAc,EAAE,EAAE,EAAE,UAAU,EAAE,SAAS,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAIjG,MAAM,MAAM,4BAA4B,GAAG,cAAc,CAAC,OAAO,CAAC,GAAG;IACjE,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,UAAU,CAAC,cAAc,CAAC,EAAE,KAAK,EAAE,cAAc,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAC9G,QAAQ,CAAC,EAAE,SAAS,CAAC,cAAc,CAAC,GAAG,WAAW,CAAC,cAAc,CAAC,CAAC;IACnE,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC7B,CAAC;AAEF,QAAA,MAAM,aAAa,EAAE,EAAE,CAAC,4BAA4B,CAkCnD,CAAC;AAEF,eAAe,aAAa,CAAC"}
|
|
@@ -16,6 +16,7 @@ export type EbayListboxButtonProps = Omit<ComponentProps<"button">, "onChange">
|
|
|
16
16
|
split?: "none" | "start" | "end";
|
|
17
17
|
strategy?: "absolute" | "fixed";
|
|
18
18
|
unselectedText?: string;
|
|
19
|
+
a11ySelectedText?: string;
|
|
19
20
|
onChange?: EbayChangeEventHandler<HTMLButtonElement, ChangeEventProps>;
|
|
20
21
|
onCollapse?: () => void;
|
|
21
22
|
onExpand?: () => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"listbox-button.d.ts","sourceRoot":"","sources":["../../src/ebay-listbox-button/listbox-button.tsx"],"names":[],"mappings":"AAAA,OAAc,EAMV,cAAc,EACd,EAAE,EAKL,MAAM,OAAO,CAAC;AAEf,OAAO,EAAE,sBAAsB,EAAO,MAAM,6BAA6B,CAAC;AAM1E,MAAM,MAAM,gBAAgB,GAAG;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,UAAU,EAAE,OAAO,CAAC;CACvB,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,EAAE,UAAU,CAAC,GAAG;IAC9E,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,KAAK,CAAC;IACjC,QAAQ,CAAC,EAAE,UAAU,GAAG,OAAO,CAAC;IAChC,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,EAAE,sBAAsB,CAAC,iBAAiB,EAAE,gBAAgB,CAAC,CAAC;IACvE,UAAU,CAAC,EAAE,MAAM,IAAI,CAAC;IACxB,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;CACzB,CAAC;AAEF,QAAA,MAAM,aAAa,EAAE,EAAE,CAAC,sBAAsB,
|
|
1
|
+
{"version":3,"file":"listbox-button.d.ts","sourceRoot":"","sources":["../../src/ebay-listbox-button/listbox-button.tsx"],"names":[],"mappings":"AAAA,OAAc,EAMV,cAAc,EACd,EAAE,EAKL,MAAM,OAAO,CAAC;AAEf,OAAO,EAAE,sBAAsB,EAAO,MAAM,6BAA6B,CAAC;AAM1E,MAAM,MAAM,gBAAgB,GAAG;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,UAAU,EAAE,OAAO,CAAC;CACvB,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,EAAE,UAAU,CAAC,GAAG;IAC9E,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,KAAK,CAAC;IACjC,QAAQ,CAAC,EAAE,UAAU,GAAG,OAAO,CAAC;IAChC,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,EAAE,sBAAsB,CAAC,iBAAiB,EAAE,gBAAgB,CAAC,CAAC;IACvE,UAAU,CAAC,EAAE,MAAM,IAAI,CAAC;IACxB,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;CACzB,CAAC;AAEF,QAAA,MAAM,aAAa,EAAE,EAAE,CAAC,sBAAsB,CAmT7C,CAAC;AAEF,eAAe,aAAa,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const A=require("../tslib.es6-C4EgNkz1.js"),t=require("react"),M=require("classnames"),d=require("../textbox-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const A=require("../tslib.es6-C4EgNkz1.js"),t=require("react"),M=require("classnames"),d=require("../textbox-DAip4ToD.js"),y=require("../icon-button-AJ6dtyvc.js"),S=require("../icons/ebay-icon-remove-24/index.js"),j=require("../icons/ebay-icon-delete-24/index.js"),O=require("../icons/ebay-icon-add-24/index.js"),W=v=>{const{className:x="",value:c=1,min:o=1,max:r=1/0,label:p="",a11yDeleteText:u="",onChange:I=()=>{},onInputChange:N=()=>{},onFocus:f=()=>{},onBlur:D=()=>{},onKeyDown:C=()=>{},onKeyPress:K=()=>{},onKeyUp:_=()=>{},onDeleteClick:g=()=>{},onIncrement:w=()=>{},onDecrement:B=()=>{}}=v,s=A.__rest(v,["className","value","min","max","label","a11yDeleteText","onChange","onInputChange","onFocus","onBlur","onKeyDown","onKeyPress","onKeyUp","onDeleteClick","onIncrement","onDecrement"]),q=u?1:0,[a,i]=t.useState(c??q),m=t.useRef(null),b=(n,e=0)=>{const z=u?1:0;let l=parseInt(n,10)+e;return isNaN(l)?l=z:l>r?l=r:l<o&&(l=o),l},h=n=>{if(!m.current)return;const e=m.current;e.classList.remove("number-input--increment"),e.classList.remove("number-input--decrement"),e.classList.remove("number-input--increment-disabled"),e.classList.remove("number-input--decrement-disabled"),e.offsetWidth,e.classList.add(`number-input--${n}`)},k=n=>{const e=b(a,1);h(e>=r?"increment-disabled":"increment"),i(e),w(n,{value:e}),I(n,{value:e})},P=n=>{const e=b(a,-1);h(e<=o?"decrement-disabled":"decrement"),i(e),B(n,{value:e}),I(n,{value:e})},E=n=>{const e=b(n.target.value,0);i(e),N(n,{value:e})},T=(n,e)=>{f(n,{value:Number(e.value)})},V=(n,e)=>{D(n,{value:Number(e.value)})},F=(n,e)=>{C(n,{value:Number(e.value)})},L=(n,e)=>{K(n,{value:Number(e.value)})},R=(n,e)=>{_(n,{value:Number(e.value)})},U=n=>{g(n,{value:a})};return t.createElement("span",{ref:m,className:M("number-input",u&&a===1&&"number-input--show-delete",x)},t.createElement(d.EbayTextbox,{max:r,min:o,onBlur:V,onChange:E,onFocus:T,onInputChange:E,onKeyDown:F,onKeyPress:L,onKeyUp:R,type:"number",value:a},t.createElement(d.EbayTextboxPrefixIcon,null,p&&t.createElement("label",{htmlFor:s?.id||"number-input"},p),t.createElement(y.EbayIconButton,{"aria-hidden":!0,className:"number-input__decrement",disabled:a<=o,icon:t.createElement(S.EbayIconRemove24,null),onClick:P,size:"small",tabIndex:-1,transparent:!0})),t.createElement(d.EbayTextboxPostfixIcon,null,u&&t.createElement(y.EbayIconButton,{"aria-label":u,className:"number-input__delete",icon:t.createElement(j.EbayIconDelete24,null),onClick:U,size:"small",transparent:!0}),t.createElement(y.EbayIconButton,{"aria-hidden":!0,className:"number-input__increment",disabled:a>=r,icon:t.createElement(O.EbayIconAdd24,null),onClick:k,size:"small",tabIndex:-1,transparent:!0}))))};exports.EbayNumberInput=W;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const w=require("../tslib.es6-C4EgNkz1.js"),Q=require("classnames"),d=require("react"),p=require("../listbox-button-lokrqNk6.js"),P=require("../textbox-5DvabGMY.js");require("../icon-I30uh1Ov.js");require("../icon-button-AJ6dtyvc.js");const X=require("../flag-DU-1tRv6.js"),G={AC:{countryCode:"AC",callingCode:"247",mask:"00000"},AD:{countryCode:"AD",callingCode:"376",mask:"000 000"},AE:{countryCode:"AE",callingCode:"971",mask:"000 000 0000"},AF:{countryCode:"AF",callingCode:"93",mask:"000 000 0000"},AG:{countryCode:"AG",callingCode:"1",mask:"(000) 000-0000"},AI:{countryCode:"AI",callingCode:"1",mask:"(000) 000-0000"},AL:{countryCode:"AL",callingCode:"355",mask:"000 000 0000"},AM:{countryCode:"AM",callingCode:"374",mask:"000 000000"},AO:{countryCode:"AO",callingCode:"244",mask:"000 000 000"},AR:{countryCode:"AR",callingCode:"54",mask:"000 00-0000-0000"},AS:{countryCode:"AS",callingCode:"1",mask:"(000) 000-0000"},AT:{countryCode:"AT",callingCode:"43",mask:"0000 000000"},AU:{countryCode:"AU",callingCode:"61",mask:"0000 000 000"},AW:{countryCode:"AW",callingCode:"297",mask:"000 0000"},AX:{countryCode:"AX",callingCode:"358",mask:"000 0000000"},AZ:{countryCode:"AZ",callingCode:"994",mask:"000 000 00 00"},BA:{countryCode:"BA",callingCode:"387",mask:"000 000 000"},BB:{countryCode:"BB",callingCode:"1",mask:"(000) 000-0000"},BD:{countryCode:"BD",callingCode:"880",mask:"00000-000000"},BE:{countryCode:"BE",callingCode:"32",mask:"0000 00 00 00"},BF:{countryCode:"BF",callingCode:"226",mask:"00 00 00 00"},BG:{countryCode:"BG",callingCode:"359",mask:"000 000 000"},BH:{countryCode:"BH",callingCode:"973",mask:"0000 0000"},BI:{countryCode:"BI",callingCode:"257",mask:"00 00 00 00"},BJ:{countryCode:"BJ",callingCode:"229",mask:"00 00 00 00 00"},BL:{countryCode:"BL",callingCode:"590",mask:"0000 00 00 00"},BM:{countryCode:"BM",callingCode:"1",mask:"(000) 000-0000"},BN:{countryCode:"BN",callingCode:"673",mask:"000 0000"},BO:{countryCode:"BO",callingCode:"591",mask:"00000000"},BQ:{countryCode:"BQ",callingCode:"599",mask:"000 0000"},BR:{countryCode:"BR",callingCode:"55",mask:"(00) 00000-0000"},BS:{countryCode:"BS",callingCode:"1",mask:"(000) 000-0000"},BT:{countryCode:"BT",callingCode:"975",mask:"00 00 00 00"},BW:{countryCode:"BW",callingCode:"267",mask:"00 000 000"},BY:{countryCode:"BY",callingCode:"375",mask:"0 000 000-00-00"},BZ:{countryCode:"BZ",callingCode:"501",mask:"000-0000"},CA:{countryCode:"CA",callingCode:"1",mask:"(000) 000-0000"},CC:{countryCode:"CC",callingCode:"61",mask:"0000 000 000"},CD:{countryCode:"CD",callingCode:"243",mask:"0000 000 000"},CF:{countryCode:"CF",callingCode:"236",mask:"00 00 00 00"},CG:{countryCode:"CG",callingCode:"242",mask:"00 000 0000"},CH:{countryCode:"CH",callingCode:"41",mask:"000 000 00 00"},CI:{countryCode:"CI",callingCode:"225",mask:"00 00 00 0000"},CK:{countryCode:"CK",callingCode:"682",mask:"00 000"},CL:{countryCode:"CL",callingCode:"56",mask:"(0) 0000 0000"},CM:{countryCode:"CM",callingCode:"237",mask:"0 00 00 00 00"},CN:{countryCode:"CN",callingCode:"86",mask:"000 0000 0000"},CO:{countryCode:"CO",callingCode:"57",mask:"000 0000000"},CR:{countryCode:"CR",callingCode:"506",mask:"0000 0000"},CU:{countryCode:"CU",callingCode:"53",mask:"00 0000000"},CV:{countryCode:"CV",callingCode:"238",mask:"000 00 00"},CW:{countryCode:"CW",callingCode:"599",mask:"0 000 0000"},CX:{countryCode:"CX",callingCode:"61",mask:"0000 000 000"},CY:{countryCode:"CY",callingCode:"357",mask:"00 000000"},CZ:{countryCode:"CZ",callingCode:"420",mask:"000 000 000"},DE:{countryCode:"DE",callingCode:"49",mask:"00000 0000000"},DJ:{countryCode:"DJ",callingCode:"253",mask:"00 00 00 00"},DK:{countryCode:"DK",callingCode:"45",mask:"00 00 00 00"},DM:{countryCode:"DM",callingCode:"1",mask:"(000) 000-0000"},DO:{countryCode:"DO",callingCode:"1",mask:"(000) 000-0000"},DZ:{countryCode:"DZ",callingCode:"213",mask:"0000 00 00 00"},EC:{countryCode:"EC",callingCode:"593",mask:"000 000 0000"},EE:{countryCode:"EE",callingCode:"372",mask:"0000 0000"},EG:{countryCode:"EG",callingCode:"20",mask:"000 00000000"},EH:{countryCode:"EH",callingCode:"212",mask:"0000-000000"},ER:{countryCode:"ER",callingCode:"291",mask:"00 000 000"},ES:{countryCode:"ES",callingCode:"34",mask:"000 00 00 00"},ET:{countryCode:"ET",callingCode:"251",mask:"000 000 0000"},FI:{countryCode:"FI",callingCode:"358",mask:"000 0000000"},FJ:{countryCode:"FJ",callingCode:"679",mask:"000 0000"},FK:{countryCode:"FK",callingCode:"500",mask:"00000"},FM:{countryCode:"FM",callingCode:"691",mask:"000 0000"},FO:{countryCode:"FO",callingCode:"298",mask:"000000"},FR:{countryCode:"FR",callingCode:"33",mask:"00 00 00 00 00"},GA:{countryCode:"GA",callingCode:"241",mask:"00 00 00 00"},GB:{countryCode:"GB",callingCode:"44",mask:"00000 000000"},GD:{countryCode:"GD",callingCode:"1",mask:"(000) 000-0000"},GE:{countryCode:"GE",callingCode:"995",mask:"000 00 00 00"},GF:{countryCode:"GF",callingCode:"594",mask:"0000 00 00 00"},GG:{countryCode:"GG",callingCode:"44",mask:"00000 000000"},GH:{countryCode:"GH",callingCode:"233",mask:"000 000 0000"},GI:{countryCode:"GI",callingCode:"350",mask:"00000000"},GL:{countryCode:"GL",callingCode:"299",mask:"00 00 00"},GM:{countryCode:"GM",callingCode:"220",mask:"000 0000"},GN:{countryCode:"GN",callingCode:"224",mask:"000 00 00 00"},GP:{countryCode:"GP",callingCode:"590",mask:"0000 00 00 00"},GQ:{countryCode:"GQ",callingCode:"240",mask:"000 000 000"},GR:{countryCode:"GR",callingCode:"30",mask:"000 000 0000"},GT:{countryCode:"GT",callingCode:"502",mask:"0000 0000"},GU:{countryCode:"GU",callingCode:"1",mask:"(000) 000-0000"},GW:{countryCode:"GW",callingCode:"245",mask:"000 000 000"},GY:{countryCode:"GY",callingCode:"592",mask:"000 0000"},HK:{countryCode:"HK",callingCode:"852",mask:"0000 0000"},HN:{countryCode:"HN",callingCode:"504",mask:"0000-0000"},HR:{countryCode:"HR",callingCode:"385",mask:"000 000 0000"},HT:{countryCode:"HT",callingCode:"509",mask:"00 00 0000"},HU:{countryCode:"HU",callingCode:"36",mask:"00 00 000 0000"},ID:{countryCode:"ID",callingCode:"62",mask:"0000-000-000"},IE:{countryCode:"IE",callingCode:"353",mask:"000 000 0000"},IL:{countryCode:"IL",callingCode:"972",mask:"000-000-0000"},IM:{countryCode:"IM",callingCode:"44",mask:"00000 000000"},IN:{countryCode:"IN",callingCode:"91",mask:"000000 00000"},IO:{countryCode:"IO",callingCode:"246",mask:"000 0000"},IQ:{countryCode:"IQ",callingCode:"964",mask:"0000 000 0000"},IR:{countryCode:"IR",callingCode:"98",mask:"0000 000 0000"},IS:{countryCode:"IS",callingCode:"354",mask:"000 0000"},IT:{countryCode:"IT",callingCode:"39",mask:"000 000 0000"},JE:{countryCode:"JE",callingCode:"44",mask:"00000 000000"},JM:{countryCode:"JM",callingCode:"1",mask:"(000) 000-0000"},JO:{countryCode:"JO",callingCode:"962",mask:"00 0000 0000"},JP:{countryCode:"JP",callingCode:"81",mask:"000-0000-0000"},KE:{countryCode:"KE",callingCode:"254",mask:"0000 000000"},KG:{countryCode:"KG",callingCode:"996",mask:"0000 000 000"},KH:{countryCode:"KH",callingCode:"855",mask:"000 000 000"},KI:{countryCode:"KI",callingCode:"686",mask:"00000000"},KM:{countryCode:"KM",callingCode:"269",mask:"000 00 00"},KN:{countryCode:"KN",callingCode:"1",mask:"(000) 000-0000"},KP:{countryCode:"KP",callingCode:"850",mask:"0000 000 0000"},KR:{countryCode:"KR",callingCode:"82",mask:"000-0000-0000"},KW:{countryCode:"KW",callingCode:"965",mask:"000 00000"},KY:{countryCode:"KY",callingCode:"1",mask:"(000) 000-0000"},KZ:{countryCode:"KZ",callingCode:"7",mask:"0 (000) 000 0000"},LA:{countryCode:"LA",callingCode:"856",mask:"000 00 000 000"},LB:{countryCode:"LB",callingCode:"961",mask:"00 000 000"},LC:{countryCode:"LC",callingCode:"1",mask:"(000) 000-0000"},LI:{countryCode:"LI",callingCode:"423",mask:"000 000 000"},LK:{countryCode:"LK",callingCode:"94",mask:"000 000 0000"},LR:{countryCode:"LR",callingCode:"231",mask:"000 000 0000"},LS:{countryCode:"LS",callingCode:"266",mask:"0000 0000"},LT:{countryCode:"LT",callingCode:"370",mask:"(0-000) 00000"},LU:{countryCode:"LU",callingCode:"352",mask:"000 000 000"},LV:{countryCode:"LV",callingCode:"371",mask:"00 000 000"},LY:{countryCode:"LY",callingCode:"218",mask:"000-0000000"},MA:{countryCode:"MA",callingCode:"212",mask:"0000-000000"},MC:{countryCode:"MC",callingCode:"377",mask:"00 00 00 00 00"},MD:{countryCode:"MD",callingCode:"373",mask:"0000 00 000"},ME:{countryCode:"ME",callingCode:"382",mask:"000 000 000"},MF:{countryCode:"MF",callingCode:"590",mask:"0000 00 00 00"},MG:{countryCode:"MG",callingCode:"261",mask:"000 00 000 00"},MH:{countryCode:"MH",callingCode:"692",mask:"000-0000"},MK:{countryCode:"MK",callingCode:"389",mask:"000 000 000"},ML:{countryCode:"ML",callingCode:"223",mask:"00 00 00 00"},MM:{countryCode:"MM",callingCode:"95",mask:"00 000 0000"},MN:{countryCode:"MN",callingCode:"976",mask:"0000 0000"},MO:{countryCode:"MO",callingCode:"853",mask:"0000 0000"},MP:{countryCode:"MP",callingCode:"1",mask:"(000) 000-0000"},MQ:{countryCode:"MQ",callingCode:"596",mask:"0000 00 00 00"},MR:{countryCode:"MR",callingCode:"222",mask:"00 00 00 00"},MS:{countryCode:"MS",callingCode:"1",mask:"(000) 000-0000"},MT:{countryCode:"MT",callingCode:"356",mask:"0000 0000"},MU:{countryCode:"MU",callingCode:"230",mask:"0000 0000"},MV:{countryCode:"MV",callingCode:"960",mask:"000-0000"},MW:{countryCode:"MW",callingCode:"265",mask:"0000 00 00 00"},MX:{countryCode:"MX",callingCode:"52",mask:"000 000 0000"},MY:{countryCode:"MY",callingCode:"60",mask:"000-000 0000"},MZ:{countryCode:"MZ",callingCode:"258",mask:"00 000 0000"},NA:{countryCode:"NA",callingCode:"264",mask:"000 000 0000"},NC:{countryCode:"NC",callingCode:"687",mask:"00.00.00"},NE:{countryCode:"NE",callingCode:"227",mask:"00 00 00 00"},NF:{countryCode:"NF",callingCode:"672",mask:"0 00000"},NG:{countryCode:"NG",callingCode:"234",mask:"0000 000 0000"},NI:{countryCode:"NI",callingCode:"505",mask:"0000 0000"},NL:{countryCode:"NL",callingCode:"31",mask:"00 00000000"},NO:{countryCode:"NO",callingCode:"47",mask:"00 00 00 00"},NP:{countryCode:"NP",callingCode:"977",mask:"000-0000000"},NR:{countryCode:"NR",callingCode:"674",mask:"000 0000"},NU:{countryCode:"NU",callingCode:"683",mask:"000 0000"},NZ:{countryCode:"NZ",callingCode:"64",mask:"000 000 0000"},OM:{countryCode:"OM",callingCode:"968",mask:"0000 0000"},PA:{countryCode:"PA",callingCode:"507",mask:"0000-0000"},PE:{countryCode:"PE",callingCode:"51",mask:"000 000 000"},PF:{countryCode:"PF",callingCode:"689",mask:"00 00 00 00"},PG:{countryCode:"PG",callingCode:"675",mask:"0000 0000"},PH:{countryCode:"PH",callingCode:"63",mask:"0000 000 0000"},PK:{countryCode:"PK",callingCode:"92",mask:"0000 0000000"},PL:{countryCode:"PL",callingCode:"48",mask:"000 000 000"},PM:{countryCode:"PM",callingCode:"508",mask:"000 00 00"},PR:{countryCode:"PR",callingCode:"1",mask:"(000) 000-0000"},PS:{countryCode:"PS",callingCode:"970",mask:"0000 000 000"},PT:{countryCode:"PT",callingCode:"351",mask:"000 000 000"},PW:{countryCode:"PW",callingCode:"680",mask:"000 0000"},PY:{countryCode:"PY",callingCode:"595",mask:"0000 000000"},QA:{countryCode:"QA",callingCode:"974",mask:"0000 0000"},RE:{countryCode:"RE",callingCode:"262",mask:"0000 00 00 00"},RO:{countryCode:"RO",callingCode:"40",mask:"0000 000 000"},RS:{countryCode:"RS",callingCode:"381",mask:"000 0000000"},RU:{countryCode:"RU",callingCode:"7",mask:"0 (000) 000-00-00"},RW:{countryCode:"RW",callingCode:"250",mask:"0000 000 000"},SA:{countryCode:"SA",callingCode:"966",mask:"000 000 0000"},SB:{countryCode:"SB",callingCode:"677",mask:"00 00000"},SC:{countryCode:"SC",callingCode:"248",mask:"0 000 000"},SD:{countryCode:"SD",callingCode:"249",mask:"000 000 0000"},SE:{countryCode:"SE",callingCode:"46",mask:"000-000 00 00"},SG:{countryCode:"SG",callingCode:"65",mask:"0000 0000"},SH:{countryCode:"SH",callingCode:"290",mask:"00000"},SI:{countryCode:"SI",callingCode:"386",mask:"000 000 000"},SJ:{countryCode:"SJ",callingCode:"47",mask:"00 00 00 00"},SK:{countryCode:"SK",callingCode:"421",mask:"0000 000 000"},SL:{countryCode:"SL",callingCode:"232",mask:"(000) 000000"},SM:{countryCode:"SM",callingCode:"378",mask:"00 00 00 00"},SN:{countryCode:"SN",callingCode:"221",mask:"00 000 00 00"},SO:{countryCode:"SO",callingCode:"252",mask:"0 0000000"},SR:{countryCode:"SR",callingCode:"597",mask:"000-0000"},SS:{countryCode:"SS",callingCode:"211",mask:"0000 000 000"},ST:{countryCode:"ST",callingCode:"239",mask:"000 0000"},SV:{countryCode:"SV",callingCode:"503",mask:"0000 0000"},SX:{countryCode:"SX",callingCode:"1",mask:"(000) 000-0000"},SY:{countryCode:"SY",callingCode:"963",mask:"0000 000 000"},SZ:{countryCode:"SZ",callingCode:"268",mask:"0000 0000"},TA:{countryCode:"TA",callingCode:"290",mask:"0000"},TC:{countryCode:"TC",callingCode:"1",mask:"(000) 000-0000"},TD:{countryCode:"TD",callingCode:"235",mask:"00 00 00 00"},TG:{countryCode:"TG",callingCode:"228",mask:"00 00 00 00"},TH:{countryCode:"TH",callingCode:"66",mask:"000 000 0000"},TJ:{countryCode:"TJ",callingCode:"992",mask:"00 000 0000"},TK:{countryCode:"TK",callingCode:"690",mask:"0000"},TL:{countryCode:"TL",callingCode:"670",mask:"0000 0000"},TM:{countryCode:"TM",callingCode:"993",mask:"0 00 000000"},TN:{countryCode:"TN",callingCode:"216",mask:"00 000 000"},TO:{countryCode:"TO",callingCode:"676",mask:"000 0000"},TR:{countryCode:"TR",callingCode:"90",mask:"0000 000 00 00"},TT:{countryCode:"TT",callingCode:"1",mask:"(000) 000-0000"},TV:{countryCode:"TV",callingCode:"688",mask:"00 0000"},TW:{countryCode:"TW",callingCode:"886",mask:"0000 000 000"},TZ:{countryCode:"TZ",callingCode:"255",mask:"0000 000 000"},UA:{countryCode:"UA",callingCode:"380",mask:"000 000 0000"},UG:{countryCode:"UG",callingCode:"256",mask:"0000 000000"},US:{countryCode:"US",callingCode:"1",mask:"(000) 000-0000"},UY:{countryCode:"UY",callingCode:"598",mask:"000 000 000"},UZ:{countryCode:"UZ",callingCode:"998",mask:"00 000 00 00"},VA:{countryCode:"VA",callingCode:"39",mask:"000 000 0000"},VC:{countryCode:"VC",callingCode:"1",mask:"(000) 000-0000"},VE:{countryCode:"VE",callingCode:"58",mask:"0000-0000000"},VG:{countryCode:"VG",callingCode:"1",mask:"(000) 000-0000"},VI:{countryCode:"VI",callingCode:"1",mask:"(000) 000-0000"},VN:{countryCode:"VN",callingCode:"84",mask:"0000 000 000"},VU:{countryCode:"VU",callingCode:"678",mask:"000 0000"},WF:{countryCode:"WF",callingCode:"681",mask:"00 00 00"},WS:{countryCode:"WS",callingCode:"685",mask:"00 00000"},XK:{countryCode:"XK",callingCode:"383",mask:"000 000 000"},YE:{countryCode:"YE",callingCode:"967",mask:"0000 000 000"},YT:{countryCode:"YT",callingCode:"262",mask:"0000 00 00 00"},ZA:{countryCode:"ZA",callingCode:"27",mask:"000 000 0000"},ZM:{countryCode:"ZM",callingCode:"260",mask:"000 0000000"},ZW:{countryCode:"ZW",callingCode:"263",mask:"000 000 0000"}};function q(e,l){let n=l;const c=C=>{R(e,n,e.value,C.inputType)};return e.addEventListener("input",c),{update(C,t){n=t,R(e,n,C,"")},destroy(){e.removeEventListener("input",c)},get value(){return e.value}}}function R(e,l,n,c){const C=/delete.*Backwards/.test(c),t=e.selectionStart||0,r=_(n,l);if(n!==r){e.value=r;const i=j(r,n,t,C);i!==void 0&&e.setSelectionRange(i,i)}}function h(e){return e.replace(/\D+/g,"")}function _(e,l){const n=h(e);let c="",C=0;if(n.length){for(const t of l)if(t==="0"){if(c+=n[C++],C===n.length)break}else c+=t;C<n.length&&(c+=" "+n.slice(C))}return c}function j(e,l,n,c){const C=n===l.length;if(c||!C){const t=l.slice(0,n),r=l.slice(n);if(e.startsWith(t))return n;if(e.endsWith(r))return e.length-r.length;{const i=D(t);let k=0,M=0;for(;M<i.length;)D(e[k])&&M++,k++;return k}}}function D(e){return e.replace(/[.,\\/#!$%^&*;:{}=+\-_`~()\s]/g,"")}const $=e=>e||(typeof navigator<"u"?navigator.language:"en-US"),z=e=>{var{countryCode:l,value:n,locale:c,floatingLabel:C,disabled:t,readonly:r,invalid:i,className:k,onFocus:M,onBlur:A,onChange:T,onInputChange:f,onKeyDown:I,onKeyPress:B,onKeyUp:K,onExpand:x,onCollapse:b}=e,U=w.__rest(e,["countryCode","value","locale","floatingLabel","disabled","readonly","invalid","className","onFocus","onBlur","onChange","onInputChange","onKeyDown","onKeyPress","onKeyUp","onExpand","onCollapse"]);const S=d.useMemo(()=>{const o=$(c),a=new Intl.DisplayNames([o],{type:"region"});return Object.keys(G).map(s=>{var u;return[s,(u=a.of(s))!==null&&u!==void 0?u:""]}).sort(([,s],[,u])=>s.localeCompare(u))},[c]),[L,N]=d.useState(()=>{if(l){const o=S.findIndex(([a])=>a===l.toUpperCase());return o!==-1?o:0}return 0}),E=d.useRef(null),y=d.useRef(null);d.useEffect(()=>{if(l){const o=S.findIndex(([a])=>a===l.toUpperCase());N(o!==-1?o:0)}},[l,S]);const m=(o=L)=>{const[a]=S[o];return G[a]};d.useEffect(()=>{E.current&&m()&&(y.current||(y.current=q(E.current,m().mask)),y.current.update(E.current.value,m().mask))},[m().mask]),d.useEffect(()=>()=>{y.current&&y.current.destroy()},[]);const g=o=>{var a,s;return{value:((a=y.current)===null||a===void 0?void 0:a.value)||"",rawValue:h(((s=y.current)===null||s===void 0?void 0:s.value)||""),callingCode:m(o).callingCode,countryCode:m(o).countryCode}},F=(o,{index:a})=>{N(a),T&&T(o,g(a))},O=o=>{M&&M(o,g())},v=o=>{A&&A(o,g())},H=o=>{T&&T(o,g())},W=o=>{f&&f(o,g())},Z=o=>{I&&I(o,g())},V=o=>{B&&B(o,g())},Y=o=>{K&&K(o,g())},J=S.map(([o,a],s)=>{const u=G[o];return d.createElement(p.ListboxOption,{key:o,value:`${a}-${u.callingCode}`,selected:s===L,icon:d.createElement(X.EbayFlagIcon,{flag:u.countryCode.toLowerCase()})},d.createElement("span",null,a," ( + ",u.callingCode," )"))});return d.createElement("span",Object.assign({},U,{className:Q("phone-input",k,{"phone-input--disabled":t,"phone-input--readonly":r,"phone-input--error":i})}),d.createElement(p.ListboxButton,{split:"start",disabled:r||t,onChange:F,onExpand:x,onCollapse:b},J),d.createElement(P.EbayTextbox,{type:"tel",value:n,disabled:t,floatingLabel:C,floatingLabelStatic:!0,readOnly:r,invalid:i,onBlur:v,onFocus:O,onKeyDown:Z,onKeyPress:V,onKeyUp:Y,onChange:H,onInputChange:W,ref:E},d.createElement(P.EbayTextboxPrefixText,{id:"phone-prefix"},"+ ",m().callingCode)))};exports.EbayPhoneInput=z;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e0=require("../tslib.es6-C4EgNkz1.js"),n0=require("classnames"),a=require("react"),U=require("../listbox-button-Dx-GGxsh.js"),b=require("../textbox-DAip4ToD.js");require("../icon-I30uh1Ov.js");require("../icon-button-AJ6dtyvc.js");const l0=require("../flag-DU-1tRv6.js"),G={AC:{countryCode:"AC",callingCode:"247",mask:"00000"},AD:{countryCode:"AD",callingCode:"376",mask:"000 000"},AE:{countryCode:"AE",callingCode:"971",mask:"000 000 0000"},AF:{countryCode:"AF",callingCode:"93",mask:"000 000 0000"},AG:{countryCode:"AG",callingCode:"1",mask:"(000) 000-0000"},AI:{countryCode:"AI",callingCode:"1",mask:"(000) 000-0000"},AL:{countryCode:"AL",callingCode:"355",mask:"000 000 0000"},AM:{countryCode:"AM",callingCode:"374",mask:"000 000000"},AO:{countryCode:"AO",callingCode:"244",mask:"000 000 000"},AR:{countryCode:"AR",callingCode:"54",mask:"000 00-0000-0000"},AS:{countryCode:"AS",callingCode:"1",mask:"(000) 000-0000"},AT:{countryCode:"AT",callingCode:"43",mask:"0000 000000"},AU:{countryCode:"AU",callingCode:"61",mask:"0000 000 000"},AW:{countryCode:"AW",callingCode:"297",mask:"000 0000"},AX:{countryCode:"AX",callingCode:"358",mask:"000 0000000"},AZ:{countryCode:"AZ",callingCode:"994",mask:"000 000 00 00"},BA:{countryCode:"BA",callingCode:"387",mask:"000 000 000"},BB:{countryCode:"BB",callingCode:"1",mask:"(000) 000-0000"},BD:{countryCode:"BD",callingCode:"880",mask:"00000-000000"},BE:{countryCode:"BE",callingCode:"32",mask:"0000 00 00 00"},BF:{countryCode:"BF",callingCode:"226",mask:"00 00 00 00"},BG:{countryCode:"BG",callingCode:"359",mask:"000 000 000"},BH:{countryCode:"BH",callingCode:"973",mask:"0000 0000"},BI:{countryCode:"BI",callingCode:"257",mask:"00 00 00 00"},BJ:{countryCode:"BJ",callingCode:"229",mask:"00 00 00 00 00"},BL:{countryCode:"BL",callingCode:"590",mask:"0000 00 00 00"},BM:{countryCode:"BM",callingCode:"1",mask:"(000) 000-0000"},BN:{countryCode:"BN",callingCode:"673",mask:"000 0000"},BO:{countryCode:"BO",callingCode:"591",mask:"00000000"},BQ:{countryCode:"BQ",callingCode:"599",mask:"000 0000"},BR:{countryCode:"BR",callingCode:"55",mask:"(00) 00000-0000"},BS:{countryCode:"BS",callingCode:"1",mask:"(000) 000-0000"},BT:{countryCode:"BT",callingCode:"975",mask:"00 00 00 00"},BW:{countryCode:"BW",callingCode:"267",mask:"00 000 000"},BY:{countryCode:"BY",callingCode:"375",mask:"0 000 000-00-00"},BZ:{countryCode:"BZ",callingCode:"501",mask:"000-0000"},CA:{countryCode:"CA",callingCode:"1",mask:"(000) 000-0000"},CC:{countryCode:"CC",callingCode:"61",mask:"0000 000 000"},CD:{countryCode:"CD",callingCode:"243",mask:"0000 000 000"},CF:{countryCode:"CF",callingCode:"236",mask:"00 00 00 00"},CG:{countryCode:"CG",callingCode:"242",mask:"00 000 0000"},CH:{countryCode:"CH",callingCode:"41",mask:"000 000 00 00"},CI:{countryCode:"CI",callingCode:"225",mask:"00 00 00 0000"},CK:{countryCode:"CK",callingCode:"682",mask:"00 000"},CL:{countryCode:"CL",callingCode:"56",mask:"(0) 0000 0000"},CM:{countryCode:"CM",callingCode:"237",mask:"0 00 00 00 00"},CN:{countryCode:"CN",callingCode:"86",mask:"000 0000 0000"},CO:{countryCode:"CO",callingCode:"57",mask:"000 0000000"},CR:{countryCode:"CR",callingCode:"506",mask:"0000 0000"},CU:{countryCode:"CU",callingCode:"53",mask:"00 0000000"},CV:{countryCode:"CV",callingCode:"238",mask:"000 00 00"},CW:{countryCode:"CW",callingCode:"599",mask:"0 000 0000"},CX:{countryCode:"CX",callingCode:"61",mask:"0000 000 000"},CY:{countryCode:"CY",callingCode:"357",mask:"00 000000"},CZ:{countryCode:"CZ",callingCode:"420",mask:"000 000 000"},DE:{countryCode:"DE",callingCode:"49",mask:"00000 0000000"},DJ:{countryCode:"DJ",callingCode:"253",mask:"00 00 00 00"},DK:{countryCode:"DK",callingCode:"45",mask:"00 00 00 00"},DM:{countryCode:"DM",callingCode:"1",mask:"(000) 000-0000"},DO:{countryCode:"DO",callingCode:"1",mask:"(000) 000-0000"},DZ:{countryCode:"DZ",callingCode:"213",mask:"0000 00 00 00"},EC:{countryCode:"EC",callingCode:"593",mask:"000 000 0000"},EE:{countryCode:"EE",callingCode:"372",mask:"0000 0000"},EG:{countryCode:"EG",callingCode:"20",mask:"000 00000000"},EH:{countryCode:"EH",callingCode:"212",mask:"0000-000000"},ER:{countryCode:"ER",callingCode:"291",mask:"00 000 000"},ES:{countryCode:"ES",callingCode:"34",mask:"000 00 00 00"},ET:{countryCode:"ET",callingCode:"251",mask:"000 000 0000"},FI:{countryCode:"FI",callingCode:"358",mask:"000 0000000"},FJ:{countryCode:"FJ",callingCode:"679",mask:"000 0000"},FK:{countryCode:"FK",callingCode:"500",mask:"00000"},FM:{countryCode:"FM",callingCode:"691",mask:"000 0000"},FO:{countryCode:"FO",callingCode:"298",mask:"000000"},FR:{countryCode:"FR",callingCode:"33",mask:"00 00 00 00 00"},GA:{countryCode:"GA",callingCode:"241",mask:"00 00 00 00"},GB:{countryCode:"GB",callingCode:"44",mask:"00000 000000"},GD:{countryCode:"GD",callingCode:"1",mask:"(000) 000-0000"},GE:{countryCode:"GE",callingCode:"995",mask:"000 00 00 00"},GF:{countryCode:"GF",callingCode:"594",mask:"0000 00 00 00"},GG:{countryCode:"GG",callingCode:"44",mask:"00000 000000"},GH:{countryCode:"GH",callingCode:"233",mask:"000 000 0000"},GI:{countryCode:"GI",callingCode:"350",mask:"00000000"},GL:{countryCode:"GL",callingCode:"299",mask:"00 00 00"},GM:{countryCode:"GM",callingCode:"220",mask:"000 0000"},GN:{countryCode:"GN",callingCode:"224",mask:"000 00 00 00"},GP:{countryCode:"GP",callingCode:"590",mask:"0000 00 00 00"},GQ:{countryCode:"GQ",callingCode:"240",mask:"000 000 000"},GR:{countryCode:"GR",callingCode:"30",mask:"000 000 0000"},GT:{countryCode:"GT",callingCode:"502",mask:"0000 0000"},GU:{countryCode:"GU",callingCode:"1",mask:"(000) 000-0000"},GW:{countryCode:"GW",callingCode:"245",mask:"000 000 000"},GY:{countryCode:"GY",callingCode:"592",mask:"000 0000"},HK:{countryCode:"HK",callingCode:"852",mask:"0000 0000"},HN:{countryCode:"HN",callingCode:"504",mask:"0000-0000"},HR:{countryCode:"HR",callingCode:"385",mask:"000 000 0000"},HT:{countryCode:"HT",callingCode:"509",mask:"00 00 0000"},HU:{countryCode:"HU",callingCode:"36",mask:"00 00 000 0000"},ID:{countryCode:"ID",callingCode:"62",mask:"0000-000-000"},IE:{countryCode:"IE",callingCode:"353",mask:"000 000 0000"},IL:{countryCode:"IL",callingCode:"972",mask:"000-000-0000"},IM:{countryCode:"IM",callingCode:"44",mask:"00000 000000"},IN:{countryCode:"IN",callingCode:"91",mask:"000000 00000"},IO:{countryCode:"IO",callingCode:"246",mask:"000 0000"},IQ:{countryCode:"IQ",callingCode:"964",mask:"0000 000 0000"},IR:{countryCode:"IR",callingCode:"98",mask:"0000 000 0000"},IS:{countryCode:"IS",callingCode:"354",mask:"000 0000"},IT:{countryCode:"IT",callingCode:"39",mask:"000 000 0000"},JE:{countryCode:"JE",callingCode:"44",mask:"00000 000000"},JM:{countryCode:"JM",callingCode:"1",mask:"(000) 000-0000"},JO:{countryCode:"JO",callingCode:"962",mask:"00 0000 0000"},JP:{countryCode:"JP",callingCode:"81",mask:"000-0000-0000"},KE:{countryCode:"KE",callingCode:"254",mask:"0000 000000"},KG:{countryCode:"KG",callingCode:"996",mask:"0000 000 000"},KH:{countryCode:"KH",callingCode:"855",mask:"000 000 000"},KI:{countryCode:"KI",callingCode:"686",mask:"00000000"},KM:{countryCode:"KM",callingCode:"269",mask:"000 00 00"},KN:{countryCode:"KN",callingCode:"1",mask:"(000) 000-0000"},KP:{countryCode:"KP",callingCode:"850",mask:"0000 000 0000"},KR:{countryCode:"KR",callingCode:"82",mask:"000-0000-0000"},KW:{countryCode:"KW",callingCode:"965",mask:"000 00000"},KY:{countryCode:"KY",callingCode:"1",mask:"(000) 000-0000"},KZ:{countryCode:"KZ",callingCode:"7",mask:"0 (000) 000 0000"},LA:{countryCode:"LA",callingCode:"856",mask:"000 00 000 000"},LB:{countryCode:"LB",callingCode:"961",mask:"00 000 000"},LC:{countryCode:"LC",callingCode:"1",mask:"(000) 000-0000"},LI:{countryCode:"LI",callingCode:"423",mask:"000 000 000"},LK:{countryCode:"LK",callingCode:"94",mask:"000 000 0000"},LR:{countryCode:"LR",callingCode:"231",mask:"000 000 0000"},LS:{countryCode:"LS",callingCode:"266",mask:"0000 0000"},LT:{countryCode:"LT",callingCode:"370",mask:"(0-000) 00000"},LU:{countryCode:"LU",callingCode:"352",mask:"000 000 000"},LV:{countryCode:"LV",callingCode:"371",mask:"00 000 000"},LY:{countryCode:"LY",callingCode:"218",mask:"000-0000000"},MA:{countryCode:"MA",callingCode:"212",mask:"0000-000000"},MC:{countryCode:"MC",callingCode:"377",mask:"00 00 00 00 00"},MD:{countryCode:"MD",callingCode:"373",mask:"0000 00 000"},ME:{countryCode:"ME",callingCode:"382",mask:"000 000 000"},MF:{countryCode:"MF",callingCode:"590",mask:"0000 00 00 00"},MG:{countryCode:"MG",callingCode:"261",mask:"000 00 000 00"},MH:{countryCode:"MH",callingCode:"692",mask:"000-0000"},MK:{countryCode:"MK",callingCode:"389",mask:"000 000 000"},ML:{countryCode:"ML",callingCode:"223",mask:"00 00 00 00"},MM:{countryCode:"MM",callingCode:"95",mask:"00 000 0000"},MN:{countryCode:"MN",callingCode:"976",mask:"0000 0000"},MO:{countryCode:"MO",callingCode:"853",mask:"0000 0000"},MP:{countryCode:"MP",callingCode:"1",mask:"(000) 000-0000"},MQ:{countryCode:"MQ",callingCode:"596",mask:"0000 00 00 00"},MR:{countryCode:"MR",callingCode:"222",mask:"00 00 00 00"},MS:{countryCode:"MS",callingCode:"1",mask:"(000) 000-0000"},MT:{countryCode:"MT",callingCode:"356",mask:"0000 0000"},MU:{countryCode:"MU",callingCode:"230",mask:"0000 0000"},MV:{countryCode:"MV",callingCode:"960",mask:"000-0000"},MW:{countryCode:"MW",callingCode:"265",mask:"0000 00 00 00"},MX:{countryCode:"MX",callingCode:"52",mask:"000 000 0000"},MY:{countryCode:"MY",callingCode:"60",mask:"000-000 0000"},MZ:{countryCode:"MZ",callingCode:"258",mask:"00 000 0000"},NA:{countryCode:"NA",callingCode:"264",mask:"000 000 0000"},NC:{countryCode:"NC",callingCode:"687",mask:"00.00.00"},NE:{countryCode:"NE",callingCode:"227",mask:"00 00 00 00"},NF:{countryCode:"NF",callingCode:"672",mask:"0 00000"},NG:{countryCode:"NG",callingCode:"234",mask:"0000 000 0000"},NI:{countryCode:"NI",callingCode:"505",mask:"0000 0000"},NL:{countryCode:"NL",callingCode:"31",mask:"00 00000000"},NO:{countryCode:"NO",callingCode:"47",mask:"00 00 00 00"},NP:{countryCode:"NP",callingCode:"977",mask:"000-0000000"},NR:{countryCode:"NR",callingCode:"674",mask:"000 0000"},NU:{countryCode:"NU",callingCode:"683",mask:"000 0000"},NZ:{countryCode:"NZ",callingCode:"64",mask:"000 000 0000"},OM:{countryCode:"OM",callingCode:"968",mask:"0000 0000"},PA:{countryCode:"PA",callingCode:"507",mask:"0000-0000"},PE:{countryCode:"PE",callingCode:"51",mask:"000 000 000"},PF:{countryCode:"PF",callingCode:"689",mask:"00 00 00 00"},PG:{countryCode:"PG",callingCode:"675",mask:"0000 0000"},PH:{countryCode:"PH",callingCode:"63",mask:"0000 000 0000"},PK:{countryCode:"PK",callingCode:"92",mask:"0000 0000000"},PL:{countryCode:"PL",callingCode:"48",mask:"000 000 000"},PM:{countryCode:"PM",callingCode:"508",mask:"000 00 00"},PR:{countryCode:"PR",callingCode:"1",mask:"(000) 000-0000"},PS:{countryCode:"PS",callingCode:"970",mask:"0000 000 000"},PT:{countryCode:"PT",callingCode:"351",mask:"000 000 000"},PW:{countryCode:"PW",callingCode:"680",mask:"000 0000"},PY:{countryCode:"PY",callingCode:"595",mask:"0000 000000"},QA:{countryCode:"QA",callingCode:"974",mask:"0000 0000"},RE:{countryCode:"RE",callingCode:"262",mask:"0000 00 00 00"},RO:{countryCode:"RO",callingCode:"40",mask:"0000 000 000"},RS:{countryCode:"RS",callingCode:"381",mask:"000 0000000"},RU:{countryCode:"RU",callingCode:"7",mask:"0 (000) 000-00-00"},RW:{countryCode:"RW",callingCode:"250",mask:"0000 000 000"},SA:{countryCode:"SA",callingCode:"966",mask:"000 000 0000"},SB:{countryCode:"SB",callingCode:"677",mask:"00 00000"},SC:{countryCode:"SC",callingCode:"248",mask:"0 000 000"},SD:{countryCode:"SD",callingCode:"249",mask:"000 000 0000"},SE:{countryCode:"SE",callingCode:"46",mask:"000-000 00 00"},SG:{countryCode:"SG",callingCode:"65",mask:"0000 0000"},SH:{countryCode:"SH",callingCode:"290",mask:"00000"},SI:{countryCode:"SI",callingCode:"386",mask:"000 000 000"},SJ:{countryCode:"SJ",callingCode:"47",mask:"00 00 00 00"},SK:{countryCode:"SK",callingCode:"421",mask:"0000 000 000"},SL:{countryCode:"SL",callingCode:"232",mask:"(000) 000000"},SM:{countryCode:"SM",callingCode:"378",mask:"00 00 00 00"},SN:{countryCode:"SN",callingCode:"221",mask:"00 000 00 00"},SO:{countryCode:"SO",callingCode:"252",mask:"0 0000000"},SR:{countryCode:"SR",callingCode:"597",mask:"000-0000"},SS:{countryCode:"SS",callingCode:"211",mask:"0000 000 000"},ST:{countryCode:"ST",callingCode:"239",mask:"000 0000"},SV:{countryCode:"SV",callingCode:"503",mask:"0000 0000"},SX:{countryCode:"SX",callingCode:"1",mask:"(000) 000-0000"},SY:{countryCode:"SY",callingCode:"963",mask:"0000 000 000"},SZ:{countryCode:"SZ",callingCode:"268",mask:"0000 0000"},TA:{countryCode:"TA",callingCode:"290",mask:"0000"},TC:{countryCode:"TC",callingCode:"1",mask:"(000) 000-0000"},TD:{countryCode:"TD",callingCode:"235",mask:"00 00 00 00"},TG:{countryCode:"TG",callingCode:"228",mask:"00 00 00 00"},TH:{countryCode:"TH",callingCode:"66",mask:"000 000 0000"},TJ:{countryCode:"TJ",callingCode:"992",mask:"00 000 0000"},TK:{countryCode:"TK",callingCode:"690",mask:"0000"},TL:{countryCode:"TL",callingCode:"670",mask:"0000 0000"},TM:{countryCode:"TM",callingCode:"993",mask:"0 00 000000"},TN:{countryCode:"TN",callingCode:"216",mask:"00 000 000"},TO:{countryCode:"TO",callingCode:"676",mask:"000 0000"},TR:{countryCode:"TR",callingCode:"90",mask:"0000 000 00 00"},TT:{countryCode:"TT",callingCode:"1",mask:"(000) 000-0000"},TV:{countryCode:"TV",callingCode:"688",mask:"00 0000"},TW:{countryCode:"TW",callingCode:"886",mask:"0000 000 000"},TZ:{countryCode:"TZ",callingCode:"255",mask:"0000 000 000"},UA:{countryCode:"UA",callingCode:"380",mask:"000 000 0000"},UG:{countryCode:"UG",callingCode:"256",mask:"0000 000000"},US:{countryCode:"US",callingCode:"1",mask:"(000) 000-0000"},UY:{countryCode:"UY",callingCode:"598",mask:"000 000 000"},UZ:{countryCode:"UZ",callingCode:"998",mask:"00 000 00 00"},VA:{countryCode:"VA",callingCode:"39",mask:"000 000 0000"},VC:{countryCode:"VC",callingCode:"1",mask:"(000) 000-0000"},VE:{countryCode:"VE",callingCode:"58",mask:"0000-0000000"},VG:{countryCode:"VG",callingCode:"1",mask:"(000) 000-0000"},VI:{countryCode:"VI",callingCode:"1",mask:"(000) 000-0000"},VN:{countryCode:"VN",callingCode:"84",mask:"0000 000 000"},VU:{countryCode:"VU",callingCode:"678",mask:"000 0000"},WF:{countryCode:"WF",callingCode:"681",mask:"00 00 00"},WS:{countryCode:"WS",callingCode:"685",mask:"00 00000"},XK:{countryCode:"XK",callingCode:"383",mask:"000 000 000"},YE:{countryCode:"YE",callingCode:"967",mask:"0000 000 000"},YT:{countryCode:"YT",callingCode:"262",mask:"0000 00 00 00"},ZA:{countryCode:"ZA",callingCode:"27",mask:"000 000 0000"},ZM:{countryCode:"ZM",callingCode:"260",mask:"000 0000000"},ZW:{countryCode:"ZW",callingCode:"263",mask:"000 000 0000"}};function a0(n,c,l,t=!1){const C=V(n,c),r=c0(C,n,l,t);return{maskedValue:C,cursorPosition:r}}function A(n){return n.replace(/\D+/g,"")}function V(n,c){const l=A(n);let t="",C=0;if(l.length){for(const r of c)if(r==="0"){if(t+=l[C++],C===l.length)break}else t+=r;C<l.length&&(t+=" "+l.slice(C))}return t}function c0(n,c,l,t){const C=l===c.length;if(t||!C){const r=c.slice(0,l),i=c.slice(l);if(n.startsWith(r))return l;if(n.endsWith(i))return n.length-i.length;{const y=F(r);let g=0,S=0;for(;S<y.length;)F(n[g])&&S++,g++;return g}}}function F(n){return n.replace(/[.,\\/#!$%^&*;:{}=+\-_`~()\s]/g,"")}const C0=n=>n||(typeof navigator<"u"?navigator.language:"en-US"),d0=n=>{var{countryCode:c,value:l,defaultValue:t="",locale:C,floatingLabel:r,disabled:i,readonly:y,invalid:g,className:S,onFocus:f,onBlur:B,onChange:T,onInputChange:I,onKeyDown:K,onKeyPress:N,onKeyUp:L,onExpand:O,onCollapse:v}=n,H=e0.__rest(n,["countryCode","value","defaultValue","locale","floatingLabel","disabled","readonly","invalid","className","onFocus","onBlur","onChange","onInputChange","onKeyDown","onKeyPress","onKeyUp","onExpand","onCollapse"]);const P=l!==void 0,m=a.useMemo(()=>{const o=C0(C),e=new Intl.DisplayNames([o],{type:"region"});return Object.keys(G).map(u=>{var d;return[u,(d=e.of(u))!==null&&d!==void 0?d:""]}).sort(([,u],[,d])=>u.localeCompare(d))},[C]),[R,p]=a.useState(()=>{if(c){const o=m.findIndex(([e])=>e===c.toUpperCase());return o!==-1?o:0}return 0}),[W,Z]=a.useState(t),E=a.useRef(null),k=a.useRef(null);a.useEffect(()=>{if(c){const o=m.findIndex(([e])=>e===c.toUpperCase());p(o!==-1?o:0)}},[c,m]);const M=(o=R)=>{const[e]=m[o];return G[e]};a.useEffect(()=>{k.current!==null&&E.current&&(E.current.setSelectionRange(k.current,k.current),k.current=null)});const Y=()=>P?l:W,x=()=>{const o=Y();return o?V(o,M().mask):""},s=o=>{const e=o?.maskedValue!==void 0?o?.maskedValue:x();return{value:e,rawValue:A(e),callingCode:M(o?.index).callingCode,countryCode:M(o?.index).countryCode}},J=(o,{index:e})=>{p(e),T&&T(o,s({index:e}))},w=o=>{f&&f(o,s())},Q=o=>{B&&B(o,s())},X=o=>{T&&T(o,s())},q=o=>{const e=o.target,u=e.value,d=e.selectionStart||0,o0=o.nativeEvent&&"inputType"in o.nativeEvent?/delete.*Backward/.test(o.nativeEvent.inputType):!1,{maskedValue:D,cursorPosition:h}=a0(u,M().mask,d,o0);h!==void 0&&(k.current=h),P||Z(A(D)),I&&I(o,s({maskedValue:D}))},_=o=>{K&&K(o,s())},j=o=>{N&&N(o,s())},$=o=>{L&&L(o,s())},z=m.map(([o,e],u)=>{const d=G[o];return a.createElement(U.ListboxOption,{key:o,value:`${e}-${d.callingCode}`,selected:u===R,icon:a.createElement(l0.EbayFlagIcon,{flag:d.countryCode.toLowerCase()})},a.createElement("span",null,e," ( + ",d.callingCode," )"))});return a.createElement("span",Object.assign({},H,{className:n0("phone-input",S,{"phone-input--disabled":i,"phone-input--readonly":y,"phone-input--error":g})}),a.createElement(U.ListboxButton,{split:"start",disabled:y||i,onChange:J,onExpand:O,onCollapse:v},z),a.createElement(b.EbayTextbox,{type:"tel",value:x(),disabled:i,floatingLabel:r,floatingLabelStatic:!0,readOnly:y,invalid:g,onBlur:Q,onFocus:w,onKeyDown:_,onKeyPress:j,onKeyUp:$,onChange:X,onInputChange:q,ref:E},a.createElement(b.EbayTextboxPrefixText,{id:"phone-prefix"},"+ ",M().callingCode)))};exports.EbayPhoneInput=d0;
|
|
@@ -1,7 +1,22 @@
|
|
|
1
|
-
export
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
export interface MaskResult {
|
|
2
|
+
maskedValue: string;
|
|
3
|
+
cursorPosition?: number;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* Apply phone mask and calculate new cursor position
|
|
7
|
+
* @param value - The current input value (may be partially formatted)
|
|
8
|
+
* @param mask - The mask pattern (e.g., "(000) 000-0000")
|
|
9
|
+
* @param cursorPosition - Current cursor position
|
|
10
|
+
* @param isDelete - Whether this is a delete operation
|
|
11
|
+
* @returns Object with masked value and new cursor position
|
|
12
|
+
*/
|
|
13
|
+
export declare function applyMaskWithCursor(value: string, mask: string, cursorPosition: number, isDelete?: boolean): MaskResult;
|
|
14
|
+
/**
|
|
15
|
+
* Strip all non-digit characters from a string
|
|
16
|
+
*/
|
|
6
17
|
export declare function stripNonDigits(value: string): string;
|
|
18
|
+
/**
|
|
19
|
+
* Apply mask pattern to a value
|
|
20
|
+
*/
|
|
21
|
+
export declare function applyMask(value: string, mask: string): string;
|
|
7
22
|
//# sourceMappingURL=mask.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mask.d.ts","sourceRoot":"","sources":["../../src/ebay-phone-input/mask.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"mask.d.ts","sourceRoot":"","sources":["../../src/ebay-phone-input/mask.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,UAAU;IACvB,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CAC/B,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,MAAM,EACZ,cAAc,EAAE,MAAM,EACtB,QAAQ,GAAE,OAAe,GAC1B,UAAU,CAQZ;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,UAE3C;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,UAkBpD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"phone-input.d.ts","sourceRoot":"","sources":["../../src/ebay-phone-input/phone-input.tsx"],"names":[],"mappings":"AACA,OAAc,EAAE,cAAc,EAAE,EAAE,EAAwC,MAAM,OAAO,CAAC;AAKxF,OAAO,EAAE,sBAAsB,EAAE,qBAAqB,EAAE,wBAAwB,EAAE,MAAM,6BAA6B,CAAC;AAOtH,MAAM,WAAW,eAAe;IAC5B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;CACxB;
|
|
1
|
+
{"version":3,"file":"phone-input.d.ts","sourceRoot":"","sources":["../../src/ebay-phone-input/phone-input.tsx"],"names":[],"mappings":"AACA,OAAc,EAAE,cAAc,EAAE,EAAE,EAAwC,MAAM,OAAO,CAAC;AAKxF,OAAO,EAAE,sBAAsB,EAAE,qBAAqB,EAAE,wBAAwB,EAAE,MAAM,6BAA6B,CAAC;AAOtH,MAAM,WAAW,eAAe;IAC5B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,MAAM,mBAAmB,GAAG,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,EAAE,UAAU,CAAC,GAAG;IACzE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,OAAO,CAAC,EAAE,qBAAqB,CAAC,gBAAgB,EAAE,eAAe,CAAC,CAAC;IACnE,MAAM,CAAC,EAAE,qBAAqB,CAAC,gBAAgB,EAAE,eAAe,CAAC,CAAC;IAClE,QAAQ,CAAC,EAAE,sBAAsB,CAAC,gBAAgB,EAAE,eAAe,CAAC,CAAC;IACrE,aAAa,CAAC,EAAE,sBAAsB,CAAC,gBAAgB,EAAE,eAAe,CAAC,CAAC;IAC1E,SAAS,CAAC,EAAE,wBAAwB,CAAC,gBAAgB,EAAE,eAAe,CAAC,CAAC;IACxE,UAAU,CAAC,EAAE,wBAAwB,CAAC,gBAAgB,EAAE,eAAe,CAAC,CAAC;IACzE,OAAO,CAAC,EAAE,wBAAwB,CAAC,gBAAgB,EAAE,eAAe,CAAC,CAAC;IACtE,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,IAAI,CAAC;CAC3B,CAAC;AAMF,QAAA,MAAM,cAAc,EAAE,EAAE,CAAC,mBAAmB,CAiO3C,CAAC;AAEF,eAAe,cAAc,CAAC"}
|
package/ebay-textbox/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const x=require("../textbox-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const x=require("../textbox-DAip4ToD.js");exports.EbayTextbox=x.EbayTextbox;exports.EbayTextboxPostfixIcon=x.EbayTextboxPostfixIcon;exports.EbayTextboxPostfixText=x.EbayTextboxPostfixText;exports.EbayTextboxPrefixIcon=x.EbayTextboxPrefixIcon;exports.EbayTextboxPrefixText=x.EbayTextboxPrefixText;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"textbox.d.ts","sourceRoot":"","sources":["../../src/ebay-textbox/textbox.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAEV,cAAc,EAEd,GAAG,
|
|
1
|
+
{"version":3,"file":"textbox.d.ts","sourceRoot":"","sources":["../../src/ebay-textbox/textbox.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAEV,cAAc,EAEd,GAAG,EAUN,MAAM,OAAO,CAAC;AAQf,OAAO,EACH,sBAAsB,EACtB,gBAAgB,EAChB,qBAAqB,EACrB,wBAAwB,EACxB,qBAAqB,EACxB,MAAM,6BAA6B,CAAC;AACrC,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAEpC,eAAO,MAAM,YAAY,GAAI,QAAQ,OAAO,KAAG,OAAuC,CAAC;AAEvF,KAAK,cAAc,GAAG,cAAc,CAAC,OAAO,CAAC,GAAG,cAAc,CAAC,UAAU,CAAC,CAAC;AAE3E,MAAM,MAAM,iBAAiB,GAAG;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAClD,MAAM,MAAM,gBAAgB,GAAG;IAC3B,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,IAAI,CAAC;IACjB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,QAAQ,CAAC,EAAE,sBAAsB,CAAC,mBAAmB,GAAG,gBAAgB,EAAE,iBAAiB,CAAC,CAAC;IAC7F,aAAa,CAAC,EAAE,sBAAsB,CAAC,mBAAmB,GAAG,gBAAgB,EAAE,iBAAiB,CAAC,CAAC;IAClG,OAAO,CAAC,EAAE,qBAAqB,CAAC,mBAAmB,GAAG,gBAAgB,EAAE,iBAAiB,CAAC,CAAC;IAC3F,MAAM,CAAC,EAAE,qBAAqB,CAAC,mBAAmB,GAAG,gBAAgB,EAAE,iBAAiB,CAAC,CAAC;IAC1F,UAAU,CAAC,EAAE,wBAAwB,CAAC,mBAAmB,GAAG,gBAAgB,EAAE,iBAAiB,CAAC,CAAC;IACjG,OAAO,CAAC,EAAE,wBAAwB,CAAC,mBAAmB,GAAG,gBAAgB,EAAE,iBAAiB,CAAC,CAAC;IAC9F,SAAS,CAAC,EAAE,wBAAwB,CAAC,mBAAmB,GAAG,gBAAgB,EAAE,iBAAiB,CAAC,CAAC;IAChG,SAAS,CAAC,EAAE,gBAAgB,CAAC,mBAAmB,GAAG,gBAAgB,EAAE,iBAAiB,CAAC,CAAC;IACxF,mBAAmB,CAAC,EAAE,MAAM,IAAI,CAAC;IACjC,aAAa,CAAC,EAAE,wBAAwB,CAAC,gBAAgB,EAAE,iBAAiB,CAAC,GACzE,qBAAqB,CAAC,gBAAgB,EAAE,iBAAiB,CAAC,CAAC;IAC/D,YAAY,CAAC,EAAE,GAAG,CAAC,mBAAmB,GAAG,gBAAgB,CAAC,CAAC;IAC3D,QAAQ,CAAC,EAAE,GAAG,CAAC,mBAAmB,GAAG,gBAAgB,CAAC,CAAC;IACvD,WAAW,CAAC,EAAE,OAAO,CAAC;CACzB,GAAG,IAAI,CAAC,cAAc,EAAE,SAAS,GAAG,QAAQ,GAAG,UAAU,GAAG,YAAY,GAAG,SAAS,GAAG,WAAW,GAAG,WAAW,CAAC,CAAC;;AAwJnH,wBAA6D"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";const V=require("./tslib.es6-C4EgNkz1.js"),n=require("react"),O=require("classnames"),ge=require("./utils-C9NL3q0j.js"),_e=require("./icons/ebay-icon-tick-16/index.js"),ye=require("./dropdown-B6wMNyjP.js"),Ee=require("./icons/ebay-icon-chevron-down-16/index.js"),W=p=>{var{value:d,children:g,selected:b,onClick:f,index:_,icon:y,innerRef:k,className:C,a11ySelectedText:T="selected"}=p,v=V.__rest(p,["value","children","selected","onClick","index","icon","innerRef","className","a11ySelectedText"]);const E=O("listbox-button__option",C,{"listbox-button__option--active":b});return n.createElement("div",Object.assign({},v,{className:E,role:"option","aria-selected":b,ref:k,onClick:i=>{f(i,d,_)}}),n.createElement("span",{className:"listbox-button__value"},y,g,b&&n.createElement("span",{className:"clipped"},T)),n.createElement(_e.EbayIconTick16,null))},he=p=>{var d,{children:g,name:b,value:f,selected:_,borderless:y,fluid:k,className:C,maxHeight:T,prefixId:v,prefixLabel:E,floatingLabel:i,strategy:L,split:w,unselectedText:z="-",a11ySelectedText:G,onChange:I=()=>{},onCollapse:J=()=>{},onExpand:Q=()=>{}}=p,X=V.__rest(p,["children","name","value","selected","borderless","fluid","className","maxHeight","prefixId","prefixLabel","floatingLabel","strategy","split","unselectedText","a11ySelectedText","onChange","onCollapse","onExpand"]);const r=n.useRef(null),S=n.useRef(new Map),a=ge.filterByType(g,W);if(!a.length)throw new Error(`EbayListboxButton: Please use a
|
|
2
|
+
EbayListboxButtonOption that defines the options of the listbox`);const Y=()=>{const e=_!==void 0?_:a.findIndex(({props:l})=>f!==void 0&&l.value===f||l.selected),t=e>-1||i?e:void 0;return{option:a[t],index:t}},{option:D,index:R}=Y(),[s,m]=n.useState(D),[o,H]=n.useState(R),[x,A]=n.useState(),[Z,ee]=n.useState(!1),[q,$]=n.useState(),{overlayStyles:te,refs:h}=ye.useFloatingDropdown({open:x,options:{strategy:L}}),N=h.host,ne=h.overlay;n.useEffect(()=>{m(D)},[f]);const c=n.Children.toArray(g),j=e=>c[e].props.value,oe=n.useCallback(e=>c.findIndex(({props:t})=>t.value===e),[c]),se=e=>S.current.get(e),u=()=>{A(!1),J()},le=()=>{A(!0),Q()},ae=()=>{x?u():le()},F=(e,t)=>{m(c[t]),H(t),u(),N.current.focus(),I(e,{index:t,selected:[String(j(t))],wasClicked:q}),$(!1)},ce=()=>{u(),m(c[R])},ie=e=>{const t=r.current.children[e];t.setAttribute("aria-selected","true"),t.classList.add("listbox-button__option--active")},re=e=>{const t=r.current.children[e];t.setAttribute("aria-selected","false"),t.classList.remove("listbox-button__option--active")},ue=e=>{const t=ne.current,l=se(e);if(t.scrollHeight>t.clientHeight){const xe=t.clientHeight+t.scrollTop,M=l.offsetTop+l.offsetHeight;M>xe?t.scrollTop=M-t.clientHeight:l.offsetTop<t.scrollTop&&(t.scrollTop=l.offsetTop)}},K=e=>{ie(o===void 0||e===-1?0:e),re(o===void 0||o===-1?0:o),ue(e),H(e),m(c[e])},P=e=>setTimeout(()=>{var t;return(t=r?.current)===null||t===void 0?void 0:t.focus(e)},0),pe=()=>{ae(),P({preventScroll:!0})},de=e=>{switch(e.key){case"Escape":u();break;case"Enter":P();break}},be=e=>{switch(e.key){case" ":case"PageUp":case"PageDown":case"Home":case"End":e.preventDefault();break;case"Down":case"ArrowDown":e.preventDefault(),o!==a.length-1&&K(o<a.length-1?o+1:0);break;case"Up":case"ArrowUp":e.preventDefault(),o!==0&&K(o>0?o-1:a.length-1);break;case"Enter":u(),setTimeout(()=>m(c[o])),setTimeout(()=>N.current.focus(),0),I(e,{index:o,selected:[String(j(o))],wasClicked:q});break;case"Esc":case"Escape":ce();break}},B=a.map((e,t)=>n.cloneElement(e,{index:t,key:t,selected:s&&e.props.value===s.props.value,id:e.props.id||`listbox_btn_${e.props.value}_${t}`,onClick:l=>F(l,t),innerRef:l=>{l?S.current.set(t,l):S.current.delete(t)},a11ySelectedText:G})),fe=O("listbox-button",C,{"listbox-button--fluid":k}),ve=O("btn",{"btn--form":!y,"btn--borderless":y,"btn--floating-label":i&&s,[`btn--split-${w}`]:w&&w!=="none"}),U=v&&"expand-btn-text",me=n.createElement(n.Fragment,null,i&&n.createElement("span",{className:"btn__floating-label"},i),E&&n.createElement("span",{className:"btn__label"},E),n.createElement("span",{className:"btn__text",id:U},s?.props.icon||s?.props.children||z));return n.createElement("span",{className:fe},n.createElement("button",Object.assign({},X,{onFocus:()=>ee(!0),type:"button",className:ve,"aria-expanded":!!x,"aria-haspopup":"listbox","aria-labelledby":v&&`${v} ${U}`,onClick:pe,onMouseDown:e=>e.preventDefault(),onKeyUp:de,ref:h.setHost}),n.createElement("span",{className:"btn__cell"},me,n.createElement(Ee.EbayIconChevronDown16,null))),(x||Z)&&n.createElement("div",{className:O("listbox-button__listbox",{"listbox-button__listbox--fixed":L==="fixed"}),ref:h.setOverlay,style:Object.assign(Object.assign({},te),{maxHeight:T})},n.createElement("div",{className:"listbox-button__options",role:"listbox",tabIndex:x?0:-1,ref:r,"aria-activedescendant":(d=B[o])===null||d===void 0?void 0:d.props.id,onKeyDown:e=>be(e),onMouseDown:e=>{e.preventDefault(),$(!0)},onBlur:()=>{u(),setTimeout(()=>N.current.focus(),0)}},B)),n.createElement("select",{hidden:!0,className:"listbox-button__native",name:b,onChange:e=>F(e,oe(e.target.value)),value:s?s?.props.value:""},B.map((e,t)=>n.createElement("option",{value:e.props.value,key:t}))))};exports.ListboxButton=he;exports.ListboxOption=W;
|
package/package.json
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const m=require("./tslib.es6-C4EgNkz1.js"),t=require("react"),se=require("classnames"),ce=require("./forwardRef-DBQKIlPy.js"),p=require("./utils-C9NL3q0j.js"),w=require("./icon-I30uh1Ov.js"),ue=require("./icon-button-AJ6dtyvc.js"),de=require("./hooks-uidlIIid.js"),K=o=>{var{children:s,name:l,icon:i,buttonAriaLabel:r,onClick:u=()=>{}}=o,d=m.__rest(o,["children","name","icon","buttonAriaLabel","onClick"]);return l||i?r?t.createElement(ue.EbayIconButton,Object.assign({"aria-label":r,icon:i||l,transparent:!0,onClick:u},d)):i||t.createElement(w.EbayIcon,Object.assign({name:l},d)):s},P=o=>t.createElement("span",Object.assign({},o)),_=o=>{var{children:s,name:l,icon:i}=o,r=m.__rest(o,["children","name","icon"]);return l?t.createElement(w.EbayIcon,Object.assign({name:l},r)):i||s},F=o=>t.createElement("span",Object.assign({},o)),q=o=>typeof o<"u",be=o=>{var s,l,{type:i="text",invalid:r,fluid:u,multiline:d,onChange:B=()=>{},onInputChange:j=()=>{},onFocus:k=()=>{},onBlur:O=()=>{},onKeyPress:R=()=>{},onKeyUp:V=()=>{},onKeyDown:N=()=>{},onInvalid:S=()=>{},onFloatingLabelInit:D=()=>{},onButtonClick:U=()=>{},autoFocus:h,defaultValue:g="",value:E,forwardedRef:z,inputRef:$,inputSize:C="default",floatingLabel:A,floatingLabelStatic:M,children:b,placeholder:W,opaqueLabel:G}=o,c=m.__rest(o,["type","invalid","fluid","multiline","onChange","onInputChange","onFocus","onBlur","onKeyPress","onKeyUp","onKeyDown","onInvalid","onFloatingLabelInit","onButtonClick","autoFocus","defaultValue","value","forwardedRef","inputRef","inputSize","floatingLabel","floatingLabelStatic","children","placeholder","opaqueLabel"]);const y=t.useRef(g),[I,H]=t.useState(g),T=de.useFloatingLabel({text:A,disabled:c.disabled,size:C,invalid:r,opaqueLabel:G,static:M||i==="date",onMount:D,containerTagName:u?"div":"span"}),L=e=>{var n,a;y.current=(n=e?.target)===null||n===void 0?void 0:n.value,k(e,{value:((a=e?.target)===null||a===void 0?void 0:a.value)||g})},J=e=>{var n;const a=(n=e.target)===null||n===void 0?void 0:n.value;O(e,{value:a}),a!==y.current&&(B(e,{value:a}),y.current=a)},Q=e=>{const n=e.target;R(e,{value:n?.value})},X=e=>{const n=e.target;V(e,{value:n?.value})},Y=e=>{const n=e.target;N(e,{value:n?.value})},Z=e=>{const n=e.target;S(e,{value:n?.value})},ee=e=>{U(e,{value:I})};t.useEffect(()=>{h&&L()},[]);const ne=e=>{var n;const a=(n=e.target)===null||n===void 0?void 0:n.value;H(a),j(e,{value:a})},oe=d?"textarea":"input",te=u?"div":"span",ae=p.findComponent(b,_),x=p.findComponent(b,F),le=(s=x?.props)===null||s===void 0?void 0:s.id,v=p.findComponent(b,K),f=p.findComponent(b,P),ie=(l=f?.props)===null||l===void 0?void 0:l.id,re=se("textbox",c.className,{"textbox--fluid":u,"textbox--large":C==="large","textbox--disabled":c.disabled,"textbox--invalid":r,"textbox--readonly":c.readOnly});return t.createElement(T.Container,null,t.createElement(T.Label,{htmlFor:c.id}),t.createElement(te,{className:re},ae,x,t.createElement(oe,Object.assign({"aria-describedby":[le,ie].filter(Boolean).join(" ")||void 0},c,{className:"textbox__control",type:i,"aria-invalid":r,value:q(E)?E:I,onChange:ne,onBlur:J,onFocus:L,onKeyPress:Q,onKeyUp:X,onKeyDown:Y,onInvalid:Z,autoFocus:h,ref:$||z,placeholder:W})),f,v&&t.cloneElement(v,Object.assign(Object.assign({},v.props),{onClick:e=>{const{onClick:n=()=>{}}=v.props;n(e),ee(e)}}))))},xe=ce.withForwardRef(be);exports.EbayTextbox=xe;exports.EbayTextboxPostfixIcon=K;exports.EbayTextboxPostfixText=P;exports.EbayTextboxPrefixIcon=_;exports.EbayTextboxPrefixText=F;exports.isControlled=q;
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";const V=require("./tslib.es6-C4EgNkz1.js"),n=require("react"),O=require("classnames"),xe=require("./utils-C9NL3q0j.js"),ge=require("./icons/ebay-icon-tick-16/index.js"),_e=require("./dropdown-B6wMNyjP.js"),Ee=require("./icons/ebay-icon-chevron-down-16/index.js"),W=u=>{var{value:p,children:m,selected:x,onClick:d,index:g,icon:_,innerRef:k,className:C}=u,w=V.__rest(u,["value","children","selected","onClick","index","icon","innerRef","className"]);const b=O("listbox-button__option",C,{"listbox-button__option--active":x});return n.createElement("div",Object.assign({},w,{className:b,role:"option","aria-selected":x,ref:k,onClick:E=>{d(E,p,g)}}),n.createElement("span",{className:"listbox-button__value"},_,m),n.createElement(ge.EbayIconTick16,null))},he=u=>{var p,{children:m,name:x,value:d,selected:g,borderless:_,fluid:k,className:C,maxHeight:w,prefixId:b,prefixLabel:E,floatingLabel:h,strategy:S,split:N,unselectedText:z="-",onChange:I=()=>{},onCollapse:G=()=>{},onExpand:J=()=>{}}=u,Q=V.__rest(u,["children","name","value","selected","borderless","fluid","className","maxHeight","prefixId","prefixLabel","floatingLabel","strategy","split","unselectedText","onChange","onCollapse","onExpand"]);const i=n.useRef(null),B=n.useRef(new Map),a=xe.filterByType(m,W);if(!a.length)throw new Error(`EbayListboxButton: Please use a
|
|
2
|
-
EbayListboxButtonOption that defines the options of the listbox`);const X=()=>{const e=g!==void 0?g:a.findIndex(({props:l})=>d!==void 0&&l.value===d||l.selected),t=e>-1||h?e:void 0;return{option:a[t],index:t}},{option:D,index:R}=X(),[s,f]=n.useState(D),[o,H]=n.useState(R),[v,A]=n.useState(),[Y,Z]=n.useState(!1),[q,$]=n.useState(),{overlayStyles:ee,refs:y}=_e.useFloatingDropdown({open:v,options:{strategy:S}}),T=y.host,te=y.overlay;n.useEffect(()=>{f(D)},[d]);const c=n.Children.toArray(m),j=e=>c[e].props.value,ne=n.useCallback(e=>c.findIndex(({props:t})=>t.value===e),[c]),oe=e=>B.current.get(e),r=()=>{A(!1),G()},se=()=>{A(!0),J()},le=()=>{v?r():se()},F=(e,t)=>{f(c[t]),H(t),r(),T.current.focus(),I(e,{index:t,selected:[String(j(t))],wasClicked:q}),$(!1)},ae=()=>{r(),f(c[R])},ce=e=>{const t=i.current.children[e];t.setAttribute("aria-selected","true"),t.classList.add("listbox-button__option--active")},ie=e=>{const t=i.current.children[e];t.setAttribute("aria-selected","false"),t.classList.remove("listbox-button__option--active")},re=e=>{const t=te.current,l=oe(e);if(t.scrollHeight>t.clientHeight){const me=t.clientHeight+t.scrollTop,M=l.offsetTop+l.offsetHeight;M>me?t.scrollTop=M-t.clientHeight:l.offsetTop<t.scrollTop&&(t.scrollTop=l.offsetTop)}},K=e=>{ce(o===void 0||e===-1?0:e),ie(o===void 0||o===-1?0:o),re(e),H(e),f(c[e])},P=e=>setTimeout(()=>{var t;return(t=i?.current)===null||t===void 0?void 0:t.focus(e)},0),ue=()=>{le(),P({preventScroll:!0})},pe=e=>{switch(e.key){case"Escape":r();break;case"Enter":P();break}},de=e=>{switch(e.key){case" ":case"PageUp":case"PageDown":case"Home":case"End":e.preventDefault();break;case"Down":case"ArrowDown":e.preventDefault(),o!==a.length-1&&K(o<a.length-1?o+1:0);break;case"Up":case"ArrowUp":e.preventDefault(),o!==0&&K(o>0?o-1:a.length-1);break;case"Enter":r(),setTimeout(()=>f(c[o])),setTimeout(()=>T.current.focus(),0),I(e,{index:o,selected:[String(j(o))],wasClicked:q});break;case"Esc":case"Escape":ae();break}},L=a.map((e,t)=>n.cloneElement(e,{index:t,key:t,selected:s&&e.props.value===s.props.value,id:e.props.id||`listbox_btn_${e.props.value}_${t}`,onClick:l=>F(l,t),innerRef:l=>{l?B.current.set(t,l):B.current.delete(t)}})),be=O("listbox-button",C,{"listbox-button--fluid":k}),fe=O("btn",{"btn--form":!_,"btn--borderless":_,"btn--floating-label":h&&s,[`btn--split-${N}`]:N&&N!=="none"}),U=b&&"expand-btn-text",ve=n.createElement(n.Fragment,null,h&&n.createElement("span",{className:"btn__floating-label"},h),E&&n.createElement("span",{className:"btn__label"},E),n.createElement("span",{className:"btn__text",id:U},s?.props.icon||s?.props.children||z));return n.createElement("span",{className:be},n.createElement("button",Object.assign({},Q,{onFocus:()=>Z(!0),type:"button",className:fe,"aria-expanded":!!v,"aria-haspopup":"listbox","aria-labelledby":b&&`${b} ${U}`,onClick:ue,onMouseDown:e=>e.preventDefault(),onKeyUp:pe,ref:y.setHost}),n.createElement("span",{className:"btn__cell"},ve,n.createElement(Ee.EbayIconChevronDown16,null))),(v||Y)&&n.createElement("div",{className:O("listbox-button__listbox",{"listbox-button__listbox--fixed":S==="fixed"}),ref:y.setOverlay,style:Object.assign(Object.assign({},ee),{maxHeight:w})},n.createElement("div",{className:"listbox-button__options",role:"listbox",tabIndex:v?0:-1,ref:i,"aria-activedescendant":(p=L[o])===null||p===void 0?void 0:p.props.id,onKeyDown:e=>de(e),onMouseDown:e=>{e.preventDefault(),$(!0)},onBlur:()=>{r(),setTimeout(()=>T.current.focus(),0)}},L)),n.createElement("select",{hidden:!0,className:"listbox-button__native",name:x,onChange:e=>F(e,ne(e.target.value)),value:s?s?.props.value:""},L.map((e,t)=>n.createElement("option",{value:e.props.value,key:t}))))};exports.ListboxButton=he;exports.ListboxOption=W;
|
package/textbox-5DvabGMY.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const h=require("./tslib.es6-C4EgNkz1.js"),o=require("react"),ce=require("classnames"),ue=require("./forwardRef-DBQKIlPy.js"),p=require("./utils-C9NL3q0j.js"),w=require("./icon-I30uh1Ov.js"),de=require("./icon-button-AJ6dtyvc.js"),be=require("./hooks-uidlIIid.js"),K=t=>{var{children:s,name:a,icon:l,buttonAriaLabel:i,onClick:u=()=>{}}=t,d=h.__rest(t,["children","name","icon","buttonAriaLabel","onClick"]);return a||l?i?o.createElement(de.EbayIconButton,Object.assign({"aria-label":i,icon:l||a,transparent:!0,onClick:u},d)):l||o.createElement(w.EbayIcon,Object.assign({name:a},d)):s},P=t=>o.createElement("span",Object.assign({},t)),F=t=>{var{children:s,name:a,icon:l}=t,i=h.__rest(t,["children","name","icon"]);return a?o.createElement(w.EbayIcon,Object.assign({name:a},i)):l||s},_=t=>o.createElement("span",Object.assign({},t)),m=t=>typeof t<"u",xe=t=>{var s,a,{type:l="text",invalid:i,fluid:u,multiline:d,onChange:q=()=>{},onInputChange:B=()=>{},onFocus:j=()=>{},onBlur:k=()=>{},onKeyPress:O=()=>{},onKeyUp:V=()=>{},onKeyDown:R=()=>{},onInvalid:N=()=>{},onFloatingLabelInit:S=()=>{},onButtonClick:D=()=>{},autoFocus:E,defaultValue:g="",value:y,forwardedRef:U,inputRef:z,inputSize:C="default",floatingLabel:$,floatingLabelStatic:A,children:b,placeholder:M,opaqueLabel:W}=t,c=h.__rest(t,["type","invalid","fluid","multiline","onChange","onInputChange","onFocus","onBlur","onKeyPress","onKeyUp","onKeyDown","onInvalid","onFloatingLabelInit","onButtonClick","autoFocus","defaultValue","value","forwardedRef","inputRef","inputSize","floatingLabel","floatingLabelStatic","children","placeholder","opaqueLabel"]);const[I,G]=o.useState(g),[H,J]=o.useState(g),T=be.useFloatingLabel({text:$,disabled:c.disabled,size:C,invalid:i,opaqueLabel:W,static:A||l==="date",onMount:S,containerTagName:u?"div":"span"}),L=n=>{var e;j(n,{value:((e=n?.target)===null||e===void 0?void 0:e.value)||g})},Q=n=>{var e;const r=(e=n.target)===null||e===void 0?void 0:e.value;k(n,{value:r}),r!==I&&(q(n,{value:r}),G(r))},X=n=>{const e=n.target;O(n,{value:e?.value})},Y=n=>{const e=n.target;V(n,{value:e?.value})},Z=n=>{const e=n.target;R(n,{value:e?.value})},ee=n=>{const e=n.target;N(n,{value:e?.value})},ne=n=>{D(n,{value:I})};o.useEffect(()=>{E&&L()},[]);const te=n=>{var e;const r=(e=n.target)===null||e===void 0?void 0:e.value;m(y)||J(r),B(n,{value:r})},oe=d?"textarea":"input",ae=u?"div":"span",le=p.findComponent(b,F),x=p.findComponent(b,_),ie=(s=x?.props)===null||s===void 0?void 0:s.id,v=p.findComponent(b,K),f=p.findComponent(b,P),se=(a=f?.props)===null||a===void 0?void 0:a.id,re=ce("textbox",c.className,{"textbox--fluid":u,"textbox--large":C==="large","textbox--disabled":c.disabled,"textbox--invalid":i,"textbox--readonly":c.readOnly});return o.createElement(T.Container,null,o.createElement(T.Label,{htmlFor:c.id}),o.createElement(ae,{className:re},le,x,o.createElement(oe,Object.assign({"aria-describedby":[ie,se].filter(Boolean).join(" ")||void 0},c,{className:"textbox__control",type:l,"aria-invalid":i,value:m(y)?y:H,onChange:te,onBlur:Q,onFocus:L,onKeyPress:X,onKeyUp:Y,onKeyDown:Z,onInvalid:ee,autoFocus:E,ref:z||U,placeholder:M})),f,v&&o.cloneElement(v,Object.assign(Object.assign({},v.props),{onClick:n=>{const{onClick:e=()=>{}}=v.props;e(n),ne(n)}}))))},ve=ue.withForwardRef(xe);exports.EbayTextbox=ve;exports.EbayTextboxPostfixIcon=K;exports.EbayTextboxPostfixText=P;exports.EbayTextboxPrefixIcon=F;exports.EbayTextboxPrefixText=_;exports.isControlled=m;
|