-
-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[core] Enable support for base and variant styles
through css layers. Behind a feature-flag right now but the aim is to make this default before v1 release.
- Loading branch information
1 parent
698f036
commit ece6a19
Showing
12 changed files
with
199 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
packages/pigment-css-react/tests/styled/fixtures/styled-variants-layer.input.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { styled } from '@pigment-css/react'; | ||
|
||
const SliderRail = styled('span', { | ||
name: 'MuiSlider', | ||
slot: 'Rail', | ||
})({ | ||
color: 'red', | ||
variants: [ | ||
{ | ||
props: { color: 'primary' }, | ||
style: { | ||
color: 'tomato', | ||
}, | ||
}, | ||
{ | ||
props: ({ ownerState }) => ownerState.color === 'secondary', | ||
style: { | ||
color: 'salmon', | ||
}, | ||
}, | ||
], | ||
}); | ||
|
||
export const SliderOverride = styled(SliderRail)({ | ||
color: 'blue', | ||
variants: [ | ||
{ | ||
props: { color: 'primary' }, | ||
style: { | ||
color: 'indigo', | ||
}, | ||
}, | ||
], | ||
}); |
31 changes: 31 additions & 0 deletions
31
packages/pigment-css-react/tests/styled/fixtures/styled-variants-layer.output.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
@layer pigment-base, pigment-variant; | ||
@layer pigment-base { | ||
.srxh6zy { | ||
color: red; | ||
} | ||
} | ||
@layer pigment-variant { | ||
.srxh6zy-1 { | ||
color: tomato; | ||
} | ||
} | ||
@layer pigment-variant { | ||
.srxh6zy-2 { | ||
color: salmon; | ||
} | ||
} | ||
@layer pigment-base { | ||
.srxh6zy-3 { | ||
font-size: 1.5rem; | ||
} | ||
} | ||
@layer pigment-base { | ||
.s1q936we { | ||
color: blue; | ||
} | ||
} | ||
@layer pigment-variant { | ||
.s1q936we-1 { | ||
color: indigo; | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
packages/pigment-css-react/tests/styled/fixtures/styled-variants-layer.output.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { styled as _styled2 } from '@pigment-css/react'; | ||
import _theme2 from '@pigment-css/react/theme'; | ||
import { styled as _styled } from '@pigment-css/react'; | ||
import _theme from '@pigment-css/react/theme'; | ||
const SliderRail = /*#__PURE__*/ _styled('span', { | ||
name: 'MuiSlider', | ||
slot: 'Rail', | ||
})({ | ||
classes: ['srxh6zy', 'srxh6zy-3'], | ||
variants: [ | ||
{ | ||
props: { | ||
color: 'primary', | ||
}, | ||
className: 'srxh6zy-1', | ||
}, | ||
{ | ||
props: ({ ownerState }) => ownerState.color === 'secondary', | ||
className: 'srxh6zy-2', | ||
}, | ||
], | ||
}); | ||
const _exp3 = /*#__PURE__*/ () => SliderRail; | ||
export const SliderOverride = /*#__PURE__*/ _styled2(_exp3())({ | ||
classes: ['s1q936we'], | ||
variants: [ | ||
{ | ||
props: { | ||
color: 'primary', | ||
}, | ||
className: 's1q936we-1', | ||
}, | ||
], | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.