@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.
- package/dist/matbea-ui.cjs.js +119 -18
- package/dist/matbea-ui.cjs.js.map +1 -1
- package/dist/matbea-ui.es.js +119 -19
- package/dist/matbea-ui.es.js.map +1 -1
- package/dist/types/index.d.ts +23 -4
- package/package.json +1 -1
package/dist/matbea-ui.cjs.js
CHANGED
|
@@ -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:
|
|
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,12 @@ const SelectField = React__default.forwardRef(({ options, value, defaultValue, p
|
|
|
1451
1456
|
setFocused(false);
|
|
1452
1457
|
onBlur?.(evt);
|
|
1453
1458
|
};
|
|
1454
|
-
|
|
1459
|
+
const includeOption = options.find((opt) => opt.value === selectedValue);
|
|
1460
|
+
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 ||
|
|
1461
|
+
(includeOption?.icon && (jsxRuntime.jsx(LeadingIcon, { children: icon || includeOption.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
1462
|
const isActiveOption = option.value === selectedValue;
|
|
1456
1463
|
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(
|
|
1464
|
+
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
1465
|
}) }))] }));
|
|
1459
1466
|
});
|
|
1460
1467
|
SelectField.displayName = "SelectField";
|
|
@@ -2199,6 +2206,99 @@ const Avatar = (props) => {
|
|
|
2199
2206
|
return jsxRuntime.jsx(AvatarStyled, { "$color": "hoverBlue", "$size": 40, ...props });
|
|
2200
2207
|
};
|
|
2201
2208
|
|
|
2209
|
+
const LangCountrySelectStyled = styled.styled.div `
|
|
2210
|
+
position: relative;
|
|
2211
|
+
min-width: 200px;
|
|
2212
|
+
`;
|
|
2213
|
+
const LangCountrySelectContainer = styled.styled.div `
|
|
2214
|
+
padding: 12px 14px;
|
|
2215
|
+
display: flex;
|
|
2216
|
+
gap: 10px;
|
|
2217
|
+
align-items: center;
|
|
2218
|
+
border-radius: 5px;
|
|
2219
|
+
border: 1px solid ${({ theme }) => theme.colors.gray.lightGray2};
|
|
2220
|
+
min-width: 200px;
|
|
2221
|
+
width: fit-content;
|
|
2222
|
+
cursor: pointer;
|
|
2223
|
+
`;
|
|
2224
|
+
const LangCountrySelectDropdown = styled.styled.div `
|
|
2225
|
+
display: flex;
|
|
2226
|
+
flex-direction: column;
|
|
2227
|
+
gap: 14px;
|
|
2228
|
+
margin-top: 16px;
|
|
2229
|
+
position: fixed;
|
|
2230
|
+
opacity: ${({ $open }) => ($open ? 1 : 0)};
|
|
2231
|
+
visibility: ${({ $open }) => ($open ? "visible" : "hidden")};
|
|
2232
|
+
pointer-events: ${({ $open }) => ($open ? "auto" : "none")};
|
|
2233
|
+
scale: ${({ $open }) => ($open ? 1 : 0.8)};
|
|
2234
|
+
transform-origin: top center;
|
|
2235
|
+
background: ${({ theme }) => theme.colors.primary.white};
|
|
2236
|
+
z-index: 100;
|
|
2237
|
+
padding: 12px 14px;
|
|
2238
|
+
border-radius: 5px;
|
|
2239
|
+
min-width: 200px;
|
|
2240
|
+
border: 1px solid ${({ theme }) => theme.colors.gray.lightGray2};
|
|
2241
|
+
transition:
|
|
2242
|
+
opacity 150ms ease,
|
|
2243
|
+
scale 150ms ease,
|
|
2244
|
+
visibility 150ms ease;
|
|
2245
|
+
`;
|
|
2246
|
+
const LangCountrySelectArrow = styled.styled(DropdownIcon) `
|
|
2247
|
+
transition: transform 150ms ease;
|
|
2248
|
+
transform: rotate(${({ $open }) => ($open ? "180deg" : "0")});
|
|
2249
|
+
`;
|
|
2250
|
+
const LangCountrySelectIcon = styled.styled.div `
|
|
2251
|
+
width: 24px;
|
|
2252
|
+
height: 24px;
|
|
2253
|
+
`;
|
|
2254
|
+
const LangCountrySelectLabel = styled.styled(Typography).attrs({
|
|
2255
|
+
forwardedAs: "p",
|
|
2256
|
+
variant: "form-input",
|
|
2257
|
+
}) `
|
|
2258
|
+
width: 100%;
|
|
2259
|
+
user-select: none;
|
|
2260
|
+
color: ${({ theme }) => theme.colors.primary.darkBlue};
|
|
2261
|
+
`;
|
|
2262
|
+
const LangCountrySelectButton = styled.styled(Button$1) `
|
|
2263
|
+
width: fit-content;
|
|
2264
|
+
`;
|
|
2265
|
+
|
|
2266
|
+
const LangCountrySelect = ({ currentLang, currentCurrency, currentCountry, countries = [], currencies = [], languages = [], handleSave, labelLang, labelCurrency, labelCountry, saveText, }) => {
|
|
2267
|
+
const [isOpen, setIsOpen] = React__default.useState(false);
|
|
2268
|
+
const ref = React__default.useRef(null);
|
|
2269
|
+
const [lang, setLang] = React__default.useState(currentLang);
|
|
2270
|
+
const [currency, setCurrency] = React__default.useState(currentCurrency);
|
|
2271
|
+
const [country, setCountry] = React__default.useState(currentCountry);
|
|
2272
|
+
const includedCurrency = currencies.find((currency) => currency.value === currentCurrency);
|
|
2273
|
+
const includedCountry = countries.find((country) => country.value === currentCountry);
|
|
2274
|
+
const includedLang = languages.find((lang) => lang.value === currentLang);
|
|
2275
|
+
const handleClick = () => {
|
|
2276
|
+
setIsOpen(!isOpen);
|
|
2277
|
+
};
|
|
2278
|
+
const handleClickSave = React__default.useCallback(() => {
|
|
2279
|
+
setIsOpen(false);
|
|
2280
|
+
handleSave?.({
|
|
2281
|
+
lang,
|
|
2282
|
+
currency,
|
|
2283
|
+
country,
|
|
2284
|
+
});
|
|
2285
|
+
}, [lang, currency, country, handleSave]);
|
|
2286
|
+
React__default.useEffect(() => {
|
|
2287
|
+
const handleClickOutside = (event) => {
|
|
2288
|
+
if (isOpen && !ref.current?.contains(event.target)) {
|
|
2289
|
+
setIsOpen(false);
|
|
2290
|
+
}
|
|
2291
|
+
};
|
|
2292
|
+
document.addEventListener("mousedown", handleClickOutside);
|
|
2293
|
+
return () => {
|
|
2294
|
+
document.removeEventListener("mousedown", handleClickOutside);
|
|
2295
|
+
};
|
|
2296
|
+
}, [isOpen]);
|
|
2297
|
+
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]
|
|
2298
|
+
.join(" / ")
|
|
2299
|
+
?.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 })] })] }));
|
|
2300
|
+
};
|
|
2301
|
+
|
|
2202
2302
|
const ApplicationDataStyled = styled.styled.div `
|
|
2203
2303
|
display: flex;
|
|
2204
2304
|
column-gap: 10px;
|
|
@@ -24452,8 +24552,8 @@ const theme = {
|
|
|
24452
24552
|
colors,
|
|
24453
24553
|
media: {
|
|
24454
24554
|
maxWidth: {
|
|
24455
|
-
mobile: "@media (max-width:
|
|
24456
|
-
tablet: "@media (max-width:
|
|
24555
|
+
mobile: "@media (max-width: 576px)",
|
|
24556
|
+
tablet: "@media (max-width: 1023px)",
|
|
24457
24557
|
},
|
|
24458
24558
|
},
|
|
24459
24559
|
};
|
|
@@ -24531,10 +24631,10 @@ const createAdaptiveScalePlugin = (customConfig) => {
|
|
|
24531
24631
|
}
|
|
24532
24632
|
return `calc(var(${config.scaleVariable}, 1) * ${pxValue}px)`;
|
|
24533
24633
|
});
|
|
24534
|
-
element.value = element.value.replace(/([-0-9.]+)vh/g, (_, value) => {
|
|
24535
|
-
|
|
24536
|
-
|
|
24537
|
-
});
|
|
24634
|
+
// element.value = element.value.replace(/([-0-9.]+)vh/g, (_, value) => {
|
|
24635
|
+
// const vhValue = parseFloat(value);
|
|
24636
|
+
// return `calc(var(${config.vhVariable}, 1vh) * ${vhValue})`;
|
|
24637
|
+
// });
|
|
24538
24638
|
};
|
|
24539
24639
|
};
|
|
24540
24640
|
|
|
@@ -24574,14 +24674,14 @@ const GlobalStyles = styled.createGlobalStyle `
|
|
|
24574
24674
|
/* Mobile base (iPhone X/11/12/13 mini) */
|
|
24575
24675
|
@media (min-width: 375px) and (max-width: 389px) {
|
|
24576
24676
|
:root {
|
|
24577
|
-
--adaptive-scale:
|
|
24677
|
+
--adaptive-scale: 0.6;
|
|
24578
24678
|
}
|
|
24579
24679
|
}
|
|
24580
24680
|
|
|
24581
24681
|
/* Large mobile (iPhone 12/13/14/15) */
|
|
24582
24682
|
@media (min-width: 390px) and (max-width: 429px) {
|
|
24583
24683
|
:root {
|
|
24584
|
-
--adaptive-scale:
|
|
24684
|
+
--adaptive-scale: 0.75;
|
|
24585
24685
|
}
|
|
24586
24686
|
}
|
|
24587
24687
|
|
|
@@ -24830,6 +24930,7 @@ exports.Informer = Informer;
|
|
|
24830
24930
|
exports.InputMessage = InputMessage;
|
|
24831
24931
|
exports.IotaIcon = IotaIcon;
|
|
24832
24932
|
exports.KlaytnIcon = KlaytnIcon;
|
|
24933
|
+
exports.LangCountrySelect = LangCountrySelect;
|
|
24833
24934
|
exports.LariIcon = LariIcon;
|
|
24834
24935
|
exports.LinkIcon = LinkIcon;
|
|
24835
24936
|
exports.LiskIcon = LiskIcon;
|