@hashicorp/react-components 1.1.10 → 1.2.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 (173) hide show
  1. package/README.md +1 -1
  2. package/package.json +8 -13
  3. package/postcss.config.js +1 -1
  4. package/src/components/nav-panel/components/flight-icon/index.tsx +53 -0
  5. package/src/components/nav-panel/components/flight-icon/style.module.css +3 -0
  6. package/src/components/nav-panel/components/link/cloud-fill.svg +3 -0
  7. package/src/components/nav-panel/components/link/index.tsx +139 -0
  8. package/src/components/nav-panel/components/link/layers-fill.svg +5 -0
  9. package/src/components/nav-panel/components/link/shield-alert-fill.svg +3 -0
  10. package/src/components/nav-panel/components/link/style.module.css +64 -0
  11. package/src/components/nav-panel/components/link/zap-fill.svg +3 -0
  12. package/src/components/nav-panel/components/link-list/index.tsx +12 -64
  13. package/src/components/nav-panel/components/link-list/style.module.css +1 -50
  14. package/src/components/nav-panel/components/panel/column/style.module.css +2 -2
  15. package/src/components/nav-panel/components/panel/root/style.module.css +5 -5
  16. package/src/components/nav-panel/components/promo/index.tsx +35 -15
  17. package/src/components/nav-panel/components/promo/style.module.css +32 -28
  18. package/src/components/nav-panel/components/text/index.tsx +34 -0
  19. package/src/components/nav-panel/product-panel/index.tsx +71 -20
  20. package/src/components/nav-panel/product-panel/style.module.css +111 -53
  21. package/src/components/nav-panel/standard-panel/index.tsx +3 -0
  22. package/src/components/nav-panel/standard-panel/style.module.css +2 -2
  23. package/src/lib/get-localized-link-props/index.test.ts +30 -0
  24. package/src/lib/get-localized-link-props/index.ts +45 -0
  25. package/src/lib/parse-url/index.test.ts +57 -2
  26. package/src/lib/parse-url/index.ts +97 -13
  27. package/src/lib/send-posthog-event/index.ts +22 -0
  28. package/src/lib/supported-locales/index.ts +10 -0
  29. package/src/lib/track-nav-click-event/index.ts +5 -5
  30. package/src/lib/v/index.ts +9 -4
  31. package/tsconfig.json +1 -2
  32. package/.eslintrc.js +0 -4
  33. package/.stylelintrc.js +0 -3
  34. package/src/components/actions/index.tsx +0 -107
  35. package/src/components/actions/style.module.css +0 -28
  36. package/src/components/actions/types.ts +0 -73
  37. package/src/components/call-to-action/index.tsx +0 -205
  38. package/src/components/call-to-action/styles/variant-centered.module.css +0 -93
  39. package/src/components/call-to-action/styles/variant-compact-grid.module.css +0 -88
  40. package/src/components/call-to-action/styles/variant-compact.module.css +0 -91
  41. package/src/components/call-to-action/styles/variant-links.module.css +0 -85
  42. package/src/components/card/README.md +0 -11
  43. package/src/components/card/card.tsx +0 -45
  44. package/src/components/card/index.test.tsx +0 -69
  45. package/src/components/card/index.tsx +0 -14
  46. package/src/components/card/newsroom-card/index.test.tsx +0 -39
  47. package/src/components/card/newsroom-card/index.tsx +0 -37
  48. package/src/components/card/newsroom-card/style.module.css +0 -12
  49. package/src/components/card/partner-card/index.test.tsx +0 -57
  50. package/src/components/card/partner-card/index.tsx +0 -69
  51. package/src/components/card/partner-card/style.module.css +0 -24
  52. package/src/components/card/person-card/index.test.tsx +0 -71
  53. package/src/components/card/person-card/index.tsx +0 -93
  54. package/src/components/card/person-card/style.module.css +0 -33
  55. package/src/components/card/primitives.tsx +0 -176
  56. package/src/components/card/promo-card/index.tsx +0 -51
  57. package/src/components/card/resource-card/index.test.tsx +0 -48
  58. package/src/components/card/resource-card/index.tsx +0 -37
  59. package/src/components/card/style.module.css +0 -145
  60. package/src/components/card/types.ts +0 -66
  61. package/src/components/card/unified-card/index.tsx +0 -64
  62. package/src/components/consent-manager/README.md +0 -73
  63. package/src/components/consent-manager/components/banner/banner.module.css +0 -23
  64. package/src/components/consent-manager/components/banner/banner.test.tsx +0 -31
  65. package/src/components/consent-manager/components/banner/banner.tsx +0 -73
  66. package/src/components/consent-manager/components/dialog/dialog.module.css +0 -145
  67. package/src/components/consent-manager/components/dialog/dialog.test.tsx +0 -194
  68. package/src/components/consent-manager/components/dialog/dialog.tsx +0 -339
  69. package/src/components/consent-manager/img/icn_close.tsx +0 -19
  70. package/src/components/consent-manager/index.test.tsx +0 -334
  71. package/src/components/consent-manager/index.tsx +0 -186
  72. package/src/components/consent-manager/loader/README.md +0 -29
  73. package/src/components/consent-manager/loader/categories.ts +0 -22
  74. package/src/components/consent-manager/loader/index.tsx +0 -94
  75. package/src/components/consent-manager/loader/presets/enterprise.ts +0 -12
  76. package/src/components/consent-manager/loader/presets/oss.ts +0 -10
  77. package/src/components/consent-manager/loader/services.ts +0 -45
  78. package/src/components/consent-manager/scripts/custom.tsx +0 -59
  79. package/src/components/consent-manager/scripts/segment.tsx +0 -87
  80. package/src/components/consent-manager/style.module.css +0 -9
  81. package/src/components/consent-manager/types.ts +0 -55
  82. package/src/components/consent-manager/util/cookies.test.ts +0 -75
  83. package/src/components/consent-manager/util/cookies.ts +0 -70
  84. package/src/components/consent-manager/util/integrations.test.ts +0 -115
  85. package/src/components/consent-manager/util/integrations.ts +0 -110
  86. package/src/components/intro/index.tsx +0 -82
  87. package/src/components/intro/style.module.css +0 -67
  88. package/src/components/intro/types.ts +0 -44
  89. package/src/components/marketo-form/CHANGELOG.md +0 -122
  90. package/src/components/marketo-form/README.md +0 -1
  91. package/src/components/marketo-form/contexts/FormMetadata.ts +0 -11
  92. package/src/components/marketo-form/docs.mdx +0 -197
  93. package/src/components/marketo-form/fixtures/index.ts +0 -185
  94. package/src/components/marketo-form/form/index.tsx +0 -369
  95. package/src/components/marketo-form/index.test.tsx +0 -320
  96. package/src/components/marketo-form/index.ts +0 -11
  97. package/src/components/marketo-form/package.original.json +0 -30
  98. package/src/components/marketo-form/partials/error-message/index.tsx +0 -12
  99. package/src/components/marketo-form/partials/error-message/style.module.css +0 -13
  100. package/src/components/marketo-form/partials/field/index.tsx +0 -90
  101. package/src/components/marketo-form/partials/field-wrapper/index.tsx +0 -26
  102. package/src/components/marketo-form/partials/fields/checkbox-field/index.tsx +0 -32
  103. package/src/components/marketo-form/partials/fields/email-field/index.tsx +0 -35
  104. package/src/components/marketo-form/partials/fields/form-page-url-field/index.tsx +0 -21
  105. package/src/components/marketo-form/partials/fields/hidden-field/index.tsx +0 -37
  106. package/src/components/marketo-form/partials/fields/htmltext-field/index.tsx +0 -21
  107. package/src/components/marketo-form/partials/fields/htmltext-field/style.module.css +0 -18
  108. package/src/components/marketo-form/partials/fields/name-field/index.tsx +0 -19
  109. package/src/components/marketo-form/partials/fields/name-field/style.module.css +0 -13
  110. package/src/components/marketo-form/partials/fields/radio-buttons-field/index.tsx +0 -48
  111. package/src/components/marketo-form/partials/fields/select-field/index.tsx +0 -39
  112. package/src/components/marketo-form/partials/fields/select-field/style.module.css +0 -5
  113. package/src/components/marketo-form/partials/fields/telephone-field/index.tsx +0 -30
  114. package/src/components/marketo-form/partials/fields/text-field/index.tsx +0 -30
  115. package/src/components/marketo-form/partials/fields/textarea-field/index.tsx +0 -29
  116. package/src/components/marketo-form/partials/label/index.tsx +0 -24
  117. package/src/components/marketo-form/partials/label/style.module.css +0 -12
  118. package/src/components/marketo-form/partials/visibility-rule/index.tsx +0 -84
  119. package/src/components/marketo-form/props.js +0 -66
  120. package/src/components/marketo-form/server/api-routes.ts +0 -109
  121. package/src/components/marketo-form/server/client.ts +0 -98
  122. package/src/components/marketo-form/server/index.ts +0 -8
  123. package/src/components/marketo-form/types.ts +0 -268
  124. package/src/components/marketo-form/utils.test.tsx +0 -103
  125. package/src/components/marketo-form/utils.ts +0 -449
  126. package/src/components/next-steps/index.tsx +0 -137
  127. package/src/components/next-steps/style.module.css +0 -270
  128. package/src/components/next-steps/types.ts +0 -63
  129. package/src/components/product-badge/index.test.tsx +0 -11
  130. package/src/components/product-badge/index.tsx +0 -42
  131. package/src/components/product-badge/style.module.css +0 -76
  132. package/src/components/products-used/index.tsx +0 -84
  133. package/src/components/products-used/style.module.css +0 -87
  134. package/src/components/products-used/types.ts +0 -31
  135. package/src/components/related-content/index.test.tsx +0 -74
  136. package/src/components/related-content/index.tsx +0 -56
  137. package/src/components/related-content/style.module.css +0 -89
  138. package/src/components/related-content/types.ts +0 -21
  139. package/src/components/subnav/helpers/areBasePathsMatching.ts +0 -13
  140. package/src/components/subnav/helpers/traverse/index.ts +0 -42
  141. package/src/components/subnav/helpers/useHeightRef.ts +0 -42
  142. package/src/components/subnav/helpers/useNavRef.ts +0 -30
  143. package/src/components/subnav/helpers/useOverflowRef.ts +0 -85
  144. package/src/components/subnav/helpers/useStuckRef.ts +0 -51
  145. package/src/components/subnav/index.tsx +0 -199
  146. package/src/components/subnav/partials/CtaLinks/github-stars-link/formatStarCount/index.test.ts +0 -26
  147. package/src/components/subnav/partials/CtaLinks/github-stars-link/formatStarCount/index.ts +0 -22
  148. package/src/components/subnav/partials/CtaLinks/github-stars-link/index.tsx +0 -87
  149. package/src/components/subnav/partials/CtaLinks/github-stars-link/parseGithubUrl/index.test.ts +0 -29
  150. package/src/components/subnav/partials/CtaLinks/github-stars-link/parseGithubUrl/index.ts +0 -32
  151. package/src/components/subnav/partials/CtaLinks/github-stars-link/style.module.css +0 -85
  152. package/src/components/subnav/partials/CtaLinks/icons/github-logo.js +0 -20
  153. package/src/components/subnav/partials/CtaLinks/icons/github.svg.js +0 -7
  154. package/src/components/subnav/partials/CtaLinks/icons/star.js +0 -20
  155. package/src/components/subnav/partials/CtaLinks/index.tsx +0 -130
  156. package/src/components/subnav/partials/CtaLinks/style.module.css +0 -45
  157. package/src/components/subnav/partials/DropdownTrigger/index.tsx +0 -35
  158. package/src/components/subnav/partials/DropdownTrigger/style.module.css +0 -36
  159. package/src/components/subnav/partials/MenuItemsDefault/index.tsx +0 -151
  160. package/src/components/subnav/partials/MenuItemsDefault/style.module.css +0 -91
  161. package/src/components/subnav/partials/MenuItemsOverflow/index.tsx +0 -139
  162. package/src/components/subnav/partials/MenuItemsOverflow/style.module.css +0 -82
  163. package/src/components/subnav/partials/TitleLink/index.tsx +0 -113
  164. package/src/components/subnav/partials/TitleLink/mktg-logos/all-community-product-logos_on-dark.ts +0 -9
  165. package/src/components/subnav/partials/TitleLink/mktg-logos/all-community-product-logos_on-light.ts +0 -9
  166. package/src/components/subnav/partials/TitleLink/mktg-logos/all-primary-logos_on-dark.ts +0 -23
  167. package/src/components/subnav/partials/TitleLink/mktg-logos/all-primary-logos_on-light.ts +0 -23
  168. package/src/components/subnav/partials/TitleLink/style.module.css +0 -43
  169. package/src/components/subnav/partials/nav-item-text/index.tsx +0 -37
  170. package/src/components/subnav/partials/nav-item-text/style.module.css +0 -15
  171. package/src/components/subnav/style.module.css +0 -68
  172. package/src/components/subnav/subnav-consts.ts +0 -1
  173. package/src/components/subnav/theme.module.css +0 -50
@@ -1,270 +0,0 @@
1
- /**
2
- * Copyright (c) HashiCorp, Inc.
3
- * SPDX-License-Identifier: MPL-2.0
4
- */
5
-
6
- .nextSteps {
7
- --padding-y: var(--wpl-spacing-10);
8
-
9
- position: relative;
10
- padding-top: var(--padding-y);
11
- padding-bottom: var(--padding-y);
12
-
13
- @media (--medium-up) {
14
- --padding-y: var(--wpl-spacing-13);
15
- }
16
- }
17
-
18
- .container {
19
- composes: g-grid-container from global;
20
- composes: g-grid from global;
21
- row-gap: var(--wpl-spacing-06);
22
- align-items: flex-start;
23
- }
24
-
25
- .content {
26
- grid-column: 1 / -1;
27
-
28
- @media (--large) {
29
- grid-column: 1 / 5;
30
- }
31
- }
32
-
33
- .heading {
34
- --color: var(--black);
35
-
36
- composes: g-type-display-2 from global;
37
- margin: 0;
38
- color: var(--color);
39
-
40
- @nest .dark & {
41
- --color: var(--white);
42
- }
43
- }
44
-
45
- .description {
46
- --color: var(--gray-3);
47
-
48
- composes: g-type-body-large from global;
49
- margin: var(--wpl-spacing-05) 0 0;
50
- color: var(--color);
51
-
52
- @nest .dark & {
53
- --color: var(--gray-5);
54
- }
55
- }
56
-
57
- .actions {
58
- margin-top: var(--wpl-spacing-06);
59
- }
60
-
61
- .stepsWrapper {
62
- --grid-gap: var(--wpl-spacing-05);
63
-
64
- display: flex;
65
- flex-direction: column;
66
- gap: var(--wpl-spacing-05);
67
- grid-column: 1 / -1;
68
-
69
- @media (--large) {
70
- --grid-gap: var(--wpl-spacing-06);
71
-
72
- grid-column: 6 / -1;
73
- }
74
- }
75
-
76
- .stepsList {
77
- --grid-template-columns: 1;
78
-
79
- display: grid;
80
- grid-template-columns: repeat(var(--grid-template-columns), 1fr);
81
- gap: var(--grid-gap);
82
- list-style: none;
83
- padding: 0;
84
- margin: 0;
85
-
86
- @media (--medium-up) {
87
- --grid-template-columns: 2;
88
- }
89
- }
90
-
91
- .stepsListItem {
92
- display: flex;
93
- width: 100%;
94
-
95
- &.stepsListItemFeature {
96
- @media (--medium-up) {
97
- grid-column: span 2;
98
- }
99
- }
100
- }
101
-
102
- .tile {
103
- --background-color: transparent;
104
- --color: var(--wpl-neutral-0);
105
- --transition-duration: 250ms;
106
- --transition-timing-function: ease-in-out;
107
- --border-radius: 8px;
108
- --scrim-background: transparent;
109
-
110
- position: relative;
111
- display: flex;
112
- width: 100%;
113
- min-height: 208px;
114
- flex-direction: column;
115
- padding: var(--wpl-spacing-06);
116
- background-color: var(--background-color);
117
- color: var(--color);
118
- border-radius: var(--border-radius);
119
- transition-duration: var(--transition-duration);
120
- transition-timing-function: var(--transition-timing-function);
121
- transition-property: background-color;
122
-
123
- &.primary {
124
- --background-color: var(--brand-secondary);
125
- --color: var(--wpl-neutral-900);
126
- --scrim-background: black;
127
-
128
- &:hover {
129
- --background-color: var(--brand-secondary);
130
- }
131
-
132
- @nest .hashicorp & {
133
- --background-color: var(--wpl-blue-500);
134
- --color: var(--wpl-neutral-0);
135
- --scrim-background: transparent;
136
-
137
- &:hover {
138
- --background-color: var(--wpl-blue-600);
139
- }
140
- }
141
-
142
- @nest .dark & {
143
- --background-color: var(--wpl-neutral-700);
144
- --color: var(--wpl-neutral-0);
145
-
146
- &:hover {
147
- --background-color: var(--wpl-neutral-600);
148
- }
149
- }
150
- }
151
-
152
- &:not(.primary) {
153
- --color: var(--wpl-neutral-900);
154
- --background-color: var(--wpl-neutral-50);
155
-
156
- &:hover {
157
- --background-color: var(--wpl-neutral-100);
158
- }
159
-
160
- @nest .dark & {
161
- --background-color: var(--wpl-neutral-700);
162
- --color: var(--white);
163
-
164
- &:hover {
165
- --background-color: var(--wpl-neutral-600);
166
- }
167
- }
168
- }
169
- }
170
-
171
- .tileInner {
172
- position: relative;
173
- display: flex;
174
- flex-direction: column;
175
- flex-grow: 1;
176
- }
177
-
178
- .tileScrim {
179
- position: absolute;
180
- inset: 0;
181
- background: var(--scrim-background);
182
- border-radius: var(--border-radius);
183
- opacity: 0;
184
- transition-duration: var(--transition-duration);
185
- transition-timing-function: var(--transition-timing-function);
186
- transition-property: opacity;
187
-
188
- @nest .tile &:hover {
189
- opacity: 0.05;
190
- }
191
- }
192
-
193
- .tileHeading {
194
- margin: 0;
195
- color: inherit;
196
- }
197
-
198
- .tileHeadingText {
199
- composes: g-type-display-4 from global;
200
- vertical-align: middle;
201
- }
202
-
203
- .tileBadge {
204
- display: inline-flex;
205
- margin: 0 0 0 var(--wpl-spacing-02);
206
- vertical-align: middle;
207
- }
208
-
209
- .tileDescription {
210
- --color: var(--wpl-neutral-900);
211
-
212
- composes: g-type-display-6 from global;
213
- margin: 8px 0 0;
214
- color: var(--color);
215
-
216
- @nest .hashicorp .primary & {
217
- --color: var(--wpl-neutral-0);
218
- }
219
-
220
- @nest .primary & {
221
- --color: var(--brand-text-on-primary);
222
- }
223
-
224
- @nest .primary & {
225
- --color: var(--brand-text-on-primary);
226
- --color: var(--wpl-neutral-900);
227
- }
228
-
229
- @nest .dark & {
230
- --color: var(--wpl-neutral-0);
231
- }
232
- }
233
-
234
- .tileCta {
235
- margin-top: auto;
236
- padding-top: var(--wpl-spacing-05);
237
- display: inline-flex;
238
- align-items: center;
239
- gap: 8px;
240
- color: inherit;
241
- }
242
-
243
- .tileCtaLabel {
244
- font-size: 0.875rem;
245
- line-height: 1.143;
246
- font-weight: var(--token-typography-font-weight-medium);
247
- font-family: var(--token-typography-font-stack-text);
248
- }
249
-
250
- .tileCtaIcon {
251
- flex-shrink: 0;
252
- }
253
-
254
- .cta {
255
- grid-column: 1/ -1;
256
- display: flex;
257
- flex-wrap: wrap;
258
- column-gap: var(--wpl-spacing-03);
259
- row-gap: var(--wpl-spacing-01);
260
- }
261
-
262
- .ctaCopy {
263
- margin: 0;
264
- composes: g-type-body-strong from global;
265
- font-size: 16px;
266
-
267
- @nest .dark & {
268
- color: var(--wpl-neutral-0);
269
- }
270
- }
@@ -1,63 +0,0 @@
1
- /**
2
- * Copyright (c) HashiCorp, Inc.
3
- * SPDX-License-Identifier: MPL-2.0
4
- */
5
-
6
- import type { Products } from '@hashicorp/platform-product-meta'
7
- import type { ActionsProps } from '@hashicorp/react-actions/types'
8
-
9
- export interface StepProps {
10
- /**
11
- * The heading for the step.
12
- */
13
- heading: string
14
- /**
15
- * Optional badge for the step.
16
- */
17
- badge?: string
18
- /**
19
- * Optional description for the step.
20
- */
21
- description?: string
22
- /**
23
- * The call to action for the step.
24
- */
25
- cta: {
26
- title: string
27
- url: string
28
- }
29
- }
30
-
31
- export interface NextStepsProps {
32
- /**
33
- * Render NextSteps on light or dark background.
34
- */
35
- appearance?: 'light' | 'dark'
36
- /**
37
- * Optional theme which controls the primary step color.
38
- */
39
- theme?: Products
40
- /**
41
- * The heading for the section.
42
- */
43
- heading: string
44
- /**
45
- * The description for the section.
46
- */
47
- description: string
48
- /**
49
- * The list of steps to display as tiles.
50
- */
51
- steps:
52
- | [StepProps]
53
- | [StepProps, StepProps]
54
- | [StepProps, StepProps, StepProps]
55
- /**
56
- * Optional CTA displayed below the tiles.
57
- */
58
- cta?: {
59
- copy: string
60
- href: string
61
- ctaText: string
62
- }
63
- }
@@ -1,11 +0,0 @@
1
- import { render, screen } from '@testing-library/react'
2
- import ProductBadge from '.'
3
-
4
- describe('<ProductBadge />', () => {
5
- it('should render the name of the product', () => {
6
- const productName = 'waypoint'
7
- render(<ProductBadge productName={productName} />)
8
- const productBadgeEl = screen.getByText(productName)
9
- expect(productBadgeEl).toBeInTheDocument()
10
- })
11
- })
@@ -1,42 +0,0 @@
1
- /**
2
- * Copyright (c) HashiCorp, Inc.
3
- * SPDX-License-Identifier: MPL-2.0
4
- */
5
-
6
- import type { Products } from '@hashicorp/platform-product-meta'
7
- import Badge from '@hashicorp/react-design-system-components/src/components/badge'
8
- import { IconDot16 } from '@hashicorp/flight-icons/svg-react/dot-16'
9
- import s from './style.module.css'
10
-
11
- export interface ProductBadgeProps {
12
- productName: Products
13
- hasDot?: boolean
14
- }
15
-
16
- const ProductBadge = ({ productName, hasDot }: ProductBadgeProps) => {
17
- const finalProductName = productName.replace('hashicorp', 'HashiCorp')
18
-
19
- const productBrand =
20
- finalProductName === 'HashiCorp cloud platform' ? 'hashicorp' : productName
21
-
22
- return (
23
- <Badge
24
- className={s.badge}
25
- text={finalProductName}
26
- icon={
27
- hasDot ? (
28
- <IconDot16
29
- width="100%"
30
- height="100%"
31
- style={{
32
- display: 'block',
33
- color: `var(--token-color-${productBrand}-brand)`,
34
- }}
35
- />
36
- ) : undefined
37
- }
38
- />
39
- )
40
- }
41
-
42
- export default ProductBadge
@@ -1,76 +0,0 @@
1
- /**
2
- * Copyright (c) HashiCorp, Inc.
3
- * SPDX-License-Identifier: MPL-2.0
4
- */
5
-
6
- .root {
7
- display: flex;
8
- align-items: center;
9
- height: 24px;
10
- padding: 1.5px 12px 2.5px 12px;
11
- border-radius: 24px;
12
- width: max-content;
13
- background-color: var(--brand);
14
- color: var(--brand-text-on-primary);
15
-
16
- &.hasDot {
17
- gap: 5px;
18
-
19
- &::before {
20
- --size: 7px;
21
-
22
- content: '';
23
- width: var(--size);
24
- height: var(--size);
25
- background-color: var(--brand);
26
- border-radius: 50%;
27
- }
28
- }
29
-
30
- &.light {
31
- &.secondary,
32
- &.hasDot {
33
- background-color: hsla(225, 2%, 63%, 0.13);
34
- }
35
- }
36
-
37
- &.dark {
38
- background-color: var(--wpl-neutral-0);
39
-
40
- &.secondary,
41
- &.hasDot {
42
- background-color: hsla(0, 0%, 100%, 0.18);
43
- }
44
- }
45
- }
46
-
47
- .text {
48
- display: inline-block;
49
- position: relative;
50
- font-family: var(--font-body);
51
- font-weight: var(--font-weight-bold);
52
- font-size: 14px;
53
- letter-spacing: 0.0125em;
54
- text-transform: capitalize;
55
- margin: 0;
56
-
57
- &.light {
58
- &.secondary,
59
- &.hasDot {
60
- color: var(--wpl-neutral-500);
61
- }
62
- }
63
-
64
- &.dark {
65
- color: var(--wpl-neutral-500);
66
-
67
- &.secondary,
68
- &.hasDot {
69
- color: var(--wpl-neutral-300);
70
- }
71
- }
72
- }
73
-
74
- .badge {
75
- text-transform: capitalize;
76
- }
@@ -1,84 +0,0 @@
1
- /**
2
- * Copyright (c) HashiCorp, Inc.
3
- * SPDX-License-Identifier: MPL-2.0
4
- */
5
-
6
- import type { ProductsUsedProps } from './types'
7
- import { IconBoundaryColor16 } from '@hashicorp/flight-icons/svg-react/boundary-color-16'
8
- import { IconConsulColor16 } from '@hashicorp/flight-icons/svg-react/consul-color-16'
9
- import { IconNomadColor16 } from '@hashicorp/flight-icons/svg-react/nomad-color-16'
10
- import { IconPackerColor16 } from '@hashicorp/flight-icons/svg-react/packer-color-16'
11
- import { IconTerraformColor16 } from '@hashicorp/flight-icons/svg-react/terraform-color-16'
12
- import { IconVaultColor16 } from '@hashicorp/flight-icons/svg-react/vault-color-16'
13
- import { IconVagrantColor16 } from '@hashicorp/flight-icons/svg-react/vagrant-color-16'
14
- import { IconWaypointColor16 } from '@hashicorp/flight-icons/svg-react/waypoint-color-16'
15
- import classNames from 'classnames'
16
- import s from './style.module.css'
17
-
18
- const ProductIconMap = {
19
- boundary: <IconBoundaryColor16 />,
20
- consul: <IconConsulColor16 />,
21
- nomad: <IconNomadColor16 />,
22
- packer: <IconPackerColor16 />,
23
- terraform: <IconTerraformColor16 />,
24
- vault: <IconVaultColor16 />,
25
- vagrant: <IconVagrantColor16 />,
26
- waypoint: <IconWaypointColor16 />,
27
- }
28
-
29
- const ProductsUsed = ({
30
- appearance = 'light',
31
- products,
32
- }: ProductsUsedProps) => {
33
- const eyebrowText = 'Products used'
34
-
35
- // Products with links have different spacing between each other (8px) than
36
- // products without links (16px). This spacing is set on the `ul` using the `gap` property.
37
- // This logic determines whether or not products have links so as to conditionally change
38
- // the spacing.
39
- const productsHaveLinks = products[0]?.hasOwnProperty('href')
40
-
41
- return (
42
- <div className={classNames([s.root, s[appearance]])} data-testid="root">
43
- <p className={classNames([s.eyebrow, s[appearance]])}>{eyebrowText}</p>
44
- <ul
45
- className={classNames([s.productList], {
46
- [s.isSmallerGap]: productsHaveLinks,
47
- })}
48
- >
49
- {products.map((product, index) => {
50
- return (
51
- <li
52
- // eslint-disable-next-line react/no-array-index-key
53
- key={index}
54
- >
55
- <ConditionalLink
56
- className={classNames([s.product, s[appearance]])}
57
- href={product.href}
58
- >
59
- <span className={s.productIcon}>
60
- {ProductIconMap[product.name]}
61
- </span>
62
- <span className={classNames([s.productName, s[appearance]])}>
63
- {product.name}
64
- </span>
65
- </ConditionalLink>
66
- </li>
67
- )
68
- })}
69
- </ul>
70
- </div>
71
- )
72
- }
73
-
74
- const ConditionalLink = ({ href, children, className }) => {
75
- return href ? (
76
- <a href={href} className={className} data-testid={'anchorEl'}>
77
- {children}
78
- </a>
79
- ) : (
80
- <div className={className}>{children}</div>
81
- )
82
- }
83
-
84
- export default ProductsUsed
@@ -1,87 +0,0 @@
1
- /**
2
- * Copyright (c) HashiCorp, Inc.
3
- * SPDX-License-Identifier: MPL-2.0
4
- */
5
-
6
- .root {
7
- position: relative;
8
- }
9
-
10
- .eyebrow {
11
- composes: g-type-label-strong from global;
12
- margin: 0 0 var(--hdsplus-spacing-05) 0;
13
- color: var(--token-color-foreground-faint);
14
-
15
- &.dark {
16
- color: var(--wpl-neutral-400);
17
- }
18
- }
19
-
20
- .productList {
21
- display: flex;
22
- align-items: center;
23
- flex-wrap: wrap;
24
- padding: 0;
25
- list-style-type: none;
26
- row-gap: var(--hdsplus-spacing-03);
27
- column-gap: var(--hdsplus-spacing-05);
28
-
29
- &.isSmallerGap {
30
- column-gap: var(--hdsplus-spacing-03);
31
- }
32
- }
33
-
34
- .product {
35
- display: flex;
36
- align-items: center;
37
-
38
- &[href] {
39
- min-height: 40px;
40
- padding: var(--hdsplus-spacing-03) var(--hdsplus-spacing-04);
41
- border-radius: calc(var(--hdsplus-spacing-03) / 2);
42
- border: 1px solid var(--token-color-border-primary);
43
- transition: background-color 0.2s, border 0.2s;
44
-
45
- &:hover {
46
- background-color: var(--token-color-border-primary);
47
- }
48
-
49
- &:focus {
50
- outline: transparent;
51
- }
52
-
53
- &:focus-visible {
54
- outline: 2px solid var(--token-color-surface-interactive-active);
55
- outline-offset: 2px;
56
- }
57
-
58
- &.dark {
59
- border-color: var(--token-color-border-strong);
60
-
61
- &:hover {
62
- background-color: var(--token-color-border-strong);
63
- }
64
-
65
- &:focus-visible {
66
- outline: 2px solid var(--token-color-border-strong);
67
- }
68
- }
69
- }
70
- }
71
-
72
- .productIcon {
73
- display: flex;
74
- align-items: center;
75
- margin-right: 6px;
76
- }
77
-
78
- .productName {
79
- composes: hds-typography-body-100 hds-font-weight-medium from global;
80
- font-size: 14px;
81
- text-transform: capitalize;
82
- color: var(--token-color-foreground-primary);
83
-
84
- &.dark {
85
- color: var(--wpl-neutral-0);
86
- }
87
- }
@@ -1,31 +0,0 @@
1
- /**
2
- * Copyright (c) HashiCorp, Inc.
3
- * SPDX-License-Identifier: MPL-2.0
4
- */
5
-
6
- import type { Products } from '@hashicorp/platform-product-meta'
7
-
8
- export interface ProductsUsedProps {
9
- /**
10
- * Display actions on light or dark background.
11
- */
12
- appearance?: 'light' | 'dark'
13
- /**
14
- * Array of products or products with links. Only supports one or the other, not a mix of the two.
15
- */
16
- products: Array<Product> | Array<ProductLink>
17
- }
18
-
19
- interface Product {
20
- /**
21
- * Renders a product name
22
- */
23
- name: Exclude<Products, 'hashicorp'>
24
- }
25
-
26
- interface ProductLink extends Product {
27
- /**
28
- * Where the anchor element links to when clicked.
29
- */
30
- href: string
31
- }