srcdev-nuxt-forms 2.1.10 → 2.1.12

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.
@@ -11,5 +11,5 @@
11
11
  --green-9: #2b8a3e;
12
12
  --green-10: #237032;
13
13
  --green-11: #1b5727;
14
- --green-12: #00a21e;
14
+ --green-12: #017f18;
15
15
  }
@@ -11,5 +11,5 @@
11
11
  --orange-9: #d9480f;
12
12
  --orange-10: #bf400d;
13
13
  --orange-11: #99330b;
14
- --orange-12: #db3e00;
14
+ --orange-12: #c23903;
15
15
  }
@@ -1,6 +1,9 @@
1
1
  <template>
2
2
  <div class="input-checkbox-wrapper" :data-form-theme="formTheme" :class="[size, { error: fieldHasError }]">
3
- <Icon v-show="isChecked" name="material-symbols:check-small" class="input-checkbox-decorator" />
3
+ <slot name="checkedIcon" v-if="isChecked">
4
+ <Icon name="material-symbols:check-small" class="input-checked-icon" />
5
+ </slot>
6
+
4
7
  <input
5
8
  type="checkbox"
6
9
  :true-value="trueValue"
@@ -19,7 +22,7 @@
19
22
 
20
23
  <script setup lang="ts">
21
24
  import propValidators from '../c12/prop-validators';
22
- const { id, name, required, trueValue, falseValue, multipleOptions, theme, styleClassPassthrough, size, stateIcon, fieldHasError } = defineProps({
25
+ const { id, name, required, trueValue, falseValue, multipleOptions, theme, styleClassPassthrough, size, fieldHasError } = defineProps({
23
26
  id: {
24
27
  type: String,
25
28
  required: true,
@@ -58,13 +61,6 @@ const { id, name, required, trueValue, falseValue, multipleOptions, theme, style
58
61
  return propValidators.size.includes(value);
59
62
  },
60
63
  },
61
- stateIcon: {
62
- type: Object as PropType<{ checked: string; unchecked: string }>,
63
- default: {
64
- checked: 'carbon:checkbox-checked',
65
- unchecked: 'carbon:checkbox',
66
- },
67
- },
68
64
  fieldHasError: {
69
65
  type: Boolean,
70
66
  default: false,
@@ -94,13 +90,9 @@ const isChecked = computed(() => {
94
90
  return modelValue.value === trueValue;
95
91
  }
96
92
  });
97
-
98
- const icon = computed(() => {
99
- return isChecked.value ? stateIcon.checked : stateIcon.unchecked;
100
- });
101
93
  </script>
102
94
 
103
- <style scoped lang="css">
95
+ <style lang="css">
104
96
  .input-checkbox-wrapper {
105
97
  --_checkbox-size: initial;
106
98
  --_outline-width: var(--input-outline-width-thin);
@@ -143,7 +135,7 @@ const icon = computed(() => {
143
135
  --_checkbox-size: 44px;
144
136
  }
145
137
 
146
- .input-checkbox-decorator {
138
+ .input-checked-icon {
147
139
  grid-area: element-stack;
148
140
  color: var(--theme-form-checkbox-symbol);
149
141
  height: var(--_checkbox-size);
@@ -1,6 +1,10 @@
1
1
  <template>
2
2
  <div class="input-checkbox-with-label" :class="[elementClasses, optionsLayout, { error: fieldHasError }]">
3
- <InputCheckboxCore :id :name :required v-model="modelValue" :size :trueValue :falseValue :stateIcon :fieldHasError :theme />
3
+ <InputCheckboxCore :id :name :required v-model="modelValue" :size :trueValue :falseValue :fieldHasError :theme>
4
+ <template #checkedIcon>
5
+ <slot name="checkedIcon"></slot>
6
+ </template>
7
+ </InputCheckboxCore>
4
8
  <label v-if="hasLabelContent" class="input-checkbox-label body-normal" :for="id">
5
9
  <slot name="labelContent"></slot>
6
10
  </label>
@@ -11,7 +15,7 @@
11
15
  <script setup lang="ts">
12
16
  import propValidators from '../c12/prop-validators';
13
17
 
14
- const { id, name, label, required, fieldHasError, trueValue, falseValue, size, stateIcon, optionsLayout, styleClassPassthrough, theme } = defineProps({
18
+ const { id, name, label, required, fieldHasError, trueValue, falseValue, size, optionsLayout, styleClassPassthrough, theme } = defineProps({
15
19
  id: {
16
20
  type: String,
17
21
  required: true,
@@ -47,13 +51,6 @@ const { id, name, label, required, fieldHasError, trueValue, falseValue, size, s
47
51
  return propValidators.size.includes(value);
48
52
  },
49
53
  },
50
- stateIcon: {
51
- type: Object as PropType<{ checked: string; unchecked: string }>,
52
- default: {
53
- checked: 'carbon:checkbox-checked',
54
- unchecked: 'carbon:checkbox',
55
- },
56
- },
57
54
  optionsLayout: {
58
55
  type: String as PropType<string>,
59
56
  default: 'equal-widths',
@@ -6,7 +6,11 @@
6
6
  </template>
7
7
  <div class="multiple-checkboxes-items" :class="[optionsLayout]">
8
8
  <template v-for="item in fieldData.data" :key="item.id">
9
- <InputCheckboxWithLabel :id="`${name}-${item.value}`" :name :required :label="item.label" :fieldHasError v-model="modelValue" :true-value="item.value" :size :stateIcon :optionsLayout :theme />
9
+ <InputCheckboxWithLabel :id="`${name}-${item.value}`" :name :required :label="item.label" :fieldHasError v-model="modelValue" :true-value="item.value" :size :optionsLayout :theme>
10
+ <template #checkedIcon>
11
+ <slot name="checkedIcon"></slot>
12
+ </template>
13
+ </InputCheckboxWithLabel>
10
14
  </template>
11
15
  </div>
12
16
  <InputError :errorMessage="errorMessage" :fieldHasError :id="name" :isDetached="true" />
@@ -19,7 +23,7 @@ import type { IOptionsConfig, IFormMultipleOptions } from '@/types/types.forms';
19
23
 
20
24
  import type { C12nMultipleCheckboxes, IFormFieldC12, IFormData } from '@/types/types.forms';
21
25
 
22
- const { id, name, legend, label, required, fieldHasError, placeholder, errorMessage, size, optionsLayout, equalCols, stateIcon, styleClassPassthrough, theme } = defineProps({
26
+ const { id, name, legend, label, required, fieldHasError, placeholder, errorMessage, size, optionsLayout, equalCols, styleClassPassthrough, theme } = defineProps({
23
27
  id: {
24
28
  type: String,
25
29
  required: true,
@@ -74,13 +78,6 @@ const { id, name, legend, label, required, fieldHasError, placeholder, errorMess
74
78
  type: Boolean,
75
79
  default: true,
76
80
  },
77
- stateIcon: {
78
- type: Object as PropType<{ checked: string; unchecked: string }>,
79
- default: {
80
- checked: 'carbon:checkbox-checked',
81
- unchecked: 'carbon:checkbox',
82
- },
83
- },
84
81
  styleClassPassthrough: {
85
82
  type: Array as PropType<string[]>,
86
83
  default: () => [],
@@ -5,7 +5,10 @@
5
5
  <slot name="description"></slot>
6
6
  </template>
7
7
  <div class="single-checkbox-items" :class="[optionsLayout]">
8
- <InputCheckboxWithLabel :id :name :required :label :fieldHasError v-model="modelValue" :trueValue :falseValue :size :stateIcon :theme>
8
+ <InputCheckboxWithLabel :id :name :required :label :fieldHasError v-model="modelValue" :trueValue :falseValue :size :theme>
9
+ <template #checkedIcon>
10
+ <slot name="checkedIcon"></slot>
11
+ </template>
9
12
  <template v-if="hasLabelContent" #labelContent>
10
13
  <slot name="labelContent"></slot>
11
14
  </template>
@@ -19,7 +22,7 @@
19
22
  import propValidators from '../../c12/prop-validators';
20
23
  import type { IFormMultipleOptions } from '@/types/types.forms';
21
24
 
22
- const { id, name, legend, label, required, fieldHasError, errorMessage, size, optionsLayout, equalCols, trueValue, falseValue, stateIcon, styleClassPassthrough, theme } = defineProps({
25
+ const { id, name, legend, label, required, fieldHasError, errorMessage, size, optionsLayout, equalCols, trueValue, falseValue, styleClassPassthrough, theme } = defineProps({
23
26
  id: {
24
27
  type: String,
25
28
  required: true,
@@ -79,13 +82,6 @@ const { id, name, legend, label, required, fieldHasError, errorMessage, size, op
79
82
  type: Boolean,
80
83
  default: true,
81
84
  },
82
- stateIcon: {
83
- type: Object as PropType<{ checked: string; unchecked: string }>,
84
- default: {
85
- checked: 'carbon:checkbox-checked',
86
- unchecked: 'carbon:checkbox',
87
- },
88
- },
89
85
  styleClassPassthrough: {
90
86
  type: Array as PropType<string[]>,
91
87
  default: () => [],
@@ -1,6 +1,8 @@
1
1
  <template>
2
2
  <div class="input-radiobutton-wrapper" :data-form-theme="formTheme" :class="[size, { error: fieldHasError }]">
3
- <Icon v-show="isChecked" name="material-symbols:circle" class="input-radiobutton-decorator" />
3
+ <slot name="checkedIcon" v-if="isChecked">
4
+ <Icon name="material-symbols:circle" class="input-checked-icon" />
5
+ </slot>
4
6
  <input
5
7
  type="radio"
6
8
  :true-value="trueValue"
@@ -19,7 +21,7 @@
19
21
 
20
22
  <script setup lang="ts">
21
23
  import propValidators from '../c12/prop-validators';
22
- const { id, name, required, trueValue, falseValue, multipleOptions, theme, styleClassPassthrough, size, stateIcon, fieldHasError } = defineProps({
24
+ const { id, name, required, trueValue, falseValue, multipleOptions, theme, styleClassPassthrough, size, fieldHasError } = defineProps({
23
25
  id: {
24
26
  type: String,
25
27
  required: true,
@@ -58,13 +60,6 @@ const { id, name, required, trueValue, falseValue, multipleOptions, theme, style
58
60
  return propValidators.size.includes(value);
59
61
  },
60
62
  },
61
- stateIcon: {
62
- type: Object as PropType<{ checked: string; unchecked: string }>,
63
- default: {
64
- checked: 'carbon:radio-button-checked',
65
- unchecked: 'carbon:radio-button',
66
- },
67
- },
68
63
  fieldHasError: {
69
64
  type: Boolean,
70
65
  default: false,
@@ -97,25 +92,9 @@ const isChecked = computed(() => {
97
92
  return modelValue.value === trueValue;
98
93
  }
99
94
  });
100
-
101
- const icon = computed(() => {
102
- return isChecked.value ? stateIcon.checked : stateIcon.unchecked;
103
- });
104
-
105
- const useCustomizeIcon = (content: string, name: string, prefix: string, provider: string) => {
106
- console.log('useCustomizeIcon');
107
- // if (prefix !== 'carbon') return content; // Ignore Prefix
108
-
109
- return content
110
- .replace(/stroke-width="[^"]*"/g, `stroke-width="2"`) // Change stroke width to 2
111
- .replace(/stroke="[^"]*"/g, `stroke="#ff0000"`) // Change stroke color to red
112
- .replace(/fill="[^"]*"/g, `fill="#00ff00"`) // Change fill color to green
113
- .replace(/animation-duration="[^"]*"/g, `animation-duration="1s"`) // Change animation duration to 1s (for animated icons)
114
- .replace(/opacity="[^"]*"/g, `opacity="0.8"`); // Change opacity to 0.8
115
- };
116
95
  </script>
117
96
 
118
- <style scoped lang="css">
97
+ <style lang="css">
119
98
  .input-radiobutton-wrapper {
120
99
  --_checkbox-size: initial;
121
100
  --_outline-width: var(--input-outline-width-thin);
@@ -158,7 +137,7 @@ const useCustomizeIcon = (content: string, name: string, prefix: string, provide
158
137
  --_checkbox-size: 44px;
159
138
  }
160
139
 
161
- .input-radiobutton-decorator {
140
+ .input-checked-icon {
162
141
  --_checked-size: calc(var(--_checkbox-size) * 0.65);
163
142
  grid-area: element-stack;
164
143
  align-self: center;
@@ -1,6 +1,10 @@
1
1
  <template>
2
2
  <div class="input-radiobutton-with-label" :class="[elementClasses, { error: fieldHasError }]">
3
- <InputRadiobuttonCore :id :name :required v-model="modelValue" :size :trueValue :falseValue :stateIcon :fieldHasError :theme />
3
+ <InputRadiobuttonCore :id :name :required v-model="modelValue" :size :trueValue :falseValue :fieldHasError :theme>
4
+ <template #checkedIcon>
5
+ <slot name="checkedIcon"></slot>
6
+ </template>
7
+ </InputRadiobuttonCore>
4
8
  <label v-if="hasLabelContent" class="input-radiobutton-label body-normal" :for="id">
5
9
  <slot name="labelContent"></slot>
6
10
  </label>
@@ -11,7 +15,7 @@
11
15
  <script setup lang="ts">
12
16
  import propValidators from '../c12/prop-validators';
13
17
 
14
- const { id, name, label, required, fieldHasError, trueValue, falseValue, size, stateIcon, styleClassPassthrough, theme } = defineProps({
18
+ const { id, name, label, required, fieldHasError, trueValue, falseValue, size, styleClassPassthrough, theme } = defineProps({
15
19
  id: {
16
20
  type: String,
17
21
  required: true,
@@ -47,13 +51,6 @@ const { id, name, label, required, fieldHasError, trueValue, falseValue, size, s
47
51
  return propValidators.size.includes(value);
48
52
  },
49
53
  },
50
- stateIcon: {
51
- type: Object as PropType<{ checked: string; unchecked: string }>,
52
- default: {
53
- checked: 'carbon:radio-button-checked',
54
- unchecked: 'carbon:radio-button',
55
- },
56
- },
57
54
  styleClassPassthrough: {
58
55
  type: Array as PropType<string[]>,
59
56
  default: () => [],
@@ -6,7 +6,11 @@
6
6
  </template>
7
7
  <div class="multiple-radiobuttons-items" :class="[optionsLayout]">
8
8
  <template v-for="item in fieldData.data" :key="item.id">
9
- <InputRadiobuttonWithLabel :id="`${name}-${item.value}`" :name="item.name" :required :label="item.label" :fieldHasError v-model="modelValue" :true-value="item.value" :size :stateIcon :theme />
9
+ <InputRadiobuttonWithLabel :id="`${name}-${item.value}`" :name="`${name}-${item.name}`" :required :label="item.label" :fieldHasError v-model="modelValue" :true-value="item.value" :size :theme>
10
+ <template #checkedIcon>
11
+ <slot name="checkedIcon"></slot>
12
+ </template>
13
+ </InputRadiobuttonWithLabel>
10
14
  </template>
11
15
  </div>
12
16
  <InputError :errorMessage="errorMessage" :fieldHasError :id="name" :isDetached="true" />
@@ -15,11 +19,9 @@
15
19
 
16
20
  <script setup lang="ts">
17
21
  import propValidators from '../../c12/prop-validators';
18
- import type { IOptionsConfig, IFormMultipleOptions } from '@/types/types.forms';
22
+ import type { IFormMultipleOptions } from '@/types/types.forms';
19
23
 
20
- import type { C12nMultipleCheckboxes, IFormFieldC12, IFormData } from '@/types/types.forms';
21
-
22
- const { id, name, legend, label, required, fieldHasError, placeholder, errorMessage, size, optionsLayout, equalCols, stateIcon, styleClassPassthrough, theme } = defineProps({
24
+ const { id, name, legend, label, required, fieldHasError, placeholder, errorMessage, size, optionsLayout, equalCols, styleClassPassthrough, theme } = defineProps({
23
25
  id: {
24
26
  type: String,
25
27
  required: true,
@@ -74,13 +76,6 @@ const { id, name, legend, label, required, fieldHasError, placeholder, errorMess
74
76
  type: Boolean,
75
77
  default: true,
76
78
  },
77
- stateIcon: {
78
- type: Object as PropType<{ checked: string; unchecked: string }>,
79
- default: {
80
- checked: 'carbon:radio-button-checked',
81
- unchecked: 'carbon:radio-button',
82
- },
83
- },
84
79
  styleClassPassthrough: {
85
80
  type: Array as PropType<string[]>,
86
81
  default: () => [],
@@ -6,7 +6,7 @@
6
6
  @click.stop.prevent="toggleDisplayPassword"
7
7
  :is-pending="false"
8
8
  :buttonText
9
- theme="ghost"
9
+ :theme
10
10
  size="x-small"
11
11
  @focusin="updateFocus(name, true)"
12
12
  @focusout="updateFocus(name, false)"
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "srcdev-nuxt-forms",
3
3
  "type": "module",
4
- "version": "2.1.10",
4
+ "version": "2.1.12",
5
5
  "main": "nuxt.config.ts",
6
6
  "scripts": {
7
7
  "clean": "rm -rf .nuxt && rm -rf .output && rm -rf .playground/.nuxt && rm -rf .playground/.output",