@donotdev/ui 0.0.27 → 0.0.28

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.
@@ -13,6 +13,8 @@ export interface LinkProps extends AnchorHTMLAttributes<HTMLAnchorElement> {
13
13
  children?: ReactNode;
14
14
  /** Icon component or string name */
15
15
  icon?: string | ReactNode;
16
+ /** Place icon after content instead of before */
17
+ iconEnd?: boolean;
16
18
  /** Label text (rendered as span if provided) */
17
19
  label?: string;
18
20
  'aria-label'?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"Link.d.ts","sourceRoot":"","sources":["../../src/routing/Link.tsx"],"names":[],"mappings":"AAaA,OAAO,EACL,KAAK,SAAS,EACd,KAAK,aAAa,EAElB,KAAK,oBAAoB,EAC1B,MAAM,OAAO,CAAC;AASf;;;;;;GAMG;AACH,MAAM,WAAW,SAAU,SAAQ,oBAAoB,CAAC,iBAAiB,CAAC;IACxE,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,oCAAoC;IACpC,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,gDAAgD;IAChD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED;;;;;;GAMG;AACH,eAAO,MAAM,IAAI,EAAE,aAAa,CAAC,SAAS,CAyIzC,CAAC"}
1
+ {"version":3,"file":"Link.d.ts","sourceRoot":"","sources":["../../src/routing/Link.tsx"],"names":[],"mappings":"AAaA,OAAO,EACL,KAAK,SAAS,EACd,KAAK,aAAa,EAElB,KAAK,oBAAoB,EAC1B,MAAM,OAAO,CAAC;AASf;;;;;;GAMG;AACH,MAAM,WAAW,SAAU,SAAQ,oBAAoB,CAAC,iBAAiB,CAAC;IACxE,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,oCAAoC;IACpC,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,iDAAiD;IACjD,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,gDAAgD;IAChD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED;;;;;;GAMG;AACH,eAAO,MAAM,IAAI,EAAE,aAAa,CAAC,SAAS,CA4IzC,CAAC"}
@@ -23,7 +23,7 @@ import { Icon } from '../components/common/icon';
23
23
  * @since 0.0.1
24
24
  * @author AMBROISE PARK Consulting
25
25
  */
26
- export const Link = ({ path, replace, prefetch = true, children, icon, label, onClick, className, 'aria-label': ariaLabel, 'aria-describedby': ariaDescribedBy, target, rel, ...rest }) => {
26
+ export const Link = ({ path, replace, prefetch = true, children, icon, iconEnd = false, label, onClick, className, 'aria-label': ariaLabel, 'aria-describedby': ariaDescribedBy, target, rel, ...rest }) => {
27
27
  const navigate = useNavigate();
28
28
  const showCookieBanner = useConsent('showCookieBanner');
29
29
  // Special framework trigger: #cookie-settings
@@ -42,11 +42,11 @@ export const Link = ({ path, replace, prefetch = true, children, icon, label, on
42
42
  }
43
43
  };
44
44
  return (_jsxs("a", { href: "#cookie-settings", onClick: handleCookieSettings, className: className, style: {
45
- display: icon && label ? 'flex' : undefined,
46
- alignItems: icon && label ? 'center' : undefined,
47
- gap: icon && label ? 'var(--gap-sm)' : undefined,
45
+ display: icon && (label || children) ? 'flex' : undefined,
46
+ alignItems: icon && (label || children) ? 'center' : undefined,
47
+ gap: icon && (label || children) ? 'var(--gap-sm)' : undefined,
48
48
  ...rest.style,
49
- }, "aria-label": ariaLabel || label || 'Cookie Settings', "aria-describedby": ariaDescribedBy, ...rest, children: [icon && _jsx(Icon, { icon: icon, fallback: LinkIcon }), label && _jsx("span", { children: label }), children] }));
49
+ }, "aria-label": ariaLabel || label || 'Cookie Settings', "aria-describedby": ariaDescribedBy, ...rest, children: [icon && !iconEnd && _jsx(Icon, { icon: icon, fallback: LinkIcon }), label && _jsx("span", { children: label }), children, icon && iconEnd && _jsx(Icon, { icon: icon, fallback: LinkIcon })] }));
50
50
  }
51
51
  // Auto-detect external URLs
52
52
  const isExternal = path.startsWith('http://') ||
@@ -75,13 +75,13 @@ export const Link = ({ path, replace, prefetch = true, children, icon, label, on
75
75
  'aria-label': ariaLabel || label,
76
76
  'aria-describedby': ariaDescribedBy,
77
77
  };
78
- const linkContent = (_jsxs(_Fragment, { children: [icon && _jsx(Icon, { icon: icon, fallback: LinkIcon }), label && _jsx("span", { children: label }), children] }));
78
+ const linkContent = (_jsxs(_Fragment, { children: [icon && !iconEnd && _jsx(Icon, { icon: icon, fallback: LinkIcon }), label && _jsx("span", { children: label }), children, icon && iconEnd && _jsx(Icon, { icon: icon, fallback: LinkIcon })] }));
79
79
  // External links: use regular <a> with target/rel
80
80
  if (isExternal) {
81
81
  return (_jsx("a", { href: path, onClick: handleClick, target: target || '_blank', rel: rel || 'noopener noreferrer', className: className, style: {
82
- display: icon && label ? 'flex' : undefined,
83
- alignItems: icon && label ? 'center' : undefined,
84
- gap: icon && label ? 'var(--gap-sm)' : undefined,
82
+ display: icon && (label || children) ? 'flex' : undefined,
83
+ alignItems: icon && (label || children) ? 'center' : undefined,
84
+ gap: icon && (label || children) ? 'var(--gap-sm)' : undefined,
85
85
  }, ...accessibilityProps, ...rest, children: linkContent }));
86
86
  }
87
87
  // Internal links: use framework Link
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@donotdev/ui",
3
- "version": "0.0.27",
3
+ "version": "0.0.28",
4
4
  "type": "module",
5
5
  "private": false,
6
6
  "license": "SEE LICENSE IN LICENSE.md",
@@ -58,11 +58,11 @@
58
58
  "react-hook-form": "^7.71.2"
59
59
  },
60
60
  "peerDependencies": {
61
- "@donotdev/auth": "^0.0.20",
61
+ "@donotdev/auth": "^0.0.21",
62
62
  "@donotdev/billing": "^0.0.17",
63
- "@donotdev/components": "^0.0.28",
64
- "@donotdev/core": "^0.0.39",
65
- "@donotdev/crud": "^0.0.27",
63
+ "@donotdev/components": "^0.0.30",
64
+ "@donotdev/core": "^0.0.41",
65
+ "@donotdev/crud": "^0.0.29",
66
66
  "@donotdev/oauth": "^0.0.17",
67
67
  "lucide-react": "^0.575.0",
68
68
  "react": "^19.2.4",