Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ export class DarkModeTheme implements ColorModeTheme {
bgNeutralSubtle: this.bgNeutralSubtle.to("sRGB").toString(),
bgNeutralSubtleHover: this.bgNeutralSubtleHover.to("sRGB").toString(),
bgNeutralSubtleActive: this.bgNeutralSubtleActive.to("sRGB").toString(),
bgNeutralSoft: this.bgNeutralSoft.to("sRGB").toString(),
bgNeutralSoftHover: this.bgNeutralSoftHover.to("sRGB").toString(),
bgNeutralSoftActive: this.bgNeutralSoftActive.to("sRGB").toString(),
bgPositive: this.bgPositive.to("sRGB").toString(),
bgPositiveHover: this.bgPositiveHover.to("sRGB").toString(),
bgPositiveActive: this.bgPositiveActive.to("sRGB").toString(),
Expand Down Expand Up @@ -434,6 +437,30 @@ export class DarkModeTheme implements ColorModeTheme {
return color;
}

private get bgNeutralSoft() {
const color = this.bgNeutralSubtle.clone();

color.oklch.l -= 0.03;

return color;
}

private get bgNeutralSoftHover() {
const color = this.bgNeutralSoft.clone();

color.oklch.l += 0.01;

return color;
}

private get bgNeutralSoftActive() {
const color = this.bgNeutralSoft.clone();

color.oklch.l -= 0.01;

return color;
}

private get bgPositive() {
// Positive background, green.
const color = new Color("oklch", [0.62, 0.17, 145]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ export class LightModeTheme implements ColorModeTheme {
bgNeutralSubtle: this.bgNeutralSubtle.to("sRGB").toString(),
bgNeutralSubtleHover: this.bgNeutralSubtleHover.to("sRGB").toString(),
bgNeutralSubtleActive: this.bgNeutralSubtleActive.to("sRGB").toString(),
bgNeutralSoft: this.bgNeutralSoft.to("sRGB").toString(),
bgNeutralSoftHover: this.bgNeutralSoftHover.to("sRGB").toString(),
bgNeutralSoftActive: this.bgNeutralSoftActive.to("sRGB").toString(),
bgPositive: this.bgPositive.to("sRGB").toString(),
bgPositiveHover: this.bgPositiveHover.to("sRGB").toString(),
bgPositiveActive: this.bgPositiveActive.to("sRGB").toString(),
Expand Down Expand Up @@ -426,6 +429,30 @@ export class LightModeTheme implements ColorModeTheme {
return color;
}

private get bgNeutralSoft() {
const color = this.bgNeutralSubtle.clone();

color.oklch.l -= 0.03;

return color;
}

private get bgNeutralSoftHover() {
const color = this.bgNeutralSoft.clone();

color.oklch.l += 0.01;

return color;
}

private get bgNeutralSoftActive() {
const color = this.bgNeutralSoft.clone();

color.oklch.l -= 0.01;

return color;
}

private get bgPositive() {
// Positive background, green.
const color = new Color("oklch", [0.62, 0.19, 145]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,36 @@
background: var(--color-bg-$(color)-subtle-active);
}
}

&[data-variant="subtle"][data-color="$(color)"] {
background-color: var(--color-bg-$(color)-subtle);
color: var(--color-fg-$(color));

&[data-hovered]:not([data-loading]) {
background-color: var(--color-bg-$(color)-subtle-hover);
}

&[data-pressed]:not([data-loading]) {
background-color: var(--color-bg-$(color)-subtle-active);
}
}
}

/*
This is a special case for the "neutral" color for "subtle" variant. The subtle color is lighter than required.
So we added the soft token for neutral color which is little more darker than the subtle color tokens.
*/
&[data-variant="subtle"][data-color="neutral"] {
background-color: var(--color-bg-neutral-soft);
color: var(--color-fg-neutral);

&[data-hovered]:not([data-loading]) {
background-color: var(--color-bg-neutral-soft-hover);
}

&[data-pressed]:not([data-loading]) {
background-color: var(--color-bg-neutral-soft-active);
}
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import type { COLORS, SIZES } from "../../../shared";
export const BUTTON_VARIANTS = {
filled: "Filled",
outlined: "Outlined",
subtle: "Subtle",
ghost: "Ghost",
} as const;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import type {
import type { ReactNode } from "react";
import type { COLORS } from "../../../shared";

export interface TextProps extends React.HTMLAttributes<HTMLElement> {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder why this was removed? This change will not allow to pass standard html attributes to Text

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So what was happening was initially when creating markdown components for paragraphs, I was using ...props and passing it to our Text which resulted in type conflicts as props of paragraph were HTMLParagraphElement and our Text couldn't accept those props. So I added the above code to fix it. But later I removed ...props part. So not required anymore.

Having the above causes issues in storybook. It shows all props of HTMLelement in the docs. 🫠

CleanShot 2024-10-16 at 14 11 00

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it, thanks. I still believe that ability to pass standard html attributes to any components is required (do you agree?). I'm sure that mentioned issues can be fixed, but don't think we have time for it. So it is up to you, feel free to resolve the thread 👍

export interface TextProps {
/** size variant of the text
* @default body
*/
Expand Down