@bubo-squared/ui-framework 0.2.22 → 0.2.24

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 CHANGED
@@ -148,6 +148,10 @@ var buttonVariants = (0, import_class_variance_authority.cva)(
148
148
  destructive: [
149
149
  "btn-destructive",
150
150
  "focus-ring-error"
151
+ ],
152
+ "destructive-outline": [
153
+ "btn-destructive-outline",
154
+ "focus-ring-error-outline"
151
155
  ]
152
156
  },
153
157
  size: {
@@ -1652,13 +1656,13 @@ var inputShellVariants = (0, import_class_variance_authority13.cva)(
1652
1656
  }
1653
1657
  },
1654
1658
  defaultVariants: {
1655
- size: "lg",
1659
+ size: "md",
1656
1660
  status: "default"
1657
1661
  }
1658
1662
  }
1659
1663
  );
1660
1664
  var InputShell = React21.forwardRef(
1661
- ({ size, status, disabled, className, ...rest }, ref) => {
1665
+ ({ size = "md", status, disabled, className, ...rest }, ref) => {
1662
1666
  return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
1663
1667
  "div",
1664
1668
  {
@@ -1761,7 +1765,7 @@ var Autocomplete = React23.forwardRef((props, forwardedRef) => {
1761
1765
  hint,
1762
1766
  hideHint,
1763
1767
  status = "default",
1764
- size = "lg",
1768
+ size = "md",
1765
1769
  disabled,
1766
1770
  className,
1767
1771
  leadingIcon,
@@ -2032,7 +2036,7 @@ var import_class_variance_authority15 = require("class-variance-authority");
2032
2036
  var import_icons8 = require("@bubo-squared/icons");
2033
2037
  var import_jsx_runtime26 = require("react/jsx-runtime");
2034
2038
  var selectTriggerVariants = (0, import_class_variance_authority15.cva)(
2035
- "group flex w-full items-center justify-between rounded-4 border bg-(--background-primary) p-2 text-left transition-colors cursor-pointer focus-ring-primary focus:border-(--border-brand) hover:bg-(--background-primary-hover) disabled:bg-(--background-primary) disabled:border-(--border-secondary-disabled) disabled:text-primary-disabled disabled:cursor-default",
2039
+ "group flex w-full items-center justify-between rounded-4 border bg-(--background-primary) p-2 text-left transition-[background-color] cursor-pointer hover:bg-(--background-primary-hover) disabled:bg-(--background-primary-disabled) disabled:text-primary-disabled disabled:cursor-default",
2036
2040
  {
2037
2041
  variants: {
2038
2042
  size: {
@@ -2042,13 +2046,13 @@ var selectTriggerVariants = (0, import_class_variance_authority15.cva)(
2042
2046
  xl: "h-14"
2043
2047
  },
2044
2048
  status: {
2045
- default: "border-(--border-secondary)",
2046
- success: "border-(--border-success)",
2047
- error: "border-(--border-error)"
2049
+ default: "input-default",
2050
+ success: "input-success",
2051
+ error: "input-error"
2048
2052
  }
2049
2053
  },
2050
2054
  defaultVariants: {
2051
- size: "lg",
2055
+ size: "md",
2052
2056
  status: "default"
2053
2057
  }
2054
2058
  }
@@ -2070,7 +2074,7 @@ var textVariants = (0, import_class_variance_authority15.cva)("truncate", {
2070
2074
  }
2071
2075
  },
2072
2076
  defaultVariants: {
2073
- size: "lg",
2077
+ size: "md",
2074
2078
  hasValue: false
2075
2079
  }
2076
2080
  });
@@ -2088,7 +2092,7 @@ var selectIconVariants = (0, import_class_variance_authority15.cva)("flex items-
2088
2092
  }
2089
2093
  },
2090
2094
  defaultVariants: {
2091
- size: "lg",
2095
+ size: "md",
2092
2096
  disabled: false
2093
2097
  }
2094
2098
  });
@@ -2112,7 +2116,7 @@ var Select = React24.forwardRef((props, forwardedRef) => {
2112
2116
  hideHint = false,
2113
2117
  name,
2114
2118
  placeholder = "Placeholder text",
2115
- size = "lg",
2119
+ size = "md",
2116
2120
  status = "default",
2117
2121
  disabled,
2118
2122
  options,
@@ -2184,6 +2188,7 @@ var Select = React24.forwardRef((props, forwardedRef) => {
2184
2188
  type: "button",
2185
2189
  "aria-haspopup": "listbox",
2186
2190
  "aria-expanded": isOpen,
2191
+ "aria-disabled": disabled || void 0,
2187
2192
  disabled,
2188
2193
  className: cn(
2189
2194
  selectTriggerVariants({ size, status }),
@@ -2277,7 +2282,7 @@ var passwordTextVariants = (0, import_class_variance_authority16.cva)("truncate"
2277
2282
  }
2278
2283
  },
2279
2284
  defaultVariants: {
2280
- size: "lg",
2285
+ size: "md",
2281
2286
  disabled: false
2282
2287
  }
2283
2288
  });
@@ -2325,7 +2330,7 @@ var PasswordInput = React25.forwardRef((props, forwardedRef) => {
2325
2330
  hint,
2326
2331
  hideHint,
2327
2332
  placeholder = "\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022",
2328
- size = "lg",
2333
+ size = "md",
2329
2334
  status = "default",
2330
2335
  variant = "icon",
2331
2336
  disabled,
@@ -2833,7 +2838,7 @@ var inputTextVariants2 = (0, import_class_variance_authority18.cva)("", {
2833
2838
  }
2834
2839
  },
2835
2840
  defaultVariants: {
2836
- size: "lg"
2841
+ size: "md"
2837
2842
  }
2838
2843
  });
2839
2844
  var dropdownWidthVariants = (0, import_class_variance_authority18.cva)("", {
@@ -2846,7 +2851,7 @@ var dropdownWidthVariants = (0, import_class_variance_authority18.cva)("", {
2846
2851
  }
2847
2852
  },
2848
2853
  defaultVariants: {
2849
- size: "lg"
2854
+ size: "md"
2850
2855
  }
2851
2856
  });
2852
2857
  var wrapperStatusClass = {
@@ -2866,12 +2871,12 @@ var countryOptionVariants = (0, import_class_variance_authority18.cva)(
2866
2871
  }
2867
2872
  },
2868
2873
  defaultVariants: {
2869
- size: "lg"
2874
+ size: "md"
2870
2875
  }
2871
2876
  }
2872
2877
  );
2873
2878
  var PhoneInput = React31.forwardRef(
2874
- (props, ref) => {
2879
+ (props, forwardedRef) => {
2875
2880
  const {
2876
2881
  className,
2877
2882
  onChange,
@@ -2880,11 +2885,16 @@ var PhoneInput = React31.forwardRef(
2880
2885
  hint,
2881
2886
  hideHint,
2882
2887
  placeholder,
2883
- size = "lg",
2888
+ size = "md",
2884
2889
  disabled = false,
2885
2890
  status = "default",
2886
2891
  ...rest
2887
2892
  } = props;
2893
+ const wrapperRef = React31.useRef(null);
2894
+ const focusNumberInput = React31.useCallback(() => {
2895
+ const el = wrapperRef.current?.querySelector("input");
2896
+ el?.focus();
2897
+ }, []);
2888
2898
  return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
2889
2899
  Field,
2890
2900
  {
@@ -2894,16 +2904,29 @@ var PhoneInput = React31.forwardRef(
2894
2904
  status,
2895
2905
  disabled,
2896
2906
  className,
2897
- children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: cn("w-full", wrapperStatusClass[status]), children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
2907
+ children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { ref: wrapperRef, className: cn("w-full", wrapperStatusClass[status]), children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
2898
2908
  RPNInput.default,
2899
2909
  {
2900
- ref,
2910
+ ref: forwardedRef,
2901
2911
  className: cn(
2902
2912
  sizeBase({ size }),
2903
2913
  inputTextVariants2({ size, disabled })
2904
2914
  ),
2905
2915
  flagComponent: FlagComponent,
2906
- countrySelectComponent: (countrySelectProps) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(CountrySelect, { ...countrySelectProps, size }),
2916
+ countrySelectComponent: (countrySelectProps) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
2917
+ CountrySelect,
2918
+ {
2919
+ ...countrySelectProps,
2920
+ size,
2921
+ onAfterSelect: () => {
2922
+ requestAnimationFrame(() => {
2923
+ requestAnimationFrame(() => {
2924
+ focusNumberInput();
2925
+ });
2926
+ });
2927
+ }
2928
+ }
2929
+ ),
2907
2930
  inputComponent: InputComponent,
2908
2931
  smartCaret: false,
2909
2932
  value: value || void 0,
@@ -2938,7 +2961,8 @@ var CountrySelect = ({
2938
2961
  value: selectedCountry,
2939
2962
  options: countryList,
2940
2963
  onChange,
2941
- size = "lg"
2964
+ size = "md",
2965
+ onAfterSelect
2942
2966
  }) => {
2943
2967
  const scrollAreaRef = React31.useRef(null);
2944
2968
  const [searchValue, setSearchValue] = React31.useState("");
@@ -3022,7 +3046,10 @@ var CountrySelect = ({
3022
3046
  countryName: label,
3023
3047
  selectedCountry,
3024
3048
  onChange,
3025
- onSelectComplete: () => setIsOpen(false),
3049
+ onSelectComplete: () => {
3050
+ setIsOpen(false);
3051
+ onAfterSelect?.();
3052
+ },
3026
3053
  size
3027
3054
  },
3028
3055
  value
@@ -3043,7 +3070,7 @@ var CountrySelectOption = (props) => {
3043
3070
  selectedCountry,
3044
3071
  onChange,
3045
3072
  onSelectComplete,
3046
- size = "lg"
3073
+ size = "md"
3047
3074
  } = props;
3048
3075
  const handleSelect = () => {
3049
3076
  onChange(country);
@@ -3206,7 +3233,7 @@ var searchTextVariants = (0, import_class_variance_authority19.cva)("truncate",
3206
3233
  }
3207
3234
  },
3208
3235
  defaultVariants: {
3209
- size: "lg"
3236
+ size: "md"
3210
3237
  }
3211
3238
  });
3212
3239
  var iconWrapperVariants3 = (0, import_class_variance_authority19.cva)("flex items-center justify-center shrink-0 text-(--icon-primary)", {
@@ -3222,13 +3249,13 @@ var iconWrapperVariants3 = (0, import_class_variance_authority19.cva)("flex item
3222
3249
  }
3223
3250
  },
3224
3251
  defaultVariants: {
3225
- size: "lg"
3252
+ size: "md"
3226
3253
  }
3227
3254
  });
3228
3255
  var SearchInput = React33.forwardRef((props, forwardedRef) => {
3229
3256
  const {
3230
3257
  placeholder = "Search...",
3231
- size = "lg",
3258
+ size = "md",
3232
3259
  disabled,
3233
3260
  className,
3234
3261
  leadingIcon,
@@ -3289,10 +3316,21 @@ SearchInput.displayName = "SearchInput";
3289
3316
  var React35 = __toESM(require("react"), 1);
3290
3317
 
3291
3318
  // src/components/Feedback/Tooltip.tsx
3292
- var React34 = require("react");
3319
+ var React34 = __toESM(require("react"), 1);
3293
3320
  var TooltipPrimitive = __toESM(require("@radix-ui/react-tooltip"), 1);
3294
3321
  var import_jsx_runtime36 = require("react/jsx-runtime");
3295
3322
  var TooltipArrow = TooltipPrimitive.Arrow;
3323
+ var REACT_FORWARD_REF_TYPE = /* @__PURE__ */ Symbol.for("react.forward_ref");
3324
+ var REACT_MEMO_TYPE = /* @__PURE__ */ Symbol.for("react.memo");
3325
+ var canAcceptRef = (child) => {
3326
+ const type = child.type;
3327
+ if (typeof child.type === "string") return true;
3328
+ if (type?.$$typeof === REACT_FORWARD_REF_TYPE) return true;
3329
+ if (type?.$$typeof === REACT_MEMO_TYPE && type.type?.$$typeof === REACT_FORWARD_REF_TYPE) {
3330
+ return true;
3331
+ }
3332
+ return false;
3333
+ };
3296
3334
  var mapPlacementToSideAndAlign = (placement) => {
3297
3335
  switch (placement) {
3298
3336
  case "top":
@@ -3339,6 +3377,7 @@ var Tooltip = (props) => {
3339
3377
  children,
3340
3378
  delayDuration = 200
3341
3379
  } = props;
3380
+ const trigger = React34.isValidElement(children) && canAcceptRef(children) ? children : /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: "inline-flex", tabIndex: 0, children });
3342
3381
  const hasStrapline = typeof strapline === "string" ? strapline.trim() !== "" : strapline != null;
3343
3382
  const hasDescription = typeof description === "string" ? description.trim() !== "" : description != null;
3344
3383
  const { side, align } = mapPlacementToSideAndAlign(placement);
@@ -3353,7 +3392,7 @@ var Tooltip = (props) => {
3353
3392
  disableHoverableContent,
3354
3393
  delayDuration,
3355
3394
  children: [
3356
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(TooltipPrimitive.Trigger, { asChild: true, children }),
3395
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(TooltipPrimitive.Trigger, { asChild: true, children: trigger }),
3357
3396
  /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(TooltipPrimitive.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
3358
3397
  TooltipPrimitive.Content,
3359
3398
  {
@@ -3612,15 +3651,27 @@ var Slider = React35.forwardRef((props, forwardedRef) => {
3612
3651
  }
3613
3652
  return rounded.toFixed(2);
3614
3653
  };
3615
- const formatDisplayValue = (val) => {
3654
+ const formatFallbackText = (val) => {
3616
3655
  const value2 = val ?? min;
3617
- if (tooltipFormatter) return tooltipFormatter(value2);
3618
3656
  if (showPercentage) {
3619
3657
  const percent = valueToPercent(value2);
3620
3658
  return `${formatNumber(percent)}%`;
3621
3659
  }
3622
3660
  return formatNumber(value2);
3623
3661
  };
3662
+ const formatDisplayNode = (val) => {
3663
+ const value2 = val ?? min;
3664
+ if (tooltipFormatter) return tooltipFormatter(value2);
3665
+ return formatFallbackText(value2);
3666
+ };
3667
+ const formatAriaValueText = (val) => {
3668
+ const fallback = formatFallbackText(val);
3669
+ if (!tooltipFormatter) return fallback;
3670
+ const node = tooltipFormatter(val ?? min);
3671
+ if (typeof node === "string") return node;
3672
+ if (typeof node === "number") return String(node);
3673
+ return fallback;
3674
+ };
3624
3675
  const formatNumericLabel = () => {
3625
3676
  if (isRange && secondary !== void 0) {
3626
3677
  if (!tooltipFormatter && showPercentage && display === "numeric") {
@@ -3628,14 +3679,18 @@ var Slider = React35.forwardRef((props, forwardedRef) => {
3628
3679
  const second = formatNumber(valueToPercent(secondary));
3629
3680
  return `${first} - ${second}`;
3630
3681
  }
3631
- return `${formatDisplayValue(primary)} - ${formatDisplayValue(secondary)}`;
3682
+ return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(import_jsx_runtime37.Fragment, { children: [
3683
+ formatDisplayNode(primary),
3684
+ " - ",
3685
+ formatDisplayNode(secondary)
3686
+ ] });
3632
3687
  }
3633
- return formatDisplayValue(primary);
3688
+ return formatDisplayNode(primary);
3634
3689
  };
3635
3690
  const trackHeight = 32;
3636
3691
  const thumbWidth = 18;
3637
3692
  const thumbRadius = thumbWidth / 2;
3638
- const renderHandle = (index, percent, ariaValueText) => {
3693
+ const renderHandle = (index, percent, tooltipContent, ariaValueText) => {
3639
3694
  const val = index === 0 ? primary : secondary;
3640
3695
  const isDragging = draggingThumbIndex === index;
3641
3696
  const isTooltipVisible = showTooltip && (hoveredThumbIndex === index || draggingThumbIndex === index || focusedThumbIndex === index);
@@ -3688,7 +3743,7 @@ var Slider = React35.forwardRef((props, forwardedRef) => {
3688
3743
  return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
3689
3744
  Tooltip,
3690
3745
  {
3691
- title: ariaValueText,
3746
+ title: tooltipContent,
3692
3747
  placement: tooltipPlacement === "top" ? "top" : "bottom",
3693
3748
  offset: 8,
3694
3749
  open: isTooltipVisible,
@@ -3750,8 +3805,18 @@ var Slider = React35.forwardRef((props, forwardedRef) => {
3750
3805
  }
3751
3806
  }
3752
3807
  ),
3753
- renderHandle(0, primaryPercent, formatDisplayValue(primary)),
3754
- isRange && secondary !== void 0 && renderHandle(1, secondaryPercent, formatDisplayValue(secondary))
3808
+ renderHandle(
3809
+ 0,
3810
+ primaryPercent,
3811
+ formatDisplayNode(primary),
3812
+ formatAriaValueText(primary)
3813
+ ),
3814
+ isRange && secondary !== void 0 && renderHandle(
3815
+ 1,
3816
+ secondaryPercent,
3817
+ formatDisplayNode(secondary),
3818
+ formatAriaValueText(secondary)
3819
+ )
3755
3820
  ]
3756
3821
  }
3757
3822
  ) }),
@@ -3969,7 +4034,7 @@ var inputTextVariants3 = (0, import_class_variance_authority20.cva)("truncate",
3969
4034
  }
3970
4035
  },
3971
4036
  defaultVariants: {
3972
- size: "lg"
4037
+ size: "md"
3973
4038
  }
3974
4039
  });
3975
4040
  var iconWrapperVariants4 = (0, import_class_variance_authority20.cva)(
@@ -3987,7 +4052,7 @@ var iconWrapperVariants4 = (0, import_class_variance_authority20.cva)(
3987
4052
  }
3988
4053
  },
3989
4054
  defaultVariants: {
3990
- size: "lg"
4055
+ size: "md"
3991
4056
  }
3992
4057
  }
3993
4058
  );
@@ -3997,7 +4062,7 @@ var TextInput = React37.forwardRef((props, forwardedRef) => {
3997
4062
  hint,
3998
4063
  hideHint,
3999
4064
  placeholder = "Placeholder text",
4000
- size = "lg",
4065
+ size = "md",
4001
4066
  status = "default",
4002
4067
  disabled = false,
4003
4068
  className,
@@ -4199,7 +4264,7 @@ var WebsiteInput = React39.forwardRef((props, forwardedRef) => {
4199
4264
  hierarchy = "leading",
4200
4265
  protocolLabel = "http://",
4201
4266
  icon,
4202
- size = "lg",
4267
+ size = "md",
4203
4268
  disabled,
4204
4269
  className,
4205
4270
  ...rest