@fluidattacks/design 3.1.10 → 3.1.12
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/dist/_commonjsHelpers-C6fGbg64.mjs +6 -0
- package/dist/assets/{design.css → index.css} +1 -1
- package/dist/assets/index2.css +1 -0
- package/dist/components/@core/index.js +18 -1
- package/dist/components/accordion/accordion-content/index.js +9 -1
- package/dist/components/accordion/index.js +21 -1
- package/dist/components/alert/index.js +111 -4
- package/dist/components/button/index.js +18 -1
- package/dist/components/card/card-header/index.js +14 -1
- package/dist/components/card/card-with-image/index.js +18 -1
- package/dist/components/card/card-with-input/index.js +57 -3
- package/dist/components/card/card-with-selector/index.js +16 -1
- package/dist/components/card/card-with-switch/index.js +12 -1
- package/dist/components/card/index.js +12 -1
- package/dist/components/carousel/index.js +36 -10
- package/dist/components/checkbox/index.js +84 -3
- package/dist/components/cloud-image/index.js +8 -1
- package/dist/components/code-snippet/index.js +27 -1
- package/dist/components/code-snippet/location-code/index.js +125 -1
- package/dist/components/colors/index.js +9 -1
- package/dist/components/confirm-dialog/index.js +23 -1
- package/dist/components/container/index.js +27 -3
- package/dist/components/content-card/category-tag/index.js +13 -1
- package/dist/components/content-card/event-date/index.js +18 -1
- package/dist/components/content-card/index.js +63 -3
- package/dist/components/content-card-carousel/index.js +15 -1
- package/dist/components/content-card-carousel/scroll-buttons/index.js +9 -1
- package/dist/components/divider/index.js +10 -1
- package/dist/components/empty-state/empty-button/index.js +6 -1
- package/dist/components/empty-state/index.js +21 -8
- package/dist/components/file-preview/index.js +15 -3
- package/dist/components/form/index.js +26 -3
- package/dist/components/grid-container/index.js +26 -5
- package/dist/components/group-selector/index.js +26 -1
- package/dist/components/group-selector/option-container/index.js +12 -1
- package/dist/components/icon/index.js +42 -4
- package/dist/components/icon-button/index.js +27 -3
- package/dist/components/indicator-card/index.js +15 -1
- package/dist/components/info-sidebar/index.js +16 -1
- package/dist/components/inputs/fields/combobox/index.js +26 -1
- package/dist/components/inputs/fields/combobox/option/index.js +8 -1
- package/dist/components/inputs/fields/date/calendar/cell/index.js +16 -1
- package/dist/components/inputs/fields/date/calendar/grid/index.js +15 -1
- package/dist/components/inputs/fields/date/calendar/header/index.js +16 -1
- package/dist/components/inputs/fields/date/calendar/index.js +15 -1
- package/dist/components/inputs/fields/date/index.js +18 -1
- package/dist/components/inputs/fields/date-range/calendar/index.js +16 -1
- package/dist/components/inputs/fields/date-range/index.js +28 -3
- package/dist/components/inputs/fields/date-time/calendar/index.js +31 -5
- package/dist/components/inputs/fields/date-time/index.js +18 -1
- package/dist/components/inputs/fields/editable/index.js +16 -1
- package/dist/components/inputs/fields/input/index.js +13 -1
- package/dist/components/inputs/fields/input-file/index.js +24 -4
- package/dist/components/inputs/fields/input-tags/index.js +14 -2
- package/dist/components/inputs/fields/number/index.js +10 -1
- package/dist/components/inputs/fields/number-range/index.js +11 -1
- package/dist/components/inputs/fields/phone/index.js +414 -11
- package/dist/components/inputs/fields/text-area/index.js +13 -1
- package/dist/components/inputs/index.js +28 -1
- package/dist/components/inputs/label/index.js +12 -1
- package/dist/components/inputs/outline-container/index.js +18 -1
- package/dist/components/inputs/utils/action-button/index.js +10 -1
- package/dist/components/inputs/utils/calendar-button/index.js +13 -1
- package/dist/components/inputs/utils/date-selector/index.js +8 -1
- package/dist/components/inputs/utils/date-time-field/index.js +32 -1
- package/dist/components/inputs/utils/dialog/index.js +11 -1
- package/dist/components/inputs/utils/number-field/index.js +13 -1
- package/dist/components/inputs/utils/popover/index.js +13 -1
- package/dist/components/interactive-card/icon/index.js +7 -1
- package/dist/components/interactive-card/index.js +15 -1
- package/dist/components/language-selector/index.js +13 -1
- package/dist/components/language-selector/item-list/index.js +8 -1
- package/dist/components/link/index.js +52 -7
- package/dist/components/list-item/index.js +16 -1
- package/dist/components/little-flag/index.js +15 -3
- package/dist/components/loading/index.js +28 -14
- package/dist/components/logo/index.js +7 -1
- package/dist/components/logo-carousel/index.js +10 -4
- package/dist/components/lottie/index.js +15 -3
- package/dist/components/menu/index.js +23 -1
- package/dist/components/message-banner/index.js +21 -4
- package/dist/components/modal/index.js +19 -1
- package/dist/components/modal/modal-confirm/index.js +10 -1
- package/dist/components/modal/modal-footer/index.js +16 -1
- package/dist/components/modal/modal-header/index.js +25 -1
- package/dist/components/notification/index.js +68 -5
- package/dist/components/notification-sign/index.js +26 -6
- package/dist/components/number-input/index.js +25 -7
- package/dist/components/oauth-selector/index.js +26 -1
- package/dist/components/oauth-selector/option-container/index.js +15 -1
- package/dist/components/plan-card/index.js +84 -5
- package/dist/components/plan-card/recommended-tag/index.js +10 -1
- package/dist/components/pop-up/description/index.js +13 -1
- package/dist/components/pop-up/index.js +23 -1
- package/dist/components/premium-feature/index.js +45 -3
- package/dist/components/priority-score/index.js +14 -1
- package/dist/components/progress/index.js +23 -3
- package/dist/components/progress-bar/index.js +95 -5
- package/dist/components/radio-button/index.js +88 -3
- package/dist/components/scroll-button/index.js +20 -2
- package/dist/components/search/index.js +63 -7
- package/dist/components/search-bar/index.js +32 -1
- package/dist/components/search-bar/item-searching/index.js +10 -1
- package/dist/components/severity-badge/index.js +14 -1
- package/dist/components/severity-overview/badge/index.js +18 -1
- package/dist/components/severity-overview/index.js +7 -1
- package/dist/components/show-on-hover/index.js +25 -3
- package/dist/components/slide-out-menu/index.js +2009 -3
- package/dist/components/slide-out-menu/menu-item/index.js +15 -1
- package/dist/components/slider/index.js +93 -7
- package/dist/components/slider/thumb/index.js +10 -1
- package/dist/components/step-lapse/index.js +95 -9
- package/dist/components/table-button/index.js +56 -3
- package/dist/components/tabs/fixed-tabs/index.js +9 -1
- package/dist/components/tabs/index.js +14 -1
- package/dist/components/tabs/tab/index.js +8 -1
- package/dist/components/tag/index.js +116 -3
- package/dist/components/timeline/card/index.js +9 -1
- package/dist/components/timeline/index.js +7 -1
- package/dist/components/toggle/index.js +45 -14
- package/dist/components/toggle-buttons/index.js +74 -5
- package/dist/components/tooltip/index.js +13 -1
- package/dist/components/tour/index.js +2481 -4
- package/dist/components/typography/heading/index.js +9 -1
- package/dist/components/typography/index.js +8 -1
- package/dist/components/typography/span/index.js +9 -1
- package/dist/components/typography/text/index.js +9 -1
- package/dist/components/web-form/index.js +59 -7
- package/dist/hooks/index.js +13 -1
- package/dist/index-38JqtnAI.mjs +122 -0
- package/dist/index-B5yoGFs6.mjs +54 -0
- package/dist/index-BLbKylyw.mjs +209 -0
- package/dist/{index-C0_LPuYU.mjs → index-Bu448Tz2.mjs} +22 -22
- package/dist/index-BwFnfaRh.mjs +2310 -0
- package/dist/index-Co_k0WFk.mjs +75 -0
- package/dist/index-Cu7uUMlx.mjs +82 -0
- package/dist/index-D-lcuEHY.mjs +1018 -0
- package/dist/index-DrfjITyT.mjs +61 -0
- package/dist/index.js +206 -1
- package/dist/styles-7_q7nHce.mjs +110 -0
- package/dist/styles-BA0WIQL-.mjs +74 -0
- package/dist/styles-C3cZmKVJ.mjs +131 -0
- package/dist/styles-CI-I6joH.mjs +144 -0
- package/dist/styles-Cx93EcVo.mjs +76 -0
- package/dist/styles-D85YYIjM.mjs +131 -0
- package/dist/styles-EIbGRPlk.mjs +106 -0
- package/dist/styles-Q1VXuWI7.mjs +65 -0
- package/dist/styles-fH2c4cfc.mjs +77 -0
- package/dist/{styles-BAhpqi6C.mjs → styles-lSVV9kjn.mjs} +28 -28
- package/dist/use-carousel-CvRxi2FI.mjs +17 -0
- package/dist/use-click-outside-BtZLIoU1.mjs +18 -0
- package/dist/use-cloudinary-image-fG7ODNgr.mjs +611 -0
- package/dist/use-modal-CkrZ-_-M.mjs +14 -0
- package/dist/use-search-DpLNvt7Q.mjs +12 -0
- package/dist/utils-CQvBF-wY.mjs +4 -0
- package/package.json +3 -2
- package/dist/_commonjsHelpers-C37NGDzP.js +0 -1
- package/dist/_commonjsHelpers-D6CrkqQz.mjs +0 -6
- package/dist/index-BH27NQKA.mjs +0 -2311
- package/dist/index-Bcw2vW_n.mjs +0 -75
- package/dist/index-C8zdgAVH.mjs +0 -82
- package/dist/index-CA_9DXWd.js +0 -5
- package/dist/index-CmylnDrF.js +0 -14
- package/dist/index-DUMgwAbO.js +0 -26
- package/dist/index-DpQYiwGu.js +0 -5
- package/dist/index-Dy8ZUIYs.js +0 -5
- package/dist/index-JPf5Yzg6.js +0 -17
- package/dist/index-OBZtKZuT.mjs +0 -1021
- package/dist/index-SsXlDjK4.mjs +0 -122
- package/dist/index-TKLFHcRp.js +0 -18
- package/dist/index-TnyKqJHo.mjs +0 -61
- package/dist/index-Yr95Cb7Z.mjs +0 -54
- package/dist/index-h9-U5wxq.mjs +0 -209
- package/dist/index-qCiUU4sZ.js +0 -9
- package/dist/index-qe0nJwzl.js +0 -15
- package/dist/styles--Elze-LV.js +0 -3
- package/dist/styles-3pR4Xdvy.js +0 -33
- package/dist/styles-59h91S9m.mjs +0 -65
- package/dist/styles-BCwLWpC3.mjs +0 -126
- package/dist/styles-BJ7-0I5X.mjs +0 -74
- package/dist/styles-BKObp9bh.mjs +0 -76
- package/dist/styles-BWVdbvFu.js +0 -5
- package/dist/styles-Bl-CstrT.js +0 -5
- package/dist/styles-Bn42XCW5.js +0 -7
- package/dist/styles-C2CoGJl7.js +0 -33
- package/dist/styles-CNzziAXG.js +0 -5
- package/dist/styles-CdD9waPD.js +0 -29
- package/dist/styles-CnKTwnFk.mjs +0 -110
- package/dist/styles-D4R-eerv.mjs +0 -77
- package/dist/styles-DNIIhyRC.mjs +0 -144
- package/dist/styles-DV8yOaqV.mjs +0 -131
- package/dist/styles-DYoftbd3.js +0 -42
- package/dist/styles-DlmKLhPh.js +0 -7
- package/dist/styles-be8gOdgy.mjs +0 -106
- package/dist/use-carousel-64dKFW4E.js +0 -1
- package/dist/use-carousel-D7xeL3YZ.mjs +0 -17
- package/dist/use-click-outside-BqkLISED.js +0 -1
- package/dist/use-click-outside-C4Z4pdiW.mjs +0 -18
- package/dist/use-cloudinary-image-DKMl7jbx.mjs +0 -612
- package/dist/use-cloudinary-image-YMMafagv.js +0 -1
- package/dist/use-modal-CNbLSSQb.mjs +0 -14
- package/dist/use-modal-_bYY6M_n.js +0 -1
- package/dist/use-search-75ip5xR-.mjs +0 -12
- package/dist/use-search-DeL4UDMh.js +0 -1
- package/dist/utils-C2whpEd3.js +0 -1
- package/dist/utils-Da0qL35u.mjs +0 -4
|
@@ -1 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
import { jsx as i } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as L } from "react";
|
|
3
|
+
import { OutlineContainer as w } from "../../outline-container/index.js";
|
|
4
|
+
import { NumberField as C } from "../../utils/number-field/index.js";
|
|
5
|
+
const P = L(function({ decimalPlaces: o, disabled: a = !1, error: e, helpLink: l, helpText: m, id: n, label: t, maxLength: d, max: h, min: p, name: r, onChange: s, placeholder: c, required: f, tooltip: u, weight: x, ...b }, g) {
|
|
6
|
+
return i(w, { error: e, helpLink: l, helpText: m, htmlFor: r, label: t, maxLength: d, required: f, tooltip: u, weight: x, children: i(C, { decimalPlaces: o, disabled: a, error: e, id: n, max: h, min: p, name: r, onChange: s, placeholder: c, ref: g, ...b }) });
|
|
7
|
+
});
|
|
8
|
+
export {
|
|
9
|
+
P as InputNumber
|
|
10
|
+
};
|
|
@@ -1 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
import { jsx as e, jsxs as m } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as f } from "react";
|
|
3
|
+
import { OutlineContainer as u } from "../../outline-container/index.js";
|
|
4
|
+
import { NumberField as a } from "../../utils/number-field/index.js";
|
|
5
|
+
import { Container as b } from "../../../container/index.js";
|
|
6
|
+
const q = f(function({ disabled: o = !1, error: r, name: t, label: s, propsMax: n, propsMin: l, required: p, tooltip: d }, i) {
|
|
7
|
+
return e(u, { error: r, htmlFor: t, label: s, required: p, tooltip: d, children: m(b, { display: "flex", gap: 0.25, width: "100%", children: [e(a, { ...l, disabled: o, error: r, ref: i }), e(a, { ...n, disabled: o, error: r, ref: i })] }) });
|
|
8
|
+
});
|
|
9
|
+
export {
|
|
10
|
+
q as InputNumberRange
|
|
11
|
+
};
|
|
@@ -1,16 +1,419 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),t=require("../../../../index-CmylnDrF.js"),a=require("react"),r=require("react-dom"),n=require("styled-components"),i=require("../../outline-container/index.js"),o=require("../../../../styles-Bl-CstrT.js"),l=require("../../../icon/index.js");require("../../../typography/heading/index.js"),require("../../../typography/span/index.js");const s=require("../../../typography/text/index.js"),u=require("../../../../use-click-outside-BqkLISED.js");var d=[["Afghanistan","af","93"],["Albania","al","355"],["Algeria","dz","213"],["Andorra","ad","376"],["Angola","ao","244"],["Antigua and Barbuda","ag","1268"],["Argentina","ar","54","(..) ........",0],["Armenia","am","374",".. ......"],["Aruba","aw","297"],["Australia","au","61",{default:". .... ....","/^4/":"... ... ...","/^5(?!50)/":"... ... ...","/^1(3|8)00/":".... ... ...","/^13/":".. .. ..","/^180/":"... ...."},0,[]],["Austria","at","43"],["Azerbaijan","az","994","(..) ... .. .."],["Bahamas","bs","1242"],["Bahrain","bh","973"],["Bangladesh","bd","880"],["Barbados","bb","1246"],["Belarus","by","375","(..) ... .. .."],["Belgium","be","32","... .. .. .."],["Belize","bz","501"],["Benin","bj","229"],["Bhutan","bt","975"],["Bolivia","bo","591"],["Bosnia and Herzegovina","ba","387"],["Botswana","bw","267"],["Brazil","br","55","(..) ........."],["British Indian Ocean Territory","io","246"],["Brunei","bn","673"],["Bulgaria","bg","359"],["Burkina Faso","bf","226"],["Burundi","bi","257"],["Cambodia","kh","855"],["Cameroon","cm","237"],["Canada","ca","1","(...) ...-....",1,["204","226","236","249","250","289","306","343","365","387","403","416","418","431","437","438","450","506","514","519","548","579","581","587","604","613","639","647","672","705","709","742","778","780","782","807","819","825","867","873","902","905"]],["Cape Verde","cv","238"],["Caribbean Netherlands","bq","599","",1],["Cayman Islands","ky","1","... ... ....",4,["345"]],["Central African Republic","cf","236"],["Chad","td","235"],["Chile","cl","56"],["China","cn","86","... .... ...."],["Colombia","co","57","... ... ...."],["Comoros","km","269"],["Congo","cd","243"],["Congo","cg","242"],["Costa Rica","cr","506","....-...."],["Côte d'Ivoire","ci","225",".. .. .. .. .."],["Croatia","hr","385"],["Cuba","cu","53"],["Curaçao","cw","599","",0],["Cyprus","cy","357",".. ......"],["Czech Republic","cz","420","... ... ..."],["Denmark","dk","45",".. .. .. .."],["Djibouti","dj","253"],["Dominica","dm","1767"],["Dominican Republic","do","1","(...) ...-....",2,["809","829","849"]],["Ecuador","ec","593"],["Egypt","eg","20"],["El Salvador","sv","503","....-...."],["Equatorial Guinea","gq","240"],["Eritrea","er","291"],["Estonia","ee","372",".... ......"],["Ethiopia","et","251"],["Fiji","fj","679"],["Finland","fi","358",".. ... .. .."],["France","fr","33",". .. .. .. .."],["French Guiana","gf","594"],["French Polynesia","pf","689"],["Gabon","ga","241"],["Gambia","gm","220"],["Georgia","ge","995"],["Germany","de","49","... ........."],["Ghana","gh","233"],["Greece","gr","30"],["Greenland","gl","299",".. .. .."],["Grenada","gd","1473"],["Guadeloupe","gp","590","",0],["Guam","gu","1671"],["Guatemala","gt","502","....-...."],["Guinea","gn","224"],["Guinea-Bissau","gw","245"],["Guyana","gy","592"],["Haiti","ht","509","....-...."],["Honduras","hn","504"],["Hong Kong","hk","852",".... ...."],["Hungary","hu","36"],["Iceland","is","354","... ...."],["India","in","91",".....-....."],["Indonesia","id","62"],["Iran","ir","98","... ... ...."],["Iraq","iq","964"],["Ireland","ie","353",".. ......."],["Israel","il","972","... ... ...."],["Italy","it","39","... .......",0],["Jamaica","jm","1876"],["Japan","jp","81",".. .... ...."],["Jordan","jo","962"],["Kazakhstan","kz","7","... ...-..-..",0],["Kenya","ke","254"],["Kiribati","ki","686"],["Kosovo","xk","383"],["Kuwait","kw","965"],["Kyrgyzstan","kg","996","... ... ..."],["Laos","la","856"],["Latvia","lv","371",".. ... ..."],["Lebanon","lb","961"],["Lesotho","ls","266"],["Liberia","lr","231"],["Libya","ly","218"],["Liechtenstein","li","423"],["Lithuania","lt","370"],["Luxembourg","lu","352"],["Macau","mo","853"],["Macedonia","mk","389"],["Madagascar","mg","261"],["Malawi","mw","265"],["Malaysia","my","60","..-....-...."],["Maldives","mv","960"],["Mali","ml","223"],["Malta","mt","356"],["Marshall Islands","mh","692"],["Martinique","mq","596"],["Mauritania","mr","222"],["Mauritius","mu","230"],["Mexico","mx","52","... ... ....",0],["Micronesia","fm","691"],["Moldova","md","373","(..) ..-..-.."],["Monaco","mc","377"],["Mongolia","mn","976"],["Montenegro","me","382"],["Morocco","ma","212"],["Mozambique","mz","258"],["Myanmar","mm","95"],["Namibia","na","264"],["Nauru","nr","674"],["Nepal","np","977"],["Netherlands","nl","31",{"/^06/":"(.). .........","/^6/":". .........","/^0(10|13|14|15|20|23|24|26|30|33|35|36|38|40|43|44|45|46|50|53|55|58|70|71|72|73|74|75|76|77|78|79|82|84|85|87|88|91)/":"(.).. ........","/^(10|13|14|15|20|23|24|26|30|33|35|36|38|40|43|44|45|46|50|53|55|58|70|71|72|73|74|75|76|77|78|79|82|84|85|87|88|91)/":".. ........","/^0/":"(.)... .......",default:"... ......."}],["New Caledonia","nc","687"],["New Zealand","nz","64","...-...-...."],["Nicaragua","ni","505"],["Niger","ne","227"],["Nigeria","ng","234"],["North Korea","kp","850"],["Norway","no","47","... .. ..."],["Oman","om","968"],["Pakistan","pk","92","...-......."],["Palau","pw","680"],["Palestine","ps","970"],["Panama","pa","507"],["Papua New Guinea","pg","675"],["Paraguay","py","595"],["Peru","pe","51"],["Philippines","ph","63","... ... ...."],["Poland","pl","48","...-...-..."],["Portugal","pt","351"],["Puerto Rico","pr","1","(...) ...-....",3,["787","939"]],["Qatar","qa","974"],["Réunion","re","262"],["Romania","ro","40"],["Russia","ru","7","(...) ...-..-..",1],["Rwanda","rw","250"],["Saint Kitts and Nevis","kn","1869"],["Saint Lucia","lc","1758"],["Saint Vincent and the Grenadines","vc","1784"],["Samoa","ws","685"],["San Marino","sm","378"],["São Tomé and Príncipe","st","239"],["Saudi Arabia","sa","966"],["Senegal","sn","221"],["Serbia","rs","381"],["Seychelles","sc","248"],["Sierra Leone","sl","232"],["Singapore","sg","65","....-...."],["Slovakia","sk","421"],["Slovenia","si","386"],["Solomon Islands","sb","677"],["Somalia","so","252"],["South Africa","za","27"],["South Korea","kr","82","... .... ...."],["South Sudan","ss","211"],["Spain","es","34","... ... ..."],["Sri Lanka","lk","94"],["Sudan","sd","249"],["Suriname","sr","597"],["Swaziland","sz","268"],["Sweden","se","46","... ... ..."],["Switzerland","ch","41",".. ... .. .."],["Syria","sy","963"],["Taiwan","tw","886"],["Tajikistan","tj","992"],["Tanzania","tz","255"],["Thailand","th","66"],["Timor-Leste","tl","670"],["Togo","tg","228"],["Tonga","to","676"],["Trinidad and Tobago","tt","1868"],["Tunisia","tn","216"],["Turkey","tr","90","... ... .. .."],["Turkmenistan","tm","993"],["Tuvalu","tv","688"],["Uganda","ug","256"],["Ukraine","ua","380","(..) ... .. .."],["United Arab Emirates","ae","971"],["United Kingdom","gb","44",".... ......"],["United States","us","1","(...) ...-....",0],["Uruguay","uy","598"],["Uzbekistan","uz","998",".. ... .. .."],["Vanuatu","vu","678"],["Vatican City","va","39",".. .... ....",1],["Venezuela","ve","58"],["Vietnam","vn","84"],["Yemen","ye","967"],["Zambia","zm","260"],["Zimbabwe","zw","263"]],c=(...e)=>e.filter((e=>!!e)).join(" ").trim(),p=({addPrefix:e,rawClassNames:t})=>c(((...e)=>c(...e).split(" ").map((e=>`react-international-phone-${e}`)).join(" "))(...e),...t),f=e=>!!e&&/^\d+$/.test(e),m=e=>e.replace(/\D/g,""),h=({phone:e,prefix:t})=>e?`${t}${m(e)}`:"";function y({value:e,country:t,insertDialCodeOnEmpty:a,trimNonDigitsEnd:r,countries:n,prefix:i,charAfterDialCode:o,forceDialCode:l,disableDialCodeAndPrefix:s,defaultMask:u,countryGuessingEnabled:d,disableFormatting:c}){let p=e;s&&(p=p.startsWith(`${i}`)?p:`${i}${t.dialCode}${p}`);let f=d?D({phone:p,countries:n,currentCountryIso2:null==t?void 0:t.iso2}):void 0,y=(null==f?void 0:f.country)??t,g=((e,t)=>{let a=!t.disableDialCodeAndPrefix&&t.forceDialCode,r=!t.disableDialCodeAndPrefix&&t.insertDialCodeOnEmpty,n=e,i=e=>t.trimNonDigitsEnd?e.trim():e;if(!n)return r&&!n.length||a?i(`${t.prefix}${t.dialCode}${t.charAfterDialCode}`):i(n);if(n=m(n),n===t.dialCode&&!t.disableDialCodeAndPrefix)return i(`${t.prefix}${t.dialCode}${t.charAfterDialCode}`);if(t.dialCode.startsWith(n)&&!t.disableDialCodeAndPrefix)return i(a?`${t.prefix}${t.dialCode}${t.charAfterDialCode}`:`${t.prefix}${n}`);if(!n.startsWith(t.dialCode)&&!t.disableDialCodeAndPrefix){if(a)return i(`${t.prefix}${t.dialCode}${t.charAfterDialCode}`);if(n.length<t.dialCode.length)return i(`${t.prefix}${n}`)}let{phoneLeftSide:o,phoneRightSide:l}=(()=>{let e=t.dialCode.length;return{phoneLeftSide:n.slice(0,e),phoneRightSide:n.slice(e)}})();return o=`${t.prefix}${o}${t.charAfterDialCode}`,l=(({value:e,mask:t,maskSymbol:a,offset:r=0,trimNonMaskCharsLeftover:n=!1})=>{if(e.length<r)return e;let i=e.slice(0,r),o=e.slice(r),l=i,s=0;for(let u of t.split("")){if(s>=o.length){if(!n&&u!==a){l+=u;continue}break}u===a?(l+=o[s],s+=1):l+=u}return l})({value:l,mask:t.mask,maskSymbol:t.maskChar,trimNonMaskCharsLeftover:t.trimNonDigitsEnd||t.disableDialCodeAndPrefix&&0===l.length}),t.disableDialCodeAndPrefix&&(o=""),i(`${o}${l}`)})(p,{prefix:i,mask:w({phone:p,country:y,defaultMask:u,disableFormatting:c}),maskChar:C,dialCode:y.dialCode,trimNonDigitsEnd:r,charAfterDialCode:o,forceDialCode:l,insertDialCodeOnEmpty:a,disableDialCodeAndPrefix:s}),b=d&&!(null==f?void 0:f.fullDialCodeMatch)?t:y;return{phone:h({phone:s?`${b.dialCode}${g}`:g,prefix:i}),inputValue:g,country:b}}var g={size:20,overrideLastItemDebounceMS:-1};var C=".",b=d,v=({defaultCountry:e="us",value:t="",countries:r=b,prefix:n="+",defaultMask:i="............",charAfterDialCode:o=" ",historySaveDebounceMS:l=200,disableCountryGuess:s=false,disableDialCodePrefill:u=false,forceDialCode:d=false,disableDialCodeAndPrefix:c=false,disableFormatting:p=false,onChange:m,inputRef:C})=>{let v={countries:r,prefix:n,charAfterDialCode:o,forceDialCode:!c&&d,disableDialCodeAndPrefix:c,defaultMask:i,countryGuessingEnabled:!s,disableFormatting:p},w=a.useRef(null),x=C||w,D=e=>{Promise.resolve().then((()=>{var t;typeof window>"u"||x.current!==(null==document?void 0:document.activeElement)||null==(t=x.current)||t.setSelectionRange(e,e)}))},[{phone:$,inputValue:S,country:N},P,A,E]=function(e,t){let{size:r,overrideLastItemDebounceMS:n,onChange:i}={...g,...t},[o,l]=a.useState(e),[s,u]=a.useState([o]),[d,c]=a.useState(0),p=(()=>{let e=a.useRef(),t=a.useRef(Date.now());return{check:()=>{let a=Date.now(),r=e.current?a-t.current:void 0;return e.current=t.current,t.current=a,r}}})();return[o,(e,t)=>{if("object"==typeof e&&"object"==typeof o&&((e,t)=>{let a=Object.keys(e),r=Object.keys(t);if(a.length!==r.length)return!1;for(let n of a)if(e[n]!==t[n])return!1;return!0})(e,o)||e===o)return;let a=n>0,f=p.check(),m=!a||void 0===f||f>n;if(void 0!==(null==t?void 0:t.overrideLastItem)?t.overrideLastItem:!m)u((t=>[...t.slice(0,d),e]));else{let t=s.length>=r;u((a=>[...a.slice(t?1:0,d+1),e])),t||c((e=>e+1))}l(e),null==i||i(e)},()=>{if(d<=0)return{success:!1};let e=s[d-1];return l(e),c((e=>e-1)),null==i||i(e),{success:!0,value:e}},()=>{if(d+1>=s.length)return{success:!1};let e=s[d+1];return l(e),c((e=>e+1)),null==i||i(e),{success:!0,value:e}}]}((()=>{let a=k({value:e,field:"iso2",countries:r}),n=a||k({value:"us",field:"iso2",countries:r}),{phone:i,inputValue:o,country:l}=y({value:t,country:n,insertDialCodeOnEmpty:!u,...v});return D(o.length),{phone:i,inputValue:o,country:l.iso2}}),{overrideLastItemDebounceMS:l,onChange:({inputValue:e,phone:t,country:a})=>{if(!m)return;let r=M(a);m({phone:t,inputValue:e,country:r})}}),M=a.useCallback((e=>k({value:e,field:"iso2",countries:r})),[r]),j=a.useMemo((()=>M(N)),[N,M]);a.useEffect((()=>{let e=x.current;if(!e)return;let t=e=>{if(!e.key)return;let t=e.ctrlKey,a=e.metaKey,r=e.shiftKey;if("z"===e.key.toLowerCase()){if(typeof window>"u"||!window.navigator.userAgent.toLowerCase().includes("macintosh")){if(!t)return}else if(!a)return;r?E():A()}};return e.addEventListener("keydown",t),()=>{e.removeEventListener("keydown",t)}}),[x,A,E]);let[I,z]=a.useState(!1);return a.useEffect((()=>{if(!I)return z(!0),void(t!==$&&(null==m||m({inputValue:S,phone:$,country:j})));if(t===$)return;let{phone:e,inputValue:a,country:r}=y({value:t,country:j,insertDialCodeOnEmpty:!u,...v});P({phone:e,inputValue:a,country:r.iso2})}),[t]),{phone:$,inputValue:S,country:j,setCountry:(e,t={focusOnInput:!1})=>{let a=k({value:e,field:"iso2",countries:r});if(!a)return;let i=c?"":`${n}${a.dialCode}${o}`;P({inputValue:i,phone:`${n}${a.dialCode}`,country:a.iso2}),t.focusOnInput&&Promise.resolve().then((()=>{var e;null==(e=x.current)||e.focus()}))},handlePhoneValueChange:e=>{e.preventDefault();let{phone:a,inputValue:r,country:n,cursorPosition:i}=((e,{country:t,insertDialCodeOnEmpty:a,phoneBeforeInput:r,prefix:n,charAfterDialCode:i,forceDialCode:o,disableDialCodeAndPrefix:l,countryGuessingEnabled:s,defaultMask:u,disableFormatting:d,countries:c})=>{let p=e.nativeEvent,m=p.inputType,g=(e=>{if(null==e?void 0:e.toLocaleLowerCase().includes("delete"))return(null==e?void 0:e.toLocaleLowerCase().includes("forward"))?"forward":"backward"})(m),C=!!(null==m?void 0:m.startsWith("insertFrom")),b="insertText"===m,v=(null==p?void 0:p.data)||void 0,w=e.target.value,x=e.target.selectionStart??0;if(null==m?void 0:m.includes("history"))return{inputValue:r,phone:h({phone:r,prefix:n}),cursorPosition:r.length,country:t};if(b&&!f(v)&&w!==n)return{inputValue:r,phone:h({phone:l?`${t.dialCode}${r}`:r,prefix:n}),cursorPosition:x-((null==v?void 0:v.length)??0),country:t};if(o&&!w.startsWith(`${n}${t.dialCode}`)&&!C){let e=w?r:`${n}${t.dialCode}${i}`;return{inputValue:e,phone:h({phone:e,prefix:n}),cursorPosition:n.length+t.dialCode.length+i.length,country:t}}let{phone:k,inputValue:D,country:$}=y({value:w,country:t,trimNonDigitsEnd:"backward"===g,insertDialCodeOnEmpty:a,countryGuessingEnabled:s,countries:c,prefix:n,charAfterDialCode:i,forceDialCode:o,disableDialCodeAndPrefix:l,disableFormatting:d,defaultMask:u});return{phone:k,inputValue:D,cursorPosition:(({phoneBeforeInput:e,phoneAfterInput:t,phoneAfterFormatted:a,cursorPositionAfterInput:r,leftOffset:n=0,deletion:i})=>{if(r<n)return n;if(!e)return a.length;let o=null;for(let d=r-1;d>=0;d-=1)if(f(t[d])){o=d;break}if(null===o){for(let e=0;e<t.length;e+=1)if(f(a[e]))return e;return t.length}let l=0;for(let d=0;d<o;d+=1)f(t[d])&&(l+=1);let s=0,u=0;for(let d=0;d<a.length&&(s+=1,f(a[d])&&(u+=1),!(u>=l+1));d+=1);if("backward"!==i)for(;!f(a[s])&&s<a.length;)s+=1;return s})({cursorPositionAfterInput:x,phoneBeforeInput:r,phoneAfterInput:w,phoneAfterFormatted:D,leftOffset:o?n.length+t.dialCode.length+i.length:0,deletion:g}),country:$}})(e,{country:j,phoneBeforeInput:S,insertDialCodeOnEmpty:!1,...v});return P({inputValue:r,phone:a,country:n.iso2}),D(i),t},inputRef:x}},w=({phone:e,country:t,defaultMask:a="............",disableFormatting:r=!1})=>{let n=t.format,i=e=>r?e.replace(new RegExp(`[^${C}]`,"g"),""):e;if(!n)return i(a);if("string"==typeof n)return i(n);if(!n.default)return i(a);let o=Object.keys(n).find((a=>{if("default"===a)return!1;if("/"!==a.charAt(0)||"/"!==a.charAt(a.length-1))return!1;let r=new RegExp(a.substring(1,a.length-1)),n=e.replace(t.dialCode,"");return r.test(m(n))}));return i(o?n[o]:n.default)},x=e=>{let[t,a,r,n,i,o]=e;return{name:t,iso2:a,dialCode:r,format:n,priority:i,areaCodes:o}},k=({field:e,value:t,countries:a=d})=>{if(["priority"].includes(e))throw new Error(`Field "${e}" is not supported`);let r=a.find((a=>{let r=x(a);return t===r[e]}));if(r)return x(r)},D=({phone:e,countries:t=d,currentCountryIso2:a})=>{var r;let n={country:void 0,fullDialCodeMatch:!1};if(!e)return n;let i=m(e);if(!i)return n;let o=n,l=({country:e,fullDialCodeMatch:t})=>{var a,r;let n=e.dialCode===(null==(a=o.country)?void 0:a.dialCode),i=(e.priority??0)<((null==(r=o.country)?void 0:r.priority)??0);(!n||i)&&(o={country:e,fullDialCodeMatch:t})};for(let s of t){let e=x(s),{dialCode:t,areaCodes:a}=e;if(i.startsWith(t)){let r=!o.country||Number(t)>=Number(o.country.dialCode);if(a){let r=i.substring(t.length);for(let t of a)if(r.startsWith(t))return{country:e,fullDialCodeMatch:!0}}(r||t===i||!o.fullDialCodeMatch)&&l({country:e,fullDialCodeMatch:!0})}o.fullDialCodeMatch||i.length<t.length&&t.startsWith(i)&&(!o.country||Number(t)<=Number(o.country.dialCode))&&l({country:e,fullDialCodeMatch:!1})}if(a){let e=k({value:a,field:"iso2",countries:t});if(!e)return o;let n=!!e&&(e=>{if(!(null==e?void 0:e.areaCodes))return!1;let t=i.substring(e.dialCode.length);return e.areaCodes.some((e=>e.startsWith(t)))})(e);o&&(null==(r=o.country)?void 0:r.dialCode)===e.dialCode&&o.country!==e&&o.fullDialCodeMatch&&(!e.areaCodes||n)&&(o={country:e,fullDialCodeMatch:!0})}return o},$=(e,t)=>{let a=parseInt(e,16);return Number(a+t).toString(16)},S="abcdefghijklmnopqrstuvwxyz".split("").reduce(((e,t,a)=>({...e,[t]:$("1f1e6",a)})),{}),N=({iso2:e,size:t,src:r,protocol:n="https",disableLazyLoading:i,className:o,style:l,...s})=>e?a.createElement("img",{className:p({addPrefix:["flag-emoji"],rawClassNames:[o]}),src:(()=>{if(r)return r;let t=[S[(a=e)[0]],S[a[1]]].join("-");var a;return`${n}://cdnjs.cloudflare.com/ajax/libs/twemoji/14.0.2/svg/${t}.svg`})(),width:t,height:t,draggable:!1,"data-country":e,loading:i?void 0:"lazy",style:{width:t,height:t,...l},alt:"",...s}):a.createElement("img",{className:p({addPrefix:["flag-emoji"],rawClassNames:[o]}),width:t,height:t,...s}),P=({show:e,dialCodePrefix:t="+",selectedCountry:r,countries:n=d,preferredCountries:i=[],flags:o,onSelect:l,onClose:s,...u})=>{let c=a.useRef(null),f=a.useRef(),m=a.useMemo((()=>{if(!i||!i.length)return n;let e=[],t=[...n];for(let a of i){let r=t.findIndex((e=>x(e).iso2===a));if(-1!==r){let a=t.splice(r,1)[0];e.push(a)}}return e.concat(t)}),[n,i]),h=a.useRef({updatedAt:void 0,value:""}),y=a.useCallback((e=>m.findIndex((t=>x(t).iso2===e))),[m]),[g,C]=a.useState(y(r)),b=()=>{f.current!==r&&C(y(r))},v=a.useCallback((e=>{C(y(e.iso2)),null==l||l(e)}),[l,y]),w=e=>{let t=m.length-1;C((a=>{let r=(n=a,"prev"===e?n-1:"next"===e?n+1:"last"===e?t:0);var n;return r<0?0:r>t?t:r}))},k=a.useCallback((()=>{if(!c.current||void 0===g)return;let e=x(m[g]).iso2;if(e===f.current)return;let t=c.current.querySelector(`[data-country="${e}"]`);t&&(((e,t)=>{let a=e.style.display;"block"!==a&&(e.style.display="block");let r=e.getBoundingClientRect(),n=t.getBoundingClientRect(),i=n.top-r.top,o=r.bottom-n.bottom;i>=0&&o>=0||(Math.abs(i)<Math.abs(o)?e.scrollTop+=i:e.scrollTop-=o),e.style.display=a})(c.current,t),f.current=e)}),[g,m]);return a.useEffect((()=>{k()}),[g,k]),a.useEffect((()=>{c.current&&(e?c.current.focus():b())}),[e]),a.useEffect((()=>{b()}),[r]),a.createElement("ul",{ref:c,role:"listbox",className:p({addPrefix:["country-selector-dropdown"],rawClassNames:[u.className]}),style:{display:e?"block":"none",...u.style},onKeyDown:e=>{if(e.stopPropagation(),"Enter"!==e.key){if("Escape"!==e.key)return"ArrowUp"===e.key?(e.preventDefault(),void w("prev")):"ArrowDown"===e.key?(e.preventDefault(),void w("next")):"PageUp"===e.key?(e.preventDefault(),void w("first")):"PageDown"===e.key?(e.preventDefault(),void w("last")):(" "===e.key&&e.preventDefault(),void(1===e.key.length&&!e.altKey&&!e.ctrlKey&&!e.metaKey&&(e=>{let t=h.current.updatedAt&&(new Date).getTime()-h.current.updatedAt.getTime()>1e3;h.current={value:t?e:`${h.current.value}${e}`,updatedAt:new Date};let a=m.findIndex((e=>x(e).name.toLowerCase().startsWith(h.current.value)));-1!==a&&C(a)})(e.key.toLocaleLowerCase())));null==s||s()}else{e.preventDefault();let t=x(m[g]);v(t)}},onBlur:s,tabIndex:-1,"aria-activedescendant":`react-international-phone__${x(m[g]).iso2}-option`},m.map(((e,n)=>{let l=x(e),s=l.iso2===r,d=n===g,c=i.includes(l.iso2),f=n===i.length-1,m=null==o?void 0:o.find((e=>e.iso2===l.iso2));return a.createElement(a.Fragment,{key:l.iso2},a.createElement("li",{"data-country":l.iso2,role:"option","aria-selected":s,"aria-label":`${l.name} ${t}${l.dialCode}`,id:`react-international-phone__${l.iso2}-option`,className:p({addPrefix:["country-selector-dropdown__list-item",c&&"country-selector-dropdown__list-item--preferred",s&&"country-selector-dropdown__list-item--selected",d&&"country-selector-dropdown__list-item--focused"],rawClassNames:[u.listItemClassName]}),onClick:()=>v(l),style:u.listItemStyle,title:l.name},a.createElement(N,{iso2:l.iso2,src:null==m?void 0:m.src,className:p({addPrefix:["country-selector-dropdown__list-item-flag-emoji"],rawClassNames:[u.listItemFlagClassName]}),style:u.listItemFlagStyle}),a.createElement("span",{className:p({addPrefix:["country-selector-dropdown__list-item-country-name"],rawClassNames:[u.listItemCountryNameClassName]}),style:u.listItemCountryNameStyle},l.name),a.createElement("span",{className:p({addPrefix:["country-selector-dropdown__list-item-dial-code"],rawClassNames:[u.listItemDialCodeClassName]}),style:u.listItemDialCodeStyle},t,l.dialCode)),f?a.createElement("hr",{className:p({addPrefix:["country-selector-dropdown__preferred-list-divider"],rawClassNames:[u.preferredListDividerClassName]}),style:u.preferredListDividerStyle}):null)})))},A=({selectedCountry:e,onSelect:t,disabled:r,hideDropdown:n,countries:i=d,preferredCountries:o=[],flags:l,renderButtonWrapper:s,...u})=>{let[c,f]=a.useState(!1),m=a.useMemo((()=>{if(e)return k({value:e,field:"iso2",countries:i})}),[i,e]),h=a.useRef(null),y=e=>{e.key&&["ArrowUp","ArrowDown"].includes(e.key)&&(e.preventDefault(),f(!0))};return a.createElement("div",{className:p({addPrefix:["country-selector"],rawClassNames:[u.className]}),style:u.style,ref:h},(()=>{var t;let i={title:null==m?void 0:m.name,onClick:()=>f((e=>!e)),onMouseDown:e=>e.preventDefault(),onKeyDown:y,disabled:n||r,role:"combobox","aria-label":"Country selector","aria-haspopup":"listbox","aria-expanded":c},o=a.createElement("div",{className:p({addPrefix:["country-selector-button__button-content"],rawClassNames:[u.buttonContentWrapperClassName]}),style:u.buttonContentWrapperStyle},a.createElement(N,{iso2:e,src:null==(t=null==l?void 0:l.find((t=>t.iso2===e)))?void 0:t.src,className:p({addPrefix:["country-selector-button__flag-emoji",r&&"country-selector-button__flag-emoji--disabled"],rawClassNames:[u.flagClassName]}),style:{visibility:e?"visible":"hidden",...u.flagStyle}}),!n&&a.createElement("div",{className:p({addPrefix:["country-selector-button__dropdown-arrow",r&&"country-selector-button__dropdown-arrow--disabled",c&&"country-selector-button__dropdown-arrow--active"],rawClassNames:[u.dropdownArrowClassName]}),style:u.dropdownArrowStyle}));return s?s({children:o,rootProps:i}):a.createElement("button",{...i,type:"button",className:p({addPrefix:["country-selector-button",c&&"country-selector-button--active",r&&"country-selector-button--disabled",n&&"country-selector-button--hide-dropdown"],rawClassNames:[u.buttonClassName]}),"data-country":e,style:u.buttonStyle},o)})(),a.createElement(P,{show:c,countries:i,preferredCountries:o,flags:l,onSelect:e=>{f(!1),null==t||t(e)},selectedCountry:e,onClose:()=>{f(!1)},...u.dropdownStyleProps}))},E=({dialCode:e,prefix:t,disabled:r,style:n,className:i})=>a.createElement("div",{className:p({addPrefix:["dial-code-preview",r&&"dial-code-preview--disabled"],rawClassNames:[i]}),style:n},`${t}${e}`);a.forwardRef((({value:e,onChange:t,countries:r=d,preferredCountries:n=[],hideDropdown:i,showDisabledDialCodeAndPrefix:o,disableFocusAfterCountrySelect:l,flags:s,style:u,className:c,inputStyle:f,inputClassName:m,countrySelectorStyleProps:h,dialCodePreviewStyleProps:y,inputProps:g,placeholder:C,disabled:b,name:w,onFocus:x,onBlur:k,required:D,autoFocus:$,...S},N)=>{let{phone:P,inputValue:M,inputRef:j,country:I,setCountry:z,handlePhoneValueChange:L}=v({value:e,countries:r,...S,onChange:e=>{null==t||t(e.phone,{country:e.country,inputValue:e.inputValue})}}),B=S.disableDialCodeAndPrefix&&o&&(null==I?void 0:I.dialCode);return a.useImperativeHandle(N,(()=>j.current?Object.assign(j.current,{setCountry:z,state:{phone:P,inputValue:M,country:I}}):null),[j,z,P,M,I]),a.createElement("div",{ref:N,className:p({addPrefix:["input-container"],rawClassNames:[c]}),style:u},a.createElement(A,{onSelect:e=>z(e.iso2,{focusOnInput:!l}),flags:s,selectedCountry:I.iso2,countries:r,preferredCountries:n,disabled:b,hideDropdown:i,...h}),B&&a.createElement(E,{dialCode:I.dialCode,prefix:S.prefix??"+",disabled:b,...y}),a.createElement("input",{onChange:L,value:M,type:"tel",ref:j,className:p({addPrefix:["input",b&&"input--disabled"],rawClassNames:[m]}),placeholder:C,disabled:b,style:f,name:w,onFocus:x,onBlur:k,autoFocus:$,required:D,...g}))}));const M=n.styled.div`
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
import { jsx as _, jsxs as U } from "react/jsx-runtime";
|
|
2
|
+
import { u as oe, a as ie } from "../../../../index-D-lcuEHY.mjs";
|
|
3
|
+
import I, { forwardRef as ae, useImperativeHandle as le, useRef as F, useCallback as R, useMemo as Y, useEffect as q, useState as G } from "react";
|
|
4
|
+
import { createPortal as se } from "react-dom";
|
|
5
|
+
import { styled as W, useTheme as de } from "styled-components";
|
|
6
|
+
import { OutlineContainer as ue } from "../../outline-container/index.js";
|
|
7
|
+
import { S as ce } from "../../../../styles-lSVV9kjn.mjs";
|
|
8
|
+
import { Icon as X } from "../../../icon/index.js";
|
|
9
|
+
import "../../../typography/heading/index.js";
|
|
10
|
+
import "../../../typography/span/index.js";
|
|
11
|
+
import { Text as pe } from "../../../typography/text/index.js";
|
|
12
|
+
import { u as fe } from "../../../../use-click-outside-BtZLIoU1.mjs";
|
|
13
|
+
var T = [["Afghanistan", "af", "93"], ["Albania", "al", "355"], ["Algeria", "dz", "213"], ["Andorra", "ad", "376"], ["Angola", "ao", "244"], ["Antigua and Barbuda", "ag", "1268"], ["Argentina", "ar", "54", "(..) ........", 0], ["Armenia", "am", "374", ".. ......"], ["Aruba", "aw", "297"], ["Australia", "au", "61", { default: ". .... ....", "/^4/": "... ... ...", "/^5(?!50)/": "... ... ...", "/^1(3|8)00/": ".... ... ...", "/^13/": ".. .. ..", "/^180/": "... ...." }, 0, []], ["Austria", "at", "43"], ["Azerbaijan", "az", "994", "(..) ... .. .."], ["Bahamas", "bs", "1242"], ["Bahrain", "bh", "973"], ["Bangladesh", "bd", "880"], ["Barbados", "bb", "1246"], ["Belarus", "by", "375", "(..) ... .. .."], ["Belgium", "be", "32", "... .. .. .."], ["Belize", "bz", "501"], ["Benin", "bj", "229"], ["Bhutan", "bt", "975"], ["Bolivia", "bo", "591"], ["Bosnia and Herzegovina", "ba", "387"], ["Botswana", "bw", "267"], ["Brazil", "br", "55", "(..) ........."], ["British Indian Ocean Territory", "io", "246"], ["Brunei", "bn", "673"], ["Bulgaria", "bg", "359"], ["Burkina Faso", "bf", "226"], ["Burundi", "bi", "257"], ["Cambodia", "kh", "855"], ["Cameroon", "cm", "237"], ["Canada", "ca", "1", "(...) ...-....", 1, ["204", "226", "236", "249", "250", "289", "306", "343", "365", "387", "403", "416", "418", "431", "437", "438", "450", "506", "514", "519", "548", "579", "581", "587", "604", "613", "639", "647", "672", "705", "709", "742", "778", "780", "782", "807", "819", "825", "867", "873", "902", "905"]], ["Cape Verde", "cv", "238"], ["Caribbean Netherlands", "bq", "599", "", 1], ["Cayman Islands", "ky", "1", "... ... ....", 4, ["345"]], ["Central African Republic", "cf", "236"], ["Chad", "td", "235"], ["Chile", "cl", "56"], ["China", "cn", "86", "... .... ...."], ["Colombia", "co", "57", "... ... ...."], ["Comoros", "km", "269"], ["Congo", "cd", "243"], ["Congo", "cg", "242"], ["Costa Rica", "cr", "506", "....-...."], ["Côte d'Ivoire", "ci", "225", ".. .. .. .. .."], ["Croatia", "hr", "385"], ["Cuba", "cu", "53"], ["Curaçao", "cw", "599", "", 0], ["Cyprus", "cy", "357", ".. ......"], ["Czech Republic", "cz", "420", "... ... ..."], ["Denmark", "dk", "45", ".. .. .. .."], ["Djibouti", "dj", "253"], ["Dominica", "dm", "1767"], ["Dominican Republic", "do", "1", "(...) ...-....", 2, ["809", "829", "849"]], ["Ecuador", "ec", "593"], ["Egypt", "eg", "20"], ["El Salvador", "sv", "503", "....-...."], ["Equatorial Guinea", "gq", "240"], ["Eritrea", "er", "291"], ["Estonia", "ee", "372", ".... ......"], ["Ethiopia", "et", "251"], ["Fiji", "fj", "679"], ["Finland", "fi", "358", ".. ... .. .."], ["France", "fr", "33", ". .. .. .. .."], ["French Guiana", "gf", "594"], ["French Polynesia", "pf", "689"], ["Gabon", "ga", "241"], ["Gambia", "gm", "220"], ["Georgia", "ge", "995"], ["Germany", "de", "49", "... ........."], ["Ghana", "gh", "233"], ["Greece", "gr", "30"], ["Greenland", "gl", "299", ".. .. .."], ["Grenada", "gd", "1473"], ["Guadeloupe", "gp", "590", "", 0], ["Guam", "gu", "1671"], ["Guatemala", "gt", "502", "....-...."], ["Guinea", "gn", "224"], ["Guinea-Bissau", "gw", "245"], ["Guyana", "gy", "592"], ["Haiti", "ht", "509", "....-...."], ["Honduras", "hn", "504"], ["Hong Kong", "hk", "852", ".... ...."], ["Hungary", "hu", "36"], ["Iceland", "is", "354", "... ...."], ["India", "in", "91", ".....-....."], ["Indonesia", "id", "62"], ["Iran", "ir", "98", "... ... ...."], ["Iraq", "iq", "964"], ["Ireland", "ie", "353", ".. ......."], ["Israel", "il", "972", "... ... ...."], ["Italy", "it", "39", "... .......", 0], ["Jamaica", "jm", "1876"], ["Japan", "jp", "81", ".. .... ...."], ["Jordan", "jo", "962"], ["Kazakhstan", "kz", "7", "... ...-..-..", 0], ["Kenya", "ke", "254"], ["Kiribati", "ki", "686"], ["Kosovo", "xk", "383"], ["Kuwait", "kw", "965"], ["Kyrgyzstan", "kg", "996", "... ... ..."], ["Laos", "la", "856"], ["Latvia", "lv", "371", ".. ... ..."], ["Lebanon", "lb", "961"], ["Lesotho", "ls", "266"], ["Liberia", "lr", "231"], ["Libya", "ly", "218"], ["Liechtenstein", "li", "423"], ["Lithuania", "lt", "370"], ["Luxembourg", "lu", "352"], ["Macau", "mo", "853"], ["Macedonia", "mk", "389"], ["Madagascar", "mg", "261"], ["Malawi", "mw", "265"], ["Malaysia", "my", "60", "..-....-...."], ["Maldives", "mv", "960"], ["Mali", "ml", "223"], ["Malta", "mt", "356"], ["Marshall Islands", "mh", "692"], ["Martinique", "mq", "596"], ["Mauritania", "mr", "222"], ["Mauritius", "mu", "230"], ["Mexico", "mx", "52", "... ... ....", 0], ["Micronesia", "fm", "691"], ["Moldova", "md", "373", "(..) ..-..-.."], ["Monaco", "mc", "377"], ["Mongolia", "mn", "976"], ["Montenegro", "me", "382"], ["Morocco", "ma", "212"], ["Mozambique", "mz", "258"], ["Myanmar", "mm", "95"], ["Namibia", "na", "264"], ["Nauru", "nr", "674"], ["Nepal", "np", "977"], ["Netherlands", "nl", "31", { "/^06/": "(.). .........", "/^6/": ". .........", "/^0(10|13|14|15|20|23|24|26|30|33|35|36|38|40|43|44|45|46|50|53|55|58|70|71|72|73|74|75|76|77|78|79|82|84|85|87|88|91)/": "(.).. ........", "/^(10|13|14|15|20|23|24|26|30|33|35|36|38|40|43|44|45|46|50|53|55|58|70|71|72|73|74|75|76|77|78|79|82|84|85|87|88|91)/": ".. ........", "/^0/": "(.)... .......", default: "... ......." }], ["New Caledonia", "nc", "687"], ["New Zealand", "nz", "64", "...-...-...."], ["Nicaragua", "ni", "505"], ["Niger", "ne", "227"], ["Nigeria", "ng", "234"], ["North Korea", "kp", "850"], ["Norway", "no", "47", "... .. ..."], ["Oman", "om", "968"], ["Pakistan", "pk", "92", "...-......."], ["Palau", "pw", "680"], ["Palestine", "ps", "970"], ["Panama", "pa", "507"], ["Papua New Guinea", "pg", "675"], ["Paraguay", "py", "595"], ["Peru", "pe", "51"], ["Philippines", "ph", "63", "... ... ...."], ["Poland", "pl", "48", "...-...-..."], ["Portugal", "pt", "351"], ["Puerto Rico", "pr", "1", "(...) ...-....", 3, ["787", "939"]], ["Qatar", "qa", "974"], ["Réunion", "re", "262"], ["Romania", "ro", "40"], ["Russia", "ru", "7", "(...) ...-..-..", 1], ["Rwanda", "rw", "250"], ["Saint Kitts and Nevis", "kn", "1869"], ["Saint Lucia", "lc", "1758"], ["Saint Vincent and the Grenadines", "vc", "1784"], ["Samoa", "ws", "685"], ["San Marino", "sm", "378"], ["São Tomé and Príncipe", "st", "239"], ["Saudi Arabia", "sa", "966"], ["Senegal", "sn", "221"], ["Serbia", "rs", "381"], ["Seychelles", "sc", "248"], ["Sierra Leone", "sl", "232"], ["Singapore", "sg", "65", "....-...."], ["Slovakia", "sk", "421"], ["Slovenia", "si", "386"], ["Solomon Islands", "sb", "677"], ["Somalia", "so", "252"], ["South Africa", "za", "27"], ["South Korea", "kr", "82", "... .... ...."], ["South Sudan", "ss", "211"], ["Spain", "es", "34", "... ... ..."], ["Sri Lanka", "lk", "94"], ["Sudan", "sd", "249"], ["Suriname", "sr", "597"], ["Swaziland", "sz", "268"], ["Sweden", "se", "46", "... ... ..."], ["Switzerland", "ch", "41", ".. ... .. .."], ["Syria", "sy", "963"], ["Taiwan", "tw", "886"], ["Tajikistan", "tj", "992"], ["Tanzania", "tz", "255"], ["Thailand", "th", "66"], ["Timor-Leste", "tl", "670"], ["Togo", "tg", "228"], ["Tonga", "to", "676"], ["Trinidad and Tobago", "tt", "1868"], ["Tunisia", "tn", "216"], ["Turkey", "tr", "90", "... ... .. .."], ["Turkmenistan", "tm", "993"], ["Tuvalu", "tv", "688"], ["Uganda", "ug", "256"], ["Ukraine", "ua", "380", "(..) ... .. .."], ["United Arab Emirates", "ae", "971"], ["United Kingdom", "gb", "44", ".... ......"], ["United States", "us", "1", "(...) ...-....", 0], ["Uruguay", "uy", "598"], ["Uzbekistan", "uz", "998", ".. ... .. .."], ["Vanuatu", "vu", "678"], ["Vatican City", "va", "39", ".. .... ....", 1], ["Venezuela", "ve", "58"], ["Vietnam", "vn", "84"], ["Yemen", "ye", "967"], ["Zambia", "zm", "260"], ["Zimbabwe", "zw", "263"]], ee = (...e) => e.filter((t) => !!t).join(" ").trim(), B = ({ addPrefix: e, rawClassNames: t }) => ee(((...d) => ee(...d).split(" ").map((l) => `react-international-phone-${l}`).join(" "))(...e), ...t), O = (e) => !!e && /^\d+$/.test(e), Z = (e) => e.replace(/\D/g, ""), H = ({ phone: e, prefix: t }) => e ? `${t}${Z(e)}` : "";
|
|
14
|
+
function Q({ value: e, country: t, insertDialCodeOnEmpty: d, trimNonDigitsEnd: l, countries: a, prefix: i, charAfterDialCode: b, forceDialCode: g, disableDialCodeAndPrefix: o, defaultMask: h, countryGuessingEnabled: f, disableFormatting: w }) {
|
|
15
|
+
let n = e;
|
|
16
|
+
o && (n = n.startsWith(`${i}`) ? n : `${i}${t.dialCode}${n}`);
|
|
17
|
+
let c = f ? Ee({ phone: n, countries: a, currentCountryIso2: t == null ? void 0 : t.iso2 }) : void 0, y = (c == null ? void 0 : c.country) ?? t, S = ((D, r) => {
|
|
18
|
+
let z = !r.disableDialCodeAndPrefix && r.forceDialCode, s = !r.disableDialCodeAndPrefix && r.insertDialCodeOnEmpty, u = D, p = (x) => r.trimNonDigitsEnd ? x.trim() : x;
|
|
19
|
+
if (!u) return s && !u.length || z ? p(`${r.prefix}${r.dialCode}${r.charAfterDialCode}`) : p(u);
|
|
20
|
+
if (u = Z(u), u === r.dialCode && !r.disableDialCodeAndPrefix) return p(`${r.prefix}${r.dialCode}${r.charAfterDialCode}`);
|
|
21
|
+
if (r.dialCode.startsWith(u) && !r.disableDialCodeAndPrefix) return p(z ? `${r.prefix}${r.dialCode}${r.charAfterDialCode}` : `${r.prefix}${u}`);
|
|
22
|
+
if (!u.startsWith(r.dialCode) && !r.disableDialCodeAndPrefix) {
|
|
23
|
+
if (z) return p(`${r.prefix}${r.dialCode}${r.charAfterDialCode}`);
|
|
24
|
+
if (u.length < r.dialCode.length) return p(`${r.prefix}${u}`);
|
|
25
|
+
}
|
|
26
|
+
let { phoneLeftSide: k, phoneRightSide: C } = (() => {
|
|
27
|
+
let x = r.dialCode.length;
|
|
28
|
+
return { phoneLeftSide: u.slice(0, x), phoneRightSide: u.slice(x) };
|
|
29
|
+
})();
|
|
30
|
+
return k = `${r.prefix}${k}${r.charAfterDialCode}`, C = (({ value: x, mask: v, maskSymbol: $, offset: m = 0, trimNonMaskCharsLeftover: A = !1 }) => {
|
|
31
|
+
if (x.length < m) return x;
|
|
32
|
+
let P = x.slice(0, m), E = x.slice(m), L = P, j = 0;
|
|
33
|
+
for (let M of v.split("")) {
|
|
34
|
+
if (j >= E.length) {
|
|
35
|
+
if (!A && M !== $) {
|
|
36
|
+
L += M;
|
|
37
|
+
continue;
|
|
38
|
+
}
|
|
39
|
+
break;
|
|
40
|
+
}
|
|
41
|
+
M === $ ? (L += E[j], j += 1) : L += M;
|
|
42
|
+
}
|
|
43
|
+
return L;
|
|
44
|
+
})({ value: C, mask: r.mask, maskSymbol: r.maskChar, trimNonMaskCharsLeftover: r.trimNonDigitsEnd || r.disableDialCodeAndPrefix && C.length === 0 }), r.disableDialCodeAndPrefix && (k = ""), p(`${k}${C}`);
|
|
45
|
+
})(n, { prefix: i, mask: Ae({ phone: n, country: y, defaultMask: h, disableFormatting: w }), maskChar: re, dialCode: y.dialCode, trimNonDigitsEnd: l, charAfterDialCode: b, forceDialCode: g, insertDialCodeOnEmpty: d, disableDialCodeAndPrefix: o }), N = f && !(c != null && c.fullDialCodeMatch) ? t : y;
|
|
46
|
+
return { phone: H({ phone: o ? `${N.dialCode}${S}` : S, prefix: i }), inputValue: S, country: N };
|
|
47
|
+
}
|
|
48
|
+
var me = (e, { country: t, insertDialCodeOnEmpty: d, phoneBeforeInput: l, prefix: a, charAfterDialCode: i, forceDialCode: b, disableDialCodeAndPrefix: g, countryGuessingEnabled: o, defaultMask: h, disableFormatting: f, countries: w }) => {
|
|
49
|
+
let n = e.nativeEvent, c = n.inputType, y = ((C) => {
|
|
50
|
+
if (C != null && C.toLocaleLowerCase().includes("delete")) return C != null && C.toLocaleLowerCase().includes("forward") ? "forward" : "backward";
|
|
51
|
+
})(c), S = !!(c != null && c.startsWith("insertFrom")), N = c === "insertText", D = (n == null ? void 0 : n.data) || void 0, r = e.target.value, z = e.target.selectionStart ?? 0;
|
|
52
|
+
if (c != null && c.includes("history")) return { inputValue: l, phone: H({ phone: l, prefix: a }), cursorPosition: l.length, country: t };
|
|
53
|
+
if (N && !O(D) && r !== a) return { inputValue: l, phone: H({ phone: g ? `${t.dialCode}${l}` : l, prefix: a }), cursorPosition: z - ((D == null ? void 0 : D.length) ?? 0), country: t };
|
|
54
|
+
if (b && !r.startsWith(`${a}${t.dialCode}`) && !S) {
|
|
55
|
+
let C = r ? l : `${a}${t.dialCode}${i}`;
|
|
56
|
+
return { inputValue: C, phone: H({ phone: C, prefix: a }), cursorPosition: a.length + t.dialCode.length + i.length, country: t };
|
|
57
|
+
}
|
|
58
|
+
let { phone: s, inputValue: u, country: p } = Q({ value: r, country: t, trimNonDigitsEnd: y === "backward", insertDialCodeOnEmpty: d, countryGuessingEnabled: o, countries: w, prefix: a, charAfterDialCode: i, forceDialCode: b, disableDialCodeAndPrefix: g, disableFormatting: f, defaultMask: h }), k = (({ phoneBeforeInput: C, phoneAfterInput: x, phoneAfterFormatted: v, cursorPositionAfterInput: $, leftOffset: m = 0, deletion: A }) => {
|
|
59
|
+
if ($ < m) return m;
|
|
60
|
+
if (!C) return v.length;
|
|
61
|
+
let P = null;
|
|
62
|
+
for (let M = $ - 1; M >= 0; M -= 1) if (O(x[M])) {
|
|
63
|
+
P = M;
|
|
64
|
+
break;
|
|
65
|
+
}
|
|
66
|
+
if (P === null) {
|
|
67
|
+
for (let M = 0; M < x.length; M += 1) if (O(v[M])) return M;
|
|
68
|
+
return x.length;
|
|
69
|
+
}
|
|
70
|
+
let E = 0;
|
|
71
|
+
for (let M = 0; M < P; M += 1) O(x[M]) && (E += 1);
|
|
72
|
+
let L = 0, j = 0;
|
|
73
|
+
for (let M = 0; M < v.length && (L += 1, O(v[M]) && (j += 1), !(j >= E + 1)); M += 1) ;
|
|
74
|
+
if (A !== "backward") for (; !O(v[L]) && L < v.length; ) L += 1;
|
|
75
|
+
return L;
|
|
76
|
+
})({ cursorPositionAfterInput: z, phoneBeforeInput: l, phoneAfterInput: r, phoneAfterFormatted: u, leftOffset: b ? a.length + t.dialCode.length + i.length : 0, deletion: y });
|
|
77
|
+
return { phone: s, inputValue: u, cursorPosition: k, country: p };
|
|
78
|
+
}, he = { size: 20, overrideLastItemDebounceMS: -1 };
|
|
79
|
+
function ye(e, t) {
|
|
80
|
+
let { size: d, overrideLastItemDebounceMS: l, onChange: a } = { ...he, ...t }, [i, b] = G(e), [g, o] = G([i]), [h, f] = G(0), w = (() => {
|
|
81
|
+
let n = F(), c = F(Date.now());
|
|
82
|
+
return { check: () => {
|
|
83
|
+
let y = Date.now(), S = n.current ? y - c.current : void 0;
|
|
84
|
+
return n.current = c.current, c.current = y, S;
|
|
85
|
+
} };
|
|
86
|
+
})();
|
|
87
|
+
return [i, (n, c) => {
|
|
88
|
+
if (typeof n == "object" && typeof i == "object" && ((D, r) => {
|
|
89
|
+
let z = Object.keys(D), s = Object.keys(r);
|
|
90
|
+
if (z.length !== s.length) return !1;
|
|
91
|
+
for (let u of z) if (D[u] !== r[u]) return !1;
|
|
92
|
+
return !0;
|
|
93
|
+
})(n, i) || n === i) return;
|
|
94
|
+
let y = l > 0, S = w.check(), N = !y || S === void 0 || S > l;
|
|
95
|
+
if ((c == null ? void 0 : c.overrideLastItem) !== void 0 ? c.overrideLastItem : !N) o((D) => [...D.slice(0, h), n]);
|
|
96
|
+
else {
|
|
97
|
+
let D = g.length >= d;
|
|
98
|
+
o((r) => [...r.slice(D ? 1 : 0, h + 1), n]), D || f((r) => r + 1);
|
|
99
|
+
}
|
|
100
|
+
b(n), a == null || a(n);
|
|
101
|
+
}, () => {
|
|
102
|
+
if (h <= 0) return { success: !1 };
|
|
103
|
+
let n = g[h - 1];
|
|
104
|
+
return b(n), f((c) => c - 1), a == null || a(n), { success: !0, value: n };
|
|
105
|
+
}, () => {
|
|
106
|
+
if (h + 1 >= g.length) return { success: !1 };
|
|
107
|
+
let n = g[h + 1];
|
|
108
|
+
return b(n), f((c) => c + 1), a == null || a(n), { success: !0, value: n };
|
|
109
|
+
}];
|
|
110
|
+
}
|
|
111
|
+
var re = ".", ge = "us", Ce = "", be = "+", we = "............", ve = " ", xe = 200, $e = !1, De = !1, ke = !1, Ne = !1, Pe = !1, Se = T, ne = ({ defaultCountry: e = ge, value: t = Ce, countries: d = Se, prefix: l = be, defaultMask: a = we, charAfterDialCode: i = ve, historySaveDebounceMS: b = xe, disableCountryGuess: g = $e, disableDialCodePrefill: o = De, forceDialCode: h = ke, disableDialCodeAndPrefix: f = Ne, disableFormatting: w = Pe, onChange: n, inputRef: c }) => {
|
|
112
|
+
let y = { countries: d, prefix: l, charAfterDialCode: i, forceDialCode: !f && h, disableDialCodeAndPrefix: f, defaultMask: a, countryGuessingEnabled: !g, disableFormatting: w }, S = F(null), N = c || S, D = (m) => {
|
|
113
|
+
Promise.resolve().then(() => {
|
|
114
|
+
var A;
|
|
115
|
+
typeof window > "u" || N.current !== (document == null ? void 0 : document.activeElement) || ((A = N.current) == null || A.setSelectionRange(m, m));
|
|
116
|
+
});
|
|
117
|
+
}, [{ phone: r, inputValue: z, country: s }, u, p, k] = ye(() => {
|
|
118
|
+
let m = K({ value: e, field: "iso2", countries: d });
|
|
119
|
+
m || console.error(`[react-international-phone]: can not find a country with "${e}" iso2 code`);
|
|
120
|
+
let A = m || K({ value: "us", field: "iso2", countries: d }), { phone: P, inputValue: E, country: L } = Q({ value: t, country: A, insertDialCodeOnEmpty: !o, ...y });
|
|
121
|
+
return D(E.length), { phone: P, inputValue: E, country: L.iso2 };
|
|
122
|
+
}, { overrideLastItemDebounceMS: b, onChange: ({ inputValue: m, phone: A, country: P }) => {
|
|
123
|
+
if (!n) return;
|
|
124
|
+
let E = C(P);
|
|
125
|
+
n({ phone: A, inputValue: m, country: E });
|
|
126
|
+
} }), C = R((m) => K({ value: m, field: "iso2", countries: d }), [d]), x = Y(() => C(s), [s, C]);
|
|
127
|
+
q(() => {
|
|
128
|
+
let m = N.current;
|
|
129
|
+
if (!m) return;
|
|
130
|
+
let A = (P) => {
|
|
131
|
+
if (!P.key) return;
|
|
132
|
+
let E = P.ctrlKey, L = P.metaKey, j = P.shiftKey;
|
|
133
|
+
if (P.key.toLowerCase() === "z") {
|
|
134
|
+
if (typeof window > "u" || !window.navigator.userAgent.toLowerCase().includes("macintosh")) {
|
|
135
|
+
if (!E) return;
|
|
136
|
+
} else if (!L) return;
|
|
137
|
+
j ? k() : p();
|
|
138
|
+
}
|
|
139
|
+
};
|
|
140
|
+
return m.addEventListener("keydown", A), () => {
|
|
141
|
+
m.removeEventListener("keydown", A);
|
|
142
|
+
};
|
|
143
|
+
}, [N, p, k]);
|
|
144
|
+
let [v, $] = G(!1);
|
|
145
|
+
return q(() => {
|
|
146
|
+
if (!v) return $(!0), void (t !== r && (n == null ? void 0 : n({ inputValue: z, phone: r, country: x })));
|
|
147
|
+
if (t === r) return;
|
|
148
|
+
let { phone: m, inputValue: A, country: P } = Q({ value: t, country: x, insertDialCodeOnEmpty: !o, ...y });
|
|
149
|
+
u({ phone: m, inputValue: A, country: P.iso2 });
|
|
150
|
+
}, [t]), { phone: r, inputValue: z, country: x, setCountry: (m, A = { focusOnInput: !1 }) => {
|
|
151
|
+
let P = K({ value: m, field: "iso2", countries: d });
|
|
152
|
+
if (!P) return void console.error(`[react-international-phone]: can not find a country with "${m}" iso2 code`);
|
|
153
|
+
let E = f ? "" : `${l}${P.dialCode}${i}`;
|
|
154
|
+
u({ inputValue: E, phone: `${l}${P.dialCode}`, country: P.iso2 }), A.focusOnInput && Promise.resolve().then(() => {
|
|
155
|
+
var L;
|
|
156
|
+
(L = N.current) == null || L.focus();
|
|
157
|
+
});
|
|
158
|
+
}, handlePhoneValueChange: (m) => {
|
|
159
|
+
m.preventDefault();
|
|
160
|
+
let { phone: A, inputValue: P, country: E, cursorPosition: L } = me(m, { country: x, phoneBeforeInput: z, insertDialCodeOnEmpty: !1, ...y });
|
|
161
|
+
return u({ inputValue: P, phone: A, country: E.iso2 }), D(L), t;
|
|
162
|
+
}, inputRef: N };
|
|
163
|
+
}, Ae = ({ phone: e, country: t, defaultMask: d = "............", disableFormatting: l = !1 }) => {
|
|
164
|
+
let a = t.format, i = (g) => l ? g.replace(new RegExp(`[^${re}]`, "g"), "") : g;
|
|
165
|
+
if (!a) return i(d);
|
|
166
|
+
if (typeof a == "string") return i(a);
|
|
167
|
+
if (!a.default) return console.error(`[react-international-phone]: default mask for ${t.iso2} is not provided`), i(d);
|
|
168
|
+
let b = Object.keys(a).find((g) => {
|
|
169
|
+
if (g === "default") return !1;
|
|
170
|
+
if (g.charAt(0) !== "/" || g.charAt(g.length - 1) !== "/") return console.error(`[react-international-phone]: format regex "${g}" for ${t.iso2} is not valid`), !1;
|
|
171
|
+
let o = new RegExp(g.substring(1, g.length - 1)), h = e.replace(t.dialCode, "");
|
|
172
|
+
return o.test(Z(h));
|
|
173
|
+
});
|
|
174
|
+
return i(b ? a[b] : a.default);
|
|
175
|
+
}, V = (e) => {
|
|
176
|
+
let [t, d, l, a, i, b] = e;
|
|
177
|
+
return { name: t, iso2: d, dialCode: l, format: a, priority: i, areaCodes: b };
|
|
178
|
+
}, K = ({ field: e, value: t, countries: d = T }) => {
|
|
179
|
+
if (["priority"].includes(e)) throw new Error(((a) => `Field "${a}" is not supported`)(e));
|
|
180
|
+
let l = d.find((a) => {
|
|
181
|
+
let i = V(a);
|
|
182
|
+
return t === i[e];
|
|
183
|
+
});
|
|
184
|
+
if (l) return V(l);
|
|
185
|
+
}, Ee = ({ phone: e, countries: t = T, currentCountryIso2: d }) => {
|
|
186
|
+
var g;
|
|
187
|
+
let l = { country: void 0, fullDialCodeMatch: !1 };
|
|
188
|
+
if (!e) return l;
|
|
189
|
+
let a = Z(e);
|
|
190
|
+
if (!a) return l;
|
|
191
|
+
let i = l, b = ({ country: o, fullDialCodeMatch: h }) => {
|
|
192
|
+
var n, c;
|
|
193
|
+
let f = o.dialCode === ((n = i.country) == null ? void 0 : n.dialCode), w = (o.priority ?? 0) < (((c = i.country) == null ? void 0 : c.priority) ?? 0);
|
|
194
|
+
(!f || w) && (i = { country: o, fullDialCodeMatch: h });
|
|
195
|
+
};
|
|
196
|
+
for (let o of t) {
|
|
197
|
+
let h = V(o), { dialCode: f, areaCodes: w } = h;
|
|
198
|
+
if (a.startsWith(f)) {
|
|
199
|
+
let n = !i.country || Number(f) >= Number(i.country.dialCode);
|
|
200
|
+
if (w) {
|
|
201
|
+
let c = a.substring(f.length);
|
|
202
|
+
for (let y of w) if (c.startsWith(y)) return { country: h, fullDialCodeMatch: !0 };
|
|
203
|
+
}
|
|
204
|
+
(n || f === a || !i.fullDialCodeMatch) && b({ country: h, fullDialCodeMatch: !0 });
|
|
205
|
+
}
|
|
206
|
+
i.fullDialCodeMatch || a.length < f.length && f.startsWith(a) && (!i.country || Number(f) <= Number(i.country.dialCode)) && b({ country: h, fullDialCodeMatch: !1 });
|
|
207
|
+
}
|
|
208
|
+
if (d) {
|
|
209
|
+
let o = K({ value: d, field: "iso2", countries: t });
|
|
210
|
+
if (!o) return i;
|
|
211
|
+
let h = !!o && ((f) => {
|
|
212
|
+
if (!(f != null && f.areaCodes)) return !1;
|
|
213
|
+
let w = a.substring(f.dialCode.length);
|
|
214
|
+
return f.areaCodes.some((n) => n.startsWith(w));
|
|
215
|
+
})(o);
|
|
216
|
+
i && ((g = i.country) == null ? void 0 : g.dialCode) === o.dialCode && i.country !== o && i.fullDialCodeMatch && (!o.areaCodes || h) && (i = { country: o, fullDialCodeMatch: !0 });
|
|
217
|
+
}
|
|
218
|
+
return i;
|
|
219
|
+
}, Me = (e, t) => {
|
|
220
|
+
let d = parseInt(e, 16);
|
|
221
|
+
return Number(d + t).toString(16);
|
|
222
|
+
}, te = "abcdefghijklmnopqrstuvwxyz".split("").reduce((e, t, d) => ({ ...e, [t]: Me("1f1e6", d) }), {}), J = ({ iso2: e, size: t, src: d, protocol: l = "https", disableLazyLoading: a, className: i, style: b, ...g }) => e ? I.createElement("img", { className: B({ addPrefix: ["flag-emoji"], rawClassNames: [i] }), src: (() => {
|
|
223
|
+
if (d) return d;
|
|
224
|
+
let o = ((h) => [te[h[0]], te[h[1]]].join("-"))(e);
|
|
225
|
+
return `${l}://cdnjs.cloudflare.com/ajax/libs/twemoji/14.0.2/svg/${o}.svg`;
|
|
226
|
+
})(), width: t, height: t, draggable: !1, "data-country": e, loading: a ? void 0 : "lazy", style: { width: t, height: t, ...b }, alt: "", ...g }) : I.createElement("img", { className: B({ addPrefix: ["flag-emoji"], rawClassNames: [i] }), width: t, height: t, ...g }), Ie = ({ show: e, dialCodePrefix: t = "+", selectedCountry: d, countries: l = T, preferredCountries: a = [], flags: i, onSelect: b, onClose: g, ...o }) => {
|
|
227
|
+
let h = F(null), f = F(), w = Y(() => {
|
|
228
|
+
if (!a || !a.length) return l;
|
|
229
|
+
let s = [], u = [...l];
|
|
230
|
+
for (let p of a) {
|
|
231
|
+
let k = u.findIndex((C) => V(C).iso2 === p);
|
|
232
|
+
if (k !== -1) {
|
|
233
|
+
let C = u.splice(k, 1)[0];
|
|
234
|
+
s.push(C);
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
return s.concat(u);
|
|
238
|
+
}, [l, a]), n = F({ updatedAt: void 0, value: "" }), c = R((s) => w.findIndex((u) => V(u).iso2 === s), [w]), [y, S] = G(c(d)), N = () => {
|
|
239
|
+
f.current !== d && S(c(d));
|
|
240
|
+
}, D = R((s) => {
|
|
241
|
+
S(c(s.iso2)), b == null || b(s);
|
|
242
|
+
}, [b, c]), r = (s) => {
|
|
243
|
+
let u = w.length - 1;
|
|
244
|
+
S((p) => {
|
|
245
|
+
let k = ((C) => s === "prev" ? C - 1 : s === "next" ? C + 1 : s === "last" ? u : 0)(p);
|
|
246
|
+
return k < 0 ? 0 : k > u ? u : k;
|
|
247
|
+
});
|
|
248
|
+
}, z = R(() => {
|
|
249
|
+
if (!h.current || y === void 0) return;
|
|
250
|
+
let s = V(w[y]).iso2;
|
|
251
|
+
if (s === f.current) return;
|
|
252
|
+
let u = h.current.querySelector(`[data-country="${s}"]`);
|
|
253
|
+
u && (((p, k) => {
|
|
254
|
+
let C = p.style.display;
|
|
255
|
+
C !== "block" && (p.style.display = "block");
|
|
256
|
+
let x = p.getBoundingClientRect(), v = k.getBoundingClientRect(), $ = v.top - x.top, m = x.bottom - v.bottom;
|
|
257
|
+
$ >= 0 && m >= 0 || (Math.abs($) < Math.abs(m) ? p.scrollTop += $ : p.scrollTop -= m), p.style.display = C;
|
|
258
|
+
})(h.current, u), f.current = s);
|
|
259
|
+
}, [y, w]);
|
|
260
|
+
return q(() => {
|
|
261
|
+
z();
|
|
262
|
+
}, [y, z]), q(() => {
|
|
263
|
+
h.current && (e ? h.current.focus() : N());
|
|
264
|
+
}, [e]), q(() => {
|
|
265
|
+
N();
|
|
266
|
+
}, [d]), I.createElement("ul", { ref: h, role: "listbox", className: B({ addPrefix: ["country-selector-dropdown"], rawClassNames: [o.className] }), style: { display: e ? "block" : "none", ...o.style }, onKeyDown: (s) => {
|
|
267
|
+
if (s.stopPropagation(), s.key !== "Enter") {
|
|
268
|
+
if (s.key !== "Escape") return s.key === "ArrowUp" ? (s.preventDefault(), void r("prev")) : s.key === "ArrowDown" ? (s.preventDefault(), void r("next")) : s.key === "PageUp" ? (s.preventDefault(), void r("first")) : s.key === "PageDown" ? (s.preventDefault(), void r("last")) : (s.key === " " && s.preventDefault(), void (s.key.length === 1 && !s.altKey && !s.ctrlKey && !s.metaKey && ((u) => {
|
|
269
|
+
let p = n.current.updatedAt && (/* @__PURE__ */ new Date()).getTime() - n.current.updatedAt.getTime() > 1e3;
|
|
270
|
+
n.current = { value: p ? u : `${n.current.value}${u}`, updatedAt: /* @__PURE__ */ new Date() };
|
|
271
|
+
let k = w.findIndex((C) => V(C).name.toLowerCase().startsWith(n.current.value));
|
|
272
|
+
k !== -1 && S(k);
|
|
273
|
+
})(s.key.toLocaleLowerCase())));
|
|
274
|
+
g == null || g();
|
|
275
|
+
} else {
|
|
276
|
+
s.preventDefault();
|
|
277
|
+
let u = V(w[y]);
|
|
278
|
+
D(u);
|
|
279
|
+
}
|
|
280
|
+
}, onBlur: g, tabIndex: -1, "aria-activedescendant": `react-international-phone__${V(w[y]).iso2}-option` }, w.map((s, u) => {
|
|
281
|
+
let p = V(s), k = p.iso2 === d, C = u === y, x = a.includes(p.iso2), v = u === a.length - 1, $ = i == null ? void 0 : i.find((m) => m.iso2 === p.iso2);
|
|
282
|
+
return I.createElement(I.Fragment, { key: p.iso2 }, I.createElement("li", { "data-country": p.iso2, role: "option", "aria-selected": k, "aria-label": `${p.name} ${t}${p.dialCode}`, id: `react-international-phone__${p.iso2}-option`, className: B({ addPrefix: ["country-selector-dropdown__list-item", x && "country-selector-dropdown__list-item--preferred", k && "country-selector-dropdown__list-item--selected", C && "country-selector-dropdown__list-item--focused"], rawClassNames: [o.listItemClassName] }), onClick: () => D(p), style: o.listItemStyle, title: p.name }, I.createElement(J, { iso2: p.iso2, src: $ == null ? void 0 : $.src, className: B({ addPrefix: ["country-selector-dropdown__list-item-flag-emoji"], rawClassNames: [o.listItemFlagClassName] }), style: o.listItemFlagStyle }), I.createElement("span", { className: B({ addPrefix: ["country-selector-dropdown__list-item-country-name"], rawClassNames: [o.listItemCountryNameClassName] }), style: o.listItemCountryNameStyle }, p.name), I.createElement("span", { className: B({ addPrefix: ["country-selector-dropdown__list-item-dial-code"], rawClassNames: [o.listItemDialCodeClassName] }), style: o.listItemDialCodeStyle }, t, p.dialCode)), v ? I.createElement("hr", { className: B({ addPrefix: ["country-selector-dropdown__preferred-list-divider"], rawClassNames: [o.preferredListDividerClassName] }), style: o.preferredListDividerStyle }) : null);
|
|
283
|
+
}));
|
|
284
|
+
}, ze = ({ selectedCountry: e, onSelect: t, disabled: d, hideDropdown: l, countries: a = T, preferredCountries: i = [], flags: b, renderButtonWrapper: g, ...o }) => {
|
|
285
|
+
let [h, f] = G(!1), w = Y(() => {
|
|
286
|
+
if (e) return K({ value: e, field: "iso2", countries: a });
|
|
287
|
+
}, [a, e]), n = F(null), c = (y) => {
|
|
288
|
+
y.key && ["ArrowUp", "ArrowDown"].includes(y.key) && (y.preventDefault(), f(!0));
|
|
289
|
+
};
|
|
290
|
+
return I.createElement("div", { className: B({ addPrefix: ["country-selector"], rawClassNames: [o.className] }), style: o.style, ref: n }, (() => {
|
|
291
|
+
var N;
|
|
292
|
+
let y = { title: w == null ? void 0 : w.name, onClick: () => f((D) => !D), onMouseDown: (D) => D.preventDefault(), onKeyDown: c, disabled: l || d, role: "combobox", "aria-label": "Country selector", "aria-haspopup": "listbox", "aria-expanded": h }, S = I.createElement("div", { className: B({ addPrefix: ["country-selector-button__button-content"], rawClassNames: [o.buttonContentWrapperClassName] }), style: o.buttonContentWrapperStyle }, I.createElement(J, { iso2: e, src: (N = b == null ? void 0 : b.find((D) => D.iso2 === e)) == null ? void 0 : N.src, className: B({ addPrefix: ["country-selector-button__flag-emoji", d && "country-selector-button__flag-emoji--disabled"], rawClassNames: [o.flagClassName] }), style: { visibility: e ? "visible" : "hidden", ...o.flagStyle } }), !l && I.createElement("div", { className: B({ addPrefix: ["country-selector-button__dropdown-arrow", d && "country-selector-button__dropdown-arrow--disabled", h && "country-selector-button__dropdown-arrow--active"], rawClassNames: [o.dropdownArrowClassName] }), style: o.dropdownArrowStyle }));
|
|
293
|
+
return g ? g({ children: S, rootProps: y }) : I.createElement("button", { ...y, type: "button", className: B({ addPrefix: ["country-selector-button", h && "country-selector-button--active", d && "country-selector-button--disabled", l && "country-selector-button--hide-dropdown"], rawClassNames: [o.buttonClassName] }), "data-country": e, style: o.buttonStyle }, S);
|
|
294
|
+
})(), I.createElement(Ie, { show: h, countries: a, preferredCountries: i, flags: b, onSelect: (y) => {
|
|
295
|
+
f(!1), t == null || t(y);
|
|
296
|
+
}, selectedCountry: e, onClose: () => {
|
|
297
|
+
f(!1);
|
|
298
|
+
}, ...o.dropdownStyleProps }));
|
|
299
|
+
}, Le = ({ dialCode: e, prefix: t, disabled: d, style: l, className: a }) => I.createElement("div", { className: B({ addPrefix: ["dial-code-preview", d && "dial-code-preview--disabled"], rawClassNames: [a] }), style: l }, `${t}${e}`);
|
|
300
|
+
ae(({ value: e, onChange: t, countries: d = T, preferredCountries: l = [], hideDropdown: a, showDisabledDialCodeAndPrefix: i, disableFocusAfterCountrySelect: b, flags: g, style: o, className: h, inputStyle: f, inputClassName: w, countrySelectorStyleProps: n, dialCodePreviewStyleProps: c, inputProps: y, placeholder: S, disabled: N, name: D, onFocus: r, onBlur: z, required: s, autoFocus: u, ...p }, k) => {
|
|
301
|
+
let { phone: C, inputValue: x, inputRef: v, country: $, setCountry: m, handlePhoneValueChange: A } = ne({ value: e, countries: d, ...p, onChange: (E) => {
|
|
302
|
+
t == null || t(E.phone, { country: E.country, inputValue: E.inputValue });
|
|
303
|
+
} }), P = p.disableDialCodeAndPrefix && i && ($ == null ? void 0 : $.dialCode);
|
|
304
|
+
return le(k, () => v.current ? Object.assign(v.current, { setCountry: m, state: { phone: C, inputValue: x, country: $ } }) : null, [v, m, C, x, $]), I.createElement("div", { ref: k, className: B({ addPrefix: ["input-container"], rawClassNames: [h] }), style: o }, I.createElement(ze, { onSelect: (E) => m(E.iso2, { focusOnInput: !b }), flags: g, selectedCountry: $.iso2, countries: d, preferredCountries: l, disabled: N, hideDropdown: a, ...n }), P && I.createElement(Le, { dialCode: $.dialCode, prefix: p.prefix ?? "+", disabled: N, ...c }), I.createElement("input", { onChange: A, value: x, type: "tel", ref: v, className: B({ addPrefix: ["input", N && "input--disabled"], rawClassNames: [w] }), placeholder: S, disabled: N, style: f, name: D, onFocus: r, onBlur: z, autoFocus: u, required: s, ...y }));
|
|
305
|
+
});
|
|
306
|
+
const Be = W.div`
|
|
307
|
+
${({ theme: e }) => `
|
|
308
|
+
align-items: flex-start;
|
|
309
|
+
align-self: stretch;
|
|
310
|
+
display: flex;
|
|
311
|
+
gap: ${e.spacing[0.5]};
|
|
312
|
+
|
|
313
|
+
> button, div {
|
|
314
|
+
border: 1px solid ${e.palette.gray[300]};
|
|
315
|
+
border-radius: ${e.spacing[0.5]};
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
&.disabled {
|
|
319
|
+
> button, div {
|
|
320
|
+
background: ${e.palette.gray[100]};
|
|
321
|
+
color: ${e.palette.gray[400]};
|
|
322
|
+
cursor: not-allowed;
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
&.error:not(.disabled) {
|
|
327
|
+
> button, div {
|
|
328
|
+
border: 1px solid ${e.palette.error[500]};
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
&:focus-within:not(.disabled, .error) {
|
|
333
|
+
> button, div {
|
|
334
|
+
background: ${e.palette.white};
|
|
335
|
+
border: 2px solid ${e.palette.black};
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
&:hover:not(:focus-within, .disabled, .error) {
|
|
340
|
+
> button, div {
|
|
341
|
+
background: ${e.palette.white};
|
|
342
|
+
border-color: ${e.palette.gray[600]};
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
`}
|
|
346
|
+
`, Ve = W.button`
|
|
347
|
+
${({ theme: e }) => `
|
|
348
|
+
align-items: center;
|
|
349
|
+
background: inherit;
|
|
350
|
+
border-color: inherit;
|
|
351
|
+
display: flex;
|
|
352
|
+
gap: ${e.spacing[0.25]};
|
|
353
|
+
height: 40px;
|
|
354
|
+
min-width: 67px;
|
|
355
|
+
padding: ${e.spacing[0.625]} ${e.spacing[1]};
|
|
356
|
+
|
|
357
|
+
&:disabled {
|
|
358
|
+
background: ${e.palette.gray[100]};
|
|
359
|
+
cursor: not-allowed;
|
|
360
|
+
}
|
|
361
|
+
`}
|
|
362
|
+
`, _e = W.ul`
|
|
363
|
+
${({ theme: e }) => `
|
|
364
|
+
align-items: flex-start;
|
|
365
|
+
box-shadow: ${e.shadows.md};
|
|
366
|
+
display: flex;
|
|
367
|
+
flex-direction: column;
|
|
368
|
+
max-height: 190px;
|
|
369
|
+
overflow: hidden auto;
|
|
370
|
+
scrollbar-color: ${e.palette.gray[600]} ${e.palette.gray[100]};
|
|
371
|
+
scroll-padding: ${e.spacing[0.5]};
|
|
372
|
+
scrollbar-width: thin;
|
|
373
|
+
width: max-content;
|
|
374
|
+
`}
|
|
375
|
+
`, je = W.li`
|
|
376
|
+
${({ theme: e }) => `
|
|
377
|
+
align-items: center;
|
|
378
|
+
background: ${e.palette.white};
|
|
379
|
+
cursor: pointer;
|
|
380
|
+
display: inline-flex;
|
|
381
|
+
font-size: ${e.typography.text.sm};
|
|
382
|
+
gap: ${e.spacing[0.5]};
|
|
383
|
+
height: 38px;
|
|
384
|
+
line-height: ${e.spacing[1.25]};
|
|
385
|
+
padding: ${e.spacing[0.5]} ${e.spacing[1]};
|
|
386
|
+
width: 190px;
|
|
387
|
+
|
|
388
|
+
&:hover {
|
|
389
|
+
background: ${e.palette.gray[100]};
|
|
390
|
+
}
|
|
391
|
+
`}
|
|
392
|
+
`, Fe = W.p`
|
|
393
|
+
color: ${({ theme: e }) => e.palette.gray[800]};
|
|
11
394
|
font-size: inherit;
|
|
12
395
|
min-width: 55%;
|
|
13
396
|
overflow: hidden;
|
|
14
397
|
text-overflow: ellipsis;
|
|
15
398
|
white-space: nowrap;
|
|
16
|
-
`,
|
|
399
|
+
`, Ye = ae(function({ disabled: e, error: t, label: d, name: l, required: a, tooltip: i, value: b, weight: g, ...o }, h) {
|
|
400
|
+
const f = de(), [w, n] = G(!1), [c, y] = G(""), S = F(null), { refs: N, floatingStyles: D } = oe({ placement: "bottom-start", whileElementsMounted: ie }), { inputValue: r, handlePhoneValueChange: z, country: s, setCountry: u } = ne({ countries: T, defaultCountry: "us", value: b ? String(b) : void 0 }), p = R(() => {
|
|
401
|
+
n((v) => !v), w || y("");
|
|
402
|
+
}, [w]), k = R((v) => () => {
|
|
403
|
+
u(v), n(!1), y("");
|
|
404
|
+
}, [u, n]), C = R((v) => {
|
|
405
|
+
v.key.length === 1 ? y(($) => $ + v.key) : v.key === "Backspace" && y(($) => $.slice(0, -1));
|
|
406
|
+
}, []), x = T.filter((v) => {
|
|
407
|
+
const { name: $ } = V(v);
|
|
408
|
+
return $.toLowerCase().includes(c.toLowerCase());
|
|
409
|
+
});
|
|
410
|
+
return fe(N.floating.current, () => {
|
|
411
|
+
n(!1), y("");
|
|
412
|
+
}, !0), _(ue, { error: t, htmlFor: l, label: d, required: a, tooltip: i, weight: g, children: U(Be, { className: `${e ? "disabled" : ""} ${t ? "error" : ""}`, ref: S, children: [U(Ve, { "aria-label": "country-selector", "data-testid": "country-selector", disabled: e, id: "country-selector", onClick: p, onKeyDown: C, ref: N.setReference, children: [_(J, { iso2: s.iso2, size: "16px" }), _(X, { icon: "angle-down", iconColor: f.palette.gray[400], iconSize: "xs", iconType: "fa-light" })] }), U(ce, { className: `${e ? "disabled" : ""} ${t ? "error" : ""}`, children: [_("input", { "aria-hidden": !1, "aria-invalid": t ? "true" : "false", "aria-label": l, "aria-required": a, autoComplete: "off", "data-testid": `${l}-input`, disabled: e, id: l, name: l, onChange: z, ref: h, type: "tel", value: r, ...o }), t ? _(X, { icon: "exclamation-circle", iconClass: "error-icon", iconColor: f.palette.error[500], iconSize: "xs" }) : void 0] }), w && se(_(_e, { ref: N.setFloating, style: D, children: x.map((v) => {
|
|
413
|
+
const { dialCode: $, iso2: m, name: A } = V(v);
|
|
414
|
+
return U(je, { onClick: k(m), value: m, children: [_(J, { iso2: m, size: "16px" }), _(Fe, { children: A }), _(pe, { color: f.palette.gray[400], size: "sm", sizeSm: "xs", textAlign: "end", children: "+" + $ })] }, m);
|
|
415
|
+
}) }), document.getElementById("root") ?? document.body)] }) });
|
|
416
|
+
});
|
|
417
|
+
export {
|
|
418
|
+
Ye as PhoneInput
|
|
419
|
+
};
|
|
@@ -1 +1,13 @@
|
|
|
1
|
-
|
|
1
|
+
import { jsx as i, jsxs as w } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as L } from "react";
|
|
3
|
+
import { useTheme as k } from "styled-components";
|
|
4
|
+
import { OutlineContainer as v } from "../../outline-container/index.js";
|
|
5
|
+
import { S as T } from "../../../../styles-lSVV9kjn.mjs";
|
|
6
|
+
import { Icon as q } from "../../../icon/index.js";
|
|
7
|
+
const A = L(function({ disabled: o = !1, error: r, helpLink: s, helpText: n, label: d, name: e = "input-text", id: m, maskValue: p = !1, maxLength: t, placeholder: h, required: l, rows: c, tooltip: u, value: a, weight: x, ...f }, b) {
|
|
8
|
+
const g = k();
|
|
9
|
+
return i(v, { error: r, helpLink: s, helpText: n, htmlFor: e, label: d, maxLength: t, required: l, tooltip: u, value: a ? String(a) : void 0, weight: x, children: w(T, { className: `${o ? "disabled" : ""} ${r ? "error" : ""}`, children: [i("textarea", { "aria-hidden": !1, "aria-invalid": r ? "true" : "false", "aria-label": e, "aria-required": l, className: p ? "sr-block" : "", "data-testid": `${e}-text-area`, disabled: o, id: m ?? e, maxLength: t, name: e, placeholder: h, ref: b, rows: c, value: a, ...f }), r ? i(q, { icon: "exclamation-circle", iconClass: "error-icon", iconColor: g.palette.error[500], iconSize: "xs" }) : void 0] }) });
|
|
10
|
+
});
|
|
11
|
+
export {
|
|
12
|
+
A as TextArea
|
|
13
|
+
};
|