myshell-react-lib 0.1.46 → 0.1.48
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.d.cts
CHANGED
|
@@ -436,6 +436,7 @@ interface IconButtonComponentProps<V extends VariantType = VariantType> extends
|
|
|
436
436
|
hoverSide?: 'top' | 'right' | 'bottom' | 'left';
|
|
437
437
|
iconClassName?: ClassNameValue;
|
|
438
438
|
size?: IconButtonSize;
|
|
439
|
+
isMobile?: boolean;
|
|
439
440
|
variant?: V;
|
|
440
441
|
color?: V extends keyof VariantColorMap ? VariantColorMap[V] : never;
|
|
441
442
|
}
|
|
@@ -568,11 +569,15 @@ interface LinkProps {
|
|
|
568
569
|
* 是否是返回link
|
|
569
570
|
*/
|
|
570
571
|
back?: boolean;
|
|
572
|
+
/**
|
|
573
|
+
* 是否是移动端
|
|
574
|
+
*/
|
|
575
|
+
isMobile?: boolean;
|
|
571
576
|
onClick?: (e: any) => void;
|
|
572
577
|
children?: React.ReactNode;
|
|
573
578
|
[key: string]: any;
|
|
574
579
|
}
|
|
575
|
-
declare function Link({ className, href, scroll, replace, prefetch, back, children, onClick, ...props }: LinkProps): react_jsx_runtime.JSX.Element;
|
|
580
|
+
declare function Link({ className, href, scroll, replace, prefetch, back, children, isMobile, onClick, ...props }: LinkProps): react_jsx_runtime.JSX.Element;
|
|
576
581
|
|
|
577
582
|
interface BreakpointColsObject {
|
|
578
583
|
default: number;
|
|
@@ -622,7 +627,9 @@ declare const MenubarShortcut: {
|
|
|
622
627
|
declare const ModalOverlay: React$1.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogOverlayProps & React$1.RefAttributes<HTMLDivElement>, "ref"> & React$1.RefAttributes<HTMLDivElement>>;
|
|
623
628
|
declare const ModalContent: React$1.ForwardRefExoticComponent<Omit<Omit<DialogPrimitive.DialogContentProps & React$1.RefAttributes<HTMLDivElement>, "ref"> & React$1.RefAttributes<HTMLDivElement>, "ref"> & React$1.RefAttributes<HTMLDivElement>>;
|
|
624
629
|
declare const ModalRoot: React$1.FC<React$1.ComponentPropsWithoutRef<typeof DialogPrimitive.Dialog>>;
|
|
625
|
-
declare const ModalTitle: React$1.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogTitleProps & React$1.RefAttributes<HTMLHeadingElement>, "ref"> &
|
|
630
|
+
declare const ModalTitle: React$1.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogTitleProps & React$1.RefAttributes<HTMLHeadingElement>, "ref"> & {
|
|
631
|
+
isMobile?: boolean;
|
|
632
|
+
} & React$1.RefAttributes<HTMLHeadingElement>>;
|
|
626
633
|
declare const modalVariants: (props?: ({
|
|
627
634
|
size?: "sm" | "md" | "lg" | null | undefined;
|
|
628
635
|
zIndex?: 99 | 9 | 999 | 9999 | null | undefined;
|
|
@@ -983,13 +990,14 @@ type ITopNavigationBar = {
|
|
|
983
990
|
* string
|
|
984
991
|
*/
|
|
985
992
|
className?: string;
|
|
993
|
+
isMobile?: boolean;
|
|
986
994
|
/**
|
|
987
995
|
* 返回按钮点击回调
|
|
988
996
|
* () => void
|
|
989
997
|
*/
|
|
990
998
|
onBack?: () => void;
|
|
991
999
|
};
|
|
992
|
-
declare function TopNavigationBar({ searchElement, title, border, backUrl, children, hasBackground, avatar, onBack, pageType, className, }: ITopNavigationBar): react_jsx_runtime.JSX.Element;
|
|
1000
|
+
declare function TopNavigationBar({ searchElement, title, border, backUrl, children, hasBackground, avatar, onBack, pageType, className, isMobile, }: ITopNavigationBar): react_jsx_runtime.JSX.Element;
|
|
993
1001
|
|
|
994
1002
|
interface ISelectProps extends SelectPrimitive.SelectProps {
|
|
995
1003
|
options?: Array<{
|
package/dist/index.d.ts
CHANGED
|
@@ -436,6 +436,7 @@ interface IconButtonComponentProps<V extends VariantType = VariantType> extends
|
|
|
436
436
|
hoverSide?: 'top' | 'right' | 'bottom' | 'left';
|
|
437
437
|
iconClassName?: ClassNameValue;
|
|
438
438
|
size?: IconButtonSize;
|
|
439
|
+
isMobile?: boolean;
|
|
439
440
|
variant?: V;
|
|
440
441
|
color?: V extends keyof VariantColorMap ? VariantColorMap[V] : never;
|
|
441
442
|
}
|
|
@@ -568,11 +569,15 @@ interface LinkProps {
|
|
|
568
569
|
* 是否是返回link
|
|
569
570
|
*/
|
|
570
571
|
back?: boolean;
|
|
572
|
+
/**
|
|
573
|
+
* 是否是移动端
|
|
574
|
+
*/
|
|
575
|
+
isMobile?: boolean;
|
|
571
576
|
onClick?: (e: any) => void;
|
|
572
577
|
children?: React.ReactNode;
|
|
573
578
|
[key: string]: any;
|
|
574
579
|
}
|
|
575
|
-
declare function Link({ className, href, scroll, replace, prefetch, back, children, onClick, ...props }: LinkProps): react_jsx_runtime.JSX.Element;
|
|
580
|
+
declare function Link({ className, href, scroll, replace, prefetch, back, children, isMobile, onClick, ...props }: LinkProps): react_jsx_runtime.JSX.Element;
|
|
576
581
|
|
|
577
582
|
interface BreakpointColsObject {
|
|
578
583
|
default: number;
|
|
@@ -622,7 +627,9 @@ declare const MenubarShortcut: {
|
|
|
622
627
|
declare const ModalOverlay: React$1.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogOverlayProps & React$1.RefAttributes<HTMLDivElement>, "ref"> & React$1.RefAttributes<HTMLDivElement>>;
|
|
623
628
|
declare const ModalContent: React$1.ForwardRefExoticComponent<Omit<Omit<DialogPrimitive.DialogContentProps & React$1.RefAttributes<HTMLDivElement>, "ref"> & React$1.RefAttributes<HTMLDivElement>, "ref"> & React$1.RefAttributes<HTMLDivElement>>;
|
|
624
629
|
declare const ModalRoot: React$1.FC<React$1.ComponentPropsWithoutRef<typeof DialogPrimitive.Dialog>>;
|
|
625
|
-
declare const ModalTitle: React$1.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogTitleProps & React$1.RefAttributes<HTMLHeadingElement>, "ref"> &
|
|
630
|
+
declare const ModalTitle: React$1.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogTitleProps & React$1.RefAttributes<HTMLHeadingElement>, "ref"> & {
|
|
631
|
+
isMobile?: boolean;
|
|
632
|
+
} & React$1.RefAttributes<HTMLHeadingElement>>;
|
|
626
633
|
declare const modalVariants: (props?: ({
|
|
627
634
|
size?: "sm" | "md" | "lg" | null | undefined;
|
|
628
635
|
zIndex?: 99 | 9 | 999 | 9999 | null | undefined;
|
|
@@ -983,13 +990,14 @@ type ITopNavigationBar = {
|
|
|
983
990
|
* string
|
|
984
991
|
*/
|
|
985
992
|
className?: string;
|
|
993
|
+
isMobile?: boolean;
|
|
986
994
|
/**
|
|
987
995
|
* 返回按钮点击回调
|
|
988
996
|
* () => void
|
|
989
997
|
*/
|
|
990
998
|
onBack?: () => void;
|
|
991
999
|
};
|
|
992
|
-
declare function TopNavigationBar({ searchElement, title, border, backUrl, children, hasBackground, avatar, onBack, pageType, className, }: ITopNavigationBar): react_jsx_runtime.JSX.Element;
|
|
1000
|
+
declare function TopNavigationBar({ searchElement, title, border, backUrl, children, hasBackground, avatar, onBack, pageType, className, isMobile, }: ITopNavigationBar): react_jsx_runtime.JSX.Element;
|
|
993
1001
|
|
|
994
1002
|
interface ISelectProps extends SelectPrimitive.SelectProps {
|
|
995
1003
|
options?: Array<{
|
package/dist/index.js
CHANGED
|
@@ -5738,7 +5738,7 @@ function getDefaultColorForVariant(variant) {
|
|
|
5738
5738
|
}
|
|
5739
5739
|
}
|
|
5740
5740
|
function createIconButtonWithVariant(props, ref) {
|
|
5741
|
-
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, [
|
|
5741
|
+
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, tmp = props.isMobile, isMobile2 = tmp === void 0 ? false : tmp, passProps = _object_without_properties(props, [
|
|
5742
5742
|
"iconClassName",
|
|
5743
5743
|
"className",
|
|
5744
5744
|
"variant",
|
|
@@ -5750,10 +5750,12 @@ function createIconButtonWithVariant(props, ref) {
|
|
|
5750
5750
|
"icon",
|
|
5751
5751
|
"disabled",
|
|
5752
5752
|
"hoverText",
|
|
5753
|
-
"hoverSide"
|
|
5753
|
+
"hoverSide",
|
|
5754
|
+
"isMobile"
|
|
5754
5755
|
]);
|
|
5755
5756
|
var color = userProvidedColor || getDefaultColorForVariant(variant);
|
|
5756
|
-
var
|
|
5757
|
+
var componentIsMobile = useMedia2("(max-width: 768px)");
|
|
5758
|
+
var isMob = isMobile2 !== null && isMobile2 !== void 0 ? isMobile2 : componentIsMobile;
|
|
5757
5759
|
var Comp = asChild ? Slot2 : "button";
|
|
5758
5760
|
var iconCls = cn(iconSizeVariants[size], iconClassName);
|
|
5759
5761
|
var disable = disabled || loading;
|
|
@@ -5762,7 +5764,7 @@ function createIconButtonWithVariant(props, ref) {
|
|
|
5762
5764
|
size: "md",
|
|
5763
5765
|
description: hoverText,
|
|
5764
5766
|
side: hoverSide,
|
|
5765
|
-
disabled:
|
|
5767
|
+
disabled: isMob,
|
|
5766
5768
|
children: /* @__PURE__ */ jsx12(Comp, _object_spread_props(_object_spread({
|
|
5767
5769
|
className: cn(iconButtonVariants({
|
|
5768
5770
|
variant: variant,
|
|
@@ -7101,7 +7103,7 @@ function useNativeBridge() {
|
|
|
7101
7103
|
import { useMedia as useMedia3 } from "react-use";
|
|
7102
7104
|
import { jsx as jsx30 } from "react/jsx-runtime";
|
|
7103
7105
|
function Link(_param) {
|
|
7104
|
-
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, [
|
|
7106
|
+
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, tmp = _param.isMobile, isMobile2 = tmp === void 0 ? false : tmp, onClick = _param.onClick, props = _object_without_properties(_param, [
|
|
7105
7107
|
"className",
|
|
7106
7108
|
"href",
|
|
7107
7109
|
"scroll",
|
|
@@ -7109,18 +7111,20 @@ function Link(_param) {
|
|
|
7109
7111
|
"prefetch",
|
|
7110
7112
|
"back",
|
|
7111
7113
|
"children",
|
|
7114
|
+
"isMobile",
|
|
7112
7115
|
"onClick"
|
|
7113
7116
|
]);
|
|
7114
7117
|
var path = typeof href === "string" ? href : "".concat(href.pathname);
|
|
7115
7118
|
var externalLink = /^(https?:\/\/)/.test(path);
|
|
7116
7119
|
var _useNativeBridge = useNativeBridge(), getIosUrl = _useNativeBridge.getIosUrl, nativeGoBack = _useNativeBridge.nativeGoBack;
|
|
7117
7120
|
var isIos = isClient() && isIosApp();
|
|
7118
|
-
var
|
|
7121
|
+
var componentIsMobile = useMedia3("(max-width: 768px)");
|
|
7122
|
+
var isMob = isMobile2 !== null && isMobile2 !== void 0 ? isMobile2 : componentIsMobile;
|
|
7119
7123
|
var pathname = useMemo3(function() {
|
|
7120
7124
|
if (externalLink) return path;
|
|
7121
7125
|
var formatPath = path;
|
|
7122
7126
|
var isMobPath = path.startsWith("/m/");
|
|
7123
|
-
if (
|
|
7127
|
+
if (isMob) {
|
|
7124
7128
|
formatPath = isMobPath ? path : "/m".concat(path);
|
|
7125
7129
|
} else {
|
|
7126
7130
|
formatPath = isMobPath ? path.slice(2) : path;
|
|
@@ -7831,11 +7835,13 @@ var ModalRoot = function(_param) {
|
|
|
7831
7835
|
}));
|
|
7832
7836
|
};
|
|
7833
7837
|
var ModalTitle = React26.forwardRef(function(_param, ref) {
|
|
7834
|
-
var className = _param.className, props = _object_without_properties(_param, [
|
|
7835
|
-
"className"
|
|
7838
|
+
var className = _param.className, isMobile2 = _param.isMobile, props = _object_without_properties(_param, [
|
|
7839
|
+
"className",
|
|
7840
|
+
"isMobile"
|
|
7836
7841
|
]);
|
|
7837
|
-
var
|
|
7838
|
-
|
|
7842
|
+
var componentIsMobile = useMedia4("(max-width: 768px)");
|
|
7843
|
+
var isMob = isMobile2 !== null && isMobile2 !== void 0 ? isMobile2 : componentIsMobile;
|
|
7844
|
+
if (isMob) {
|
|
7839
7845
|
return /* @__PURE__ */ jsx34(DrawerPrimitive2.Title, _object_spread_props(_object_spread({
|
|
7840
7846
|
ref: ref
|
|
7841
7847
|
}, props), {
|
|
@@ -10757,8 +10763,9 @@ var ArrowLeftIcon = React31.forwardRef(function(props, ref) {
|
|
|
10757
10763
|
// src/components/top-navigation-bar.tsx
|
|
10758
10764
|
import { jsx as jsx44, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
10759
10765
|
function TopNavigationBar(param) {
|
|
10760
|
-
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;
|
|
10761
|
-
var
|
|
10766
|
+
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, tmp = param.isMobile, isMobile2 = tmp === void 0 ? false : tmp;
|
|
10767
|
+
var componentIsMobile = useMedia5("(max-width: 768px)");
|
|
10768
|
+
var isMob = isMobile2 !== null && isMobile2 !== void 0 ? isMobile2 : componentIsMobile;
|
|
10762
10769
|
var navbarRef = useRef6(null);
|
|
10763
10770
|
var _useState8 = _sliced_to_array(useState8(hasBackground), 2), showBackground = _useState8[0], setShowBackground = _useState8[1];
|
|
10764
10771
|
useEffect10(function() {
|
|
@@ -10781,7 +10788,7 @@ function TopNavigationBar(param) {
|
|
|
10781
10788
|
]);
|
|
10782
10789
|
return /* @__PURE__ */ jsxs24("div", {
|
|
10783
10790
|
ref: navbarRef,
|
|
10784
|
-
className: cn("w-full flex flex-col md:flex-row justify-center items-center px-4 md:px-6", !
|
|
10791
|
+
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),
|
|
10785
10792
|
children: [
|
|
10786
10793
|
/* @__PURE__ */ jsxs24("div", {
|
|
10787
10794
|
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"),
|
|
@@ -10808,20 +10815,20 @@ function TopNavigationBar(param) {
|
|
|
10808
10815
|
icon: ArrowLeftIcon,
|
|
10809
10816
|
onClick: onBack
|
|
10810
10817
|
}),
|
|
10811
|
-
!
|
|
10818
|
+
!isMob && title && /* @__PURE__ */ jsx44(Separator, {
|
|
10812
10819
|
orientation: "vertical",
|
|
10813
10820
|
className: "h-5 ml-1.5 mr-3"
|
|
10814
10821
|
})
|
|
10815
10822
|
]
|
|
10816
10823
|
}),
|
|
10817
|
-
title && (!(avatar === null || avatar === void 0 ? void 0 : avatar.logo) || !
|
|
10824
|
+
title && (!(avatar === null || avatar === void 0 ? void 0 : avatar.logo) || !isMob) && (pageType === 1 || !isMob) && /* @__PURE__ */ jsx44(Display, {
|
|
10818
10825
|
size: "sm",
|
|
10819
10826
|
className: "line-clamp-1 text-xl",
|
|
10820
10827
|
children: title
|
|
10821
10828
|
})
|
|
10822
10829
|
]
|
|
10823
10830
|
}),
|
|
10824
|
-
pageType === 2 &&
|
|
10831
|
+
pageType === 2 && isMob && !(avatar === null || avatar === void 0 ? void 0 : avatar.logo) && !searchElement && /* @__PURE__ */ jsx44("div", {
|
|
10825
10832
|
className: "absolute left-1/2 top-1/2 transform -translate-x-1/2 -translate-y-1/2 z-10",
|
|
10826
10833
|
children: /* @__PURE__ */ jsx44(Display, {
|
|
10827
10834
|
size: "sm",
|
|
@@ -10838,7 +10845,7 @@ function TopNavigationBar(param) {
|
|
|
10838
10845
|
size: "sm",
|
|
10839
10846
|
src: avatar.logo
|
|
10840
10847
|
}),
|
|
10841
|
-
avatar.name && !
|
|
10848
|
+
avatar.name && !isMob && /* @__PURE__ */ jsx44(Text, {
|
|
10842
10849
|
size: "lg",
|
|
10843
10850
|
weight: "medium",
|
|
10844
10851
|
children: avatar.name
|
|
@@ -10847,18 +10854,18 @@ function TopNavigationBar(param) {
|
|
|
10847
10854
|
})
|
|
10848
10855
|
}) : null,
|
|
10849
10856
|
/* @__PURE__ */ jsx44("div", {
|
|
10850
|
-
className: cn("flex justify-end items-center", pageType === 2 &&
|
|
10857
|
+
className: cn("flex justify-end items-center", pageType === 2 && isMob && searchElement && "w-full"),
|
|
10851
10858
|
children: /* @__PURE__ */ jsxs24("div", {
|
|
10852
10859
|
className: "w-full md:w-auto flex items-center space-x-3",
|
|
10853
10860
|
children: [
|
|
10854
|
-
searchElement && (!
|
|
10861
|
+
searchElement && (!isMob && pageType === 1 || pageType === 2) && searchElement,
|
|
10855
10862
|
children
|
|
10856
10863
|
]
|
|
10857
10864
|
})
|
|
10858
10865
|
})
|
|
10859
10866
|
]
|
|
10860
10867
|
}),
|
|
10861
|
-
searchElement && pageType === 1 &&
|
|
10868
|
+
searchElement && pageType === 1 && isMob && /* @__PURE__ */ jsx44("div", {
|
|
10862
10869
|
className: "relative w-full h-13 py-2",
|
|
10863
10870
|
children: searchElement
|
|
10864
10871
|
})
|