diff --git a/components/togglebutton/togglebutton.ts b/components/togglebutton/togglebutton.ts index 8dba101a33e..c8c0697b465 100644 --- a/components/togglebutton/togglebutton.ts +++ b/components/togglebutton/togglebutton.ts @@ -12,8 +12,11 @@ export const TOGGLEBUTTON_VALUE_ACCESSOR: any = { selector: 'p-toggleButton', template: `
+
+ +
{{checked ? onLabel : offLabel}}
@@ -39,6 +42,8 @@ export class ToggleButton implements ControlValueAccessor { @Output() onChange: EventEmitter = new EventEmitter(); checked: boolean = false; + + focus: boolean = false; onModelChange: Function = () => {}; @@ -62,6 +67,15 @@ export class ToggleButton implements ControlValueAccessor { }) } } + + onFocus() { + this.focus = true; + } + + onBlur() { + this.focus = false; + this.onModelTouched(); + } writeValue(value: any) : void { this.checked = value; diff --git a/resources/themes/bootstrap/theme.css b/resources/themes/bootstrap/theme.css index 096113f12bf..3da8ba6d900 100644 --- a/resources/themes/bootstrap/theme.css +++ b/resources/themes/bootstrap/theme.css @@ -145,6 +145,11 @@ body .ui-button.raised-btn { -webkit-box-shadow: 0 1px 2.5px 0 rgba(0, 0, 0, 0.26), 0 1px 5px 0 rgba(0, 0, 0, 0.16); box-shadow: 0 1px 2.5px 0 rgba(0, 0, 0, 0.26), 0 1px 5px 0 rgba(0, 0, 0, 0.16); } +body .ui-togglebutton.ui-button.ui-state-focus { + -moz-box-shadow: 0px 0px 5px #1f89ce; + -webkit-box-shadow: 0px 0px 5px #1f89ce; + box-shadow: 0px 0px 5px #1f89ce; +} body .ui-chips .ui-chips-token .ui-chips-token-label { padding: 0.125em; } diff --git a/resources/themes/omega/theme.css b/resources/themes/omega/theme.css index ea9a2f55ccb..37bc92993e4 100644 --- a/resources/themes/omega/theme.css +++ b/resources/themes/omega/theme.css @@ -543,6 +543,12 @@ button.ui-button.ui-state-active, .ui-button.ui-state-active { border: 1px solid #156090; background: #186ba0; color: #FFFFFF; } +.ui-togglebutton.ui-button.ui-state-focus { + -moz-box-shadow: 0px 0px 5px #1f89ce; + -webkit-box-shadow: 0px 0px 5px #1f89ce; + box-shadow: 0px 0px 5px #1f89ce; +} + /* SelectOneMenu */ .ui-dropdown .ui-dropdown-trigger, .ui-multiselect .ui-multiselect-trigger {