@hashicorp/react-components 1.2.0 → 1.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.test/setup-vitest.js +4 -0
- package/global.d.ts +1 -1
- package/package.json +1 -2
- package/postcss.config.js +4 -0
- package/src/components/nav-panel/components/flight-icon/index.tsx +4 -0
- package/src/components/nav-panel/components/flight-icon/style.module.css +4 -0
- package/src/components/nav-panel/components/link/index.tsx +36 -2
- package/src/components/nav-panel/components/link/style.module.css +5 -0
- package/src/components/nav-panel/components/link-list/index.tsx +5 -0
- package/src/components/nav-panel/components/link-list/style.module.css +4 -0
- package/src/components/nav-panel/components/panel/column/index.tsx +4 -0
- package/src/components/nav-panel/components/panel/column/style.module.css +4 -0
- package/src/components/nav-panel/components/panel/index.tsx +4 -0
- package/src/components/nav-panel/components/panel/root/index.tsx +4 -0
- package/src/components/nav-panel/components/panel/root/style.module.css +4 -0
- package/src/components/nav-panel/components/promo/index.tsx +4 -0
- package/src/components/nav-panel/components/promo/style.module.css +4 -0
- package/src/components/nav-panel/components/text/index.tsx +4 -0
- package/src/components/nav-panel/index.tsx +4 -0
- package/src/components/nav-panel/product-panel/index.tsx +14 -1
- package/src/components/nav-panel/product-panel/style.module.css +4 -0
- package/src/components/nav-panel/standard-panel/index.tsx +4 -0
- package/src/components/nav-panel/standard-panel/style.module.css +4 -0
- package/src/lib/get-localized-link-props/index.test.ts +4 -0
- package/src/lib/get-localized-link-props/index.ts +4 -0
- package/src/lib/parse-url/index.test.ts +4 -0
- package/src/lib/parse-url/index.ts +4 -0
- package/src/lib/send-posthog-event/index.ts +4 -0
- package/src/lib/supported-locales/index.ts +4 -0
- package/src/lib/track-nav-click-event/index.ts +4 -0
- package/src/lib/v/index.ts +4 -0
package/.test/setup-vitest.js
CHANGED
package/global.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hashicorp/react-components",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.2",
|
|
4
4
|
"main": "src/index.ts",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"lint": "npm run lint:js",
|
|
@@ -10,7 +10,6 @@
|
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@hashicorp/flight-icons": "^3.7.0",
|
|
13
|
-
"@web/product-meta": "^0.1.1",
|
|
14
13
|
"@hashicorp/web-mktg-logos": "*",
|
|
15
14
|
"@radix-ui/react-navigation-menu": "^1.2.14",
|
|
16
15
|
"@radix-ui/react-visually-hidden": "^1.2.4",
|
package/postcss.config.js
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2022, 2026
|
|
3
|
+
*/
|
|
4
|
+
|
|
1
5
|
import Image from 'next/image'
|
|
2
6
|
import Link from 'next/link'
|
|
3
7
|
import classNames from 'classnames'
|
|
@@ -17,6 +21,7 @@ interface NavLinkProps {
|
|
|
17
21
|
icon?: string
|
|
18
22
|
description?: string
|
|
19
23
|
iconGradient?: string
|
|
24
|
+
isDevPortal?: boolean
|
|
20
25
|
linkClickHandler?: (title: string, url: string) => void
|
|
21
26
|
locale?: string
|
|
22
27
|
className?: string
|
|
@@ -56,6 +61,13 @@ const GRADIENT_VALUE_MAP = new Map([
|
|
|
56
61
|
],
|
|
57
62
|
['ILM Solid', { iconBackground: '#7948FF' }],
|
|
58
63
|
['SLM Solid', { iconBackground: '#FF6423' }],
|
|
64
|
+
[
|
|
65
|
+
'Learn',
|
|
66
|
+
{
|
|
67
|
+
iconBackground: 'var(--mds-color-foreground-high-contrast)',
|
|
68
|
+
iconBorder: 'var(--mds-color-border-primary)',
|
|
69
|
+
},
|
|
70
|
+
],
|
|
59
71
|
])
|
|
60
72
|
|
|
61
73
|
export default function NavLink({
|
|
@@ -67,12 +79,16 @@ export default function NavLink({
|
|
|
67
79
|
linkClickHandler,
|
|
68
80
|
locale,
|
|
69
81
|
className,
|
|
82
|
+
isDevPortal = false,
|
|
70
83
|
}: NavLinkProps) {
|
|
71
84
|
const style = iconGradient
|
|
72
85
|
? {
|
|
73
86
|
['--iconBackground' as string]: GRADIENT_VALUE_MAP.get(
|
|
74
87
|
vercelSplit(iconGradient),
|
|
75
88
|
)?.iconBackground,
|
|
89
|
+
['--iconBorder' as string]: GRADIENT_VALUE_MAP.get(
|
|
90
|
+
vercelSplit(iconGradient),
|
|
91
|
+
)?.iconBorder,
|
|
76
92
|
}
|
|
77
93
|
: undefined
|
|
78
94
|
|
|
@@ -86,8 +102,16 @@ export default function NavLink({
|
|
|
86
102
|
}}
|
|
87
103
|
>
|
|
88
104
|
{iconGradient && icon ? (
|
|
89
|
-
<div
|
|
90
|
-
|
|
105
|
+
<div
|
|
106
|
+
className={s.iconBackground}
|
|
107
|
+
style={style}
|
|
108
|
+
data-theme={!isDevPortal && 'dark'}
|
|
109
|
+
>
|
|
110
|
+
<IconSwitcher
|
|
111
|
+
icon={icon}
|
|
112
|
+
iconGradient={iconGradient}
|
|
113
|
+
isDevPortal={isDevPortal}
|
|
114
|
+
/>
|
|
91
115
|
</div>
|
|
92
116
|
) : (
|
|
93
117
|
icon && (
|
|
@@ -111,10 +135,20 @@ export default function NavLink({
|
|
|
111
135
|
const IconSwitcher = ({
|
|
112
136
|
icon,
|
|
113
137
|
iconGradient,
|
|
138
|
+
isDevPortal = false,
|
|
114
139
|
}: {
|
|
115
140
|
icon: string
|
|
116
141
|
iconGradient: string
|
|
142
|
+
isDevPortal?: boolean
|
|
117
143
|
}) => {
|
|
144
|
+
if (isDevPortal) {
|
|
145
|
+
return (
|
|
146
|
+
<FlightIcon
|
|
147
|
+
name={vercelSplit(icon)}
|
|
148
|
+
color={'var(--mds-color-foreground-faint)'}
|
|
149
|
+
/>
|
|
150
|
+
)
|
|
151
|
+
}
|
|
118
152
|
switch (icon) {
|
|
119
153
|
case 'shield-alert':
|
|
120
154
|
return <Image src={ShieldAlertFill} alt="shield alert icon" />
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2022, 2026
|
|
3
|
+
*/
|
|
4
|
+
|
|
1
5
|
import NavLink from '../link'
|
|
2
6
|
import s from './style.module.css'
|
|
3
7
|
|
|
@@ -9,6 +13,7 @@ export interface LinkListProps {
|
|
|
9
13
|
icon?: string
|
|
10
14
|
description?: string
|
|
11
15
|
iconGradient?: string
|
|
16
|
+
isDevPortal?: boolean
|
|
12
17
|
}[]
|
|
13
18
|
linkClickHandler?: (title: string, url: string) => void
|
|
14
19
|
}
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2022, 2026
|
|
3
|
+
*/
|
|
4
|
+
|
|
1
5
|
import classNames from 'classnames'
|
|
2
6
|
import Link from 'next/link'
|
|
3
7
|
import * as NavPanel from '../components/panel'
|
|
4
8
|
import Promo, { type PromoProps } from '../components/promo'
|
|
5
9
|
import { getLocalizedLinkProps } from '../../../lib/get-localized-link-props'
|
|
6
|
-
import { Products } from '@web/product-meta'
|
|
7
10
|
import FlightIcon from '../components/flight-icon'
|
|
8
11
|
import { Text } from '../components/text'
|
|
9
12
|
import { trackNavClickEvent } from '../../../lib/track-nav-click-event'
|
|
@@ -160,6 +163,16 @@ const ProductPanel = ({
|
|
|
160
163
|
)
|
|
161
164
|
}
|
|
162
165
|
|
|
166
|
+
type Products =
|
|
167
|
+
| 'hashicorp'
|
|
168
|
+
| 'boundary'
|
|
169
|
+
| 'consul'
|
|
170
|
+
| 'nomad'
|
|
171
|
+
| 'packer'
|
|
172
|
+
| 'terraform'
|
|
173
|
+
| 'vault'
|
|
174
|
+
| 'vagrant'
|
|
175
|
+
| 'waypoint'
|
|
163
176
|
export interface NavProductProps {
|
|
164
177
|
locale?: string
|
|
165
178
|
url: string
|