diff --git a/packages/react/src/components/datepicker/datepicker.test.tsx.snap b/packages/react/src/components/datepicker/datepicker.test.tsx.snap
index 0e10f6989b..dfe3e023b0 100644
--- a/packages/react/src/components/datepicker/datepicker.test.tsx.snap
+++ b/packages/react/src/components/datepicker/datepicker.test.tsx.snap
@@ -2,8 +2,15 @@
exports[`Datepicker has startDate 1`] = `
.c2 {
+ -webkit-align-items: center;
+ -webkit-box-align: center;
+ -ms-flex-align: center;
+ align-items: center;
color: #000000;
- display: block;
+ display: -webkit-box;
+ display: -webkit-flex;
+ display: -ms-flexbox;
+ display: flex;
font-size: 0.875rem;
font-weight: var(--font-normal);
-webkit-letter-spacing: 0.02rem;
@@ -288,8 +295,15 @@ label + .c3 {
exports[`Datepicker matches snapshot (desktop) 1`] = `
.c2 {
+ -webkit-align-items: center;
+ -webkit-box-align: center;
+ -ms-flex-align: center;
+ align-items: center;
color: #000000;
- display: block;
+ display: -webkit-box;
+ display: -webkit-flex;
+ display: -ms-flexbox;
+ display: flex;
font-size: 0.75rem;
font-weight: var(--font-normal);
-webkit-letter-spacing: 0.02rem;
@@ -574,8 +588,15 @@ label + .c3 {
exports[`Datepicker matches snapshot (disabled) 1`] = `
.c2 {
+ -webkit-align-items: center;
+ -webkit-box-align: center;
+ -ms-flex-align: center;
+ align-items: center;
color: #000000;
- display: block;
+ display: -webkit-box;
+ display: -webkit-flex;
+ display: -ms-flexbox;
+ display: flex;
font-size: 0.75rem;
font-weight: var(--font-normal);
-webkit-letter-spacing: 0.02rem;
@@ -890,8 +911,15 @@ exports[`Datepicker matches snapshot (invalid) 1`] = `
}
.c2 {
+ -webkit-align-items: center;
+ -webkit-box-align: center;
+ -ms-flex-align: center;
+ align-items: center;
color: #000000;
- display: block;
+ display: -webkit-box;
+ display: -webkit-flex;
+ display: -ms-flexbox;
+ display: flex;
font-size: 0.75rem;
font-weight: var(--font-normal);
-webkit-letter-spacing: 0.02rem;
@@ -1198,8 +1226,15 @@ label + .c6 {
exports[`Datepicker matches snapshot (mobile) 1`] = `
.c2 {
+ -webkit-align-items: center;
+ -webkit-box-align: center;
+ -ms-flex-align: center;
+ align-items: center;
color: #000000;
- display: block;
+ display: -webkit-box;
+ display: -webkit-flex;
+ display: -ms-flexbox;
+ display: flex;
font-size: 0.875rem;
font-weight: var(--font-normal);
-webkit-letter-spacing: 0.02rem;
@@ -1484,8 +1519,15 @@ label + .c3 {
exports[`Datepicker matches snapshot (open, desktop) 1`] = `
.c2 {
+ -webkit-align-items: center;
+ -webkit-box-align: center;
+ -ms-flex-align: center;
+ align-items: center;
color: #000000;
- display: block;
+ display: -webkit-box;
+ display: -webkit-flex;
+ display: -ms-flexbox;
+ display: flex;
font-size: 0.75rem;
font-weight: var(--font-normal);
-webkit-letter-spacing: 0.02rem;
@@ -2609,8 +2651,15 @@ exports[`Datepicker matches snapshot (open, hasTodayButton) 1`] = `
}
.c2 {
+ -webkit-align-items: center;
+ -webkit-box-align: center;
+ -ms-flex-align: center;
+ align-items: center;
color: #000000;
- display: block;
+ display: -webkit-box;
+ display: -webkit-flex;
+ display: -ms-flexbox;
+ display: flex;
font-size: 0.75rem;
font-weight: var(--font-normal);
-webkit-letter-spacing: 0.02rem;
@@ -3667,8 +3716,15 @@ label + .c3 {
exports[`Datepicker matches snapshot (open, mobile) 1`] = `
.c2 {
+ -webkit-align-items: center;
+ -webkit-box-align: center;
+ -ms-flex-align: center;
+ align-items: center;
color: #000000;
- display: block;
+ display: -webkit-box;
+ display: -webkit-flex;
+ display: -ms-flexbox;
+ display: flex;
font-size: 0.875rem;
font-weight: var(--font-normal);
-webkit-letter-spacing: 0.02rem;
diff --git a/packages/react/src/components/field-container/field-container.test.tsx b/packages/react/src/components/field-container/field-container.test.tsx
index d997a7e430..ae2fd5b958 100644
--- a/packages/react/src/components/field-container/field-container.test.tsx
+++ b/packages/react/src/components/field-container/field-container.test.tsx
@@ -1,5 +1,7 @@
-import { renderWithProviders } from '../../test-utils/renderer';
+import { mountWithTheme, renderWithProviders } from '../../test-utils/renderer';
import { FieldContainer } from './field-container';
+import { Tooltip } from '../tooltip/tooltip';
+import { getByTestId } from '../../test-utils/enzyme-selectors';
const defaultProps = {
fieldId: 'test-id',
@@ -8,6 +10,16 @@ const defaultProps = {
};
describe('Field Container', () => {
+ test('label has tooltip when tooltipLabel prop is defined', () => {
+ const wrapper = mountWithTheme(
+
+ Children
+ ,
+ );
+
+ expect(getByTestId(wrapper, 'field-label').find(Tooltip).exists()).toBe(true);
+ });
+
test('matches snapshot', () => {
const tree = renderWithProviders(
diff --git a/packages/react/src/components/field-container/field-container.test.tsx.snap b/packages/react/src/components/field-container/field-container.test.tsx.snap
index d7ea0b024c..6a6ccdd5fe 100644
--- a/packages/react/src/components/field-container/field-container.test.tsx.snap
+++ b/packages/react/src/components/field-container/field-container.test.tsx.snap
@@ -2,8 +2,15 @@
exports[`Field Container matches snapshot 1`] = `
.c2 {
+ -webkit-align-items: center;
+ -webkit-box-align: center;
+ -ms-flex-align: center;
+ align-items: center;
color: #000000;
- display: block;
+ display: -webkit-box;
+ display: -webkit-flex;
+ display: -ms-flexbox;
+ display: flex;
font-size: 0.75rem;
font-weight: var(--font-normal);
-webkit-letter-spacing: 0.02rem;
@@ -84,8 +91,15 @@ exports[`Field Container should have invalid styles given valid prop is set to f
}
.c2 {
+ -webkit-align-items: center;
+ -webkit-box-align: center;
+ -ms-flex-align: center;
+ align-items: center;
color: #000000;
- display: block;
+ display: -webkit-box;
+ display: -webkit-flex;
+ display: -ms-flexbox;
+ display: flex;
font-size: 0.75rem;
font-weight: var(--font-normal);
-webkit-letter-spacing: 0.02rem;
@@ -158,8 +172,15 @@ input + .c1 {
exports[`Field Container should not have margins given noMargin prop is set to true 1`] = `
.c2 {
+ -webkit-align-items: center;
+ -webkit-box-align: center;
+ -ms-flex-align: center;
+ align-items: center;
color: #000000;
- display: block;
+ display: -webkit-box;
+ display: -webkit-flex;
+ display: -ms-flexbox;
+ display: flex;
font-size: 0.75rem;
font-weight: var(--font-normal);
-webkit-letter-spacing: 0.02rem;
diff --git a/packages/react/src/components/field-container/field-container.tsx b/packages/react/src/components/field-container/field-container.tsx
index 8a39135841..8aef2f13df 100644
--- a/packages/react/src/components/field-container/field-container.tsx
+++ b/packages/react/src/components/field-container/field-container.tsx
@@ -49,6 +49,7 @@ export interface FieldContainerProps {
valid: boolean;
validationErrorMessage: string;
hint?: string;
+ tooltipLabel?: string;
}
export function FieldContainer({
@@ -60,6 +61,7 @@ export function FieldContainer({
validationErrorMessage,
hint,
noMargin,
+ tooltipLabel,
...props
}: FieldContainerProps): ReactElement {
const { isMobile } = useDeviceContext();
@@ -73,8 +75,8 @@ export function FieldContainer({
valid={valid}
{...props /* eslint-disable-line react/jsx-props-no-spreading */}
>
- {label && }
- {hint && {hint}}
+ {label && }
+ {hint && {hint}}
{!valid && (
`
+ align-items: center;
color: ${(props) => props.theme.greys.black};
- display: block;
+ display: flex;
font-size: ${({ isMobile }) => (isMobile ? '0.875rem' : '0.75rem')};
font-weight: var(--font-normal);
letter-spacing: 0.02rem;
@@ -17,18 +19,26 @@ const StyledLabel = styled.label<{isMobile: boolean}>`
}
`;
+const StyledTooltip = styled(Tooltip)`
+ margin-left: calc(var(--spacing-1x) * 1.5);
+`;
+
interface LabelProps {
className?: string;
children: ReactNode;
forId: string;
+ tooltipLabel?: string;
}
-function Label({ className, children, forId }: LabelProps): ReactElement {
+function Label({
+ className, children, forId, tooltipLabel,
+}: LabelProps): ReactElement {
const { isMobile } = useDeviceContext();
return (
{children}
+ {tooltipLabel && }
);
}
diff --git a/packages/react/src/components/search/search-input.test.tsx.snap b/packages/react/src/components/search/search-input.test.tsx.snap
index 517904aab0..58a24916c3 100644
--- a/packages/react/src/components/search/search-input.test.tsx.snap
+++ b/packages/react/src/components/search/search-input.test.tsx.snap
@@ -60,8 +60,15 @@ exports[`SearchInput should match the snapshot 1`] = `
}
.c3 {
+ -webkit-align-items: center;
+ -webkit-box-align: center;
+ -ms-flex-align: center;
+ align-items: center;
color: #000000;
- display: block;
+ display: -webkit-box;
+ display: -webkit-flex;
+ display: -ms-flexbox;
+ display: flex;
font-size: 0.75rem;
font-weight: var(--font-normal);
-webkit-letter-spacing: 0.02rem;
diff --git a/packages/react/src/components/select/select.test.tsx.snap b/packages/react/src/components/select/select.test.tsx.snap
index ab5a1738e4..d2085981fc 100644
--- a/packages/react/src/components/select/select.test.tsx.snap
+++ b/packages/react/src/components/select/select.test.tsx.snap
@@ -2,8 +2,15 @@
exports[`Select disabled select has a different style 1`] = `
.c3 {
+ -webkit-align-items: center;
+ -webkit-box-align: center;
+ -ms-flex-align: center;
+ align-items: center;
color: #000000;
- display: block;
+ display: -webkit-box;
+ display: -webkit-flex;
+ display: -ms-flexbox;
+ display: flex;
font-size: 0.75rem;
font-weight: var(--font-normal);
-webkit-letter-spacing: 0.02rem;
@@ -405,8 +412,15 @@ Array [
}
.c3 {
+ -webkit-align-items: center;
+ -webkit-box-align: center;
+ -ms-flex-align: center;
+ align-items: center;
color: #000000;
- display: block;
+ display: -webkit-box;
+ display: -webkit-flex;
+ display: -ms-flexbox;
+ display: flex;
font-size: 0.75rem;
font-weight: var(--font-normal);
-webkit-letter-spacing: 0.02rem;
@@ -892,8 +906,15 @@ input[type="radio"]:disabled + .c1 {
exports[`Select matches the snapshot 1`] = `
Array [
.c3 {
+ -webkit-align-items: center;
+ -webkit-box-align: center;
+ -ms-flex-align: center;
+ align-items: center;
color: #000000;
- display: block;
+ display: -webkit-box;
+ display: -webkit-flex;
+ display: -ms-flexbox;
+ display: flex;
font-size: 0.75rem;
font-weight: var(--font-normal);
-webkit-letter-spacing: 0.02rem;
diff --git a/packages/react/src/components/stepper-input/stepper-input.test.tsx.snap b/packages/react/src/components/stepper-input/stepper-input.test.tsx.snap
index 8a7e45fc01..111a557580 100644
--- a/packages/react/src/components/stepper-input/stepper-input.test.tsx.snap
+++ b/packages/react/src/components/stepper-input/stepper-input.test.tsx.snap
@@ -2,8 +2,15 @@
exports[`Stepper input matches snapshot (disabled) 1`] = `
.c2 {
+ -webkit-align-items: center;
+ -webkit-box-align: center;
+ -ms-flex-align: center;
+ align-items: center;
color: #000000;
- display: block;
+ display: -webkit-box;
+ display: -webkit-flex;
+ display: -ms-flexbox;
+ display: flex;
font-size: 0.75rem;
font-weight: var(--font-normal);
-webkit-letter-spacing: 0.02rem;
@@ -312,8 +319,15 @@ exports[`Stepper input matches snapshot (invalid) 1`] = `
}
.c2 {
+ -webkit-align-items: center;
+ -webkit-box-align: center;
+ -ms-flex-align: center;
+ align-items: center;
color: #000000;
- display: block;
+ display: -webkit-box;
+ display: -webkit-flex;
+ display: -ms-flexbox;
+ display: flex;
font-size: 0.75rem;
font-weight: var(--font-normal);
-webkit-letter-spacing: 0.02rem;
@@ -611,8 +625,15 @@ input + .c1 {
exports[`Stepper input matches snapshot (mobile) 1`] = `
.c2 {
+ -webkit-align-items: center;
+ -webkit-box-align: center;
+ -ms-flex-align: center;
+ align-items: center;
color: #000000;
- display: block;
+ display: -webkit-box;
+ display: -webkit-flex;
+ display: -ms-flexbox;
+ display: flex;
font-size: 0.875rem;
font-weight: var(--font-normal);
-webkit-letter-spacing: 0.02rem;
@@ -765,8 +786,15 @@ input + .c1 {
exports[`Stepper input matches snapshot 1`] = `
.c2 {
+ -webkit-align-items: center;
+ -webkit-box-align: center;
+ -ms-flex-align: center;
+ align-items: center;
color: #000000;
- display: block;
+ display: -webkit-box;
+ display: -webkit-flex;
+ display: -ms-flexbox;
+ display: flex;
font-size: 0.75rem;
font-weight: var(--font-normal);
-webkit-letter-spacing: 0.02rem;
diff --git a/packages/react/src/components/text-area/text-area.test.tsx.snap b/packages/react/src/components/text-area/text-area.test.tsx.snap
index f9cc66c707..e341111d80 100644
--- a/packages/react/src/components/text-area/text-area.test.tsx.snap
+++ b/packages/react/src/components/text-area/text-area.test.tsx.snap
@@ -2,8 +2,15 @@
exports[`TextArea Is disabled 1`] = `
.c2 {
+ -webkit-align-items: center;
+ -webkit-box-align: center;
+ -ms-flex-align: center;
+ align-items: center;
color: #000000;
- display: block;
+ display: -webkit-box;
+ display: -webkit-flex;
+ display: -ms-flexbox;
+ display: flex;
font-size: 0.75rem;
font-weight: var(--font-normal);
-webkit-letter-spacing: 0.02rem;
@@ -139,8 +146,15 @@ input + .c1 {
exports[`TextArea Matches the snapshot 1`] = `
.c2 {
+ -webkit-align-items: center;
+ -webkit-box-align: center;
+ -ms-flex-align: center;
+ align-items: center;
color: #000000;
- display: block;
+ display: -webkit-box;
+ display: -webkit-flex;
+ display: -ms-flexbox;
+ display: flex;
font-size: 0.75rem;
font-weight: var(--font-normal);
-webkit-letter-spacing: 0.02rem;
diff --git a/packages/react/src/components/text-input/text-input.test.tsx.snap b/packages/react/src/components/text-input/text-input.test.tsx.snap
index f284b27407..df662f89c0 100644
--- a/packages/react/src/components/text-input/text-input.test.tsx.snap
+++ b/packages/react/src/components/text-input/text-input.test.tsx.snap
@@ -2,8 +2,15 @@
exports[`TextInput Matches the snapshot [disabled = true] 1`] = `
.c2 {
+ -webkit-align-items: center;
+ -webkit-box-align: center;
+ -ms-flex-align: center;
+ align-items: center;
color: #000000;
- display: block;
+ display: -webkit-box;
+ display: -webkit-flex;
+ display: -ms-flexbox;
+ display: flex;
font-size: 0.75rem;
font-weight: var(--font-normal);
-webkit-letter-spacing: 0.02rem;
@@ -136,8 +143,15 @@ input + .c1 {
exports[`TextInput Matches the snapshot [required = true] 1`] = `
.c2 {
+ -webkit-align-items: center;
+ -webkit-box-align: center;
+ -ms-flex-align: center;
+ align-items: center;
color: #000000;
- display: block;
+ display: -webkit-box;
+ display: -webkit-flex;
+ display: -ms-flexbox;
+ display: flex;
font-size: 0.75rem;
font-weight: var(--font-normal);
-webkit-letter-spacing: 0.02rem;
@@ -270,8 +284,15 @@ input + .c1 {
exports[`TextInput Matches the snapshot 1`] = `
.c2 {
+ -webkit-align-items: center;
+ -webkit-box-align: center;
+ -ms-flex-align: center;
+ align-items: center;
color: #000000;
- display: block;
+ display: -webkit-box;
+ display: -webkit-flex;
+ display: -ms-flexbox;
+ display: flex;
font-size: 0.75rem;
font-weight: var(--font-normal);
-webkit-letter-spacing: 0.02rem;