mirror of
https://github.com/jquery/jquery-ui.git
synced 2025-01-07 20:34:24 +00:00
Button: Removed ui-button-text-icon class. Added ui-button-text-icon-primary and ui-button-text-icon-secondary classes. Fixed #5382 - Button: specifying only a secondary icon for the button widget locates the icon on the left
This commit is contained in:
parent
e815e7c1e4
commit
202ddd0c58
@ -23,24 +23,34 @@
|
||||
</button>
|
||||
|
||||
<button class="ui-button ui-button-icon-only ui-widget ui-state-default ui-corner-all" title="Button">
|
||||
<span class="ui-button-icon-primary ui-icon ui-icon-locked"></span>
|
||||
<span class="ui-button-text">Button</span>
|
||||
<span class="ui-button-icon-primary ui-icon ui-icon-gear"></span>
|
||||
<span class="ui-button-text">Primary icon</span>
|
||||
</button>
|
||||
|
||||
<button class="ui-button ui-button-text-icon ui-widget ui-state-default ui-corner-all">
|
||||
<span class="ui-button-icon-primary ui-icon ui-icon-locked"></span>
|
||||
<span class="ui-button-text">Button</span>
|
||||
<button class="ui-button ui-button-icon-only ui-widget ui-state-default ui-corner-all" title="Button">
|
||||
<span class="ui-button-text">Secondary icon</span>
|
||||
<span class="ui-button-icon-secondary ui-icon ui-icon-triangle-1-s"></span>
|
||||
</button>
|
||||
|
||||
<button class="ui-button ui-button-text-icon-primary ui-widget ui-state-default ui-corner-all">
|
||||
<span class="ui-button-icon-primary ui-icon ui-icon-gear"></span>
|
||||
<span class="ui-button-text">Primary icon</span>
|
||||
</button>
|
||||
|
||||
<button class="ui-button ui-button-text-icon-secondary ui-widget ui-state-default ui-corner-all">
|
||||
<span class="ui-button-text">Secondary icon</span>
|
||||
<span class="ui-button-icon-secondary ui-icon ui-icon-triangle-1-s"></span>
|
||||
</button>
|
||||
|
||||
<button class="ui-button ui-button-text-icons ui-widget ui-state-default ui-corner-all">
|
||||
<span class="ui-button-icon-primary ui-icon ui-icon-gear"></span>
|
||||
<span class="ui-button-text">Button</span>
|
||||
<span class="ui-button-text">Both icons</span>
|
||||
<span class="ui-button-icon-secondary ui-icon ui-icon-triangle-1-s"></span>
|
||||
</button>
|
||||
|
||||
<button class="ui-button ui-button-icons-only ui-widget ui-state-default ui-corner-all">
|
||||
<span class="ui-button-icon-primary ui-icon ui-icon-gear"></span>
|
||||
<span class="ui-button-text">Button</span>
|
||||
<span class="ui-button-text">No text</span>
|
||||
<span class="ui-button-icon-secondary ui-icon ui-icon-triangle-1-s"></span>
|
||||
</button>
|
||||
</div>
|
||||
@ -53,24 +63,34 @@
|
||||
</a>
|
||||
|
||||
<a href="#" class="ui-button ui-button-icon-only ui-widget ui-state-default ui-corner-all" title="Button">
|
||||
<span class="ui-button-icon-primary ui-icon ui-icon-locked"></span>
|
||||
<span class="ui-button-text">Button</span>
|
||||
<span class="ui-button-icon-primary ui-icon ui-icon-gear"></span>
|
||||
<span class="ui-button-text">Primary icon</span>
|
||||
</a>
|
||||
|
||||
<a href="#" class="ui-button ui-button-text-icon ui-widget ui-state-default ui-corner-all">
|
||||
<span class="ui-button-icon-primary ui-icon ui-icon-locked"></span>
|
||||
<span class="ui-button-text">Button</span>
|
||||
<a href="#" class="ui-button ui-button-icon-only ui-widget ui-state-default ui-corner-all" title="Button">
|
||||
<span class="ui-button-text">Secondary icon</span>
|
||||
<span class="ui-button-icon-secondary ui-icon ui-icon-triangle-1-s"></span>
|
||||
</a>
|
||||
|
||||
<a href="#" class="ui-button ui-button-text-icon-primary ui-widget ui-state-default ui-corner-all">
|
||||
<span class="ui-button-icon-primary ui-icon ui-icon-gear"></span>
|
||||
<span class="ui-button-text">Primary icon</span>
|
||||
</a>
|
||||
|
||||
<a href="#" class="ui-button ui-button-text-icon-secondary ui-widget ui-state-default ui-corner-all">
|
||||
<span class="ui-button-text">Secondary icon</span>
|
||||
<span class="ui-button-icon-secondary ui-icon ui-icon-triangle-1-s"></span>
|
||||
</a>
|
||||
|
||||
<a href="#" class="ui-button ui-button-text-icons ui-widget ui-state-default ui-corner-all">
|
||||
<span class="ui-button-icon-primary ui-icon ui-icon-gear"></span>
|
||||
<span class="ui-button-text">Button</span>
|
||||
<span class="ui-button-text">Both icons</span>
|
||||
<span class="ui-button-icon-secondary ui-icon ui-icon-triangle-1-s"></span>
|
||||
</a>
|
||||
|
||||
<a href="#" class="ui-button ui-button-icons-only ui-widget ui-state-default ui-corner-all">
|
||||
<span class="ui-button-icon-primary ui-icon ui-icon-gear"></span>
|
||||
<span class="ui-button-text">Button</span>
|
||||
<span class="ui-button-text">No text</span>
|
||||
<span class="ui-button-icon-secondary ui-icon ui-icon-triangle-1-s"></span>
|
||||
</a>
|
||||
</div>
|
||||
@ -85,24 +105,34 @@
|
||||
</label>
|
||||
|
||||
<label class="ui-button ui-button-icon-only ui-widget ui-state-default ui-corner-all" title="Button">
|
||||
<span class="ui-button-icon-primary ui-icon ui-icon-locked"></span>
|
||||
<span class="ui-button-text">Button</span>
|
||||
<span class="ui-button-icon-primary ui-icon ui-icon-gear"></span>
|
||||
<span class="ui-button-text">Primary icon</span>
|
||||
</label>
|
||||
|
||||
<label class="ui-button ui-button-text-icon ui-widget ui-state-default ui-corner-all">
|
||||
<span class="ui-button-icon-primary ui-icon ui-icon-locked"></span>
|
||||
<span class="ui-button-text">Button</span>
|
||||
<label class="ui-button ui-button-icon-only ui-widget ui-state-default ui-corner-all" title="Button">
|
||||
<span class="ui-button-text">Secondary icon</span>
|
||||
<span class="ui-button-icon-secondary ui-icon ui-icon-triangle-1-s"></span>
|
||||
</label>
|
||||
|
||||
<label class="ui-button ui-button-text-icon-primary ui-widget ui-state-default ui-corner-all">
|
||||
<span class="ui-button-icon-primary ui-icon ui-icon-gear"></span>
|
||||
<span class="ui-button-text">Primary icon</span>
|
||||
</label>
|
||||
|
||||
<label class="ui-button ui-button-text-icon-secondary ui-widget ui-state-default ui-corner-all">
|
||||
<span class="ui-button-text">Secondary icon</span>
|
||||
<span class="ui-button-icon-secondary ui-icon ui-icon-triangle-1-s"></span>
|
||||
</label>
|
||||
|
||||
<label class="ui-button ui-button-text-icons ui-widget ui-state-default ui-corner-all">
|
||||
<span class="ui-button-icon-primary ui-icon ui-icon-gear"></span>
|
||||
<span class="ui-button-text">Button</span>
|
||||
<span class="ui-button-text">Both icons</span>
|
||||
<span class="ui-button-icon-secondary ui-icon ui-icon-triangle-1-s"></span>
|
||||
</label>
|
||||
|
||||
<label class="ui-button ui-button-icons-only ui-widget ui-state-default ui-corner-all">
|
||||
<span class="ui-button-icon-primary ui-icon ui-icon-gear"></span>
|
||||
<span class="ui-button-text">Button</span>
|
||||
<span class="ui-button-text">No text</span>
|
||||
<span class="ui-button-icon-secondary ui-icon ui-icon-triangle-1-s"></span>
|
||||
</label>
|
||||
</div>
|
||||
@ -111,9 +141,10 @@
|
||||
<h2>Button Sets</h2>
|
||||
|
||||
<div class="ui-buttonset">
|
||||
<button class="ui-button ui-button-text-only ui-widget ui-state-default ui-corner-left"><span class="ui-button-text">Simple button</span></button>
|
||||
<button class="ui-button ui-button-text-only ui-widget ui-state-default"><span class="ui-button-text">Simple button</span></button>
|
||||
<button class="ui-button ui-button-text-only ui-widget ui-state-default ui-corner-right"><span class="ui-button-text">Simple button</span></button>
|
||||
<button class="ui-button ui-button-text-only ui-widget ui-state-default ui-corner-left"><span class="ui-button-text">First</span></button>
|
||||
<button class="ui-button ui-button-text-only ui-widget ui-state-default"><span class="ui-button-text">Middle</span></button>
|
||||
<button class="ui-button ui-button-text-only ui-widget ui-state-default"><span class="ui-button-text">Middle</span></button>
|
||||
<button class="ui-button ui-button-text-only ui-widget ui-state-default ui-corner-right"><span class="ui-button-text">Last</span></button>
|
||||
</div>
|
||||
|
||||
|
||||
|
@ -58,9 +58,9 @@
|
||||
<div>
|
||||
With icon
|
||||
<button class="{button:{icons:{primary:'ui-icon-locked'},text:false}}">Button with icon only</button>
|
||||
<button class="{button:{icons:{primary:'ui-icon-locked'}}}">Button with icon on the left</button>
|
||||
<button class="{button:{icons:{primary:'ui-icon-gear',secondary:'ui-icon-triangle-1-s'}}}">Button with two icons</button>
|
||||
<button class="{button:{icons:{secondary:'ui-icon-triangle-1-s'}}}">Button with text and secondary icon</button>
|
||||
<button class="{button:{icons:{primary:'ui-icon-locked'}}}">Primary icon</button>
|
||||
<button class="{button:{icons:{secondary:'ui-icon-triangle-1-s'}}}">Secondary icon</button>
|
||||
<button class="{button:{icons:{primary:'ui-icon-gear',secondary:'ui-icon-triangle-1-s'}}}">Both icons</button>
|
||||
<button class="{button:{icons:{primary:'ui-icon-gear',secondary:'ui-icon-triangle-1-s'},text:false}}">Button with two icons and no text</button>
|
||||
</div>
|
||||
</div>
|
||||
|
13
themes/base/jquery.ui.button.css
vendored
13
themes/base/jquery.ui.button.css
vendored
@ -11,15 +11,17 @@ button.ui-button-icons-only { width: 3.7em; }
|
||||
.ui-button .ui-button-text { display: block; line-height: 1.4; }
|
||||
.ui-button-text-only .ui-button-text { padding: .4em 1em; }
|
||||
.ui-button-icon-only .ui-button-text, .ui-button-icons-only .ui-button-text { padding: .4em; text-indent: -9999999px; }
|
||||
.ui-button-text-icon .ui-button-text, .ui-button-text-icons .ui-button-text { padding: .4em 1em .4em 2.1em; }
|
||||
.ui-button-text-icon-primary .ui-button-text, .ui-button-text-icons .ui-button-text { padding: .4em 1em .4em 2.1em; }
|
||||
.ui-button-text-icon-secondary .ui-button-text, .ui-button-text-icons .ui-button-text { padding: .4em 2.1em .4em 1em; }
|
||||
.ui-button-text-icons .ui-button-text { padding-left: 2.1em; padding-right: 2.1em; }
|
||||
/* no icon support for input elements, provide padding by default */
|
||||
input.ui-button { padding: .4em 1em; }
|
||||
|
||||
/*button icon element(s) */
|
||||
.ui-button-icon-only .ui-icon, .ui-button-text-icon .ui-icon, .ui-button-text-icons .ui-icon, .ui-button-icons-only .ui-icon { position: absolute; top: 50%; margin-top: -8px; }
|
||||
.ui-button-icon-only .ui-icon, .ui-button-text-icon-primary .ui-icon, .ui-button-text-icon-secondary .ui-icon, .ui-button-text-icons .ui-icon, .ui-button-icons-only .ui-icon { position: absolute; top: 50%; margin-top: -8px; }
|
||||
.ui-button-icon-only .ui-icon { left: 50%; margin-left: -8px; }
|
||||
.ui-button-text-icon .ui-button-icon-primary, .ui-button-text-icons .ui-button-icon-primary, .ui-button-icons-only .ui-button-icon-primary { left: .5em; }
|
||||
.ui-button-text-icon-primary .ui-button-icon-primary, .ui-button-text-icons .ui-button-icon-primary, .ui-button-icons-only .ui-button-icon-primary { left: .5em; }
|
||||
.ui-button-text-icon-secondary .ui-button-icon-secondary, .ui-button-text-icons .ui-button-icon-secondary, .ui-button-icons-only .ui-button-icon-secondary { right: .5em; }
|
||||
.ui-button-text-icons .ui-button-icon-secondary, .ui-button-icons-only .ui-button-icon-secondary { right: .5em; }
|
||||
|
||||
/*button sets*/
|
||||
@ -28,8 +30,3 @@ input.ui-button { padding: .4em 1em; }
|
||||
|
||||
/* workarounds */
|
||||
button.ui-button::-moz-focus-inner { border: 0; padding: 0; } /* reset extra padding in Firefox */
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
6
ui/jquery.ui.button.js
vendored
6
ui/jquery.ui.button.js
vendored
@ -16,7 +16,7 @@
|
||||
var lastActive,
|
||||
baseClasses = "ui-button ui-widget ui-state-default ui-corner-all",
|
||||
stateClasses = "ui-state-hover ui-state-active ",
|
||||
typeClasses = "ui-button-icons-only ui-button-icon-only ui-button-text-icons ui-button-text-icon ui-button-text-only",
|
||||
typeClasses = "ui-button-icons-only ui-button-icon-only ui-button-text-icons ui-button-text-icon-primary ui-button-text-icon-secondary ui-button-text-only",
|
||||
formResetHandler = function( event ) {
|
||||
$( ":ui-button", event.target.form ).each(function() {
|
||||
var inst = $( this ).data( "button" );
|
||||
@ -288,7 +288,7 @@ $.widget( "ui.button", {
|
||||
multipleIcons = icons.primary && icons.secondary;
|
||||
if ( icons.primary || icons.secondary ) {
|
||||
buttonElement.addClass( "ui-button-text-icon" +
|
||||
( multipleIcons ? "s" : "" ) );
|
||||
( multipleIcons ? "s" : ( icons.primary ? "-primary" : "-secondary" ) ) );
|
||||
if ( icons.primary ) {
|
||||
buttonElement.prepend( "<span class='ui-button-icon-primary ui-icon " + icons.primary + "'></span>" );
|
||||
}
|
||||
@ -298,7 +298,7 @@ $.widget( "ui.button", {
|
||||
if ( !this.options.text ) {
|
||||
buttonElement
|
||||
.addClass( multipleIcons ? "ui-button-icons-only" : "ui-button-icon-only" )
|
||||
.removeClass( "ui-button-text-icons ui-button-text-icon" );
|
||||
.removeClass( "ui-button-text-icons ui-button-text-icon-primary ui-button-text-icon-secondary" );
|
||||
if ( !this.hasTitle ) {
|
||||
buttonElement.attr( "title", buttonText );
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user