1+ import * as icons from '@cloudblueconnect/material-svg' ;
12import Button from '~widgets/button/widget.vue' ;
23import registerWidget from '~core/registerWidget' ;
34
45registerWidget ( 'ui-button' , Button ) ;
56
6- export const Component = {
7+ export const Base = {
8+ name : 'Base component' ,
79 render : ( args ) => ( {
810 setup ( ) {
9- return { args } ;
11+ const showAlert = ( ) => alert ( 'The button was clicked' ) ;
12+ return { args, showAlert } ;
1013 } ,
11- template : ` <ui-button disabled v-bind="args"></ui-button>` ,
14+ template : ' <ui-button v-bind="args" @clicked="showAlert" />' ,
1215 } ) ,
16+ args : {
17+ mode : 'solid' ,
18+ size : 'large' ,
19+ label : 'Accept' ,
20+ icon : 'googleCheckBaseline' ,
21+ iconRight : '' ,
22+ color : '#2C98F0' ,
23+ progress : false ,
24+ lowerCase : false ,
25+ onlyIcon : false ,
26+ disabled : false ,
27+ } ,
28+ } ;
1329
30+ export const Slotted = {
31+ name : 'Using the default slot' ,
32+ render : ( args ) => ( {
33+ setup ( ) {
34+ const showAlert = ( ) => alert ( 'The button was clicked' ) ;
35+ return { args, showAlert } ;
36+ } ,
37+ template :
38+ '<ui-button v-bind="args" @clicked="showAlert"><pre style="background-color:darkblue;color:lightcyan;font-style:italic;">Custom slot content</pre></ui-button>' ,
39+ } ) ,
1440 args : {
15- text : 'Text' ,
41+ ...Base . args ,
42+ label : '' ,
1643 } ,
1744} ;
1845
@@ -23,6 +50,25 @@ export default {
2350 layout : 'centered' ,
2451 } ,
2552 argTypes : {
26- text : 'text' ,
53+ mode : { control : 'radio' , options : [ 'solid' , 'flat' , 'outlined' ] } ,
54+ size : { control : 'radio' , options : [ 'small' , 'large' ] } ,
55+ label : 'text' ,
56+ icon : {
57+ options : Object . keys ( icons ) ,
58+ control : {
59+ type : 'select' ,
60+ } ,
61+ } ,
62+ iconRight : {
63+ options : Object . keys ( icons ) ,
64+ control : {
65+ type : 'select' ,
66+ } ,
67+ } ,
68+ color : 'text' ,
69+ progress : 'boolean' ,
70+ lowerCase : 'boolean' ,
71+ onlyIcon : 'boolean' ,
72+ disabled : 'boolean' ,
2773 } ,
2874} ;
0 commit comments