/* Copyright 2019 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ @import "../commons/basebutton.css"; @import "../vars/css/components/spectrum-actionbutton.css"; .spectrum-ActionButton--sizeS { @remapvars { find: --spectrum-actionbutton-s-; replace: --spectrum-actionbutton-; } /* todo: remove hardcoded values when we update DNA */ --spectrum-actionbutton-hold-icon-padding-bottom: var(--spectrum-global-dimension-size-25); --spectrum-actionbutton-hold-icon-padding-right: var(--spectrum-global-dimension-size-25); } .spectrum-ActionButton--sizeM { @remapvars { find: --spectrum-actionbutton-m-; replace: --spectrum-actionbutton-; } /* todo: remove hardcoded values when we update DNA */ --spectrum-actionbutton-hold-icon-padding-bottom: var(--spectrum-global-dimension-size-40); --spectrum-actionbutton-hold-icon-padding-right: var(--spectrum-global-dimension-size-40); } .spectrum-ActionButton--sizeL { @remapvars { find: --spectrum-actionbutton-l-; replace: --spectrum-actionbutton-; } /* todo: remove hardcoded values when we update DNA */ --spectrum-actionbutton-hold-icon-padding-bottom: var(--spectrum-global-dimension-size-50); --spectrum-actionbutton-hold-icon-padding-right: var(--spectrum-global-dimension-size-50); } .spectrum-ActionButton--sizeXL { @remapvars { find: --spectrum-actionbutton-xl-; replace: --spectrum-actionbutton-; } /* todo: remove hardcoded values when we update DNA */ --spectrum-actionbutton-hold-icon-padding-bottom: var(--spectrum-global-dimension-size-65); --spectrum-actionbutton-hold-icon-padding-right: var(--spectrum-global-dimension-size-65); } .spectrum-ActionButton { /* Adjustments for inset/outset padding in DNA */ --spectrum-actionbutton-padding-left-adjusted: calc(var(--spectrum-actionbutton-padding-left) - var(--spectrum-actionbutton-border-size)); --spectrum-actionbutton-padding-right-adjusted: calc(var(--spectrum-actionbutton-padding-right) - var(--spectrum-actionbutton-border-size)); --spectrum-actionbutton-textonly-padding-left-adjusted: calc(var(--spectrum-actionbutton-textonly-padding-left) - var(--spectrum-actionbutton-border-size)); --spectrum-actionbutton-textonly-padding-right-adjusted: calc(var(--spectrum-actionbutton-textonly-padding-right) - var(--spectrum-actionbutton-border-size)); --spectrum-actionbutton-icononly-padding-left-adjusted: calc(var(--spectrum-actionbutton-icononly-padding-left) - var(--spectrum-actionbutton-border-size)); --spectrum-actionbutton-icononly-padding-right-adjusted: calc(var(--spectrum-actionbutton-icononly-padding-right) - var(--spectrum-actionbutton-border-size)); } a.spectrum-ActionButton { @inherit: %spectrum-AnchorButton; } .spectrum-ActionButton { @inherit: %spectrum-BaseButton; position: relative; block-size: var(--spectrum-actionbutton-height); min-inline-size: var(--spectrum-actionbutton-min-width); /* Start with text-only padding */ padding-inline: var(--spectrum-actionbutton-textonly-padding-left-adjusted) var(--spectrum-actionbutton-textonly-padding-right-adjusted); border-width: var(--spectrum-actionbutton-border-size); border-radius: var(--spectrum-actionbutton-border-radius); font-size: var(--spectrum-actionbutton-text-size); font-weight: var(--spectrum-actionbutton-text-font-weight); line-height: var(--spectrum-actionbutton-text-line-height); .spectrum-Icon { @inherit: %spectrum-ButtonIcon; /* Scoot over, assuming we have both icon and text */ margin-inline-start: calc(-1 * (var(--spectrum-actionbutton-textonly-padding-left-adjusted) - var(--spectrum-actionbutton-padding-left-adjusted))); } .spectrum-Icon + .spectrum-ActionButton-label { /* Have gap on on the left */ padding-inline-start: var(--spectrum-actionbutton-icon-gap); /* Have no padding on the right (it's built into the element) This will fail if --spectrum-actionbutton-textonly-padding-right !== --spectrum-actionbutton-padding-right */ padding-inline-end: 0; } .spectrum-ActionButton-hold + .spectrum-Icon, .spectrum-Icon:only-child { /* Use icon-only padding, subtracted from the default text-only padding */ margin-left: calc(-1 * (var(--spectrum-actionbutton-textonly-padding-left-adjusted) - var(--spectrum-actionbutton-icononly-padding-left-adjusted))); margin-right: calc(-1 * (var(--spectrum-actionbutton-textonly-padding-right-adjusted) - var(--spectrum-actionbutton-icononly-padding-right-adjusted))); } } .spectrum-ActionButton-label { @inherit: %spectrum-ButtonLabel; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .spectrum-ActionButton-hold { position: absolute; inset-inline-end: var(--spectrum-actionbutton-hold-icon-padding-right); inset-block-end: var(--spectrum-actionbutton-hold-icon-padding-bottom); transform: logical rotate(0deg); } .spectrum-ActionButton--quiet { border-width: var(--spectrum-actionbutton-quiet-border-size); border-radius: var(--spectrum-actionbutton-quiet-border-radius); font-size: var(--spectrum-actionbutton-quiet-text-size); font-weight: var(--spectrum-actionbutton-quiet-text-font-weight); }