@bubo-squared/ui-framework 0.2.20 → 0.2.21

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
@@ -151,10 +151,10 @@ var buttonVariants = (0, import_class_variance_authority.cva)(
151
151
  ]
152
152
  },
153
153
  size: {
154
- sm: ["px-2", "py-1", "gap-2", "h-9"],
155
- md: ["px-2", "py-1", "gap-2", "h-10"],
156
- lg: ["px-2.5", "py-1", "gap-2.5", "h-11"],
157
- xl: ["px-3", "py-0.5", "gap-3", "h-12"]
154
+ sm: ["px-3", "py-1", "gap-2", "h-9"],
155
+ md: ["px-4", "py-2", "gap-2", "h-10"],
156
+ lg: ["px-4", "py-2", "gap-2.5", "h-11"],
157
+ xl: ["px-4", "py-2", "gap-3", "h-12"]
158
158
  }
159
159
  },
160
160
  defaultVariants: {
@@ -1583,16 +1583,17 @@ var MenuSubContent = DropdownMenuSubContent;
1583
1583
  var MenuSubTrigger = DropdownMenuSubTrigger;
1584
1584
 
1585
1585
  // src/components/Inputs/Checkbox.tsx
1586
- var React20 = require("react");
1586
+ var React20 = __toESM(require("react"), 1);
1587
1587
  var CheckboxPrimitive = __toESM(require("@radix-ui/react-checkbox"), 1);
1588
1588
  var import_icons6 = require("@bubo-squared/icons");
1589
1589
  var import_icons7 = require("@bubo-squared/icons");
1590
1590
  var import_jsx_runtime22 = require("react/jsx-runtime");
1591
- function Checkbox({ label, className, ...props }) {
1591
+ var Checkbox = React20.forwardRef(({ label, className, ...props }, forwardedRef) => {
1592
1592
  return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("label", { className: "inline-flex items-center gap-(--space-12) cursor-pointer select-none", children: [
1593
1593
  /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
1594
1594
  CheckboxPrimitive.Root,
1595
1595
  {
1596
+ ref: forwardedRef,
1596
1597
  className: cn(
1597
1598
  "group flex h-5 w-5 items-center justify-center rounded-2 border border-(--border-secondary) bg-(--background-neutral) text-primary-inverse",
1598
1599
  "data-[state=checked]:bg-(--background-brand) data-[state=checked]:text-button-white data-[state=checked]:border-none",
@@ -1614,7 +1615,8 @@ function Checkbox({ label, className, ...props }) {
1614
1615
  ),
1615
1616
  label && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "paragraph-md-medium text-primary", children: label })
1616
1617
  ] });
1617
- }
1618
+ });
1619
+ Checkbox.displayName = "Checkbox";
1618
1620
 
1619
1621
  // src/components/Inputs/Autocomplete.tsx
1620
1622
  var React23 = __toESM(require("react"), 1);
@@ -1747,7 +1749,7 @@ var iconWrapperVariants = (0, import_class_variance_authority14.cva)(
1747
1749
  }
1748
1750
  }
1749
1751
  );
1750
- var Autocomplete = (props) => {
1752
+ var Autocomplete = React23.forwardRef((props, forwardedRef) => {
1751
1753
  const {
1752
1754
  label,
1753
1755
  hint,
@@ -1788,6 +1790,18 @@ var Autocomplete = (props) => {
1788
1790
  const [isFocused, setIsFocused] = React23.useState(false);
1789
1791
  const [activeIndex, setActiveIndex] = React23.useState(-1);
1790
1792
  const inputRef = React23.useRef(null);
1793
+ const setInputRef = React23.useCallback(
1794
+ (node) => {
1795
+ inputRef.current = node;
1796
+ if (!forwardedRef) return;
1797
+ if (typeof forwardedRef === "function") {
1798
+ forwardedRef(node);
1799
+ } else {
1800
+ forwardedRef.current = node;
1801
+ }
1802
+ },
1803
+ [forwardedRef]
1804
+ );
1791
1805
  const baseId = React23.useId();
1792
1806
  const inputId = id ?? baseId;
1793
1807
  const listboxId = `${inputId}-listbox`;
@@ -1900,7 +1914,7 @@ var Autocomplete = (props) => {
1900
1914
  /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
1901
1915
  Input,
1902
1916
  {
1903
- ref: inputRef,
1917
+ ref: setInputRef,
1904
1918
  id: inputId,
1905
1919
  type: "text",
1906
1920
  disabled: disabled ?? void 0,
@@ -1975,7 +1989,7 @@ var Autocomplete = (props) => {
1975
1989
  }
1976
1990
  )
1977
1991
  ] }) });
1978
- };
1992
+ });
1979
1993
  Autocomplete.displayName = "Autocomplete";
1980
1994
 
1981
1995
  // src/components/Inputs/Select.tsx
@@ -2058,7 +2072,7 @@ var selectButtonVariants = (0, import_class_variance_authority15.cva)(
2058
2072
  }
2059
2073
  }
2060
2074
  );
2061
- var Select = (props) => {
2075
+ var Select = React24.forwardRef((props, forwardedRef) => {
2062
2076
  const {
2063
2077
  label = "Field Label",
2064
2078
  hint = "This is a hint text to help user.",
@@ -2133,6 +2147,7 @@ var Select = (props) => {
2133
2147
  /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(SelectPrimitive.Trigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
2134
2148
  "button",
2135
2149
  {
2150
+ ref: forwardedRef,
2136
2151
  type: "button",
2137
2152
  "aria-haspopup": "listbox",
2138
2153
  "aria-expanded": isOpen,
@@ -2207,7 +2222,7 @@ var Select = (props) => {
2207
2222
  )
2208
2223
  }
2209
2224
  );
2210
- };
2225
+ });
2211
2226
  Select.displayName = "Select";
2212
2227
 
2213
2228
  // src/components/Inputs/PasswordInput.tsx
@@ -2271,7 +2286,7 @@ var actionButtonVariants = (0, import_class_variance_authority16.cva)(
2271
2286
  }
2272
2287
  }
2273
2288
  );
2274
- var PasswordInput = (props) => {
2289
+ var PasswordInput = React25.forwardRef((props, forwardedRef) => {
2275
2290
  const {
2276
2291
  label,
2277
2292
  hint,
@@ -2295,6 +2310,18 @@ var PasswordInput = (props) => {
2295
2310
  const [isRevealed, setIsRevealed] = React25.useState(false);
2296
2311
  const currentValue = (isControlled ? value : internalValue) ?? "";
2297
2312
  const inputRef = React25.useRef(null);
2313
+ const setInputRef = React25.useCallback(
2314
+ (node) => {
2315
+ inputRef.current = node;
2316
+ if (!forwardedRef) return;
2317
+ if (typeof forwardedRef === "function") {
2318
+ forwardedRef(node);
2319
+ } else {
2320
+ forwardedRef.current = node;
2321
+ }
2322
+ },
2323
+ [forwardedRef]
2324
+ );
2298
2325
  const showLeadingIcon = !!leadingIcon;
2299
2326
  const handleContainerClick = () => {
2300
2327
  if (disabled) return;
@@ -2335,7 +2362,7 @@ var PasswordInput = (props) => {
2335
2362
  /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
2336
2363
  Input,
2337
2364
  {
2338
- ref: inputRef,
2365
+ ref: setInputRef,
2339
2366
  type: isRevealed ? "text" : "password",
2340
2367
  disabled: disabled ?? void 0,
2341
2368
  placeholder,
@@ -2370,7 +2397,7 @@ var PasswordInput = (props) => {
2370
2397
  )
2371
2398
  }
2372
2399
  );
2373
- };
2400
+ });
2374
2401
  PasswordInput.displayName = "PasswordInput";
2375
2402
 
2376
2403
  // src/components/Inputs/PhoneInput.tsx
@@ -3017,19 +3044,20 @@ var FlagComponent = ({ country, countryName }) => {
3017
3044
  var React32 = __toESM(require("react"), 1);
3018
3045
  var RadioGroupPrimitive = __toESM(require("@radix-ui/react-radio-group"), 1);
3019
3046
  var import_jsx_runtime34 = require("react/jsx-runtime");
3020
- var RadioGroup = ({
3021
- label,
3022
- hint,
3023
- hideHint,
3024
- options,
3025
- orientation = "vertical",
3026
- disabled = false,
3027
- value,
3028
- defaultValue,
3029
- onValueChange,
3030
- className,
3031
- ...rootProps
3032
- }) => {
3047
+ var RadioGroup = React32.forwardRef((props, forwardedRef) => {
3048
+ const {
3049
+ label,
3050
+ hint,
3051
+ hideHint,
3052
+ options,
3053
+ orientation = "vertical",
3054
+ disabled = false,
3055
+ value,
3056
+ defaultValue,
3057
+ onValueChange,
3058
+ className,
3059
+ ...rootProps
3060
+ } = props;
3033
3061
  const groupId = React32.useId();
3034
3062
  const hintId = hint ? `${groupId}-hint` : void 0;
3035
3063
  const handleValueChange = (next) => {
@@ -3046,6 +3074,7 @@ var RadioGroup = ({
3046
3074
  children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
3047
3075
  RadioGroupPrimitive.Root,
3048
3076
  {
3077
+ ref: forwardedRef,
3049
3078
  ...rootProps,
3050
3079
  value,
3051
3080
  defaultValue,
@@ -3126,7 +3155,8 @@ var RadioGroup = ({
3126
3155
  )
3127
3156
  }
3128
3157
  );
3129
- };
3158
+ });
3159
+ RadioGroup.displayName = "RadioGroup";
3130
3160
 
3131
3161
  // src/components/Inputs/SearchInput.tsx
3132
3162
  var React33 = __toESM(require("react"), 1);
@@ -3162,7 +3192,7 @@ var iconWrapperVariants3 = (0, import_class_variance_authority19.cva)("flex item
3162
3192
  size: "lg"
3163
3193
  }
3164
3194
  });
3165
- var SearchInput = (props) => {
3195
+ var SearchInput = React33.forwardRef((props, forwardedRef) => {
3166
3196
  const {
3167
3197
  placeholder = "Search...",
3168
3198
  size = "lg",
@@ -3174,6 +3204,18 @@ var SearchInput = (props) => {
3174
3204
  ...inputProps
3175
3205
  } = props;
3176
3206
  const inputRef = React33.useRef(null);
3207
+ const setInputRef = React33.useCallback(
3208
+ (node) => {
3209
+ inputRef.current = node;
3210
+ if (!forwardedRef) return;
3211
+ if (typeof forwardedRef === "function") {
3212
+ forwardedRef(node);
3213
+ } else {
3214
+ forwardedRef.current = node;
3215
+ }
3216
+ },
3217
+ [forwardedRef]
3218
+ );
3177
3219
  const handleContainerClick = () => {
3178
3220
  if (disabled) return;
3179
3221
  inputRef.current?.focus();
@@ -3192,7 +3234,7 @@ var SearchInput = (props) => {
3192
3234
  /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
3193
3235
  Input,
3194
3236
  {
3195
- ref: inputRef,
3237
+ ref: setInputRef,
3196
3238
  type: "search",
3197
3239
  placeholder,
3198
3240
  disabled: disabled ?? void 0,
@@ -3207,7 +3249,7 @@ var SearchInput = (props) => {
3207
3249
  ]
3208
3250
  }
3209
3251
  ) }) });
3210
- };
3252
+ });
3211
3253
  SearchInput.displayName = "SearchInput";
3212
3254
 
3213
3255
  // src/components/Inputs/Slider.tsx
@@ -3310,7 +3352,7 @@ var toArray = (value) => {
3310
3352
  if (value === void 0) return void 0;
3311
3353
  return Array.isArray(value) ? value : [value];
3312
3354
  };
3313
- var Slider = (props) => {
3355
+ var Slider = React35.forwardRef((props, forwardedRef) => {
3314
3356
  const {
3315
3357
  name,
3316
3358
  display = "flat",
@@ -3626,6 +3668,7 @@ var Slider = (props) => {
3626
3668
  {
3627
3669
  className: wrapperBase,
3628
3670
  style: { marginInline: `${thumbRadius}px` },
3671
+ ref: forwardedRef,
3629
3672
  children: [
3630
3673
  name && /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(import_jsx_runtime37.Fragment, { children: [
3631
3674
  /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
@@ -3691,14 +3734,14 @@ var Slider = (props) => {
3691
3734
  ]
3692
3735
  }
3693
3736
  );
3694
- };
3737
+ });
3695
3738
  Slider.displayName = "Slider";
3696
3739
 
3697
3740
  // src/components/Inputs/TextArea.tsx
3698
3741
  var React36 = __toESM(require("react"), 1);
3699
3742
  var import_icons13 = require("@bubo-squared/icons");
3700
3743
  var import_jsx_runtime38 = require("react/jsx-runtime");
3701
- var TextArea = (props) => {
3744
+ var TextArea = React36.forwardRef((props, forwardedRef) => {
3702
3745
  const {
3703
3746
  label,
3704
3747
  hint,
@@ -3727,6 +3770,18 @@ var TextArea = (props) => {
3727
3770
  const showCharacterLimit = type === "character-limit" && typeof effectiveMaxLength === "number";
3728
3771
  const textareaRef = React36.useRef(null);
3729
3772
  const containerRef = React36.useRef(null);
3773
+ const setTextareaRef = React36.useCallback(
3774
+ (node) => {
3775
+ textareaRef.current = node;
3776
+ if (!forwardedRef) return;
3777
+ if (typeof forwardedRef === "function") {
3778
+ forwardedRef(node);
3779
+ } else {
3780
+ forwardedRef.current = node;
3781
+ }
3782
+ },
3783
+ [forwardedRef]
3784
+ );
3730
3785
  const [height, setHeight] = React36.useState(void 0);
3731
3786
  const [width, setWidth] = React36.useState(void 0);
3732
3787
  const minHeight = 80;
@@ -3811,7 +3866,7 @@ var TextArea = (props) => {
3811
3866
  {
3812
3867
  id: textareaId,
3813
3868
  name,
3814
- ref: textareaRef,
3869
+ ref: setTextareaRef,
3815
3870
  disabled: disabled ?? void 0,
3816
3871
  value: isControlled ? value : currentValue,
3817
3872
  defaultValue: isControlled ? void 0 : defaultValue,
@@ -3862,7 +3917,7 @@ var TextArea = (props) => {
3862
3917
  )
3863
3918
  }
3864
3919
  );
3865
- };
3920
+ });
3866
3921
  TextArea.displayName = "TextArea";
3867
3922
 
3868
3923
  // src/components/Inputs/TextInput.tsx
@@ -3901,7 +3956,7 @@ var iconWrapperVariants4 = (0, import_class_variance_authority20.cva)(
3901
3956
  }
3902
3957
  }
3903
3958
  );
3904
- var TextInput = (props) => {
3959
+ var TextInput = React37.forwardRef((props, forwardedRef) => {
3905
3960
  const {
3906
3961
  label,
3907
3962
  hint,
@@ -3924,6 +3979,18 @@ var TextInput = (props) => {
3924
3979
  );
3925
3980
  const currentValue = (isControlled ? value : internalValue) ?? "";
3926
3981
  const inputRef = React37.useRef(null);
3982
+ const setInputRef = React37.useCallback(
3983
+ (node) => {
3984
+ inputRef.current = node;
3985
+ if (!forwardedRef) return;
3986
+ if (typeof forwardedRef === "function") {
3987
+ forwardedRef(node);
3988
+ } else {
3989
+ forwardedRef.current = node;
3990
+ }
3991
+ },
3992
+ [forwardedRef]
3993
+ );
3927
3994
  const handleContainerClick = () => {
3928
3995
  if (disabled) return;
3929
3996
  inputRef.current?.focus();
@@ -3965,7 +4032,7 @@ var TextInput = (props) => {
3965
4032
  /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
3966
4033
  Input,
3967
4034
  {
3968
- ref: inputRef,
4035
+ ref: setInputRef,
3969
4036
  type: "text",
3970
4037
  disabled: disabled ?? void 0,
3971
4038
  placeholder,
@@ -3994,13 +4061,13 @@ var TextInput = (props) => {
3994
4061
  )
3995
4062
  }
3996
4063
  );
3997
- };
4064
+ });
3998
4065
  TextInput.displayName = "TextInput";
3999
4066
 
4000
4067
  // src/components/Inputs/Toggle.tsx
4001
- var React38 = require("react");
4068
+ var React38 = __toESM(require("react"), 1);
4002
4069
  var import_jsx_runtime40 = require("react/jsx-runtime");
4003
- var Toggle = (props) => {
4070
+ var Toggle = React38.forwardRef((props, forwardedRef) => {
4004
4071
  const { label, className, disabled, ...inputProps } = props;
4005
4072
  return /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(
4006
4073
  "label",
@@ -4014,6 +4081,7 @@ var Toggle = (props) => {
4014
4081
  /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
4015
4082
  "input",
4016
4083
  {
4084
+ ref: forwardedRef,
4017
4085
  type: "checkbox",
4018
4086
  disabled,
4019
4087
  className: "peer sr-only",
@@ -4085,13 +4153,13 @@ var Toggle = (props) => {
4085
4153
  ]
4086
4154
  }
4087
4155
  );
4088
- };
4156
+ });
4089
4157
  Toggle.displayName = "Toggle";
4090
4158
 
4091
4159
  // src/components/Inputs/WebsiteInput.tsx
4092
- var React39 = require("react");
4160
+ var React39 = __toESM(require("react"), 1);
4093
4161
  var import_jsx_runtime41 = require("react/jsx-runtime");
4094
- var WebsiteInput = (props) => {
4162
+ var WebsiteInput = React39.forwardRef((props, forwardedRef) => {
4095
4163
  const {
4096
4164
  hierarchy = "leading",
4097
4165
  protocolLabel = "http://",
@@ -4138,6 +4206,7 @@ var WebsiteInput = (props) => {
4138
4206
  return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
4139
4207
  TextInput,
4140
4208
  {
4209
+ ref: forwardedRef,
4141
4210
  ...rest,
4142
4211
  size,
4143
4212
  disabled,
@@ -4146,7 +4215,7 @@ var WebsiteInput = (props) => {
4146
4215
  trailingIcon: !isLeading ? trailingAddon : void 0
4147
4216
  }
4148
4217
  );
4149
- };
4218
+ });
4150
4219
  WebsiteInput.displayName = "WebsiteInput";
4151
4220
 
4152
4221
  // src/components/Feedback/Popover.tsx