uibee 3.1.0 → 3.1.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.
@@ -825,14 +825,17 @@ function SearchInput({ placeholder = "Search...", variant = "default" }) {
825
825
  className: "pl-10 pr-4 py-2 border-b outline-none w-64"
826
826
  })]
827
827
  });
828
- else return /* @__PURE__ */ jsx(Input, {
829
- name: "search",
830
- icon: /* @__PURE__ */ jsx(Search, { className: "w-5 h-5" }),
831
- value: searchValue,
832
- onChange: handleChange,
833
- onKeyDown: handleKeyDown,
834
- onBlur: () => handleSearch(searchValue),
835
- placeholder
828
+ else return /* @__PURE__ */ jsx("div", {
829
+ className: "w-fit min-w-48",
830
+ children: /* @__PURE__ */ jsx(Input, {
831
+ name: "search",
832
+ icon: /* @__PURE__ */ jsx(Search, { className: "w-5 h-5" }),
833
+ value: searchValue,
834
+ onChange: handleChange,
835
+ onKeyDown: handleKeyDown,
836
+ onBlur: () => handleSearch(searchValue),
837
+ placeholder
838
+ })
836
839
  });
837
840
  }
838
841
  //#endregion
@@ -2646,7 +2649,9 @@ const variants = {
2646
2649
  success: "bg-green-600 text-white hover:brightness-110",
2647
2650
  info: "bg-blue-600 text-white hover:brightness-110"
2648
2651
  };
2649
- const base = "cursor-pointer px-4 rounded-md h-9 flex items-center justify-center gap-2 select-none text-sm font-medium transition-all duration-150 w-fit";
2652
+ const base = "cursor-pointer rounded-md h-9 flex items-center justify-center gap-2 select-none text-sm font-medium transition-all duration-150";
2653
+ const withText = "px-4 w-fit";
2654
+ const iconOnly = "w-9";
2650
2655
  const disabledCls = "opacity-40 cursor-not-allowed pointer-events-none";
2651
2656
  const iconWrap = (icon) => icon ? /* @__PURE__ */ jsx("span", {
2652
2657
  className: "[&>svg]:w-4 [&>svg]:h-4 flex items-center",
@@ -2654,7 +2659,8 @@ const iconWrap = (icon) => icon ? /* @__PURE__ */ jsx("span", {
2654
2659
  }) : null;
2655
2660
  function Button({ text, className, icon, path, variant = "primary", type, onClick, disabled }) {
2656
2661
  const color = variants[variant];
2657
- const cls = `${base} ${color} ${disabled ? disabledCls : ""} ${className || ""}`;
2662
+ const sizing = icon && !text ? iconOnly : withText;
2663
+ const cls = `${base} ${sizing} ${color} ${disabled ? disabledCls : ""} ${className || ""}`;
2658
2664
  if (!path) return /* @__PURE__ */ jsxs("button", {
2659
2665
  type: type || "button",
2660
2666
  disabled,
@@ -2669,7 +2675,7 @@ function Button({ text, className, icon, path, variant = "primary", type, onClic
2669
2675
  });
2670
2676
  return /* @__PURE__ */ jsxs(Link, {
2671
2677
  href: path,
2672
- className: `${base} ${color} ${className || ""}`,
2678
+ className: `${base} ${sizing} ${color} ${className || ""}`,
2673
2679
  children: [iconWrap(icon), text]
2674
2680
  });
2675
2681
  }
package/dist/style.css CHANGED
@@ -1809,6 +1809,9 @@
1809
1809
  .min-w-40 {
1810
1810
  min-width: calc(var(--spacing) * 40);
1811
1811
  }
1812
+ .min-w-48 {
1813
+ min-width: calc(var(--spacing) * 48);
1814
+ }
1812
1815
  .min-w-70 {
1813
1816
  min-width: calc(var(--spacing) * 70);
1814
1817
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "uibee",
3
- "version": "3.1.0",
3
+ "version": "3.1.2",
4
4
  "description": "Shared components, functions and hooks for reuse across Login projects",
5
5
  "homepage": "https://github.com/Login-Linjeforening-for-IT/uibee#readme",
6
6
  "bugs": {
@@ -21,7 +21,9 @@ const variants = {
21
21
  info: 'bg-blue-600 text-white hover:brightness-110',
22
22
  }
23
23
 
24
- const base = 'cursor-pointer px-4 rounded-md h-9 flex items-center justify-center gap-2 select-none text-sm font-medium transition-all duration-150 w-fit'
24
+ const base = 'cursor-pointer rounded-md h-9 flex items-center justify-center gap-2 select-none text-sm font-medium transition-all duration-150'
25
+ const withText = 'px-4 w-fit'
26
+ const iconOnly = 'w-9'
25
27
  const disabledCls = 'opacity-40 cursor-not-allowed pointer-events-none'
26
28
 
27
29
  const iconWrap = (icon: ButtonProps['icon']) =>
@@ -38,7 +40,8 @@ export default function Button({
38
40
  disabled,
39
41
  }: ButtonProps) {
40
42
  const color = variants[variant]
41
- const cls = `${base} ${color} ${disabled ? disabledCls : ''} ${className || ''}`
43
+ const sizing = icon && !text ? iconOnly : withText
44
+ const cls = `${base} ${sizing} ${color} ${disabled ? disabledCls : ''} ${className || ''}`
42
45
 
43
46
  if (!path) {
44
47
  return (
@@ -65,7 +68,7 @@ export default function Button({
65
68
  }
66
69
 
67
70
  return (
68
- <Link href={path} className={`${base} ${color} ${className || ''}`}>
71
+ <Link href={path} className={`${base} ${sizing} ${color} ${className || ''}`}>
69
72
  {iconWrap(icon)}
70
73
  {text}
71
74
  </Link>
@@ -59,14 +59,18 @@ export default function SearchInput({ placeholder = 'Search...', variant = 'defa
59
59
  </div>
60
60
  )
61
61
  } else {
62
- return <Input
63
- name='search'
64
- icon={<Search className='w-5 h-5' />}
65
- value={searchValue}
66
- onChange={handleChange}
67
- onKeyDown={handleKeyDown}
68
- onBlur={() => handleSearch(searchValue)}
69
- placeholder={placeholder}
70
- />
62
+ return (
63
+ <div className='w-fit min-w-48'>
64
+ <Input
65
+ name='search'
66
+ icon={<Search className='w-5 h-5' />}
67
+ value={searchValue}
68
+ onChange={handleChange}
69
+ onKeyDown={handleKeyDown}
70
+ onBlur={() => handleSearch(searchValue)}
71
+ placeholder={placeholder}
72
+ />
73
+ </div>
74
+ )
71
75
  }
72
76
  }