@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.
@@ -1211,15 +1211,13 @@ const RadioButton = ({ checked, defaultChecked = false, disabled = false, name,
1211
1211
 
1212
1212
  const Wrapper = styled.styled.div `
1213
1213
  position: relative;
1214
- display: flex;
1215
- flex-direction: column;
1216
- gap: 12px;
1217
1214
  width: 100%;
1218
1215
  `;
1219
1216
  const Label$1 = styled.styled(Typography).attrs({
1220
1217
  variant: "form-input",
1221
1218
  forwardedAs: "label",
1222
1219
  }) `
1220
+ margin-bottom: 8px;
1223
1221
  color: ${({ theme }) => theme.colors.primary.darkBlue};
1224
1222
  `;
1225
1223
  const FieldContainer = styled.styled.div `
@@ -1283,9 +1281,8 @@ const ErrorText = styled.styled.span `
1283
1281
  color: ${({ theme }) => theme.colors.accent.red};
1284
1282
  `;
1285
1283
  const List = styled.styled.div `
1284
+ margin-top: 12px;
1286
1285
  position: fixed;
1287
- top: ${({ $top }) => `${$top}px`};
1288
- left: ${({ $left }) => `${$left}px`};
1289
1286
  width: ${({ $width }) => `${$width}px`};
1290
1287
  z-index: 999;
1291
1288
  border-radius: 5px;
@@ -1301,7 +1298,7 @@ const Option = styled.styled.button `
1301
1298
  display: flex;
1302
1299
  align-items: center;
1303
1300
  gap: 10px;
1304
- padding: 0 13px;
1301
+ padding: 11px 13px;
1305
1302
  height: 40px;
1306
1303
  border: none;
1307
1304
  background: transparent;
@@ -1310,7 +1307,6 @@ const Option = styled.styled.button `
1310
1307
  color: ${({ theme }) => theme.colors.primary.darkBlue};
1311
1308
  cursor: pointer;
1312
1309
  transition: background 140ms ease;
1313
-
1314
1310
  &[data-hovered="true"],
1315
1311
  &:hover {
1316
1312
  background: ${({ theme }) => theme.colors.gray.lightBlueGray};
@@ -1320,14 +1316,23 @@ const Option = styled.styled.button `
1320
1316
  background: ${({ theme }) => theme.colors.gray.lightGray};
1321
1317
  }
1322
1318
  `;
1319
+ const OptionText = styled.styled(Typography).attrs({
1320
+ forwardedAs: "span",
1321
+ variant: "form-input",
1322
+ }) `
1323
+ overflow: hidden;
1324
+ white-space: nowrap;
1325
+ text-overflow: ellipsis;
1326
+ `;
1323
1327
  const OptionIcon = styled.styled.span `
1324
1328
  display: inline-flex;
1329
+ align-items: center;
1325
1330
  width: 24px;
1326
1331
  height: 24px;
1327
1332
  `;
1328
1333
 
1329
1334
  const DROPDOWN_OFFSET = 8;
1330
- const SelectField = React__default.forwardRef(({ options, value, defaultValue, placeholder = "Text", label, error, disabled = false, icon, name, onChange, onFocus, onBlur, className, }, ref) => {
1335
+ const SelectField = React__default.forwardRef(({ options = [], value, defaultValue, placeholder = "Text", label, error, disabled = false, icon, name, onChange, onFocus, onBlur, className, }, ref) => {
1331
1336
  const wrapperRef = React__default.useRef(null);
1332
1337
  const fieldRef = React__default.useRef(null);
1333
1338
  const listRef = React__default.useRef(null);
@@ -1451,10 +1456,10 @@ const SelectField = React__default.forwardRef(({ options, value, defaultValue, p
1451
1456
  setFocused(false);
1452
1457
  onBlur?.(evt);
1453
1458
  };
1454
- return (jsxRuntime.jsxs(Wrapper, { className: className, ref: wrapperRef, onKeyDown: handleKeyDown, onFocus: handleFocus, onBlur: handleBlur, children: [label && jsxRuntime.jsx(Label$1, { children: label }), jsxRuntime.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 && jsxRuntime.jsx(LeadingIcon, { children: icon }), jsxRuntime.jsx(Value, { "$placeholder": displayPlaceholder, children: displayText }), jsxRuntime.jsx(HiddenInput$1, { ref: ref, readOnly: true, name: name, value: selectedValue, tabIndex: -1, "aria-hidden": true })] }), error && jsxRuntime.jsx(ErrorText, { children: error }), isOpen && (jsxRuntime.jsx(List, { ref: listRef, role: "listbox", "$top": dropdownRect.top, "$left": dropdownRect.left, "$width": dropdownRect.width, children: options.map((option, index) => {
1459
+ return (jsxRuntime.jsxs(Wrapper, { "data-select-field": "true", className: className, ref: wrapperRef, onKeyDown: handleKeyDown, onFocus: handleFocus, onBlur: handleBlur, onClick: (e) => e.stopPropagation(), children: [label && jsxRuntime.jsx(Label$1, { children: label }), jsxRuntime.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 && jsxRuntime.jsx(LeadingIcon, { children: icon }), jsxRuntime.jsx(Value, { "$placeholder": displayPlaceholder, children: displayText }), jsxRuntime.jsx(HiddenInput$1, { ref: ref, readOnly: true, name: name, value: selectedValue, tabIndex: -1, "aria-hidden": true })] }), error && jsxRuntime.jsx(ErrorText, { children: error }), isOpen && (jsxRuntime.jsx(List, { ref: listRef, role: "listbox", "$width": dropdownRect.width, children: options.map((option, index) => {
1455
1460
  const isActiveOption = option.value === selectedValue;
1456
1461
  const isHovered = index === hoveredIndex;
1457
- return (jsxRuntime.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 && jsxRuntime.jsx(OptionIcon, { children: option.icon }), jsxRuntime.jsx(Typography, { variant: "form-input", children: option.label })] }, option.value));
1462
+ return (jsxRuntime.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 && jsxRuntime.jsx(OptionIcon, { children: option.icon }), jsxRuntime.jsx(OptionText, { variant: "form-input", children: option.label })] }, option.value));
1458
1463
  }) }))] }));
1459
1464
  });
1460
1465
  SelectField.displayName = "SelectField";
@@ -2199,6 +2204,98 @@ const Avatar = (props) => {
2199
2204
  return jsxRuntime.jsx(AvatarStyled, { "$color": "hoverBlue", "$size": 40, ...props });
2200
2205
  };
2201
2206
 
2207
+ const LangCountrySelectStyled = styled.styled.div `
2208
+ position: relative;
2209
+ min-width: 200px;
2210
+ `;
2211
+ const LangCountrySelectContainer = styled.styled.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.styled.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
+ z-index: 100;
2234
+ padding: 12px 14px;
2235
+ border-radius: 5px;
2236
+ min-width: 200px;
2237
+ border: 1px solid ${({ theme }) => theme.colors.gray.lightGray2};
2238
+ transition:
2239
+ opacity 150ms ease,
2240
+ scale 150ms ease,
2241
+ visibility 150ms ease;
2242
+ `;
2243
+ const LangCountrySelectArrow = styled.styled(DropdownIcon) `
2244
+ transition: transform 150ms ease;
2245
+ transform: rotate(${({ $open }) => ($open ? "180deg" : "0")});
2246
+ `;
2247
+ const LangCountrySelectIcon = styled.styled.div `
2248
+ width: 24px;
2249
+ height: 24px;
2250
+ `;
2251
+ const LangCountrySelectLabel = styled.styled(Typography).attrs({
2252
+ forwardedAs: "p",
2253
+ variant: "form-input",
2254
+ }) `
2255
+ width: 100%;
2256
+ user-select: none;
2257
+ color: ${({ theme }) => theme.colors.primary.darkBlue};
2258
+ `;
2259
+ const LangCountrySelectButton = styled.styled(Button$1) `
2260
+ width: fit-content;
2261
+ `;
2262
+
2263
+ const LangCountrySelect = ({ currentLang, currentCurrency, currentCountry, countries = [], currencies = [], languages = [], handleSave, labelLang, labelCurrency, labelCountry, saveText, }) => {
2264
+ const [isOpen, setIsOpen] = React__default.useState(false);
2265
+ const ref = React__default.useRef(null);
2266
+ const [lang, setLang] = React__default.useState(currentLang);
2267
+ const [currency, setCurrency] = React__default.useState(currentCurrency);
2268
+ const [country, setCountry] = React__default.useState(currentCountry);
2269
+ const includedCurrency = currencies.find((currency) => currency.value === currentCurrency);
2270
+ const includedCountry = countries.find((country) => country.value === currentCountry);
2271
+ const includedLang = languages.find((lang) => lang.value === currentLang);
2272
+ const handleClick = () => {
2273
+ setIsOpen(!isOpen);
2274
+ };
2275
+ const handleClickSave = React__default.useCallback(() => {
2276
+ setIsOpen(false);
2277
+ handleSave?.({
2278
+ lang,
2279
+ currency,
2280
+ country,
2281
+ });
2282
+ }, [lang, currency, country, handleSave]);
2283
+ React__default.useEffect(() => {
2284
+ const handleClickOutside = (event) => {
2285
+ if (isOpen && !ref.current?.contains(event.target)) {
2286
+ setIsOpen(false);
2287
+ }
2288
+ };
2289
+ document.addEventListener("mousedown", handleClickOutside);
2290
+ return () => {
2291
+ document.removeEventListener("mousedown", handleClickOutside);
2292
+ };
2293
+ }, [isOpen]);
2294
+ return (jsxRuntime.jsxs(LangCountrySelectStyled, { ref: ref, children: [jsxRuntime.jsxs(LangCountrySelectContainer, { onClick: handleClick, children: [includedCurrency?.icon && (jsxRuntime.jsx(LangCountrySelectIcon, { children: includedCurrency?.icon })), jsxRuntime.jsx(LangCountrySelectLabel, { children: [includedCurrency?.value, includedLang?.label]
2295
+ .join(" / ")
2296
+ ?.toLocaleUpperCase() }), jsxRuntime.jsx(LangCountrySelectArrow, { "$open": isOpen, size: 9 })] }), jsxRuntime.jsxs(LangCountrySelectDropdown, { "$open": isOpen, children: [jsxRuntime.jsx(SelectField, { placeholder: "", label: labelLang, options: languages, value: lang, onChange: setLang }), jsxRuntime.jsx(SelectField, { icon: includedCurrency?.icon, placeholder: "", label: labelCurrency, options: currencies, value: currency, onChange: setCurrency }), jsxRuntime.jsx(SelectField, { icon: includedCountry?.icon, placeholder: "", label: labelCountry, options: countries, value: country, onChange: setCountry }), jsxRuntime.jsx(LangCountrySelectButton, { size: "medium", onClick: handleClickSave, children: saveText })] })] }));
2297
+ };
2298
+
2202
2299
  const ApplicationDataStyled = styled.styled.div `
2203
2300
  display: flex;
2204
2301
  column-gap: 10px;
@@ -2242,7 +2339,7 @@ const ApplicationData = ({ label, statusValue, withdraw, info, }) => {
2242
2339
 
2243
2340
  const ApplicationInfoStyled = styled.styled.div `
2244
2341
  display: flex;
2245
- width: fit-content;
2342
+ width: 100%;
2246
2343
  align-items: center;
2247
2344
  gap: 22px;
2248
2345
  ${({ $variant }) => {
@@ -2264,7 +2361,6 @@ const ApplicationInfoStyled = styled.styled.div `
2264
2361
 
2265
2362
  border-radius: 6px;
2266
2363
  ${({ theme }) => theme.media.maxWidth.tablet} {
2267
- width: 100%;
2268
2364
  flex-direction: column;
2269
2365
  gap: 18px;
2270
2366
  padding: 18px 20px;
@@ -2277,10 +2373,9 @@ const ApplicationInfoStyled = styled.styled.div `
2277
2373
  `;
2278
2374
  const ApplicationInfoDataContainer = styled.styled.div `
2279
2375
  display: flex;
2280
- gap: 56px;
2281
- width: fit-content;
2376
+ gap: 64px;
2377
+ width: 100%;
2282
2378
  ${({ theme }) => theme.media.maxWidth.tablet} {
2283
- width: 100%;
2284
2379
  flex-direction: column;
2285
2380
  gap: 12px;
2286
2381
  }
@@ -24454,8 +24549,8 @@ const theme = {
24454
24549
  colors,
24455
24550
  media: {
24456
24551
  maxWidth: {
24457
- mobile: "@media (max-width: 375px)",
24458
- tablet: "@media (max-width: 834px)",
24552
+ mobile: "@media (max-width: 576px)",
24553
+ tablet: "@media (max-width: 1023px)",
24459
24554
  },
24460
24555
  },
24461
24556
  };
@@ -24533,10 +24628,10 @@ const createAdaptiveScalePlugin = (customConfig) => {
24533
24628
  }
24534
24629
  return `calc(var(${config.scaleVariable}, 1) * ${pxValue}px)`;
24535
24630
  });
24536
- element.value = element.value.replace(/([-0-9.]+)vh/g, (_, value) => {
24537
- const vhValue = parseFloat(value);
24538
- return `calc(var(${config.vhVariable}, 1vh) * ${vhValue})`;
24539
- });
24631
+ // element.value = element.value.replace(/([-0-9.]+)vh/g, (_, value) => {
24632
+ // const vhValue = parseFloat(value);
24633
+ // return `calc(var(${config.vhVariable}, 1vh) * ${vhValue})`;
24634
+ // });
24540
24635
  };
24541
24636
  };
24542
24637
 
@@ -24576,14 +24671,14 @@ const GlobalStyles = styled.createGlobalStyle `
24576
24671
  /* Mobile base (iPhone X/11/12/13 mini) */
24577
24672
  @media (min-width: 375px) and (max-width: 389px) {
24578
24673
  :root {
24579
- --adaptive-scale: 1;
24674
+ --adaptive-scale: 0.6;
24580
24675
  }
24581
24676
  }
24582
24677
 
24583
24678
  /* Large mobile (iPhone 12/13/14/15) */
24584
24679
  @media (min-width: 390px) and (max-width: 429px) {
24585
24680
  :root {
24586
- --adaptive-scale: 1;
24681
+ --adaptive-scale: 0.75;
24587
24682
  }
24588
24683
  }
24589
24684
 
@@ -24832,6 +24927,7 @@ exports.Informer = Informer;
24832
24927
  exports.InputMessage = InputMessage;
24833
24928
  exports.IotaIcon = IotaIcon;
24834
24929
  exports.KlaytnIcon = KlaytnIcon;
24930
+ exports.LangCountrySelect = LangCountrySelect;
24835
24931
  exports.LariIcon = LariIcon;
24836
24932
  exports.LinkIcon = LinkIcon;
24837
24933
  exports.LiskIcon = LiskIcon;