srcdev-nuxt-forms 6.1.3 → 6.1.5

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.
@@ -1,38 +1,48 @@
1
1
  export const propValidators = {
2
- size: ['x-small', 'small', 'default', 'medium', 'large'],
2
+ size: ["x-small", "small", "default", "medium", "large"],
3
3
  weight: [
4
- 'wght-100',
5
- 'wght-200',
6
- 'wght-300',
7
- 'wght-400',
8
- 'wght-500',
9
- 'wght-600',
10
- 'wght-700',
11
- 'wght-800',
12
- 'wght-900',
13
- 'light',
14
- 'normal',
15
- 'bold',
16
- 'fvs-wght-100',
17
- 'fvs-wght-200',
18
- 'fvs-wght-300',
19
- 'fvs-wght-400',
20
- 'fvs-wght-500',
21
- 'fvs-wght-600',
22
- 'fvs-wght-700',
23
- 'fvs-wght-800',
24
- 'fvs-wght-900',
4
+ "wght-100",
5
+ "wght-200",
6
+ "wght-300",
7
+ "wght-400",
8
+ "wght-500",
9
+ "wght-600",
10
+ "wght-700",
11
+ "wght-800",
12
+ "wght-900",
13
+ "light",
14
+ "normal",
15
+ "bold",
16
+ "fvs-wght-100",
17
+ "fvs-wght-200",
18
+ "fvs-wght-300",
19
+ "fvs-wght-400",
20
+ "fvs-wght-500",
21
+ "fvs-wght-600",
22
+ "fvs-wght-700",
23
+ "fvs-wght-800",
24
+ "fvs-wght-900",
25
25
  ],
26
- theme: ['primary', 'secondary', 'tertiary', 'ghost', 'error', 'success', 'warning', 'input-action', 'input-action-underlined'],
27
- checkboxAppearance: [null, 'with-decorator'],
28
- checkboxStyle: ['check', 'cross'],
29
- radioAppearance: [null, 'with-decorator'],
30
- optionsLayout: ['block', 'inline', 'equal-widths'],
31
- labelWeight: ['normal', 'semi-bold', 'bold'],
32
- inputVariant: ['normal', 'outlined', 'underlined'],
33
- inputTypesButton: ['button', 'cancel', 'reset', 'submit'],
34
- inputTypesText: ['text', 'email', 'password', 'number', 'tel', 'url'],
35
- inputMode: ['text', 'email', 'tel', 'url', 'search', 'numeric', 'none', 'decimal'],
36
- };
26
+ theme: [
27
+ "primary",
28
+ "secondary",
29
+ "tertiary",
30
+ "ghost",
31
+ "error",
32
+ "success",
33
+ "warning",
34
+ "input-action",
35
+ "input-action-underlined",
36
+ ],
37
+ checkboxAppearance: [null, "with-decorator"],
38
+ checkboxStyle: ["check", "cross"],
39
+ radioAppearance: [null, "with-decorator"],
40
+ optionsLayout: ["block", "inline", "equal-widths"],
41
+ labelWeight: ["normal", "semi-bold", "bold"],
42
+ inputVariant: ["normal", "outlined", "underlined"],
43
+ inputTypesButton: ["button", "cancel", "reset", "submit"],
44
+ inputTypesText: ["text", "email", "password", "number", "tel", "url"],
45
+ inputMode: ["text", "email", "tel", "url", "search", "numeric", "none", "decimal"],
46
+ }
37
47
 
38
- export default propValidators;
48
+ export default propValidators
@@ -1,5 +1,6 @@
1
1
  <template>
2
- <div
2
+ <label
3
+ :for="id"
3
4
  class="input-checkbox-radio-options-button"
4
5
  :data-theme="formTheme"
5
6
  :data-size="size"
@@ -24,16 +25,16 @@
24
25
  <slot name="checkedIcon"></slot>
25
26
  </template>
26
27
  </InputCheckboxRadioCore>
27
- <label v-if="slots.labelContent" class="input-checkbox-radio-options-button-label" :for="id">
28
+ <div v-if="slots.labelContent" class="input-checkbox-radio-options-button-label">
28
29
  <slot name="labelContent"></slot>
29
- </label>
30
- <label v-else class="input-checkbox-radio-options-button-label" :for="id">{{ label }}</label>
30
+ </div>
31
+ <div v-else class="input-checkbox-radio-options-button-label">{{ label }}</div>
31
32
  <div class="decorator-icon">
32
33
  <slot name="itemIcon">
33
34
  <Icon name="material-symbols:add-2" class="icon" aria-hidden="true" focusable="false" />
34
35
  </slot>
35
36
  </div>
36
- </div>
37
+ </label>
37
38
  </template>
38
39
 
39
40
  <script setup lang="ts">
@@ -154,6 +155,7 @@ const flexDirection = ref(props.direction)
154
155
  border-color: var(--theme-input-border);
155
156
  outline-color: var(--theme-input-outline-hover);
156
157
  outline-offset: var(--form-element-outline-offset-focus);
158
+ cursor: pointer;
157
159
  }
158
160
 
159
161
  &:has(.input-checkbox-radio-core:focus-visible) {
@@ -3,11 +3,20 @@
3
3
  class="input-checkbox-radio-wrapper"
4
4
  :data-theme="formTheme"
5
5
  :data-size="size"
6
- :class="[type, size, elementClasses, { error: fieldHasError }, { button: isButton }, { 'display-as-disc': displayAsDisc }]"
6
+ :class="[
7
+ type,
8
+ size,
9
+ elementClasses,
10
+ { error: fieldHasError },
11
+ { button: isButton },
12
+ { 'display-as-disc': displayAsDisc },
13
+ ]"
7
14
  >
8
- <slot name="checkedIcon" v-if="isChecked">
9
- <Icon :name="defaultIcon" class="input-checked-icon" />
10
- </slot>
15
+ <div class="input-checked-icon-slot">
16
+ <slot name="checkedIcon">
17
+ <Icon :name="defaultIcon" class="input-checked-icon-checked" />
18
+ </slot>
19
+ </div>
11
20
 
12
21
  <input
13
22
  :type
@@ -29,14 +38,14 @@
29
38
  </template>
30
39
 
31
40
  <script setup lang="ts">
32
- import propValidators from '../c12/prop-validators';
41
+ import propValidators from "../c12/prop-validators"
33
42
  const props = defineProps({
34
43
  isButton: {
35
44
  type: Boolean,
36
45
  default: false,
37
46
  },
38
47
  type: {
39
- type: String as PropType<'checkbox' | 'radio'>,
48
+ type: String as PropType<"checkbox" | "radio">,
40
49
  required: true,
41
50
  },
42
51
  id: {
@@ -65,16 +74,16 @@ const props = defineProps({
65
74
  },
66
75
  theme: {
67
76
  type: String as PropType<string>,
68
- default: 'primary',
77
+ default: "primary",
69
78
  validator(value: string) {
70
- return propValidators.theme.includes(value);
79
+ return propValidators.theme.includes(value)
71
80
  },
72
81
  },
73
82
  size: {
74
83
  type: String as PropType<string>,
75
- default: 'medium',
84
+ default: "medium",
76
85
  validator(value: string) {
77
- return propValidators.size.includes(value);
86
+ return propValidators.size.includes(value)
78
87
  },
79
88
  },
80
89
  fieldHasError: {
@@ -93,37 +102,37 @@ const props = defineProps({
93
102
  type: Boolean,
94
103
  default: false,
95
104
  },
96
- });
105
+ })
97
106
 
98
- const { elementClasses } = useStyleClassPassthrough(props.styleClassPassthrough);
107
+ const { elementClasses } = useStyleClassPassthrough(props.styleClassPassthrough)
99
108
 
100
109
  const formTheme = computed(() => {
101
- return props.fieldHasError ? 'error' : props.theme;
102
- });
110
+ return props.fieldHasError ? "error" : props.theme
111
+ })
103
112
 
104
- const modelValue = defineModel<any>();
113
+ const modelValue = defineModel<any>()
105
114
 
106
- const inputField = ref<HTMLInputElement | null>(null);
115
+ const inputField = ref<HTMLInputElement | null>(null)
107
116
 
108
117
  const defaultIcon = computed(() => {
109
- return props.type === 'checkbox' ? 'material-symbols:check-small' : 'material-symbols:circle';
110
- });
118
+ return props.type === "checkbox" ? "material-symbols:check-small" : "material-symbols:circle"
119
+ })
111
120
 
112
- const isArray = Array.isArray(modelValue.value);
121
+ const isArray = Array.isArray(modelValue.value)
113
122
 
114
123
  const isChecked = computed(() => {
115
124
  if (isArray) {
116
- return modelValue.value.includes(props.trueValue);
125
+ return modelValue.value.includes(props.trueValue)
117
126
  } else {
118
- return modelValue.value === props.trueValue;
127
+ return modelValue.value === props.trueValue
119
128
  }
120
- });
129
+ })
121
130
  </script>
122
131
 
123
132
  <style lang="css">
124
133
  .input-checkbox-radio-wrapper {
125
134
  display: grid;
126
- grid-template-areas: 'element-stack';
135
+ grid-template-areas: "element-stack";
127
136
  place-content: center;
128
137
 
129
138
  background-color: var(--theme-checkbox-symbol-surface);
@@ -149,17 +158,34 @@ const isChecked = computed(() => {
149
158
  border-radius: 50%;
150
159
  }
151
160
 
161
+ &:has(.input-checkbox-radio-core:checked) {
162
+ .input-checked-icon-slot {
163
+ opacity: 1;
164
+
165
+ .input-checked-icon-checked {
166
+ color: var(--theme-checkbox-symbol-color);
167
+ }
168
+ }
169
+ }
170
+
152
171
  /* focus-visible */
153
172
  &:not(.button):has(.input-checkbox-radio-core:focus-visible) {
154
173
  outline: var(--theme-focus-visible-outline);
155
174
  }
156
175
 
157
- .input-checked-icon {
176
+ .input-checked-icon-slot {
158
177
  grid-area: element-stack;
159
- color: var(--theme-checkbox-symbol-color);
160
- height: var(--input-symbol-size);
161
- width: var(--input-symbol-size);
162
- box-shadow: var(--_box-shadow);
178
+ display: grid;
179
+ place-content: center;
180
+ opacity: 0;
181
+ transition: opacity 0.2s ease-in-out;
182
+
183
+ .input-checked-icon-checked {
184
+ color: var(--theme-checkbox-symbol-color);
185
+ height: var(--input-symbol-size);
186
+ width: var(--input-symbol-size);
187
+ box-shadow: var(--_box-shadow);
188
+ }
163
189
  }
164
190
 
165
191
  .input-checkbox-radio-core {
@@ -1,5 +1,6 @@
1
1
  <template>
2
- <div
2
+ <label
3
+ :for="id"
3
4
  class="input-checkbox-radio-with-label"
4
5
  :data-size="size"
5
6
  :class="[elementClasses, optionsLayout, { error: fieldHasError }]"
@@ -23,11 +24,11 @@
23
24
  </template>
24
25
  </InputCheckboxRadioCore>
25
26
 
26
- <label v-if="slots.labelContent" class="input-checkbox-radio-label body-normal" :for="id">
27
+ <div v-if="slots.labelContent" class="input-checkbox-radio-label body-normal">
27
28
  <slot name="labelContent"></slot>
28
- </label>
29
- <label v-else class="input-checkbox-radio-label body-normal-semibold" :for="id">{{ label }}</label>
30
- </div>
29
+ </div>
30
+ <div v-else class="input-checkbox-radio-label body-normal-semibold">{{ label }}</div>
31
+ </label>
31
32
  </template>
32
33
 
33
34
  <script setup lang="ts">
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "srcdev-nuxt-forms",
3
3
  "type": "module",
4
- "version": "6.1.3",
4
+ "version": "6.1.5",
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",