@eturnity/eturnity_reusable_components 1.0.74 → 1.0.75

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.0.74",
3
+ "version": "1.0.75",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "dev": "vue-cli-service serve",
package/src/App.vue CHANGED
@@ -64,7 +64,7 @@ export default {
64
64
  number_max_allowed: 10,
65
65
  unit_short_name: "cm",
66
66
  },
67
- isChecked: false,
67
+ isChecked: true,
68
68
  listOptions: [
69
69
  {
70
70
  name: "Option 1",
@@ -12,12 +12,14 @@ const theme = {
12
12
  white: "#fff",
13
13
  blue: "#48a2d0",
14
14
  red: "#ff7e7e",
15
- disabled: "#c4c4c4",
16
15
  blue1: "#e4efff",
16
+ grey1: "#666",
17
+ grey2: "#c4c4c4",
17
18
  grey3: "#b2b9c5",
18
19
  grey4: "#ebeef4",
19
20
  grey5: "#fafafa",
20
21
  green: "#99db0c",
22
+ disabled: "#dfe1e1",
21
23
  },
22
24
  screen: {
23
25
  mobileSmall: "345px",
@@ -1,6 +1,6 @@
1
1
  <template>
2
2
  <container>
3
- <flex-wrapper :size="size" @click="onToggleChange">
3
+ <flex-wrapper :size="size" :disabled="disabled" @click="onToggleChange">
4
4
  <label-text v-if="labelAlign === 'left'" :size="size">{{
5
5
  label
6
6
  }}</label-text>
@@ -15,6 +15,7 @@
15
15
  <toggle-background
16
16
  :backgroundColor="backgroundColor"
17
17
  :isChecked="isChecked"
18
+ :disabled="disabled"
18
19
  />
19
20
  <toggle-dot
20
21
  :isChecked="isChecked"
@@ -54,7 +55,7 @@ const Container = styled.div`
54
55
  display: inline-block;
55
56
  `
56
57
 
57
- const flexAttrs = { size: String }
58
+ const flexAttrs = { size: String, disabled: Boolean }
58
59
  const FlexWrapper = styled("div", flexAttrs)`
59
60
  display: grid;
60
61
  grid-template-columns: auto 1fr;
@@ -65,7 +66,7 @@ const FlexWrapper = styled("div", flexAttrs)`
65
66
  ? "10px"
66
67
  : "20px"};
67
68
  align-items: center;
68
- cursor: pointer;
69
+ cursor: ${(props) => (props.disabled ? "not-allowed" : "pointer")};
69
70
  `
70
71
 
71
72
  const toggleAttrs = { size: String, fontColor: String, disabled: Boolean }
@@ -82,6 +83,8 @@ const LabelText = styled("div", toggleAttrs)`
82
83
 
83
84
  const ToggleWrapper = styled("span", toggleAttrs)`
84
85
  display: inline-block;
86
+ border: ${(props) =>
87
+ props.disabled ? "1px solid " + props.theme.colors.disabled : "none"}
85
88
  position: relative;
86
89
  cursor: ${(props) => (props.disabled ? "not-allowed" : "pointer")};
87
90
  width: ${(props) =>
@@ -108,14 +111,20 @@ const ToggleWrapper = styled("span", toggleAttrs)`
108
111
  }
109
112
  `
110
113
 
111
- const backgroundAttrs = { backgroundColor: String, isChecked: Boolean }
114
+ const backgroundAttrs = {
115
+ backgroundColor: String,
116
+ isChecked: Boolean,
117
+ disabled: Boolean,
118
+ }
112
119
  const ToggleBackground = styled("span", backgroundAttrs)`
113
120
  display: inline-block;
114
121
  border-radius: 100px;
115
122
  height: 100%;
116
123
  width: 100%;
117
124
  background-color: ${(props) =>
118
- props.isChecked
125
+ props.disabled
126
+ ? props.theme.colors.grey5
127
+ : props.isChecked
119
128
  ? props.backgroundColor
120
129
  ? props.backgroundColor
121
130
  : props.theme.colors.green