dce-reactkit 3.5.13 → 3.5.14

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.
@@ -5,12 +5,14 @@ import React from 'react';
5
5
  * @param text the text to process
6
6
  * @param [opts] options to customize behavior
7
7
  * @param [opts.newTab] if true, links will open in a new tab
8
- * @param [opts.preventPropagation] if true, clicks to link will prevent default
9
- * and propagation
8
+ * @param [opts.preventPropagation] if true, clicks to link will prevent
9
+ * propagation
10
+ * @param [opts.inheritColor] if true, inherit text color for links
10
11
  * @returns the processed text
11
12
  */
12
13
  declare const makeLinksClickable: (text: string, opts?: {
13
14
  newTab?: boolean;
14
15
  preventPropagation?: boolean;
16
+ inheritColor?: boolean;
15
17
  }) => React.ReactNode;
16
18
  export default makeLinksClickable;
package/dist/index.d.ts CHANGED
@@ -1379,13 +1379,15 @@ declare const idify: (str: string) => string;
1379
1379
  * @param text the text to process
1380
1380
  * @param [opts] options to customize behavior
1381
1381
  * @param [opts.newTab] if true, links will open in a new tab
1382
- * @param [opts.preventPropagation] if true, clicks to link will prevent default
1383
- * and propagation
1382
+ * @param [opts.preventPropagation] if true, clicks to link will prevent
1383
+ * propagation
1384
+ * @param [opts.inheritColor] if true, inherit text color for links
1384
1385
  * @returns the processed text
1385
1386
  */
1386
1387
  declare const makeLinksClickable: (text: string, opts?: {
1387
1388
  newTab?: boolean;
1388
1389
  preventPropagation?: boolean;
1390
+ inheritColor?: boolean;
1389
1391
  }) => React.ReactNode;
1390
1392
 
1391
1393
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dce-reactkit",
3
- "version": "3.5.13",
3
+ "version": "3.5.14",
4
4
  "description": "Shared components for Harvard DCE apps",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -10,8 +10,9 @@ const urlRegex = /(https?:\/\/)?([a-z0-9-]+\.)+[a-z0-9]{2,6}(:[0-9]{1,5})?(\/\S*
10
10
  * @param text the text to process
11
11
  * @param [opts] options to customize behavior
12
12
  * @param [opts.newTab] if true, links will open in a new tab
13
- * @param [opts.preventPropagation] if true, clicks to link will prevent default
14
- * and propagation
13
+ * @param [opts.preventPropagation] if true, clicks to link will prevent
14
+ * propagation
15
+ * @param [opts.inheritColor] if true, inherit text color for links
15
16
  * @returns the processed text
16
17
  */
17
18
  const makeLinksClickable = (
@@ -19,6 +20,7 @@ const makeLinksClickable = (
19
20
  opts?: {
20
21
  newTab?: boolean,
21
22
  preventPropagation?: boolean,
23
+ inheritColor?: boolean,
22
24
  },
23
25
  ): React.ReactNode => {
24
26
  // Search text for links
@@ -61,11 +63,11 @@ const makeLinksClickable = (
61
63
  rel={newTab ? 'noopener noreferrer' : undefined}
62
64
  style={{
63
65
  textDecoration: 'underline',
66
+ color: opts?.inheritColor ? 'inherit' : undefined,
64
67
  }}
65
68
  onClick={(e) => {
66
- // Prevent default and propagation if requested
69
+ // Prevent propagation if requested
67
70
  if (opts?.preventPropagation) {
68
- e.preventDefault();
69
71
  e.stopPropagation();
70
72
  }
71
73
  }}