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

Implement styling for split Button across all themes #6228

Merged
merged 6 commits into from
Mar 20, 2024
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
2 changes: 1 addition & 1 deletion packages/components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
"build": "npm run build:light",
"build:deps": "pnpm --filter @public-ui/components^... build",
"build:light": "npm run clear && mkdir doc && cross-env NODE_ENV=production stencil build --docs --prod && node scripts/hashing.js && node scripts/autogen.doc.js && node scripts/vaadin.js && npm run format -- -w",
"clear": "rimraf dist doc loader www ../adapters/angular/v11/src ../adapters/angular/v12/src ../adapters/angular/v13/src ../adapters/angular/v14/src ../adapters/angular/v15/src ../adapters/angular/v16/src ../adapters/angular/v17/src ../adapters/hydrate/dist ../adapters/react/src ../adapters/solid/src ../adapters/vaadin/*.java ../adapters/vue/src",
"clear": "rimraf -g dist doc loader www ../adapters/angular/v11/src ../adapters/angular/v12/src ../adapters/angular/v13/src ../adapters/angular/v14/src ../adapters/angular/v15/src ../adapters/angular/v16/src ../adapters/angular/v17/src ../adapters/hydrate/dist ../adapters/react/src ../adapters/solid/src ../adapters/vaadin/*.java ../adapters/vue/src",
"format": "prettier --check src",
"lighthouse": "lighthouse --chrome-flags=\"--headless\" --output-path lighthouse.report.html --preset=desktop --quiet",
"lint": "tsc --noemit && eslint src",
Expand Down
2 changes: 1 addition & 1 deletion packages/components/scripts/autogen.doc.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ const modifyReadmeContent = (contents) =>
*/
const modifyReadmeContentForDocsFolder = (contents) => contents.replace('style="color:red"', 'class="text-red-500"').replace(/ \\\| /g, '` \\| `');

rimraf('doc/*.md').then(() => {
rimraf('doc/*.md', { glob: true }).then(() => {
README_PATHS.forEach((readmePath) => {
const name = reverseString(reverseString(path.dirname(readmePath)).replace(/(\/|\\).+/g, ''));
const contents = fs.readFileSync(readmePath, 'utf-8');
Expand Down
16 changes: 0 additions & 16 deletions packages/components/src/components/split-button/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,6 @@
text-align: left;
}

.main-button .kol-span-wc {
place-items: start;
}

.secondary-button button {
height: 100%;
}

.horizontal-line {
background-color: rgba(0, 0, 0, 0.2);
border-radius: 2px;
height: 70%;
margin-block: auto;
width: 1px;
}

/* popover */
.popover {
height: 0;
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
125 changes: 3 additions & 122 deletions packages/themes/bmf/src/components/button.scss
Original file line number Diff line number Diff line change
@@ -1,16 +1,10 @@
@import '../mixins/button.scss';

@layer kol-theme-component {
:host {
font-family: var(--font-family);
}

:is(a, button) {
font-size: 1.125em;
}

:is(a, button):focus {
outline: none;
}

:is(a, button):focus .kol-span-wc {
outline-color: var(--color-ocean);
outline-offset: 2px;
Expand All @@ -32,118 +26,5 @@
transition-property: background-color, color, border-color;
}

.primary :is(a, button) > .kol-span-wc,
.primary :is(a, button):disabled:hover > .kol-span-wc {
background-color: var(--color-midnight);
border-color: var(--color-midnight);
color: var(--color-white);
}

.secondary :is(a, button) > .kol-span-wc,
.secondary :is(a, button):disabled:hover > .kol-span-wc,
.normal :is(a, button) > .kol-span-wc,
.normal :is(a, button):disabled:hover > .kol-span-wc {
background-color: var(--color-white);
border-color: var(--color-midnight);
color: var(--color-midnight);
}

.danger :is(a, button) > .kol-span-wc,
.danger :is(a, button):disabled:hover > .kol-span-wc {
background-color: var(--color-red);
border-color: var(--color-red);
color: var(--color-white);
}

.success :is(a, button) > .kol-span-wc,
.success :is(a, button):disabled:hover > .kol-span-wc {
background-color: var(--color-green);
border-color: var(--color-green);
color: var(--color-white);
}

.ghost :is(a, button) > .kol-span-wc,
.ghost :is(a, button):disabled:hover > .kol-span-wc {
border-color: var(--color-white);
background-color: var(--color-white);
box-shadow: none;
color: var(--color-midnight);
}

/*-----------*/
.primary :is(a, button):active > .kol-span-wc,
.primary :is(a, button):hover > .kol-span-wc,
.secondary :is(a, button):active > .kol-span-wc,
.secondary :is(a, button):hover > .kol-span-wc,
.normal :is(a, button):active > .kol-span-wc,
.normal :is(a, button):hover > .kol-span-wc,
.danger :is(a, button):active > .kol-span-wc,
.danger :is(a, button):hover > .kol-span-wc,
.success :is(a, button):active > .kol-span-wc,
.success :is(a, button):hover > .kol-span-wc,
.ghost :is(a, button):active > .kol-span-wc,
.ghost :is(a, button):hover > .kol-span-wc {
background-color: var(--color-ocean);
border-color: var(--color-ocean);
box-shadow: 0px 2px 8px 2px rgba(8, 35, 48, 0.24);
color: var(--color-white);
}

.danger :is(a, button):active > .kol-span-wc,
.danger :is(a, button):hover > .kol-span-wc {
background-color: var(--color-crimson);
border-color: var(--color-crimson);
}

:is(a, button):disabled:hover > .kol-span-wc,
:is(a, button):focus:hover > .kol-span-wc {
box-shadow: none;
}

.primary :is(a, button):active > .kol-span-wc,
.secondary :is(a, button):active > .kol-span-wc,
.normal :is(a, button):active > .kol-span-wc,
.danger :is(a, button):active > .kol-span-wc,
.success :is(a, button):active > .kol-span-wc,
.ghost :is(a, button):active > .kol-span-wc {
border-color: var(--color-white);
box-shadow: none;
outline: none;
}

:is(a, button).hide-label > .kol-span-wc {
padding: 8px;
width: unset;
}

:is(a, button).hide-label > .kol-span-wc > span > span {
display: none;
}

:is(a, button).loading > .kol-span-wc .kol-icon {
animation: spin 5s infinite linear;
}

/** button with inline focus */
:is(a, button).focus-inline:focus > .kol-span-wc {
outline-offset: -2px;
}

/** :is(a,button) with transparent background */
:is(a, button).transparent > .kol-span-wc > span,
.ghost :is(a, button).transparent > .kol-span-wc > span,
:is(a, button).transparent > .kol-span-wc {
background-color: transparent;
border-color: transparent;
}

/** CUSTOM_CLASS */
:is(a, button).hide-label > .kol-span-wc {
padding: 8px;
width: unset;
}

:is(a, button).hide-label > .kol-span-wc > span > span {
display: block;
}
@include kol-button;
}
51 changes: 51 additions & 0 deletions packages/themes/bmf/src/components/split-button.scss
Original file line number Diff line number Diff line change
@@ -1,9 +1,60 @@
@import '../mixins/button.scss';

@layer kol-theme-component {
:host {
font-family: var(--font-family);
border-radius: var(--a11y-min-size);
border-style: solid;
border-width: 2px;
border-color: var(--color-midnight);
}

.popover {
background: #fff;
}

.horizontal-line {
background-color: var(--color-midnight);
border-radius: 2px;
width: 1px;
}

.secondary-button button {
height: 100%;
}

.secondary-button :active > .kol-span-wc {
border-top-right-radius: var(--a11y-min-size);
border-bottom-right-radius: var(--a11y-min-size);
}

.secondary-button :focus .kol-span-wc {
border-top-right-radius: var(--a11y-min-size);
border-bottom-right-radius: var(--a11y-min-size);
border-top-left-radius: 0px;
border-bottom-left-radius: 0px;
outline-offset: 0;
}

:is(a, button):focus .kol-span-wc {
outline-color: var(--color-ocean);
outline-style: solid;
outline-width: 3px;
outline-offset: 2px;
transition: outline-offset 0.2s linear;
}

:is(a, button) > .kol-span-wc {
font-weight: 700;
border-top-left-radius: var(--a11y-min-size);
border-bottom-left-radius: var(--a11y-min-size);
min-height: var(--a11y-min-size);
min-width: var(--a11y-min-size);
padding: 8px 14px;
text-align: center;
transition-duration: 0.5s;
transition-property: background-color, color, border-color;
}

@include kol-button;
}
124 changes: 124 additions & 0 deletions packages/themes/bmf/src/mixins/button.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
@mixin kol-button {
:is(a, button) {
font-size: 1.125em;
}

:is(a, button):focus {
outline: none;
}

.primary :is(a, button) > .kol-span-wc,
.primary :is(a, button):disabled:hover > .kol-span-wc {
background-color: var(--color-midnight);
border-color: var(--color-midnight);
color: var(--color-white);
}

.secondary :is(a, button) > .kol-span-wc,
.secondary :is(a, button):disabled:hover > .kol-span-wc,
.normal :is(a, button) > .kol-span-wc,
.normal :is(a, button):disabled:hover > .kol-span-wc {
background-color: var(--color-white);
border-color: var(--color-midnight);
color: var(--color-midnight);
}

.danger :is(a, button) > .kol-span-wc,
.danger :is(a, button):disabled:hover > .kol-span-wc {
background-color: var(--color-red);
border-color: var(--color-red);
color: var(--color-white);
}

.success :is(a, button) > .kol-span-wc,
.success :is(a, button):disabled:hover > .kol-span-wc {
background-color: var(--color-green);
border-color: var(--color-green);
color: var(--color-white);
}

.ghost :is(a, button) > .kol-span-wc,
.ghost :is(a, button):disabled:hover > .kol-span-wc {
border-color: var(--color-white);
background-color: var(--color-white);
box-shadow: none;
color: var(--color-midnight);
}

/*-----------*/
.primary :is(a, button):active > .kol-span-wc,
.primary :is(a, button):hover > .kol-span-wc,
.secondary :is(a, button):active > .kol-span-wc,
.secondary :is(a, button):hover > .kol-span-wc,
.normal :is(a, button):active > .kol-span-wc,
.normal :is(a, button):hover > .kol-span-wc,
.danger :is(a, button):active > .kol-span-wc,
.danger :is(a, button):hover > .kol-span-wc,
.success :is(a, button):active > .kol-span-wc,
.success :is(a, button):hover > .kol-span-wc,
.ghost :is(a, button):active > .kol-span-wc,
.ghost :is(a, button):hover > .kol-span-wc {
background-color: var(--color-ocean);
border-color: var(--color-ocean);
box-shadow: 0px 2px 8px 2px rgba(8, 35, 48, 0.24);
color: var(--color-white);
}

.danger :is(a, button):active > .kol-span-wc,
.danger :is(a, button):hover > .kol-span-wc {
background-color: var(--color-crimson);
border-color: var(--color-crimson);
}

:is(a, button):disabled:hover > .kol-span-wc,
:is(a, button):focus:hover > .kol-span-wc {
box-shadow: none;
}

.primary :is(a, button):active > .kol-span-wc,
.secondary :is(a, button):active > .kol-span-wc,
.normal :is(a, button):active > .kol-span-wc,
.danger :is(a, button):active > .kol-span-wc,
.success :is(a, button):active > .kol-span-wc,
.ghost :is(a, button):active > .kol-span-wc {
border-color: var(--color-white);
box-shadow: none;
outline: none;
}

:is(a, button).hide-label > .kol-span-wc {
padding: 8px;
width: unset;
}

:is(a, button).hide-label > .kol-span-wc > span > span {
display: none;
}

:is(a, button).loading > .kol-span-wc .kol-icon {
animation: spin 5s infinite linear;
}

/** button with inline focus */
:is(a, button).focus-inline:focus > .kol-span-wc {
outline-offset: -2px;
}

/** :is(a,button) with transparent background */
:is(a, button).transparent > .kol-span-wc > span,
.ghost :is(a, button).transparent > .kol-span-wc > span,
:is(a, button).transparent > .kol-span-wc {
background-color: transparent;
border-color: transparent;
}

/** CUSTOM_CLASS */
:is(a, button).hide-label > .kol-span-wc {
padding: 8px;
width: unset;
}

:is(a, button).hide-label > .kol-span-wc > span > span {
display: block;
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading