myshell-react-lib 0.2.0 → 0.2.2

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.d.cts CHANGED
@@ -1026,13 +1026,17 @@ interface ISelectProps extends SelectPrimitive.SelectProps {
1026
1026
  }>;
1027
1027
  placeholder?: React$1.ReactNode;
1028
1028
  triggerClassName?: string;
1029
+ contentClassName?: string;
1030
+ variant?: 'input' | 'button';
1029
1031
  noPortal?: boolean;
1030
1032
  side?: SelectPrimitive.SelectContentProps['side'];
1031
1033
  }
1032
1034
  declare const Select: React$1.ForwardRefExoticComponent<ISelectProps & React$1.RefAttributes<never>>;
1033
1035
  declare const SelectGroup: React$1.ForwardRefExoticComponent<SelectPrimitive.SelectGroupProps & React$1.RefAttributes<HTMLDivElement>>;
1034
1036
  declare const SelectValue: React$1.ForwardRefExoticComponent<SelectPrimitive.SelectValueProps & React$1.RefAttributes<HTMLSpanElement>>;
1035
- declare const SelectTrigger: React$1.ForwardRefExoticComponent<Omit<SelectPrimitive.SelectTriggerProps & React$1.RefAttributes<HTMLButtonElement>, "ref"> & React$1.RefAttributes<HTMLButtonElement>>;
1037
+ declare const SelectTrigger: React$1.ForwardRefExoticComponent<Omit<SelectPrimitive.SelectTriggerProps & React$1.RefAttributes<HTMLButtonElement>, "ref"> & {
1038
+ isButtonVariant?: boolean;
1039
+ } & React$1.RefAttributes<HTMLButtonElement>>;
1036
1040
  declare const SelectScrollUpButton: React$1.ForwardRefExoticComponent<Omit<SelectPrimitive.SelectScrollUpButtonProps & React$1.RefAttributes<HTMLDivElement>, "ref"> & React$1.RefAttributes<HTMLDivElement>>;
1037
1041
  declare const SelectScrollDownButton: React$1.ForwardRefExoticComponent<Omit<SelectPrimitive.SelectScrollDownButtonProps & React$1.RefAttributes<HTMLDivElement>, "ref"> & React$1.RefAttributes<HTMLDivElement>>;
1038
1042
  declare const SelectContent: React$1.ForwardRefExoticComponent<Omit<SelectPrimitive.SelectContentProps & React$1.RefAttributes<HTMLDivElement>, "ref"> & {
package/dist/index.d.ts CHANGED
@@ -1026,13 +1026,17 @@ interface ISelectProps extends SelectPrimitive.SelectProps {
1026
1026
  }>;
1027
1027
  placeholder?: React$1.ReactNode;
1028
1028
  triggerClassName?: string;
1029
+ contentClassName?: string;
1030
+ variant?: 'input' | 'button';
1029
1031
  noPortal?: boolean;
1030
1032
  side?: SelectPrimitive.SelectContentProps['side'];
1031
1033
  }
1032
1034
  declare const Select: React$1.ForwardRefExoticComponent<ISelectProps & React$1.RefAttributes<never>>;
1033
1035
  declare const SelectGroup: React$1.ForwardRefExoticComponent<SelectPrimitive.SelectGroupProps & React$1.RefAttributes<HTMLDivElement>>;
1034
1036
  declare const SelectValue: React$1.ForwardRefExoticComponent<SelectPrimitive.SelectValueProps & React$1.RefAttributes<HTMLSpanElement>>;
1035
- declare const SelectTrigger: React$1.ForwardRefExoticComponent<Omit<SelectPrimitive.SelectTriggerProps & React$1.RefAttributes<HTMLButtonElement>, "ref"> & React$1.RefAttributes<HTMLButtonElement>>;
1037
+ declare const SelectTrigger: React$1.ForwardRefExoticComponent<Omit<SelectPrimitive.SelectTriggerProps & React$1.RefAttributes<HTMLButtonElement>, "ref"> & {
1038
+ isButtonVariant?: boolean;
1039
+ } & React$1.RefAttributes<HTMLButtonElement>>;
1036
1040
  declare const SelectScrollUpButton: React$1.ForwardRefExoticComponent<Omit<SelectPrimitive.SelectScrollUpButtonProps & React$1.RefAttributes<HTMLDivElement>, "ref"> & React$1.RefAttributes<HTMLDivElement>>;
1037
1041
  declare const SelectScrollDownButton: React$1.ForwardRefExoticComponent<Omit<SelectPrimitive.SelectScrollDownButtonProps & React$1.RefAttributes<HTMLDivElement>, "ref"> & React$1.RefAttributes<HTMLDivElement>>;
1038
1042
  declare const SelectContent: React$1.ForwardRefExoticComponent<Omit<SelectPrimitive.SelectContentProps & React$1.RefAttributes<HTMLDivElement>, "ref"> & {
package/dist/index.js CHANGED
@@ -6132,6 +6132,7 @@ var DropdownMenuCheckboxItem = React13.forwardRef(function(_param, ref) {
6132
6132
  checked: checked
6133
6133
  }, props), {
6134
6134
  children: [
6135
+ children,
6135
6136
  /* @__PURE__ */ jsx18("span", {
6136
6137
  className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center",
6137
6138
  children: /* @__PURE__ */ jsx18(DropdownMenuPrimitive.ItemIndicator, {
@@ -6139,8 +6140,7 @@ var DropdownMenuCheckboxItem = React13.forwardRef(function(_param, ref) {
6139
6140
  className: "h-4 w-4"
6140
6141
  })
6141
6142
  })
6142
- }),
6143
- children
6143
+ })
6144
6144
  ]
6145
6145
  }));
6146
6146
  });
@@ -10923,12 +10923,14 @@ import { ChevronDown as ChevronDown2, ChevronUp, CheckIcon as CheckIcon2 } from
10923
10923
  import * as React33 from "react";
10924
10924
  import { Fragment as Fragment8, jsx as jsx45, jsxs as jsxs27 } from "react/jsx-runtime";
10925
10925
  var Select = React33.forwardRef(function(_param, ref) {
10926
- var children = _param.children, placeholder = _param.placeholder, options = _param.options, triggerClassName = _param.triggerClassName, side = _param.side, props = _object_without_properties(_param, [
10926
+ var children = _param.children, placeholder = _param.placeholder, options = _param.options, triggerClassName = _param.triggerClassName, contentClassName = _param.contentClassName, side = _param.side, _param_variant = _param.variant, variant = _param_variant === void 0 ? "input" : _param_variant, props = _object_without_properties(_param, [
10927
10927
  "children",
10928
10928
  "placeholder",
10929
10929
  "options",
10930
10930
  "triggerClassName",
10931
- "side"
10931
+ "contentClassName",
10932
+ "side",
10933
+ "variant"
10932
10934
  ]);
10933
10935
  var _options_find;
10934
10936
  var icon = options === null || options === void 0 ? void 0 : (_options_find = options.find(function(item) {
@@ -10938,9 +10940,10 @@ var Select = React33.forwardRef(function(_param, ref) {
10938
10940
  children: Array.isArray(options) && options.length ? /* @__PURE__ */ jsxs27(Fragment8, {
10939
10941
  children: [
10940
10942
  /* @__PURE__ */ jsx45(SelectTrigger, {
10941
- className: cn(triggerClassName),
10943
+ className: triggerClassName,
10944
+ isButtonVariant: variant === "button",
10942
10945
  children: /* @__PURE__ */ jsxs27("div", {
10943
- className: "flex items-center space-x-1.5",
10946
+ className: "flex items-center space-x-2",
10944
10947
  children: [
10945
10948
  /* @__PURE__ */ jsx45(SelectIcon, {
10946
10949
  icon: icon
@@ -10953,11 +10956,16 @@ var Select = React33.forwardRef(function(_param, ref) {
10953
10956
  }),
10954
10957
  /* @__PURE__ */ jsx45(SelectContent, {
10955
10958
  side: side,
10959
+ sideOffset: variant === "button" ? 4 : 0,
10960
+ align: "center",
10956
10961
  noPortal: true,
10962
+ className: contentClassName,
10957
10963
  children: options.map(function(item, i) {
10958
- return /* @__PURE__ */ jsx45(SelectItem, _object_spread_props(_object_spread({}, item), {
10959
- children: item.label
10960
- }), "".concat(item.value, "_").concat(i));
10964
+ return /* @__PURE__ */ jsx45(Fragment8, {
10965
+ children: item.label ? /* @__PURE__ */ jsx45(SelectItem, _object_spread_props(_object_spread({}, item), {
10966
+ children: item.label
10967
+ }), "".concat(item.value, "_").concat(i)) : /* @__PURE__ */ jsx45(SelectSeparator, {}, "".concat(item.value, "_").concat(i))
10968
+ });
10961
10969
  })
10962
10970
  })
10963
10971
  ]
@@ -10967,13 +10975,17 @@ var Select = React33.forwardRef(function(_param, ref) {
10967
10975
  var SelectGroup = SelectPrimitive.Group;
10968
10976
  var SelectValue = SelectPrimitive.Value;
10969
10977
  var SelectTrigger = React33.forwardRef(function(_param, ref) {
10970
- var className = _param.className, children = _param.children, props = _object_without_properties(_param, [
10978
+ var className = _param.className, children = _param.children, isButtonVariant = _param.isButtonVariant, props = _object_without_properties(_param, [
10971
10979
  "className",
10972
- "children"
10980
+ "children",
10981
+ "isButtonVariant"
10973
10982
  ]);
10974
10983
  return /* @__PURE__ */ jsxs27(SelectPrimitive.Trigger, _object_spread_props(_object_spread({
10975
10984
  ref: ref,
10976
- className: cn("flex h-7 md:h-10 w-full items-center justify-between rounded-sm border border-transparent hover:border-cc-Input-border-default bg-cc-Input-bg-default text-Colors-Text-Default text-sm p-3 focus:shadow-cc-Focus-Rings-Brand-default placeholder:text-Colors-Text-Subtlest focus:outline-none focus:ring-0 focus:ring-offset-0 disabled:cursor-not-allowed disabled:opacity-30 [&>span]:line-clamp-1 [&>.select-chevron]:aria-expanded:rotate-180 space-x-1.5", className)
10985
+ className: cn("flex h-7 md:h-10 w-full items-center justify-between rounded-sm border border-transparent hover:border-cc-Input-border-default bg-cc-Input-bg-default text-Colors-Text-Default text-sm p-3 focus:shadow-cc-Focus-Rings-Brand-default placeholder:text-Colors-Text-Subtlest focus:outline-none focus:ring-0 focus:ring-offset-0 disabled:cursor-not-allowed disabled:opacity-30 [&>span]:line-clamp-1 [&>.select-chevron]:aria-expanded:rotate-180 space-x-1.5", isButtonVariant && buttonVariants({
10986
+ variant: "solid",
10987
+ size: "lg"
10988
+ }), isButtonVariant && "w-auto min-w-max inline-flex", className)
10977
10989
  }, props), {
10978
10990
  children: [
10979
10991
  children,
@@ -11058,17 +11070,17 @@ function SelectIcon(props) {
11058
11070
  return /* @__PURE__ */ jsx45(SelectPrimitive.Icon, {
11059
11071
  children: typeof icon === "string" ? // 如果是字符串URL,作为背景图片显示
11060
11072
  /* @__PURE__ */ jsx45("div", {
11061
- className: cn("aspect-[20/20] w-5 h-5 relative bg-cover bg-no-repeat rounded-sm overflow-hidden mr-1.5", critical && "text-Colors-Text-Critical-Default"),
11073
+ className: cn("aspect-[20/20] w-5 h-5 relative bg-cover bg-no-repeat rounded-sm overflow-hidden", critical && "text-Colors-Text-Critical-Default"),
11062
11074
  style: {
11063
11075
  backgroundImage: "url('".concat(icon, "')")
11064
11076
  }
11065
11077
  }) : React33.isValidElement(icon) ? // 如果是React元素,直接渲染
11066
11078
  /* @__PURE__ */ jsx45("div", {
11067
- className: cn("mr-1.5 w-5 h-5 text-Colors-Foreground-Default", critical && "text-Colors-Foreground-Critical-Default"),
11079
+ className: cn("w-5 h-5 text-Colors-Foreground-Default flex items-center justify-center", critical && "text-Colors-Foreground-Critical-Default"),
11068
11080
  children: icon
11069
11081
  }) : // 如果是组件类型,创建元素
11070
11082
  /* @__PURE__ */ jsx45("div", {
11071
- className: cn("mr-1.5 w-5 h-5 text-Colors-Foreground-Default", critical && "text-Colors-Foreground-Critical-Default"),
11083
+ className: cn("w-5 h-5 text-Colors-Foreground-Default flex items-center justify-center", critical && "text-Colors-Foreground-Critical-Default"),
11072
11084
  children: React33.createElement(icon, {
11073
11085
  className: cn("w-5 h-5 text-Colors-Foreground-Default", critical && "text-Colors-Foreground-Critical-Default")
11074
11086
  })
@@ -11089,7 +11101,7 @@ var SelectItem = React33.forwardRef(function(_param, ref) {
11089
11101
  }, props), {
11090
11102
  children: [
11091
11103
  /* @__PURE__ */ jsxs27("span", {
11092
- className: "flex items-center grow",
11104
+ className: "flex items-center grow space-x-1.5",
11093
11105
  children: [
11094
11106
  /* @__PURE__ */ jsx45(SelectIcon, {
11095
11107
  icon: icon,
@@ -11118,7 +11130,7 @@ var SelectSeparator = React33.forwardRef(function(_param, ref) {
11118
11130
  ]);
11119
11131
  return /* @__PURE__ */ jsx45(SelectPrimitive.Separator, _object_spread({
11120
11132
  ref: ref,
11121
- className: cn("-mx-1 my-1 h-px bg-border-default", className)
11133
+ className: cn("mx-1.5 my-1 h-px bg-[var(--Colors-Border-Default)]", className)
11122
11134
  }, props));
11123
11135
  });
11124
11136
  SelectSeparator.displayName = SelectPrimitive.Separator.displayName;