@eturnity/eturnity_reusable_components 1.2.31-3d-master.6 → 1.2.31-3d-master.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eturnity/eturnity_reusable_components",
3
- "version": "1.2.31-3d-master.6",
3
+ "version": "1.2.31-3d-master.8",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "dev": "vue-cli-service serve",
package/src/App.vue CHANGED
@@ -53,6 +53,83 @@
53
53
  </div>
54
54
  </template>
55
55
  </input-number>
56
+ <Select
57
+ selectWidth="100%"
58
+ optionWidth="50%"
59
+ label="that is a label"
60
+ alignItems="vertical"
61
+ colorMode="light"
62
+ >
63
+ <template #selector="{selectedValue}">
64
+ value selected: {{selectedValue}}
65
+ </template>
66
+ <template #dropdown>
67
+ <Option value="1">value one</Option>
68
+ <Option value="2">value two</Option>
69
+ <Option value="3">value three</Option>
70
+ <Option value="4">value four</Option>
71
+ </template>
72
+ </Select>
73
+ <Select
74
+ selectWidth="100%"
75
+ optionWidth="50%"
76
+ label="that is a label"
77
+ alignItems="vertical"
78
+ >
79
+ <template #selector="{selectedValue}">
80
+ value selected: {{selectedValue}}
81
+ </template>
82
+ <template #dropdown>
83
+ <Option value="1">value one</Option>
84
+ <Option value="2">value two</Option>
85
+ <Option value="3">value three</Option>
86
+ <Option value="4">value four</Option>
87
+ </template>
88
+ </Select>
89
+ <Select
90
+ selectWidth="100%"
91
+ optionWidth="50%"
92
+ label="that is a label"
93
+ alignItems="vertical"
94
+ colorMode="dark"
95
+ >
96
+ <template #selector="{selectedValue}">
97
+ value selected: {{selectedValue}}
98
+ </template>
99
+ <template #dropdown>
100
+ <Option value="1">value one</Option>
101
+ <Option value="2">value two</Option>
102
+ <Option value="3">value three</Option>
103
+ <Option value="4">value four</Option>
104
+ </template>
105
+ </Select>
106
+ <hr>
107
+ <SwitchField
108
+ @on-switch-change="onInputChange($event)"
109
+ :options="[{value:0,content:'zero'},{value:1,content:'one'},{value:2,content:'two'}]"
110
+ :value="1"
111
+ label="label"
112
+ toggleColor="red"
113
+ size="large"
114
+ backgroundColor="blue"
115
+ labelAlign="left"
116
+ fontColor="black"
117
+ :disabled="false"
118
+ />
119
+ <div :style="{padding:'50px',backgroundColor:'#1e1e1e'}">
120
+ <SwitchField
121
+ @on-switch-change="onInputChange($event)"
122
+ :options="[{value:'test',content:'zero'},{value:'1',content:'one'},{value:'2',content:'two'}]"
123
+ value='test'
124
+ label="label"
125
+ toggleColor="red"
126
+ size="large"
127
+ backgroundColor="blue"
128
+ labelAlign="left"
129
+ colorMode="dark"
130
+ alignItems="vertical"
131
+ />
132
+ </div>
56
133
  </div>
57
134
  </modal>
58
135
  </page-container>
@@ -64,7 +141,11 @@ import { ThemeProvider } from "vue-styled-components"
64
141
  import theme from "./assets/theme"
65
142
  import styled from "vue-styled-components"
66
143
  import InputNumber from "@/components/inputs/inputNumber"
144
+ import Select from "@/components/inputs/select"
145
+ import Option from "@/components/inputs/select/option"
67
146
  import Modal from "@/components/modals/modal"
147
+ import SwitchField from "@/components/inputs/switchField"
148
+
68
149
  // import TableDropdown from "@/components/tableDropdown"
69
150
 
70
151
  const PageContainer = styled.div`
@@ -83,12 +164,16 @@ export default {
83
164
  ThemeProvider,
84
165
  PageContainer,
85
166
  InputNumber,
86
- Modal
167
+ Modal,
168
+ Option,
169
+ Select,
170
+ SwitchField
87
171
  },
88
172
  data() {
89
173
  return {
90
174
  value:42,
91
- value2:42
175
+ value2:42,
176
+ companyName:"toto"
92
177
  }
93
178
  },
94
179
  methods: {
@@ -5,7 +5,7 @@
5
5
  </label-slot-wrapper>
6
6
 
7
7
  <label-wrapper v-if="labelText">
8
- <label-text>
8
+ <label-text :labelFontColor="labelFontColor">
9
9
  {{ labelText }}
10
10
  </label-text>
11
11
  <info-text
@@ -113,7 +113,8 @@ const inputProps = {
113
113
  slotSize: String,
114
114
  inputHeight:String,
115
115
  isInteractive:Boolean,
116
- alignItems:String
116
+ alignItems:String,
117
+ labelFontColor:String
117
118
  }
118
119
 
119
120
  const Container = styled('div', inputProps)`
@@ -238,9 +239,9 @@ const LabelSlotWrapper = styled('div',inputProps)`
238
239
  cursor: ${(props) => (props.isInteractive?'ew-resize':'auto')};
239
240
  `
240
241
 
241
- const LabelText = styled.div`
242
+ const LabelText = styled('div',inputProps)`
242
243
  font-size: 13px;
243
- color: ${(props) => props.theme.colors.eturnityGrey};
244
+ color: ${(props) => props.theme.colors[props.labelFontColor]?props.theme.colors[props.labelFontColor]:props.labelFontColor};
244
245
  font-weight: 700;
245
246
  `
246
247
 
@@ -389,6 +390,10 @@ export default {
389
390
  },
390
391
  slotSize: {
391
392
  required: false
393
+ },
394
+ labelFontColor:{
395
+ required:false,
396
+ default:'eturnityGrey'
392
397
  }
393
398
  },
394
399
  computed: {
@@ -0,0 +1,275 @@
1
+ <template>
2
+ <Container
3
+ :selectWidth="selectWidth"
4
+ v-click-outside="closeDropdown"
5
+ @mouseenter="mouseEnterHandler"
6
+ @mouseleave="mouseLeaveHandler"
7
+ >
8
+ <input-wrapper
9
+ :hasLabel="!!label && label.length > 0"
10
+ :alignItems="alignItems"
11
+ >
12
+ <label-wrapper v-if="label" >
13
+ <input-label
14
+ :fontColor="labelFontColor || colorMode=='dark'?'white':'eturnityGrey'"
15
+ :fontSize="fontSize">{{ label }}</input-label>
16
+ <info-text
17
+ v-if="infoTextMessage"
18
+ :text="infoTextMessage"
19
+ borderColor="#ccc"
20
+ :size="fontSize ? fontSize : '16px'"
21
+ :alignText="infoTextAlign"
22
+ />
23
+ </label-wrapper>
24
+ <div>
25
+ <selectButton
26
+ @click="toggleDropdown"
27
+ :isActive="isActive"
28
+ :bgColor="buttonBgColor || colorMode=='dark'?'transparentBlack1':'white'"
29
+ :fontColor="buttonFontColor || colorMode=='dark'?'white':'black'"
30
+
31
+ >
32
+ <slot name="selector" :selectedValue="selectedValue"></slot>
33
+ <Caret :isUp="isDropdownOpen">
34
+ <icon name="arrow_up" size="12px" :color="caretColor || colorMode=='dark'?'white':'transparentBlack1'"/>
35
+ </Caret>
36
+ </selectButton>
37
+ <DropdownWrapper>
38
+ <selectDropdown
39
+ v-if="isDropdownOpen"
40
+ :isActive="isActive"
41
+ :optionWidth="optionWidth"
42
+ :bgColor="dropdownBgColor || colorMode=='dark'?'black':'white'"
43
+ :fontColor="dropdownFontColor || colorMode=='dark'?'white':'black'"
44
+ @option-selected="optionSelected">
45
+ <slot name="dropdown"></slot>
46
+ </selectDropdown>
47
+ </DropdownWrapper>
48
+ </div>
49
+ </input-wrapper>
50
+ </Container>
51
+ </template>
52
+
53
+ <script>
54
+ //How to use it
55
+ // <Select
56
+ // hoverDropdown="true"
57
+ // selectWidth="100%"
58
+ // optionWidth="50%"
59
+ // label="that is a label"
60
+ // alignItems="vertical"
61
+ // >
62
+ // <template #selector="{selectedValue}">
63
+ // value selected: {{selectedValue}}
64
+ // </template>
65
+ // <template #dropdown>
66
+ // <Option value="1">value one</Option>
67
+ // <Option value="2">value two</Option>
68
+ // <Option value="3">value three</Option>
69
+ // <Option value="4">value four</Option>
70
+ // </template>
71
+ // </Select>
72
+
73
+ import styled from 'vue-styled-components'
74
+ import InfoText from '../../infoText'
75
+ import icon from '../../icon'
76
+
77
+ const caretAttrs={isUp:Boolean}
78
+ const Caret=styled('div', caretAttrs)`
79
+ position:absolute;
80
+ display:flex;
81
+ align-items:center;
82
+ height:100%;
83
+ right:15px;
84
+ top:-2px
85
+ transform: ${props=>!props.isUp?"rotate(180deg)":""};
86
+ transform-origin: center;
87
+ `
88
+
89
+ const labelAttrs = { fontSize: String }
90
+ const InputLabel = styled('div', labelAttrs)`
91
+ color:${(props) => props.theme.colors[props.fontColor]?props.theme.colors[props.fontColor]:props.fontColor};
92
+ font-size: ${(props) => (props.fontSize ? props.fontSize : '13px')};
93
+ font-weight: 700;
94
+ `
95
+ const inputProps={selectWidth: String, optionWidth: String}
96
+ const Container = styled('div', inputProps)`
97
+ width: ${(props) => (props.selectWidth ? props.selectWidth : '100%')};
98
+ position: relative;
99
+ display: inline-block;
100
+ `
101
+ const LabelWrapper = styled.div`
102
+ display: inline-grid;
103
+ grid-template-columns: auto auto;
104
+ grid-gap: 12px;
105
+ align-items: center;
106
+ justify-content: start;
107
+ `
108
+ const selectButtonAttrs={bgColor:String,fontColor:String,isActive:Boolean}
109
+ const selectButton = styled('div',selectButtonAttrs)`
110
+ position:relative;
111
+ box-sizing: border-box;
112
+ border:1px solid red;
113
+ border-radius:4px;
114
+ padding:10px 15px;
115
+ text-align:left;
116
+ border-radius:4px;
117
+ min-height:36px;
118
+ display: flex;
119
+ align-items: center;
120
+ border:1px solid ${(props)=>props.theme.colors.grey4}
121
+ background-color:${(props) => props.theme.colors[props.bgColor]?props.theme.colors[props.bgColor]:props.bgColor};
122
+ color:${(props) => props.theme.colors[props.fontColor]?props.theme.colors[props.fontColor]:props.fontColor};
123
+ `
124
+ const selectDropdownAttrs={bgColor:String,fontColor:String,selectWidth: String, optionWidth: String}
125
+ const selectDropdown = styled('div',selectDropdownAttrs)`
126
+ box-sizing: border-box;
127
+ z-index:${props=>props.isActive?'2':'1'};
128
+ position:absolute;
129
+ top:5px;
130
+ padding:10px;
131
+ border:1px solid ${(props)=>props.theme.colors.grey4}
132
+ border-radius:4px;
133
+ display: flex;
134
+ flex-direction: column;
135
+ align-items: flex-start;
136
+ padding: 0px;
137
+ box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
138
+ width: ${(props) => (props.optionWidth ? props.optionWidth : '100%')};
139
+ background-color:${(props) => props.theme.colors[props.bgColor]?props.theme.colors[props.bgColor]:props.bgColor};
140
+ color:${(props) => props.theme.colors[props.fontColor]?props.theme.colors[props.fontColor]:props.fontColor};
141
+ max-height:300px;
142
+ overflow-y:scroll;
143
+ `
144
+ const DropdownWrapper=styled('div')`
145
+ position:relative;
146
+ `
147
+ const inputAttrs = { alignItems: String, hasLabel: Boolean }
148
+ const InputWrapper = styled('div', inputAttrs)`
149
+ position: relative;
150
+ display: grid;
151
+ align-items: center;
152
+ gap: 8px;
153
+ grid-template-columns: ${(props) =>
154
+ props.alignItems === 'vertical' || !props.hasLabel ? '1fr' : 'auto 1fr'};
155
+ `
156
+ export default {
157
+ name: 'RCselect',
158
+
159
+ props: {
160
+ value:{
161
+ required:false,
162
+ default: null
163
+ },
164
+ fontSize:{
165
+ required:false,
166
+ default: null
167
+ },
168
+ label:{
169
+ required:false
170
+ },
171
+ infoTextMessage:{
172
+ required:false
173
+ },
174
+ infoTextAlign:{
175
+ required:false
176
+ },
177
+ selectWidth: {
178
+ required: false,
179
+ default: null
180
+ },
181
+ optionWidth: {
182
+ required: false,
183
+ default: null
184
+ },
185
+ hoverDropdown: {
186
+ required: false,
187
+ default: false
188
+ },
189
+ alignItems:{
190
+ required: false,
191
+ default: 'horizontal'
192
+ },
193
+ buttonBgColor:{
194
+ required: false,
195
+ },
196
+ buttonFontColor:{
197
+ required: false,
198
+ },
199
+ dropdownBgColor:{
200
+ required: false,
201
+ },
202
+ dropdownFontColor:{
203
+ required: false,
204
+ },
205
+ caretColor:{
206
+ required:false,
207
+ },
208
+ labelFontColor:{
209
+ required:false
210
+ },
211
+ colorMode:{
212
+ required:false,
213
+ default:'light'
214
+ }
215
+ },
216
+
217
+ components: {
218
+ selectButton,
219
+ selectDropdown,
220
+ Container,
221
+ InputLabel,
222
+ LabelWrapper,
223
+ InfoText,
224
+ InputWrapper,
225
+ DropdownWrapper,
226
+ icon,
227
+ Caret
228
+ },
229
+
230
+ data() {
231
+ return {
232
+ selectedValue: null,
233
+ isDropdownOpen:false,
234
+ isActive:false,
235
+ }
236
+ },
237
+ created(){
238
+ this.selectedValue=this.value
239
+ },
240
+ methods:{
241
+ focus(){
242
+ this.isActive=true
243
+ },
244
+ blur(){
245
+ this.isActive=false
246
+ },
247
+ toggleDropdown(){
248
+ this.focus()
249
+ this.isDropdownOpen=!this.isDropdownOpen
250
+ },
251
+ closeDropdown(){
252
+ this.blur()
253
+ this.isDropdownOpen=false
254
+ },
255
+ optionSelected(e){
256
+ this.selectedValue=e
257
+ this.closeDropdown()
258
+ this.blur()
259
+ this.$emit('input-change',e)
260
+ },
261
+ mouseEnterHandler(){
262
+ this.focus()
263
+ if(this.hoverDropdown){
264
+ this.isDropdownOpen=true
265
+ }
266
+ },
267
+ mouseLeaveHandler(){
268
+ this.blur()
269
+ },
270
+ },
271
+ computed: {
272
+ }
273
+ }
274
+ </script>
275
+
@@ -0,0 +1,57 @@
1
+ <template>
2
+ <optionContainer :hoveredBgColor="hoveredBgColor || colorMode=='dark'?'#000000':'grey5'" @click="clickHandler">
3
+ <slot></slot>
4
+ </optionContainer>
5
+ </template>
6
+
7
+ <script>
8
+ // import selectButton from './selectButton'
9
+ // import selectDropdown from './selectDropDown'
10
+ import styled from 'vue-styled-components'
11
+ const optionProps={hoveredBgColor:String}
12
+ const optionContainer = styled('div',optionProps)`
13
+ display:flex;
14
+ cursor: pointer;
15
+ flex-direction: row;
16
+ justify-content: space-between;
17
+ align-items: center;
18
+ padding: 12px 15px;
19
+ gap: 14px;
20
+ width:100%;
21
+ box-sizing:inherit;
22
+ &:hover{
23
+ background-color:${(props) => props.theme.colors[props.hoveredBgColor]?props.theme.colors[props.hoveredBgColor]:props.hoveredBgColor};
24
+ }
25
+ `
26
+
27
+ export default {
28
+ name: 'RCoption',
29
+
30
+ props: {
31
+ value: {
32
+ required: true
33
+ },
34
+ hoveredBgColor:{
35
+ required:false,
36
+ },
37
+ colorMode:{
38
+ required:false,
39
+ default:'light'
40
+ }
41
+ },
42
+
43
+ components: {optionContainer},
44
+
45
+ data() {
46
+ return {}
47
+ },
48
+ methods:{
49
+ clickHandler(){
50
+ this.$parent.$emit('option-selected',this.value)
51
+ }
52
+ },
53
+ computed: {
54
+ }
55
+ }
56
+ </script>
57
+
@@ -0,0 +1,59 @@
1
+ import Select from "./index.vue"
2
+ import Option from "./option/index.vue"
3
+
4
+ export default {
5
+ title: "select",
6
+ component: Select,
7
+ // argTypes: {},
8
+ }
9
+
10
+ const Template = (args, { argTypes }) => ({
11
+ // Components used in your story `template` are defined in the `components` object
12
+ components: { Select,Option },
13
+ // The story's `args` need to be mapped into the template through the `setup()` method
14
+ props: Object.keys(argTypes),
15
+ template: `<Select v-bind="$props">
16
+ <template #selector="{selectedValue}">
17
+ value selected: {{selectedValue}}
18
+ </template>
19
+ <template #dropdown>
20
+ <Option value="1">value one</Option>
21
+ <Option value="2">value two</Option>
22
+ <Option value="3">value three</Option>
23
+ <Option value="4">value four</Option>
24
+ </template>
25
+ </Select>`,
26
+
27
+ // import Select from "@eturnity/eturnity_reusable_components/src/components/inputs/select"
28
+ // import Option from "@eturnity/eturnity_reusable_components/src/components/inputs/select/option"
29
+ // To use:
30
+ // How to use it
31
+ // <Select
32
+ // hoverDropdown="true"
33
+ // selectWidth="100%"
34
+ // optionWidth="50%"
35
+ // label="that is a label"
36
+ // alignItems="vertical"
37
+ // >
38
+ // <template #selector="{selectedValue}">
39
+ // value selected: {{selectedValue}}
40
+ // </template>
41
+ // <template #dropdown>
42
+ // <Option value="1">value one</Option>
43
+ // <Option value="2">value two</Option>
44
+ // <Option value="3">value three</Option>
45
+ // <Option value="4">value four</Option>
46
+ // </template>
47
+ // </Select>
48
+ })
49
+
50
+ export const Default = Template.bind({})
51
+ Default.args = {
52
+ hoverDropdown="true"
53
+ selectWidth="100%"
54
+ optionWidth="50%"
55
+ label="that is a label"
56
+ alignItems="vertical"
57
+ value="2"
58
+ }
59
+
@@ -0,0 +1,239 @@
1
+ <template>
2
+ <container>
3
+ <flex-wrapper :size="size" :disabled="disabled" :alignItems="alignItems" :label="label">
4
+ <label-container
5
+ v-if="label && labelAlign === 'left'"
6
+ :hasInfoMessage="!!infoTextMessage"
7
+ :colorMode="colorMode"
8
+ >
9
+ <label-text :size="size">{{ label }}</label-text>
10
+ <info-text
11
+ v-if="infoTextMessage"
12
+ :text="infoTextMessage"
13
+ borderColor="#ccc"
14
+ size="14px"
15
+ :alignText="infoTextAlign"
16
+ />
17
+ </label-container>
18
+
19
+ <switch-wrapper
20
+ :size="size"
21
+ :disabled="disabled"
22
+ :backgroundColor="backgroundColor"
23
+ >
24
+ <switchOption
25
+ v-for="(item,index) in options"
26
+ :key="index"
27
+ @click="selectItem(item.value)"
28
+ :isActive="selectedValue==item.value"
29
+ :colorMode="colorMode"
30
+ :primaryColor="primaryColor"
31
+ :secondaryColor="secondaryColor"
32
+ :inactiveColor="inactiveColor"
33
+ >
34
+ {{ item.content }}
35
+ </switchOption>
36
+ </switch-wrapper>
37
+ <label-container
38
+ v-if="label && labelAlign === 'right'"
39
+ :hasInfoMessage="!!infoTextMessage"
40
+ >
41
+ <label-text :size="size" :fontColor="fontColor">{{ label }}</label-text>
42
+ <info-text
43
+ @click.native.stop
44
+ v-if="infoTextMessage"
45
+ :text="infoTextMessage"
46
+ borderColor="#ccc"
47
+ size="14px"
48
+ :alignText="infoTextAlign"
49
+ />
50
+ </label-container>
51
+ </flex-wrapper>
52
+ </container>
53
+ </template>
54
+
55
+ <script>
56
+ // import Toggle from "@eturnity/eturnity_reusable_components/src/components/inputs/toggle"
57
+ // To use:
58
+ // <SwitchField
59
+ // @on-switch-change="onInputChange($event)"
60
+ // :options="[{value:0,content:'zero'},{value:1,content:'one'},{value:2,content:'two'}]"
61
+ // :value="1"
62
+ // label="label"
63
+ // toggleColor="red"
64
+ // size="large"
65
+ // backgroundColor="blue"
66
+ // labelAlign="left"
67
+ // fontColor="black"
68
+ // :disabled="false"
69
+ // />
70
+
71
+ import styled from "vue-styled-components"
72
+ import InfoText from "../../infoText"
73
+ import theme from "../../../assets/theme"
74
+ const Container = styled.div`
75
+ display: inline-block;
76
+ `
77
+
78
+ const flexAttrs = { label:String,size: String, disabled: Boolean,alignItems: String }
79
+ const FlexWrapper = styled("div", flexAttrs)`
80
+ display: grid;
81
+ grid-template-columns: auto 1fr;
82
+ grid-gap: 10px;
83
+ align-items: center;
84
+ cursor: ${(props) => (props.disabled ? "not-allowed" : "pointer")};
85
+ grid-template-columns: ${(props) =>
86
+ props.alignItems === 'vertical' || !props.label ? '1fr' : 'auto 1fr'};
87
+ `
88
+
89
+ const toggleAttrs = {
90
+ size: String,
91
+ fontColor: String,
92
+ disabled: Boolean,
93
+ backgroundColor: String,
94
+ isChecked: Boolean,
95
+ }
96
+ const LabelText = styled("div", toggleAttrs)`
97
+ color: white;
98
+ font-size: 13px;
99
+ font-family: 'Lato-Bold',Arial;
100
+ `
101
+
102
+ const SwitchWrapper = styled("span", toggleAttrs)`
103
+ display: flex;
104
+ position: relative;
105
+ cursor: ${(props) => (props.disabled ? "not-allowed" : "pointer")};
106
+ height: ${(props) =>
107
+ props.size === "medium"
108
+ ? "24px"
109
+ : props.size === "small"
110
+ ? "16px"
111
+ : "24px"};
112
+ `
113
+ const optionAttrs={isActive:Boolean,primaryColor:String,secondaryColor:String,inactiveColor:String}
114
+ const switchOption=styled('div',optionAttrs)`
115
+ color:${props=>props.isActive?props.primaryColor:props.inactiveColor};
116
+ background-color:${props=>props.isActive?props.secondaryColor:"transparent"};
117
+ border:1px solid ${props=>props.isActive?props.secondaryColor:props.inactiveColor};
118
+ display:flex;
119
+ align-items:center;
120
+ font-size: 14px;
121
+ line-height: 1;
122
+ text-align: center;
123
+ padding: 10px;
124
+ margin-right: -1px;
125
+ transition: all 0.1s ease-in-out;
126
+ overflow:hidden;
127
+ & :hover{
128
+ cursor: pointer;
129
+ }
130
+ &:first-child {
131
+ border-radius: 4px 0 0 4px;
132
+ }
133
+ &:last-child {
134
+ border-radius: 0 4px 4px 0;
135
+ }
136
+
137
+ `
138
+
139
+ const labelAttrs = { hasInfoMessage: Boolean }
140
+ const LabelContainer = styled("div", labelAttrs)`
141
+ display: inline-grid;
142
+ grid-template-columns: ${(props) =>
143
+ props.hasInfoMessage ? "auto 1fr" : "auto"};
144
+ grid-gap: 12px;
145
+ align-items: center;
146
+ `
147
+
148
+ export default {
149
+ name: "switchField",
150
+ components: {
151
+ Container,
152
+ SwitchWrapper,
153
+ FlexWrapper,
154
+ LabelText,
155
+ InfoText,
156
+ LabelContainer,
157
+ switchOption,
158
+ },
159
+ props: {
160
+ label: {
161
+ required: false,
162
+ default: "",
163
+ },
164
+ toggleColor: {
165
+ required: false,
166
+ },
167
+ backgroundColor: {
168
+ required: false,
169
+ },
170
+ size: {
171
+ required: false,
172
+ default: "small",
173
+ },
174
+ labelAlign: {
175
+ required: false,
176
+ default: "left",
177
+ },
178
+ fontColor: {
179
+ required: false,
180
+ },
181
+ disabled: {
182
+ required: false,
183
+ default: false,
184
+ },
185
+ infoTextMessage: {
186
+ required: false,
187
+ },
188
+ infoTextAlign: {
189
+ required: false,
190
+ },
191
+ colorMode: {
192
+ required: false,
193
+ default:'light'
194
+ },
195
+ alignItems:{
196
+ required: false,
197
+ default: 'horizontal'
198
+ },
199
+ options:{
200
+ required:true
201
+ },
202
+ value:{
203
+ required:false,
204
+ default:null
205
+ },
206
+ },
207
+ data() {
208
+ return {
209
+ selectedValue:null,
210
+ primaryColor:"white",
211
+ secondaryColor:"black",
212
+ inactiveColor:"grey6"
213
+ }
214
+ },
215
+ created(){
216
+ this.selectedValue=this.value
217
+
218
+ if(this.colorMode=='dark'){
219
+ this.primaryColor=theme.colors.black
220
+ this.secondaryColor=theme.colors.white
221
+ this.inactiveColor=theme.colors.grey6
222
+ }else{
223
+ this.primaryColor=theme.colors.white
224
+ this.secondaryColor=theme.colors.black
225
+ this.inactiveColor=theme.colors.grey6
226
+ }
227
+ },
228
+ methods: {
229
+ selectItem(value){
230
+ if (this.disabled) {
231
+ return
232
+ }
233
+ this.selectedValue=value
234
+ this.$emit("on-switch-change", this.selectedValue)
235
+ },
236
+ },
237
+ }
238
+ </script>
239
+