From 6f47675917117dbcb2a3634e5729b3e829221ab0 Mon Sep 17 00:00:00 2001 From: Atakan Bayrak Date: Tue, 24 Nov 2026 17:00:33 +0300 Subject: [PATCH 1/7] variant support --- src/lib/components/Dropdown/Dropdown.module.scss | 15 +++++++++++++++ src/lib/components/Dropdown/Dropdown.tsx | 6 ++++-- .../components/Dropdown/test/Dropdown.test.tsx | 8 ++++++++ 3 files changed, 27 insertions(+), 2 deletions(-) diff --git a/src/lib/components/Dropdown/Dropdown.module.scss b/src/lib/components/Dropdown/Dropdown.module.scss index c4697ecf..2267bd0b 100644 --- a/src/lib/components/Dropdown/Dropdown.module.scss +++ b/src/lib/components/Dropdown/Dropdown.module.scss @@ -112,6 +112,21 @@ $caret-center: clamp($caret-margin, calc(var(--overlay-anchor-right) - $caret-ma } } } + + // textOnly takes the variant's surface color as its text color. secondary has no rule: the neutral textOnly colors + // already cover it. Kept off :disabled so the textOnly disabled color stays. + @if $variant != "secondary" { + &.textOnly.#{$variant}:not(:disabled) { + color: var(--theme-color-surface-#{$variant}-default); + + &:hover { + color: var(--theme-color-surface-#{$variant}-hover); + } + &:active { + color: var(--theme-color-surface-#{$variant}-active); + } + } + } } } diff --git a/src/lib/components/Dropdown/Dropdown.tsx b/src/lib/components/Dropdown/Dropdown.tsx index c8de5421..91d2d11f 100644 --- a/src/lib/components/Dropdown/Dropdown.tsx +++ b/src/lib/components/Dropdown/Dropdown.tsx @@ -20,7 +20,7 @@ const Dropdown = (props: PropsWithRef) => { label, icon, pill, - variant = "primary", + variant, shape = "solid", spacing = "callout", items, @@ -52,7 +52,9 @@ const Dropdown = (props: PropsWithRef) => { const mergedRef = useMemo(() => mergeRefs(anchorRef, ref), [ref]); const side = placement.startsWith("top") ? "top" : "bottom"; - const buttonClassNames = sanitizeModuleRootClasses(styles, className, [size, shape, variant, open && "open", pill && "pill"]); + // solid defaults to primary; textOnly stays neutral unless a variant is given. + const variantClass = variant ?? (shape === "solid" && "primary"); + const buttonClassNames = sanitizeModuleRootClasses(styles, className, [size, shape, variantClass, open && "open", pill && "pill"]); const overlayClassNames = sanitizeModuleClasses(styles, "Menu", size, spacing, side); return ( diff --git a/src/lib/components/Dropdown/test/Dropdown.test.tsx b/src/lib/components/Dropdown/test/Dropdown.test.tsx index b3a4428b..fb5407f2 100644 --- a/src/lib/components/Dropdown/test/Dropdown.test.tsx +++ b/src/lib/components/Dropdown/test/Dropdown.test.tsx @@ -166,6 +166,14 @@ describe("Dropdown", () => { expect(container.firstElementChild).toHaveClass("textOnly"); }); + it("should add the variant class to textOnly only when a variant is given", () => { + const { container, rerender } = render(); + expect(container.firstElementChild).not.toHaveClass("primary"); + rerender(); + expect(container.firstElementChild).toHaveClass("textOnly"); + expect(container.firstElementChild).toHaveClass("danger"); + }); + it("items should be rendered with the color given in items' iconColor prop", () => { render(); fireEvent.click(screen.getByText("Dropdown Menu")); From fadca9b182d1df181c528ceed87b9d8bff0c54eb Mon Sep 17 00:00:00 2001 From: Atakan Bayrak Date: Thu, 26 Nov 2026 09:48:24 +0300 Subject: [PATCH 2/7] fix --- src/lib/components/Dropdown/Dropdown.module.scss | 7 ++++--- src/lib/components/Dropdown/test/Dropdown.test.tsx | 8 +++----- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/lib/components/Dropdown/Dropdown.module.scss b/src/lib/components/Dropdown/Dropdown.module.scss index 2267bd0b..78fb846d 100644 --- a/src/lib/components/Dropdown/Dropdown.module.scss +++ b/src/lib/components/Dropdown/Dropdown.module.scss @@ -113,10 +113,8 @@ $caret-center: clamp($caret-margin, calc(var(--overlay-anchor-right) - $caret-ma } } - // textOnly takes the variant's surface color as its text color. secondary has no rule: the neutral textOnly colors - // already cover it. Kept off :disabled so the textOnly disabled color stays. @if $variant != "secondary" { - &.textOnly.#{$variant}:not(:disabled) { + &.textOnly.#{$variant} { color: var(--theme-color-surface-#{$variant}-default); &:hover { @@ -125,6 +123,9 @@ $caret-center: clamp($caret-margin, calc(var(--overlay-anchor-right) - $caret-ma &:active { color: var(--theme-color-surface-#{$variant}-active); } + &:disabled { + color: var(--theme-color-text-base-disabled); + } } } } diff --git a/src/lib/components/Dropdown/test/Dropdown.test.tsx b/src/lib/components/Dropdown/test/Dropdown.test.tsx index fb5407f2..b4ac3a34 100644 --- a/src/lib/components/Dropdown/test/Dropdown.test.tsx +++ b/src/lib/components/Dropdown/test/Dropdown.test.tsx @@ -12,7 +12,7 @@ describe("Dropdown", () => { (props: StandardPropsWithRef) => render(), { assertDefaults: ({ container, getByText }) => { - // variant: primary + // variant: primary (solid only) expect(container.firstElementChild).toHaveClass("primary"); // shape: solid expect(container.firstElementChild).toHaveClass("solid"); @@ -166,10 +166,8 @@ describe("Dropdown", () => { expect(container.firstElementChild).toHaveClass("textOnly"); }); - it("should add the variant class to textOnly only when a variant is given", () => { - const { container, rerender } = render(); - expect(container.firstElementChild).not.toHaveClass("primary"); - rerender(); + it("should add the given variant class to textOnly", () => { + const { container } = render(); expect(container.firstElementChild).toHaveClass("textOnly"); expect(container.firstElementChild).toHaveClass("danger"); }); From 4a6d2c10d7161fa03b5ece9adef649c054cf2ed9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mehmet=20Akta=C5=9F?= Date: Thu, 26 Nov 2026 16:56:33 +0300 Subject: [PATCH 3/7] feat(tokens): Dropdown, Modal and Toast on the design tokens Dropdown's button takes Button's box and colors and its menu items Select's options; variant is VariantV2 (solid defaults to primary, textOnly to neutral). Modal takes AlertModal's surface. Toast takes the soft fill on the raised surface with elevation-3, a 24px icon on the title line and VariantV2 (useToast returns a function per variant); its close button no longer shrinks. Compare screens with baselines, Figma notes for the three new pages. --- docs/figma/Dropdown.md | 40 +++ docs/figma/Modal.md | 35 +++ docs/figma/README.md | 4 +- docs/figma/Toast.md | 36 +++ .../components/Dropdown/Dropdown.module.scss | 217 ++++++++-------- .../components/Dropdown/Dropdown.stories.tsx | 2 +- src/lib/components/Dropdown/Dropdown.tsx | 3 +- .../Dropdown/test/Dropdown.test.tsx | 6 +- src/lib/components/Dropdown/types.ts | 4 +- src/lib/components/Modal/Modal.module.scss | 78 +++--- src/lib/components/Toast/Toast.module.scss | 68 +++-- src/lib/components/Toast/Toast.test.tsx | 2 +- src/lib/components/Toast/Toast.tsx | 4 +- src/lib/components/Toast/types.ts | 4 +- src/lib/components/Toast/useToast.tsx | 7 +- .../compare/Dropdown.compare-stories.tsx | 161 ++++++++++++ .../tokens/compare/Modal.compare-stories.tsx | 85 +++++++ .../tokens/compare/Toast.compare-stories.tsx | 55 ++++ .../compare/baseline/Dropdown/Dropdown.tsx | 79 ++++++ .../Dropdown/DropdownBaseline.module.scss | 236 ++++++++++++++++++ .../Dropdown/components/DropdownButton.tsx | 29 +++ .../Dropdown/components/DropdownMenuItem.tsx | 37 +++ .../Dropdown/context/DropdownContext.tsx | 4 + .../tokens/compare/baseline/Dropdown/index.ts | 1 + .../tokens/compare/baseline/Dropdown/types.ts | 54 ++++ .../tokens/compare/baseline/Modal/Modal.tsx | 69 +++++ .../baseline/Modal/ModalBaseline.module.scss | 141 +++++++++++ .../Modal/components/ModalActions.tsx | 32 +++ .../baseline/Modal/components/ModalHeader.tsx | 25 ++ .../tokens/compare/baseline/Modal/index.ts | 1 + .../tokens/compare/baseline/Modal/types.ts | 24 ++ .../tokens/compare/baseline/Toast/Toast.tsx | 87 +++++++ .../baseline/Toast/ToastBaseline.module.scss | 113 +++++++++ .../tokens/compare/baseline/Toast/types.ts | 59 +++++ stylelint.config.mjs | 3 + 35 files changed, 1614 insertions(+), 191 deletions(-) create mode 100644 docs/figma/Dropdown.md create mode 100644 docs/figma/Modal.md create mode 100644 docs/figma/Toast.md create mode 100644 src/lib/styles/tokens/compare/Dropdown.compare-stories.tsx create mode 100644 src/lib/styles/tokens/compare/Modal.compare-stories.tsx create mode 100644 src/lib/styles/tokens/compare/Toast.compare-stories.tsx create mode 100644 src/lib/styles/tokens/compare/baseline/Dropdown/Dropdown.tsx create mode 100644 src/lib/styles/tokens/compare/baseline/Dropdown/DropdownBaseline.module.scss create mode 100644 src/lib/styles/tokens/compare/baseline/Dropdown/components/DropdownButton.tsx create mode 100644 src/lib/styles/tokens/compare/baseline/Dropdown/components/DropdownMenuItem.tsx create mode 100644 src/lib/styles/tokens/compare/baseline/Dropdown/context/DropdownContext.tsx create mode 100644 src/lib/styles/tokens/compare/baseline/Dropdown/index.ts create mode 100644 src/lib/styles/tokens/compare/baseline/Dropdown/types.ts create mode 100644 src/lib/styles/tokens/compare/baseline/Modal/Modal.tsx create mode 100644 src/lib/styles/tokens/compare/baseline/Modal/ModalBaseline.module.scss create mode 100644 src/lib/styles/tokens/compare/baseline/Modal/components/ModalActions.tsx create mode 100644 src/lib/styles/tokens/compare/baseline/Modal/components/ModalHeader.tsx create mode 100644 src/lib/styles/tokens/compare/baseline/Modal/index.ts create mode 100644 src/lib/styles/tokens/compare/baseline/Modal/types.ts create mode 100644 src/lib/styles/tokens/compare/baseline/Toast/Toast.tsx create mode 100644 src/lib/styles/tokens/compare/baseline/Toast/ToastBaseline.module.scss create mode 100644 src/lib/styles/tokens/compare/baseline/Toast/types.ts diff --git a/docs/figma/Dropdown.md b/docs/figma/Dropdown.md new file mode 100644 index 00000000..d9e69f69 --- /dev/null +++ b/docs/figma/Dropdown.md @@ -0,0 +1,40 @@ +# Dropdown: Figma notes (maintained by AI, do not edit by hand) + +## Nodes + +| What | ID | +| ----------------------------------------------------------- | ----------------------------------------------------------------- | +| Page | `466:793` | +| Component set `Dropdown` (128 variants) | `466:795` | +| Doc frame | `466:2275` | +| Playground frame | `466:2432` | +| Sections: Documentation, Playground, Component, Internal | `466:2274`, `466:2431`, `466:794`, `468:881` | +| Component table labels / spec tables (groups) | in `466:794`: `table labels` `469:1096`, `spec tables` `466:2024` | +| Parts `_Dropdown/Item` (12 variants), `_Dropdown/Menu` (12) | `468:934`, `468:1195` | + +## Properties + +- Variants: `variant` (8) × `shape` (solid, textOnly) × `size` (xs, sm, md, lg; md default) × `disabled`. +- `label` (text) + `showLabel`; `showIcon` + `icon` (instance swap) before the label; `arrow` (instance swap on + `arrowIcon`, always shown): `Icon/arrow_drop_down`, or `_Dropdown/ArrowUp` (`475:1253`, the same glyph turned 180°) + while the menu is open. `pill` is a `sizing/radius/round` corner override on the instance. +- `_Dropdown/Item`: `kind` (item, header) × `disabled` × `size`; `label`, `showIcon` + `icon`, `showDivider` (off on the + first item). +- `_Dropdown/Menu`: `spacing` (callout, withGap, noSpace) × `size`; the MenuList holds four items (header, two items, + a disabled item). +- Table: column `size`; blocks `shape` × `disabled`; rows `variant` (primary first under solid, neutral first under + textOnly). + +## Decisions + +- The button is Button's box and colors (heights 24 · 32 · 40 · 48, `text-{size}` stronger, `sizing/icon/{size}`, + solid fills, neutral `color/neutral/soft`, textOnly `color/{variant}/text` with a `{variant}/soft` hover). The code + default variant is primary for solid and neutral for textOnly (#250). +- The menu: `color/surface/raised`, 1px `color/border/default`, radius `sizing/radius/md`, `elevation/2`; items like + Select's options (`color/text/stronger`, hover `color/neutral/soft`, a `color/border/soft` divider); header + `color/text/softer` strong; disabled `color/text/disabled`. callout: a caret 12px from the anchor's right edge. +- Hover, active, focus and open are in the Color spec (fills bound to the state tokens, the focus ring frame, the up + arrow). open keeps the default colors in every variant: only the arrow turns. +- Spec tables: Size spec (xs … lg × label, icon, icon without label), Color spec (variants × default · hover · active · focus · open · disabled per shape). + Scenarios: open menu by spacing, open menu by size, pill · textOnly. +- No Examples. diff --git a/docs/figma/Modal.md b/docs/figma/Modal.md new file mode 100644 index 00000000..600df28d --- /dev/null +++ b/docs/figma/Modal.md @@ -0,0 +1,35 @@ +# Modal: Figma notes (maintained by AI, do not edit by hand) + +## Nodes + +| What | ID | +| ---------------------------------------------- | --------------------------------------- | +| Page | `465:2182` | +| Component `Modal` | `465:3118` | +| Doc frame | `465:2184` | +| Playground frame | `465:2249` | +| Sections: Documentation, Playground, Component | `465:2183`, `465:2248`, `465:2255` | +| Spec tables (group) | in `465:2255`: `spec tables` `465:3556` | + +## Properties + +- One component, no variants: Modal has no color variants and `size` only changes the width, so the instance width + binds to `sizing/320 · 480 · 720 · 960` (md 480 default). +- `title` and `subtitle` (text) with `showHeader` and `showSubtitle`; `children` (text, the content); `closable` + (the close IconButton xxl neutral, 16px from the top right); `showActions`, `showAction`, `showAlternate` (Button md + pill: action primary solid, alternate neutral outline). +- `noContentPadding` and custom `buttons` are instance overrides; `maximizable` is the instance size (the screen minus + `sizing/64`). + +## Decisions + +- Like AlertModal: `color/surface/raised`, radius `sizing/radius/lg`, `elevation/4`, backdrop `color/backdrop`. +- Header: padding and gap `sizing/space/16`, a 1px `color/border/soft` bottom border; title `heading-h4` + `color/text/strong`, subtitle `body-lg` `color/text/soft`. Content: padding `sizing/space/16`, min height + `sizing/64`, `color/text/default`. Actions: padding and gap `sizing/space/16`, right-aligned, a 1px + `color/border/soft` top border. +- Spec tables: Size spec (sm · md · lg · xl; size only changes the width). Every cell keeps 48px around the modal, so + the `elevation/4` shadows never overlap. Scenarios: Content (title · subtitle · actions, + closable, title only, no header, no actions, actionButton only) and Backdrop (Light · Dark). No Color spec: Modal has + no color variants; Light and Dark are on the doc page. +- No Examples. diff --git a/docs/figma/README.md b/docs/figma/README.md index 67ea2102..62c9c5a3 100644 --- a/docs/figma/README.md +++ b/docs/figma/README.md @@ -11,8 +11,8 @@ what the rules do not: node IDs, per-component decisions and Plugin API pitfalls read-only reference. - Pages, alphabetical inside each group (docs/review/figma.md, Pages): Cover `0:1`, Getting Started `7:2`; Foundations: Colors `7:4`, Elevation `7:8`, Radius `7:7`, Spacing & Sizing `7:6`, Typography `7:5`; Components: Accordion `349:22`, Alert `242:22`, AlertModal `137:22`, - Avatar `236:798`, Badge `230:439`, Breadcrumb `174:22`, Button `129:22`, ButtonGroup `353:22`, Checkbox `339:22`, Chip `239:22`, DataView `269:22`, Divider `169:22`, Icon `361:288`, IconButton `361:289`, ImageView `352:22`, InputNumber `391:22`, InputPassword `390:22`, InputText `389:22`, Link `171:958`, ListView `265:22`, Pagination `261:22`, Panel `372:22`, - PinCode `405:22`, Popover `381:22`, ProgressBar `176:810`, ProgressCircle `7:10`, Radio `375:22`, RadioGroup `378:22`, Select `7:11`, Skeleton `171:22`, Switch `344:22`, Textarea `403:22`, Timeline `272:22`, Tooltip `384:22`; + Avatar `236:798`, Badge `230:439`, Breadcrumb `174:22`, Button `129:22`, ButtonGroup `353:22`, Checkbox `339:22`, Chip `239:22`, DataView `269:22`, Divider `169:22`, Dropdown `466:793`, Icon `361:288`, IconButton `361:289`, ImageView `352:22`, InputNumber `391:22`, InputPassword `390:22`, InputText `389:22`, Link `171:958`, ListView `265:22`, Modal `465:2182`, Pagination `261:22`, Panel `372:22`, + PinCode `405:22`, Popover `381:22`, ProgressBar `176:810`, ProgressCircle `7:10`, Radio `375:22`, RadioGroup `378:22`, Select `7:11`, Skeleton `171:22`, Switch `344:22`, Textarea `403:22`, Timeline `272:22`, Toast `465:468`, Tooltip `384:22`; Common Components (divider `386:22`): `_MotifInputText` `386:23`; Internal: `_Doc` `7:13`. The 40 embedded `Icon/` glyph components live on the Icon page (Icons section); the former `_Icons` page was removed on 2026-11-20. - Doc blocks on `_Doc`: Header `11:2`, SectionTitle `11:14`, PropRow `11:29`, Note `11:30`, Label `11:33`, diff --git a/docs/figma/Toast.md b/docs/figma/Toast.md new file mode 100644 index 00000000..67d87f9a --- /dev/null +++ b/docs/figma/Toast.md @@ -0,0 +1,36 @@ +# Toast: Figma notes (maintained by AI, do not edit by hand) + +## Nodes + +| What | ID | +| ---------------------------------------------- | ----------------------------------------------------- | +| Page | `465:468` | +| Component set `Toast` (8 variants) | `465:538` | +| Doc frame | `465:470` | +| Playground frame | `465:531` | +| Sections: Documentation, Playground, Component | `465:469`, `465:530`, `465:537` | +| Component table labels / spec tables (groups) | in `465:537`: `table labels`, `spec tables` `465:632` | + +## Properties + +- Variants: `variant` (8, default neutral). +- `title` (text) + `showTitle`; `content` (text, always shown: the code requires it); `showIcon` + `icon` (instance swap, + default `Icon/info`); `closable` (default true, like `useToast`); `showProgress` (default true: `useToast` gives a + 3000 ms duration) shows the countdown bar, a ProgressBar `size=sm` of the same variant, absolute along the bottom. +- The toast is 256px wide (`sizing/256`); the code makes it 100vw - 72px below the sm breakpoint. +- Table: no column property; rows `variant`, neutral first. + +## Decisions + +- Fill `{variant}/soft` layered over `color/surface/raised` (the soft tones are translucent and a toast floats over the + page), radius `sizing/radius/md` on every corner, no edge; the icon `{variant}/solid`, the title `{variant}/text` + (`label-xl` Semi Bold), the content `color/text/strong` (`body-md`); `elevation/3`; padding `sizing/space/10` + `sizing/space/16`, gap `sizing/space/10`. +- Toasts in the set, the doc and the spec tables sit 40px apart (cells 32px around the toast), so the `elevation/3` + shadows never overlap. +- The icon and the close button are 24px and sit on the title's line through Alert's `iconSlot` / `closeSlot` with the + 2px `titleOffset`. +- Spec tables: Color spec with the variants as rows and Light · Dark as columns. Scenarios: Content (title · content, + content only, icon unset, closable=false, duration unset). No Size spec: Toast has no sizes. +- The six positions, the slide animations and the pause on hover are on the doc page's "Not shown in Figma" note. +- No Examples. diff --git a/src/lib/components/Dropdown/Dropdown.module.scss b/src/lib/components/Dropdown/Dropdown.module.scss index 78fb846d..45855484 100644 --- a/src/lib/components/Dropdown/Dropdown.module.scss +++ b/src/lib/components/Dropdown/Dropdown.module.scss @@ -1,16 +1,9 @@ @use "@styles" as *; -$sizes: ( - // size, buttonPaddingAndGap, itemPaddingAndGap - ("xs", "4x", "6x"), - ("sm", "6x", "8x"), - ("md", "8x", "10x"), - ("lg", "10x", "12x") -); - -$states: "hover", "active", "disabled"; -$variants: ("primary", "secondary", "info", "success", "warning", "danger"); -$caret-margin: var(--base-sizing-12x); +// size (also the text and icon step), paddingV, paddingH +$sizes: (("xs", 4, 8), ("sm", 6, 12), ("md", 8, 16), ("lg", 10, 20)); + +$caret-margin: var(--mtf-sizing-12); // The caret points near the anchor's right edge. It is kept in the menu, e.g. when the menu is shifted into the screen. $caret-center: clamp($caret-margin, calc(var(--overlay-anchor-right) - $caret-margin), calc(100% - $caret-margin)); @@ -21,29 +14,30 @@ $caret-center: clamp($caret-margin, calc(var(--overlay-anchor-right) - $caret-ma border: solid transparent; content: " "; position: absolute; + left: $caret-center; pointer-events: none; @if $pos == bottom { - top: var(--base-sizing-2x); + top: 0; + translate: -50% var(--mtf-sizing-2); } @else { - bottom: var(--base-sizing-2x); + bottom: 0; + translate: -50% calc(-1 * var(--mtf-sizing-2)); } } &::before { - left: calc($caret-center - var(--base-sizing-6x)); - border-#{$pos}-color: var(--theme-color-surface-base-base7); + border-#{$pos}-color: var(--mtf-color-border-default); @if $pos == bottom { - border-width: 0 var(--base-sizing-6x) var(--base-sizing-10x) var(--base-sizing-6x); + border-width: 0 var(--mtf-sizing-6) var(--mtf-sizing-10) var(--mtf-sizing-6); } @else { - border-width: var(--base-sizing-10x) var(--base-sizing-6x) 0 var(--base-sizing-6x); + border-width: var(--mtf-sizing-10) var(--mtf-sizing-6) 0 var(--mtf-sizing-6); } } &::after { - left: calc($caret-center - var(--base-sizing-4x)); - border-#{$pos}-color: var(--theme-color-surface-base-bg-light); + border-#{$pos}-color: var(--mtf-color-surface-raised); @if $pos == bottom { - border-width: var(--base-sizing-2x) var(--base-sizing-4x) var(--base-sizing-10x) var(--base-sizing-4x); + border-width: var(--mtf-sizing-2) var(--mtf-sizing-4) var(--mtf-sizing-10) var(--mtf-sizing-4); } @else { - border-width: var(--base-sizing-10x) var(--base-sizing-4x) var(--base-sizing-2x) var(--base-sizing-4x); + border-width: var(--mtf-sizing-10) var(--mtf-sizing-4) var(--mtf-sizing-2) var(--mtf-sizing-4); } } } @@ -54,83 +48,103 @@ $caret-center: clamp($caret-margin, calc(var(--overlay-anchor-right) - $caret-ma .Root { display: inline-flex; justify-content: space-between; - border-radius: var(--theme-sizing-radius-default); align-items: center; + min-width: max-content; border: none; + border-radius: var(--mtf-sizing-radius-md); overflow-wrap: break-word; - min-width: max-content; - @include transition(background color); + + // Invisible, but forced colors (Windows high contrast) paint it as the button's edge + outline: var(--mtf-sizing-1) solid transparent; + outline-offset: calc(-1 * var(--mtf-sizing-1)); + @include transition(background-color color); &:not(:disabled) { cursor: pointer; } &:focus-visible { - border: solid var(--base-sizing-1x) var(--theme-color-surface-base-bg-light); - outline: solid var(--base-sizing-4x) var(--theme-color-border-primary-focus); + outline: var(--mtf-sizing-2) solid var(--mtf-color-focus-ring); + outline-offset: var(--mtf-sizing-2); } .arrowIcon { @include transition(rotate); } + &.open .arrowIcon { rotate: 180deg; } &.pill { - border-radius: var(--theme-sizing-radius-round); + border-radius: var(--mtf-sizing-radius-round); } &.textOnly { - background: transparent; - color: var(--theme-color-text-base-subtitle); - - &:hover, - &:active { - color: var(--theme-color-text-base-text-dark); - } - &:disabled { - color: var(--theme-color-text-base-disabled); - } + background-color: transparent; } +} - @each $variant in $variants { - $color: if(sass($variant == "secondary"): "light"; else: $variant); - &.solid.#{$variant} { - background-color: var(--theme-color-surface-#{$color}-default); - color: if(sass($variant == "secondary" or $variant == "warning"): var(--theme-color-text-base-title); else: var(--theme-color-text-base-global-light)); - - @each $state in $states { - &:#{$state} { - background-color: var(--theme-color-surface-#{$color}-#{$state}); - @if $variant == "secondary" { - color: var(--theme-color-text-light-#{$state}); - } - @if $variant == "warning" and $state == "disabled" { - color: var(--theme-color-text-base-default-overlay50); - } - } - } - } - - @if $variant != "secondary" { - &.textOnly.#{$variant} { - color: var(--theme-color-surface-#{$variant}-default); +@each $variant in $variants-v2 { + .#{$variant} { + @if $variant != "neutral" { + &.solid { + background-color: var(--mtf-color-#{$variant}-solid); + color: var(--mtf-color-on-#{$variant}); &:hover { - color: var(--theme-color-surface-#{$variant}-hover); + background-color: var(--mtf-color-#{$variant}-solid-hover); } + &:active { - color: var(--theme-color-surface-#{$variant}-active); - } - &:disabled { - color: var(--theme-color-text-base-disabled); + background-color: var(--mtf-color-#{$variant}-solid-active); } } } + + &.textOnly { + color: var(--mtf-color-#{$variant}-text); + + &:hover { + background-color: var(--mtf-color-#{$variant}-soft); + } + + &:active { + background-color: var(--mtf-color-#{$variant}-soft-hover); + } + } + } +} + +.neutral.solid { + background-color: var(--mtf-color-neutral-soft); + color: var(--mtf-color-neutral-text); + + &:hover { + background-color: var(--mtf-color-neutral-soft-hover); + } + + &:active { + background-color: var(--mtf-color-neutral-soft-active); } } +// After the variant rules: same specificity, so disabled wins by order +.solid, +.textOnly { + &:disabled { + color: var(--mtf-color-text-disabled); + } +} + +.solid:disabled { + background-color: var(--mtf-color-surface-disabled); +} + +.textOnly:disabled { + background-color: transparent; +} + // ============================================================================= // Dropdown Menu // ============================================================================= @@ -139,14 +153,16 @@ $caret-center: clamp($caret-margin, calc(var(--overlay-anchor-right) - $caret-ma position: absolute; width: max-content; box-sizing: border-box; - margin-inline: var(--base-sizing-8x); + margin-inline: var(--mtf-sizing-space-8); &.bottom { - padding-top: var(--base-sizing-10x); + padding-top: var(--mtf-sizing-space-10); } + &.top { - padding-bottom: var(--base-sizing-10x); + padding-bottom: var(--mtf-sizing-space-10); } + &.noSpace { padding-block: 0; } @@ -159,54 +175,51 @@ $caret-center: clamp($caret-margin, calc(var(--overlay-anchor-right) - $caret-ma } .MenuList { - list-style: none; - padding: 0; - margin-block: 0; position: relative; - border: solid var(--base-sizing-1x) var(--theme-color-border-light-default); - border-radius: var(--theme-sizing-radius-default); - background-color: var(--theme-color-surface-base-global-light); - @include shadow(6); + overflow: hidden; + margin-block: 0; + padding: 0; + list-style: none; + border: solid var(--mtf-sizing-1) var(--mtf-color-border-default); + border-radius: var(--mtf-sizing-radius-md); + background-color: var(--mtf-color-surface-raised); + box-shadow: var(--mtf-elevation-2); } // ============================================================================= // Dropdown Menu Item // ============================================================================= .MenuItem { - @include transition(color background-color); - color: var(--theme-color-text-base-subtitle); - user-select: none; display: flex; align-items: center; white-space: nowrap; + user-select: none; + color: var(--mtf-color-text-stronger); + @include transition(background-color); - li:first-child & { - border-top-left-radius: var(--theme-sizing-radius-default); - border-top-right-radius: var(--theme-sizing-radius-default); - } - li:last-child & { - border-bottom-left-radius: var(--theme-sizing-radius-default); - border-bottom-right-radius: var(--theme-sizing-radius-default); - } - li:not(:last-child) & { - border-bottom: solid var(--base-sizing-1x) var(--theme-color-surface-base-base6); + li:not(:first-child) & { + border-top: solid var(--mtf-sizing-1) var(--mtf-color-border-soft); } - &.MenuItem_disabled, &.MenuItem_header { pointer-events: none; - color: var(--theme-color-text-base-caption-light); + color: var(--mtf-color-text-softer); + } + + &.MenuItem_disabled { + pointer-events: none; + color: var(--mtf-color-text-disabled); } &.MenuItem_clickable { cursor: pointer; + &:hover { - background: var(--theme-color-surface-base-base4); - color: var(--theme-color-text-base-text-dark); + background-color: var(--mtf-color-neutral-soft); } } - .icon:first-child:last-child { + .icon:only-child { flex: 1; text-align: center; } @@ -215,21 +228,21 @@ $caret-center: clamp($caret-margin, calc(var(--overlay-anchor-right) - $caret-ma // ============================================================================= // COMMON // ============================================================================= -@each $size, $buttonPaddingAndGap, $itemPaddingAndGap in $sizes { +@each $size, $paddingV, $paddingH in $sizes { .#{$size} { &.Root { - padding: var(--base-sizing-#{$buttonPaddingAndGap}); - gap: var(--base-sizing-#{$buttonPaddingAndGap}); - @include font("base", $size, "500"); + padding: var(--mtf-sizing-space-#{$paddingV}) var(--mtf-sizing-space-#{$paddingH}); + gap: var(--mtf-sizing-space-#{$paddingV}); + @include typography("text-#{$size}", "stronger"); } + .MenuItem { - padding: var(--base-sizing-#{$itemPaddingAndGap}); - gap: var(--base-sizing-#{$itemPaddingAndGap}); - &.MenuItem_clickable { - @include font("body", $size); - } + padding: var(--mtf-sizing-space-#{$paddingV}) var(--mtf-sizing-space-#{$paddingH}); + gap: var(--mtf-sizing-space-#{$paddingV}); + @include typography("text-#{$size}", "regular"); + &.MenuItem_header { - @include font("base", $size, "500"); + @include typography("text-#{$size}", "strong"); } } } diff --git a/src/lib/components/Dropdown/Dropdown.stories.tsx b/src/lib/components/Dropdown/Dropdown.stories.tsx index 5706e1cc..063ec027 100644 --- a/src/lib/components/Dropdown/Dropdown.stories.tsx +++ b/src/lib/components/Dropdown/Dropdown.stories.tsx @@ -6,7 +6,7 @@ const meta: Meta = { component: Dropdown, argTypes: { shape: { table: { defaultValue: { summary: "solid" } } }, - variant: { table: { defaultValue: { summary: "primary" } } }, + variant: { table: { defaultValue: { summary: "primary (solid), neutral (textOnly)" } } }, size: { table: { defaultValue: { summary: "md" } } }, spacing: { table: { defaultValue: { summary: "callout" } } }, }, diff --git a/src/lib/components/Dropdown/Dropdown.tsx b/src/lib/components/Dropdown/Dropdown.tsx index 91d2d11f..452bd682 100644 --- a/src/lib/components/Dropdown/Dropdown.tsx +++ b/src/lib/components/Dropdown/Dropdown.tsx @@ -52,8 +52,7 @@ const Dropdown = (props: PropsWithRef) => { const mergedRef = useMemo(() => mergeRefs(anchorRef, ref), [ref]); const side = placement.startsWith("top") ? "top" : "bottom"; - // solid defaults to primary; textOnly stays neutral unless a variant is given. - const variantClass = variant ?? (shape === "solid" && "primary"); + const variantClass = variant ?? (shape === "solid" ? "primary" : "neutral"); const buttonClassNames = sanitizeModuleRootClasses(styles, className, [size, shape, variantClass, open && "open", pill && "pill"]); const overlayClassNames = sanitizeModuleClasses(styles, "Menu", size, spacing, side); diff --git a/src/lib/components/Dropdown/test/Dropdown.test.tsx b/src/lib/components/Dropdown/test/Dropdown.test.tsx index b4ac3a34..94cc795e 100644 --- a/src/lib/components/Dropdown/test/Dropdown.test.tsx +++ b/src/lib/components/Dropdown/test/Dropdown.test.tsx @@ -1,7 +1,7 @@ import { render, screen, fireEvent, waitFor, cleanup } from "@testing-library/react"; import { createRef } from "react"; import { runIconPropTest, runSnapshotDefaultsAndStandardPropsTest } from "../../../../utils/testUtils"; -import { StandardPropsWithRef, Variant } from "../../../../lib/types"; +import { StandardPropsWithRef, VariantV2 } from "../../../../lib/types"; import Dropdown from "../Dropdown"; import { userEvent } from "@testing-library/user-event"; import { Size4SM } from "../../../types"; @@ -27,7 +27,7 @@ describe("Dropdown", () => { ); it("should be rendered in different color schemas given in the variant prop", () => { - const variants: Variant[] = ["primary", "secondary", "success", "danger", "warning", "info"]; + const variants: VariantV2[] = ["neutral", "primary", "secondary", "accent", "success", "danger", "warning", "info"]; variants.forEach(variant => { expect(render().container.firstElementChild).toHaveClass(variant); }); @@ -164,6 +164,8 @@ describe("Dropdown", () => { expect(container.firstElementChild).toHaveClass("solid"); rerender(); expect(container.firstElementChild).toHaveClass("textOnly"); + // textOnly without a variant is neutral + expect(container.firstElementChild).toHaveClass("neutral"); }); it("should add the given variant class to textOnly", () => { diff --git a/src/lib/components/Dropdown/types.ts b/src/lib/components/Dropdown/types.ts index 1b244811..3e6f7ff1 100644 --- a/src/lib/components/Dropdown/types.ts +++ b/src/lib/components/Dropdown/types.ts @@ -1,6 +1,6 @@ import type { IconGlobalType } from "../../types"; import type { MouseEvent } from "react"; -import { OverlayRefProps, Size4SM, Variant } from "../../types"; +import { OverlayRefProps, Size4SM, VariantV2 } from "../../types"; export type Spacing = "withGap" | "callout" | "noSpace"; @@ -26,7 +26,7 @@ export type DropdownProps = { export type DropdownDefaultableProps = { shape?: "solid" | "textOnly"; - variant?: Variant; + variant?: VariantV2; size?: Size4SM; pill?: boolean; spacing?: Spacing; diff --git a/src/lib/components/Modal/Modal.module.scss b/src/lib/components/Modal/Modal.module.scss index a5e0776f..4e370c9c 100644 --- a/src/lib/components/Modal/Modal.module.scss +++ b/src/lib/components/Modal/Modal.module.scss @@ -1,13 +1,9 @@ @use "@styles" as *; -$side-space: 4rem; -$sizes: ( - //sizeName, width - ("sm", "320x"), - ("md", "480x"), - ("lg", "720x"), - ("xl", "960x") -); +$side-space: var(--mtf-sizing-64); + +// size, width +$sizes: (("sm", 320), ("md", 480), ("lg", 720), ("xl", 960)); .Root { position: fixed; @@ -15,23 +11,21 @@ $sizes: ( width: 100%; height: 100%; min-height: 100%; - background-color: var(--base-colors-black-black-overlay50); + background-color: var(--mtf-color-backdrop); display: flex; - z-index: 999; + z-index: z-layer("modal"); @include fade-default; &.show { @include fade-in; } - // Size classes at root level @each $size, $width in $sizes { &.#{$size} .modal { - width: var(--base-sizing-#{$width}); + width: var(--mtf-sizing-#{$width}); } } - // Maximized class at root level &.maximized .modal { width: calc(100% - $side-space); height: calc(100% - $side-space); @@ -47,10 +41,10 @@ $sizes: ( top: 50%; left: 50%; transform: translate(-50%, -50%); - background: white; - color: black; - border-radius: var(--theme-sizing-radius-default); - @include shadow(4); + background-color: var(--mtf-color-surface-raised); + color: var(--mtf-color-text-default); + border-radius: var(--mtf-sizing-radius-lg); + box-shadow: var(--mtf-elevation-4); height: auto; max-width: calc(100% - $side-space); max-height: 100%; @@ -68,35 +62,21 @@ $sizes: ( } .content { - padding: var(--base-sizing-16x); - min-height: var(--base-sizing-64x); + padding: var(--mtf-sizing-space-16); + min-height: var(--mtf-sizing-64); height: 100%; overflow-y: auto; + scrollbar-color: var(--mtf-color-border-strong) transparent; .noContentPadding & { padding: 0; } - - &::-webkit-scrollbar { - width: var(--base-sizing-8x); - } - - &::-webkit-scrollbar-track { - background: #f1f1f1; - margin: var(--base-sizing-1x) 0; - border-radius: var(--theme-sizing-radius-default); - } - - &::-webkit-scrollbar-thumb { - background: var(--base-colors-black-black-overlay25); - border-radius: var(--theme-sizing-radius-default); - } } .closeButton { position: absolute; - top: var(--base-sizing-16x); - right: var(--base-sizing-16x); + top: var(--mtf-sizing-space-16); + right: var(--mtf-sizing-space-16); } // ============================================================================= @@ -105,37 +85,39 @@ $sizes: ( .header { display: flex; - padding: var(--base-sizing-16x); - gap: var(--base-sizing-16x); - border-bottom: solid var(--base-sizing-1x) var(--theme-color-surface-base-base6); + padding: var(--mtf-sizing-space-16); + gap: var(--mtf-sizing-space-16); + border-bottom: solid var(--mtf-sizing-1) var(--mtf-color-border-soft); align-items: flex-start; } .headerContent { flex: 1; - gap: var(--base-sizing-4x); overflow-wrap: break-word; .headerTitle { display: block; - color: var(--theme-color-text-base-title); - @include font("heading", "heading4"); + color: var(--mtf-color-text-strong); + @include typography("heading-h4"); } .headerSubtitle { display: block; - color: var(--theme-color-text-base-caption); - @include font("body", "lg"); + color: var(--mtf-color-text-soft); + @include typography("body-lg"); } } -// Modal Actions Styles +// ============================================================================= +// Sub Component: Actions +// ============================================================================= + .actions { display: flex; flex-wrap: wrap; - padding: var(--base-sizing-16x); - gap: var(--base-sizing-16x); + padding: var(--mtf-sizing-space-16); + gap: var(--mtf-sizing-space-16); justify-content: flex-end; flex-shrink: 0; - border-top: solid var(--base-sizing-1x) var(--theme-color-surface-base-base6); + border-top: solid var(--mtf-sizing-1) var(--mtf-color-border-soft); } diff --git a/src/lib/components/Toast/Toast.module.scss b/src/lib/components/Toast/Toast.module.scss index bb665fa9..0ff8301b 100644 --- a/src/lib/components/Toast/Toast.module.scss +++ b/src/lib/components/Toast/Toast.module.scss @@ -1,14 +1,14 @@ @use "@styles" as *; -$color-types: (("secondary", "light"), ("warning", "warning"), ("success", "success"), ("danger", "danger"), ("info", "info")); +$edge: var(--mtf-sizing-space-16); $positions: ( // position, animationIn, animationOut, top, right, bottom, left, transform - ("top", slideInTop, slideOutTop, var(--base-sizing-16x), null, null, 50%, translateX(-50%)), - ("topRight", slideInRight, slideOutRight, var(--base-sizing-16x), var(--base-sizing-16x), null, null, null), - ("topLeft", slideInLeft, slideOutLeft, var(--base-sizing-16x), null, null, var(--base-sizing-16x), null), - ("bottom", slideInBottom, slideOutBottom, null, null, var(--base-sizing-16x), 50%, translateX(-50%)), - ("bottomRight", slideInRight, slideOutRight, null, var(--base-sizing-16x), var(--base-sizing-16x), null, null), - ("bottomLeft", slideInLeft, slideOutLeft, null, null, var(--base-sizing-16x), var(--base-sizing-16x), null) + ("top", slideInTop, slideOutTop, $edge, null, null, 50%, translateX(-50%)), + ("topRight", slideInRight, slideOutRight, $edge, $edge, null, null, null), + ("topLeft", slideInLeft, slideOutLeft, $edge, null, null, $edge, null), + ("bottom", slideInBottom, slideOutBottom, null, null, $edge, 50%, translateX(-50%)), + ("bottomRight", slideInRight, slideOutRight, null, $edge, $edge, null, null), + ("bottomLeft", slideInLeft, slideOutLeft, null, null, $edge, $edge, null) ); $animation-keyframes: ( // animation, transform0, transform100, opacity0, $opacity100 @@ -38,25 +38,37 @@ $animation-keyframes: ( position: relative; display: flex; flex-wrap: nowrap; - @include width-or-width-below-screen-size(--theme-grid-breakpoint-sm, --base-sizing-256x, calc(100vw - var(--base-sizing-72x))); - padding: var(--base-sizing-10x) var(--base-sizing-20x); - gap: var(--base-sizing-10x); - border-radius: var(--theme-sizing-radius-default); + width: var(--mtf-sizing-256); + padding: var(--mtf-sizing-space-10) var(--mtf-sizing-space-16); + gap: var(--mtf-sizing-space-10); align-items: flex-start; + border-radius: var(--mtf-sizing-radius-md); + background-color: var(--mtf-color-surface-raised); + color: var(--mtf-color-text-strong); + box-shadow: var(--mtf-elevation-3); - .icon { - align-self: center; + @include screen-width("below", "sm") { + width: calc(100vw - var(--mtf-sizing-72)); + } + + // The title's line (28px) is 4px taller than the icon and the close button (24px), which sit on it + &:has(.title) .icon, + &:has(.title) .close { + margin-top: var(--mtf-sizing-space-2); } -} -@each $color-type, $color in $color-types { - .#{$color-type} { - color: var(--theme-color-text-base-title); - background-color: var(--theme-color-surface-#{$color}-negative); - border-left-color: var(--theme-color-text-#{$color}-active); + // The soft tones are translucent: layered over the raised fill, so the page does not show through + @each $variant in $variants-v2 { + &.#{$variant} { + background-image: linear-gradient(var(--mtf-color-#{$variant}-soft), var(--mtf-color-#{$variant}-soft)); + + .title { + color: var(--mtf-color-#{$variant}-text); + } - .title { - color: var(--theme-color-text-#{$color}-active); + .icon { + color: var(--mtf-color-#{$variant}-solid); + } } } } @@ -64,20 +76,26 @@ $animation-keyframes: ( .contentContainer { display: flex; flex-direction: column; - gap: var(--base-sizing-4x); + gap: var(--mtf-sizing-space-4); flex-grow: 1; max-height: 90vh; overflow-y: scroll; @include hidden-scrollbar; .content { - @include font("body", "md"); + @include typography("body-md"); } + .title { - @include font("base", "lg", "600"); + @include typography("label-xl", "stronger"); } } +// IconButton clips its icon (overflow: hidden), so it must not shrink +.close { + flex-shrink: 0; +} + .progress { position: absolute; bottom: 0; @@ -88,7 +106,7 @@ $animation-keyframes: ( .Container { display: flex; flex-direction: column-reverse; - row-gap: var(--base-sizing-12x); + row-gap: var(--mtf-sizing-space-12); position: fixed; z-index: 5; diff --git a/src/lib/components/Toast/Toast.test.tsx b/src/lib/components/Toast/Toast.test.tsx index 844f563f..d4472d09 100644 --- a/src/lib/components/Toast/Toast.test.tsx +++ b/src/lib/components/Toast/Toast.test.tsx @@ -100,7 +100,7 @@ describe("Toast", () => { }); it("should be rendered in the variant given in the variant prop", () => { - const variants = ["secondary", "danger", "warning", "info", "success"] as const; + const variants = ["neutral", "primary", "secondary", "accent", "info", "success", "warning", "danger"] as const; variants.forEach((variant, i) => { render(); diff --git a/src/lib/components/Toast/Toast.tsx b/src/lib/components/Toast/Toast.tsx index 696ef66f..ec1cc772 100644 --- a/src/lib/components/Toast/Toast.tsx +++ b/src/lib/components/Toast/Toast.tsx @@ -64,7 +64,7 @@ const Toast = (props: PropsWithRef) => { return ( !dismissed && (
- {icon && } + {icon && }
{title && {title}} @@ -75,7 +75,7 @@ const Toast = (props: PropsWithRef) => {
- {closable && } + {closable && } {duration !== undefined && }
diff --git a/src/lib/components/Toast/types.ts b/src/lib/components/Toast/types.ts index f5b1d1a1..eed8862e 100644 --- a/src/lib/components/Toast/types.ts +++ b/src/lib/components/Toast/types.ts @@ -1,10 +1,10 @@ import type { IconGlobalType } from "../../types"; import { ReactElement } from "react"; -import { PropsWithRef } from "../../types"; +import { PropsWithRef, VariantV2 } from "../../types"; export type ToastPosition = "topLeft" | "topRight" | "top" | "bottomLeft" | "bottomRight" | "bottom"; -export type ToastVariant = "secondary" | "danger" | "warning" | "info" | "success"; +export type ToastVariant = VariantV2; export type ToastProps = { id: string; diff --git a/src/lib/components/Toast/useToast.tsx b/src/lib/components/Toast/useToast.tsx index cefafa9b..58d4c4ee 100644 --- a/src/lib/components/Toast/useToast.tsx +++ b/src/lib/components/Toast/useToast.tsx @@ -53,11 +53,14 @@ export const useToast: () => UseToastProps = () => { const { top, bottom, topRight, topLeft, bottomRight, bottomLeft } = state.toasts; return { + neutral: createToast("neutral"), + primary: createToast("primary"), + secondary: createToast("secondary"), + accent: createToast("accent"), + info: createToast("info"), success: createToast("success"), warning: createToast("warning"), - info: createToast("info"), danger: createToast("danger"), - secondary: createToast("secondary"), toasts: ( <> diff --git a/src/lib/styles/tokens/compare/Dropdown.compare-stories.tsx b/src/lib/styles/tokens/compare/Dropdown.compare-stories.tsx new file mode 100644 index 00000000..00611bb5 --- /dev/null +++ b/src/lib/styles/tokens/compare/Dropdown.compare-stories.tsx @@ -0,0 +1,161 @@ +import type { Meta, StoryObj } from "@storybook/nextjs"; +import { ComponentType, CSSProperties, Context } from "react"; +import nextStyles from "@/components/Dropdown/Dropdown.module.scss"; +import NextButton from "@/components/Dropdown/components/DropdownButton"; +import NextItem from "@/components/Dropdown/components/DropdownMenuItem"; +import { DropdownContext as NextContext } from "@/components/Dropdown/context/DropdownContext"; +import { DropdownContextProps, DropdownMenuItemProps, DropdownProps } from "@/components/Dropdown/types"; +import Button from "@/components/Button/Button"; +import currentStyles from "./baseline/Dropdown/DropdownBaseline.module.scss"; +import CurrentButton from "./baseline/Dropdown/components/DropdownButton"; +import CurrentItem from "./baseline/Dropdown/components/DropdownMenuItem"; +import { DropdownContext as CurrentContext } from "./baseline/Dropdown/context/DropdownContext"; +import ButtonBaseline from "./baseline/Button/Button"; +import { sanitizeModuleClasses, sanitizeModuleRootClasses } from "../../../../utils/cssUtils"; +import { CompareSection, TokenCompare } from "./TokenCompare"; + +type Row = Omit & { items?: DropdownMenuItemProps[]; menu?: boolean; besideButton?: boolean }; + +type Parts = { + styles: Readonly>; + Trigger: ComponentType<{ label?: string; icon?: DropdownProps["icon"]; className?: string }>; + Item: ComponentType; + Ctx: Context; + ButtonView: ComponentType<{ label: string; size: DropdownProps["size"]; variant?: string }>; + // Today has no neutral: its light gray secondary is the new neutral. Today's textOnly has no variant by default. + variantOf: (variant: DropdownProps["variant"], shape: DropdownProps["shape"]) => string | false | undefined; +}; + +// The menu is a portal on document.body in the component; the preview draws the button and the open menu in place with +// each version's own parts and classes +const preview = + ({ styles, Trigger, Item, Ctx, ButtonView, variantOf }: Parts) => + (props: Row) => { + const { + size = "md", + shape = "solid", + spacing = "callout", + variant, + pill, + disabled, + label, + icon, + items = [], + menu, + besideButton, + } = props; + const classNames = sanitizeModuleRootClasses(styles, undefined, [ + size, + shape, + variantOf(variant, shape), + menu && "open", + pill && "pill", + ]); + + return ( + undefined }}> +
+
+ + {besideButton && } +
+ {menu && ( +
+
    + {items.map((item, index) => ( + + ))} +
+
+ )} +
+
+ ); + }; + +const Current = preview({ + styles: currentStyles, + Trigger: CurrentButton, + Item: CurrentItem as ComponentType, + Ctx: CurrentContext, + ButtonView: ButtonBaseline as ComponentType<{ label: string; size: DropdownProps["size"]; variant?: string }>, + variantOf: (variant, shape) => (variant === "neutral" ? "secondary" : (variant ?? (shape === "solid" && "primary"))), +}); +const Next = preview({ + styles: nextStyles, + Trigger: NextButton, + Item: NextItem, + Ctx: NextContext, + ButtonView: Button as ComponentType<{ label: string; size: DropdownProps["size"]; variant?: string }>, + variantOf: (variant, shape) => variant ?? (shape === "solid" ? "primary" : "neutral"), +}); + +const VARIANTS = ["neutral", "primary", "secondary", "accent", "info", "success", "warning", "danger"] as const; +const SIZES = ["xs", "sm", "md", "lg"] as const; +const ITEMS: DropdownMenuItemProps[] = [ + { header: "Account" }, + { label: "Profile", icon: "person" }, + { label: "Settings", icon: "settings" }, + { label: "Archived", disabled: true }, +]; +const base: Row = { label: "Dropdown", size: "md" }; + +const sections: CompareSection[] = [ + { + title: "Variants (solid)", + note: "Today's neutral is its light gray secondary; Today has no accent. The default is primary.", + rows: VARIANTS.map(variant => ({ label: variant, props: { ...base, variant } })), + }, + { + title: "Variants (textOnly)", + note: "textOnly without a variant is neutral (Today: gray); with one it takes the variant's text color, like Button's textonly.", + rows: [ + { label: "no variant", props: { ...base, shape: "textOnly" } }, + ...VARIANTS.filter(variant => variant !== "neutral").map(variant => ({ + label: variant, + props: { ...base, shape: "textOnly" as const, variant }, + })), + ], + }, + { + title: "Sizes, beside a Button", + note: "The button is Button's box: heights 24 · 32 · 40 · 48.", + rows: SIZES.map(size => ({ label: size, props: { ...base, size, icon: "home", besideButton: true } })), + }, + { + title: "States", + rows: [ + { label: "pill", props: { ...base, pill: true } }, + { label: "disabled", props: { ...base, disabled: true } }, + { label: "textOnly · disabled", props: { ...base, shape: "textOnly", disabled: true } }, + ], + }, + { + title: "Menu", + note: "Items are Select's options: text-{size}, hover neutral-soft, border-soft between items; the header is text-softer.", + rows: SIZES.map(size => ({ label: size, props: { ...base, size, menu: true, items: ITEMS } })), + }, + { + title: "Menu spacing", + rows: (["callout", "withGap", "noSpace"] as const).map(spacing => ({ + label: spacing, + props: { ...base, spacing, menu: true, items: ITEMS }, + })), + }, +]; + +const meta: Meta = { + title: "Token Compare/Dropdown", + component: TokenCompare, + parameters: { layout: "padded" }, +}; + +export default meta; + +export const Dropdown_: StoryObj = { + name: "Dropdown", + render: () => , +}; diff --git a/src/lib/styles/tokens/compare/Modal.compare-stories.tsx b/src/lib/styles/tokens/compare/Modal.compare-stories.tsx new file mode 100644 index 00000000..99cd9de4 --- /dev/null +++ b/src/lib/styles/tokens/compare/Modal.compare-stories.tsx @@ -0,0 +1,85 @@ +import type { Meta, StoryObj } from "@storybook/nextjs"; +import { ComponentType } from "react"; +import nextStyles from "@/components/Modal/Modal.module.scss"; +import NextHeader from "@/components/Modal/components/ModalHeader"; +import NextActions from "@/components/Modal/components/ModalActions"; +import { ModalProps } from "@/components/Modal/types"; +import { MotifIconButton } from "@/components/Motif/Icon"; +import currentStyles from "./baseline/Modal/ModalBaseline.module.scss"; +import CurrentHeader from "./baseline/Modal/components/ModalHeader"; +import CurrentActions from "./baseline/Modal/components/ModalActions"; +import { sanitizeModuleRootClasses } from "../../../../utils/cssUtils"; +import { CompareSection, TokenCompare } from "./TokenCompare"; + +type Row = Omit & { text?: string }; +type HeaderProps = Pick; +type ActionsProps = Pick; + +// Modal portals into document.body with position: fixed, so the preview draws the same markup in place with each +// version's own parts and classes +const preview = + (styles: Readonly>, Header: ComponentType, Actions: ComponentType) => + ({ size = "md", closable, noContentPadding, title, subtitle, text, actionButton, alternateButton }: Row) => ( +
+
+ {closable && } +
+
{text}
+ +
+
+ ); + +const Current = preview(currentStyles, CurrentHeader, CurrentActions); +const Next = preview(nextStyles, NextHeader, NextActions); + +const noop = () => undefined; +const TEXT = "Your changes are saved as a draft. Publish them to make the page visible to everyone on the team."; +const base: Row = { + size: "sm", + title: "Publish changes", + subtitle: "3 pages changed", + text: TEXT, + actionButton: { text: "Publish", onClick: noop }, + alternateButton: { text: "Cancel", onClick: noop }, +}; + +const sections: CompareSection[] = [ + { + title: "Content", + rows: [ + { label: "default", props: base }, + { label: "closable", props: { ...base, closable: true } }, + { label: "title only", props: { ...base, subtitle: undefined } }, + { label: "no header", props: { ...base, title: undefined, subtitle: undefined } }, + { label: "no actions", props: { ...base, actionButton: undefined, alternateButton: undefined } }, + { label: "noContentPadding", props: { ...base, noContentPadding: true } }, + ], + }, + { + title: "Scrolling content", + note: "The content scrolls inside the box; the scrollbar takes border-strong on a transparent track.", + rows: [{ label: "long text", props: { ...base, text: Array(8).fill(TEXT).join(" ") } }], + }, + { + title: "Sizes", + note: "size only changes the width (sizing-320 · 480 · 720 · 960); lg and xl do not fit the column and are not shown.", + rows: (["sm", "md"] as const).map(size => ({ label: size, props: { ...base, size } })), + }, +]; + +const meta: Meta = { + title: "Token Compare/Modal", + component: TokenCompare, + parameters: { layout: "padded" }, +}; + +export default meta; + +export const Modal_: StoryObj = { + name: "Modal", + render: () => , +}; diff --git a/src/lib/styles/tokens/compare/Toast.compare-stories.tsx b/src/lib/styles/tokens/compare/Toast.compare-stories.tsx new file mode 100644 index 00000000..583690c3 --- /dev/null +++ b/src/lib/styles/tokens/compare/Toast.compare-stories.tsx @@ -0,0 +1,55 @@ +import type { Meta, StoryObj } from "@storybook/nextjs"; +import Toast from "@/components/Toast/Toast"; +import { ToastProps } from "@/components/Toast/types"; +import ToastBaseline from "./baseline/Toast/Toast"; +import { ToastVariant as BaselineVariant } from "./baseline/Toast/types"; +import { CompareSection, TokenCompare } from "./TokenCompare"; + +type Row = Omit; + +// Today has no neutral, primary or accent: its light gray secondary is the new neutral +const Current = ({ variant, ...props }: Row) => ( + +); +const Next = (props: Row) => ; + +const VARIANTS = ["neutral", "primary", "secondary", "accent", "info", "success", "warning", "danger"] as const; +const base: Row = { + variant: "info", + title: "Upload complete", + content: "The report is saved to your files.", + icon: "info", + closable: true, +}; + +const sections: CompareSection[] = [ + { + title: "Variants", + note: "Today's secondary (light gray) is now neutral; secondary is the brand color. Today has no primary or accent. Soft fill over the raised surface, elevation-3.", + rows: VARIANTS.map(variant => ({ label: variant, props: { ...base, variant } })), + }, + { + title: "Content", + note: "The icon and the close button are 24px and sit on the title's line.", + rows: [ + { label: "title + content", props: base }, + { label: "content only", props: { ...base, title: undefined } }, + { label: "no icon", props: { ...base, icon: undefined } }, + { label: "not closable", props: { ...base, closable: false } }, + { label: "with duration", props: { ...base, duration: 1e9 } }, + ], + }, +]; + +const meta: Meta = { + title: "Token Compare/Toast", + component: TokenCompare, + parameters: { layout: "padded" }, +}; + +export default meta; + +export const Toast_: StoryObj = { + name: "Toast", + render: () => , +}; diff --git a/src/lib/styles/tokens/compare/baseline/Dropdown/Dropdown.tsx b/src/lib/styles/tokens/compare/baseline/Dropdown/Dropdown.tsx new file mode 100644 index 00000000..c3dc9eea --- /dev/null +++ b/src/lib/styles/tokens/compare/baseline/Dropdown/Dropdown.tsx @@ -0,0 +1,79 @@ +"use client"; + +import { PropsWithRef } from "../../../../../types"; +import { DropdownProps } from "./types"; +import DropdownButton from "./components/DropdownButton"; +import DropdownMenuItem from "./components/DropdownMenuItem"; +import { sanitizeModuleClasses, sanitizeModuleRootClasses } from "../../../../../../utils/cssUtils"; +import styles from "./DropdownBaseline.module.scss"; +import usePropsWithThemeDefaults from "../../../../../motif/hooks/usePropsWithThemeDefaults"; +import { useMemo, useRef } from "react"; +import { DropdownContext } from "./context/DropdownContext"; +import useAnchoredOverlay from "../../../../../hooks/useAnchoredOverlay"; +import { createPortal } from "react-dom"; +import { mergeRefs } from "../../../../../../utils/reactUtils"; + +const Dropdown = (props: PropsWithRef) => { + const { + size = "md", + disabled, + label, + icon, + pill, + variant, + shape = "solid", + spacing = "callout", + items, + ref, + overlayRef, + style, + className, + } = usePropsWithThemeDefaults("Dropdown", props); + + const anchorRef = useRef(null); + const { + open, + hide, + attached, + overlayRef: menuRef, + insideProps, + style: overlayStyle, + placement, + } = useAnchoredOverlay({ + anchorRef, + overlayRef, + placement: "bottomRight", + toggleOnAnchorClick: true, + tabBridge: true, + closeOnOutsideClick: true, + closeOnEscape: true, + inactive: disabled, + }); + const mergedRef = useMemo(() => mergeRefs(anchorRef, ref), [ref]); + + const side = placement.startsWith("top") ? "top" : "bottom"; + // solid defaults to primary; textOnly stays neutral unless a variant is given. + const variantClass = variant ?? (shape === "solid" && "primary"); + const buttonClassNames = sanitizeModuleRootClasses(styles, className, [size, shape, variantClass, open && "open", pill && "pill"]); + const overlayClassNames = sanitizeModuleClasses(styles, "Menu", size, spacing, side); + + return ( + + + {attached && + createPortal( +
+
    + {items.map((item, index) => ( + + ))} +
+
, + document.body, + )} +
+ ); +}; + +Dropdown.displayName = "Dropdown"; +export default Dropdown; diff --git a/src/lib/styles/tokens/compare/baseline/Dropdown/DropdownBaseline.module.scss b/src/lib/styles/tokens/compare/baseline/Dropdown/DropdownBaseline.module.scss new file mode 100644 index 00000000..78fb846d --- /dev/null +++ b/src/lib/styles/tokens/compare/baseline/Dropdown/DropdownBaseline.module.scss @@ -0,0 +1,236 @@ +@use "@styles" as *; + +$sizes: ( + // size, buttonPaddingAndGap, itemPaddingAndGap + ("xs", "4x", "6x"), + ("sm", "6x", "8x"), + ("md", "8x", "10x"), + ("lg", "10x", "12x") +); + +$states: "hover", "active", "disabled"; +$variants: ("primary", "secondary", "info", "success", "warning", "danger"); +$caret-margin: var(--base-sizing-12x); + +// The caret points near the anchor's right edge. It is kept in the menu, e.g. when the menu is shifted into the screen. +$caret-center: clamp($caret-margin, calc(var(--overlay-anchor-right) - $caret-margin), calc(100% - $caret-margin)); + +@mixin caret-tip($pos) { + &::after, + &::before { + border: solid transparent; + content: " "; + position: absolute; + pointer-events: none; + @if $pos == bottom { + top: var(--base-sizing-2x); + } @else { + bottom: var(--base-sizing-2x); + } + } + &::before { + left: calc($caret-center - var(--base-sizing-6x)); + border-#{$pos}-color: var(--theme-color-surface-base-base7); + @if $pos == bottom { + border-width: 0 var(--base-sizing-6x) var(--base-sizing-10x) var(--base-sizing-6x); + } @else { + border-width: var(--base-sizing-10x) var(--base-sizing-6x) 0 var(--base-sizing-6x); + } + } + &::after { + left: calc($caret-center - var(--base-sizing-4x)); + border-#{$pos}-color: var(--theme-color-surface-base-bg-light); + @if $pos == bottom { + border-width: var(--base-sizing-2x) var(--base-sizing-4x) var(--base-sizing-10x) var(--base-sizing-4x); + } @else { + border-width: var(--base-sizing-10x) var(--base-sizing-4x) var(--base-sizing-2x) var(--base-sizing-4x); + } + } +} + +// ============================================================================= +// Dropdown Button +// ============================================================================= +.Root { + display: inline-flex; + justify-content: space-between; + border-radius: var(--theme-sizing-radius-default); + align-items: center; + border: none; + overflow-wrap: break-word; + min-width: max-content; + @include transition(background color); + + &:not(:disabled) { + cursor: pointer; + } + + &:focus-visible { + border: solid var(--base-sizing-1x) var(--theme-color-surface-base-bg-light); + outline: solid var(--base-sizing-4x) var(--theme-color-border-primary-focus); + } + + .arrowIcon { + @include transition(rotate); + } + &.open .arrowIcon { + rotate: 180deg; + } + + &.pill { + border-radius: var(--theme-sizing-radius-round); + } + + &.textOnly { + background: transparent; + color: var(--theme-color-text-base-subtitle); + + &:hover, + &:active { + color: var(--theme-color-text-base-text-dark); + } + &:disabled { + color: var(--theme-color-text-base-disabled); + } + } + + @each $variant in $variants { + $color: if(sass($variant == "secondary"): "light"; else: $variant); + &.solid.#{$variant} { + background-color: var(--theme-color-surface-#{$color}-default); + color: if(sass($variant == "secondary" or $variant == "warning"): var(--theme-color-text-base-title); else: var(--theme-color-text-base-global-light)); + + @each $state in $states { + &:#{$state} { + background-color: var(--theme-color-surface-#{$color}-#{$state}); + @if $variant == "secondary" { + color: var(--theme-color-text-light-#{$state}); + } + @if $variant == "warning" and $state == "disabled" { + color: var(--theme-color-text-base-default-overlay50); + } + } + } + } + + @if $variant != "secondary" { + &.textOnly.#{$variant} { + color: var(--theme-color-surface-#{$variant}-default); + + &:hover { + color: var(--theme-color-surface-#{$variant}-hover); + } + &:active { + color: var(--theme-color-surface-#{$variant}-active); + } + &:disabled { + color: var(--theme-color-text-base-disabled); + } + } + } + } +} + +// ============================================================================= +// Dropdown Menu +// ============================================================================= +.Menu { + z-index: z-layer("anchored"); + position: absolute; + width: max-content; + box-sizing: border-box; + margin-inline: var(--base-sizing-8x); + + &.bottom { + padding-top: var(--base-sizing-10x); + } + &.top { + padding-bottom: var(--base-sizing-10x); + } + &.noSpace { + padding-block: 0; + } +} + +@each $pos in bottom, top { + .#{$pos}.callout { + @include caret-tip($pos); + } +} + +.MenuList { + list-style: none; + padding: 0; + margin-block: 0; + position: relative; + border: solid var(--base-sizing-1x) var(--theme-color-border-light-default); + border-radius: var(--theme-sizing-radius-default); + background-color: var(--theme-color-surface-base-global-light); + @include shadow(6); +} + +// ============================================================================= +// Dropdown Menu Item +// ============================================================================= +.MenuItem { + @include transition(color background-color); + color: var(--theme-color-text-base-subtitle); + user-select: none; + display: flex; + align-items: center; + white-space: nowrap; + + li:first-child & { + border-top-left-radius: var(--theme-sizing-radius-default); + border-top-right-radius: var(--theme-sizing-radius-default); + } + li:last-child & { + border-bottom-left-radius: var(--theme-sizing-radius-default); + border-bottom-right-radius: var(--theme-sizing-radius-default); + } + li:not(:last-child) & { + border-bottom: solid var(--base-sizing-1x) var(--theme-color-surface-base-base6); + } + + &.MenuItem_disabled, + &.MenuItem_header { + pointer-events: none; + color: var(--theme-color-text-base-caption-light); + } + + &.MenuItem_clickable { + cursor: pointer; + &:hover { + background: var(--theme-color-surface-base-base4); + color: var(--theme-color-text-base-text-dark); + } + } + + .icon:first-child:last-child { + flex: 1; + text-align: center; + } +} + +// ============================================================================= +// COMMON +// ============================================================================= +@each $size, $buttonPaddingAndGap, $itemPaddingAndGap in $sizes { + .#{$size} { + &.Root { + padding: var(--base-sizing-#{$buttonPaddingAndGap}); + gap: var(--base-sizing-#{$buttonPaddingAndGap}); + @include font("base", $size, "500"); + } + .MenuItem { + padding: var(--base-sizing-#{$itemPaddingAndGap}); + gap: var(--base-sizing-#{$itemPaddingAndGap}); + &.MenuItem_clickable { + @include font("body", $size); + } + &.MenuItem_header { + @include font("base", $size, "500"); + } + } + } +} diff --git a/src/lib/styles/tokens/compare/baseline/Dropdown/components/DropdownButton.tsx b/src/lib/styles/tokens/compare/baseline/Dropdown/components/DropdownButton.tsx new file mode 100644 index 00000000..3c548346 --- /dev/null +++ b/src/lib/styles/tokens/compare/baseline/Dropdown/components/DropdownButton.tsx @@ -0,0 +1,29 @@ +import styles from "../DropdownBaseline.module.scss"; +import GlobalIconWrapper from "../../../../../../components/Motif/GlobalIconWrapper/GlobalIconWrapper"; +import { MotifIcon } from "@/components/Motif/Icon"; +import { useContext } from "react"; +import type { CSSProperties, Ref } from "react"; +import type { IconGlobalType } from "../../../../../../types"; +import { DropdownContext } from "../context/DropdownContext"; + +type Props = { + label?: string; + icon?: IconGlobalType; + ref?: Ref; + className?: string; + style?: CSSProperties; +}; + +const DropdownButton = ({ label, icon, ref, className, style }: Props) => { + const { size, disabled } = useContext(DropdownContext); + + return ( + + ); +}; + +export default DropdownButton; diff --git a/src/lib/styles/tokens/compare/baseline/Dropdown/components/DropdownMenuItem.tsx b/src/lib/styles/tokens/compare/baseline/Dropdown/components/DropdownMenuItem.tsx new file mode 100644 index 00000000..98d3ee2e --- /dev/null +++ b/src/lib/styles/tokens/compare/baseline/Dropdown/components/DropdownMenuItem.tsx @@ -0,0 +1,37 @@ +import { DropdownMenuItemProps } from "../types"; +import styles from "../DropdownBaseline.module.scss"; +import GlobalIconWrapper from "../../../../../../components/Motif/GlobalIconWrapper/GlobalIconWrapper"; +import { MouseEvent, useContext } from "react"; +import { sanitizeModuleClasses } from "../../../../../../../utils/cssUtils"; +import { DropdownContext } from "../context/DropdownContext"; + +const DropdownMenuItem = (props: DropdownMenuItemProps) => { + const { label, header, icon, iconColor, disabled, action } = props; + const { size, hideMenu } = useContext(DropdownContext); + const classNames = sanitizeModuleClasses( + styles, + "MenuItem", + header ? "MenuItem_header" : "MenuItem_clickable", + disabled && "MenuItem_disabled", + ); + + const handleClick = (e: MouseEvent) => { + action?.(e); + hideMenu(); + }; + + return ( +
  • + + {header ?? ( + <> + {icon && } + {label && {label}} + + )} + +
  • + ); +}; + +export default DropdownMenuItem; diff --git a/src/lib/styles/tokens/compare/baseline/Dropdown/context/DropdownContext.tsx b/src/lib/styles/tokens/compare/baseline/Dropdown/context/DropdownContext.tsx new file mode 100644 index 00000000..d5fd86c3 --- /dev/null +++ b/src/lib/styles/tokens/compare/baseline/Dropdown/context/DropdownContext.tsx @@ -0,0 +1,4 @@ +import { createContext } from "react"; +import { dropdownContextDefaultValues, DropdownContextProps } from "../types"; + +export const DropdownContext = createContext(dropdownContextDefaultValues); diff --git a/src/lib/styles/tokens/compare/baseline/Dropdown/index.ts b/src/lib/styles/tokens/compare/baseline/Dropdown/index.ts new file mode 100644 index 00000000..4d208f48 --- /dev/null +++ b/src/lib/styles/tokens/compare/baseline/Dropdown/index.ts @@ -0,0 +1 @@ +export { default } from "./Dropdown"; diff --git a/src/lib/styles/tokens/compare/baseline/Dropdown/types.ts b/src/lib/styles/tokens/compare/baseline/Dropdown/types.ts new file mode 100644 index 00000000..c107818e --- /dev/null +++ b/src/lib/styles/tokens/compare/baseline/Dropdown/types.ts @@ -0,0 +1,54 @@ +import type { IconGlobalType } from "../../../../../types"; +import type { MouseEvent } from "react"; +import { OverlayRefProps, Size4SM, Variant } from "../../../../../types"; + +export type Spacing = "withGap" | "callout" | "noSpace"; + +export type DropdownProps = { + label?: string; + icon?: IconGlobalType; + disabled?: boolean; + /** + * ``` + * { + * label?: string; + * icon?: IconGlobalType; + * iconColor?: string; + * header?: string; + * action?: (event: MouseEvent) => void; + * disabled?: boolean; + * }[] + * ``` + */ + items: DropdownMenuItemProps[]; +} & OverlayRefProps & + DropdownDefaultableProps; + +export type DropdownDefaultableProps = { + shape?: "solid" | "textOnly"; + variant?: Variant; + size?: Size4SM; + pill?: boolean; + spacing?: Spacing; +}; + +export type DropdownMenuItemProps = { + label?: string; + icon?: IconGlobalType; + iconColor?: string; + header?: string; + action?: (event: MouseEvent) => void; + disabled?: boolean; +}; + +export type DropdownContextProps = { + size: Size4SM; + disabled?: boolean; + hideMenu: () => void; +}; + +export const dropdownContextDefaultValues: DropdownContextProps = { + size: "md", + disabled: false, + hideMenu: () => {}, +}; diff --git a/src/lib/styles/tokens/compare/baseline/Modal/Modal.tsx b/src/lib/styles/tokens/compare/baseline/Modal/Modal.tsx new file mode 100644 index 00000000..a31a6af7 --- /dev/null +++ b/src/lib/styles/tokens/compare/baseline/Modal/Modal.tsx @@ -0,0 +1,69 @@ +"use client"; + +import styles from "./ModalBaseline.module.scss"; +import ModalHeader from "./components/ModalHeader"; +import { PropsWithRef } from "../../../../../types"; +import ModalActions from "./components/ModalActions"; +import { useMemo } from "react"; +import { createPortal } from "react-dom"; +import useModalOverlay from "../../../../../hooks/useModalOverlay"; +import { ModalProps } from "./types"; +import { sanitizeModuleRootClasses } from "../../../../../../utils/cssUtils"; +import { mergeRefs } from "../../../../../../utils/reactUtils"; +import usePropsWithThemeDefaults from "../../../../../motif/hooks/usePropsWithThemeDefaults"; +import { MotifIconButton } from "@/components/Motif/Icon"; + +const Modal = (props: PropsWithRef) => { + const { + title, + subtitle, + open, + onClose, + onAfterClose, + children, + maximizable, + closable, + size = "md", + buttons, + actionButton, + alternateButton, + noContentPadding, + ref, + style, + className, + } = usePropsWithThemeDefaults("Modal", props); + + const { attached, visible, hide, rootRef, dialogRef, insideProps } = useModalOverlay({ + open: !!open, + onClose, + onAfterClose, + duration: 300, + closeOnOutsideClick: closable, + closeOnEscape: closable, + }); + const mergedRef = useMemo(() => mergeRefs(rootRef, ref), [rootRef, ref]); + + const classNames = sanitizeModuleRootClasses(styles, className, [ + visible && "show", + maximizable && "maximized", + noContentPadding && "noContentPadding", + size, + ]); + return ( + attached && + createPortal( +
    +
    + {closable && hide("closeButton")} size="xxl" className={styles.closeButton} />} + +
    {children}
    + +
    +
    , + document.body, + ) + ); +}; + +Modal.displayName = "Modal"; +export default Modal; diff --git a/src/lib/styles/tokens/compare/baseline/Modal/ModalBaseline.module.scss b/src/lib/styles/tokens/compare/baseline/Modal/ModalBaseline.module.scss new file mode 100644 index 00000000..a5e0776f --- /dev/null +++ b/src/lib/styles/tokens/compare/baseline/Modal/ModalBaseline.module.scss @@ -0,0 +1,141 @@ +@use "@styles" as *; + +$side-space: 4rem; +$sizes: ( + //sizeName, width + ("sm", "320x"), + ("md", "480x"), + ("lg", "720x"), + ("xl", "960x") +); + +.Root { + position: fixed; + inset: 0; + width: 100%; + height: 100%; + min-height: 100%; + background-color: var(--base-colors-black-black-overlay50); + display: flex; + z-index: 999; + @include fade-default; + + &.show { + @include fade-in; + } + + // Size classes at root level + @each $size, $width in $sizes { + &.#{$size} .modal { + width: var(--base-sizing-#{$width}); + } + } + + // Maximized class at root level + &.maximized .modal { + width: calc(100% - $side-space); + height: calc(100% - $side-space); + max-width: none; + max-height: none; + } +} + +.modal { + display: flex; + flex-direction: column; + position: fixed; + top: 50%; + left: 50%; + transform: translate(-50%, -50%); + background: white; + color: black; + border-radius: var(--theme-sizing-radius-default); + @include shadow(4); + height: auto; + max-width: calc(100% - $side-space); + max-height: 100%; + overflow: hidden; + transform-origin: left top; + @include pop-default; + + &:focus { + outline: none; + } +} + +.show .modal { + @include pop-in; +} + +.content { + padding: var(--base-sizing-16x); + min-height: var(--base-sizing-64x); + height: 100%; + overflow-y: auto; + + .noContentPadding & { + padding: 0; + } + + &::-webkit-scrollbar { + width: var(--base-sizing-8x); + } + + &::-webkit-scrollbar-track { + background: #f1f1f1; + margin: var(--base-sizing-1x) 0; + border-radius: var(--theme-sizing-radius-default); + } + + &::-webkit-scrollbar-thumb { + background: var(--base-colors-black-black-overlay25); + border-radius: var(--theme-sizing-radius-default); + } +} + +.closeButton { + position: absolute; + top: var(--base-sizing-16x); + right: var(--base-sizing-16x); +} + +// ============================================================================= +// Sub Component: Header +// ============================================================================= + +.header { + display: flex; + padding: var(--base-sizing-16x); + gap: var(--base-sizing-16x); + border-bottom: solid var(--base-sizing-1x) var(--theme-color-surface-base-base6); + align-items: flex-start; +} + +.headerContent { + flex: 1; + gap: var(--base-sizing-4x); + overflow-wrap: break-word; + + .headerTitle { + display: block; + color: var(--theme-color-text-base-title); + @include font("heading", "heading4"); + } + + .headerSubtitle { + display: block; + color: var(--theme-color-text-base-caption); + @include font("body", "lg"); + } +} + +// Modal Actions Styles +.actions { + display: flex; + flex-wrap: wrap; + padding: var(--base-sizing-16x); + gap: var(--base-sizing-16x); + justify-content: flex-end; + flex-shrink: 0; + border-top: solid var(--base-sizing-1x) var(--theme-color-surface-base-base6); +} diff --git a/src/lib/styles/tokens/compare/baseline/Modal/components/ModalActions.tsx b/src/lib/styles/tokens/compare/baseline/Modal/components/ModalActions.tsx new file mode 100644 index 00000000..7cab7dad --- /dev/null +++ b/src/lib/styles/tokens/compare/baseline/Modal/components/ModalActions.tsx @@ -0,0 +1,32 @@ +import type { MouseEvent } from "react"; +import { ReactElement } from "react"; +import Button from "../../../../../../components/Button/Button"; +import styles from "../ModalBaseline.module.scss"; +import { LinkProps } from "../../../../../../components/Link/types"; +import { ButtonProps } from "../../../../../../components/Button/types"; +import { IconButtonProps } from "../../../../../../components/IconButton/types"; + +type Props = { + actionButton?: { text: string; onClick: (event: MouseEvent) => void }; + alternateButton?: { text: string; onClick: (event: MouseEvent) => void }; + buttons?: ReactElement[]; +}; + +const ModalActions = (props: Props) => { + const { alternateButton, buttons, actionButton } = props; + const isVisible = actionButton || alternateButton || buttons?.length; + + return ( + isVisible && ( +
    + {actionButton &&
    + ) + ); +}; + +export default ModalActions; diff --git a/src/lib/styles/tokens/compare/baseline/Modal/components/ModalHeader.tsx b/src/lib/styles/tokens/compare/baseline/Modal/components/ModalHeader.tsx new file mode 100644 index 00000000..3f53778f --- /dev/null +++ b/src/lib/styles/tokens/compare/baseline/Modal/components/ModalHeader.tsx @@ -0,0 +1,25 @@ +import styles from "../ModalBaseline.module.scss"; + +export type HeaderProps = { + title?: string; + subtitle?: string; +}; + +const ModalHeader = (props: HeaderProps) => { + const { subtitle, title } = props; + + return ( + (title || subtitle) && ( +
    + {(title || subtitle) && ( +
    + {title && {title}} + {subtitle && {subtitle}} +
    + )} +
    + ) + ); +}; + +export default ModalHeader; diff --git a/src/lib/styles/tokens/compare/baseline/Modal/index.ts b/src/lib/styles/tokens/compare/baseline/Modal/index.ts new file mode 100644 index 00000000..09b91f72 --- /dev/null +++ b/src/lib/styles/tokens/compare/baseline/Modal/index.ts @@ -0,0 +1 @@ +export { default } from "./Modal"; diff --git a/src/lib/styles/tokens/compare/baseline/Modal/types.ts b/src/lib/styles/tokens/compare/baseline/Modal/types.ts new file mode 100644 index 00000000..3ce9bb23 --- /dev/null +++ b/src/lib/styles/tokens/compare/baseline/Modal/types.ts @@ -0,0 +1,24 @@ +import { ReactElement, ReactNode, MouseEvent } from "react"; +import { OverlayCloseReason, Size4LG } from "../../../../../types"; +import { LinkProps } from "../../../../../components/Link/types"; +import { ButtonProps } from "../../../../../components/Button/types"; +import { IconButtonProps } from "../../../../../components/IconButton/types"; + +export type ModalDefaultableProps = { + size?: Size4LG; + maximizable?: boolean; + closable?: boolean; +}; + +export type ModalProps = { + children: ReactNode; + title?: string; + subtitle?: string; + open?: boolean; + onClose?: (reason: OverlayCloseReason) => void; + onAfterClose?: () => void; + buttons?: ReactElement[]; + actionButton?: { text: string; onClick: (event: MouseEvent) => void }; + alternateButton?: { text: string; onClick: (event: MouseEvent) => void }; + noContentPadding?: boolean; +} & ModalDefaultableProps; diff --git a/src/lib/styles/tokens/compare/baseline/Toast/Toast.tsx b/src/lib/styles/tokens/compare/baseline/Toast/Toast.tsx new file mode 100644 index 00000000..9028c6c0 --- /dev/null +++ b/src/lib/styles/tokens/compare/baseline/Toast/Toast.tsx @@ -0,0 +1,87 @@ +"use client"; + +import { useCallback, useEffect, useMemo, useRef, useState } from "react"; +import styles from "./ToastBaseline.module.scss"; +import GlobalIconWrapper from "../../../../../components/Motif/GlobalIconWrapper/GlobalIconWrapper"; +import { MotifIconButton } from "@/components/Motif/Icon"; +import useTimeout from "../../../../../hooks/useTimeout"; +import { PropsWithRef } from "../../../../../types"; +import { ToastProps } from "./types"; +import { sanitizeModuleRootClasses } from "src/utils/cssUtils.ts"; +import ProgressBar from "@/components/ProgressBar"; + +const Toast = (props: PropsWithRef) => { + const { variant, title, content, duration, closable, icon, onDismiss, position, maxContentLength, ref, id, style, className } = props; + + const [dismissed, setDismissed] = useState(false); + const [closing, setClosing] = useState(false); + const closingTimeoutRef = useRef(null); + + const toastClasses = sanitizeModuleRootClasses(styles, className, [variant, closing && "closing"]); + + const handleDismiss = useCallback(() => { + setClosing(true); + closingTimeoutRef.current = setTimeout(() => { + setDismissed(true); + onDismiss?.(id, position); + }, 300); + }, [id, position, onDismiss]); + + const timer = useTimeout(handleDismiss, duration); + const [paused, setPaused] = useState(false); + + useEffect(() => { + if (duration !== undefined) timer.start(); + }, [duration, timer]); + + useEffect(() => { + return () => { + closingTimeoutRef.current && clearTimeout(closingTimeoutRef.current); + }; + }, []); + + const handleEnter = useCallback(() => { + timer.pause(); + setPaused(true); + }, [timer]); + + const handleLeave = useCallback(() => { + timer.start(); + setPaused(false); + }, [timer]); + + const handlers = useMemo( + () => + closable && { + onMouseEnter: handleEnter, + onMouseLeave: handleLeave, + onTouchStart: handleEnter, + onTouchEnd: handleLeave, + }, + [closable, handleEnter, handleLeave], + ); + + return ( + !dismissed && ( +
    + {icon && } + +
    + {title && {title}} + + {maxContentLength !== undefined && maxContentLength > 0 && maxContentLength < content.length + ? content.substring(0, maxContentLength).concat("...") + : content} + +
    + + {closable && } + + {duration !== undefined && } +
    + ) + ); +}; + +Toast.displayName = "Toast"; +export default Toast; diff --git a/src/lib/styles/tokens/compare/baseline/Toast/ToastBaseline.module.scss b/src/lib/styles/tokens/compare/baseline/Toast/ToastBaseline.module.scss new file mode 100644 index 00000000..bb665fa9 --- /dev/null +++ b/src/lib/styles/tokens/compare/baseline/Toast/ToastBaseline.module.scss @@ -0,0 +1,113 @@ +@use "@styles" as *; + +$color-types: (("secondary", "light"), ("warning", "warning"), ("success", "success"), ("danger", "danger"), ("info", "info")); +$positions: ( + // position, animationIn, animationOut, top, right, bottom, left, transform + ("top", slideInTop, slideOutTop, var(--base-sizing-16x), null, null, 50%, translateX(-50%)), + ("topRight", slideInRight, slideOutRight, var(--base-sizing-16x), var(--base-sizing-16x), null, null, null), + ("topLeft", slideInLeft, slideOutLeft, var(--base-sizing-16x), null, null, var(--base-sizing-16x), null), + ("bottom", slideInBottom, slideOutBottom, null, null, var(--base-sizing-16x), 50%, translateX(-50%)), + ("bottomRight", slideInRight, slideOutRight, null, var(--base-sizing-16x), var(--base-sizing-16x), null, null), + ("bottomLeft", slideInLeft, slideOutLeft, null, null, var(--base-sizing-16x), var(--base-sizing-16x), null) +); +$animation-keyframes: ( + // animation, transform0, transform100, opacity0, $opacity100 + ("slideInRight", translateX(100%), translateX(0%), 0, 1), + ("slideOutRight", translateX(0%), translateX(100%), 1, 0), + ("slideInLeft", translateX(-100%), translateX(0%), 0, 1), + ("slideOutLeft", translateX(0%), translateX(-100%), 1, 0), + ("slideInTop", translateY(-100%), translateY(0%), 0, 1), + ("slideOutTop", translateY(0%), translateY(-100%), 1, 0), + ("slideInBottom", translateY(100%), translateY(0%), 0, 1), + ("slideOutBottom", translateY(0%), translateY(100%), 1, 0) +); +@each $animation, $transformZero, $transformHundred, $opacityZero, $opacityHundred in $animation-keyframes { + @keyframes #{$animation} { + 0% { + opacity: $opacityZero; + transform: $transformZero; + } + 100% { + opacity: $opacityHundred; + transform: $transformHundred; + } + } +} + +.Root { + position: relative; + display: flex; + flex-wrap: nowrap; + @include width-or-width-below-screen-size(--theme-grid-breakpoint-sm, --base-sizing-256x, calc(100vw - var(--base-sizing-72x))); + padding: var(--base-sizing-10x) var(--base-sizing-20x); + gap: var(--base-sizing-10x); + border-radius: var(--theme-sizing-radius-default); + align-items: flex-start; + + .icon { + align-self: center; + } +} + +@each $color-type, $color in $color-types { + .#{$color-type} { + color: var(--theme-color-text-base-title); + background-color: var(--theme-color-surface-#{$color}-negative); + border-left-color: var(--theme-color-text-#{$color}-active); + + .title { + color: var(--theme-color-text-#{$color}-active); + } + } +} + +.contentContainer { + display: flex; + flex-direction: column; + gap: var(--base-sizing-4x); + flex-grow: 1; + max-height: 90vh; + overflow-y: scroll; + @include hidden-scrollbar; + + .content { + @include font("body", "md"); + } + .title { + @include font("base", "lg", "600"); + } +} + +.progress { + position: absolute; + bottom: 0; + left: 0; + width: 100%; +} + +.Container { + display: flex; + flex-direction: column-reverse; + row-gap: var(--base-sizing-12x); + position: fixed; + z-index: 5; + + @each $position, $animationIn, $animationOut, $top, $right, $bottom, $left, $transform in $positions { + &.#{$position} { + /* stylelint-disable declaration-block-no-redundant-longhand-properties */ + top: $top; + right: $right; + bottom: $bottom; + left: $left; + /* stylelint-enable declaration-block-no-redundant-longhand-properties */ + transform: $transform; + + .Root:not(.closing) { + animation: $animationIn 0.3s ease-in-out forwards; + } + .Root.closing { + animation: $animationOut 0.3s ease-in-out forwards; + } + } + } +} diff --git a/src/lib/styles/tokens/compare/baseline/Toast/types.ts b/src/lib/styles/tokens/compare/baseline/Toast/types.ts new file mode 100644 index 00000000..2ffa61c1 --- /dev/null +++ b/src/lib/styles/tokens/compare/baseline/Toast/types.ts @@ -0,0 +1,59 @@ +import type { IconGlobalType } from "../../../../../types"; +import { ReactElement } from "react"; +import { PropsWithRef } from "../../../../../types"; + +export type ToastPosition = "topLeft" | "topRight" | "top" | "bottomLeft" | "bottomRight" | "bottom"; + +export type ToastVariant = "secondary" | "danger" | "warning" | "info" | "success"; + +export type ToastProps = { + id: string; + onDismiss?: (id: string, position: ToastPosition) => void; + content: string; + variant: ToastVariant; + position: ToastPosition; + duration?: number; + closable?: boolean; + title?: string; + icon?: IconGlobalType; + maxContentLength?: number; +}; + +export type AddToastOptions = PropsWithRef; + +export type ToastDefaultableProps = { + title?: string; + position?: ToastPosition; + icon?: IconGlobalType; + duration?: number; + closable?: boolean; + maxContentLength?: number; +}; + +type AddToastType = (content: string, options?: AddToastOptions) => void; +export type UseToastProps = Record & { + toasts: ReactElement; +}; + +export type DeleteToastActionPayload = { id: string; position: ToastPosition }; + +export type AddToastActionType = { + type: string; + payload: PropsWithRef; +}; + +export type DeleteToastActionType = { + type: string; + payload: DeleteToastActionPayload; +}; + +export type ToastStateProps = { + toasts: { + topLeft?: ToastProps[]; + topRight?: ToastProps[]; + top?: ToastProps[]; + bottomLeft?: ToastProps[]; + bottomRight?: ToastProps[]; + bottom?: ToastProps[]; + }; +}; diff --git a/stylelint.config.mjs b/stylelint.config.mjs index a9090644..fc882a72 100644 --- a/stylelint.config.mjs +++ b/stylelint.config.mjs @@ -50,6 +50,7 @@ export default { "src/lib/components/Container/**/*.scss", "src/lib/components/DataView/**/*.scss", "src/lib/components/Divider/**/*.scss", + "src/lib/components/Dropdown/**/*.scss", "src/lib/components/Icon/**/*.scss", "src/lib/components/IconButton/**/*.scss", "src/lib/components/ImageView/**/*.scss", @@ -58,6 +59,7 @@ export default { "src/lib/components/InputText/**/*.scss", "src/lib/components/Link/**/*.scss", "src/lib/components/ListView/**/*.scss", + "src/lib/components/Modal/**/*.scss", "src/lib/components/Motif/InputText/**/*.scss", "src/lib/components/Pagination/**/*.scss", "src/lib/components/Panel/**/*.scss", @@ -73,6 +75,7 @@ export default { "src/lib/components/Text/**/*.scss", "src/lib/components/Textarea/**/*.scss", "src/lib/components/Timeline/**/*.scss", + "src/lib/components/Toast/**/*.scss", "src/lib/components/Tooltip/**/*.scss", ], rules: { From 8898023ed7b8f55a36f515510ab32d59191338de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mehmet=20Akta=C5=9F?= Date: Mon, 30 Nov 2026 14:34:51 +0300 Subject: [PATCH 4/7] fix(Dropdown, Toast): review fixes - Dropdown: a disabled button takes no pointer, so hover and active colors never reach it; drop the repeated textOnly disabled background - Toast: the icon takes its variant color from Icon; drop the repeated rule - Toast: new "toast" overlay layer above modal and anchored, so a toast is never behind a modal's backdrop - Toast test: variants typed as VariantV2[] --- src/lib/components/Dropdown/Dropdown.module.scss | 13 ++++++------- src/lib/components/Toast/Toast.module.scss | 6 +----- src/lib/components/Toast/Toast.test.tsx | 4 ++-- src/lib/styles/layers.scss | 4 +++- 4 files changed, 12 insertions(+), 15 deletions(-) diff --git a/src/lib/components/Dropdown/Dropdown.module.scss b/src/lib/components/Dropdown/Dropdown.module.scss index 45855484..18b5c904 100644 --- a/src/lib/components/Dropdown/Dropdown.module.scss +++ b/src/lib/components/Dropdown/Dropdown.module.scss @@ -59,8 +59,11 @@ $caret-center: clamp($caret-margin, calc(var(--overlay-anchor-right) - $caret-ma outline-offset: calc(-1 * var(--mtf-sizing-1)); @include transition(background-color color); - &:not(:disabled) { - cursor: pointer; + cursor: pointer; + + // Takes no pointer, so the variants' hover and active colors never reach a disabled button + &:disabled { + pointer-events: none; } &:focus-visible { @@ -129,7 +132,7 @@ $caret-center: clamp($caret-margin, calc(var(--overlay-anchor-right) - $caret-ma } } -// After the variant rules: same specificity, so disabled wins by order +// After the variant rules: same specificity as their rest colors, so disabled wins by order .solid, .textOnly { &:disabled { @@ -141,10 +144,6 @@ $caret-center: clamp($caret-margin, calc(var(--overlay-anchor-right) - $caret-ma background-color: var(--mtf-color-surface-disabled); } -.textOnly:disabled { - background-color: transparent; -} - // ============================================================================= // Dropdown Menu // ============================================================================= diff --git a/src/lib/components/Toast/Toast.module.scss b/src/lib/components/Toast/Toast.module.scss index 0ff8301b..1de7e9f5 100644 --- a/src/lib/components/Toast/Toast.module.scss +++ b/src/lib/components/Toast/Toast.module.scss @@ -65,10 +65,6 @@ $animation-keyframes: ( .title { color: var(--mtf-color-#{$variant}-text); } - - .icon { - color: var(--mtf-color-#{$variant}-solid); - } } } } @@ -108,7 +104,7 @@ $animation-keyframes: ( flex-direction: column-reverse; row-gap: var(--mtf-sizing-space-12); position: fixed; - z-index: 5; + z-index: z-layer("toast"); @each $position, $animationIn, $animationOut, $top, $right, $bottom, $left, $transform in $positions { &.#{$position} { diff --git a/src/lib/components/Toast/Toast.test.tsx b/src/lib/components/Toast/Toast.test.tsx index d4472d09..eb3c13ef 100644 --- a/src/lib/components/Toast/Toast.test.tsx +++ b/src/lib/components/Toast/Toast.test.tsx @@ -1,7 +1,7 @@ import "@testing-library/jest-dom"; import { fireEvent, render, screen, act } from "@testing-library/react"; import { runIconPropTest, runSnapshotDefaultsAndStandardPropsTest } from "../../../utils/testUtils"; -import { StandardPropsWithRef } from "../../../lib/types"; +import { StandardPropsWithRef, VariantV2 } from "../../../lib/types"; import { useToast } from "@/components/Toast/useToast"; import Toast from "@/components/Toast/Toast"; import { AddToastOptions, ToastVariant } from "@/components/Toast/types"; @@ -100,7 +100,7 @@ describe("Toast", () => { }); it("should be rendered in the variant given in the variant prop", () => { - const variants = ["neutral", "primary", "secondary", "accent", "info", "success", "warning", "danger"] as const; + const variants: VariantV2[] = ["neutral", "primary", "secondary", "accent", "info", "success", "warning", "danger"]; variants.forEach((variant, i) => { render(); diff --git a/src/lib/styles/layers.scss b/src/lib/styles/layers.scss index 08637f8f..c7ae38c3 100644 --- a/src/lib/styles/layers.scss +++ b/src/lib/styles/layers.scss @@ -2,10 +2,12 @@ // Stacking order of the elements rendered on top of the page (in a portal at the end of document.body). // "anchored" is above "modal", so an anchored overlay (Popover, picker) opened in a modal is shown over it. +// "toast" is above both: a notification is never covered by a modal's backdrop or an open overlay. // Modal, AlertModal and Tooltip still use these values literally and will use this map when they move to the overlay hooks. $overlay-layers: ( "modal": 999, - "anchored": 1000 + "anchored": 1000, + "toast": 1001 ); @function z-layer($name) { From 7e70210c4b6bd09cd83350473d239b3d0d8d45db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mehmet=20Akta=C5=9F?= Date: Mon, 30 Nov 2026 14:41:03 +0300 Subject: [PATCH 5/7] test(Dropdown): both variant defaults in assertDefaults --- src/lib/components/Dropdown/test/Dropdown.test.tsx | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/lib/components/Dropdown/test/Dropdown.test.tsx b/src/lib/components/Dropdown/test/Dropdown.test.tsx index 94cc795e..b81e7041 100644 --- a/src/lib/components/Dropdown/test/Dropdown.test.tsx +++ b/src/lib/components/Dropdown/test/Dropdown.test.tsx @@ -11,8 +11,8 @@ describe("Dropdown", () => { runSnapshotDefaultsAndStandardPropsTest( (props: StandardPropsWithRef) => render(), { - assertDefaults: ({ container, getByText }) => { - // variant: primary (solid only) + assertDefaults: ({ container, getByText, rerender }) => { + // variant: primary (shape solid) expect(container.firstElementChild).toHaveClass("primary"); // shape: solid expect(container.firstElementChild).toHaveClass("solid"); @@ -22,6 +22,10 @@ describe("Dropdown", () => { // spacing: callout fireEvent.click(getByText("Dropdown")); expect(screen.getByTestId("dropdown-menu")).toHaveClass("callout"); + + // variant: neutral (shape textOnly) + rerender(); + expect(container.firstElementChild).toHaveClass("neutral"); }, }, ); @@ -164,8 +168,6 @@ describe("Dropdown", () => { expect(container.firstElementChild).toHaveClass("solid"); rerender(); expect(container.firstElementChild).toHaveClass("textOnly"); - // textOnly without a variant is neutral - expect(container.firstElementChild).toHaveClass("neutral"); }); it("should add the given variant class to textOnly", () => { From a517f70c47819a639c082ebbfc216842a1550f53 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mehmet=20Akta=C5=9F?= Date: Mon, 30 Nov 2026 16:34:25 +0300 Subject: [PATCH 6/7] fix(DateRangePicker): the days dropdown keeps its light gray (neutral) --- .../DateRangePicker/__snapshots__/DateRangePicker.test.tsx.snap | 2 +- src/lib/components/DateRangePicker/components/DaysDropdown.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib/components/DateRangePicker/__snapshots__/DateRangePicker.test.tsx.snap b/src/lib/components/DateRangePicker/__snapshots__/DateRangePicker.test.tsx.snap index f0d048ce..f79a41cf 100644 --- a/src/lib/components/DateRangePicker/__snapshots__/DateRangePicker.test.tsx.snap +++ b/src/lib/components/DateRangePicker/__snapshots__/DateRangePicker.test.tsx.snap @@ -13,7 +13,7 @@ exports[`DateRangePicker should render with only required props, have default pr class="selectionBar" >