@veeqo/ui 9.9.3 → 9.10.0

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.
Files changed (142) hide show
  1. package/dist/_virtual/____insertStyle.cjs +14 -0
  2. package/dist/_virtual/____insertStyle.cjs.map +1 -0
  3. package/dist/_virtual/____insertStyle.js +12 -0
  4. package/dist/_virtual/____insertStyle.js.map +1 -0
  5. package/dist/components/Anchor/Anchor.cjs +34 -8
  6. package/dist/components/Anchor/Anchor.cjs.map +1 -1
  7. package/dist/components/Anchor/Anchor.d.ts +14 -8
  8. package/dist/components/Anchor/Anchor.js +35 -9
  9. package/dist/components/Anchor/Anchor.js.map +1 -1
  10. package/dist/components/Anchor/index.d.ts +2 -1
  11. package/dist/components/Anchor/isExternalLink.cjs +37 -0
  12. package/dist/components/Anchor/isExternalLink.cjs.map +1 -0
  13. package/dist/components/Anchor/isExternalLink.d.ts +13 -0
  14. package/dist/components/Anchor/isExternalLink.js +34 -0
  15. package/dist/components/Anchor/isExternalLink.js.map +1 -0
  16. package/dist/components/Anchor/styled.cjs +27 -2
  17. package/dist/components/Anchor/styled.cjs.map +1 -1
  18. package/dist/components/Anchor/styled.d.ts +10 -1
  19. package/dist/components/Anchor/styled.js +24 -2
  20. package/dist/components/Anchor/styled.js.map +1 -1
  21. package/dist/components/Anchor/types.d.ts +45 -0
  22. package/dist/components/Anchor/utils/urlUtils.cjs +48 -0
  23. package/dist/components/Anchor/utils/urlUtils.cjs.map +1 -0
  24. package/dist/components/Anchor/utils/urlUtils.d.ts +32 -0
  25. package/dist/components/Anchor/utils/urlUtils.js +42 -0
  26. package/dist/components/Anchor/utils/urlUtils.js.map +1 -0
  27. package/dist/components/DataGrid/DataGrid.module.scss.cjs +9 -0
  28. package/dist/components/DataGrid/DataGrid.module.scss.cjs.map +1 -0
  29. package/dist/components/DataGrid/DataGrid.module.scss.js +7 -0
  30. package/dist/components/DataGrid/DataGrid.module.scss.js.map +1 -0
  31. package/dist/components/DataGrid/components/Body/BodyCell/BodyCell.cjs +6 -2
  32. package/dist/components/DataGrid/components/Body/BodyCell/BodyCell.cjs.map +1 -1
  33. package/dist/components/DataGrid/components/Body/BodyCell/BodyCell.js +6 -2
  34. package/dist/components/DataGrid/components/Body/BodyCell/BodyCell.js.map +1 -1
  35. package/dist/components/DataGrid/components/Body/BodyCell/BodyCell.module.scss.cjs +9 -0
  36. package/dist/components/DataGrid/components/Body/BodyCell/BodyCell.module.scss.cjs.map +1 -0
  37. package/dist/components/DataGrid/components/Body/BodyCell/BodyCell.module.scss.js +7 -0
  38. package/dist/components/DataGrid/components/Body/BodyCell/BodyCell.module.scss.js.map +1 -0
  39. package/dist/components/DataGrid/components/CellContent/CellContent.cjs +1 -1
  40. package/dist/components/DataGrid/components/CellContent/CellContent.cjs.map +1 -1
  41. package/dist/components/DataGrid/components/CellContent/CellContent.js +2 -2
  42. package/dist/components/DataGrid/components/CellContent/CellContent.js.map +1 -1
  43. package/dist/components/DataGrid/components/CellContent/CellContent.module.scss.cjs +9 -0
  44. package/dist/components/DataGrid/components/CellContent/CellContent.module.scss.cjs.map +1 -0
  45. package/dist/components/DataGrid/components/CellContent/CellContent.module.scss.js +7 -0
  46. package/dist/components/DataGrid/components/CellContent/CellContent.module.scss.js.map +1 -0
  47. package/dist/components/DataGrid/components/Footer/FooterCell/FooterCell.cjs +1 -1
  48. package/dist/components/DataGrid/components/Footer/FooterCell/FooterCell.cjs.map +1 -1
  49. package/dist/components/DataGrid/components/Footer/FooterCell/FooterCell.js +2 -2
  50. package/dist/components/DataGrid/components/Footer/FooterCell/FooterCell.js.map +1 -1
  51. package/dist/components/DataGrid/components/Footer/FooterCell/FooterCell.module.scss.cjs +9 -0
  52. package/dist/components/DataGrid/components/Footer/FooterCell/FooterCell.module.scss.cjs.map +1 -0
  53. package/dist/components/DataGrid/components/Footer/FooterCell/FooterCell.module.scss.js +7 -0
  54. package/dist/components/DataGrid/components/Footer/FooterCell/FooterCell.module.scss.js.map +1 -0
  55. package/dist/components/DataGrid/components/GridContainer/Container/Container.cjs +1 -1
  56. package/dist/components/DataGrid/components/GridContainer/Container/Container.cjs.map +1 -1
  57. package/dist/components/DataGrid/components/GridContainer/Container/Container.js +5 -5
  58. package/dist/components/DataGrid/components/GridContainer/Container/Container.js.map +1 -1
  59. package/dist/components/DataGrid/components/GridContainer/Container/Container.module.scss.cjs +9 -0
  60. package/dist/components/DataGrid/components/GridContainer/Container/Container.module.scss.cjs.map +1 -0
  61. package/dist/components/DataGrid/components/GridContainer/Container/Container.module.scss.js +7 -0
  62. package/dist/components/DataGrid/components/GridContainer/Container/Container.module.scss.js.map +1 -0
  63. package/dist/components/DataGrid/components/GridContainer/GridContainer.cjs +1 -1
  64. package/dist/components/DataGrid/components/GridContainer/GridContainer.cjs.map +1 -1
  65. package/dist/components/DataGrid/components/GridContainer/GridContainer.js +2 -2
  66. package/dist/components/DataGrid/components/GridContainer/GridContainer.js.map +1 -1
  67. package/dist/components/DataGrid/components/GridContainer/GridContainer.module.scss.cjs +9 -0
  68. package/dist/components/DataGrid/components/GridContainer/GridContainer.module.scss.cjs.map +1 -0
  69. package/dist/components/DataGrid/components/GridContainer/GridContainer.module.scss.js +7 -0
  70. package/dist/components/DataGrid/components/GridContainer/GridContainer.module.scss.js.map +1 -0
  71. package/dist/components/DataGrid/components/Header/HeaderCell/HeaderCell.cjs +1 -1
  72. package/dist/components/DataGrid/components/Header/HeaderCell/HeaderCell.cjs.map +1 -1
  73. package/dist/components/DataGrid/components/Header/HeaderCell/HeaderCell.js +4 -4
  74. package/dist/components/DataGrid/components/Header/HeaderCell/HeaderCell.js.map +1 -1
  75. package/dist/components/DataGrid/components/Header/HeaderCell/HeaderCell.module.scss.cjs +9 -0
  76. package/dist/components/DataGrid/components/Header/HeaderCell/HeaderCell.module.scss.cjs.map +1 -0
  77. package/dist/components/DataGrid/components/Header/HeaderCell/HeaderCell.module.scss.js +7 -0
  78. package/dist/components/DataGrid/components/Header/HeaderCell/HeaderCell.module.scss.js.map +1 -0
  79. package/dist/components/DataGrid/components/Header/HeaderCell/SortIcon/SortIcon.cjs +1 -1
  80. package/dist/components/DataGrid/components/Header/HeaderCell/SortIcon/SortIcon.cjs.map +1 -1
  81. package/dist/components/DataGrid/components/Header/HeaderCell/SortIcon/SortIcon.js +2 -2
  82. package/dist/components/DataGrid/components/Header/HeaderCell/SortIcon/SortIcon.js.map +1 -1
  83. package/dist/components/DataGrid/components/Header/Resizer/Resizer.cjs +1 -1
  84. package/dist/components/DataGrid/components/Header/Resizer/Resizer.cjs.map +1 -1
  85. package/dist/components/DataGrid/components/Header/Resizer/Resizer.js +2 -2
  86. package/dist/components/DataGrid/components/Header/Resizer/Resizer.js.map +1 -1
  87. package/dist/components/DataGrid/components/Header/Resizer/Resizer.module.scss.cjs +9 -0
  88. package/dist/components/DataGrid/components/Header/Resizer/Resizer.module.scss.cjs.map +1 -0
  89. package/dist/components/DataGrid/components/Header/Resizer/Resizer.module.scss.js +7 -0
  90. package/dist/components/DataGrid/components/Header/Resizer/Resizer.module.scss.js.map +1 -0
  91. package/dist/components/DataGrid/utils/pinnedColumnUtils.cjs +1 -1
  92. package/dist/components/DataGrid/utils/pinnedColumnUtils.cjs.map +1 -1
  93. package/dist/components/DataGrid/utils/pinnedColumnUtils.js +3 -3
  94. package/dist/components/DataGrid/utils/pinnedColumnUtils.js.map +1 -1
  95. package/dist/index.cjs +0 -2
  96. package/dist/index.cjs.map +1 -1
  97. package/dist/index.js +0 -1
  98. package/dist/index.js.map +1 -1
  99. package/dist/tempIcons/LaunchIcon.cjs +13 -0
  100. package/dist/tempIcons/LaunchIcon.cjs.map +1 -0
  101. package/dist/tempIcons/LaunchIcon.d.ts +2 -0
  102. package/dist/tempIcons/LaunchIcon.js +7 -0
  103. package/dist/tempIcons/LaunchIcon.js.map +1 -0
  104. package/dist/utils/index.d.ts +0 -1
  105. package/package.json +2 -1
  106. package/dist/components/DataGrid/DataGrid.module.css.cjs +0 -13
  107. package/dist/components/DataGrid/DataGrid.module.css.cjs.map +0 -1
  108. package/dist/components/DataGrid/DataGrid.module.css.js +0 -10
  109. package/dist/components/DataGrid/DataGrid.module.css.js.map +0 -1
  110. package/dist/components/DataGrid/components/Body/BodyCell/BodyCell.module.css.cjs +0 -11
  111. package/dist/components/DataGrid/components/Body/BodyCell/BodyCell.module.css.cjs.map +0 -1
  112. package/dist/components/DataGrid/components/Body/BodyCell/BodyCell.module.css.js +0 -9
  113. package/dist/components/DataGrid/components/Body/BodyCell/BodyCell.module.css.js.map +0 -1
  114. package/dist/components/DataGrid/components/CellContent/CellContent.module.css.cjs +0 -11
  115. package/dist/components/DataGrid/components/CellContent/CellContent.module.css.cjs.map +0 -1
  116. package/dist/components/DataGrid/components/CellContent/CellContent.module.css.js +0 -9
  117. package/dist/components/DataGrid/components/CellContent/CellContent.module.css.js.map +0 -1
  118. package/dist/components/DataGrid/components/Footer/FooterCell/FooterCell.module.css.cjs +0 -11
  119. package/dist/components/DataGrid/components/Footer/FooterCell/FooterCell.module.css.cjs.map +0 -1
  120. package/dist/components/DataGrid/components/Footer/FooterCell/FooterCell.module.css.js +0 -9
  121. package/dist/components/DataGrid/components/Footer/FooterCell/FooterCell.module.css.js.map +0 -1
  122. package/dist/components/DataGrid/components/GridContainer/Container/Container.module.css.cjs +0 -17
  123. package/dist/components/DataGrid/components/GridContainer/Container/Container.module.css.cjs.map +0 -1
  124. package/dist/components/DataGrid/components/GridContainer/Container/Container.module.css.js +0 -12
  125. package/dist/components/DataGrid/components/GridContainer/Container/Container.module.css.js.map +0 -1
  126. package/dist/components/DataGrid/components/GridContainer/GridContainer.module.css.cjs +0 -11
  127. package/dist/components/DataGrid/components/GridContainer/GridContainer.module.css.cjs.map +0 -1
  128. package/dist/components/DataGrid/components/GridContainer/GridContainer.module.css.js +0 -9
  129. package/dist/components/DataGrid/components/GridContainer/GridContainer.module.css.js.map +0 -1
  130. package/dist/components/DataGrid/components/Header/HeaderCell/HeaderCell.module.css.cjs +0 -19
  131. package/dist/components/DataGrid/components/Header/HeaderCell/HeaderCell.module.css.cjs.map +0 -1
  132. package/dist/components/DataGrid/components/Header/HeaderCell/HeaderCell.module.css.js +0 -13
  133. package/dist/components/DataGrid/components/Header/HeaderCell/HeaderCell.module.css.js.map +0 -1
  134. package/dist/components/DataGrid/components/Header/Resizer/Resizer.module.css.cjs +0 -11
  135. package/dist/components/DataGrid/components/Header/Resizer/Resizer.module.css.cjs.map +0 -1
  136. package/dist/components/DataGrid/components/Header/Resizer/Resizer.module.css.js +0 -9
  137. package/dist/components/DataGrid/components/Header/Resizer/Resizer.module.css.js.map +0 -1
  138. package/dist/utils/isExternalLink.cjs +0 -30
  139. package/dist/utils/isExternalLink.cjs.map +0 -1
  140. package/dist/utils/isExternalLink.d.ts +0 -9
  141. package/dist/utils/isExternalLink.js +0 -27
  142. package/dist/utils/isExternalLink.js.map +0 -1
@@ -0,0 +1,14 @@
1
+ 'use strict';
2
+
3
+ function insertStyle(css) {
4
+ if (!css || typeof window === 'undefined')
5
+ return;
6
+ const style = document.createElement('style');
7
+ style.setAttribute('type', 'text/css');
8
+ style.innerHTML = css;
9
+ document.head.appendChild(style);
10
+ return css;
11
+ }
12
+
13
+ module.exports = insertStyle;
14
+ //# sourceMappingURL=____insertStyle.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"____insertStyle.cjs","sources":["../../___$insertStyle"],"sourcesContent":["export default function insertStyle(css) {\n if (!css || typeof window === 'undefined')\n return;\n const style = document.createElement('style');\n style.setAttribute('type', 'text/css');\n style.innerHTML = css;\n document.head.appendChild(style);\n return css;\n}"],"names":[],"mappings":";;AAAe,SAAS,WAAW,CAAC,GAAG,EAAE;AACzC,IAAI,IAAI,CAAC,GAAG,IAAI,OAAO,MAAM,KAAK,WAAW;AAC7C,QAAQ;AACR,IAAI,MAAM,KAAK,GAAG,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC;AACjD,IAAI,KAAK,CAAC,YAAY,CAAC,MAAM,EAAE,UAAU,CAAC;AAC1C,IAAI,KAAK,CAAC,SAAS,GAAG,GAAG;AACzB,IAAI,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC;AACpC,IAAI,OAAO,GAAG;AACd;;;;"}
@@ -0,0 +1,12 @@
1
+ function insertStyle(css) {
2
+ if (!css || typeof window === 'undefined')
3
+ return;
4
+ const style = document.createElement('style');
5
+ style.setAttribute('type', 'text/css');
6
+ style.innerHTML = css;
7
+ document.head.appendChild(style);
8
+ return css;
9
+ }
10
+
11
+ export { insertStyle as default };
12
+ //# sourceMappingURL=____insertStyle.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"____insertStyle.js","sources":["../../___$insertStyle"],"sourcesContent":["export default function insertStyle(css) {\n if (!css || typeof window === 'undefined')\n return;\n const style = document.createElement('style');\n style.setAttribute('type', 'text/css');\n style.innerHTML = css;\n document.head.appendChild(style);\n return css;\n}"],"names":[],"mappings":"AAAe,SAAS,WAAW,CAAC,GAAG,EAAE;AACzC,IAAI,IAAI,CAAC,GAAG,IAAI,OAAO,MAAM,KAAK,WAAW;AAC7C,QAAQ;AACR,IAAI,MAAM,KAAK,GAAG,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC;AACjD,IAAI,KAAK,CAAC,YAAY,CAAC,MAAM,EAAE,UAAU,CAAC;AAC1C,IAAI,KAAK,CAAC,SAAS,GAAG,GAAG;AACzB,IAAI,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC;AACpC,IAAI,OAAO,GAAG;AACd;;;;"}
@@ -1,20 +1,46 @@
1
1
  'use strict';
2
2
 
3
3
  var React = require('react');
4
+ var sizes = require('../../theme/modules/sizes.cjs');
5
+ var urlUtils = require('./utils/urlUtils.cjs');
4
6
  var styled = require('./styled.cjs');
5
- var isExternalLink = require('../../utils/isExternalLink.cjs');
7
+ var HelpIcon = require('../../tempIcons/HelpIcon.cjs');
8
+ var LaunchIcon = require('../../tempIcons/LaunchIcon.cjs');
9
+ var isExternalLink = require('./isExternalLink.cjs');
6
10
 
7
11
  function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
8
12
 
9
13
  var React__default = /*#__PURE__*/_interopDefaultCompat(React);
10
14
 
11
- const Anchor = ({ children, href, rel, allowedHostnames = isExternalLink.defaultAllowedHostnames, ...props }) => {
12
- // Determine if the link is external based on the allowed hostnames
13
- const isExternal = isExternalLink.isExternalLink(href, allowedHostnames);
14
- // Set default rel property for external links
15
- const setDefaultRelValue = rel || (isExternal ? 'noopener noreferrer' : undefined);
16
- return (React__default.default.createElement(styled.CommonAnchor, { href: href, rel: setDefaultRelValue, ...props }, children));
17
- };
15
+ /**
16
+ * Anchor component for handling context-aware links with consistent functionality and styling options.
17
+ *
18
+ * https://www.figma.com/design/KFfBvJvYT4evKe9eiLEnwD/%F0%9F%8E%A8-Design-System?node-id=1170-63891&m=dev
19
+ *
20
+ * @param variant - The visual style variant ('base' or 'unstyled')
21
+ * @param href - The URL the link points to (will be processed to be context-aware)
22
+ * @param showHelpIcon - Whether to show a help icon on the left (defaults to false)
23
+ * @param children - The content of the anchor
24
+ * @param rest - All other standard anchor HTML attributes
25
+ */
26
+ const Anchor = React__default.default.memo(({ variant = 'base', size = 'base', href, showHelpIcon = false, leftIconSlot = null, hideExternalLinkIcon = false, allowedHostnames = [], children, target, rel, ...rest }) => {
27
+ // Process the URL to make it context-aware
28
+ const processedHref = href ? urlUtils.createContextAwareUrl(href) : undefined;
29
+ // Determine if link is external based on processed href
30
+ const isExternal = processedHref ? isExternalLink.isExternalLink(processedHref, allowedHostnames) : false;
31
+ // Set security attributes for external links if not given in props
32
+ const secureTarget = target || (isExternal ? '_blank' : undefined);
33
+ const secureRel = rel || (isExternal ? 'noopener noreferrer' : undefined);
34
+ // Lookup the appropriate styled component based on variant
35
+ const AnchorComponent = styled.AnchorMapping[variant];
36
+ // Show icon when when link is external and/or will open new tab (and not overridden by variant or hideExternalLinkIcon)
37
+ const shouldShowExternalLinkIcon = (isExternal || secureTarget === '_blank') && !hideExternalLinkIcon && variant === 'base';
38
+ return (React__default.default.createElement(AnchorComponent, { href: processedHref, target: secureTarget, rel: secureRel, size: size, ...rest },
39
+ leftIconSlot,
40
+ showHelpIcon && !leftIconSlot && (React__default.default.createElement(HelpIcon.HelpIcon, { role: "presentation", "data-testid": "help-icon", style: { marginRight: sizes.sizes.xs } })),
41
+ children,
42
+ shouldShowExternalLinkIcon && (React__default.default.createElement(LaunchIcon.LaunchIcon, { role: "presentation", "data-testid": "external-icon", style: { marginLeft: sizes.sizes.xs } }))));
43
+ });
18
44
 
19
45
  exports.Anchor = Anchor;
20
46
  //# sourceMappingURL=Anchor.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"Anchor.cjs","sources":["../../../src/components/Anchor/Anchor.tsx"],"sourcesContent":["import React, { ReactNode, AnchorHTMLAttributes } from 'react';\n\nimport { CommonAnchor } from './styled';\nimport { defaultAllowedHostnames, isExternalLink } from '../../utils/isExternalLink';\n\nexport type AnchorProps = AnchorHTMLAttributes<HTMLAnchorElement> & {\n children?: ReactNode;\n href: string;\n rel?: string;\n allowedHostnames?: string[];\n};\n\nexport const Anchor = ({\n children,\n href,\n rel,\n allowedHostnames = defaultAllowedHostnames,\n ...props\n}: AnchorProps) => {\n // Determine if the link is external based on the allowed hostnames\n const isExternal = isExternalLink(href, allowedHostnames);\n // Set default rel property for external links\n const setDefaultRelValue = rel || (isExternal ? 'noopener noreferrer' : undefined);\n\n return (\n <CommonAnchor href={href} rel={setDefaultRelValue} {...props}>\n {children}\n </CommonAnchor>\n );\n};\n"],"names":["defaultAllowedHostnames","isExternalLink","React","CommonAnchor"],"mappings":";;;;;;;;;;MAYa,MAAM,GAAG,CAAC,EACrB,QAAQ,EACR,IAAI,EACJ,GAAG,EACH,gBAAgB,GAAGA,sCAAuB,EAC1C,GAAG,KAAK,EACI,KAAI;;IAEhB,MAAM,UAAU,GAAGC,6BAAc,CAAC,IAAI,EAAE,gBAAgB,CAAC;;AAEzD,IAAA,MAAM,kBAAkB,GAAG,GAAG,KAAK,UAAU,GAAG,qBAAqB,GAAG,SAAS,CAAC;AAElF,IAAA,QACEC,sBAAC,CAAA,aAAA,CAAAC,mBAAY,EAAC,EAAA,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,kBAAkB,EAAM,GAAA,KAAK,IACzD,QAAQ,CACI;AAEnB;;;;"}
1
+ {"version":3,"file":"Anchor.cjs","sources":["../../../src/components/Anchor/Anchor.tsx"],"sourcesContent":["import React from 'react';\n\nimport { sizes } from 'Theme/modules/sizes';\nimport { createContextAwareUrl } from './utils/urlUtils';\nimport { AnchorProps } from './types';\nimport { AnchorMapping } from './styled';\n\nimport { HelpIcon } from '../../tempIcons/HelpIcon';\nimport { LaunchIcon } from '../../tempIcons/LaunchIcon';\n\nimport { isExternalLink } from './isExternalLink';\n\n/**\n * Anchor component for handling context-aware links with consistent functionality and styling options.\n *\n * https://www.figma.com/design/KFfBvJvYT4evKe9eiLEnwD/%F0%9F%8E%A8-Design-System?node-id=1170-63891&m=dev\n *\n * @param variant - The visual style variant ('base' or 'unstyled')\n * @param href - The URL the link points to (will be processed to be context-aware)\n * @param showHelpIcon - Whether to show a help icon on the left (defaults to false)\n * @param children - The content of the anchor\n * @param rest - All other standard anchor HTML attributes\n */\nexport const Anchor = React.memo(\n ({\n variant = 'base',\n size = 'base',\n href,\n showHelpIcon = false,\n leftIconSlot = null,\n hideExternalLinkIcon = false,\n allowedHostnames = [],\n children,\n target,\n rel,\n ...rest\n }: AnchorProps) => {\n // Process the URL to make it context-aware\n const processedHref = href ? createContextAwareUrl(href) : undefined;\n\n // Determine if link is external based on processed href\n const isExternal = processedHref ? isExternalLink(processedHref, allowedHostnames) : false;\n\n // Set security attributes for external links if not given in props\n const secureTarget = target || (isExternal ? '_blank' : undefined);\n const secureRel = rel || (isExternal ? 'noopener noreferrer' : undefined);\n\n // Lookup the appropriate styled component based on variant\n const AnchorComponent = AnchorMapping[variant];\n\n // Show icon when when link is external and/or will open new tab (and not overridden by variant or hideExternalLinkIcon)\n const shouldShowExternalLinkIcon =\n (isExternal || secureTarget === '_blank') && !hideExternalLinkIcon && variant === 'base';\n\n return (\n <AnchorComponent\n href={processedHref}\n target={secureTarget}\n rel={secureRel}\n size={size}\n {...rest}\n >\n {leftIconSlot}\n {showHelpIcon && !leftIconSlot && (\n <HelpIcon role=\"presentation\" data-testid=\"help-icon\" style={{ marginRight: sizes.xs }} />\n )}\n\n {children}\n {shouldShowExternalLinkIcon && (\n <LaunchIcon\n role=\"presentation\"\n data-testid=\"external-icon\"\n style={{ marginLeft: sizes.xs }}\n />\n )}\n </AnchorComponent>\n );\n },\n);\n"],"names":["React","createContextAwareUrl","isExternalLink","AnchorMapping","HelpIcon","sizes","LaunchIcon"],"mappings":";;;;;;;;;;;;;;AAYA;;;;;;;;;;AAUG;MACU,MAAM,GAAGA,sBAAK,CAAC,IAAI,CAC9B,CAAC,EACC,OAAO,GAAG,MAAM,EAChB,IAAI,GAAG,MAAM,EACb,IAAI,EACJ,YAAY,GAAG,KAAK,EACpB,YAAY,GAAG,IAAI,EACnB,oBAAoB,GAAG,KAAK,EAC5B,gBAAgB,GAAG,EAAE,EACrB,QAAQ,EACR,MAAM,EACN,GAAG,EACH,GAAG,IAAI,EACK,KAAI;;AAEhB,IAAA,MAAM,aAAa,GAAG,IAAI,GAAGC,8BAAqB,CAAC,IAAI,CAAC,GAAG,SAAS;;AAGpE,IAAA,MAAM,UAAU,GAAG,aAAa,GAAGC,6BAAc,CAAC,aAAa,EAAE,gBAAgB,CAAC,GAAG,KAAK;;AAG1F,IAAA,MAAM,YAAY,GAAG,MAAM,KAAK,UAAU,GAAG,QAAQ,GAAG,SAAS,CAAC;AAClE,IAAA,MAAM,SAAS,GAAG,GAAG,KAAK,UAAU,GAAG,qBAAqB,GAAG,SAAS,CAAC;;AAGzE,IAAA,MAAM,eAAe,GAAGC,oBAAa,CAAC,OAAO,CAAC;;AAG9C,IAAA,MAAM,0BAA0B,GAC9B,CAAC,UAAU,IAAI,YAAY,KAAK,QAAQ,KAAK,CAAC,oBAAoB,IAAI,OAAO,KAAK,MAAM;IAE1F,QACEH,qCAAC,eAAe,EAAA,EACd,IAAI,EAAE,aAAa,EACnB,MAAM,EAAE,YAAY,EACpB,GAAG,EAAE,SAAS,EACd,IAAI,EAAE,IAAI,KACN,IAAI,EAAA;QAEP,YAAY;QACZ,YAAY,IAAI,CAAC,YAAY,KAC5BA,qCAACI,iBAAQ,EAAA,EAAC,IAAI,EAAC,cAAc,EAAA,aAAA,EAAa,WAAW,EAAC,KAAK,EAAE,EAAE,WAAW,EAAEC,WAAK,CAAC,EAAE,EAAE,EAAA,CAAI,CAC3F;QAEA,QAAQ;QACR,0BAA0B,KACzBL,sBAAA,CAAA,aAAA,CAACM,qBAAU,EAAA,EACT,IAAI,EAAC,cAAc,EACP,aAAA,EAAA,eAAe,EAC3B,KAAK,EAAE,EAAE,UAAU,EAAED,WAAK,CAAC,EAAE,EAAE,EAC/B,CAAA,CACH,CACe;AAEtB,CAAC;;;;"}
@@ -1,8 +1,14 @@
1
- import React, { ReactNode, AnchorHTMLAttributes } from 'react';
2
- export type AnchorProps = AnchorHTMLAttributes<HTMLAnchorElement> & {
3
- children?: ReactNode;
4
- href: string;
5
- rel?: string;
6
- allowedHostnames?: string[];
7
- };
8
- export declare const Anchor: ({ children, href, rel, allowedHostnames, ...props }: AnchorProps) => React.JSX.Element;
1
+ import React from 'react';
2
+ import { AnchorProps } from './types';
3
+ /**
4
+ * Anchor component for handling context-aware links with consistent functionality and styling options.
5
+ *
6
+ * https://www.figma.com/design/KFfBvJvYT4evKe9eiLEnwD/%F0%9F%8E%A8-Design-System?node-id=1170-63891&m=dev
7
+ *
8
+ * @param variant - The visual style variant ('base' or 'unstyled')
9
+ * @param href - The URL the link points to (will be processed to be context-aware)
10
+ * @param showHelpIcon - Whether to show a help icon on the left (defaults to false)
11
+ * @param children - The content of the anchor
12
+ * @param rest - All other standard anchor HTML attributes
13
+ */
14
+ export declare const Anchor: React.MemoExoticComponent<({ variant, size, href, showHelpIcon, leftIconSlot, hideExternalLinkIcon, allowedHostnames, children, target, rel, ...rest }: AnchorProps) => React.JSX.Element>;
@@ -1,14 +1,40 @@
1
1
  import React__default from 'react';
2
- import { CommonAnchor } from './styled.js';
3
- import { isExternalLink, defaultAllowedHostnames } from '../../utils/isExternalLink.js';
2
+ import { sizes } from '../../theme/modules/sizes.js';
3
+ import { createContextAwareUrl } from './utils/urlUtils.js';
4
+ import { AnchorMapping } from './styled.js';
5
+ import { HelpIcon } from '../../tempIcons/HelpIcon.js';
6
+ import { LaunchIcon } from '../../tempIcons/LaunchIcon.js';
7
+ import { isExternalLink } from './isExternalLink.js';
4
8
 
5
- const Anchor = ({ children, href, rel, allowedHostnames = defaultAllowedHostnames, ...props }) => {
6
- // Determine if the link is external based on the allowed hostnames
7
- const isExternal = isExternalLink(href, allowedHostnames);
8
- // Set default rel property for external links
9
- const setDefaultRelValue = rel || (isExternal ? 'noopener noreferrer' : undefined);
10
- return (React__default.createElement(CommonAnchor, { href: href, rel: setDefaultRelValue, ...props }, children));
11
- };
9
+ /**
10
+ * Anchor component for handling context-aware links with consistent functionality and styling options.
11
+ *
12
+ * https://www.figma.com/design/KFfBvJvYT4evKe9eiLEnwD/%F0%9F%8E%A8-Design-System?node-id=1170-63891&m=dev
13
+ *
14
+ * @param variant - The visual style variant ('base' or 'unstyled')
15
+ * @param href - The URL the link points to (will be processed to be context-aware)
16
+ * @param showHelpIcon - Whether to show a help icon on the left (defaults to false)
17
+ * @param children - The content of the anchor
18
+ * @param rest - All other standard anchor HTML attributes
19
+ */
20
+ const Anchor = React__default.memo(({ variant = 'base', size = 'base', href, showHelpIcon = false, leftIconSlot = null, hideExternalLinkIcon = false, allowedHostnames = [], children, target, rel, ...rest }) => {
21
+ // Process the URL to make it context-aware
22
+ const processedHref = href ? createContextAwareUrl(href) : undefined;
23
+ // Determine if link is external based on processed href
24
+ const isExternal = processedHref ? isExternalLink(processedHref, allowedHostnames) : false;
25
+ // Set security attributes for external links if not given in props
26
+ const secureTarget = target || (isExternal ? '_blank' : undefined);
27
+ const secureRel = rel || (isExternal ? 'noopener noreferrer' : undefined);
28
+ // Lookup the appropriate styled component based on variant
29
+ const AnchorComponent = AnchorMapping[variant];
30
+ // Show icon when when link is external and/or will open new tab (and not overridden by variant or hideExternalLinkIcon)
31
+ const shouldShowExternalLinkIcon = (isExternal || secureTarget === '_blank') && !hideExternalLinkIcon && variant === 'base';
32
+ return (React__default.createElement(AnchorComponent, { href: processedHref, target: secureTarget, rel: secureRel, size: size, ...rest },
33
+ leftIconSlot,
34
+ showHelpIcon && !leftIconSlot && (React__default.createElement(HelpIcon, { role: "presentation", "data-testid": "help-icon", style: { marginRight: sizes.xs } })),
35
+ children,
36
+ shouldShowExternalLinkIcon && (React__default.createElement(LaunchIcon, { role: "presentation", "data-testid": "external-icon", style: { marginLeft: sizes.xs } }))));
37
+ });
12
38
 
13
39
  export { Anchor };
14
40
  //# sourceMappingURL=Anchor.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Anchor.js","sources":["../../../src/components/Anchor/Anchor.tsx"],"sourcesContent":["import React, { ReactNode, AnchorHTMLAttributes } from 'react';\n\nimport { CommonAnchor } from './styled';\nimport { defaultAllowedHostnames, isExternalLink } from '../../utils/isExternalLink';\n\nexport type AnchorProps = AnchorHTMLAttributes<HTMLAnchorElement> & {\n children?: ReactNode;\n href: string;\n rel?: string;\n allowedHostnames?: string[];\n};\n\nexport const Anchor = ({\n children,\n href,\n rel,\n allowedHostnames = defaultAllowedHostnames,\n ...props\n}: AnchorProps) => {\n // Determine if the link is external based on the allowed hostnames\n const isExternal = isExternalLink(href, allowedHostnames);\n // Set default rel property for external links\n const setDefaultRelValue = rel || (isExternal ? 'noopener noreferrer' : undefined);\n\n return (\n <CommonAnchor href={href} rel={setDefaultRelValue} {...props}>\n {children}\n </CommonAnchor>\n );\n};\n"],"names":["React"],"mappings":";;;;MAYa,MAAM,GAAG,CAAC,EACrB,QAAQ,EACR,IAAI,EACJ,GAAG,EACH,gBAAgB,GAAG,uBAAuB,EAC1C,GAAG,KAAK,EACI,KAAI;;IAEhB,MAAM,UAAU,GAAG,cAAc,CAAC,IAAI,EAAE,gBAAgB,CAAC;;AAEzD,IAAA,MAAM,kBAAkB,GAAG,GAAG,KAAK,UAAU,GAAG,qBAAqB,GAAG,SAAS,CAAC;AAElF,IAAA,QACEA,cAAC,CAAA,aAAA,CAAA,YAAY,EAAC,EAAA,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,kBAAkB,EAAM,GAAA,KAAK,IACzD,QAAQ,CACI;AAEnB;;;;"}
1
+ {"version":3,"file":"Anchor.js","sources":["../../../src/components/Anchor/Anchor.tsx"],"sourcesContent":["import React from 'react';\n\nimport { sizes } from 'Theme/modules/sizes';\nimport { createContextAwareUrl } from './utils/urlUtils';\nimport { AnchorProps } from './types';\nimport { AnchorMapping } from './styled';\n\nimport { HelpIcon } from '../../tempIcons/HelpIcon';\nimport { LaunchIcon } from '../../tempIcons/LaunchIcon';\n\nimport { isExternalLink } from './isExternalLink';\n\n/**\n * Anchor component for handling context-aware links with consistent functionality and styling options.\n *\n * https://www.figma.com/design/KFfBvJvYT4evKe9eiLEnwD/%F0%9F%8E%A8-Design-System?node-id=1170-63891&m=dev\n *\n * @param variant - The visual style variant ('base' or 'unstyled')\n * @param href - The URL the link points to (will be processed to be context-aware)\n * @param showHelpIcon - Whether to show a help icon on the left (defaults to false)\n * @param children - The content of the anchor\n * @param rest - All other standard anchor HTML attributes\n */\nexport const Anchor = React.memo(\n ({\n variant = 'base',\n size = 'base',\n href,\n showHelpIcon = false,\n leftIconSlot = null,\n hideExternalLinkIcon = false,\n allowedHostnames = [],\n children,\n target,\n rel,\n ...rest\n }: AnchorProps) => {\n // Process the URL to make it context-aware\n const processedHref = href ? createContextAwareUrl(href) : undefined;\n\n // Determine if link is external based on processed href\n const isExternal = processedHref ? isExternalLink(processedHref, allowedHostnames) : false;\n\n // Set security attributes for external links if not given in props\n const secureTarget = target || (isExternal ? '_blank' : undefined);\n const secureRel = rel || (isExternal ? 'noopener noreferrer' : undefined);\n\n // Lookup the appropriate styled component based on variant\n const AnchorComponent = AnchorMapping[variant];\n\n // Show icon when when link is external and/or will open new tab (and not overridden by variant or hideExternalLinkIcon)\n const shouldShowExternalLinkIcon =\n (isExternal || secureTarget === '_blank') && !hideExternalLinkIcon && variant === 'base';\n\n return (\n <AnchorComponent\n href={processedHref}\n target={secureTarget}\n rel={secureRel}\n size={size}\n {...rest}\n >\n {leftIconSlot}\n {showHelpIcon && !leftIconSlot && (\n <HelpIcon role=\"presentation\" data-testid=\"help-icon\" style={{ marginRight: sizes.xs }} />\n )}\n\n {children}\n {shouldShowExternalLinkIcon && (\n <LaunchIcon\n role=\"presentation\"\n data-testid=\"external-icon\"\n style={{ marginLeft: sizes.xs }}\n />\n )}\n </AnchorComponent>\n );\n },\n);\n"],"names":["React"],"mappings":";;;;;;;;AAYA;;;;;;;;;;AAUG;MACU,MAAM,GAAGA,cAAK,CAAC,IAAI,CAC9B,CAAC,EACC,OAAO,GAAG,MAAM,EAChB,IAAI,GAAG,MAAM,EACb,IAAI,EACJ,YAAY,GAAG,KAAK,EACpB,YAAY,GAAG,IAAI,EACnB,oBAAoB,GAAG,KAAK,EAC5B,gBAAgB,GAAG,EAAE,EACrB,QAAQ,EACR,MAAM,EACN,GAAG,EACH,GAAG,IAAI,EACK,KAAI;;AAEhB,IAAA,MAAM,aAAa,GAAG,IAAI,GAAG,qBAAqB,CAAC,IAAI,CAAC,GAAG,SAAS;;AAGpE,IAAA,MAAM,UAAU,GAAG,aAAa,GAAG,cAAc,CAAC,aAAa,EAAE,gBAAgB,CAAC,GAAG,KAAK;;AAG1F,IAAA,MAAM,YAAY,GAAG,MAAM,KAAK,UAAU,GAAG,QAAQ,GAAG,SAAS,CAAC;AAClE,IAAA,MAAM,SAAS,GAAG,GAAG,KAAK,UAAU,GAAG,qBAAqB,GAAG,SAAS,CAAC;;AAGzE,IAAA,MAAM,eAAe,GAAG,aAAa,CAAC,OAAO,CAAC;;AAG9C,IAAA,MAAM,0BAA0B,GAC9B,CAAC,UAAU,IAAI,YAAY,KAAK,QAAQ,KAAK,CAAC,oBAAoB,IAAI,OAAO,KAAK,MAAM;IAE1F,QACEA,6BAAC,eAAe,EAAA,EACd,IAAI,EAAE,aAAa,EACnB,MAAM,EAAE,YAAY,EACpB,GAAG,EAAE,SAAS,EACd,IAAI,EAAE,IAAI,KACN,IAAI,EAAA;QAEP,YAAY;QACZ,YAAY,IAAI,CAAC,YAAY,KAC5BA,6BAAC,QAAQ,EAAA,EAAC,IAAI,EAAC,cAAc,EAAA,aAAA,EAAa,WAAW,EAAC,KAAK,EAAE,EAAE,WAAW,EAAE,KAAK,CAAC,EAAE,EAAE,EAAA,CAAI,CAC3F;QAEA,QAAQ;QACR,0BAA0B,KACzBA,cAAA,CAAA,aAAA,CAAC,UAAU,EAAA,EACT,IAAI,EAAC,cAAc,EACP,aAAA,EAAA,eAAe,EAC3B,KAAK,EAAE,EAAE,UAAU,EAAE,KAAK,CAAC,EAAE,EAAE,EAC/B,CAAA,CACH,CACe;AAEtB,CAAC;;;;"}
@@ -1 +1,2 @@
1
- export { Anchor } from './Anchor';
1
+ export * from './Anchor';
2
+ export * from './types';
@@ -0,0 +1,37 @@
1
+ 'use strict';
2
+
3
+ var urlUtils = require('./utils/urlUtils.cjs');
4
+
5
+ // Default empty array for backward compatibility
6
+ const DEFAULT_ALLOWED_HOSTNAMES = [];
7
+ /**
8
+ * Check if a URL/path string is an external link
9
+ *
10
+ * External links are any that would take the user away from their current domain,
11
+ * with relative paths considered internal, but any other domain (including
12
+ * other veeqo.com subdomains like help.veeqo.com) considered external.
13
+ *
14
+ * @param {string} urlOrPath - URL or path to check
15
+ * @param {string[]} allowedHostnames - Optional list of allowed hostnames to consider as internal
16
+ * @returns {boolean} Whether the URL is external
17
+ */
18
+ function isExternalLink(urlOrPath, allowedHostnames = DEFAULT_ALLOWED_HOSTNAMES) {
19
+ var _a, _b, _c;
20
+ if (urlUtils.isRelativeUrl(urlOrPath))
21
+ return false;
22
+ // For protocol-relative URLs, prepend 'http:' to properly parse
23
+ const { hostname } = new URL(urlOrPath.startsWith('//') ? `http:${urlOrPath}` : urlOrPath);
24
+ const requestHostname = hostname.toLowerCase();
25
+ const currentHostname = ((_c = (_b = (_a = window.location) === null || _a === undefined ? undefined : _a.hostname) === null || _b === undefined ? undefined : _b.toLowerCase) === null || _c === undefined ? undefined : _c.call(_b)) || '';
26
+ // Check if hostname is in the allowed list
27
+ if (allowedHostnames.length > 0 &&
28
+ allowedHostnames.some((allowed) => allowed.toLowerCase() === requestHostname)) {
29
+ return false;
30
+ }
31
+ // Only treat as internal if it's the exact same hostname as current
32
+ return requestHostname !== currentHostname;
33
+ }
34
+
35
+ exports.DEFAULT_ALLOWED_HOSTNAMES = DEFAULT_ALLOWED_HOSTNAMES;
36
+ exports.isExternalLink = isExternalLink;
37
+ //# sourceMappingURL=isExternalLink.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"isExternalLink.cjs","sources":["../../../src/components/Anchor/isExternalLink.ts"],"sourcesContent":["import { isRelativeUrl } from './utils/urlUtils';\n\n// Default empty array for backward compatibility\nexport const DEFAULT_ALLOWED_HOSTNAMES: string[] = [];\n\n/**\n * Check if a URL/path string is an external link\n *\n * External links are any that would take the user away from their current domain,\n * with relative paths considered internal, but any other domain (including\n * other veeqo.com subdomains like help.veeqo.com) considered external.\n *\n * @param {string} urlOrPath - URL or path to check\n * @param {string[]} allowedHostnames - Optional list of allowed hostnames to consider as internal\n * @returns {boolean} Whether the URL is external\n */\nexport function isExternalLink(\n urlOrPath: string,\n allowedHostnames: string[] = DEFAULT_ALLOWED_HOSTNAMES,\n): boolean {\n if (isRelativeUrl(urlOrPath)) return false;\n\n // For protocol-relative URLs, prepend 'http:' to properly parse\n const { hostname } = new URL(urlOrPath.startsWith('//') ? `http:${urlOrPath}` : urlOrPath);\n\n const requestHostname = hostname.toLowerCase();\n const currentHostname = window.location?.hostname?.toLowerCase?.() || '';\n\n // Check if hostname is in the allowed list\n if (\n allowedHostnames.length > 0 &&\n allowedHostnames.some((allowed) => allowed.toLowerCase() === requestHostname)\n ) {\n return false;\n }\n\n // Only treat as internal if it's the exact same hostname as current\n return requestHostname !== currentHostname;\n}\n"],"names":["isRelativeUrl"],"mappings":";;;;AAEA;AACO,MAAM,yBAAyB,GAAa;AAEnD;;;;;;;;;;AAUG;SACa,cAAc,CAC5B,SAAiB,EACjB,mBAA6B,yBAAyB,EAAA;;IAEtD,IAAIA,sBAAa,CAAC,SAAS,CAAC;AAAE,QAAA,OAAO,KAAK;;IAG1C,MAAM,EAAE,QAAQ,EAAE,GAAG,IAAI,GAAG,CAAC,SAAS,CAAC,UAAU,CAAC,IAAI,CAAC,GAAG,CAAA,KAAA,EAAQ,SAAS,CAAA,CAAE,GAAG,SAAS,CAAC;AAE1F,IAAA,MAAM,eAAe,GAAG,QAAQ,CAAC,WAAW,EAAE;AAC9C,IAAA,MAAM,eAAe,GAAG,CAAA,CAAA,EAAA,GAAA,CAAA,EAAA,GAAA,MAAA,MAAM,CAAC,QAAQ,MAAA,IAAA,IAAA,EAAA,KAAA,SAAA,GAAA,SAAA,GAAA,EAAA,CAAE,QAAQ,MAAE,IAAA,IAAA,EAAA,KAAA,SAAA,GAAA,SAAA,GAAA,EAAA,CAAA,WAAW,MAAI,IAAA,IAAA,EAAA,KAAA,SAAA,GAAA,SAAA,GAAA,EAAA,CAAA,IAAA,CAAA,EAAA,CAAA,KAAI,EAAE;;AAGxE,IAAA,IACE,gBAAgB,CAAC,MAAM,GAAG,CAAC;AAC3B,QAAA,gBAAgB,CAAC,IAAI,CAAC,CAAC,OAAO,KAAK,OAAO,CAAC,WAAW,EAAE,KAAK,eAAe,CAAC,EAC7E;AACA,QAAA,OAAO,KAAK;AACb;;IAGD,OAAO,eAAe,KAAK,eAAe;AAC5C;;;;;"}
@@ -0,0 +1,13 @@
1
+ export declare const DEFAULT_ALLOWED_HOSTNAMES: string[];
2
+ /**
3
+ * Check if a URL/path string is an external link
4
+ *
5
+ * External links are any that would take the user away from their current domain,
6
+ * with relative paths considered internal, but any other domain (including
7
+ * other veeqo.com subdomains like help.veeqo.com) considered external.
8
+ *
9
+ * @param {string} urlOrPath - URL or path to check
10
+ * @param {string[]} allowedHostnames - Optional list of allowed hostnames to consider as internal
11
+ * @returns {boolean} Whether the URL is external
12
+ */
13
+ export declare function isExternalLink(urlOrPath: string, allowedHostnames?: string[]): boolean;
@@ -0,0 +1,34 @@
1
+ import { isRelativeUrl } from './utils/urlUtils.js';
2
+
3
+ // Default empty array for backward compatibility
4
+ const DEFAULT_ALLOWED_HOSTNAMES = [];
5
+ /**
6
+ * Check if a URL/path string is an external link
7
+ *
8
+ * External links are any that would take the user away from their current domain,
9
+ * with relative paths considered internal, but any other domain (including
10
+ * other veeqo.com subdomains like help.veeqo.com) considered external.
11
+ *
12
+ * @param {string} urlOrPath - URL or path to check
13
+ * @param {string[]} allowedHostnames - Optional list of allowed hostnames to consider as internal
14
+ * @returns {boolean} Whether the URL is external
15
+ */
16
+ function isExternalLink(urlOrPath, allowedHostnames = DEFAULT_ALLOWED_HOSTNAMES) {
17
+ var _a, _b, _c;
18
+ if (isRelativeUrl(urlOrPath))
19
+ return false;
20
+ // For protocol-relative URLs, prepend 'http:' to properly parse
21
+ const { hostname } = new URL(urlOrPath.startsWith('//') ? `http:${urlOrPath}` : urlOrPath);
22
+ const requestHostname = hostname.toLowerCase();
23
+ const currentHostname = ((_c = (_b = (_a = window.location) === null || _a === undefined ? undefined : _a.hostname) === null || _b === undefined ? undefined : _b.toLowerCase) === null || _c === undefined ? undefined : _c.call(_b)) || '';
24
+ // Check if hostname is in the allowed list
25
+ if (allowedHostnames.length > 0 &&
26
+ allowedHostnames.some((allowed) => allowed.toLowerCase() === requestHostname)) {
27
+ return false;
28
+ }
29
+ // Only treat as internal if it's the exact same hostname as current
30
+ return requestHostname !== currentHostname;
31
+ }
32
+
33
+ export { DEFAULT_ALLOWED_HOSTNAMES, isExternalLink };
34
+ //# sourceMappingURL=isExternalLink.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"isExternalLink.js","sources":["../../../src/components/Anchor/isExternalLink.ts"],"sourcesContent":["import { isRelativeUrl } from './utils/urlUtils';\n\n// Default empty array for backward compatibility\nexport const DEFAULT_ALLOWED_HOSTNAMES: string[] = [];\n\n/**\n * Check if a URL/path string is an external link\n *\n * External links are any that would take the user away from their current domain,\n * with relative paths considered internal, but any other domain (including\n * other veeqo.com subdomains like help.veeqo.com) considered external.\n *\n * @param {string} urlOrPath - URL or path to check\n * @param {string[]} allowedHostnames - Optional list of allowed hostnames to consider as internal\n * @returns {boolean} Whether the URL is external\n */\nexport function isExternalLink(\n urlOrPath: string,\n allowedHostnames: string[] = DEFAULT_ALLOWED_HOSTNAMES,\n): boolean {\n if (isRelativeUrl(urlOrPath)) return false;\n\n // For protocol-relative URLs, prepend 'http:' to properly parse\n const { hostname } = new URL(urlOrPath.startsWith('//') ? `http:${urlOrPath}` : urlOrPath);\n\n const requestHostname = hostname.toLowerCase();\n const currentHostname = window.location?.hostname?.toLowerCase?.() || '';\n\n // Check if hostname is in the allowed list\n if (\n allowedHostnames.length > 0 &&\n allowedHostnames.some((allowed) => allowed.toLowerCase() === requestHostname)\n ) {\n return false;\n }\n\n // Only treat as internal if it's the exact same hostname as current\n return requestHostname !== currentHostname;\n}\n"],"names":[],"mappings":";;AAEA;AACO,MAAM,yBAAyB,GAAa;AAEnD;;;;;;;;;;AAUG;SACa,cAAc,CAC5B,SAAiB,EACjB,mBAA6B,yBAAyB,EAAA;;IAEtD,IAAI,aAAa,CAAC,SAAS,CAAC;AAAE,QAAA,OAAO,KAAK;;IAG1C,MAAM,EAAE,QAAQ,EAAE,GAAG,IAAI,GAAG,CAAC,SAAS,CAAC,UAAU,CAAC,IAAI,CAAC,GAAG,CAAA,KAAA,EAAQ,SAAS,CAAA,CAAE,GAAG,SAAS,CAAC;AAE1F,IAAA,MAAM,eAAe,GAAG,QAAQ,CAAC,WAAW,EAAE;AAC9C,IAAA,MAAM,eAAe,GAAG,CAAA,CAAA,EAAA,GAAA,CAAA,EAAA,GAAA,MAAA,MAAM,CAAC,QAAQ,MAAA,IAAA,IAAA,EAAA,KAAA,SAAA,GAAA,SAAA,GAAA,EAAA,CAAE,QAAQ,MAAE,IAAA,IAAA,EAAA,KAAA,SAAA,GAAA,SAAA,GAAA,EAAA,CAAA,WAAW,MAAI,IAAA,IAAA,EAAA,KAAA,SAAA,GAAA,SAAA,GAAA,EAAA,CAAA,IAAA,CAAA,EAAA,CAAA,KAAI,EAAE;;AAGxE,IAAA,IACE,gBAAgB,CAAC,MAAM,GAAG,CAAC;AAC3B,QAAA,gBAAgB,CAAC,IAAI,CAAC,CAAC,OAAO,KAAK,OAAO,CAAC,WAAW,EAAE,KAAK,eAAe,CAAC,EAC7E;AACA,QAAA,OAAO,KAAK;AACb;;IAGD,OAAO,eAAe,KAAK,eAAe;AAC5C;;;;"}
@@ -1,13 +1,38 @@
1
1
  'use strict';
2
2
 
3
3
  var styled = require('styled-components');
4
+ var utils = require('../../theme/utils.cjs');
4
5
  var index = require('../../theme/index.cjs');
5
6
 
6
7
  function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
7
8
 
8
9
  var styled__default = /*#__PURE__*/_interopDefaultCompat(styled);
9
10
 
10
- const CommonAnchor = styled__default.default.a.withConfig({ displayName: "vui--CommonAnchor", componentId: "vui--14i39s8" }) `box-sizing:border-box;display:inline-flex;margin:0;padding:0;font-family:${index.theme.text.link.fontFamily};font-style:${index.theme.text.link.fontStyle};font-weight:${index.theme.text.link.fontWeight};font-size:${index.theme.text.link.fontSize};line-height:${index.theme.text.link.lineHeight};color:${index.theme.colors.secondary.blue.base};text-decoration:${index.theme.text.link.textDecoration};&:hover{color:${index.theme.colors.secondary.blue.dark};}`;
11
+ const sizeMappings = {
12
+ lg: index.theme.sizes.md,
13
+ md: index.theme.sizes[5],
14
+ base: index.theme.sizes.base,
15
+ sm: index.theme.sizes[3],
16
+ };
17
+ const styleMappings = {
18
+ lg: 'linkLarge',
19
+ md: 'linkMedium',
20
+ base: 'link',
21
+ sm: 'linkSmall',
22
+ };
23
+ const UnstyledAnchor = styled__default.default.a.withConfig({ displayName: "vui--UnstyledAnchor", componentId: "vui--1af0loc" }) ``;
24
+ // Standard variant styling
25
+ const StandardAnchor = styled__default.default(UnstyledAnchor).withConfig({ displayName: "vui--StandardAnchor", componentId: "vui--k5ndq9" }) `display:inline-flex;align-items:center;cursor:pointer;transition:color 0.1s ease;text-decoration:none;padding:0 2px;${({ size }) => utils.getTextStyles(index.theme.text[styleMappings[size]])};&:focus{outline:0;border-color:${index.theme.colors.secondary.blue.dark};border-radius:${index.theme.radius.base};box-shadow:0 0 0 2px ${index.theme.colors.secondary.blue.light};}&:hover{color:${index.theme.colors.secondary.blue.dark};}svg{width:${({ size }) => sizeMappings[size]};height:${({ size }) => sizeMappings[size]};vertical-align:middle;}`;
26
+ // Inherit font size and line height from parent
27
+ const InheritAnchor = styled__default.default(StandardAnchor).withConfig({ displayName: "vui--InheritAnchor", componentId: "vui--ut8az0" }) `font-size:inherit;line-height:inherit;`;
28
+ const AnchorMapping = {
29
+ base: StandardAnchor,
30
+ unstyled: UnstyledAnchor,
31
+ inherit: InheritAnchor,
32
+ };
11
33
 
12
- exports.CommonAnchor = CommonAnchor;
34
+ exports.AnchorMapping = AnchorMapping;
35
+ exports.InheritAnchor = InheritAnchor;
36
+ exports.StandardAnchor = StandardAnchor;
37
+ exports.UnstyledAnchor = UnstyledAnchor;
13
38
  //# sourceMappingURL=styled.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"styled.cjs","sources":["../../../src/components/Anchor/styled.ts"],"sourcesContent":["import styled from 'styled-components';\n\nimport { theme } from '../../theme';\n\nexport const CommonAnchor = styled.a`\n box-sizing: border-box;\n display: inline-flex;\n margin: 0;\n padding: 0;\n\n font-family: ${theme.text.link.fontFamily};\n font-style: ${theme.text.link.fontStyle};\n font-weight: ${theme.text.link.fontWeight};\n font-size: ${theme.text.link.fontSize};\n line-height: ${theme.text.link.lineHeight};\n color: ${theme.colors.secondary.blue.base};\n text-decoration: ${theme.text.link.textDecoration};\n\n &:hover {\n color: ${theme.colors.secondary.blue.dark};\n }\n`;\n"],"names":["styled","theme"],"mappings":";;;;;;;;;AAIa,MAAA,YAAY,GAAGA,uBAAM,CAAC,CAAC,CAAA,UAAA,CAAA,EAAA,WAAA,EAAA,mBAAA,EAAA,WAAA,EAAA,cAAA,EAAA,CAAA,CAAA,CAAA,yEAAA,EAMnBC,WAAK,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,eAC3BA,WAAK,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CACxB,aAAA,EAAAA,WAAK,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAC5B,WAAA,EAAAA,WAAK,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAA,aAAA,EACtBA,WAAK,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAA,OAAA,EAChCA,WAAK,CAAC,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAA,iBAAA,EACtBA,WAAK,CAAC,IAAI,CAAC,IAAI,CAAC,cAAc,kBAGtCA,WAAK,CAAC,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI;;;;"}
1
+ {"version":3,"file":"styled.cjs","sources":["../../../src/components/Anchor/styled.ts"],"sourcesContent":["import styled, { StyledComponent } from 'styled-components';\nimport { getTextStyles } from '../../theme/utils';\nimport { theme } from '../../theme';\nimport { AnchorProps, AnchorSize } from './types';\n\ntype StyledAnchorProps = {\n size: AnchorSize;\n};\n\nconst sizeMappings: Record<StyledAnchorProps['size'], string> = {\n lg: theme.sizes.md,\n md: theme.sizes[5],\n base: theme.sizes.base,\n sm: theme.sizes[3],\n};\n\nconst styleMappings: Record<StyledAnchorProps['size'], string> = {\n lg: 'linkLarge',\n md: 'linkMedium',\n base: 'link',\n sm: 'linkSmall',\n};\n\nexport const UnstyledAnchor = styled.a<StyledAnchorProps>``;\n\n// Standard variant styling\nexport const StandardAnchor = styled(UnstyledAnchor)<StyledAnchorProps>`\n display: inline-flex;\n align-items: center;\n\n cursor: pointer;\n transition: color 0.1s ease;\n text-decoration: none;\n padding: 0 2px;\n\n ${({ size }) => getTextStyles(theme.text[styleMappings[size]])};\n\n &:focus {\n outline: 0;\n border-color: ${theme.colors.secondary.blue.dark};\n border-radius: ${theme.radius.base};\n box-shadow: 0 0 0 2px ${theme.colors.secondary.blue.light};\n }\n\n &:hover {\n color: ${theme.colors.secondary.blue.dark};\n }\n\n svg {\n width: ${({ size }) => sizeMappings[size]};\n height: ${({ size }) => sizeMappings[size]};\n vertical-align: middle;\n }\n`;\n\n// Inherit font size and line height from parent\nexport const InheritAnchor = styled(StandardAnchor)<StyledAnchorProps>`\n font-size: inherit;\n line-height: inherit;\n`;\n\nexport const AnchorMapping: Record<\n NonNullable<AnchorProps['variant']>,\n StyledComponent<'a', any, StyledAnchorProps>\n> = {\n base: StandardAnchor,\n unstyled: UnstyledAnchor,\n inherit: InheritAnchor,\n};\n"],"names":["theme","styled","getTextStyles"],"mappings":";;;;;;;;;;AASA,MAAM,YAAY,GAA8C;AAC9D,IAAA,EAAE,EAAEA,WAAK,CAAC,KAAK,CAAC,EAAE;AAClB,IAAA,EAAE,EAAEA,WAAK,CAAC,KAAK,CAAC,CAAC,CAAC;AAClB,IAAA,IAAI,EAAEA,WAAK,CAAC,KAAK,CAAC,IAAI;AACtB,IAAA,EAAE,EAAEA,WAAK,CAAC,KAAK,CAAC,CAAC,CAAC;CACnB;AAED,MAAM,aAAa,GAA8C;AAC/D,IAAA,EAAE,EAAE,WAAW;AACf,IAAA,EAAE,EAAE,YAAY;AAChB,IAAA,IAAI,EAAE,MAAM;AACZ,IAAA,EAAE,EAAE,WAAW;CAChB;MAEY,cAAc,GAAGC,uBAAM,CAAC,CAAC;AAEtC;AACa,MAAA,cAAc,GAAGA,uBAAM,CAAC,cAAc,CAAC,CAAA,UAAA,CAAA,EAAA,WAAA,EAAA,qBAAA,EAAA,WAAA,EAAA,aAAA,EAAA,CAAA,CAAA,CAAA,oHAAA,EAShD,CAAC,EAAE,IAAI,EAAE,KAAKC,mBAAa,CAACF,WAAK,CAAC,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA,gCAAA,EAI5CA,WAAK,CAAC,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,kBAC/BA,WAAK,CAAC,MAAM,CAAC,IAAI,CACV,sBAAA,EAAAA,WAAK,CAAC,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAA,gBAAA,EAIhDA,WAAK,CAAC,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,eAIhC,CAAC,EAAE,IAAI,EAAE,KAAK,YAAY,CAAC,IAAI,CAAC,WAC/B,CAAC,EAAE,IAAI,EAAE,KAAK,YAAY,CAAC,IAAI,CAAC;AAK9C;MACa,aAAa,GAAGC,uBAAM,CAAC,cAAc,CAAC,CAAA,UAAA,CAAA,EAAA,WAAA,EAAA,oBAAA,EAAA,WAAA,EAAA,aAAA,EAAA,CAAA,CAAA,CAAA,sCAAA;AAKtC,MAAA,aAAa,GAGtB;AACF,IAAA,IAAI,EAAE,cAAc;AACpB,IAAA,QAAQ,EAAE,cAAc;AACxB,IAAA,OAAO,EAAE,aAAa;;;;;;;;"}
@@ -1 +1,10 @@
1
- export declare const CommonAnchor: import("styled-components").StyledComponent<"a", any, {}, never>;
1
+ import { StyledComponent } from 'styled-components';
2
+ import { AnchorProps, AnchorSize } from './types';
3
+ type StyledAnchorProps = {
4
+ size: AnchorSize;
5
+ };
6
+ export declare const UnstyledAnchor: StyledComponent<"a", any, StyledAnchorProps, never>;
7
+ export declare const StandardAnchor: StyledComponent<"a", any, StyledAnchorProps, never>;
8
+ export declare const InheritAnchor: StyledComponent<"a", any, StyledAnchorProps, never>;
9
+ export declare const AnchorMapping: Record<NonNullable<AnchorProps['variant']>, StyledComponent<'a', any, StyledAnchorProps>>;
10
+ export {};
@@ -1,7 +1,29 @@
1
1
  import styled from 'styled-components';
2
+ import { getTextStyles } from '../../theme/utils.js';
2
3
  import { theme } from '../../theme/index.js';
3
4
 
4
- const CommonAnchor = styled.a.withConfig({ displayName: "vui--CommonAnchor", componentId: "vui--14i39s8" }) `box-sizing:border-box;display:inline-flex;margin:0;padding:0;font-family:${theme.text.link.fontFamily};font-style:${theme.text.link.fontStyle};font-weight:${theme.text.link.fontWeight};font-size:${theme.text.link.fontSize};line-height:${theme.text.link.lineHeight};color:${theme.colors.secondary.blue.base};text-decoration:${theme.text.link.textDecoration};&:hover{color:${theme.colors.secondary.blue.dark};}`;
5
+ const sizeMappings = {
6
+ lg: theme.sizes.md,
7
+ md: theme.sizes[5],
8
+ base: theme.sizes.base,
9
+ sm: theme.sizes[3],
10
+ };
11
+ const styleMappings = {
12
+ lg: 'linkLarge',
13
+ md: 'linkMedium',
14
+ base: 'link',
15
+ sm: 'linkSmall',
16
+ };
17
+ const UnstyledAnchor = styled.a.withConfig({ displayName: "vui--UnstyledAnchor", componentId: "vui--1af0loc" }) ``;
18
+ // Standard variant styling
19
+ const StandardAnchor = styled(UnstyledAnchor).withConfig({ displayName: "vui--StandardAnchor", componentId: "vui--k5ndq9" }) `display:inline-flex;align-items:center;cursor:pointer;transition:color 0.1s ease;text-decoration:none;padding:0 2px;${({ size }) => getTextStyles(theme.text[styleMappings[size]])};&:focus{outline:0;border-color:${theme.colors.secondary.blue.dark};border-radius:${theme.radius.base};box-shadow:0 0 0 2px ${theme.colors.secondary.blue.light};}&:hover{color:${theme.colors.secondary.blue.dark};}svg{width:${({ size }) => sizeMappings[size]};height:${({ size }) => sizeMappings[size]};vertical-align:middle;}`;
20
+ // Inherit font size and line height from parent
21
+ const InheritAnchor = styled(StandardAnchor).withConfig({ displayName: "vui--InheritAnchor", componentId: "vui--ut8az0" }) `font-size:inherit;line-height:inherit;`;
22
+ const AnchorMapping = {
23
+ base: StandardAnchor,
24
+ unstyled: UnstyledAnchor,
25
+ inherit: InheritAnchor,
26
+ };
5
27
 
6
- export { CommonAnchor };
28
+ export { AnchorMapping, InheritAnchor, StandardAnchor, UnstyledAnchor };
7
29
  //# sourceMappingURL=styled.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"styled.js","sources":["../../../src/components/Anchor/styled.ts"],"sourcesContent":["import styled from 'styled-components';\n\nimport { theme } from '../../theme';\n\nexport const CommonAnchor = styled.a`\n box-sizing: border-box;\n display: inline-flex;\n margin: 0;\n padding: 0;\n\n font-family: ${theme.text.link.fontFamily};\n font-style: ${theme.text.link.fontStyle};\n font-weight: ${theme.text.link.fontWeight};\n font-size: ${theme.text.link.fontSize};\n line-height: ${theme.text.link.lineHeight};\n color: ${theme.colors.secondary.blue.base};\n text-decoration: ${theme.text.link.textDecoration};\n\n &:hover {\n color: ${theme.colors.secondary.blue.dark};\n }\n`;\n"],"names":[],"mappings":";;;AAIa,MAAA,YAAY,GAAG,MAAM,CAAC,CAAC,CAAA,UAAA,CAAA,EAAA,WAAA,EAAA,mBAAA,EAAA,WAAA,EAAA,cAAA,EAAA,CAAA,CAAA,CAAA,yEAAA,EAMnB,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,eAC3B,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CACxB,aAAA,EAAA,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAC5B,WAAA,EAAA,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAA,aAAA,EACtB,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAA,OAAA,EAChC,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAA,iBAAA,EACtB,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,cAAc,kBAGtC,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI;;;;"}
1
+ {"version":3,"file":"styled.js","sources":["../../../src/components/Anchor/styled.ts"],"sourcesContent":["import styled, { StyledComponent } from 'styled-components';\nimport { getTextStyles } from '../../theme/utils';\nimport { theme } from '../../theme';\nimport { AnchorProps, AnchorSize } from './types';\n\ntype StyledAnchorProps = {\n size: AnchorSize;\n};\n\nconst sizeMappings: Record<StyledAnchorProps['size'], string> = {\n lg: theme.sizes.md,\n md: theme.sizes[5],\n base: theme.sizes.base,\n sm: theme.sizes[3],\n};\n\nconst styleMappings: Record<StyledAnchorProps['size'], string> = {\n lg: 'linkLarge',\n md: 'linkMedium',\n base: 'link',\n sm: 'linkSmall',\n};\n\nexport const UnstyledAnchor = styled.a<StyledAnchorProps>``;\n\n// Standard variant styling\nexport const StandardAnchor = styled(UnstyledAnchor)<StyledAnchorProps>`\n display: inline-flex;\n align-items: center;\n\n cursor: pointer;\n transition: color 0.1s ease;\n text-decoration: none;\n padding: 0 2px;\n\n ${({ size }) => getTextStyles(theme.text[styleMappings[size]])};\n\n &:focus {\n outline: 0;\n border-color: ${theme.colors.secondary.blue.dark};\n border-radius: ${theme.radius.base};\n box-shadow: 0 0 0 2px ${theme.colors.secondary.blue.light};\n }\n\n &:hover {\n color: ${theme.colors.secondary.blue.dark};\n }\n\n svg {\n width: ${({ size }) => sizeMappings[size]};\n height: ${({ size }) => sizeMappings[size]};\n vertical-align: middle;\n }\n`;\n\n// Inherit font size and line height from parent\nexport const InheritAnchor = styled(StandardAnchor)<StyledAnchorProps>`\n font-size: inherit;\n line-height: inherit;\n`;\n\nexport const AnchorMapping: Record<\n NonNullable<AnchorProps['variant']>,\n StyledComponent<'a', any, StyledAnchorProps>\n> = {\n base: StandardAnchor,\n unstyled: UnstyledAnchor,\n inherit: InheritAnchor,\n};\n"],"names":[],"mappings":";;;;AASA,MAAM,YAAY,GAA8C;AAC9D,IAAA,EAAE,EAAE,KAAK,CAAC,KAAK,CAAC,EAAE;AAClB,IAAA,EAAE,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;AAClB,IAAA,IAAI,EAAE,KAAK,CAAC,KAAK,CAAC,IAAI;AACtB,IAAA,EAAE,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;CACnB;AAED,MAAM,aAAa,GAA8C;AAC/D,IAAA,EAAE,EAAE,WAAW;AACf,IAAA,EAAE,EAAE,YAAY;AAChB,IAAA,IAAI,EAAE,MAAM;AACZ,IAAA,EAAE,EAAE,WAAW;CAChB;MAEY,cAAc,GAAG,MAAM,CAAC,CAAC;AAEtC;AACa,MAAA,cAAc,GAAG,MAAM,CAAC,cAAc,CAAC,CAAA,UAAA,CAAA,EAAA,WAAA,EAAA,qBAAA,EAAA,WAAA,EAAA,aAAA,EAAA,CAAA,CAAA,CAAA,oHAAA,EAShD,CAAC,EAAE,IAAI,EAAE,KAAK,aAAa,CAAC,KAAK,CAAC,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA,gCAAA,EAI5C,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,kBAC/B,KAAK,CAAC,MAAM,CAAC,IAAI,CACV,sBAAA,EAAA,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAA,gBAAA,EAIhD,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,eAIhC,CAAC,EAAE,IAAI,EAAE,KAAK,YAAY,CAAC,IAAI,CAAC,WAC/B,CAAC,EAAE,IAAI,EAAE,KAAK,YAAY,CAAC,IAAI,CAAC;AAK9C;MACa,aAAa,GAAG,MAAM,CAAC,cAAc,CAAC,CAAA,UAAA,CAAA,EAAA,WAAA,EAAA,oBAAA,EAAA,WAAA,EAAA,aAAA,EAAA,CAAA,CAAA,CAAA,sCAAA;AAKtC,MAAA,aAAa,GAGtB;AACF,IAAA,IAAI,EAAE,cAAc;AACpB,IAAA,QAAQ,EAAE,cAAc;AACxB,IAAA,OAAO,EAAE,aAAa;;;;;"}
@@ -0,0 +1,45 @@
1
+ import { AnchorHTMLAttributes, ReactNode } from 'react';
2
+ /**
3
+ * Available style variants for the Anchor component
4
+ */
5
+ export type AnchorVariant = 'base' | 'unstyled' | 'inherit';
6
+ export type AnchorSize = 'lg' | 'md' | 'base' | 'sm';
7
+ /**
8
+ * Props for the Anchor component
9
+ */
10
+ export interface AnchorProps extends AnchorHTMLAttributes<HTMLAnchorElement> {
11
+ /**
12
+ * The visual style variant of the anchor
13
+ * @default 'base'
14
+ */
15
+ variant?: AnchorVariant;
16
+ /**
17
+ * The size of the anchor
18
+ * @default 'base'
19
+ */
20
+ size?: AnchorSize;
21
+ /**
22
+ * Whether to show a help icon on the left side of the anchor text
23
+ * @default false
24
+ */
25
+ showHelpIcon?: boolean;
26
+ /**
27
+ * Slot for a custom icon on the left side of the anchor text
28
+ * @default null
29
+ */
30
+ leftIconSlot?: ReactNode | null;
31
+ /**
32
+ * Whether to hide the external link icon
33
+ * @default false
34
+ */
35
+ hideExternalLinkIcon?: boolean;
36
+ /**
37
+ * List of hostnames to consider as internal links
38
+ * @default []
39
+ */
40
+ allowedHostnames?: string[];
41
+ /**
42
+ * The content of the anchor
43
+ */
44
+ children: ReactNode;
45
+ }
@@ -0,0 +1,48 @@
1
+ 'use strict';
2
+
3
+ /**
4
+ * Utility functions for URL processing
5
+ */
6
+ /**
7
+ * Checks if the URL should have a prefix added based on the current context
8
+ * @returns {boolean} Whether a prefix should be added
9
+ */
10
+ const shouldAddPrefix = () => !!(window.veeqoContext &&
11
+ window.veeqoContext.vqHost !== 'standalone' &&
12
+ window.veeqoContext.baseUrl);
13
+ /**
14
+ * Checks if a URL is relative (not starting with http://, https://, or //)
15
+ * @param {string} url - The URL to check
16
+ * @returns {boolean} Whether the URL is relative
17
+ */
18
+ const isRelativeUrl = (url) => !url.match(/^(https?:\/\/|\/\/)/);
19
+ /**
20
+ * Checks if a URL is an anchor link (starts with #)
21
+ * @param {string} url - The URL to check
22
+ * @returns {boolean} Whether the URL is an anchor link
23
+ */
24
+ const isAnchorUrl = (url) => url.startsWith('#');
25
+ /**
26
+ * Adds the appropriate prefix to a URL based on the current context
27
+ * @param {string} url - The URL to add a prefix to
28
+ * @returns {string} The URL with prefix added if needed
29
+ */
30
+ const addPrefixToUrl = (url) => { var _a; return `${((_a = window.veeqoContext) === null || _a === undefined ? undefined : _a.baseUrl) || ''}${url.startsWith('/') ? '' : '/'}${url}`; };
31
+ /**
32
+ * Processes a URL by adding the appropriate prefix if needed
33
+ * @param {string} url - The URL to process
34
+ * @returns {string} The processed URL
35
+ */
36
+ const createContextAwareUrl = (url) => {
37
+ // Don't modify anchor URLs (they should be treated as absolute)
38
+ if (isAnchorUrl(url) || !shouldAddPrefix() || !isRelativeUrl(url))
39
+ return url;
40
+ return addPrefixToUrl(url);
41
+ };
42
+
43
+ exports.addPrefixToUrl = addPrefixToUrl;
44
+ exports.createContextAwareUrl = createContextAwareUrl;
45
+ exports.isAnchorUrl = isAnchorUrl;
46
+ exports.isRelativeUrl = isRelativeUrl;
47
+ exports.shouldAddPrefix = shouldAddPrefix;
48
+ //# sourceMappingURL=urlUtils.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"urlUtils.cjs","sources":["../../../../src/components/Anchor/utils/urlUtils.ts"],"sourcesContent":["/**\n * Utility functions for URL processing\n */\n\n/**\n * Checks if the URL should have a prefix added based on the current context\n * @returns {boolean} Whether a prefix should be added\n */\nexport const shouldAddPrefix = (): boolean =>\n !!(\n window.veeqoContext &&\n window.veeqoContext.vqHost !== 'standalone' &&\n window.veeqoContext.baseUrl\n );\n\n/**\n * Checks if a URL is relative (not starting with http://, https://, or //)\n * @param {string} url - The URL to check\n * @returns {boolean} Whether the URL is relative\n */\nexport const isRelativeUrl = (url: string): boolean => !url.match(/^(https?:\\/\\/|\\/\\/)/);\n\n/**\n * Checks if a URL is an anchor link (starts with #)\n * @param {string} url - The URL to check\n * @returns {boolean} Whether the URL is an anchor link\n */\nexport const isAnchorUrl = (url: string): boolean => url.startsWith('#');\n\n/**\n * Adds the appropriate prefix to a URL based on the current context\n * @param {string} url - The URL to add a prefix to\n * @returns {string} The URL with prefix added if needed\n */\nexport const addPrefixToUrl = (url: string): string =>\n `${window.veeqoContext?.baseUrl || ''}${url.startsWith('/') ? '' : '/'}${url}`;\n\n/**\n * Processes a URL by adding the appropriate prefix if needed\n * @param {string} url - The URL to process\n * @returns {string} The processed URL\n */\nexport const createContextAwareUrl = (url: string): string => {\n // Don't modify anchor URLs (they should be treated as absolute)\n if (isAnchorUrl(url) || !shouldAddPrefix() || !isRelativeUrl(url)) return url;\n\n return addPrefixToUrl(url);\n};\n"],"names":[],"mappings":";;AAAA;;AAEG;AAEH;;;AAGG;AACI,MAAM,eAAe,GAAG,MAC7B,CAAC,EACC,MAAM,CAAC,YAAY;AACnB,IAAA,MAAM,CAAC,YAAY,CAAC,MAAM,KAAK,YAAY;AAC3C,IAAA,MAAM,CAAC,YAAY,CAAC,OAAO;AAG/B;;;;AAIG;AACU,MAAA,aAAa,GAAG,CAAC,GAAW,KAAc,CAAC,GAAG,CAAC,KAAK,CAAC,qBAAqB;AAEvF;;;;AAIG;AACI,MAAM,WAAW,GAAG,CAAC,GAAW,KAAc,GAAG,CAAC,UAAU,CAAC,GAAG;AAEvE;;;;AAIG;AACU,MAAA,cAAc,GAAG,CAAC,GAAW,KAAY,EAAA,IAAA,EAAA,CAAA,CACpD,OAAA,CAAA,EAAG,CAAA,CAAA,EAAA,GAAA,MAAM,CAAC,YAAY,MAAA,IAAA,IAAA,EAAA,KAAA,SAAA,GAAA,SAAA,GAAA,EAAA,CAAE,OAAO,KAAI,EAAE,CAAG,EAAA,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,GAAG,CAAA,EAAG,GAAG,CAAE,CAAA,CAAA;AAEhF;;;;AAIG;AACU,MAAA,qBAAqB,GAAG,CAAC,GAAW,KAAY;;AAE3D,IAAA,IAAI,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC,eAAe,EAAE,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC;AAAE,QAAA,OAAO,GAAG;AAE7E,IAAA,OAAO,cAAc,CAAC,GAAG,CAAC;AAC5B;;;;;;;;"}
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Utility functions for URL processing
3
+ */
4
+ /**
5
+ * Checks if the URL should have a prefix added based on the current context
6
+ * @returns {boolean} Whether a prefix should be added
7
+ */
8
+ export declare const shouldAddPrefix: () => boolean;
9
+ /**
10
+ * Checks if a URL is relative (not starting with http://, https://, or //)
11
+ * @param {string} url - The URL to check
12
+ * @returns {boolean} Whether the URL is relative
13
+ */
14
+ export declare const isRelativeUrl: (url: string) => boolean;
15
+ /**
16
+ * Checks if a URL is an anchor link (starts with #)
17
+ * @param {string} url - The URL to check
18
+ * @returns {boolean} Whether the URL is an anchor link
19
+ */
20
+ export declare const isAnchorUrl: (url: string) => boolean;
21
+ /**
22
+ * Adds the appropriate prefix to a URL based on the current context
23
+ * @param {string} url - The URL to add a prefix to
24
+ * @returns {string} The URL with prefix added if needed
25
+ */
26
+ export declare const addPrefixToUrl: (url: string) => string;
27
+ /**
28
+ * Processes a URL by adding the appropriate prefix if needed
29
+ * @param {string} url - The URL to process
30
+ * @returns {string} The processed URL
31
+ */
32
+ export declare const createContextAwareUrl: (url: string) => string;