myshell-react-lib 0.1.47 → 0.1.49
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/index.cjs +28 -21
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +11 -3
- package/dist/index.d.ts +11 -3
- package/dist/index.js +28 -21
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -6479,7 +6479,7 @@ function getDefaultColorForVariant(variant) {
|
|
|
6479
6479
|
}
|
|
6480
6480
|
}
|
|
6481
6481
|
function createIconButtonWithVariant(props, ref) {
|
|
6482
|
-
var iconClassName = props.iconClassName, className = props.className, _props_variant = props.variant, variant = _props_variant === void 0 ? "primary" : _props_variant, _props_size = props.size, size = _props_size === void 0 ? "lg" : _props_size, userProvidedColor = props.color, _props_asChild = props.asChild, asChild = _props_asChild === void 0 ? false : _props_asChild, _props_loading = props.loading, loading = _props_loading === void 0 ? false : _props_loading, children = props.children, IconEle = props.icon, disabled = props.disabled, hoverText = props.hoverText, hoverSide = props.hoverSide, passProps = _object_without_properties(props, [
|
|
6482
|
+
var iconClassName = props.iconClassName, className = props.className, _props_variant = props.variant, variant = _props_variant === void 0 ? "primary" : _props_variant, _props_size = props.size, size = _props_size === void 0 ? "lg" : _props_size, userProvidedColor = props.color, _props_asChild = props.asChild, asChild = _props_asChild === void 0 ? false : _props_asChild, _props_loading = props.loading, loading = _props_loading === void 0 ? false : _props_loading, children = props.children, IconEle = props.icon, disabled = props.disabled, hoverText = props.hoverText, hoverSide = props.hoverSide, isMobile2 = props.isMobile, passProps = _object_without_properties(props, [
|
|
6483
6483
|
"iconClassName",
|
|
6484
6484
|
"className",
|
|
6485
6485
|
"variant",
|
|
@@ -6491,10 +6491,12 @@ function createIconButtonWithVariant(props, ref) {
|
|
|
6491
6491
|
"icon",
|
|
6492
6492
|
"disabled",
|
|
6493
6493
|
"hoverText",
|
|
6494
|
-
"hoverSide"
|
|
6494
|
+
"hoverSide",
|
|
6495
|
+
"isMobile"
|
|
6495
6496
|
]);
|
|
6496
6497
|
var color = userProvidedColor || getDefaultColorForVariant(variant);
|
|
6497
|
-
var
|
|
6498
|
+
var componentIsMobile = (0, import_react_use2.useMedia)("(max-width: 768px)");
|
|
6499
|
+
var isMob = isMobile2 !== null && isMobile2 !== void 0 ? isMobile2 : componentIsMobile;
|
|
6498
6500
|
var Comp = asChild ? import_react_slot2.Slot : "button";
|
|
6499
6501
|
var iconCls = cn(iconSizeVariants[size], iconClassName);
|
|
6500
6502
|
var disable = disabled || loading;
|
|
@@ -6503,7 +6505,7 @@ function createIconButtonWithVariant(props, ref) {
|
|
|
6503
6505
|
size: "md",
|
|
6504
6506
|
description: hoverText,
|
|
6505
6507
|
side: hoverSide,
|
|
6506
|
-
disabled:
|
|
6508
|
+
disabled: isMob,
|
|
6507
6509
|
children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Comp, _object_spread_props(_object_spread({
|
|
6508
6510
|
className: cn(iconButtonVariants({
|
|
6509
6511
|
variant: variant,
|
|
@@ -7842,7 +7844,7 @@ function useNativeBridge() {
|
|
|
7842
7844
|
var import_react_use5 = require("react-use");
|
|
7843
7845
|
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
7844
7846
|
function Link(_param) {
|
|
7845
|
-
var className = _param.className, href = _param.href, _param_scroll = _param.scroll, scroll = _param_scroll === void 0 ? false : _param_scroll, _param_replace = _param.replace, replace = _param_replace === void 0 ? false : _param_replace, _param_prefetch = _param.prefetch, prefetch = _param_prefetch === void 0 ? true : _param_prefetch, _param_back = _param.back, back = _param_back === void 0 ? false : _param_back, children = _param.children, onClick = _param.onClick, props = _object_without_properties(_param, [
|
|
7847
|
+
var className = _param.className, href = _param.href, _param_scroll = _param.scroll, scroll = _param_scroll === void 0 ? false : _param_scroll, _param_replace = _param.replace, replace = _param_replace === void 0 ? false : _param_replace, _param_prefetch = _param.prefetch, prefetch = _param_prefetch === void 0 ? true : _param_prefetch, _param_back = _param.back, back = _param_back === void 0 ? false : _param_back, children = _param.children, isMobile2 = _param.isMobile, onClick = _param.onClick, props = _object_without_properties(_param, [
|
|
7846
7848
|
"className",
|
|
7847
7849
|
"href",
|
|
7848
7850
|
"scroll",
|
|
@@ -7850,18 +7852,20 @@ function Link(_param) {
|
|
|
7850
7852
|
"prefetch",
|
|
7851
7853
|
"back",
|
|
7852
7854
|
"children",
|
|
7855
|
+
"isMobile",
|
|
7853
7856
|
"onClick"
|
|
7854
7857
|
]);
|
|
7855
7858
|
var path = typeof href === "string" ? href : "".concat(href.pathname);
|
|
7856
7859
|
var externalLink = /^(https?:\/\/)/.test(path);
|
|
7857
7860
|
var _useNativeBridge = useNativeBridge(), getIosUrl = _useNativeBridge.getIosUrl, nativeGoBack = _useNativeBridge.nativeGoBack;
|
|
7858
7861
|
var isIos = isClient() && isIosApp();
|
|
7859
|
-
var
|
|
7862
|
+
var componentIsMobile = (0, import_react_use5.useMedia)("(max-width: 768px)");
|
|
7863
|
+
var isMob = isMobile2 !== null && isMobile2 !== void 0 ? isMobile2 : componentIsMobile;
|
|
7860
7864
|
var pathname = (0, import_react9.useMemo)(function() {
|
|
7861
7865
|
if (externalLink) return path;
|
|
7862
7866
|
var formatPath = path;
|
|
7863
7867
|
var isMobPath = path.startsWith("/m/");
|
|
7864
|
-
if (
|
|
7868
|
+
if (isMob) {
|
|
7865
7869
|
formatPath = isMobPath ? path : "/m".concat(path);
|
|
7866
7870
|
} else {
|
|
7867
7871
|
formatPath = isMobPath ? path.slice(2) : path;
|
|
@@ -8572,11 +8576,13 @@ var ModalRoot = function(_param) {
|
|
|
8572
8576
|
}));
|
|
8573
8577
|
};
|
|
8574
8578
|
var ModalTitle = React26.forwardRef(function(_param, ref) {
|
|
8575
|
-
var className = _param.className, props = _object_without_properties(_param, [
|
|
8576
|
-
"className"
|
|
8579
|
+
var className = _param.className, isMobile2 = _param.isMobile, props = _object_without_properties(_param, [
|
|
8580
|
+
"className",
|
|
8581
|
+
"isMobile"
|
|
8577
8582
|
]);
|
|
8578
|
-
var
|
|
8579
|
-
|
|
8583
|
+
var componentIsMobile = (0, import_react_use6.useMedia)("(max-width: 768px)");
|
|
8584
|
+
var isMob = isMobile2 !== null && isMobile2 !== void 0 ? isMobile2 : componentIsMobile;
|
|
8585
|
+
if (isMob) {
|
|
8580
8586
|
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_vaul2.Drawer.Title, _object_spread_props(_object_spread({
|
|
8581
8587
|
ref: ref
|
|
8582
8588
|
}, props), {
|
|
@@ -11498,8 +11504,9 @@ var ArrowLeftIcon = React31.forwardRef(function(props, ref) {
|
|
|
11498
11504
|
// src/components/top-navigation-bar.tsx
|
|
11499
11505
|
var import_jsx_runtime44 = require("react/jsx-runtime");
|
|
11500
11506
|
function TopNavigationBar(param) {
|
|
11501
|
-
var searchElement = param.searchElement, title = param.title, border = param.border, backUrl = param.backUrl, children = param.children, _param_hasBackground = param.hasBackground, hasBackground = _param_hasBackground === void 0 ? false : _param_hasBackground, avatar = param.avatar, onBack = param.onBack, _param_pageType = param.pageType, pageType = _param_pageType === void 0 ? 2 : _param_pageType, className = param.className;
|
|
11502
|
-
var
|
|
11507
|
+
var searchElement = param.searchElement, title = param.title, border = param.border, backUrl = param.backUrl, children = param.children, _param_hasBackground = param.hasBackground, hasBackground = _param_hasBackground === void 0 ? false : _param_hasBackground, avatar = param.avatar, onBack = param.onBack, _param_pageType = param.pageType, pageType = _param_pageType === void 0 ? 2 : _param_pageType, className = param.className, isMobile2 = param.isMobile;
|
|
11508
|
+
var componentIsMobile = (0, import_react_use7.useMedia)("(max-width: 768px)");
|
|
11509
|
+
var isMob = isMobile2 !== null && isMobile2 !== void 0 ? isMobile2 : componentIsMobile;
|
|
11503
11510
|
var navbarRef = (0, import_react14.useRef)(null);
|
|
11504
11511
|
var _ref = _sliced_to_array((0, import_react14.useState)(hasBackground), 2), showBackground = _ref[0], setShowBackground = _ref[1];
|
|
11505
11512
|
(0, import_react14.useEffect)(function() {
|
|
@@ -11522,7 +11529,7 @@ function TopNavigationBar(param) {
|
|
|
11522
11529
|
]);
|
|
11523
11530
|
return /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", {
|
|
11524
11531
|
ref: navbarRef,
|
|
11525
|
-
className: cn("w-full flex flex-col md:flex-row justify-center items-center px-4 md:px-6", !
|
|
11532
|
+
className: cn("w-full flex flex-col md:flex-row justify-center items-center px-4 md:px-6", !isMob && border && "border-b border-Colors-Border-Default", showBackground ? "bg-Colors-Background-Normal-Primary-Default" : "bg-cc-Button-Plain-bg-default md:bg-Colors-Background-Normal-Primary-Default", className),
|
|
11526
11533
|
children: [
|
|
11527
11534
|
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", {
|
|
11528
11535
|
className: cn("relative w-full flex justify-between items-center h-13 md:h-15", searchElement && "pt-5 pb-1.5 md:pt-2 md:pb-2"),
|
|
@@ -11549,20 +11556,20 @@ function TopNavigationBar(param) {
|
|
|
11549
11556
|
icon: ArrowLeftIcon,
|
|
11550
11557
|
onClick: onBack
|
|
11551
11558
|
}),
|
|
11552
|
-
!
|
|
11559
|
+
!isMob && title && /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(Separator, {
|
|
11553
11560
|
orientation: "vertical",
|
|
11554
11561
|
className: "h-5 ml-1.5 mr-3"
|
|
11555
11562
|
})
|
|
11556
11563
|
]
|
|
11557
11564
|
}),
|
|
11558
|
-
title && (!(avatar === null || avatar === void 0 ? void 0 : avatar.logo) || !
|
|
11565
|
+
title && (!(avatar === null || avatar === void 0 ? void 0 : avatar.logo) || !isMob) && (pageType === 1 || !isMob) && /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(Display, {
|
|
11559
11566
|
size: "sm",
|
|
11560
11567
|
className: "line-clamp-1 text-xl",
|
|
11561
11568
|
children: title
|
|
11562
11569
|
})
|
|
11563
11570
|
]
|
|
11564
11571
|
}),
|
|
11565
|
-
pageType === 2 &&
|
|
11572
|
+
pageType === 2 && isMob && !(avatar === null || avatar === void 0 ? void 0 : avatar.logo) && !searchElement && /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", {
|
|
11566
11573
|
className: "absolute left-1/2 top-1/2 transform -translate-x-1/2 -translate-y-1/2 z-10",
|
|
11567
11574
|
children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(Display, {
|
|
11568
11575
|
size: "sm",
|
|
@@ -11579,7 +11586,7 @@ function TopNavigationBar(param) {
|
|
|
11579
11586
|
size: "sm",
|
|
11580
11587
|
src: avatar.logo
|
|
11581
11588
|
}),
|
|
11582
|
-
avatar.name && !
|
|
11589
|
+
avatar.name && !isMob && /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(Text, {
|
|
11583
11590
|
size: "lg",
|
|
11584
11591
|
weight: "medium",
|
|
11585
11592
|
children: avatar.name
|
|
@@ -11588,18 +11595,18 @@ function TopNavigationBar(param) {
|
|
|
11588
11595
|
})
|
|
11589
11596
|
}) : null,
|
|
11590
11597
|
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", {
|
|
11591
|
-
className: cn("flex justify-end items-center", pageType === 2 &&
|
|
11598
|
+
className: cn("flex justify-end items-center", pageType === 2 && isMob && searchElement && "w-full"),
|
|
11592
11599
|
children: /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", {
|
|
11593
11600
|
className: "w-full md:w-auto flex items-center space-x-3",
|
|
11594
11601
|
children: [
|
|
11595
|
-
searchElement && (!
|
|
11602
|
+
searchElement && (!isMob && pageType === 1 || pageType === 2) && searchElement,
|
|
11596
11603
|
children
|
|
11597
11604
|
]
|
|
11598
11605
|
})
|
|
11599
11606
|
})
|
|
11600
11607
|
]
|
|
11601
11608
|
}),
|
|
11602
|
-
searchElement && pageType === 1 &&
|
|
11609
|
+
searchElement && pageType === 1 && isMob && /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", {
|
|
11603
11610
|
className: "relative w-full h-13 py-2",
|
|
11604
11611
|
children: searchElement
|
|
11605
11612
|
})
|