File tree Expand file tree Collapse file tree 2 files changed +34
-8
lines changed
Expand file tree Collapse file tree 2 files changed +34
-8
lines changed Original file line number Diff line number Diff line change @@ -18,6 +18,17 @@ function CheckboxController(LxUtilsService) {
1818 // //
1919 /////////////////////////////
2020
21+ /**
22+ * The default props.
23+ *
24+ * @type {Object }
25+ * @constant
26+ * @readonly
27+ */
28+ const _DEFAULT_PROPS = {
29+ theme : 'light' ,
30+ } ;
31+
2132 /**
2233 * The model controller.
2334 *
@@ -81,6 +92,27 @@ function CheckboxController(LxUtilsService) {
8192 // //
8293 /////////////////////////////
8394
95+ /**
96+ * Get checkbox classes.
97+ *
98+ * @return {Array } The list of checkbox classes.
99+ */
100+ function getClasses ( ) {
101+ const classes = [ ] ;
102+
103+ const state = lx . viewValue ? 'checked' : 'unchecked' ;
104+ const theme = lx . theme ? lx . theme : _DEFAULT_PROPS . theme ;
105+
106+ classes . push ( `${ CSS_PREFIX } -checkbox--is-${ state } ` ) ;
107+ classes . push ( `${ CSS_PREFIX } -checkbox--theme-${ theme } ` ) ;
108+
109+ if ( lx . customColors ) {
110+ classes . push ( `${ CSS_PREFIX } -custom-colors` ) ;
111+ }
112+
113+ return classes ;
114+ }
115+
84116 /**
85117 * Set the model controller.
86118 *
@@ -110,6 +142,7 @@ function CheckboxController(LxUtilsService) {
110142
111143 /////////////////////////////
112144
145+ lx . getClasses = getClasses ;
113146 lx . setModelController = setModelController ;
114147 lx . updateViewValue = updateViewValue ;
115148}
Original file line number Diff line number Diff line change 1- < div
2- class ="lumx-checkbox "
3- ng-class ="{ 'lumx-checkbox--is-checked': lx.viewValue,
4- 'lumx-checkbox--is-unchecked': !lx.viewValue,
5- 'lumx-checkbox--theme-light': !lx.theme || lx.theme === 'light',
6- 'lumx-checkbox--theme-dark': lx.theme === 'dark',
7- 'lumx-custom-colors': lx.customColors } "
8- >
1+ < div class ="lumx-checkbox " ng-class ="lx.getClasses() ">
92 < div class ="lumx-checkbox__input-wrapper ">
103 < input
114 type ="checkbox "
You can’t perform that action at this time.
0 commit comments