@matbea-ui/matbea-ui 0.2.0-dev.303804 → 0.2.0-dev.347138

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,10 @@ 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
+ 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 && 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", "$width": dropdownRect.width, children: options.map((option, index) => {
1453
1458
  const isActiveOption = option.value === selectedValue;
1454
1459
  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));
1460
+ 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
1461
  }) }))] }));
1457
1462
  });
1458
1463
  SelectField.displayName = "SelectField";
@@ -2197,6 +2202,98 @@ const Avatar = (props) => {
2197
2202
  return jsx(AvatarStyled, { "$color": "hoverBlue", "$size": 40, ...props });
2198
2203
  };
2199
2204
 
2205
+ const LangCountrySelectStyled = styled$1.div `
2206
+ position: relative;
2207
+ min-width: 200px;
2208
+ `;
2209
+ const LangCountrySelectContainer = styled$1.div `
2210
+ padding: 12px 14px;
2211
+ display: flex;
2212
+ gap: 10px;
2213
+ align-items: center;
2214
+ border-radius: 5px;
2215
+ border: 1px solid ${({ theme }) => theme.colors.gray.lightGray2};
2216
+ min-width: 200px;
2217
+ width: fit-content;
2218
+ cursor: pointer;
2219
+ `;
2220
+ const LangCountrySelectDropdown = styled$1.div `
2221
+ display: flex;
2222
+ flex-direction: column;
2223
+ gap: 14px;
2224
+ margin-top: 16px;
2225
+ position: fixed;
2226
+ opacity: ${({ $open }) => ($open ? 1 : 0)};
2227
+ visibility: ${({ $open }) => ($open ? "visible" : "hidden")};
2228
+ pointer-events: ${({ $open }) => ($open ? "auto" : "none")};
2229
+ scale: ${({ $open }) => ($open ? 1 : 0.8)};
2230
+ transform-origin: top center;
2231
+ z-index: 100;
2232
+ padding: 12px 14px;
2233
+ border-radius: 5px;
2234
+ min-width: 200px;
2235
+ border: 1px solid ${({ theme }) => theme.colors.gray.lightGray2};
2236
+ transition:
2237
+ opacity 150ms ease,
2238
+ scale 150ms ease,
2239
+ visibility 150ms ease;
2240
+ `;
2241
+ const LangCountrySelectArrow = styled$1(DropdownIcon) `
2242
+ transition: transform 150ms ease;
2243
+ transform: rotate(${({ $open }) => ($open ? "180deg" : "0")});
2244
+ `;
2245
+ const LangCountrySelectIcon = styled$1.div `
2246
+ width: 24px;
2247
+ height: 24px;
2248
+ `;
2249
+ const LangCountrySelectLabel = styled$1(Typography).attrs({
2250
+ forwardedAs: "p",
2251
+ variant: "form-input",
2252
+ }) `
2253
+ width: 100%;
2254
+ user-select: none;
2255
+ color: ${({ theme }) => theme.colors.primary.darkBlue};
2256
+ `;
2257
+ const LangCountrySelectButton = styled$1(Button$1) `
2258
+ width: fit-content;
2259
+ `;
2260
+
2261
+ const LangCountrySelect = ({ currentLang, currentCurrency, currentCountry, countries = [], currencies = [], languages = [], handleSave, labelLang, labelCurrency, labelCountry, saveText, }) => {
2262
+ const [isOpen, setIsOpen] = useState(false);
2263
+ const ref = useRef(null);
2264
+ const [lang, setLang] = useState(currentLang);
2265
+ const [currency, setCurrency] = useState(currentCurrency);
2266
+ const [country, setCountry] = useState(currentCountry);
2267
+ const includedCurrency = currencies.find((currency) => currency.value === currentCurrency);
2268
+ const includedCountry = countries.find((country) => country.value === currentCountry);
2269
+ const includedLang = languages.find((lang) => lang.value === currentLang);
2270
+ const handleClick = () => {
2271
+ setIsOpen(!isOpen);
2272
+ };
2273
+ const handleClickSave = useCallback(() => {
2274
+ setIsOpen(false);
2275
+ handleSave?.({
2276
+ lang,
2277
+ currency,
2278
+ country,
2279
+ });
2280
+ }, [lang, currency, country, handleSave]);
2281
+ useEffect(() => {
2282
+ const handleClickOutside = (event) => {
2283
+ if (isOpen && !ref.current?.contains(event.target)) {
2284
+ setIsOpen(false);
2285
+ }
2286
+ };
2287
+ document.addEventListener("mousedown", handleClickOutside);
2288
+ return () => {
2289
+ document.removeEventListener("mousedown", handleClickOutside);
2290
+ };
2291
+ }, [isOpen]);
2292
+ 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]
2293
+ .join(" / ")
2294
+ ?.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 })] })] }));
2295
+ };
2296
+
2200
2297
  const ApplicationDataStyled = styled$1.div `
2201
2298
  display: flex;
2202
2299
  column-gap: 10px;
@@ -2240,7 +2337,7 @@ const ApplicationData = ({ label, statusValue, withdraw, info, }) => {
2240
2337
 
2241
2338
  const ApplicationInfoStyled = styled$1.div `
2242
2339
  display: flex;
2243
- width: fit-content;
2340
+ width: 100%;
2244
2341
  align-items: center;
2245
2342
  gap: 22px;
2246
2343
  ${({ $variant }) => {
@@ -2262,7 +2359,6 @@ const ApplicationInfoStyled = styled$1.div `
2262
2359
 
2263
2360
  border-radius: 6px;
2264
2361
  ${({ theme }) => theme.media.maxWidth.tablet} {
2265
- width: 100%;
2266
2362
  flex-direction: column;
2267
2363
  gap: 18px;
2268
2364
  padding: 18px 20px;
@@ -2275,10 +2371,9 @@ const ApplicationInfoStyled = styled$1.div `
2275
2371
  `;
2276
2372
  const ApplicationInfoDataContainer = styled$1.div `
2277
2373
  display: flex;
2278
- gap: 56px;
2279
- width: fit-content;
2374
+ gap: 64px;
2375
+ width: 100%;
2280
2376
  ${({ theme }) => theme.media.maxWidth.tablet} {
2281
- width: 100%;
2282
2377
  flex-direction: column;
2283
2378
  gap: 12px;
2284
2379
  }
@@ -24452,8 +24547,8 @@ const theme = {
24452
24547
  colors,
24453
24548
  media: {
24454
24549
  maxWidth: {
24455
- mobile: "@media (max-width: 375px)",
24456
- tablet: "@media (max-width: 834px)",
24550
+ mobile: "@media (max-width: 576px)",
24551
+ tablet: "@media (max-width: 1023px)",
24457
24552
  },
24458
24553
  },
24459
24554
  };
@@ -24531,10 +24626,10 @@ const createAdaptiveScalePlugin = (customConfig) => {
24531
24626
  }
24532
24627
  return `calc(var(${config.scaleVariable}, 1) * ${pxValue}px)`;
24533
24628
  });
24534
- element.value = element.value.replace(/([-0-9.]+)vh/g, (_, value) => {
24535
- const vhValue = parseFloat(value);
24536
- return `calc(var(${config.vhVariable}, 1vh) * ${vhValue})`;
24537
- });
24629
+ // element.value = element.value.replace(/([-0-9.]+)vh/g, (_, value) => {
24630
+ // const vhValue = parseFloat(value);
24631
+ // return `calc(var(${config.vhVariable}, 1vh) * ${vhValue})`;
24632
+ // });
24538
24633
  };
24539
24634
  };
24540
24635
 
@@ -24574,14 +24669,14 @@ const GlobalStyles = createGlobalStyle `
24574
24669
  /* Mobile base (iPhone X/11/12/13 mini) */
24575
24670
  @media (min-width: 375px) and (max-width: 389px) {
24576
24671
  :root {
24577
- --adaptive-scale: 1;
24672
+ --adaptive-scale: 0.6;
24578
24673
  }
24579
24674
  }
24580
24675
 
24581
24676
  /* Large mobile (iPhone 12/13/14/15) */
24582
24677
  @media (min-width: 390px) and (max-width: 429px) {
24583
24678
  :root {
24584
- --adaptive-scale: 1;
24679
+ --adaptive-scale: 0.75;
24585
24680
  }
24586
24681
  }
24587
24682
 
@@ -24750,5 +24845,5 @@ const GlobalStyles = createGlobalStyle `
24750
24845
  }
24751
24846
  `;
24752
24847
 
24753
- 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 };
24848
+ 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 };
24754
24849
  //# sourceMappingURL=matbea-ui.es.js.map