Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/jpmorganchase/salt-ds into …
Browse files Browse the repository at this point in the history
…combobox-secondary-label
  • Loading branch information
ThusharaJ07 committed May 9, 2024
2 parents d70534c + 318515c commit 87304af
Show file tree
Hide file tree
Showing 33 changed files with 717 additions and 287 deletions.
5 changes: 5 additions & 0 deletions .changeset/fast-snakes-know.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@salt-ds/core": patch
---

Changed RadioButton's display to `inline-flex` so the hit area only covers the label.
5 changes: 5 additions & 0 deletions .changeset/heavy-geckos-scream.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@salt-ds/ag-grid-theme": patch
---

Fixed header background incorrectly referencing palette color (`--salt-container-primary-background`) instead of characterstics (`--salt-container-primary-background`)
5 changes: 5 additions & 0 deletions .changeset/violet-dingos-hammer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@salt-ds/core": patch
---

Fixed `Tooltip` not displaying when the `content` prop value is falsy e.g. 0
5 changes: 5 additions & 0 deletions .changeset/violet-tomatoes-enjoy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@salt-ds/core": patch
---

Changed Checkbox's display to `inline-flex` so the hit area only covers the label.
508 changes: 254 additions & 254 deletions .yarn/releases/yarn-4.2.1.cjs → .yarn/releases/yarn-4.2.2.cjs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion .yarnrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ nodeLinker: node-modules

npmRegistryServer: "https://registry.yarnpkg.com"

yarnPath: .yarn/releases/yarn-4.2.1.cjs
yarnPath: .yarn/releases/yarn-4.2.2.cjs
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@
"last 1 safari version"
]
},
"packageManager": "[email protected].1",
"packageManager": "[email protected].2",
"msw": {
"workerDirectory": "docs/public"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
$salt-ag-theme-default-params: (
row-hover-color: var(--agGrid-row-color-hover),
row-border-color: var(--agGrid-row-borderColor),
header-background-color: var(--salt-palette-neutral-primary-background),
header-background-color: var(--salt-container-primary-background),
header-column-separator: true,
header-column-separator-width: 1px,
header-column-separator-color: var(--agGrid-header-column-separator-color),
Expand Down
14 changes: 14 additions & 0 deletions packages/core/src/__tests__/__e2e__/tooltip/Tooltip.cy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,20 @@ describe("GIVEN a Tooltip", () => {
});
});

describe("WHEN content is undefined", () => {
it("then tooltip doesn't display", () => {
cy.mount(<Open content={undefined} />);
cy.findByRole("tooltip").should("not.exist");
});
});

describe("WHEN content is falsy", () => {
it("then tooltip should still display", () => {
cy.mount(<Open content={0} />);
cy.findByRole("tooltip").should("exist");
});
});

describe("WHEN used in header tag", () => {
it("then tooltip displays default font weight and size", () => {
cy.mount(
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/checkbox/Checkbox.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* Styles applied to root component */
.saltCheckbox {
display: flex;
display: inline-flex;
gap: var(--salt-spacing-100);
position: relative;
cursor: var(--salt-selectable-cursor-hover);
Expand Down
2 changes: 2 additions & 0 deletions packages/core/src/link/Link.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export const Link = forwardRef<HTMLAnchorElement, LinkProps>(function Link(
className,
children,
variant = "primary",
color = "primary",
target = "_self",
...rest
},
Expand All @@ -47,6 +48,7 @@ export const Link = forwardRef<HTMLAnchorElement, LinkProps>(function Link(
ref={ref}
target={target}
variant={variant}
color={color}
{...rest}
>
{children}
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/radio-button/RadioButton.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* Styles applied to RadioButton container */
.saltRadioButton {
display: flex;
display: inline-flex;
gap: var(--salt-spacing-100);
cursor: var(--salt-selectable-cursor-hover);
position: relative;
Expand Down
4 changes: 4 additions & 0 deletions packages/core/src/text/Text.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
.saltText {
--text-color: currentColor;
}

/* Main css class. Style for body text */
.saltText {
color: var(--saltText-color, var(--text-color));
Expand Down
16 changes: 12 additions & 4 deletions packages/core/src/text/Text.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,13 @@ export type TextProps<T extends ElementType> = PolymorphicComponentPropWithRef<
| "code";
/**
* Change text color palette
* @deprecated Use `color` instead
*/
variant?: "primary" | "secondary";
/*
* The color of the text. Defaults to "primary".
*/
color?: "inherit" | "primary" | "secondary";
}
>;

Expand All @@ -59,7 +64,8 @@ export const Text: TextComponent = forwardRef(
maxRows,
style,
styleAs,
variant = "primary",
variant,
color: colorProp,
...restProps
}: TextProps<T>,
ref?: PolymorphicRef<T>
Expand All @@ -71,19 +77,21 @@ export const Text: TextComponent = forwardRef(
window: targetWindow,
});

const Component = as || "div";
const Component = as ?? "div";

const textStyles = { "--text-max-rows": maxRows, ...style };

const color = variant ?? colorProp ?? "primary";

return (
<Component
className={clsx(
withBaseName(),
{
[withBaseName("disabled")]: disabled,
[withBaseName("lineClamp")]: maxRows,
[withBaseName(styleAs || "")]: styleAs,
[withBaseName(variant)]: variant,
[withBaseName(styleAs as string)]: styleAs,
[withBaseName(color)]: color !== "inherit",
},
className
)}
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/tooltip/Tooltip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ export const Tooltip = forwardRef<HTMLDivElement, TooltipProps>(
);

const floatingRef = useForkRef<HTMLDivElement>(floating, ref);
const hasContent = !!content;
const hasContent = content != undefined && content !== "";

return (
<>
Expand Down
12 changes: 6 additions & 6 deletions packages/core/stories/link/link.qa.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ export const AllVariantsGrid: StoryFn<QAContainerProps> = (props) => (
<strong>Strong</strong> and <small>small</small> truncation example
</Link>
</div>
<Link href="https://www.google.com" variant="secondary">
<Link href="https://www.google.com" color="secondary">
Secondary Link
</Link>
<Link href="https://www.google.com" variant="secondary" target="_blank">
<Link href="https://www.google.com" color="secondary" target="_blank">
Secondary Link target blank
</Link>
<div style={{ width: 150 }}>
<Link href="https://www.google.com" maxRows={1} variant="secondary">
<Link href="https://www.google.com" maxRows={1} color="secondary">
<strong>Strong</strong> and <small>small</small> truncation example
</Link>
</div>
Expand All @@ -54,14 +54,14 @@ export const NoStyleInjectionGrid: StoryFn<QAContainerNoStyleInjectionProps> = (
<strong>Strong</strong> and <small>small</small> truncation example
</Link>
</div>
<Link href="https://www.google.com" variant="secondary">
<Link href="https://www.google.com" color="secondary">
Secondary Link
</Link>
<Link href="https://www.google.com" variant="secondary" target="_blank">
<Link href="https://www.google.com" color="secondary" target="_blank">
Secondary Link target blank
</Link>
<div style={{ width: 150 }}>
<Link href="https://www.google.com" maxRows={1} variant="secondary">
<Link href="https://www.google.com" maxRows={1} color="secondary">
<strong>Strong</strong> and <small>small</small> truncation example
</Link>
</div>
Expand Down
10 changes: 9 additions & 1 deletion packages/core/stories/link/link.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,15 @@ export const Primary: StoryFn<typeof Link> = () => {

export const Secondary: StoryFn<typeof Link> = () => {
return (
<Link variant="secondary" href="https://www.google.com">
<Link color="secondary" href="https://www.google.com">
Link to URL
</Link>
);
};

export const InheritColor: StoryFn<typeof Link> = () => {
return (
<Link color="inherit" href="https://www.google.com">
Link to URL
</Link>
);
Expand Down
Loading

0 comments on commit 87304af

Please sign in to comment.