diff --git a/src/docs/v1/design/designTokens.mdx b/src/docs/v1/design/designTokens.mdx index d180fd50..d24ca015 100644 --- a/src/docs/v1/design/designTokens.mdx +++ b/src/docs/v1/design/designTokens.mdx @@ -309,7 +309,7 @@ Breakpoint values used to define responsive design thresholds. These tokens help size: `xs` `sm` `md` `lg` `xl` `xxl` ```css ---theme-grid-breakpoint-xs: 24rem +--theme-grid-breakpoint-xs: 28rem --theme-grid-breakpoint-sm: 36rem --theme-grid-breakpoint-md: 48rem --theme-grid-breakpoint-lg: 62rem diff --git a/src/lib/components/DataView/DataView.module.scss b/src/lib/components/DataView/DataView.module.scss index 7f8168a0..c85bc484 100644 --- a/src/lib/components/DataView/DataView.module.scss +++ b/src/lib/components/DataView/DataView.module.scss @@ -136,3 +136,10 @@ $data-view-sizes: ("xs", "sm", "md", "lg", "xl"); } } } + +@include screen-width("below", "sm") { + .title, + .value { + padding: var(--mtf-sizing-space-8) var(--mtf-sizing-space-12); + } +} diff --git a/src/lib/components/Form/Form.stories.tsx b/src/lib/components/Form/Form.stories.tsx index 85c1e532..d81aaa3f 100644 --- a/src/lib/components/Form/Form.stories.tsx +++ b/src/lib/components/Form/Form.stories.tsx @@ -135,7 +135,6 @@ export const Primary: Story = { label="Which sports" helperText="Please select at least 2 sports" groupValidations={[Validations.Required, Validations.AtLeastN(2)]} - wrap name="sports" > diff --git a/src/lib/components/Form/FormFields/FormField.module.scss b/src/lib/components/Form/FormFields/FormField.module.scss index 3a6f35f8..56a29fba 100644 --- a/src/lib/components/Form/FormFields/FormField.module.scss +++ b/src/lib/components/Form/FormFields/FormField.module.scss @@ -7,8 +7,7 @@ $sizes: (("xs", "xxs", 2, 8, 4, 20), ("sm", "xxs", 4, 12, 6, 24), ("md", "xs", 6 display: flex; } -// The required mark: before a horizontal label, after a vertical one. The mark comes from the required modifier and its -// place from the label orientation, two axes whose combined selector would exceed the specificity limit (css.md section 4) +// The required mark, always after the label .required { --mtf-form-field-mark: "*"; } @@ -16,26 +15,19 @@ $sizes: (("xs", "xxs", 2, 8, 4, 20), ("sm", "xxs", 4, 12, 6, 24), ("md", "xs", 6 .label { color: var(--mtf-color-text-strong); - &::before, &::after { + content: var(--mtf-form-field-mark, none); padding: 0 var(--mtf-sizing-space-2); color: var(--mtf-color-text-softer); font-weight: var(--mtf-typography-weight-strongest); } - .horizontalLabel &::before, - .verticalLabel &::after { - content: var(--mtf-form-field-mark, none); - } - // After the base colors: same specificity, so error and disabled win by order - .error &::before, .error &::after { color: var(--mtf-color-danger-text); } .disabled &, - .disabled &::before, .disabled &::after { color: var(--mtf-color-text-disabled); } @@ -112,7 +104,7 @@ $sizes: (("xs", "xxs", 2, 8, 4, 20), ("sm", "xxs", 4, 12, 6, 24), ("md", "xs", 6 .groupItems { display: flex; - flex-wrap: nowrap; + flex-wrap: wrap; .horizontalGroup & { align-items: flex-start; @@ -128,10 +120,6 @@ $sizes: (("xs", "xxs", 2, 8, 4, 20), ("sm", "xxs", 4, 12, 6, 24), ("md", "xs", 6 .verticalGroup & { flex-direction: column; } - - .wrap & { - flex-wrap: wrap; - } } @each $size, $helperStep, $gapVLabel, $gapHLabel, $marginTopHLabel, $gapHGroupItems in $sizes { @@ -147,7 +135,7 @@ $sizes: (("xs", "xxs", 2, 8, 4, 20), ("sm", "xxs", 4, 12, 6, 24), ("md", "xs", 6 } &.horizontalLabel { - gap: var(--mtf-sizing-space-#{$gapHLabel}); + gap: var(--mtf-sizing-space-#{$gapVLabel}) var(--mtf-sizing-space-#{$gapHLabel}); // The input's vertical padding (its border is drawn inside), so the label lines up with the input's text .label { @@ -172,3 +160,22 @@ $sizes: (("xs", "xxs", 2, 8, 4, 20), ("sm", "xxs", 4, 12, 6, 24), ("md", "xs", 6 } } } + +@include screen-width("below", "xs") { + .verticalForm.horizontalLabel .label { + width: auto; + min-width: auto; + } + + // The label goes above the input, as in vertical labels + .horizontalLabel { + flex-direction: column; + align-items: stretch; + } + + @each $size, $helperStep, $gapVLabel, $gapHLabel, $marginTopHLabel, $gapHGroupItems in $sizes { + .#{$size}.horizontalLabel .label { + margin-top: 0; + } + } +} diff --git a/src/lib/components/Form/FormFields/FormFieldGroup.stories.tsx b/src/lib/components/Form/FormFields/FormFieldGroup.stories.tsx index be20a4f2..386ccb75 100644 --- a/src/lib/components/Form/FormFields/FormFieldGroup.stories.tsx +++ b/src/lib/components/Form/FormFields/FormFieldGroup.stories.tsx @@ -2,9 +2,6 @@ import type { Meta, StoryObj } from "@storybook/nextjs"; import { Form, Validations } from "../../../index"; import FormFieldGroup from "@/components/Form/FormFields/FormFieldGroup"; import Checkbox from "@/components/Checkbox"; -import RadioGroup from "@/components/RadioGroup"; -import Radio from "@/components/Radio"; -import InputPassword from "@/components/InputPassword"; const meta: Meta = { title: "Components/Form/Form.FieldGroup", @@ -13,7 +10,6 @@ const meta: Meta = { name: { control: false }, groupValidations: { control: false }, orientation: { table: { defaultValue: { summary: "horizontal" } } }, - wrap: { table: { defaultValue: { summary: "false" } } }, }, args: { label: "Sports", @@ -45,55 +41,3 @@ export const Primary: Story = { ), }; - -export const SideBySideByDefault: Story = { - parameters: { - docs: { - description: { - story: - "By default (**wrap={false}**), group items are kept on a single line, which is important when grouping a couple of wider items (e.g. a RadioGroup next to an input) that should always sit side by side rather than stack.", - }, - }, - }, - args: { - label: "Gender", - helperText: undefined, - name: "gender", - groupValidations: undefined, - orientation: "horizontal", - }, - render: args => ( -
- - - - - - - -
- ), -}; - -export const Wrap: Story = { - parameters: { - docs: { - description: { - story: - "Set **wrap={true}** to let group items wrap onto multiple lines when they don't fit on one, which is useful for groups with many small items (e.g. checkboxes) in a narrow container.", - }, - }, - }, - args: { - wrap: true, - }, - render: args => ( -
- - - - - -
- ), -}; diff --git a/src/lib/components/Form/FormFields/FormFieldGroup.tsx b/src/lib/components/Form/FormFields/FormFieldGroup.tsx index 36cfe73f..4f539962 100644 --- a/src/lib/components/Form/FormFields/FormFieldGroup.tsx +++ b/src/lib/components/Form/FormFields/FormFieldGroup.tsx @@ -19,7 +19,6 @@ const FormFieldGroup = (props: PropsWithRefAndChildren { expect(getFormFieldGroup(0)).toHaveClass("horizontalGroup"); }); - it("should wrap group items when wrap is set as true for Form.FieldGroup", () => { - const formGroup = (wrap?: boolean) => ( -
- - - - -
- ); - const { rerender } = render(formGroup()); - expect(getFormFieldGroup(0)).not.toHaveClass("wrap"); - - rerender(formGroup(true)); - expect(getFormFieldGroup(0)).toHaveClass("wrap"); - }); - it("should display submit button text as given in the submitButtonLabel prop", () => { const submitButtonLabel = "Submit Form"; diff --git a/src/lib/components/Grid/Grid.mdx b/src/lib/components/Grid/Grid.mdx index 3c734815..87af6d23 100644 --- a/src/lib/components/Grid/Grid.mdx +++ b/src/lib/components/Grid/Grid.mdx @@ -32,15 +32,15 @@ Page size aliases alongside with the container sizes are: **sm**>= 576px540px - **xs**>= 384px360px + **xs**>= 448px360px - **xxs**< 384pxauto + **xxs**< 448pxauto -The **minimum** supported width of the `` is **420px** even if the width below 384px is considered as `xxs`. +The **minimum** supported width of the `` is **420px** even if the width below 448px is considered as `xxs`. Most of the contents below 420px might still look good, but it isn't ``'s responsibility. `` itself is a pretty simple component which only accepts `` as children. In order to correctly place the diff --git a/src/lib/components/Panel/Panel.module.scss b/src/lib/components/Panel/Panel.module.scss index 6e282700..9e73db36 100644 --- a/src/lib/components/Panel/Panel.module.scss +++ b/src/lib/components/Panel/Panel.module.scss @@ -60,3 +60,9 @@ $title-sizes: (("sm", "md"), ("md", "lg"), ("lg", "xl")); @include typography("text-#{$step}", "strongest"); } } + +@include screen-width("below", "sm") { + .Root { + padding: var(--mtf-sizing-space-8); + } +} diff --git a/src/lib/components/RadioGroup/RadioGroup.module.scss b/src/lib/components/RadioGroup/RadioGroup.module.scss index 9e817e43..7fbd5f52 100644 --- a/src/lib/components/RadioGroup/RadioGroup.module.scss +++ b/src/lib/components/RadioGroup/RadioGroup.module.scss @@ -13,7 +13,7 @@ $sizes: (("xs", 20, 12, 4), ("sm", 24, 16, 6), ("md", 28, 20, 8), ("lg", 32, 24, } .horizontal { - flex-direction: row; + flex-flow: row wrap; } @each $size, $gapH, $gapV, $paddingV in $sizes { @@ -23,7 +23,7 @@ $sizes: (("xs", 20, 12, 4), ("sm", 24, 16, 6), ("md", 28, 20, 8), ("lg", 32, 24, } &.horizontal { - gap: var(--mtf-sizing-space-#{$gapH}); + gap: var(--mtf-sizing-space-#{$gapV}) var(--mtf-sizing-space-#{$gapH}); } &.inFormField { diff --git a/src/lib/styles/breakpoints.scss b/src/lib/styles/breakpoints.scss index 2aba574b..cd077e7a 100644 --- a/src/lib/styles/breakpoints.scss +++ b/src/lib/styles/breakpoints.scss @@ -2,7 +2,7 @@ $breakpoints: ( "xxs": 0, - "xs": 24rem, + "xs": 28rem, "sm": 36rem, "md": 48rem, "lg": 62rem, diff --git a/src/lib/styles/themes/default-theme.css b/src/lib/styles/themes/default-theme.css index 96be3283..67939283 100644 --- a/src/lib/styles/themes/default-theme.css +++ b/src/lib/styles/themes/default-theme.css @@ -14,7 +14,7 @@ --theme-grid-gutter-gutter-sm: 1rem; --theme-grid-gutter-gutter-xs: 0.5rem; --theme-grid-gutter-gutter-xxs: 0.25rem; - --theme-grid-breakpoint-xs: 24rem; + --theme-grid-breakpoint-xs: 28rem; --theme-grid-breakpoint-sm: 36rem; --theme-grid-breakpoint-md: 48rem; --theme-grid-breakpoint-lg: 62rem; diff --git a/src/lib/styles/themes/papyrus.css b/src/lib/styles/themes/papyrus.css index a4cd2c70..66cd2d27 100644 --- a/src/lib/styles/themes/papyrus.css +++ b/src/lib/styles/themes/papyrus.css @@ -14,7 +14,7 @@ --theme-grid-gutter-gutter-xl: 4rem; --theme-grid-gutter-gutter-xxl: 8rem; - --theme-grid-breakpoint-xs: 24rem; + --theme-grid-breakpoint-xs: 28rem; --theme-grid-breakpoint-sm: 36rem; --theme-grid-breakpoint-md: 48rem; --theme-grid-breakpoint-lg: 62rem; diff --git a/src/lib/styles/tokens/compare/baseline/Form/FormFields/FormFieldGroup.tsx b/src/lib/styles/tokens/compare/baseline/Form/FormFields/FormFieldGroup.tsx index 6c6d3f60..8204227c 100644 --- a/src/lib/styles/tokens/compare/baseline/Form/FormFields/FormFieldGroup.tsx +++ b/src/lib/styles/tokens/compare/baseline/Form/FormFields/FormFieldGroup.tsx @@ -19,7 +19,6 @@ const FormFieldGroup = (props: PropsWithRefAndChildren