diff --git a/web/packages/shared/components/FieldInput/FieldInput.tsx b/web/packages/shared/components/FieldInput/FieldInput.tsx index 2f3a3eb012550..146db2849cdce 100644 --- a/web/packages/shared/components/FieldInput/FieldInput.tsx +++ b/web/packages/shared/components/FieldInput/FieldInput.tsx @@ -57,6 +57,7 @@ const FieldInput = forwardRef( spellCheck, readonly = false, toolTipContent = null, + tooltipSticky = false, disabled = false, markAsError = false, required = false, @@ -114,7 +115,10 @@ const FieldInput = forwardRef( > {label} - + ) : ( <>{label} @@ -242,6 +246,7 @@ export type FieldInputProps = BoxProps & { min?: number; max?: number; toolTipContent?: React.ReactNode; + tooltipSticky?: boolean; disabled?: boolean; // markAsError is a flag to highlight an // input box as error color before validator diff --git a/web/packages/teleport/src/components/LabelsInput/LabelsInput.story.tsx b/web/packages/teleport/src/components/LabelsInput/LabelsInput.story.tsx index 0fdbbfcb3cd05..d1cfa0853d8dd 100644 --- a/web/packages/teleport/src/components/LabelsInput/LabelsInput.story.tsx +++ b/web/packages/teleport/src/components/LabelsInput/LabelsInput.story.tsx @@ -60,6 +60,8 @@ export const Custom = () => { ; export function LabelsInput({ + legend, + tooltipContent, labels = [], setLabels, disableBtns = false, @@ -74,6 +77,8 @@ export function LabelsInput({ inputWidth = 200, rule = defaultRule, }: { + legend?: string; + tooltipContent?: string; labels: Label[]; setLabels(l: Label[]): void; disableBtns?: boolean; @@ -141,15 +146,34 @@ export function LabelsInput({ const width = `${inputWidth}px`; const inputSize = 'medium'; return ( - <> +
+ {legend && ( + + {tooltipContent ? ( + <> + + {legend} + + + + ) : ( + legend + )} + + )} {labels.length > 0 && ( - + - {labelKey.fieldName} (required field) - - - {labelVal.fieldName} (required field) + + {labelKey.fieldName} (required field) + + {labelVal.fieldName} (required field) )} @@ -229,17 +253,12 @@ export function LabelsInput({ {labels.length > 0 ? `Add another ${adjective}` : `Add a ${adjective}`} - +
); } const defaultRule = () => () => ({ valid: true }); -const SmallText = styled.span` - font-size: ${p => p.theme.fontSizes[1]}px; - font-weight: lighter; -`; - export const nonEmptyLabels: LabelsRule = labels => () => { const results = labels.map(label => ({ name: requiredField('required')(label.name)(), @@ -250,3 +269,15 @@ export const nonEmptyLabels: LabelsRule = labels => () => { results: results, }; }; + +const Fieldset = styled.fieldset` + border: none; + margin: 0; + padding: 0; +`; + +const Legend = styled.legend` + margin: 0 0 ${props => props.theme.space[1]}px 0; + padding: 0; + ${props => props.theme.typography.body3} +`;