@onesaz/ui 0.4.5 → 0.4.6

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.js CHANGED
@@ -870,23 +870,23 @@ var useButtonGroup = () => React6.useContext(ButtonGroupContext);
870
870
  var colorMap = {
871
871
  success: {
872
872
  contained: "bg-success-500 text-white hover:bg-success-600 dark:bg-success-600 dark:hover:bg-success-700",
873
- outline: "border border-success-500 bg-transparent text-success-600 hover:bg-success-50 dark:text-success-400 dark:hover:bg-success-950",
874
- secondary: "bg-success-50 text-success-700 hover:bg-success-100 dark:bg-success-950 dark:text-success-300 dark:hover:bg-success-900",
875
- ghost: "text-success-600 hover:bg-success-50 dark:text-success-400 dark:hover:bg-success-950",
873
+ outline: "border border-success-500 bg-transparent text-success-600 hover:bg-success-500/10 dark:text-success-400 dark:hover:bg-success-500/10",
874
+ secondary: "bg-success-500/10 text-success-700 hover:bg-success-500/15 dark:text-success-300 dark:hover:bg-success-500/15",
875
+ ghost: "text-success-600 hover:bg-success-500/10 dark:text-success-400 dark:hover:bg-success-500/10",
876
876
  link: "text-success-600 dark:text-success-400"
877
877
  },
878
878
  warning: {
879
879
  contained: "bg-warning-500 text-white hover:bg-warning-600 dark:bg-warning-600 dark:hover:bg-warning-700",
880
- outline: "border border-warning-500 bg-transparent text-warning-600 hover:bg-warning-50 dark:text-warning-400 dark:hover:bg-warning-950",
881
- secondary: "bg-warning-50 text-warning-700 hover:bg-warning-100 dark:bg-warning-950 dark:text-warning-300 dark:hover:bg-warning-900",
882
- ghost: "text-warning-600 hover:bg-warning-50 dark:text-warning-400 dark:hover:bg-warning-950",
880
+ outline: "border border-warning-500 bg-transparent text-warning-600 hover:bg-warning-500/10 dark:text-warning-400 dark:hover:bg-warning-500/10",
881
+ secondary: "bg-warning-500/10 text-warning-700 hover:bg-warning-500/15 dark:text-warning-300 dark:hover:bg-warning-500/15",
882
+ ghost: "text-warning-600 hover:bg-warning-500/10 dark:text-warning-400 dark:hover:bg-warning-500/10",
883
883
  link: "text-warning-600 dark:text-warning-400"
884
884
  },
885
885
  error: {
886
886
  contained: "bg-error-500 text-white hover:bg-error-600 dark:bg-error-600 dark:hover:bg-error-700",
887
- outline: "border border-error-500 bg-transparent text-error-600 hover:bg-error-50 dark:text-error-400 dark:hover:bg-error-950",
888
- secondary: "bg-error-50 text-error-700 hover:bg-error-100 dark:bg-error-950 dark:text-error-300 dark:hover:bg-error-900",
889
- ghost: "text-error-600 hover:bg-error-50 dark:text-error-400 dark:hover:bg-error-950",
887
+ outline: "border border-error-500 bg-transparent text-error-600 hover:bg-error-500/10 dark:text-error-400 dark:hover:bg-error-500/10",
888
+ secondary: "bg-error-500/10 text-error-700 hover:bg-error-500/15 dark:text-error-300 dark:hover:bg-error-500/15",
889
+ ghost: "text-error-600 hover:bg-error-500/10 dark:text-error-400 dark:hover:bg-error-500/10",
890
890
  link: "text-error-600 dark:text-error-400"
891
891
  },
892
892
  destructive: {
@@ -951,11 +951,11 @@ var Button = React6.forwardRef(
951
951
  const resolvedSize = size ?? "default";
952
952
  const resolvedColor = color ?? groupCtx.color ?? "default";
953
953
  const resolvedDisabled = disabled ?? groupCtx.disabled;
954
- const colorOverride = resolvedColor !== "default" ? colorMap[resolvedColor][variantToShape(resolvedVariant)] : null;
954
+ const colorOverride = resolvedColor !== "default" ? colorMap[resolvedColor]?.[variantToShape(resolvedVariant)] ?? null : null;
955
955
  const variantClasses3 = colorOverride ? null : {
956
956
  "bg-accent text-accent-foreground hover:bg-accent-hover": resolvedVariant === "default",
957
957
  "bg-destructive text-destructive-foreground hover:bg-destructive/90": resolvedVariant === "destructive",
958
- "border border-input bg-background hover:bg-muted hover:text-foreground": resolvedVariant === "outline",
958
+ "border border-accent bg-transparent text-accent hover:bg-accent/10": resolvedVariant === "outline",
959
959
  "bg-muted text-foreground hover:bg-muted/80": resolvedVariant === "secondary",
960
960
  "hover:bg-muted hover:text-foreground": resolvedVariant === "ghost",
961
961
  "text-accent underline-offset-4 hover:underline": resolvedVariant === "link"
@@ -1004,11 +1004,11 @@ var iconButtonSizes = {
1004
1004
  };
1005
1005
  var IconButton = React6.forwardRef(
1006
1006
  ({ className, variant = "ghost", color = "default", size = "md", rounded = false, loading = false, ...props }, ref) => {
1007
- const colorOverride = color !== "default" ? colorMap[color][variantToShape(variant)] : null;
1007
+ const colorOverride = color !== "default" ? colorMap[color]?.[variantToShape(variant)] ?? null : null;
1008
1008
  const variantClasses3 = colorOverride ? null : {
1009
1009
  "bg-accent text-accent-foreground hover:bg-accent-hover": variant === "default",
1010
1010
  "bg-destructive text-destructive-foreground hover:bg-destructive/90": variant === "destructive",
1011
- "border border-input bg-background hover:bg-muted hover:text-foreground": variant === "outline",
1011
+ "border border-accent bg-transparent text-accent hover:bg-accent/10": variant === "outline",
1012
1012
  "bg-muted text-foreground hover:bg-muted/80": variant === "secondary",
1013
1013
  "hover:bg-muted hover:text-foreground": variant === "ghost",
1014
1014
  "text-accent underline-offset-4 hover:underline": variant === "link"
@@ -1100,6 +1100,7 @@ var Input = React7.forwardRef(
1100
1100
  containerClassName,
1101
1101
  ...props
1102
1102
  }, ref) => {
1103
+ const safeSize = inputSize in sizeClasses ? inputSize : "md";
1103
1104
  const hasAdornment = startAdornment || endAdornment;
1104
1105
  if (hasAdornment) {
1105
1106
  return /* @__PURE__ */ jsxs2(
@@ -1126,7 +1127,7 @@ var Input = React7.forwardRef(
1126
1127
  "focus:outline-none",
1127
1128
  "disabled:cursor-not-allowed",
1128
1129
  "file:border-0 file:bg-transparent file:text-sm file:font-medium",
1129
- sizeClasses[inputSize],
1130
+ sizeClasses[safeSize],
1130
1131
  startAdornment && "pl-2",
1131
1132
  endAdornment && "pr-2",
1132
1133
  className
@@ -1153,7 +1154,7 @@ var Input = React7.forwardRef(
1153
1154
  "disabled:cursor-not-allowed disabled:opacity-50 disabled:bg-muted",
1154
1155
  "transition-colors",
1155
1156
  "file:border-0 file:bg-transparent file:text-sm file:font-medium",
1156
- sizeClasses[inputSize],
1157
+ sizeClasses[safeSize],
1157
1158
  className
1158
1159
  ),
1159
1160
  ref,
@@ -1505,6 +1506,7 @@ var indicatorSizeClasses = {
1505
1506
  var RadioGroupItem = React14.forwardRef(({ className, size: sizeProp, ...props }, ref) => {
1506
1507
  const { size: contextSize } = React14.useContext(RadioGroupContext);
1507
1508
  const size = sizeProp || contextSize || "md";
1509
+ const safeSize = size in sizeClasses2 ? size : "md";
1508
1510
  return /* @__PURE__ */ jsx14(
1509
1511
  RadioGroupPrimitive.Item,
1510
1512
  {
@@ -1517,7 +1519,7 @@ var RadioGroupItem = React14.forwardRef(({ className, size: sizeProp, ...props }
1517
1519
  "disabled:cursor-not-allowed disabled:opacity-50",
1518
1520
  "data-[state=checked]:border-accent",
1519
1521
  "transition-colors",
1520
- sizeClasses2[size],
1522
+ sizeClasses2[safeSize],
1521
1523
  className
1522
1524
  ),
1523
1525
  ...props,
@@ -1526,7 +1528,7 @@ var RadioGroupItem = React14.forwardRef(({ className, size: sizeProp, ...props }
1526
1528
  {
1527
1529
  className: cn(
1528
1530
  "rounded-full bg-accent",
1529
- indicatorSizeClasses[size]
1531
+ indicatorSizeClasses[safeSize]
1530
1532
  )
1531
1533
  }
1532
1534
  ) })
@@ -1752,7 +1754,8 @@ var Slider = React16.forwardRef(({
1752
1754
  valueElement
1753
1755
  ] })
1754
1756
  };
1755
- return /* @__PURE__ */ jsx16("div", { className: containerClasses[valuePosition], children: orderMap[valuePosition] });
1757
+ const safePosition = valuePosition in containerClasses ? valuePosition : "top";
1758
+ return /* @__PURE__ */ jsx16("div", { className: containerClasses[safePosition], children: orderMap[safePosition] });
1756
1759
  });
1757
1760
  Slider.displayName = SliderPrimitive.Root.displayName;
1758
1761
 
@@ -2043,8 +2046,10 @@ var Chip = React20.forwardRef(
2043
2046
  const content = label ?? children;
2044
2047
  const isClickable = clickable || !!onClick || !!href;
2045
2048
  const Component = component ?? (href ? "a" : "div");
2046
- const colorClass = variant === "filled" ? filledClasses[color] ?? filledClasses.default : outlinedClasses2[color] ?? outlinedClasses2.default;
2047
- const hoverClass = isClickable && !disabled ? variant === "filled" ? filledHoverClasses[color] ?? filledHoverClasses.default : outlinedHoverClasses[color] ?? outlinedHoverClasses.default : "";
2049
+ const safeSize = size in sizeClasses3 ? size : "medium";
2050
+ const safeVariant = variant === "filled" || variant === "outlined" ? variant : "filled";
2051
+ const colorClass = safeVariant === "filled" ? filledClasses[color] ?? filledClasses.default : outlinedClasses2[color] ?? outlinedClasses2.default;
2052
+ const hoverClass = isClickable && !disabled ? safeVariant === "filled" ? filledHoverClasses[color] ?? filledHoverClasses.default : outlinedHoverClasses[color] ?? outlinedHoverClasses.default : "";
2048
2053
  const handleKeyDown = (e) => {
2049
2054
  if (!disabled) {
2050
2055
  if (isClickable && (e.key === "Enter" || e.key === " ")) {
@@ -2071,8 +2076,8 @@ var Chip = React20.forwardRef(
2071
2076
  className: cn(
2072
2077
  "inline-flex items-center rounded-full font-medium transition-colors select-none",
2073
2078
  "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1",
2074
- sizeClasses3[size],
2075
- variant === "outlined" && "border bg-transparent",
2079
+ sizeClasses3[safeSize],
2080
+ safeVariant === "outlined" && "border bg-transparent",
2076
2081
  colorClass,
2077
2082
  hoverClass,
2078
2083
  isClickable && !disabled ? "cursor-pointer" : "cursor-default",
@@ -2081,8 +2086,8 @@ var Chip = React20.forwardRef(
2081
2086
  ),
2082
2087
  ...props,
2083
2088
  children: [
2084
- avatar && /* @__PURE__ */ jsx20("span", { className: cn("-ml-1 flex shrink-0 items-center justify-center [&>*]:rounded-full", avatarSizeClasses[size]), children: avatar }),
2085
- !avatar && icon && /* @__PURE__ */ jsx20("span", { className: cn("-ml-0.5 flex shrink-0 items-center justify-center", iconSizeClasses[size]), children: icon }),
2089
+ avatar && /* @__PURE__ */ jsx20("span", { className: cn("-ml-1 flex shrink-0 items-center justify-center [&>*]:rounded-full", avatarSizeClasses[safeSize]), children: avatar }),
2090
+ !avatar && icon && /* @__PURE__ */ jsx20("span", { className: cn("-ml-0.5 flex shrink-0 items-center justify-center", iconSizeClasses[safeSize]), children: icon }),
2086
2091
  /* @__PURE__ */ jsx20("span", { className: "truncate", children: content }),
2087
2092
  onDelete && /* @__PURE__ */ jsx20(
2088
2093
  "button",
@@ -2100,7 +2105,7 @@ var Chip = React20.forwardRef(
2100
2105
  ),
2101
2106
  disabled,
2102
2107
  "aria-label": "Remove",
2103
- children: deleteIcon ?? /* @__PURE__ */ jsx20(DefaultDeleteIcon, { size })
2108
+ children: deleteIcon ?? /* @__PURE__ */ jsx20(DefaultDeleteIcon, { size: safeSize })
2104
2109
  }
2105
2110
  )
2106
2111
  ]
@@ -2735,19 +2740,19 @@ var variantConfig = {
2735
2740
  iconColor: "text-accent"
2736
2741
  },
2737
2742
  success: {
2738
- root: "bg-success-50",
2743
+ root: "bg-success-500/10",
2739
2744
  strip: "bg-success-500",
2740
- iconColor: "text-success-600"
2745
+ iconColor: "text-success-600 dark:text-success-400"
2741
2746
  },
2742
2747
  warning: {
2743
- root: "bg-warning-50",
2748
+ root: "bg-warning-500/10",
2744
2749
  strip: "bg-warning-500",
2745
- iconColor: "text-warning-600"
2750
+ iconColor: "text-warning-600 dark:text-warning-400"
2746
2751
  },
2747
2752
  error: {
2748
- root: "bg-error-50",
2753
+ root: "bg-error-500/10",
2749
2754
  strip: "bg-error-500",
2750
- iconColor: "text-error-600"
2755
+ iconColor: "text-error-600 dark:text-error-400"
2751
2756
  }
2752
2757
  };
2753
2758
  var InfoIcon = () => /* @__PURE__ */ jsxs15(
@@ -3174,13 +3179,15 @@ var LinearProgress = React30.forwardRef(
3174
3179
  ...props
3175
3180
  }, ref) => {
3176
3181
  const isIndeterminate = value === void 0;
3182
+ const safeSize = size in linearSizeClasses ? size : "md";
3183
+ const safeVariant = variant in variantClasses2 ? variant : "default";
3177
3184
  return /* @__PURE__ */ jsxs18("div", { ref, className: cn("w-full", className), ...props, children: [
3178
3185
  /* @__PURE__ */ jsx30(
3179
3186
  "div",
3180
3187
  {
3181
3188
  className: cn(
3182
3189
  "w-full overflow-hidden rounded-full bg-muted",
3183
- linearSizeClasses[size]
3190
+ linearSizeClasses[safeSize]
3184
3191
  ),
3185
3192
  role: "progressbar",
3186
3193
  "aria-valuenow": isIndeterminate ? void 0 : value,
@@ -3191,7 +3198,7 @@ var LinearProgress = React30.forwardRef(
3191
3198
  {
3192
3199
  className: cn(
3193
3200
  "h-full rounded-full",
3194
- variantClasses2[variant],
3201
+ variantClasses2[safeVariant],
3195
3202
  animated && !isIndeterminate && "transition-all duration-300 ease-out",
3196
3203
  isIndeterminate && "animate-indeterminate-progress w-1/3"
3197
3204
  ),
@@ -3231,7 +3238,9 @@ var CircularProgress = React30.forwardRef(
3231
3238
  ...props
3232
3239
  }, ref) => {
3233
3240
  const isIndeterminate = value === void 0;
3234
- const sizeValue = typeof size === "number" ? size : circularSizeValues[size];
3241
+ const safeVariant = variant in strokeColors ? variant : "default";
3242
+ const safeSize = typeof size === "number" || size in circularSizeValues ? size : "md";
3243
+ const sizeValue = typeof safeSize === "number" ? safeSize : circularSizeValues[safeSize];
3235
3244
  const radius = (sizeValue - thickness) / 2;
3236
3245
  const circumference = 2 * Math.PI * radius;
3237
3246
  const strokeDashoffset = isIndeterminate ? 0 : circumference - Math.min(100, Math.max(0, value)) / 100 * circumference;
@@ -3270,7 +3279,7 @@ var CircularProgress = React30.forwardRef(
3270
3279
  "circle",
3271
3280
  {
3272
3281
  className: cn(
3273
- strokeColors[variant],
3282
+ strokeColors[safeVariant],
3274
3283
  !isIndeterminate && "transition-all duration-300 ease-out"
3275
3284
  ),
3276
3285
  fill: "none",
@@ -3931,7 +3940,7 @@ var Combobox = React35.forwardRef(
3931
3940
  (option) => {
3932
3941
  if (typeof option === "string") return option;
3933
3942
  const record = option;
3934
- const maybeLabel = record[labelKey];
3943
+ const maybeLabel = labelKey in record ? record[labelKey] : void 0;
3935
3944
  return typeof maybeLabel === "string" ? maybeLabel : String(maybeLabel ?? "");
3936
3945
  },
3937
3946
  [labelKey]
@@ -3940,7 +3949,7 @@ var Combobox = React35.forwardRef(
3940
3949
  (option) => {
3941
3950
  if (typeof option === "string") return option;
3942
3951
  const record = option;
3943
- const maybeValue = record[valueKey];
3952
+ const maybeValue = valueKey in record ? record[valueKey] : void 0;
3944
3953
  if (maybeValue !== void 0 && maybeValue !== null) {
3945
3954
  return String(maybeValue);
3946
3955
  }
@@ -8347,13 +8356,14 @@ var sizeClasses5 = {
8347
8356
  };
8348
8357
  var TopBar = React46.forwardRef(
8349
8358
  ({ className, bordered = true, sticky = false, size = "md", children, ...props }, ref) => {
8359
+ const safeSize = size in sizeClasses5 ? size : "md";
8350
8360
  return /* @__PURE__ */ jsx46(
8351
8361
  "header",
8352
8362
  {
8353
8363
  ref,
8354
8364
  className: cn(
8355
8365
  "flex items-center px-4 bg-card text-foreground",
8356
- sizeClasses5[size],
8366
+ sizeClasses5[safeSize],
8357
8367
  bordered && "border-b border-border",
8358
8368
  sticky && "sticky top-0 z-40",
8359
8369
  className