@hashicorp/react-components 0.0.0-canary.29ac326 → 0.0.0-canary.32599ff
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/package.json +7 -6
- package/src/components/actions/index.tsx +5 -5
- package/src/components/call-to-action/index.tsx +12 -10
- package/src/components/call-to-action/styles/variant-centered.module.css +5 -4
- package/src/components/call-to-action/styles/variant-compact-grid.module.css +6 -4
- package/src/components/call-to-action/styles/variant-compact.module.css +6 -4
- package/src/components/call-to-action/styles/variant-links.module.css +6 -11
- package/src/components/card/index.test.tsx +1 -1
- package/src/components/card/newsroom-card/index.test.tsx +1 -1
- package/src/components/card/newsroom-card/style.module.css +1 -1
- package/src/components/card/partner-card/index.tsx +5 -5
- package/src/components/card/person-card/index.tsx +3 -3
- package/src/components/card/primitives.tsx +20 -19
- package/src/components/card/resource-card/index.test.tsx +1 -1
- package/src/components/card/resource-card/index.tsx +3 -0
- package/src/components/card/style.module.css +2 -2
- package/src/components/card/types.ts +2 -2
- package/src/components/card/unified-card/index.spec.tsx +40 -0
- package/src/components/card/unified-card/index.tsx +5 -11
- package/src/components/inline-video/index.tsx +104 -0
- package/src/components/inline-video/style.module.css +99 -0
- package/src/components/intro/style.module.css +2 -2
- package/src/components/marketo-form/contexts/FormMetadata.ts +2 -0
- package/src/components/marketo-form/form/index.tsx +12 -7
- package/src/components/marketo-form/partials/fields/checkbox-field/index.tsx +1 -1
- package/src/components/marketo-form/partials/fields/email-field/index.tsx +1 -1
- package/src/components/marketo-form/partials/fields/form-page-url-field/index.tsx +12 -1
- package/src/components/marketo-form/partials/fields/hidden-field/index.tsx +1 -0
- package/src/components/marketo-form/partials/fields/htmltext-field/style.module.css +2 -2
- package/src/components/marketo-form/partials/fields/radio-buttons-field/index.tsx +1 -1
- package/src/components/marketo-form/partials/fields/select-field/index.tsx +1 -1
- package/src/components/marketo-form/partials/fields/telephone-field/index.tsx +1 -1
- package/src/components/marketo-form/partials/fields/text-field/index.tsx +1 -1
- package/src/components/marketo-form/partials/fields/textarea-field/index.tsx +1 -1
- package/src/components/marketo-form/types.ts +10 -12
- package/src/components/marketo-form/utils.ts +1 -1
- package/src/components/nav-panel/components/link-list/index.tsx +15 -9
- package/src/components/nav-panel/components/link-list/style.module.css +10 -10
- package/src/components/nav-panel/components/panel/column/index.tsx +15 -2
- package/src/components/nav-panel/components/panel/column/style.module.css +13 -3
- package/src/components/nav-panel/components/panel/root/index.tsx +11 -2
- package/src/components/nav-panel/components/panel/root/style.module.css +20 -6
- package/src/components/nav-panel/components/promo/index.tsx +23 -10
- package/src/components/nav-panel/components/promo/style.module.css +48 -16
- package/src/components/nav-panel/product-panel/index.tsx +46 -16
- package/src/components/nav-panel/product-panel/style.module.css +151 -42
- package/src/components/nav-panel/standard-panel/index.tsx +3 -0
- package/src/components/nav-panel/standard-panel/style.module.css +2 -2
- package/src/components/next-steps/index.tsx +3 -2
- package/src/components/next-steps/style.module.css +18 -18
- package/src/components/product-badge/index.tsx +1 -1
- package/src/components/product-badge/style.module.css +2 -2
- package/src/components/products-used/style.module.css +7 -7
- package/src/components/related-content/index.tsx +28 -29
- package/src/components/related-content/style.module.css +58 -60
- package/src/components/related-content/types.ts +2 -2
- package/src/components/subnav/index.tsx +12 -3
- package/src/components/subnav/partials/CtaLinks/github-stars-link/style.module.css +8 -12
- package/src/components/subnav/partials/CtaLinks/index.tsx +9 -8
- package/src/components/subnav/partials/CtaLinks/style.module.css +6 -6
- package/src/components/subnav/partials/DropdownTrigger/index.tsx +2 -2
- package/src/components/subnav/partials/DropdownTrigger/style.module.css +11 -8
- package/src/components/subnav/partials/MenuItemsDefault/index.tsx +24 -8
- package/src/components/subnav/partials/MenuItemsDefault/style.module.css +44 -31
- package/src/components/subnav/partials/MenuItemsOverflow/index.tsx +17 -4
- package/src/components/subnav/partials/MenuItemsOverflow/style.module.css +24 -18
- package/src/components/subnav/partials/TitleLink/index.tsx +6 -4
- package/src/components/subnav/partials/TitleLink/mktg-logos/all-community-product-logos_on-dark.ts +2 -1
- package/src/components/subnav/partials/TitleLink/mktg-logos/all-community-product-logos_on-light.ts +2 -1
- package/src/components/subnav/partials/TitleLink/style.module.css +3 -3
- package/src/components/subnav/partials/nav-item-text/style.module.css +2 -4
- package/src/components/subnav/style.module.css +5 -7
- package/src/lib/get-localized-link-props/index.test.ts +30 -0
- package/src/lib/get-localized-link-props/index.ts +45 -0
- package/src/lib/parse-url/index.test.ts +40 -1
- package/src/lib/parse-url/index.ts +77 -9
- package/src/lib/supported-locales/index.ts +1 -0
- package/src/lib/track-nav-click-event/index.ts +4 -4
- package/src/lib/v/index.ts +4 -5
- package/src/components/consent-manager/README.md +0 -73
- package/src/components/consent-manager/components/banner/banner.module.css +0 -23
- package/src/components/consent-manager/components/banner/banner.test.tsx +0 -31
- package/src/components/consent-manager/components/banner/banner.tsx +0 -73
- package/src/components/consent-manager/components/dialog/dialog.module.css +0 -145
- package/src/components/consent-manager/components/dialog/dialog.test.tsx +0 -194
- package/src/components/consent-manager/components/dialog/dialog.tsx +0 -339
- package/src/components/consent-manager/img/icn_close.tsx +0 -19
- package/src/components/consent-manager/index.test.tsx +0 -334
- package/src/components/consent-manager/index.tsx +0 -186
- package/src/components/consent-manager/loader/README.md +0 -29
- package/src/components/consent-manager/loader/categories.ts +0 -22
- package/src/components/consent-manager/loader/index.tsx +0 -94
- package/src/components/consent-manager/loader/presets/enterprise.ts +0 -12
- package/src/components/consent-manager/loader/presets/oss.ts +0 -10
- package/src/components/consent-manager/loader/services.ts +0 -45
- package/src/components/consent-manager/scripts/custom.tsx +0 -59
- package/src/components/consent-manager/scripts/segment.tsx +0 -87
- package/src/components/consent-manager/style.module.css +0 -9
- package/src/components/consent-manager/types.ts +0 -55
- package/src/components/consent-manager/util/cookies.test.ts +0 -75
- package/src/components/consent-manager/util/cookies.ts +0 -70
- package/src/components/consent-manager/util/integrations.test.ts +0 -115
- package/src/components/consent-manager/util/integrations.ts +0 -110
- package/src/components/subnav/theme.module.css +0 -50
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) HashiCorp, Inc.
|
|
3
|
+
* SPDX-License-Identifier: MPL-2.0
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { useEffect, useState } from 'react'
|
|
7
|
+
import classNames from 'classnames'
|
|
8
|
+
import WistiaPlayer from 'react-player/wistia'
|
|
9
|
+
import Player from 'react-player'
|
|
10
|
+
import s from './style.module.css'
|
|
11
|
+
|
|
12
|
+
interface InlineVideoProps {
|
|
13
|
+
appearance?: 'light' | 'dark'
|
|
14
|
+
url: string
|
|
15
|
+
description?: string
|
|
16
|
+
solution?: 'infrastructure' | 'security' | 'networking' | 'applications'
|
|
17
|
+
gradientPosition?: 'left' | 'right' | false
|
|
18
|
+
videoClassName?: string
|
|
19
|
+
aspectRatio?: string
|
|
20
|
+
showAccent?: boolean
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const DEFAULT_ASPECT_RATIO = '16 / 9'
|
|
24
|
+
|
|
25
|
+
export default function InlineVideo(props: InlineVideoProps) {
|
|
26
|
+
const {
|
|
27
|
+
appearance = 'light',
|
|
28
|
+
gradientPosition = 'left',
|
|
29
|
+
url,
|
|
30
|
+
description,
|
|
31
|
+
solution,
|
|
32
|
+
videoClassName,
|
|
33
|
+
aspectRatio,
|
|
34
|
+
showAccent = true,
|
|
35
|
+
} = props
|
|
36
|
+
|
|
37
|
+
const hasAspectRatio = Boolean(aspectRatio)
|
|
38
|
+
|
|
39
|
+
const playerProps = {
|
|
40
|
+
controls: true,
|
|
41
|
+
url,
|
|
42
|
+
width: '100%',
|
|
43
|
+
height: '100%',
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
const [hasWindow, setHasWindow] = useState(false)
|
|
47
|
+
|
|
48
|
+
useEffect(() => {
|
|
49
|
+
if (typeof window !== 'undefined') {
|
|
50
|
+
setHasWindow(true)
|
|
51
|
+
}
|
|
52
|
+
}, [])
|
|
53
|
+
|
|
54
|
+
return (
|
|
55
|
+
<div
|
|
56
|
+
className={classNames(
|
|
57
|
+
s.inlineVideo,
|
|
58
|
+
s[appearance],
|
|
59
|
+
gradientPosition && s[gradientPosition]
|
|
60
|
+
)}
|
|
61
|
+
data-testid="wpl-inline-video"
|
|
62
|
+
>
|
|
63
|
+
<div
|
|
64
|
+
className={classNames(s.videoContainer, solution && s[solution], {
|
|
65
|
+
[s.hideAccentColor]: !showAccent,
|
|
66
|
+
})}
|
|
67
|
+
style={{
|
|
68
|
+
['--aspect-ratio' as string]: hasAspectRatio
|
|
69
|
+
? aspectRatio
|
|
70
|
+
: DEFAULT_ASPECT_RATIO,
|
|
71
|
+
}}
|
|
72
|
+
>
|
|
73
|
+
<div
|
|
74
|
+
className={classNames(
|
|
75
|
+
s.video,
|
|
76
|
+
{
|
|
77
|
+
[s.innerHasAspectRatio]: hasAspectRatio,
|
|
78
|
+
},
|
|
79
|
+
videoClassName
|
|
80
|
+
)}
|
|
81
|
+
>
|
|
82
|
+
{hasWindow ? (
|
|
83
|
+
<>
|
|
84
|
+
{url.includes('wistia') ? (
|
|
85
|
+
<WistiaPlayer
|
|
86
|
+
{...playerProps}
|
|
87
|
+
config={{
|
|
88
|
+
options: {
|
|
89
|
+
controlsVisibleOnLoad: false,
|
|
90
|
+
},
|
|
91
|
+
}}
|
|
92
|
+
/>
|
|
93
|
+
) : (
|
|
94
|
+
<Player {...playerProps} />
|
|
95
|
+
)}
|
|
96
|
+
</>
|
|
97
|
+
) : null}
|
|
98
|
+
</div>
|
|
99
|
+
</div>
|
|
100
|
+
|
|
101
|
+
{description ? <p className={s.description}>{description}</p> : null}
|
|
102
|
+
</div>
|
|
103
|
+
)
|
|
104
|
+
}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) HashiCorp, Inc.
|
|
3
|
+
* SPDX-License-Identifier: MPL-2.0
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
.inlineVideo {
|
|
7
|
+
--gradient-size: 32px;
|
|
8
|
+
|
|
9
|
+
/* Apply border radius to Wistia play button */
|
|
10
|
+
& :global(.w-bpb-wrapper) {
|
|
11
|
+
border-radius: 4px !important;
|
|
12
|
+
overflow: hidden;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.videoContainer {
|
|
17
|
+
--gradient: linear-gradient(180deg, #b5d9fa 0%, #1a5ee5 100%);
|
|
18
|
+
|
|
19
|
+
width: 100%;
|
|
20
|
+
position: relative;
|
|
21
|
+
|
|
22
|
+
@media (--large) {
|
|
23
|
+
@nest .left & {
|
|
24
|
+
padding-left: var(--gradient-size);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
@nest .right & {
|
|
28
|
+
padding-right: var(--gradient-size);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
&.hideAccentColor {
|
|
32
|
+
&::before {
|
|
33
|
+
background-image: none;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
&::before {
|
|
38
|
+
position: absolute;
|
|
39
|
+
content: '';
|
|
40
|
+
width: 100%;
|
|
41
|
+
height: calc(100% - var(--gradient-size) * 2);
|
|
42
|
+
top: var(--gradient-size);
|
|
43
|
+
left: 0;
|
|
44
|
+
border-radius: 8px;
|
|
45
|
+
background-image: var(--gradient);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
&.infrastructure {
|
|
50
|
+
--gradient: linear-gradient(180deg, #8cdeff 0%, #8763d9 100%);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
&.security {
|
|
54
|
+
--gradient: linear-gradient(180deg, #ffe58c 0%, #f26b63 100%);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
&.networking {
|
|
58
|
+
--gradient: linear-gradient(180deg, #ffb2b8 0%, #c74fb8 100%);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
&.applications {
|
|
62
|
+
--gradient: linear-gradient(180deg, #a3f7d6 0%, #5cd1d9 50%, #5494e3 100%);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.video {
|
|
67
|
+
aspect-ratio: var(--aspect-ratio);
|
|
68
|
+
border-radius: 8px;
|
|
69
|
+
background-color: var(--wpl-neutral-50);
|
|
70
|
+
overflow: hidden;
|
|
71
|
+
position: relative;
|
|
72
|
+
|
|
73
|
+
@nest .dark & {
|
|
74
|
+
background-color: var(--wpl-neutral-800);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
&.innerHasAspectRatio {
|
|
78
|
+
width: calc(var(--aspect-ratio) * 100%);
|
|
79
|
+
height: auto;
|
|
80
|
+
max-width: 100%;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
.description {
|
|
84
|
+
composes: g-type-body-small-strong from global;
|
|
85
|
+
color: var(--wpl-neutral-500);
|
|
86
|
+
padding: 16px 24px 0 24px;
|
|
87
|
+
margin: 0;
|
|
88
|
+
text-align: center;
|
|
89
|
+
|
|
90
|
+
@media (--large) {
|
|
91
|
+
@nest .left & {
|
|
92
|
+
padding-left: calc(24px + var(--gradient-size));
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
@nest .right & {
|
|
96
|
+
padding-right: calc(24px + var(--gradient-size));
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
@@ -17,8 +17,8 @@
|
|
|
17
17
|
.eyebrow {
|
|
18
18
|
--color: var(--wpl-neutral-500);
|
|
19
19
|
|
|
20
|
-
composes:
|
|
21
|
-
font-weight: var(--font-weight-bold);
|
|
20
|
+
composes: mds-typography-label from global;
|
|
21
|
+
font-weight: var(--mds-typography-font-weight-bold);
|
|
22
22
|
text-transform: uppercase;
|
|
23
23
|
margin: 0 0 32px;
|
|
24
24
|
color: var(--color);
|
|
@@ -3,9 +3,11 @@
|
|
|
3
3
|
* SPDX-License-Identifier: MPL-2.0
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
+
'use client'
|
|
7
|
+
|
|
6
8
|
import { useEffect, useMemo, useRef } from 'react'
|
|
7
9
|
import { useForm, FormProvider } from 'react-hook-form'
|
|
8
|
-
import
|
|
10
|
+
import { HDSButton } from '@hashicorp/react-mds/src/hds/components/button'
|
|
9
11
|
import VisibilityRule from '../partials/visibility-rule'
|
|
10
12
|
import NameField from '../partials/fields/name-field'
|
|
11
13
|
import { FormMetadataContext } from '../contexts/FormMetadata'
|
|
@@ -81,7 +83,10 @@ interface Props {
|
|
|
81
83
|
/**
|
|
82
84
|
* Callback called when form has been successfully submitted.
|
|
83
85
|
*/
|
|
84
|
-
onSubmitSuccess?: (
|
|
86
|
+
onSubmitSuccess?: (
|
|
87
|
+
dataToPersist: Record<string, unknown>,
|
|
88
|
+
response: MarketoSubmissionResponse
|
|
89
|
+
) => void
|
|
85
90
|
|
|
86
91
|
/**
|
|
87
92
|
* Callback called when form submission results in an error.
|
|
@@ -278,16 +283,16 @@ const Form = ({
|
|
|
278
283
|
marketoResponse.success &&
|
|
279
284
|
!includesSkippedRecords(marketoResponse)
|
|
280
285
|
) {
|
|
281
|
-
if (onSubmitSuccess) {
|
|
282
|
-
onSubmitSuccess()
|
|
283
|
-
}
|
|
284
|
-
|
|
285
286
|
// Remove fields that shouldn't be stored in local storage
|
|
286
287
|
const dataToPersist = Object.fromEntries(
|
|
287
288
|
Object.entries(data).filter(([k]) => STORED_FIELD_NAMES.includes(k))
|
|
288
289
|
)
|
|
289
290
|
localStorage.setItem('marketoFormData', JSON.stringify(dataToPersist))
|
|
290
291
|
|
|
292
|
+
if (onSubmitSuccess) {
|
|
293
|
+
onSubmitSuccess(dataToPersist, marketoResponse)
|
|
294
|
+
}
|
|
295
|
+
|
|
291
296
|
if (resetOnSubmission) {
|
|
292
297
|
methods.reset()
|
|
293
298
|
}
|
|
@@ -345,7 +350,7 @@ const Form = ({
|
|
|
345
350
|
/>
|
|
346
351
|
)
|
|
347
352
|
})}
|
|
348
|
-
<
|
|
353
|
+
<HDSButton
|
|
349
354
|
type="submit"
|
|
350
355
|
size="large"
|
|
351
356
|
disabled={
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
import { useFormContext } from 'react-hook-form'
|
|
7
7
|
// import CheckboxInput from '@hashicorp/react-form-fields/checkbox'
|
|
8
|
-
import Checkbox from '@hashicorp/react-
|
|
8
|
+
import Checkbox from '@hashicorp/react-mds/src/hds/components/form/checkbox'
|
|
9
9
|
import FieldWrapper from '../../field-wrapper'
|
|
10
10
|
import { formattedLabel, useErrorMessage } from '../../../utils'
|
|
11
11
|
import type { MarketoFormCheckboxField } from '../../../types'
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
import { useFormContext } from 'react-hook-form'
|
|
7
7
|
// import TextInput from '@hashicorp/react-form-fields/text'
|
|
8
|
-
import TextInput from '@hashicorp/react-
|
|
8
|
+
import TextInput from '@hashicorp/react-mds/src/hds/components/form/text-input'
|
|
9
9
|
import FieldWrapper from '../../field-wrapper'
|
|
10
10
|
import { formattedLabel, useErrorMessage } from '../../../utils'
|
|
11
11
|
import type { MarketoFormEmailField } from '../../../types'
|
|
@@ -3,8 +3,11 @@
|
|
|
3
3
|
* SPDX-License-Identifier: MPL-2.0
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
+
'use client'
|
|
7
|
+
|
|
6
8
|
import { useEffect } from 'react'
|
|
7
9
|
import { useFormContext } from 'react-hook-form'
|
|
10
|
+
import { removeLocaleFromPathname } from '@web/utils/supported-locales/index'
|
|
8
11
|
import type { MarketoFormHiddenField } from '../../../types'
|
|
9
12
|
|
|
10
13
|
const FormPageUrlField = ({ field }: { field: MarketoFormHiddenField }) => {
|
|
@@ -12,7 +15,15 @@ const FormPageUrlField = ({ field }: { field: MarketoFormHiddenField }) => {
|
|
|
12
15
|
|
|
13
16
|
useEffect(() => {
|
|
14
17
|
const { protocol, host, pathname } = window.location
|
|
15
|
-
|
|
18
|
+
// Marketo campaigns expect a URL that does not include the locale.
|
|
19
|
+
// This is because the campaigns were created prior to locales being
|
|
20
|
+
// added to hashicorp.com paths. As a result, we need to strip out the
|
|
21
|
+
// locale from the path in order for Marketo campaigns to work.
|
|
22
|
+
// In the future, we should better understand why this dependency exists
|
|
23
|
+
// and explore ways to make this less brittle.
|
|
24
|
+
const pathnameWithoutLocale = removeLocaleFromPathname(pathname)
|
|
25
|
+
const url = `${protocol}//${host}${pathnameWithoutLocale}`
|
|
26
|
+
setValue(field.id, url)
|
|
16
27
|
}, [])
|
|
17
28
|
|
|
18
29
|
return <input type="hidden" {...register(field.id)} />
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
.htmltext {
|
|
2
2
|
composes: g-type-body-small from global;
|
|
3
|
-
margin-top: var(--
|
|
4
|
-
margin-bottom: var(--
|
|
3
|
+
margin-top: var(--mds-spacing-04);
|
|
4
|
+
margin-bottom: var(--mds-spacing-07);
|
|
5
5
|
color: var(--token-color-foreground-faint);
|
|
6
6
|
|
|
7
7
|
& a {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useFormContext } from 'react-hook-form'
|
|
2
2
|
import RadioCard, {
|
|
3
3
|
RadioCardGroup,
|
|
4
|
-
} from '@hashicorp/react-
|
|
4
|
+
} from '@hashicorp/react-mds/src/hds/components/form/radio-card'
|
|
5
5
|
import FieldWrapper from '../../field-wrapper'
|
|
6
6
|
import type { MarketoFormRadioButtonsField } from '../../../types'
|
|
7
7
|
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import { useFormContext } from 'react-hook-form'
|
|
7
|
-
import Select from '@hashicorp/react-
|
|
7
|
+
import Select from '@hashicorp/react-mds/src/hds/components/form/select'
|
|
8
8
|
import FieldWrapper from '../../field-wrapper'
|
|
9
9
|
import { formattedLabel, useErrorMessage } from '../../../utils'
|
|
10
10
|
import type { MarketoFormSelectField } from '../../../types'
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import { useFormContext } from 'react-hook-form'
|
|
7
|
-
import TextInput from '@hashicorp/react-
|
|
7
|
+
import TextInput from '@hashicorp/react-mds/src/hds/components/form/text-input'
|
|
8
8
|
import FieldWrapper from '../../field-wrapper'
|
|
9
9
|
import { formattedLabel, useErrorMessage } from '../../../utils'
|
|
10
10
|
import type { MarketoFormTelephoneField } from '../../../types'
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import { useFormContext } from 'react-hook-form'
|
|
7
|
-
import TextInput from '@hashicorp/react-
|
|
7
|
+
import TextInput from '@hashicorp/react-mds/src/hds/components/form/text-input'
|
|
8
8
|
import FieldWrapper from '../../field-wrapper'
|
|
9
9
|
import { formattedLabel, useErrorMessage } from '../../../utils'
|
|
10
10
|
import type { MarketoFormTextField } from '../../../types'
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import { useFormContext } from 'react-hook-form'
|
|
7
|
-
import Textarea from '@hashicorp/react-
|
|
7
|
+
import Textarea from '@hashicorp/react-mds/src/hds/components/form/textarea'
|
|
8
8
|
import FieldWrapper from '../../field-wrapper'
|
|
9
9
|
import { formattedLabel, useErrorMessage } from '../../../utils'
|
|
10
10
|
import type { MarketoFormTextAreaField } from '../../../types'
|
|
@@ -15,6 +15,7 @@ export type MarketoFormDatatype =
|
|
|
15
15
|
| 'hidden'
|
|
16
16
|
| 'htmltext'
|
|
17
17
|
| 'radioButtons'
|
|
18
|
+
| 'fieldset'
|
|
18
19
|
|
|
19
20
|
export interface Autofill {
|
|
20
21
|
value: string
|
|
@@ -41,7 +42,7 @@ export interface MarketoBaseFormField {
|
|
|
41
42
|
columnNumber: number
|
|
42
43
|
defaultValue?: string
|
|
43
44
|
label?: string
|
|
44
|
-
required
|
|
45
|
+
required?: boolean
|
|
45
46
|
validationMessage?: string
|
|
46
47
|
autoFill?: Autofill
|
|
47
48
|
visibilityRules?: VisibilityRules
|
|
@@ -106,12 +107,9 @@ export interface MarketoFormHiddenField extends MarketoBaseFormField {
|
|
|
106
107
|
dataType: 'hidden'
|
|
107
108
|
}
|
|
108
109
|
|
|
109
|
-
export interface MarketoFormHtmltextField {
|
|
110
|
-
id: string
|
|
111
|
-
labelWidth: number
|
|
110
|
+
export interface MarketoFormHtmltextField extends MarketoBaseFormField {
|
|
112
111
|
dataType: 'htmltext'
|
|
113
|
-
|
|
114
|
-
columnNumber: number
|
|
112
|
+
labelWidth: number
|
|
115
113
|
visibilityRules?: VisibilityRules
|
|
116
114
|
text: string
|
|
117
115
|
}
|
|
@@ -125,12 +123,8 @@ export interface MarketoFormRadioButtonsField extends MarketoBaseFormField {
|
|
|
125
123
|
}
|
|
126
124
|
}
|
|
127
125
|
|
|
128
|
-
export interface MarketoFormFieldset {
|
|
129
|
-
id: string
|
|
130
|
-
label?: string
|
|
126
|
+
export interface MarketoFormFieldset extends MarketoBaseFormField {
|
|
131
127
|
dataType: 'fieldset'
|
|
132
|
-
rowNumber: number
|
|
133
|
-
columnNumber: number
|
|
134
128
|
visibilityRules?: VisibilityRules
|
|
135
129
|
fields: Array<string>
|
|
136
130
|
}
|
|
@@ -232,8 +226,12 @@ export type MarketoFormGroups = Record<
|
|
|
232
226
|
export type SubmissionFilter = (req: NextApiRequest) => Promise<boolean>
|
|
233
227
|
|
|
234
228
|
export interface MarketoSubmissionResponse {
|
|
229
|
+
requestId?: string
|
|
235
230
|
success: boolean
|
|
236
|
-
result: {
|
|
231
|
+
result: {
|
|
232
|
+
status: 'created' | 'updated' | 'skipped'
|
|
233
|
+
id?: number
|
|
234
|
+
}[]
|
|
237
235
|
}
|
|
238
236
|
|
|
239
237
|
export type OnSubmitData = Record<string, unknown>
|
|
@@ -18,7 +18,7 @@ import cookies from 'js-cookie'
|
|
|
18
18
|
// endpoints return SOAP names, while others accept REST names. This object
|
|
19
19
|
// contains all fields from our Marketo instance that have a REST name that is
|
|
20
20
|
// different from the SOAP name.
|
|
21
|
-
const soapToRESTFieldNames: Record<string, string> = {
|
|
21
|
+
export const soapToRESTFieldNames: Record<string, string> = {
|
|
22
22
|
Address: 'address',
|
|
23
23
|
AnnualRevenue: 'annualRevenue',
|
|
24
24
|
AnonymousIP: 'anonymousIP',
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import Link from 'next/link'
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import FlightIcon from '@hashicorp/react-
|
|
2
|
+
import { vercelSplit } from '../../../../lib/v'
|
|
3
|
+
import { getLocalizedLinkProps } from '../../../../lib/get-localized-link-props'
|
|
4
|
+
import FlightIcon from '@hashicorp/react-mds/src/hds/components/flight-icon'
|
|
5
5
|
import * as NavigationMenu from '@radix-ui/react-navigation-menu'
|
|
6
6
|
import s from './style.module.css'
|
|
7
7
|
|
|
8
8
|
export interface LinkListProps {
|
|
9
|
+
locale?: string
|
|
9
10
|
links: {
|
|
10
11
|
title: string
|
|
11
12
|
url: string
|
|
@@ -37,15 +38,20 @@ const GRADIENT_VALUE_MAP = new Map([
|
|
|
37
38
|
],
|
|
38
39
|
])
|
|
39
40
|
|
|
40
|
-
export default function LinkList({
|
|
41
|
+
export default function LinkList({
|
|
42
|
+
locale,
|
|
43
|
+
links,
|
|
44
|
+
linkClickHandler,
|
|
45
|
+
}: LinkListProps) {
|
|
41
46
|
return (
|
|
42
47
|
<ul className={s.linkList}>
|
|
43
48
|
{links.map((link) => {
|
|
44
49
|
let style
|
|
45
50
|
link.iconGradient
|
|
46
51
|
? (style = {
|
|
47
|
-
'--iconGradient': GRADIENT_VALUE_MAP.get(
|
|
48
|
-
|
|
52
|
+
'--iconGradient': GRADIENT_VALUE_MAP.get(
|
|
53
|
+
vercelSplit(link.iconGradient)
|
|
54
|
+
)?.iconGradient,
|
|
49
55
|
} as React.CSSProperties)
|
|
50
56
|
: (style = null)
|
|
51
57
|
return (
|
|
@@ -53,19 +59,19 @@ export default function LinkList({ links, linkClickHandler }: LinkListProps) {
|
|
|
53
59
|
<NavigationMenu.Link asChild>
|
|
54
60
|
<Link
|
|
55
61
|
className={s.link}
|
|
56
|
-
|
|
62
|
+
{...getLocalizedLinkProps(link.url, locale)}
|
|
57
63
|
onClickCapture={() => {
|
|
58
64
|
linkClickHandler && linkClickHandler(link.title, link.url)
|
|
59
65
|
}}
|
|
60
66
|
>
|
|
61
67
|
{link.iconGradient && link.icon ? (
|
|
62
68
|
<div className={s.iconBackground} style={style}>
|
|
63
|
-
<FlightIcon name={
|
|
69
|
+
<FlightIcon name={vercelSplit(link.icon)} />
|
|
64
70
|
</div>
|
|
65
71
|
) : (
|
|
66
72
|
link.icon && (
|
|
67
73
|
<FlightIcon
|
|
68
|
-
name={
|
|
74
|
+
name={vercelSplit(link.icon)}
|
|
69
75
|
color="var(--token-color-foreground-faint)"
|
|
70
76
|
/>
|
|
71
77
|
)
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
display: flex;
|
|
3
3
|
list-style: none;
|
|
4
4
|
flex-direction: column;
|
|
5
|
-
gap: var(--
|
|
5
|
+
gap: var(--mds-spacing-03);
|
|
6
6
|
margin: 0;
|
|
7
7
|
padding: 0;
|
|
8
8
|
}
|
|
@@ -10,14 +10,14 @@
|
|
|
10
10
|
.link {
|
|
11
11
|
color: var(--token-color-foreground-primary);
|
|
12
12
|
display: flex;
|
|
13
|
-
gap: var(--
|
|
14
|
-
padding: var(--
|
|
13
|
+
gap: var(--mds-spacing-04);
|
|
14
|
+
padding: var(--mds-spacing-03) var(--mds-spacing-04);
|
|
15
15
|
min-width: 190px;
|
|
16
16
|
align-items: center;
|
|
17
17
|
|
|
18
18
|
&:hover {
|
|
19
19
|
background-color: var(--token-color-surface-interactive-hover);
|
|
20
|
-
border-radius: var(--
|
|
20
|
+
border-radius: var(--mds-spacing-01);
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
&:has(.iconBackground) {
|
|
@@ -35,15 +35,15 @@
|
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
.description {
|
|
38
|
-
font-size: var(--
|
|
39
|
-
font-weight: var(--
|
|
40
|
-
margin-top: var(--
|
|
38
|
+
font-size: var(--mds-typography-body-200-font-size);
|
|
39
|
+
font-weight: var(--mds-typography-font-weight-regular);
|
|
40
|
+
margin-top: var(--mds-spacing-02);
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
.iconBackground {
|
|
44
44
|
background: var(--iconGradient);
|
|
45
|
-
height: var(--
|
|
46
|
-
width: var(--
|
|
45
|
+
height: var(--mds-spacing-08);
|
|
46
|
+
width: var(--mds-spacing-08);
|
|
47
47
|
display: flex;
|
|
48
48
|
align-items: center;
|
|
49
49
|
justify-content: center;
|
|
@@ -53,5 +53,5 @@
|
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
.boldTitle {
|
|
56
|
-
font-weight: var(--font-weight-
|
|
56
|
+
font-weight: var(--mds-typography-font-weight-semibold);
|
|
57
57
|
}
|
|
@@ -4,8 +4,21 @@ import s from './style.module.css'
|
|
|
4
4
|
export interface NavColumnProps {
|
|
5
5
|
className?: string
|
|
6
6
|
children: React.ReactNode
|
|
7
|
+
hasSidePanel?: boolean
|
|
7
8
|
}
|
|
8
9
|
|
|
9
|
-
export default function Column({
|
|
10
|
-
|
|
10
|
+
export default function Column({
|
|
11
|
+
className,
|
|
12
|
+
children,
|
|
13
|
+
hasSidePanel,
|
|
14
|
+
}: NavColumnProps) {
|
|
15
|
+
return (
|
|
16
|
+
<div
|
|
17
|
+
className={classNames(s.column, className, {
|
|
18
|
+
[s.hasSide]: hasSidePanel,
|
|
19
|
+
})}
|
|
20
|
+
>
|
|
21
|
+
{children}
|
|
22
|
+
</div>
|
|
23
|
+
)
|
|
11
24
|
}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
@custom-media --dev-dot-viewport (min-width: 924px);
|
|
2
|
+
|
|
1
3
|
.column {
|
|
2
4
|
position: relative;
|
|
3
5
|
display: flex;
|
|
@@ -5,10 +7,18 @@
|
|
|
5
7
|
justify-content: flex-start;
|
|
6
8
|
min-width: 190px;
|
|
7
9
|
padding: 0;
|
|
8
|
-
margin: 0 var(--
|
|
9
|
-
border-radius: var(--
|
|
10
|
+
margin: 0 var(--mds-spacing-07);
|
|
11
|
+
border-radius: var(--mds-spacing-03);
|
|
10
12
|
|
|
11
13
|
@media (--large) {
|
|
12
|
-
|
|
14
|
+
&:not(.hasSide) {
|
|
15
|
+
margin: 0;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
@media (--dev-dot-viewport) {
|
|
20
|
+
&.hasSide {
|
|
21
|
+
margin: 0;
|
|
22
|
+
}
|
|
13
23
|
}
|
|
14
24
|
}
|
|
@@ -4,8 +4,17 @@ import s from './style.module.css'
|
|
|
4
4
|
interface RootProps {
|
|
5
5
|
className?: string
|
|
6
6
|
children: React.ReactNode
|
|
7
|
+
hasSidePanel?: boolean
|
|
7
8
|
}
|
|
8
9
|
|
|
9
|
-
export default function Root({ className, children }: RootProps) {
|
|
10
|
-
return
|
|
10
|
+
export default function Root({ className, children, hasSidePanel }: RootProps) {
|
|
11
|
+
return (
|
|
12
|
+
<div
|
|
13
|
+
className={classNames(s.root, className, {
|
|
14
|
+
[s.hasSide]: hasSidePanel,
|
|
15
|
+
})}
|
|
16
|
+
>
|
|
17
|
+
{children}
|
|
18
|
+
</div>
|
|
19
|
+
)
|
|
11
20
|
}
|