Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] json for theme 2.0 #3143

Closed
wants to merge 50 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
2d37cb1
[Theme next] Adds unified color palette
origami-z Apr 15, 2024
83810e1
Add some doc
origami-z Apr 15, 2024
b9b9edb
changeset
origami-z Apr 15, 2024
d1d328c
adds selectable-next, rename background-none
origami-z Apr 16, 2024
02794c1
Fix fade variable reference
origami-z Apr 16, 2024
bdc396a
Add editable next
origami-z Apr 16, 2024
42cc7d7
Add rest of characteristics
origami-z Apr 17, 2024
8382164
Update changeset
origami-z Apr 17, 2024
884508a
Update to include more examples, fix ag grid in
origami-z May 3, 2024
aa37643
Revert ag grid theme change
origami-z May 6, 2024
23dee89
- Update to r6 hex values
origami-z May 6, 2024
4555555
Adds accent action disabled
origami-z May 6, 2024
0927c46
Update status mapping to 500
origami-z May 6, 2024
06c9a87
Update button colors again
origami-z May 7, 2024
968b443
Fix build
origami-z May 7, 2024
f24bfc8
Update color to r8
origami-z May 10, 2024
6bb3ff4
Fix button to match Figma better
origami-z May 10, 2024
f929b75
Update button color mapping to meet contrast
origami-z May 13, 2024
1066346
[Theme next] Adds unified color palette
origami-z Apr 15, 2024
56e1166
foundations and palette
libertymayc Mar 8, 2024
5bf88fd
update to use brackets and aliass
libertymayc Mar 11, 2024
ade7d7b
use groupings
libertymayc Mar 11, 2024
51cd6a3
include density and mode in json
libertymayc Mar 12, 2024
fc30e4a
parse back to css
libertymayc Mar 13, 2024
cb81dcd
restructure for snapshot
libertymayc Mar 14, 2024
f0a9f72
changeset
libertymayc Mar 14, 2024
d34ae3e
export in .js and experiment with main tag
libertymayc Mar 14, 2024
bc90b09
rm gitignore file
libertymayc Mar 14, 2024
323bff2
add path to build
libertymayc Mar 14, 2024
0fbe875
add path to build
libertymayc Mar 14, 2024
708506b
change build
libertymayc Mar 14, 2024
2d21ba9
change build
libertymayc Mar 15, 2024
4dac4f0
change build
libertymayc Mar 15, 2024
2b29722
change build
libertymayc Mar 15, 2024
55d5fb8
change build
libertymayc Mar 15, 2024
50f07db
add characteristics
libertymayc Mar 18, 2024
c6fbfeb
fix glitches
libertymayc Mar 19, 2024
a1726b7
fix foundations
libertymayc Mar 19, 2024
6fa2a03
rm
libertymayc Mar 20, 2024
5fe0e70
fix typography
libertymayc Mar 20, 2024
db67871
Pull theme from color-palette-next branch
libertymayc Mar 19, 2024
36a57b5
file
libertymayc Mar 19, 2024
f3ab071
pause
libertymayc Mar 19, 2024
c562047
theme 2.0
libertymayc Mar 19, 2024
95122e2
updates based on unified-color-palette branch
libertymayc May 16, 2024
14590b0
fix
libertymayc May 17, 2024
8fd8f1c
include fonts and corners from new theme
libertymayc May 17, 2024
8f6bd3c
undo gitignore
libertymayc May 17, 2024
d93d47c
undo delete theme-next.css
libertymayc May 17, 2024
2bb83c3
change to only include -next files from characteristics and palette d…
libertymayc May 17, 2024
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
5 changes: 5 additions & 0 deletions .changeset/early-radios-sell.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@salt-ds/theme": patch
---

[Theme next] Adds unified color palette
5 changes: 5 additions & 0 deletions .changeset/ninety-pumpkins-shake.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@salt-ds/theme": minor
---

Expose JSON theme
7 changes: 7 additions & 0 deletions .changeset/strong-parents-march.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"@salt-ds/theme": minor
---

Switched to use new color palette in theme next when using `UNSTABLE_SaltProviderNext`.

Refer to [documentation](https://storybook.saltdesignsystem.com/?path=/docs/experimental-theme-next--docs) for more information.
6 changes: 3 additions & 3 deletions packages/ag-grid-theme/stories/examples/HDCompact.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { SaltProvider } from "@salt-ds/core";
import { UNSTABLE_SaltProviderNext } from "@salt-ds/core";
import { AgGridReact, AgGridReactProps } from "ag-grid-react";
import { useAgGridThemeSwitcher } from "../dependencies/ThemeSwitcher";
import dataGridExampleColumns from "../dependencies/dataGridExampleColumns";
Expand Down Expand Up @@ -26,7 +26,7 @@ const HDCompact = (props: AgGridReactProps) => {
});

return (
<SaltProvider density="high">
<UNSTABLE_SaltProviderNext density="high">
<div {...containerProps}>
<AgGridReact
columnDefs={dataGridExampleColumns}
Expand All @@ -47,7 +47,7 @@ const HDCompact = (props: AgGridReactProps) => {
}}
/>
</div>
</SaltProvider>
</UNSTABLE_SaltProviderNext>
);
};

Expand Down
17 changes: 12 additions & 5 deletions packages/core/stories/form-field/form-field.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -376,11 +376,18 @@ export const MultipleChildren: StoryFn<typeof FormField> = (props) => {

export const Readonly: StoryFn<typeof FormField> = (props) => {
return (
<FormField style={{ width: "366px" }} readOnly {...props}>
<FormLabel>Readonly Form Field</FormLabel>
<Input defaultValue="Primary Input value" />
<FormHelperText>This Form Field is readonly</FormHelperText>
</FormField>
<StackLayout>
<FormField style={{ width: "366px" }} readOnly {...props}>
<FormLabel>Readonly Form Field</FormLabel>
<Input defaultValue="Primary Input value" />
<FormHelperText>This Form Field is readonly</FormHelperText>
</FormField>
<FormField style={{ width: "366px" }} readOnly {...props}>
<FormLabel>Readonly multiline input</FormLabel>
<MultilineInput defaultValue="Input value" />
<FormHelperText>This Form Field is readonly</FormHelperText>
</FormField>
</StackLayout>
);
};

Expand Down
32 changes: 32 additions & 0 deletions packages/core/stories/salt-provider/salt-provider-next.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -131,3 +131,35 @@ You'll need to install Amplitude font to your application to make sure every use
src: url("PATH/TO/FONT.woff2") format("woff2");
}
```

## Unified Color Palette

A completely new color palette is used with balanced color ramps for each color group.

You will find 9 colors in each color group, which makes sure middle point (500 colors) will achieve
at least 4.5 contrast ratio against both light and dark primary background. Primary and secondary
background colors are no longer picked from the color ramps, but rather from additional foundation
colors (snow & marble in light, jet & granite in dark).

Refer to Figma file ([UNSTABLE Salt Colors (variables)](<https://www.figma.com/file/e753bB0n5Adc0LCXqtvslu/UNSTABLE-Salt-Colors-(variables)?type=design&node-id=424%3A77224&mode=design&t=1snosiQ76rKnIe9d-1>))
for color values and mappings.

Migration note: If you're referring any Salt foundation colors (i.e. `--salt-color-*`) directly in your code,
you'll need to revisit those values. We do not recommend directly consume foundation colors directly, instead
try to find a characteristics color instead which will work better in different modes.

## New Theme Palette Structure

A new structure of palette layer is introduced to help making color changes easier for custom themes, namely

- Accent
- Background
- Foreground
- Neutral
- Info
- Negative
- Positive
- Warning

All existing characteristics are re-wired through above new palette layers to use the new colors,
which is scoped to `.salt-theme-next`.
53 changes: 50 additions & 3 deletions packages/lab/stories/kitchen-sink/kitchen-sink.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import {
SaltShakerIcon,
SaltShakerSolidIcon,
} from "@salt-ds/icons";
import { ListNext, ListItemNext } from "@salt-ds/lab";
import {
DefaultGroup as AccordionDefault,
Status as AccordionStatus,
Expand Down Expand Up @@ -58,7 +59,13 @@ import {
Error as ToastError,
Warning as ToastWarning,
} from "../../../core/stories/toast/toast.stories";
import { WithValidation as FormFieldValidation } from "../../../core/stories/form-field/form-field.stories";
import {
WithValidation as FormFieldValidation,
WithMultilineInputAsQuestion,
HelperText as FormFieldHelperText,
Readonly as FormFieldReadonly,
} from "../../../core/stories/form-field/form-field.stories";
import { Default as SegmentedButtonGroupDefault } from "../../../core/stories/segmented-button-group/segmented-button-group.stories";
import {
Default as PillDefault,
Disabled as PillDisabled,
Expand All @@ -67,8 +74,13 @@ import {
} from "../../../core/stories/pill/pill.stories";
import { Default as OverlayDefault } from "../../../core/stories/overlay/overlay.stories";
import AgGridThemeDefault from "../../../ag-grid-theme/stories/examples/Default";
import AgGridThemeZebra from "../../../ag-grid-theme/stories/examples/VariantZebra";
import AgGridThemeHDCompact from "../../../ag-grid-theme/stories/examples/HDCompact";

import "ag-grid-community/dist/styles/ag-grid.css";
import "ag-grid-community/dist/styles/ag-theme-material.css";
import "../../../../dist/salt-ds-ag-grid-theme/salt-ag-theme.css";

export default {
title: "Experimental/Kitchen Sink",
};
Expand Down Expand Up @@ -224,7 +236,18 @@ export const Example1 = () => {
</StackLayout>
<StackLayout direction="row">
<ButtonExamples />
<Button disabled>Submit</Button>
<Button variant="cta" disabled>
CTA
</Button>
<Button variant="primary" disabled>
Primary
</Button>
<Button variant="secondary" disabled>
Secondary
</Button>
</StackLayout>
<StackLayout direction="row">
<SegmentedButtonGroupDefault />
</StackLayout>
<StackLayout direction="row">
<ToggleButtonGroupHorizontalText defaultValue="high" />
Expand Down Expand Up @@ -272,7 +295,10 @@ export const Example1 = () => {
<SwitchDefault label="Switch" disabled />
<SwitchDefault label="Switch" disabled defaultChecked />
</StackLayout>
<StackLayout direction="row" gap={20} style={{ marginBlock: 60 }}>
<StackLayout direction="row" gap={16} style={{ marginBlock: 60 }}>
<Tooltip content="I am a tooltip" open placement="bottom">
<Button>Info</Button>
</Tooltip>
<Tooltip content="I am a tooltip" status="info" open placement="bottom">
<Button>Info</Button>
</Tooltip>
Expand Down Expand Up @@ -319,6 +345,25 @@ export const Example1 = () => {
</StackLayout>
<StackLayout direction="row">
<FormFieldValidation />
<StackLayout>
<FormFieldHelperText />
<FlexItem>
<WithMultilineInputAsQuestion />
</FlexItem>
</StackLayout>
<StackLayout>
<FormFieldReadonly />
</StackLayout>
</StackLayout>
<StackLayout>
<ListNext selected="blue">
<ListItemNext value="green">Green</ListItemNext>
<ListItemNext disabled value="red">
Red
</ListItemNext>
<ListItemNext value="blue">Blue</ListItemNext>
<ListItemNext value="purple">Purple</ListItemNext>
</ListNext>
</StackLayout>
<AgGridThemeDefault
columnDefs={[
Expand All @@ -344,6 +389,8 @@ export const Example1 = () => {
},
]}
/>
<H3>Zebra</H3>
<AgGridThemeZebra />
<H3>HD Compact</H3>
<AgGridThemeHDCompact
columnDefs={[
Expand Down
5 changes: 5 additions & 0 deletions packages/theme/css/characteristics/accent-next.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.salt-theme.salt-theme-next {
--salt-accent-background: var(--salt-palette-accent);
--salt-accent-borderColor: var(--salt-palette-accent);
--salt-accent-foreground: var(--salt-palette-foreground-primary-alt);
}
29 changes: 29 additions & 0 deletions packages/theme/css/characteristics/actionable-next.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
.salt-theme.salt-theme-next {
/* CTA variant */
--salt-actionable-cta-foreground: var(--salt-palette-foreground-primary-alt);
--salt-actionable-cta-foreground-hover: var(--salt-palette-foreground-invert);
--salt-actionable-cta-foreground-active: var(--salt-palette-foreground-invert);
--salt-actionable-cta-foreground-disabled: var(--salt-palette-foreground-primary-alt-disabled);
--salt-actionable-cta-background: var(--salt-palette-accent);
--salt-actionable-cta-background-hover: var(--salt-palette-accent-strong);
--salt-actionable-cta-background-active: var(--salt-palette-accent-stronger);
--salt-actionable-cta-background-disabled: var(--salt-palette-accent-disabled);
/* Primary variant */
--salt-actionable-primary-foreground: var(--salt-palette-foreground-primary-alt);
--salt-actionable-primary-foreground-hover: var(--salt-palette-foreground-invert);
--salt-actionable-primary-foreground-active: var(--salt-palette-foreground-invert);
--salt-actionable-primary-foreground-disabled: var(--salt-palette-foreground-primary-alt-disabled);
--salt-actionable-primary-background: var(--salt-palette-neutral);
--salt-actionable-primary-background-hover: var(--salt-palette-neutral-strong);
--salt-actionable-primary-background-active: var(--salt-palette-neutral-stronger);
--salt-actionable-primary-background-disabled: var(--salt-palette-neutral-strong-disabled);
/* Secondary variant */
--salt-actionable-secondary-foreground: var(--salt-palette-foreground-primary);
--salt-actionable-secondary-foreground-hover: var(--salt-palette-foreground-invert);
--salt-actionable-secondary-foreground-active: var(--salt-palette-foreground-invert);
--salt-actionable-secondary-foreground-disabled: var(--salt-palette-foreground-primary-disabled);
--salt-actionable-secondary-background: var(--salt-palette-background-none);
--salt-actionable-secondary-background-hover: var(--salt-palette-neutral-strong);
--salt-actionable-secondary-background-active: var(--salt-palette-neutral-stronger);
--salt-actionable-secondary-background-disabled: var(--salt-palette-background-none);
}
14 changes: 14 additions & 0 deletions packages/theme/css/characteristics/container-next.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
.salt-theme.salt-theme-next {
--salt-container-primary-background: var(--salt-palette-background-primary);
--salt-container-primary-background-disabled: var(--salt-palette-background-primary-disabled);
--salt-container-primary-borderColor: var(--salt-palette-neutral-weaker);
--salt-container-primary-borderColor-disabled: var(--salt-palette-neutral-weaker-disabled);

--salt-container-secondary-background: var(--salt-palette-background-secondary);
--salt-container-secondary-background-disabled: var(--salt-palette-background-secondary-disabled);
--salt-container-secondary-borderColor: var(--salt-palette-neutral-weaker);
--salt-container-secondary-borderColor-disabled: var(--salt-palette-neutral-weaker-disabled);

--salt-container-tertiary-background: var(--salt-palette-background-tertiary);
--salt-container-tertiary-background-disabled: var(--salt-palette-background-tertiary-disabled);
}
11 changes: 11 additions & 0 deletions packages/theme/css/characteristics/content-next.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
.salt-theme.salt-theme-next {
--salt-content-primary-foreground: var(--salt-palette-foreground-primary);
--salt-content-primary-foreground-disabled: var(--salt-palette-foreground-primary-disabled);
--salt-content-secondary-foreground: var(--salt-palette-foreground-secondary);
--salt-content-secondary-foreground-disabled: var(--salt-palette-foreground-secondary-disabled);

--salt-content-foreground-hover: var(--salt-palette-foreground-hover);
--salt-content-foreground-active: var(--salt-palette-foreground-active);
--salt-content-foreground-visited: var(--salt-palette-foreground-visited);
--salt-content-foreground-highlight: var(--salt-palette-accent-weaker);
}
19 changes: 19 additions & 0 deletions packages/theme/css/characteristics/editable-next.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
.salt-theme.salt-theme-next {
--salt-editable-borderColor: var(--salt-palette-neutral);
--salt-editable-borderColor-active: var(--salt-palette-accent-stronger);
--salt-editable-borderColor-disabled: var(--salt-palette-neutral-disabled);
--salt-editable-borderColor-hover: var(--salt-palette-accent);
--salt-editable-borderColor-readonly: var(--salt-palette-neutral-readonly);

--salt-editable-primary-background: var(--salt-palette-background-primary);
--salt-editable-primary-background-active: var(--salt-palette-background-primary);
--salt-editable-primary-background-disabled: var(--salt-palette-background-primary-disabled);
--salt-editable-primary-background-hover: var(--salt-palette-background-primary);
--salt-editable-primary-background-readonly: var(--salt-palette-background-none);

--salt-editable-secondary-background: var(--salt-palette-background-secondary);
--salt-editable-secondary-background-active: var(--salt-palette-background-secondary);
--salt-editable-secondary-background-disabled: var(--salt-palette-background-secondary-disabled);
--salt-editable-secondary-background-hover: var(--salt-palette-background-secondary);
--salt-editable-secondary-background-readonly: var(--salt-palette-background-none);
}
3 changes: 3 additions & 0 deletions packages/theme/css/characteristics/focused-next.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.salt-theme.salt-theme-next {
--salt-focused-outlineColor: var(--salt-palette-accent-stronger);
}
4 changes: 4 additions & 0 deletions packages/theme/css/characteristics/navigable-next.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.salt-theme.salt-theme-next {
--salt-navigable-indicator-hover: var(--salt-palette-neutral);
--salt-navigable-indicator-active: var(--salt-palette-accent);
}
3 changes: 3 additions & 0 deletions packages/theme/css/characteristics/overlayable-next.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.salt-theme.salt-theme-next {
--salt-overlayable-background: var(--salt-palette-background-backdrop);
}
20 changes: 20 additions & 0 deletions packages/theme/css/characteristics/selectable-next.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
.salt-theme.salt-theme-next {
--salt-selectable-borderColor: var(--salt-palette-neutral);
--salt-selectable-borderColor-hover: var(--salt-palette-accent-weak);
--salt-selectable-borderColor-selected: var(--salt-palette-accent);
--salt-selectable-borderColor-selectedDisabled: var(--salt-palette-accent-disabled);
--salt-selectable-borderColor-disabled: var(--salt-palette-neutral-disabled);
--salt-selectable-borderColor-readonly: var(--salt-palette-neutral-readonly);

--salt-selectable-foreground: var(--salt-palette-neutral-strong);
--salt-selectable-foreground-disabled: var(--salt-palette-neutral-strong-disabled);
--salt-selectable-foreground-hover: var(--salt-palette-accent-weak);
--salt-selectable-foreground-selected: var(--salt-palette-accent);
--salt-selectable-foreground-selectedDisabled: var(--salt-palette-accent-disabled);
--salt-selectable-background: var(--salt-palette-background-none);
--salt-selectable-background-hover: var(--salt-palette-accent-weakest);
--salt-selectable-background-selected: var(--salt-palette-accent-weaker);
--salt-selectable-background-blurSelected: var(--salt-palette-neutral-weakest);
--salt-selectable-background-disabled: var(--salt-palette-background-none);
--salt-selectable-background-selectedDisabled: var(--salt-palette-accent-weaker-disabled);
}
5 changes: 5 additions & 0 deletions packages/theme/css/characteristics/separable-next.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.salt-theme.salt-theme-next {
--salt-separable-primary-borderColor: var(--salt-palette-neutral-stronger-primary);
--salt-separable-secondary-borderColor: var(--salt-palette-neutral-stronger-secondary);
--salt-separable-tertiary-borderColor: var(--salt-palette-neutral-stronger-tertiary);
}
23 changes: 23 additions & 0 deletions packages/theme/css/characteristics/status-next.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
.salt-theme.salt-theme-next {
--salt-status-info-foreground: var(--salt-palette-accent);
--salt-status-success-foreground: var(--salt-palette-positive);
--salt-status-warning-foreground: var(--salt-palette-warning);
--salt-status-error-foreground: var(--salt-palette-negative);
--salt-status-static-foreground: var(--salt-palette-foreground-secondary); /* TBD */
--salt-status-negative-foreground: var(--salt-palette-negative);
--salt-status-positive-foreground: var(--salt-palette-positive);

--salt-status-info-borderColor: var(--salt-palette-accent);
--salt-status-success-borderColor: var(--salt-palette-positive);
--salt-status-warning-borderColor: var(--salt-palette-warning);
--salt-status-error-borderColor: var(--salt-palette-negative);

--salt-status-info-background: var(--salt-palette-accent-weakest);
--salt-status-success-background: var(--salt-palette-positive-weak);
--salt-status-warning-background: var(--salt-palette-warning-weak);
--salt-status-error-background: var(--salt-palette-negative-weak);

--salt-status-success-background-selected: var(--salt-palette-positive-weak);
--salt-status-warning-background-selected: var(--salt-palette-warning-weak);
--salt-status-error-background-selected: var(--salt-palette-negative-weak);
}
4 changes: 4 additions & 0 deletions packages/theme/css/characteristics/target-next.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.salt-theme.salt-theme-next {
--salt-target-background-hover: var(--salt-palette-accent);
--salt-target-borderColor-hover: var(--salt-palette-accent-weakest);
}
3 changes: 3 additions & 0 deletions packages/theme/css/characteristics/track-next.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.salt-theme.salt-theme-next {
--salt-track-borderColor: var(--salt-palette-neutral);
}
Loading
Loading