@refinn/core-ui 0.1.17 → 0.1.19

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
@@ -376,15 +376,15 @@ var import_react4 = require("react");
376
376
  var import_jsx_runtime4 = require("react/jsx-runtime");
377
377
  var sizeClasses2 = {
378
378
  xs: "h-24 w-24",
379
- s: "h-32 w-32",
380
- m: "h-40 w-40",
381
- l: "h-48 w-48"
379
+ sm: "h-32 w-32",
380
+ md: "h-40 w-40",
381
+ lg: "h-48 w-48"
382
382
  };
383
383
  var iconSizeClasses = {
384
384
  xs: "h-16 w-16",
385
- s: "h-20 w-20",
386
- m: "h-24 w-24",
387
- l: "h-24 w-24"
385
+ sm: "h-20 w-20",
386
+ md: "h-24 w-24",
387
+ lg: "h-24 w-24"
388
388
  };
389
389
  var surfaceBackgroundClasses = {
390
390
  default: {
@@ -424,7 +424,7 @@ var IconButton = (0, import_react4.forwardRef)(
424
424
  (_a, ref) => {
425
425
  var _b = _a, {
426
426
  icon,
427
- size = "s",
427
+ size = "sm",
428
428
  surface = "default",
429
429
  transparent = false,
430
430
  danger = false,
@@ -581,7 +581,7 @@ var AlertBanner = (0, import_react5.forwardRef)(
581
581
  onClose && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
582
582
  IconButton,
583
583
  {
584
- size: "s",
584
+ size: "sm",
585
585
  surface: closeButtonSurface,
586
586
  transparent: true,
587
587
  onClick: onClose,
@@ -911,21 +911,21 @@ function IndeterminateIcon({ className }) {
911
911
  );
912
912
  }
913
913
  var boxSizeClasses = {
914
- s: "h-20 w-20",
915
- m: "h-24 w-24"
914
+ sm: "h-20 w-20",
915
+ md: "h-24 w-24"
916
916
  };
917
917
  var labelTextClasses = {
918
- s: "text-label-medium",
919
- m: "text-label-large"
918
+ sm: "text-label-medium",
919
+ md: "text-label-large"
920
920
  };
921
921
  var descriptionPaddingClasses = {
922
- s: "pl-24",
923
- m: "pl-28"
922
+ sm: "pl-24",
923
+ md: "pl-28"
924
924
  };
925
925
  var Checkbox = (0, import_react9.forwardRef)(
926
926
  (_a, ref) => {
927
927
  var _b = _a, {
928
- size = "s",
928
+ size = "sm",
929
929
  label,
930
930
  description,
931
931
  error = false,
@@ -1206,7 +1206,7 @@ var TextField = (0, import_react11.forwardRef)(
1206
1206
  ]);
1207
1207
  const [isFocused, setIsFocused] = (0, import_react11.useState)(false);
1208
1208
  const isActive = isFocused && !!value;
1209
- const iconButtonSize = size === "lg" ? "m" : "s";
1209
+ const iconButtonSize = size === "lg" ? "md" : "sm";
1210
1210
  const inputRef = (0, import_react11.useRef)(null);
1211
1211
  (0, import_react11.useImperativeHandle)(ref, () => inputRef.current);
1212
1212
  return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "w-full flex flex-col gap-4 font-sans", children: [
@@ -1485,19 +1485,23 @@ function useMountTransition(open, duration = 300) {
1485
1485
  (0, import_react13.useEffect)(() => {
1486
1486
  if (open) {
1487
1487
  setMounted(true);
1488
- let raf2 = 0;
1489
- const raf1 = requestAnimationFrame(() => {
1490
- raf2 = requestAnimationFrame(() => setAnimate(true));
1491
- });
1492
- return () => {
1493
- cancelAnimationFrame(raf1);
1494
- cancelAnimationFrame(raf2);
1495
- };
1488
+ return;
1496
1489
  }
1497
1490
  setAnimate(false);
1498
1491
  const timer = setTimeout(() => setMounted(false), duration);
1499
1492
  return () => clearTimeout(timer);
1500
1493
  }, [open, duration]);
1494
+ (0, import_react13.useEffect)(() => {
1495
+ if (!open || !mounted) return;
1496
+ let raf2 = 0;
1497
+ const raf1 = requestAnimationFrame(() => {
1498
+ raf2 = requestAnimationFrame(() => setAnimate(true));
1499
+ });
1500
+ return () => {
1501
+ cancelAnimationFrame(raf1);
1502
+ cancelAnimationFrame(raf2);
1503
+ };
1504
+ }, [open, mounted]);
1501
1505
  return { mounted, animate };
1502
1506
  }
1503
1507
  function DialogAction({
@@ -1603,7 +1607,7 @@ var Dialog = (0, import_react13.forwardRef)(
1603
1607
  IconButton,
1604
1608
  {
1605
1609
  icon: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(CloseIcon2, { className: "h-24 w-24" }),
1606
- size: "m",
1610
+ size: "md",
1607
1611
  surface: "dark",
1608
1612
  "aria-label": "\u0E1B\u0E34\u0E14",
1609
1613
  onClick: handleClose
@@ -1624,7 +1628,7 @@ var Dialog = (0, import_react13.forwardRef)(
1624
1628
  IconButton,
1625
1629
  {
1626
1630
  icon: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(CloseIcon2, { className: "h-20 w-20" }),
1627
- size: "s",
1631
+ size: "sm",
1628
1632
  "aria-label": "\u0E1B\u0E34\u0E14",
1629
1633
  onClick: handleClose,
1630
1634
  className: "lg:hidden!"
@@ -1634,7 +1638,7 @@ var Dialog = (0, import_react13.forwardRef)(
1634
1638
  IconButton,
1635
1639
  {
1636
1640
  icon: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(CloseIcon2, { className: "h-24 w-24" }),
1637
- size: "m",
1641
+ size: "md",
1638
1642
  "aria-label": "\u0E1B\u0E34\u0E14",
1639
1643
  onClick: handleClose,
1640
1644
  className: "hidden! lg:inline-flex!"
@@ -1679,19 +1683,23 @@ function useMountTransition2(open, duration = 300) {
1679
1683
  (0, import_react14.useEffect)(() => {
1680
1684
  if (open) {
1681
1685
  setMounted(true);
1682
- let raf2 = 0;
1683
- const raf1 = requestAnimationFrame(() => {
1684
- raf2 = requestAnimationFrame(() => setAnimate(true));
1685
- });
1686
- return () => {
1687
- cancelAnimationFrame(raf1);
1688
- cancelAnimationFrame(raf2);
1689
- };
1686
+ return;
1690
1687
  }
1691
1688
  setAnimate(false);
1692
1689
  const timer = setTimeout(() => setMounted(false), duration);
1693
1690
  return () => clearTimeout(timer);
1694
1691
  }, [open, duration]);
1692
+ (0, import_react14.useEffect)(() => {
1693
+ if (!open || !mounted) return;
1694
+ let raf2 = 0;
1695
+ const raf1 = requestAnimationFrame(() => {
1696
+ raf2 = requestAnimationFrame(() => setAnimate(true));
1697
+ });
1698
+ return () => {
1699
+ cancelAnimationFrame(raf1);
1700
+ cancelAnimationFrame(raf2);
1701
+ };
1702
+ }, [open, mounted]);
1695
1703
  return { mounted, animate };
1696
1704
  }
1697
1705
  function DrawerAction({
@@ -1728,6 +1736,7 @@ var Drawer = (0, import_react14.forwardRef)(
1728
1736
  dismiss,
1729
1737
  secondary,
1730
1738
  confirm,
1739
+ noPadding = false,
1731
1740
  className = ""
1732
1741
  } = _b, rest = __objRest(_b, [
1733
1742
  "open",
@@ -1743,6 +1752,7 @@ var Drawer = (0, import_react14.forwardRef)(
1743
1752
  "dismiss",
1744
1753
  "secondary",
1745
1754
  "confirm",
1755
+ "noPadding",
1746
1756
  "className"
1747
1757
  ]);
1748
1758
  const { mounted, animate } = useMountTransition2(open);
@@ -1794,12 +1804,12 @@ var Drawer = (0, import_react14.forwardRef)(
1794
1804
  onMouseDown: (e) => e.stopPropagation()
1795
1805
  }, rest), {
1796
1806
  children: [
1797
- showHeader && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
1807
+ showHeader && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "flex flex-col w-full items-center border-b border-border-subtle bg-dialog-background-primary", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
1798
1808
  "div",
1799
1809
  {
1800
1810
  className: [
1801
- "flex shrink-0 items-center gap-8 border-b border-border-subtle bg-dialog-background-primary px-16 pb-12 pt-16",
1802
- fullScreen ? "lg:gap-16 lg:px-112 lg:py-24" : "lg:px-24 lg:pb-16 lg:pt-20"
1811
+ "flex shrink-0 items-center gap-8 px-16 pb-12 pt-16 w-full",
1812
+ fullScreen ? "lg:gap-16 lg:px-0 lg:py-24 lg:max-w-1216" : "lg:px-24 lg:pb-16 lg:pt-20"
1803
1813
  ].join(" "),
1804
1814
  children: [
1805
1815
  /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex min-w-0 flex-1 flex-col gap-2", children: [
@@ -1811,7 +1821,7 @@ var Drawer = (0, import_react14.forwardRef)(
1811
1821
  IconButton,
1812
1822
  {
1813
1823
  icon: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(CloseIcon3, { className: "h-20 w-20" }),
1814
- size: "s",
1824
+ size: "sm",
1815
1825
  "aria-label": "\u0E1B\u0E34\u0E14",
1816
1826
  onClick: handleClose,
1817
1827
  className: "lg:hidden!"
@@ -1821,7 +1831,7 @@ var Drawer = (0, import_react14.forwardRef)(
1821
1831
  IconButton,
1822
1832
  {
1823
1833
  icon: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(CloseIcon3, { className: "h-24 w-24" }),
1824
- size: fullScreen ? "l" : "m",
1834
+ size: fullScreen ? "lg" : "md",
1825
1835
  "aria-label": "\u0E1B\u0E34\u0E14",
1826
1836
  onClick: handleClose,
1827
1837
  className: "hidden! lg:inline-flex!"
@@ -1830,24 +1840,24 @@ var Drawer = (0, import_react14.forwardRef)(
1830
1840
  ] })
1831
1841
  ]
1832
1842
  }
1833
- ),
1843
+ ) }),
1834
1844
  /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1835
1845
  "div",
1836
1846
  {
1837
1847
  className: [
1838
- "flex-1 overflow-y-auto p-16 text-body-regular text-dialog-text-primary",
1839
- background === "secondary" ? "bg-drawer-background-secondary" : "bg-dialog-background-primary",
1840
- fullScreen ? "lg:px-112 lg:py-24" : "lg:p-24"
1848
+ "flex-1 overflow-y-auto text-body-regular text-dialog-text-primary",
1849
+ !noPadding && "p-16",
1850
+ background === "secondary" ? "bg-drawer-background-secondary" : "bg-dialog-background-primary"
1841
1851
  ].join(" "),
1842
1852
  children
1843
1853
  }
1844
1854
  ),
1845
- showFooter && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1855
+ showFooter && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: `flex shrink-0 w-full flex-col items-center border-t border-border-subtle bg-dialog-background-primary`, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1846
1856
  "div",
1847
1857
  {
1848
1858
  className: [
1849
- "flex shrink-0 flex-col gap-8 border-t border-border-subtle bg-dialog-background-primary px-16 pb-16 pt-12 lg:flex-row lg:items-center lg:justify-end",
1850
- fullScreen ? "lg:gap-16 lg:px-112 lg:py-24" : "lg:px-24 lg:pb-24 lg:pt-16"
1859
+ "flex shrink-0 flex-col gap-8 px-16 pb-16 pt-12 lg:flex-row lg:items-center lg:justify-end",
1860
+ fullScreen ? "lg:gap-16 lg:px-0 lg:max-w-1216 lg:py-24" : "lg:px-24 lg:pb-24 lg:pt-16"
1851
1861
  ].join(" "),
1852
1862
  children: allActions ? /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_jsx_runtime14.Fragment, { children: [
1853
1863
  /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(DrawerAction, { action: dismiss, variant: "tertiary", orderClass: "order-3 lg:order-1" }),
@@ -1861,7 +1871,7 @@ var Drawer = (0, import_react14.forwardRef)(
1861
1871
  /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(DrawerAction, { action: dismiss, variant: "tertiary", orderClass: "order-3 lg:order-1" })
1862
1872
  ] })
1863
1873
  }
1864
- )
1874
+ ) })
1865
1875
  ]
1866
1876
  })
1867
1877
  )
@@ -1969,7 +1979,7 @@ var Dropdown = (0, import_react15.forwardRef)(
1969
1979
  "className"
1970
1980
  ]);
1971
1981
  const isCombobox = variant === "combobox";
1972
- const iconButtonSize = size === "lg" ? "m" : "s";
1982
+ const iconButtonSize = size === "lg" ? "md" : "sm";
1973
1983
  const [isOpen, setIsOpen] = (0, import_react15.useState)(false);
1974
1984
  const [isFocused, setIsFocused] = (0, import_react15.useState)(false);
1975
1985
  const [query, setQuery] = (0, import_react15.useState)(value.label || "");
@@ -2386,17 +2396,11 @@ var linkVariantClasses = {
2386
2396
  lg: "text-link-large gap-4"
2387
2397
  };
2388
2398
  var iconVariantClasses = {
2389
- xs: "w-20 h-20",
2390
- sm: "w-20 h-20",
2391
- md: "w-20 h-20",
2392
- lg: "w-24 h-24"
2399
+ xs: "w-20 h-20 text-[20px]",
2400
+ sm: "w-20 h-20 text-[20px]",
2401
+ md: "w-20 h-20 text-[20px]",
2402
+ lg: "w-24 h-24 text-[24px]"
2393
2403
  };
2394
- function SuccessIcon3({ className }) {
2395
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("svg", { className, width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", "aria-hidden": "true", children: [
2396
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("path", { d: "M10 18a8 8 0 1 0 0-16 8 8 0 0 0 0 16Z", stroke: "currentColor", strokeWidth: "1.5" }),
2397
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("path", { d: "m7 10 2 2 4-4", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" })
2398
- ] });
2399
- }
2400
2404
  var Link = (0, import_react18.forwardRef)(
2401
2405
  (_a, ref) => {
2402
2406
  var _b = _a, {
@@ -2405,7 +2409,7 @@ var Link = (0, import_react18.forwardRef)(
2405
2409
  linkStyle = "brand",
2406
2410
  text,
2407
2411
  href,
2408
- icon = true,
2412
+ icon,
2409
2413
  className = "",
2410
2414
  children
2411
2415
  } = _b, rest = __objRest(_b, [
@@ -2418,6 +2422,7 @@ var Link = (0, import_react18.forwardRef)(
2418
2422
  "className",
2419
2423
  "children"
2420
2424
  ]);
2425
+ var _a2;
2421
2426
  const styleClass = linkStyleClasses[linkStyle];
2422
2427
  const variantClass = linkVariantClasses[variant];
2423
2428
  const iconClass = iconVariantClasses[variant];
@@ -2428,9 +2433,11 @@ var Link = (0, import_react18.forwardRef)(
2428
2433
  variantClass,
2429
2434
  className
2430
2435
  ].filter(Boolean).join(" ");
2431
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", __spreadProps(__spreadValues({ ref, role: "link", className: classes }, rest), { children: [
2436
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("span", __spreadProps(__spreadValues({ ref, role: "link", className: classes }, rest), { children: [
2432
2437
  /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("a", { href, target: "_blank", rel: "noopener noreferrer", children: text }),
2433
- icon && !isInline ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SuccessIcon3, { className: iconClass }) : null
2438
+ icon && (0, import_react18.cloneElement)(icon, {
2439
+ className: `${(_a2 = icon.props.className) != null ? _a2 : ""} ${iconClass}`
2440
+ })
2434
2441
  ] }));
2435
2442
  }
2436
2443
  );
@@ -2963,7 +2970,7 @@ var TextArea = (0, import_react23.forwardRef)(
2963
2970
  pending ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Loading, { size: "sm", className: "shrink-0 absolute right-12 top-12" }) : clearable && isFocused && value ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
2964
2971
  IconButton,
2965
2972
  {
2966
- size: "s",
2973
+ size: "sm",
2967
2974
  transparent: true,
2968
2975
  "aria-label": "\u0E25\u0E49\u0E32\u0E07\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21",
2969
2976
  className: "absolute right-6 top-6",
package/dist/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as react from 'react';
2
- import react__default, { HTMLAttributes, ReactNode, ButtonHTMLAttributes, InputHTMLAttributes, TextareaHTMLAttributes } from 'react';
2
+ import react__default, { HTMLAttributes, ReactNode, ButtonHTMLAttributes, InputHTMLAttributes, ReactElement, TextareaHTMLAttributes } from 'react';
3
3
 
4
4
  interface AccordionItemData {
5
5
  id?: string;
@@ -80,7 +80,7 @@ interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
80
80
  }
81
81
  declare const Button: react.ForwardRefExoticComponent<ButtonProps & react.RefAttributes<HTMLButtonElement>>;
82
82
 
83
- type CheckboxSize = "s" | "m";
83
+ type CheckboxSize = "sm" | "md";
84
84
  interface CheckboxProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "size"> {
85
85
  size?: CheckboxSize;
86
86
  label?: ReactNode;
@@ -182,6 +182,7 @@ interface DrawerProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {
182
182
  dismiss?: DrawerActionProps;
183
183
  secondary?: DrawerActionProps;
184
184
  confirm?: DrawerActionProps;
185
+ noPadding?: boolean;
185
186
  }
186
187
  declare const Drawer: react.ForwardRefExoticComponent<DrawerProps & react.RefAttributes<HTMLDivElement>>;
187
188
 
@@ -233,7 +234,7 @@ interface IconProps extends Omit<HTMLAttributes<HTMLSpanElement>, 'children'> {
233
234
  }
234
235
  declare const Icon: react.ForwardRefExoticComponent<IconProps & react.RefAttributes<HTMLSpanElement>>;
235
236
 
236
- type IconButtonSize = 'xs' | 's' | 'm' | 'l';
237
+ type IconButtonSize = 'xs' | 'sm' | 'md' | 'lg';
237
238
  type IconButtonSurface = 'default' | 'dark' | 'light';
238
239
  interface IconButtonProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'children'> {
239
240
  icon: ReactNode;
@@ -249,15 +250,17 @@ declare const IconButton: react.ForwardRefExoticComponent<IconButtonProps & reac
249
250
 
250
251
  type LinkVariant = 'xs' | 'sm' | 'md' | 'lg';
251
252
  type LinkStyle = 'brand' | 'white' | 'black' | 'brandLooped' | 'whiteLooped' | 'blackLooped';
252
- interface LinkProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {
253
+ interface LinkProps extends Omit<HTMLAttributes<HTMLSpanElement>, 'title'> {
253
254
  variant?: LinkVariant;
254
255
  isInline?: boolean;
255
256
  linkStyle?: LinkStyle;
256
257
  text?: ReactNode;
257
258
  href?: string;
258
- icon?: boolean;
259
+ icon?: ReactElement<{
260
+ className?: string;
261
+ }>;
259
262
  }
260
- declare const Link: react.ForwardRefExoticComponent<LinkProps & react.RefAttributes<HTMLDivElement>>;
263
+ declare const Link: react.ForwardRefExoticComponent<LinkProps & react.RefAttributes<HTMLSpanElement>>;
261
264
 
262
265
  type LoadingSize = "sm" | "lg";
263
266
  interface LoadingProps extends HTMLAttributes<HTMLDivElement> {
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as react from 'react';
2
- import react__default, { HTMLAttributes, ReactNode, ButtonHTMLAttributes, InputHTMLAttributes, TextareaHTMLAttributes } from 'react';
2
+ import react__default, { HTMLAttributes, ReactNode, ButtonHTMLAttributes, InputHTMLAttributes, ReactElement, TextareaHTMLAttributes } from 'react';
3
3
 
4
4
  interface AccordionItemData {
5
5
  id?: string;
@@ -80,7 +80,7 @@ interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
80
80
  }
81
81
  declare const Button: react.ForwardRefExoticComponent<ButtonProps & react.RefAttributes<HTMLButtonElement>>;
82
82
 
83
- type CheckboxSize = "s" | "m";
83
+ type CheckboxSize = "sm" | "md";
84
84
  interface CheckboxProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "size"> {
85
85
  size?: CheckboxSize;
86
86
  label?: ReactNode;
@@ -182,6 +182,7 @@ interface DrawerProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {
182
182
  dismiss?: DrawerActionProps;
183
183
  secondary?: DrawerActionProps;
184
184
  confirm?: DrawerActionProps;
185
+ noPadding?: boolean;
185
186
  }
186
187
  declare const Drawer: react.ForwardRefExoticComponent<DrawerProps & react.RefAttributes<HTMLDivElement>>;
187
188
 
@@ -233,7 +234,7 @@ interface IconProps extends Omit<HTMLAttributes<HTMLSpanElement>, 'children'> {
233
234
  }
234
235
  declare const Icon: react.ForwardRefExoticComponent<IconProps & react.RefAttributes<HTMLSpanElement>>;
235
236
 
236
- type IconButtonSize = 'xs' | 's' | 'm' | 'l';
237
+ type IconButtonSize = 'xs' | 'sm' | 'md' | 'lg';
237
238
  type IconButtonSurface = 'default' | 'dark' | 'light';
238
239
  interface IconButtonProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'children'> {
239
240
  icon: ReactNode;
@@ -249,15 +250,17 @@ declare const IconButton: react.ForwardRefExoticComponent<IconButtonProps & reac
249
250
 
250
251
  type LinkVariant = 'xs' | 'sm' | 'md' | 'lg';
251
252
  type LinkStyle = 'brand' | 'white' | 'black' | 'brandLooped' | 'whiteLooped' | 'blackLooped';
252
- interface LinkProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {
253
+ interface LinkProps extends Omit<HTMLAttributes<HTMLSpanElement>, 'title'> {
253
254
  variant?: LinkVariant;
254
255
  isInline?: boolean;
255
256
  linkStyle?: LinkStyle;
256
257
  text?: ReactNode;
257
258
  href?: string;
258
- icon?: boolean;
259
+ icon?: ReactElement<{
260
+ className?: string;
261
+ }>;
259
262
  }
260
- declare const Link: react.ForwardRefExoticComponent<LinkProps & react.RefAttributes<HTMLDivElement>>;
263
+ declare const Link: react.ForwardRefExoticComponent<LinkProps & react.RefAttributes<HTMLSpanElement>>;
261
264
 
262
265
  type LoadingSize = "sm" | "lg";
263
266
  interface LoadingProps extends HTMLAttributes<HTMLDivElement> {
package/dist/index.js CHANGED
@@ -333,15 +333,15 @@ import { forwardRef as forwardRef4 } from "react";
333
333
  import { jsx as jsx4 } from "react/jsx-runtime";
334
334
  var sizeClasses2 = {
335
335
  xs: "h-24 w-24",
336
- s: "h-32 w-32",
337
- m: "h-40 w-40",
338
- l: "h-48 w-48"
336
+ sm: "h-32 w-32",
337
+ md: "h-40 w-40",
338
+ lg: "h-48 w-48"
339
339
  };
340
340
  var iconSizeClasses = {
341
341
  xs: "h-16 w-16",
342
- s: "h-20 w-20",
343
- m: "h-24 w-24",
344
- l: "h-24 w-24"
342
+ sm: "h-20 w-20",
343
+ md: "h-24 w-24",
344
+ lg: "h-24 w-24"
345
345
  };
346
346
  var surfaceBackgroundClasses = {
347
347
  default: {
@@ -381,7 +381,7 @@ var IconButton = forwardRef4(
381
381
  (_a, ref) => {
382
382
  var _b = _a, {
383
383
  icon,
384
- size = "s",
384
+ size = "sm",
385
385
  surface = "default",
386
386
  transparent = false,
387
387
  danger = false,
@@ -538,7 +538,7 @@ var AlertBanner = forwardRef5(
538
538
  onClose && /* @__PURE__ */ jsx5(
539
539
  IconButton,
540
540
  {
541
- size: "s",
541
+ size: "sm",
542
542
  surface: closeButtonSurface,
543
543
  transparent: true,
544
544
  onClick: onClose,
@@ -874,21 +874,21 @@ function IndeterminateIcon({ className }) {
874
874
  );
875
875
  }
876
876
  var boxSizeClasses = {
877
- s: "h-20 w-20",
878
- m: "h-24 w-24"
877
+ sm: "h-20 w-20",
878
+ md: "h-24 w-24"
879
879
  };
880
880
  var labelTextClasses = {
881
- s: "text-label-medium",
882
- m: "text-label-large"
881
+ sm: "text-label-medium",
882
+ md: "text-label-large"
883
883
  };
884
884
  var descriptionPaddingClasses = {
885
- s: "pl-24",
886
- m: "pl-28"
885
+ sm: "pl-24",
886
+ md: "pl-28"
887
887
  };
888
888
  var Checkbox = forwardRef9(
889
889
  (_a, ref) => {
890
890
  var _b = _a, {
891
- size = "s",
891
+ size = "sm",
892
892
  label,
893
893
  description,
894
894
  error = false,
@@ -1184,7 +1184,7 @@ var TextField = forwardRef11(
1184
1184
  ]);
1185
1185
  const [isFocused, setIsFocused] = useState4(false);
1186
1186
  const isActive = isFocused && !!value;
1187
- const iconButtonSize = size === "lg" ? "m" : "s";
1187
+ const iconButtonSize = size === "lg" ? "md" : "sm";
1188
1188
  const inputRef = useRef(null);
1189
1189
  useImperativeHandle(ref, () => inputRef.current);
1190
1190
  return /* @__PURE__ */ jsxs10("div", { className: "w-full flex flex-col gap-4 font-sans", children: [
@@ -1467,19 +1467,23 @@ function useMountTransition(open, duration = 300) {
1467
1467
  useEffect2(() => {
1468
1468
  if (open) {
1469
1469
  setMounted(true);
1470
- let raf2 = 0;
1471
- const raf1 = requestAnimationFrame(() => {
1472
- raf2 = requestAnimationFrame(() => setAnimate(true));
1473
- });
1474
- return () => {
1475
- cancelAnimationFrame(raf1);
1476
- cancelAnimationFrame(raf2);
1477
- };
1470
+ return;
1478
1471
  }
1479
1472
  setAnimate(false);
1480
1473
  const timer = setTimeout(() => setMounted(false), duration);
1481
1474
  return () => clearTimeout(timer);
1482
1475
  }, [open, duration]);
1476
+ useEffect2(() => {
1477
+ if (!open || !mounted) return;
1478
+ let raf2 = 0;
1479
+ const raf1 = requestAnimationFrame(() => {
1480
+ raf2 = requestAnimationFrame(() => setAnimate(true));
1481
+ });
1482
+ return () => {
1483
+ cancelAnimationFrame(raf1);
1484
+ cancelAnimationFrame(raf2);
1485
+ };
1486
+ }, [open, mounted]);
1483
1487
  return { mounted, animate };
1484
1488
  }
1485
1489
  function DialogAction({
@@ -1585,7 +1589,7 @@ var Dialog = forwardRef13(
1585
1589
  IconButton,
1586
1590
  {
1587
1591
  icon: /* @__PURE__ */ jsx13(CloseIcon2, { className: "h-24 w-24" }),
1588
- size: "m",
1592
+ size: "md",
1589
1593
  surface: "dark",
1590
1594
  "aria-label": "\u0E1B\u0E34\u0E14",
1591
1595
  onClick: handleClose
@@ -1606,7 +1610,7 @@ var Dialog = forwardRef13(
1606
1610
  IconButton,
1607
1611
  {
1608
1612
  icon: /* @__PURE__ */ jsx13(CloseIcon2, { className: "h-20 w-20" }),
1609
- size: "s",
1613
+ size: "sm",
1610
1614
  "aria-label": "\u0E1B\u0E34\u0E14",
1611
1615
  onClick: handleClose,
1612
1616
  className: "lg:hidden!"
@@ -1616,7 +1620,7 @@ var Dialog = forwardRef13(
1616
1620
  IconButton,
1617
1621
  {
1618
1622
  icon: /* @__PURE__ */ jsx13(CloseIcon2, { className: "h-24 w-24" }),
1619
- size: "m",
1623
+ size: "md",
1620
1624
  "aria-label": "\u0E1B\u0E34\u0E14",
1621
1625
  onClick: handleClose,
1622
1626
  className: "hidden! lg:inline-flex!"
@@ -1665,19 +1669,23 @@ function useMountTransition2(open, duration = 300) {
1665
1669
  useEffect3(() => {
1666
1670
  if (open) {
1667
1671
  setMounted(true);
1668
- let raf2 = 0;
1669
- const raf1 = requestAnimationFrame(() => {
1670
- raf2 = requestAnimationFrame(() => setAnimate(true));
1671
- });
1672
- return () => {
1673
- cancelAnimationFrame(raf1);
1674
- cancelAnimationFrame(raf2);
1675
- };
1672
+ return;
1676
1673
  }
1677
1674
  setAnimate(false);
1678
1675
  const timer = setTimeout(() => setMounted(false), duration);
1679
1676
  return () => clearTimeout(timer);
1680
1677
  }, [open, duration]);
1678
+ useEffect3(() => {
1679
+ if (!open || !mounted) return;
1680
+ let raf2 = 0;
1681
+ const raf1 = requestAnimationFrame(() => {
1682
+ raf2 = requestAnimationFrame(() => setAnimate(true));
1683
+ });
1684
+ return () => {
1685
+ cancelAnimationFrame(raf1);
1686
+ cancelAnimationFrame(raf2);
1687
+ };
1688
+ }, [open, mounted]);
1681
1689
  return { mounted, animate };
1682
1690
  }
1683
1691
  function DrawerAction({
@@ -1714,6 +1722,7 @@ var Drawer = forwardRef14(
1714
1722
  dismiss,
1715
1723
  secondary,
1716
1724
  confirm,
1725
+ noPadding = false,
1717
1726
  className = ""
1718
1727
  } = _b, rest = __objRest(_b, [
1719
1728
  "open",
@@ -1729,6 +1738,7 @@ var Drawer = forwardRef14(
1729
1738
  "dismiss",
1730
1739
  "secondary",
1731
1740
  "confirm",
1741
+ "noPadding",
1732
1742
  "className"
1733
1743
  ]);
1734
1744
  const { mounted, animate } = useMountTransition2(open);
@@ -1780,12 +1790,12 @@ var Drawer = forwardRef14(
1780
1790
  onMouseDown: (e) => e.stopPropagation()
1781
1791
  }, rest), {
1782
1792
  children: [
1783
- showHeader && /* @__PURE__ */ jsxs12(
1793
+ showHeader && /* @__PURE__ */ jsx14("div", { className: "flex flex-col w-full items-center border-b border-border-subtle bg-dialog-background-primary", children: /* @__PURE__ */ jsxs12(
1784
1794
  "div",
1785
1795
  {
1786
1796
  className: [
1787
- "flex shrink-0 items-center gap-8 border-b border-border-subtle bg-dialog-background-primary px-16 pb-12 pt-16",
1788
- fullScreen ? "lg:gap-16 lg:px-112 lg:py-24" : "lg:px-24 lg:pb-16 lg:pt-20"
1797
+ "flex shrink-0 items-center gap-8 px-16 pb-12 pt-16 w-full",
1798
+ fullScreen ? "lg:gap-16 lg:px-0 lg:py-24 lg:max-w-1216" : "lg:px-24 lg:pb-16 lg:pt-20"
1789
1799
  ].join(" "),
1790
1800
  children: [
1791
1801
  /* @__PURE__ */ jsxs12("div", { className: "flex min-w-0 flex-1 flex-col gap-2", children: [
@@ -1797,7 +1807,7 @@ var Drawer = forwardRef14(
1797
1807
  IconButton,
1798
1808
  {
1799
1809
  icon: /* @__PURE__ */ jsx14(CloseIcon3, { className: "h-20 w-20" }),
1800
- size: "s",
1810
+ size: "sm",
1801
1811
  "aria-label": "\u0E1B\u0E34\u0E14",
1802
1812
  onClick: handleClose,
1803
1813
  className: "lg:hidden!"
@@ -1807,7 +1817,7 @@ var Drawer = forwardRef14(
1807
1817
  IconButton,
1808
1818
  {
1809
1819
  icon: /* @__PURE__ */ jsx14(CloseIcon3, { className: "h-24 w-24" }),
1810
- size: fullScreen ? "l" : "m",
1820
+ size: fullScreen ? "lg" : "md",
1811
1821
  "aria-label": "\u0E1B\u0E34\u0E14",
1812
1822
  onClick: handleClose,
1813
1823
  className: "hidden! lg:inline-flex!"
@@ -1816,24 +1826,24 @@ var Drawer = forwardRef14(
1816
1826
  ] })
1817
1827
  ]
1818
1828
  }
1819
- ),
1829
+ ) }),
1820
1830
  /* @__PURE__ */ jsx14(
1821
1831
  "div",
1822
1832
  {
1823
1833
  className: [
1824
- "flex-1 overflow-y-auto p-16 text-body-regular text-dialog-text-primary",
1825
- background === "secondary" ? "bg-drawer-background-secondary" : "bg-dialog-background-primary",
1826
- fullScreen ? "lg:px-112 lg:py-24" : "lg:p-24"
1834
+ "flex-1 overflow-y-auto text-body-regular text-dialog-text-primary",
1835
+ !noPadding && "p-16",
1836
+ background === "secondary" ? "bg-drawer-background-secondary" : "bg-dialog-background-primary"
1827
1837
  ].join(" "),
1828
1838
  children
1829
1839
  }
1830
1840
  ),
1831
- showFooter && /* @__PURE__ */ jsx14(
1841
+ showFooter && /* @__PURE__ */ jsx14("div", { className: `flex shrink-0 w-full flex-col items-center border-t border-border-subtle bg-dialog-background-primary`, children: /* @__PURE__ */ jsx14(
1832
1842
  "div",
1833
1843
  {
1834
1844
  className: [
1835
- "flex shrink-0 flex-col gap-8 border-t border-border-subtle bg-dialog-background-primary px-16 pb-16 pt-12 lg:flex-row lg:items-center lg:justify-end",
1836
- fullScreen ? "lg:gap-16 lg:px-112 lg:py-24" : "lg:px-24 lg:pb-24 lg:pt-16"
1845
+ "flex shrink-0 flex-col gap-8 px-16 pb-16 pt-12 lg:flex-row lg:items-center lg:justify-end",
1846
+ fullScreen ? "lg:gap-16 lg:px-0 lg:max-w-1216 lg:py-24" : "lg:px-24 lg:pb-24 lg:pt-16"
1837
1847
  ].join(" "),
1838
1848
  children: allActions ? /* @__PURE__ */ jsxs12(Fragment3, { children: [
1839
1849
  /* @__PURE__ */ jsx14(DrawerAction, { action: dismiss, variant: "tertiary", orderClass: "order-3 lg:order-1" }),
@@ -1847,7 +1857,7 @@ var Drawer = forwardRef14(
1847
1857
  /* @__PURE__ */ jsx14(DrawerAction, { action: dismiss, variant: "tertiary", orderClass: "order-3 lg:order-1" })
1848
1858
  ] })
1849
1859
  }
1850
- )
1860
+ ) })
1851
1861
  ]
1852
1862
  })
1853
1863
  )
@@ -1961,7 +1971,7 @@ var Dropdown = forwardRef15(
1961
1971
  "className"
1962
1972
  ]);
1963
1973
  const isCombobox = variant === "combobox";
1964
- const iconButtonSize = size === "lg" ? "m" : "s";
1974
+ const iconButtonSize = size === "lg" ? "md" : "sm";
1965
1975
  const [isOpen, setIsOpen] = useState8(false);
1966
1976
  const [isFocused, setIsFocused] = useState8(false);
1967
1977
  const [query, setQuery] = useState8(value.label || "");
@@ -2361,7 +2371,7 @@ var Icon = forwardRef17(
2361
2371
  Icon.displayName = "Icon";
2362
2372
 
2363
2373
  // src/components/Link/Link.tsx
2364
- import { forwardRef as forwardRef18 } from "react";
2374
+ import { forwardRef as forwardRef18, cloneElement } from "react";
2365
2375
  import { jsx as jsx18, jsxs as jsxs15 } from "react/jsx-runtime";
2366
2376
  var linkStyleClasses = {
2367
2377
  brand: "font-sans text-link-text-enabled",
@@ -2378,17 +2388,11 @@ var linkVariantClasses = {
2378
2388
  lg: "text-link-large gap-4"
2379
2389
  };
2380
2390
  var iconVariantClasses = {
2381
- xs: "w-20 h-20",
2382
- sm: "w-20 h-20",
2383
- md: "w-20 h-20",
2384
- lg: "w-24 h-24"
2391
+ xs: "w-20 h-20 text-[20px]",
2392
+ sm: "w-20 h-20 text-[20px]",
2393
+ md: "w-20 h-20 text-[20px]",
2394
+ lg: "w-24 h-24 text-[24px]"
2385
2395
  };
2386
- function SuccessIcon3({ className }) {
2387
- return /* @__PURE__ */ jsxs15("svg", { className, width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", "aria-hidden": "true", children: [
2388
- /* @__PURE__ */ jsx18("path", { d: "M10 18a8 8 0 1 0 0-16 8 8 0 0 0 0 16Z", stroke: "currentColor", strokeWidth: "1.5" }),
2389
- /* @__PURE__ */ jsx18("path", { d: "m7 10 2 2 4-4", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" })
2390
- ] });
2391
- }
2392
2396
  var Link = forwardRef18(
2393
2397
  (_a, ref) => {
2394
2398
  var _b = _a, {
@@ -2397,7 +2401,7 @@ var Link = forwardRef18(
2397
2401
  linkStyle = "brand",
2398
2402
  text,
2399
2403
  href,
2400
- icon = true,
2404
+ icon,
2401
2405
  className = "",
2402
2406
  children
2403
2407
  } = _b, rest = __objRest(_b, [
@@ -2410,6 +2414,7 @@ var Link = forwardRef18(
2410
2414
  "className",
2411
2415
  "children"
2412
2416
  ]);
2417
+ var _a2;
2413
2418
  const styleClass = linkStyleClasses[linkStyle];
2414
2419
  const variantClass = linkVariantClasses[variant];
2415
2420
  const iconClass = iconVariantClasses[variant];
@@ -2420,9 +2425,11 @@ var Link = forwardRef18(
2420
2425
  variantClass,
2421
2426
  className
2422
2427
  ].filter(Boolean).join(" ");
2423
- return /* @__PURE__ */ jsxs15("div", __spreadProps(__spreadValues({ ref, role: "link", className: classes }, rest), { children: [
2428
+ return /* @__PURE__ */ jsxs15("span", __spreadProps(__spreadValues({ ref, role: "link", className: classes }, rest), { children: [
2424
2429
  /* @__PURE__ */ jsx18("a", { href, target: "_blank", rel: "noopener noreferrer", children: text }),
2425
- icon && !isInline ? /* @__PURE__ */ jsx18(SuccessIcon3, { className: iconClass }) : null
2430
+ icon && cloneElement(icon, {
2431
+ className: `${(_a2 = icon.props.className) != null ? _a2 : ""} ${iconClass}`
2432
+ })
2426
2433
  ] }));
2427
2434
  }
2428
2435
  );
@@ -2966,7 +2973,7 @@ var TextArea = forwardRef23(
2966
2973
  pending ? /* @__PURE__ */ jsx23(Loading, { size: "sm", className: "shrink-0 absolute right-12 top-12" }) : clearable && isFocused && value ? /* @__PURE__ */ jsx23(
2967
2974
  IconButton,
2968
2975
  {
2969
- size: "s",
2976
+ size: "sm",
2970
2977
  transparent: true,
2971
2978
  "aria-label": "\u0E25\u0E49\u0E32\u0E07\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21",
2972
2979
  className: "absolute right-6 top-6",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@refinn/core-ui",
3
- "version": "0.1.17",
3
+ "version": "0.1.19",
4
4
  "description": "Refinn Design System — UI components + Tailwind v4 theme preset",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.js",