Skip to content

Commit

Permalink
feat(card): lighter and darker palettes (#1327)
Browse files Browse the repository at this point in the history
* chore: stylelint config

* feat(lib): context-picker allow attr

* feat(lib): reflect color-palette on demo

* fix(card): lighter/darker color-palettes

* fix(card): adjust whitespace to suit designs

* docs(card): custom header context demo
  • Loading branch information
bennypowers authored Nov 16, 2023
1 parent 369d5b7 commit 6e8fad6
Show file tree
Hide file tree
Showing 43 changed files with 604 additions and 340 deletions.
4 changes: 4 additions & 0 deletions .changeset/card-whitespace.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
"@rhds/elements": patch
---
`<rh-card>`: adjust whitespace of card parts to suit design
32 changes: 18 additions & 14 deletions .stylelintrc.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
extends: stylelint-config-standard
extends:
- stylelint-config-standard
- stylelint-stylistic/config

ignoreFiles:
- node_modules/**/*

Expand All @@ -16,18 +19,6 @@ rules:
- ignoreShorthands:
- /grid/

# TODO: migrate the following paragraph to stylelint-stylistic
# see https://github.com/elirasza/stylelint-stylistic/tree/main/lib/rules/indentation
string-quotes: double
selector-combinator-space-after: always
selector-combinator-space-before: always
indentation:
- 2
- indentInsideParens: 'once-at-root-twice-in-block'
max-line-length:
- 100
- ignorePattern: /--rh-font-family-/

number-max-precision: 6
no-descending-specificity:
- true
Expand All @@ -49,18 +40,31 @@ rules:
- ignorePseudoElements:
- /part(.*)/

stylistic/string-quotes: double
stylistic/selector-combinator-space-after: always
stylistic/selector-combinator-space-before: always
stylistic/indentation:
- 2
- indentInsideParens: 'once-at-root-twice-in-block'
stylistic/max-line-length:
- 100
- ignorePattern: /--rh-font-family-/

rhds/token-values: true

media-feature-range-notation: prefix

plugins:
- ./node_modules/@rhds/tokens/plugins/stylelint.cjs
- stylelint-stylistic

overrides:
- files:
- docs/**/*.scss
defaultSeverity: warning
extends: stylelint-config-standard-scss
rules:
max-line-length:
stylistic/max-line-length:
- 120
- ignorePattern: /--rh-font-family-/

2 changes: 1 addition & 1 deletion elements/rh-accordion/rh-accordion-header.css
Original file line number Diff line number Diff line change
Expand Up @@ -115,4 +115,4 @@ span {
.toggle:after {
inset-block: 0;
inset-inline-start: 0;
}
}
13 changes: 9 additions & 4 deletions elements/rh-accordion/rh-accordion-panel.css
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,20 @@
border-inline-end:
1px
solid
var(--_panel-border-inline-end-color,
var(--rh-color-border-subtle-on-light, #c7c7c7));
var(
--_panel-border-inline-end-color,
var(--rh-color-border-subtle-on-light, #c7c7c7)
);
background-color: var(--_background-color);
}

.content[expanded],
:host([expanded]) .content {
--_panel-body--before-background-color: var(--_panel-content-body-accent-color,
var(--rh-color-accent-base-on-light, #0066cc));
--_panel-body--before-background-color:
var(
--_panel-content-body-accent-color,
var(--rh-color-accent-base-on-light, #0066cc)
);
}

.body:after {
Expand Down
2 changes: 1 addition & 1 deletion elements/rh-alert/rh-alert.css
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
}

:host([toast]),
:host([variant="toast"]){
:host([variant="toast"]) {
--_background-color: var(--rh-color-surface-lightest, #ffffff);

max-width: 550px;
Expand Down
13 changes: 8 additions & 5 deletions elements/rh-audio-player/rh-audio-player-lightdom.css
Original file line number Diff line number Diff line change
Expand Up @@ -49,16 +49,20 @@ rh-audio-player[color-palette="dark"] {

rh-audio-player[color-palette="dark"] > * {
background-color:
var(--rh-audio-player-background-color,
var(--rh-color-surface-darkest, #151515));
var(
--rh-audio-player-background-color,
var(--rh-color-surface-darkest, #151515)
);
}

rh-audio-player-about,
rh-audio-player-subscribe,
rh-transcript {
background-color:
var(--rh-audio-player-background-color,
var(--rh-color-surface-lightest, #ffffff));
var(
--rh-audio-player-background-color,
var(--rh-color-surface-lightest, #ffffff)
);
}

rh-audio-player > [slot="series"] {
Expand All @@ -82,4 +86,3 @@ rh-audio-player [slot="heading"] {
rh-audio-player [slot="heading"] {
font-size: var(--rh-font-size-body-text-md, 1rem);
}

67 changes: 36 additions & 31 deletions elements/rh-audio-player/rh-audio-player-range-styles.css
Original file line number Diff line number Diff line change
@@ -1,26 +1,27 @@
/*
Adapted from:
Copyright (c) 2023 by S. Shahriar (https://codepen.io/ShadowShahriar/pen/zYPPYrQ)
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in the
Software without restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
IN THE SOFTWARE.
*/
/**
* @license Adapted from:
*
* Copyright (c) 2023 by S. Shahriar (https://codepen.io/ShadowShahriar/pen/zYPPYrQ)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in the
* Software without restriction, including without limitation the rights to use,
* copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
* Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
* IN THE SOFTWARE.
*/

input[type="range"] {
display: inline-flex;
align-items: center;
Expand All @@ -45,7 +46,6 @@ input[type="range"] {
--_outline: var(--rh-border-width-md, 2px) solid var(--_interactive-color);
--_thumb-color: var(--rh-audio-player-range-thumb-color, var(--_accent-color));
--_progress-color: var(--rh-audio-player-range-progress-color, var(--_accent-color));

}

input[type="range"][hidden] {
Expand Down Expand Up @@ -95,13 +95,15 @@ input[type="range"]::-webkit-slider-thumb {
box-shadow: var(--box-fill);
border-radius: var(--_thumb-width, var(--_thumb-height));

/* stylelint-disable-next-line max-line-length */
--_clip-top: calc((var(--_thumb-height) - var(--_track-height)) * 0.5 - 0.5px);
--_clip-bottom: calc(var(--_thumb-height) - var(--_clip-top));
--_clip-further: calc(100% + 1px);

/* stylelint-disable-next-line max-line-length */
--box-fill: calc(-100vmax - var(--_thumb-width, var(--_thumb-height))) 0 0 100vmax var(--_box-fill-color, currentcolor);
--box-fill:
calc(-100vmax - var(--_thumb-width, var(--_thumb-height)))
0
0
100vmax
var(--_box-fill-color, currentcolor);

clip-path:
polygon(
Expand All @@ -122,8 +124,11 @@ input[type="range"]:disabled::-webkit-slider-thumb {

input[type="range"]::-webkit-slider-runnable-track {
border-radius: 3px;
/* stylelint-disable-next-line max-line-length */
background: linear-gradient(var(--_track-fill-color) 0 0) scroll no-repeat center / 100% calc(var(--_track-height) + 1px);
background:
linear-gradient(var(--_track-fill-color) 0 0)
scroll
no-repeat
center / 100% calc(var(--_track-height) + 1px);
}

input[type="range"],
Expand Down Expand Up @@ -164,4 +169,4 @@ input[type="range"]::-moz-range-progress {

input[type="range"]:disabled::-moz-range-thumb {
cursor: not-allowed;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,18 @@
overflow-y: visible;

--_fade-color:
var(--rh-audio-player-scrolling-text-overflow-background-color,
var(--rh-color-surface-lightest, #ffffff));
var(
--rh-audio-player-scrolling-text-overflow-background-color,
var(--rh-color-surface-lightest, #ffffff)
);
}

#outer.dark {
--_fade-color:
var(--rh-audio-player-scrolling-text-overflow-background-color,
var(--rh-color-surface-darkest, #151515));
var(
--rh-audio-player-scrolling-text-overflow-background-color,
var(--rh-color-surface-darkest, #151515)
);
}

#outer.rtl {
Expand Down
Loading

0 comments on commit 6e8fad6

Please sign in to comment.