@matbea-ui/matbea-ui 0.2.0-dev.562872 → 0.2.0-dev.573256

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.
@@ -1209,15 +1209,13 @@ const RadioButton = ({ checked, defaultChecked = false, disabled = false, name,
1209
1209
 
1210
1210
  const Wrapper = styled$1.div `
1211
1211
  position: relative;
1212
- display: flex;
1213
- flex-direction: column;
1214
- gap: 12px;
1215
1212
  width: 100%;
1216
1213
  `;
1217
1214
  const Label$1 = styled$1(Typography).attrs({
1218
1215
  variant: "form-input",
1219
1216
  forwardedAs: "label",
1220
1217
  }) `
1218
+ margin-bottom: 8px;
1221
1219
  color: ${({ theme }) => theme.colors.primary.darkBlue};
1222
1220
  `;
1223
1221
  const FieldContainer = styled$1.div `
@@ -1281,9 +1279,8 @@ const ErrorText = styled$1.span `
1281
1279
  color: ${({ theme }) => theme.colors.accent.red};
1282
1280
  `;
1283
1281
  const List = styled$1.div `
1282
+ margin-top: 12px;
1284
1283
  position: fixed;
1285
- top: ${({ $top }) => `${$top}px`};
1286
- left: ${({ $left }) => `${$left}px`};
1287
1284
  width: ${({ $width }) => `${$width}px`};
1288
1285
  z-index: 999;
1289
1286
  border-radius: 5px;
@@ -1299,7 +1296,7 @@ const Option = styled$1.button `
1299
1296
  display: flex;
1300
1297
  align-items: center;
1301
1298
  gap: 10px;
1302
- padding: 0 13px;
1299
+ padding: 11px 13px;
1303
1300
  height: 40px;
1304
1301
  border: none;
1305
1302
  background: transparent;
@@ -1308,7 +1305,6 @@ const Option = styled$1.button `
1308
1305
  color: ${({ theme }) => theme.colors.primary.darkBlue};
1309
1306
  cursor: pointer;
1310
1307
  transition: background 140ms ease;
1311
-
1312
1308
  &[data-hovered="true"],
1313
1309
  &:hover {
1314
1310
  background: ${({ theme }) => theme.colors.gray.lightBlueGray};
@@ -1318,14 +1314,23 @@ const Option = styled$1.button `
1318
1314
  background: ${({ theme }) => theme.colors.gray.lightGray};
1319
1315
  }
1320
1316
  `;
1317
+ const OptionText = styled$1(Typography).attrs({
1318
+ forwardedAs: "span",
1319
+ variant: "form-input",
1320
+ }) `
1321
+ overflow: hidden;
1322
+ white-space: nowrap;
1323
+ text-overflow: ellipsis;
1324
+ `;
1321
1325
  const OptionIcon = styled$1.span `
1322
1326
  display: inline-flex;
1327
+ align-items: center;
1323
1328
  width: 24px;
1324
1329
  height: 24px;
1325
1330
  `;
1326
1331
 
1327
1332
  const DROPDOWN_OFFSET = 8;
1328
- const SelectField = forwardRef(({ options, value, defaultValue, placeholder = "Text", label, error, disabled = false, icon, name, onChange, onFocus, onBlur, className, }, ref) => {
1333
+ const SelectField = forwardRef(({ options = [], value, defaultValue, placeholder = "Text", label, error, disabled = false, icon, name, onChange, onFocus, onBlur, className, }, ref) => {
1329
1334
  const wrapperRef = useRef(null);
1330
1335
  const fieldRef = useRef(null);
1331
1336
  const listRef = useRef(null);
@@ -1449,10 +1454,12 @@ const SelectField = forwardRef(({ options, value, defaultValue, placeholder = "T
1449
1454
  setFocused(false);
1450
1455
  onBlur?.(evt);
1451
1456
  };
1452
- return (jsxs(Wrapper, { className: className, ref: wrapperRef, onKeyDown: handleKeyDown, onFocus: handleFocus, onBlur: handleBlur, children: [label && jsx(Label$1, { children: label }), jsxs(FieldContainer, { ref: fieldRef, role: "button", tabIndex: disabled ? -1 : 0, "aria-haspopup": "listbox", "aria-expanded": isOpen, "aria-invalid": hasError, "aria-disabled": disabled, "$hasError": hasError, "$disabled": disabled, "data-state": hasError ? "error" : isOpen || focused ? "active" : undefined, onClick: toggleDropdown, children: [icon && jsx(LeadingIcon, { children: icon }), jsx(Value, { "$placeholder": displayPlaceholder, children: displayText }), jsx(HiddenInput$1, { ref: ref, readOnly: true, name: name, value: selectedValue, tabIndex: -1, "aria-hidden": true })] }), error && jsx(ErrorText, { children: error }), isOpen && (jsx(List, { ref: listRef, role: "listbox", "$top": dropdownRect.top, "$left": dropdownRect.left, "$width": dropdownRect.width, children: options.map((option, index) => {
1457
+ const includeOption = options.find((opt) => opt.value === selectedValue);
1458
+ return (jsxs(Wrapper, { "data-select-field": "true", className: className, ref: wrapperRef, onKeyDown: handleKeyDown, onFocus: handleFocus, onBlur: handleBlur, onClick: (e) => e.stopPropagation(), children: [label && jsx(Label$1, { children: label }), jsxs(FieldContainer, { ref: fieldRef, role: "button", tabIndex: disabled ? -1 : 0, "aria-haspopup": "listbox", "aria-expanded": isOpen, "aria-invalid": hasError, "aria-disabled": disabled, "$hasError": hasError, "$disabled": disabled, "data-state": hasError ? "error" : isOpen || focused ? "active" : undefined, onClick: toggleDropdown, children: [icon ||
1459
+ (includeOption?.icon && (jsx(LeadingIcon, { children: icon || includeOption.icon }))), jsx(Value, { "$placeholder": displayPlaceholder, children: displayText }), jsx(HiddenInput$1, { ref: ref, readOnly: true, name: name, value: selectedValue, tabIndex: -1, "aria-hidden": true })] }), error && jsx(ErrorText, { children: error }), isOpen && (jsx(List, { ref: listRef, role: "listbox", "$width": dropdownRect.width, children: options.map((option, index) => {
1453
1460
  const isActiveOption = option.value === selectedValue;
1454
1461
  const isHovered = index === hoveredIndex;
1455
- return (jsxs(Option, { role: "option", "aria-selected": isActiveOption, "data-active": isActiveOption || undefined, "data-hovered": isHovered || undefined, onMouseEnter: () => setHoveredIndex(index), onMouseLeave: () => setHoveredIndex(null), onMouseDown: (evt) => evt.preventDefault(), onClick: () => handleSelect(option), children: [option.icon && jsx(OptionIcon, { children: option.icon }), jsx(Typography, { variant: "form-input", children: option.label })] }, option.value));
1462
+ return (jsxs(Option, { role: "option", "aria-selected": isActiveOption, "data-active": isActiveOption || undefined, "data-hovered": isHovered || undefined, onMouseEnter: () => setHoveredIndex(index), onMouseLeave: () => setHoveredIndex(null), onMouseDown: (evt) => evt.preventDefault(), onClick: () => handleSelect(option), children: [option.icon && jsx(OptionIcon, { children: option.icon }), jsx(OptionText, { variant: "form-input", children: option.label })] }, option.value));
1456
1463
  }) }))] }));
1457
1464
  });
1458
1465
  SelectField.displayName = "SelectField";
@@ -2197,6 +2204,99 @@ const Avatar = (props) => {
2197
2204
  return jsx(AvatarStyled, { "$color": "hoverBlue", "$size": 40, ...props });
2198
2205
  };
2199
2206
 
2207
+ const LangCountrySelectStyled = styled$1.div `
2208
+ position: relative;
2209
+ min-width: 200px;
2210
+ `;
2211
+ const LangCountrySelectContainer = styled$1.div `
2212
+ padding: 12px 14px;
2213
+ display: flex;
2214
+ gap: 10px;
2215
+ align-items: center;
2216
+ border-radius: 5px;
2217
+ border: 1px solid ${({ theme }) => theme.colors.gray.lightGray2};
2218
+ min-width: 200px;
2219
+ width: fit-content;
2220
+ cursor: pointer;
2221
+ `;
2222
+ const LangCountrySelectDropdown = styled$1.div `
2223
+ display: flex;
2224
+ flex-direction: column;
2225
+ gap: 14px;
2226
+ margin-top: 16px;
2227
+ position: fixed;
2228
+ opacity: ${({ $open }) => ($open ? 1 : 0)};
2229
+ visibility: ${({ $open }) => ($open ? "visible" : "hidden")};
2230
+ pointer-events: ${({ $open }) => ($open ? "auto" : "none")};
2231
+ scale: ${({ $open }) => ($open ? 1 : 0.8)};
2232
+ transform-origin: top center;
2233
+ background: ${({ theme }) => theme.colors.primary.white};
2234
+ z-index: 100;
2235
+ padding: 12px 14px;
2236
+ border-radius: 5px;
2237
+ min-width: 200px;
2238
+ border: 1px solid ${({ theme }) => theme.colors.gray.lightGray2};
2239
+ transition:
2240
+ opacity 150ms ease,
2241
+ scale 150ms ease,
2242
+ visibility 150ms ease;
2243
+ `;
2244
+ const LangCountrySelectArrow = styled$1(DropdownIcon) `
2245
+ transition: transform 150ms ease;
2246
+ transform: rotate(${({ $open }) => ($open ? "180deg" : "0")});
2247
+ `;
2248
+ const LangCountrySelectIcon = styled$1.div `
2249
+ width: 24px;
2250
+ height: 24px;
2251
+ `;
2252
+ const LangCountrySelectLabel = styled$1(Typography).attrs({
2253
+ forwardedAs: "p",
2254
+ variant: "form-input",
2255
+ }) `
2256
+ width: 100%;
2257
+ user-select: none;
2258
+ color: ${({ theme }) => theme.colors.primary.darkBlue};
2259
+ `;
2260
+ const LangCountrySelectButton = styled$1(Button$1) `
2261
+ width: fit-content;
2262
+ `;
2263
+
2264
+ const LangCountrySelect = ({ currentLang, currentCurrency, currentCountry, countries = [], currencies = [], languages = [], handleSave, labelLang, labelCurrency, labelCountry, saveText, }) => {
2265
+ const [isOpen, setIsOpen] = useState(false);
2266
+ const ref = useRef(null);
2267
+ const [lang, setLang] = useState(currentLang);
2268
+ const [currency, setCurrency] = useState(currentCurrency);
2269
+ const [country, setCountry] = useState(currentCountry);
2270
+ const includedCurrency = currencies.find((currency) => currency.value === currentCurrency);
2271
+ const includedCountry = countries.find((country) => country.value === currentCountry);
2272
+ const includedLang = languages.find((lang) => lang.value === currentLang);
2273
+ const handleClick = () => {
2274
+ setIsOpen(!isOpen);
2275
+ };
2276
+ const handleClickSave = useCallback(() => {
2277
+ setIsOpen(false);
2278
+ handleSave?.({
2279
+ lang,
2280
+ currency,
2281
+ country,
2282
+ });
2283
+ }, [lang, currency, country, handleSave]);
2284
+ useEffect(() => {
2285
+ const handleClickOutside = (event) => {
2286
+ if (isOpen && !ref.current?.contains(event.target)) {
2287
+ setIsOpen(false);
2288
+ }
2289
+ };
2290
+ document.addEventListener("mousedown", handleClickOutside);
2291
+ return () => {
2292
+ document.removeEventListener("mousedown", handleClickOutside);
2293
+ };
2294
+ }, [isOpen]);
2295
+ return (jsxs(LangCountrySelectStyled, { ref: ref, children: [jsxs(LangCountrySelectContainer, { onClick: handleClick, children: [includedCurrency?.icon && (jsx(LangCountrySelectIcon, { children: includedCurrency?.icon })), jsx(LangCountrySelectLabel, { children: [includedCurrency?.value, includedLang?.label]
2296
+ .join(" / ")
2297
+ ?.toLocaleUpperCase() }), jsx(LangCountrySelectArrow, { "$open": isOpen, size: 9 })] }), jsxs(LangCountrySelectDropdown, { "$open": isOpen, children: [jsx(SelectField, { placeholder: "", label: labelLang, options: languages, value: lang, onChange: setLang }), jsx(SelectField, { icon: includedCurrency?.icon, placeholder: "", label: labelCurrency, options: currencies, value: currency, onChange: setCurrency }), jsx(SelectField, { icon: includedCountry?.icon, placeholder: "", label: labelCountry, options: countries, value: country, onChange: setCountry }), jsx(LangCountrySelectButton, { size: "medium", onClick: handleClickSave, children: saveText })] })] }));
2298
+ };
2299
+
2200
2300
  const ApplicationDataStyled = styled$1.div `
2201
2301
  display: flex;
2202
2302
  column-gap: 10px;
@@ -24450,8 +24550,8 @@ const theme = {
24450
24550
  colors,
24451
24551
  media: {
24452
24552
  maxWidth: {
24453
- mobile: "@media (max-width: 375px)",
24454
- tablet: "@media (max-width: 834px)",
24553
+ mobile: "@media (max-width: 576px)",
24554
+ tablet: "@media (max-width: 1023px)",
24455
24555
  },
24456
24556
  },
24457
24557
  };
@@ -24529,10 +24629,10 @@ const createAdaptiveScalePlugin = (customConfig) => {
24529
24629
  }
24530
24630
  return `calc(var(${config.scaleVariable}, 1) * ${pxValue}px)`;
24531
24631
  });
24532
- element.value = element.value.replace(/([-0-9.]+)vh/g, (_, value) => {
24533
- const vhValue = parseFloat(value);
24534
- return `calc(var(${config.vhVariable}, 1vh) * ${vhValue})`;
24535
- });
24632
+ // element.value = element.value.replace(/([-0-9.]+)vh/g, (_, value) => {
24633
+ // const vhValue = parseFloat(value);
24634
+ // return `calc(var(${config.vhVariable}, 1vh) * ${vhValue})`;
24635
+ // });
24536
24636
  };
24537
24637
  };
24538
24638
 
@@ -24572,14 +24672,14 @@ const GlobalStyles = createGlobalStyle `
24572
24672
  /* Mobile base (iPhone X/11/12/13 mini) */
24573
24673
  @media (min-width: 375px) and (max-width: 389px) {
24574
24674
  :root {
24575
- --adaptive-scale: 1;
24675
+ --adaptive-scale: 0.6;
24576
24676
  }
24577
24677
  }
24578
24678
 
24579
24679
  /* Large mobile (iPhone 12/13/14/15) */
24580
24680
  @media (min-width: 390px) and (max-width: 429px) {
24581
24681
  :root {
24582
- --adaptive-scale: 1;
24682
+ --adaptive-scale: 0.75;
24583
24683
  }
24584
24684
  }
24585
24685
 
@@ -24748,5 +24848,5 @@ const GlobalStyles = createGlobalStyle `
24748
24848
  }
24749
24849
  `;
24750
24850
 
24751
- export { AaveIcon, AlgorandIcon, ApplicationData, ApplicationInfo, ApplicationStatus, ArrowIcon, AttachIcon, AvalancheIcon, Avatar, BalanceRow, BatIcon, BitcoinIcon, BnbSmallIcon, BtgIcon, BusdIcon, Button$1 as Button, ButtonSwitcher, CakeIcon, CardanoIcon, ChainlinkIcon, Chat, ChatMessage, CheckIcon$1 as CheckIcon, Checkbox, CircleSendCryptoIcon, ClockIcon, Close2Icon, CloseIcon, Container, CopyIcon, CopyTooltip, CosmosIcon, Counter, CountryBrIcon, CountryCzechIcon, CountryKzIcon, CountryRusIcon, CurrencyName, CurrencyRate, DashSmallIcon, DashboardIcon, DecentralandIcon, DepositIcon, DepositSimpleIcon, DigibyteIcon, DogeSmallIcon, DropdownIcon, DropdownSmallIcon, DropdownUpIcon, EditIcon, ElrondIcon, EmojiIcon, EnjinIcon, EosIcon, ErrorBigIcon, EtcIcon, EthIcon, EurIcon, ExchangeArrowsIcon, ExchangeIcon, ExchangeSimpleIcon, FantomIcon, FilecoinIcon, FtxIcon, GlobalStyles, HamburgerButton, HamburgerIcon, HeadphonesIcon, HederaIcon, HideUiIcon, HistoryIcon, IcomputerIcon, IconNeoIcon, IcxIcon, IlsIcon, InfoIcon, Informer, InputMessage, IotaIcon, KlaytnIcon, LariIcon, LinkIcon, LiskIcon, LitecoinIcon, Loader, Logo, LogoAbankIcon, LogoAbsolutIcon, LogoAcbaCreditIcon, LogoAlphabankIcon, LogoArmEconomBankIcon, LogoArshidBankIcon, LogoBankcentercreditIcon, LogoBankofGeorgiaIcon, LogoEurobankIcon, LogoForteBankIcon, LogoHalykBankIcon, LogoHomecreditIcon, LogoHumoCardIcon, LogoJysanBankIcon, LogoKaspiBankIcon, LogoMonobankIcon, LogoMtsbankIcon, LogoNetellerIcon, LogoOshadbankIcon, LogoOtkrutieIcon, LogoPochtabankIcon, LogoPrivatebankIcon, LogoPumbIcon, LogoQiwiIcon, LogoRayfuzenbankIcon, LogoRevolutIcon, LogoRnkbIcon, LogoRosbankIcon, LogoRosselhozbankIcon, LogoRusstandartIcon, LogoSberIcon, LogoSbpIcon, LogoSotovuyIcon, LogoTbcBankIcon, LogoTinkoffIcon, LogoUkrsibbankIcon, LogoUzCardIcon, LogoVtbIcon, LogoWiseIcon, LogoYoumoneyIcon, LogoutIcon, LunaIcon, MakerIcon, MaticIcon, MessageSendIcon, NearIcon, NemIcon, OmgnetworkIcon, OmiseIcon, OntologyIcon, P2PIcon, PaxgIcon, PlusIcon, PolkaIcon, QnekworkIcon, QutumIcon, RadioButton, ReciveCryptoIcon, Requisites, RippleIcon, RubIcon, SandboxIcon, ScanQrIcon, SearchIcon, SelectField, SendCryptoIcon, SettingsIcon, ShowUiIcon, SolanaIcon, StellarIcon, StepnIcon, StyledProvider, SuccessfullBigIcon, SuccessfullSmallIcon, SushiIcon, Switcher, SynthetixIcon, TabList, Table, TetherIcon, TextField, TezosIcon, ThegraphIcon, ThetaIcon, Tooltip, TopUpIcon, TransactionStatus, TrxSmallIcon, Typography, UniswapIcon, UpSmallIcon, UsdIcon, UsdcIcon, UserAccount, UserIcon, UsersIcon, VechainIcon, WalletFillIcon, WalletIcon, WarningIcon, WavesIcon, WithdrawIcon, WithdrawSimpleIcon, XmrSmallIcon, ZcashSmallIcon, ZilliqaIcon, ZrxIcon, adaptiveScalePlugin, copyToClipboard, createAdaptiveScalePlugin, formatCardNumber, maskEmail, theme };
24851
+ export { AaveIcon, AlgorandIcon, ApplicationData, ApplicationInfo, ApplicationStatus, ArrowIcon, AttachIcon, AvalancheIcon, Avatar, BalanceRow, BatIcon, BitcoinIcon, BnbSmallIcon, BtgIcon, BusdIcon, Button$1 as Button, ButtonSwitcher, CakeIcon, CardanoIcon, ChainlinkIcon, Chat, ChatMessage, CheckIcon$1 as CheckIcon, Checkbox, CircleSendCryptoIcon, ClockIcon, Close2Icon, CloseIcon, Container, CopyIcon, CopyTooltip, CosmosIcon, Counter, CountryBrIcon, CountryCzechIcon, CountryKzIcon, CountryRusIcon, CurrencyName, CurrencyRate, DashSmallIcon, DashboardIcon, DecentralandIcon, DepositIcon, DepositSimpleIcon, DigibyteIcon, DogeSmallIcon, DropdownIcon, DropdownSmallIcon, DropdownUpIcon, EditIcon, ElrondIcon, EmojiIcon, EnjinIcon, EosIcon, ErrorBigIcon, EtcIcon, EthIcon, EurIcon, ExchangeArrowsIcon, ExchangeIcon, ExchangeSimpleIcon, FantomIcon, FilecoinIcon, FtxIcon, GlobalStyles, HamburgerButton, HamburgerIcon, HeadphonesIcon, HederaIcon, HideUiIcon, HistoryIcon, IcomputerIcon, IconNeoIcon, IcxIcon, IlsIcon, InfoIcon, Informer, InputMessage, IotaIcon, KlaytnIcon, LangCountrySelect, LariIcon, LinkIcon, LiskIcon, LitecoinIcon, Loader, Logo, LogoAbankIcon, LogoAbsolutIcon, LogoAcbaCreditIcon, LogoAlphabankIcon, LogoArmEconomBankIcon, LogoArshidBankIcon, LogoBankcentercreditIcon, LogoBankofGeorgiaIcon, LogoEurobankIcon, LogoForteBankIcon, LogoHalykBankIcon, LogoHomecreditIcon, LogoHumoCardIcon, LogoJysanBankIcon, LogoKaspiBankIcon, LogoMonobankIcon, LogoMtsbankIcon, LogoNetellerIcon, LogoOshadbankIcon, LogoOtkrutieIcon, LogoPochtabankIcon, LogoPrivatebankIcon, LogoPumbIcon, LogoQiwiIcon, LogoRayfuzenbankIcon, LogoRevolutIcon, LogoRnkbIcon, LogoRosbankIcon, LogoRosselhozbankIcon, LogoRusstandartIcon, LogoSberIcon, LogoSbpIcon, LogoSotovuyIcon, LogoTbcBankIcon, LogoTinkoffIcon, LogoUkrsibbankIcon, LogoUzCardIcon, LogoVtbIcon, LogoWiseIcon, LogoYoumoneyIcon, LogoutIcon, LunaIcon, MakerIcon, MaticIcon, MessageSendIcon, NearIcon, NemIcon, OmgnetworkIcon, OmiseIcon, OntologyIcon, P2PIcon, PaxgIcon, PlusIcon, PolkaIcon, QnekworkIcon, QutumIcon, RadioButton, ReciveCryptoIcon, Requisites, RippleIcon, RubIcon, SandboxIcon, ScanQrIcon, SearchIcon, SelectField, SendCryptoIcon, SettingsIcon, ShowUiIcon, SolanaIcon, StellarIcon, StepnIcon, StyledProvider, SuccessfullBigIcon, SuccessfullSmallIcon, SushiIcon, Switcher, SynthetixIcon, TabList, Table, TetherIcon, TextField, TezosIcon, ThegraphIcon, ThetaIcon, Tooltip, TopUpIcon, TransactionStatus, TrxSmallIcon, Typography, UniswapIcon, UpSmallIcon, UsdIcon, UsdcIcon, UserAccount, UserIcon, UsersIcon, VechainIcon, WalletFillIcon, WalletIcon, WarningIcon, WavesIcon, WithdrawIcon, WithdrawSimpleIcon, XmrSmallIcon, ZcashSmallIcon, ZilliqaIcon, ZrxIcon, adaptiveScalePlugin, copyToClipboard, createAdaptiveScalePlugin, formatCardNumber, maskEmail, theme };
24752
24852
  //# sourceMappingURL=matbea-ui.es.js.map