cja-phoenix 0.7.39 → 0.7.40

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.
@@ -81,7 +81,7 @@ const maskValue: MaskaDetail = reactive({
81
81
  completed: false,
82
82
  });
83
83
 
84
- const { value, errorMessage, meta, validate, handleBlur } = useField(
84
+ const { errorMessage, meta, validate, handleBlur } = useField(
85
85
  "input",
86
86
  props.validation,
87
87
  {
@@ -107,27 +107,15 @@ defineExpose({ errorMessage, meta, validate });
107
107
  }
108
108
  }
109
109
 
110
- &.size-sm {
111
- padding-right: $sm-padding-h * 2 + 10;
110
+ @each $size-name, $size in $input-sizes {
111
+ &.size-#{$size-name} {
112
+ padding-right: map.get($size, padding-h) * 2 + 10;
112
113
 
113
- + .input-currency {
114
- right: $sm-padding-h;
115
- }
116
- }
117
-
118
- &.size-md {
119
- padding-right: $md-padding-h * 2 + 10;
120
-
121
- + .input-currency {
122
- right: $md-padding-h;
123
- }
124
- }
125
-
126
- &.size-lg {
127
- padding-right: $lg-padding-h * 2 + 10;
128
-
129
- + .input-currency {
130
- right: $lg-padding-h;
114
+ + .input-currency {
115
+ right: map.get($size, padding-h);
116
+ font-size: map.get($size, font-size);
117
+ line-height: map.get($size, font-size);
118
+ }
131
119
  }
132
120
  }
133
121
  }
@@ -142,8 +130,8 @@ defineExpose({ errorMessage, meta, validate });
142
130
  position: absolute;
143
131
  top: 50%;
144
132
  transform: translateY(-50%);
145
- line-height: 12px;
146
- font-size: 12px;
133
+ font-weight: 700;
134
+ pointer-events: none;
147
135
  }
148
136
  }
149
137
  </style>
@@ -44,12 +44,13 @@ import { useField } from "vee-validate";
44
44
  import { TileOption } from "../../types/TileOption";
45
45
  import InputError from "./structure/InputError.vue";
46
46
  import InputContainer from "./structure/InputContainer.vue";
47
+ import { Icon } from "@/types/Icon";
47
48
 
48
49
  const props = withDefaults(
49
50
  defineProps<{
50
51
  options: TileOption[] | undefined;
51
52
  modelValue: any;
52
- icon?: string;
53
+ icon?: Icon;
53
54
  layout?: "list" | "grid" | "image";
54
55
  multiselect?: boolean;
55
56
  error?: string;
@@ -9,14 +9,27 @@
9
9
  }"
10
10
  >
11
11
  <input
12
- :class="[`size-${size}`]"
12
+ :class="[`size-${size}`, `icon-${iconPosition}`, { 'has-icon': icon }]"
13
13
  v-bind="{ id, inputmode, placeholder, type, disabled, autocomplete }"
14
14
  v-model="model"
15
15
  @blur="handleBlur($event, validationMode == 'blur')"
16
16
  ref="inputEl"
17
+ :style="inputStyles"
18
+ />
19
+
20
+ <div
21
+ class="input-icon"
22
+ :class="[icon, `icon-${iconPosition}`, `size-${size}`]"
23
+ ref="iconEl"
24
+ v-if="icon"
17
25
  />
18
26
 
19
- <div class="input-suffix" ref="suffixEl" v-if="suffix">
27
+ <div
28
+ class="input-suffix"
29
+ :class="[`size-${size}`]"
30
+ ref="suffixEl"
31
+ v-if="suffix && iconPosition != 'right'"
32
+ >
20
33
  {{ suffix }}
21
34
  </div>
22
35
  </div>
@@ -28,9 +41,11 @@
28
41
  <script lang="ts" setup>
29
42
  import { useField } from "vee-validate";
30
43
  import { InputHTMLAttributes, onMounted, ref } from "vue";
44
+ import { Icon } from "@/types/Icon";
31
45
  import InputTitle from "./structure/InputTitle.vue";
32
46
  import InputError from "./structure/InputError.vue";
33
47
  import InputContainer from "./structure/InputContainer.vue";
48
+ import { computed } from "vue";
34
49
 
35
50
  const props = withDefaults(
36
51
  defineProps<{
@@ -48,6 +63,8 @@ const props = withDefaults(
48
63
  type?: InputHTMLAttributes["type"];
49
64
  autocomplete?: InputHTMLAttributes["autocomplete"];
50
65
  suffix?: string;
66
+ icon?: Icon;
67
+ iconPosition?: "left" | "right";
51
68
  }>(),
52
69
  {
53
70
  layout: "vertical",
@@ -55,6 +72,7 @@ const props = withDefaults(
55
72
  type: "text",
56
73
  validationMode: "change",
57
74
  errorDisplay: true,
75
+ iconPosition: "left",
58
76
  }
59
77
  );
60
78
 
@@ -72,16 +90,27 @@ const { errorMessage, meta, handleBlur, validate } = useField(
72
90
  );
73
91
  const inputEl = ref();
74
92
  const suffixEl = ref();
75
-
76
- onMounted(() => {
77
- if (props.suffix) {
93
+ const iconEl = ref();
94
+ const inputStyles = computed(() => {
95
+ if (
96
+ window &&
97
+ props.suffix &&
98
+ inputEl.value &&
99
+ suffixEl.value &&
100
+ !(props.icon && props.iconPosition == "right")
101
+ ) {
78
102
  const inputPadding = parseInt(
79
- window.getComputedStyle(inputEl.value).getPropertyValue("padding-right")
103
+ window.getComputedStyle(inputEl.value).getPropertyValue("padding-left")
80
104
  );
105
+
81
106
  const suffixWidth = suffixEl.value.getBoundingClientRect().width;
82
107
 
83
- inputEl.value.style.paddingRight = `${suffixWidth + inputPadding * 2}px`;
108
+ return {
109
+ paddingRight: `${inputPadding * 2 + suffixWidth}px`,
110
+ };
84
111
  }
112
+
113
+ return {};
85
114
  });
86
115
 
87
116
  defineExpose({ errorMessage, meta, validate });
@@ -106,21 +135,15 @@ defineExpose({ errorMessage, meta, validate });
106
135
  }
107
136
  }
108
137
 
109
- &.size-sm {
110
- + .input-suffix {
111
- right: $sm-padding-h;
112
- }
113
- }
114
-
115
- &.size-md {
116
- + .input-suffix {
117
- right: $md-padding-h;
118
- }
119
- }
120
-
121
- &.size-lg {
122
- + .input-suffix {
123
- right: $lg-padding-h;
138
+ &.has-icon {
139
+ @each $position in ("left", "right") {
140
+ &.icon-#{$position} {
141
+ @each $size-name, $size in $input-sizes {
142
+ &.size-#{$size-name} {
143
+ padding-#{$position}: map.get($size, padding-h) * 2 + 16px;
144
+ }
145
+ }
146
+ }
124
147
  }
125
148
  }
126
149
  }
@@ -135,8 +158,36 @@ defineExpose({ errorMessage, meta, validate });
135
158
  position: absolute;
136
159
  top: 50%;
137
160
  transform: translateY(-50%);
138
- line-height: 12px;
139
- font-size: 12px;
161
+ font-weight: 700;
162
+ pointer-events: none;
163
+
164
+ @each $size-name, $size in $input-sizes {
165
+ &.size-#{$size-name} {
166
+ right: map.get($size, padding-h);
167
+ font-size: map.get($size, font-size);
168
+ line-height: map.get($size, font-size);
169
+ }
170
+ }
171
+ }
172
+
173
+ .input-icon {
174
+ position: absolute;
175
+ top: 50%;
176
+ transform: translateY(-50%);
177
+ pointer-events: none;
178
+
179
+ @each $size-name, $size in $input-sizes {
180
+ &.size-#{$size-name} {
181
+ font-size: map.get($size, font-size);
182
+ line-height: map.get($size, font-size);
183
+
184
+ @each $position in ("left", "right") {
185
+ &.icon-#{$position} {
186
+ #{$position}: map.get($size, padding-h);
187
+ }
188
+ }
189
+ }
190
+ }
140
191
  }
141
192
  }
142
193
  </style>
@@ -23,6 +23,7 @@
23
23
  <script lang="ts" setup>
24
24
  import { AnchorHTMLAttributes } from "vue";
25
25
  import Scaffold from "./Scaffold.vue";
26
+ import { Icon } from "@/types/Icon";
26
27
 
27
28
  withDefaults(
28
29
  defineProps<{
@@ -30,7 +31,7 @@ withDefaults(
30
31
  color?: "blue" | "orange" | "white" | "extra-light-blue";
31
32
  size?: "sm" | "md" | "lg";
32
33
  shadow?: boolean;
33
- icon?: string;
34
+ icon?: Icon;
34
35
  iconPosition?: "left" | "right" | "only";
35
36
  loading?: boolean;
36
37
  href?: AnchorHTMLAttributes["href"];
@@ -1,32 +1,18 @@
1
1
  <template>
2
- <div :class="[`grid-container-${size}`]">
2
+ <div class="grid-container">
3
3
  <slot></slot>
4
4
  </div>
5
5
  </template>
6
6
 
7
- <script lang="ts" setup>
8
- withDefaults(
9
- defineProps<{
10
- size?: 1 | 2 | 3;
11
- }>(),
12
- {
13
- size: 1,
14
- }
15
- );
16
- </script>
17
-
18
7
  <style lang="scss" scoped>
19
- @import "@/assets/variables/grid";
20
-
21
- .grid-container-1,
22
- .grid-container-2,
23
- .grid-container-3 {
8
+ .grid-container {
24
9
  display: grid;
10
+ grid-template-columns: $grid-columns-sm;
25
11
  column-gap: $grid-column-gap-sm;
26
12
  padding-left: $grid-side-padding-sm;
27
13
  padding-right: $grid-side-padding-sm;
28
14
 
29
- @media screen and (min-width: $break-md-min) and (max-width: $break-md-max) {
15
+ @media screen and (min-width: $break-md-min) {
30
16
  grid-template-columns: $grid-columns-md;
31
17
  column-gap: $grid-column-gap-md;
32
18
  padding-left: $grid-side-padding-md;
@@ -48,22 +34,4 @@ withDefaults(
48
34
  margin-right: auto;
49
35
  }
50
36
  }
51
-
52
- .grid-container-1 {
53
- @media screen and (max-width: $break-sm-max) {
54
- grid-template-columns: $grid-columns-sm-1;
55
- }
56
- }
57
-
58
- .grid-container-2 {
59
- @media screen and (max-width: $break-sm-max) {
60
- grid-template-columns: $grid-columns-sm-2;
61
- }
62
- }
63
-
64
- .grid-container-3 {
65
- @media screen and (max-width: $break-sm-max) {
66
- grid-template-columns: $grid-columns-sm-3;
67
- }
68
- }
69
37
  </style>
@@ -37,8 +37,6 @@ withDefaults(
37
37
  </script>
38
38
 
39
39
  <style lang="scss" scoped>
40
- @import "@/assets/variables/grid";
41
-
42
40
  @for $i from 1 to 5 {
43
41
  .grid-item-sm-#{$i} {
44
42
  @media screen and (max-width: $break-sm-max) {