diff --git a/src/lib/components/Checkbox/Checkbox.module.scss b/src/lib/components/Checkbox/Checkbox.module.scss index 554f1770..19bf056b 100644 --- a/src/lib/components/Checkbox/Checkbox.module.scss +++ b/src/lib/components/Checkbox/Checkbox.module.scss @@ -8,17 +8,12 @@ $partial-path: ') => ]); return ( -
+
:first-child { + flex: 1 1 0; + min-width: 0; + } + + // data-mtf-inline-control marks the controls as wide as their content (Checkbox, Switch, RadioGroup, PinCode), while + // the others fill the row. Such a control, or a group of only such controls, keeps its width, so the mark follows it + // instead of going to the row's end + > [data-mtf-inline-control], + > .groupItems:not(:has(> :not([data-mtf-inline-control]))) { + max-width: max-content; + } + + > .helper { + flex-basis: 100%; + } +} + @each $size, $helperStep, $gapVLabel, $gapHLabel, $marginTopHLabel, $gapHGroupItems in $sizes { .#{$size} { &.verticalLabel { @@ -151,6 +171,10 @@ $sizes: (("xs", "xxs", 2, 8, 4, 20), ("sm", "xxs", 4, 12, 6, 24), ("md", "xs", 6 @include typography("text-#{$size}", "strong"); } + .mark { + @include typography("text-#{$size}", "strongest"); + } + .helper { @include typography("text-#{$helperStep}", "regular"); } diff --git a/src/lib/components/Form/FormFields/FormField.tsx b/src/lib/components/Form/FormFields/FormField.tsx index 6779cd34..6ab78168 100644 --- a/src/lib/components/Form/FormFields/FormField.tsx +++ b/src/lib/components/Form/FormFields/FormField.tsx @@ -6,7 +6,7 @@ import { useForm } from "@/components/Form/context/FormContext"; import { FieldContext } from "@/components/Form/context/FieldContext"; import { PropsWithRef } from "../../../types"; import { FormFieldProps } from "@/components/Form/FormFields/types"; -import { sanitizeModuleRootClasses } from "../../../../utils/cssUtils"; +import { sanitizeModuleRootClasses, sanitizeModuleClasses } from "../../../../utils/cssUtils"; import usePropsWithThemeDefaults from "../../../motif/hooks/usePropsWithThemeDefaults"; const FormField = (props: PropsWithRef) => { @@ -23,6 +23,7 @@ const FormField = (props: PropsWithRef) => { const [error, setError] = useState(() => getInitialExternalError(name, disabled)); const isRequired = validations?.some(validation => validation.requiredValidation); + const showMark = isRequired && !label; const classNames = useMemo( () => sanitizeModuleRootClasses(styles, className, [ @@ -39,8 +40,13 @@ const FormField = (props: PropsWithRef) => {
{label && {label}} -
+
{children} + {showMark && ( + + )} {(error || helperText) && {error ?? helperText}}
diff --git a/src/lib/components/Form/FormFields/FormFieldGroup.tsx b/src/lib/components/Form/FormFields/FormFieldGroup.tsx index 4f539962..a0c29442 100644 --- a/src/lib/components/Form/FormFields/FormFieldGroup.tsx +++ b/src/lib/components/Form/FormFields/FormFieldGroup.tsx @@ -7,7 +7,7 @@ import { FieldContext } from "@/components/Form/context/FieldContext"; import { PropsWithRefAndChildren } from "../../../types"; import { FormFieldGroupProps } from "@/components/Form/FormFields/types"; import usePropsWithThemeDefaults from "../../../motif/hooks/usePropsWithThemeDefaults"; -import { sanitizeModuleRootClasses } from "../../../../utils/cssUtils"; +import { sanitizeModuleClasses, sanitizeModuleRootClasses } from "../../../../utils/cssUtils"; const FormFieldGroup = (props: PropsWithRefAndChildren) => { const formContext = useForm(); @@ -32,6 +32,7 @@ const FormFieldGroup = (props: PropsWithRefAndChildren(() => getInitialExternalError(name, disabled)); const isRequired = groupValidations?.some(validation => validation.requiredValidation); + const showMark = isRequired && !label; const classNames = useMemo( () => @@ -61,8 +62,13 @@ const FormFieldGroup = (props: PropsWithRefAndChildren
{label && {label}} -
+
{children}
+ {showMark && ( + + )} {(error || helperText) && {error ?? helperText}}
diff --git a/src/lib/components/InputNumber/InputNumber.module.scss b/src/lib/components/InputNumber/InputNumber.module.scss index 5ef12926..ab7a0050 100644 --- a/src/lib/components/InputNumber/InputNumber.module.scss +++ b/src/lib/components/InputNumber/InputNumber.module.scss @@ -1,3 +1,5 @@ +@use "@styles" as *; + .Root { - overflow: hidden; + @include retain-scoped-class; } diff --git a/src/lib/components/Motif/InputText/InputText.module.scss b/src/lib/components/Motif/InputText/InputText.module.scss index ec745807..de706f10 100644 --- a/src/lib/components/Motif/InputText/InputText.module.scss +++ b/src/lib/components/Motif/InputText/InputText.module.scss @@ -48,12 +48,16 @@ $sizes: (("xs", 8, 4), ("sm", 12, 6), ("md", 16, 8), ("lg", 20, 10)); &.error { box-shadow: inset 0 0 0 var(--mtf-sizing-1) var(--mtf-color-danger-border); - .iconRight { color: var(--mtf-color-danger-text); } + .iconRight { + color: var(--mtf-color-danger-text); + } } &.success { box-shadow: inset 0 0 0 var(--mtf-sizing-1) var(--mtf-color-success-border); - .iconRight { color: var(--mtf-color-success-text); } + .iconRight { + color: var(--mtf-color-success-text); + } } } diff --git a/src/lib/components/PinCode/PinCode.tsx b/src/lib/components/PinCode/PinCode.tsx index 8ab986cd..bb815398 100644 --- a/src/lib/components/PinCode/PinCode.tsx +++ b/src/lib/components/PinCode/PinCode.tsx @@ -107,7 +107,7 @@ const PinCodeComponent = (p: PropsWithRef) => { const classNames = sanitizeModuleRootClasses(styles, className, [size, circle && "circle"]); return ( -
+
{renderPinCodeItems()}
); diff --git a/src/lib/components/PinCode/__snapshots__/PinCode.test.tsx.snap b/src/lib/components/PinCode/__snapshots__/PinCode.test.tsx.snap index 55636de0..af8ae978 100644 --- a/src/lib/components/PinCode/__snapshots__/PinCode.test.tsx.snap +++ b/src/lib/components/PinCode/__snapshots__/PinCode.test.tsx.snap @@ -4,6 +4,7 @@ exports[`PinCode should render with only required props, have default prop value
) => { const classNames = sanitizeModuleRootClasses(styles, className, [orientation, size, inFormField && "inFormField"]); return ( -
+
{children}
); diff --git a/src/lib/components/RadioGroup/__snapshots__/RadioGroup.test.tsx.snap b/src/lib/components/RadioGroup/__snapshots__/RadioGroup.test.tsx.snap index af555c3f..6323bc7c 100644 --- a/src/lib/components/RadioGroup/__snapshots__/RadioGroup.test.tsx.snap +++ b/src/lib/components/RadioGroup/__snapshots__/RadioGroup.test.tsx.snap @@ -4,6 +4,7 @@ exports[`RadioGroup should render with only required props, and have standard pr
) => { ]); return ( -
+