srcdev-nuxt-forms 5.1.0 → 6.0.0

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.
Files changed (162) hide show
  1. package/README.md +16 -0
  2. package/app/assets/styles/extends-layer/srcdev-forms/components/_form-fieldset.css +38 -0
  3. package/app/assets/styles/extends-layer/srcdev-forms/components/_input-button.css +66 -0
  4. package/app/assets/styles/extends-layer/srcdev-forms/components/_input-checkbox-radio-core.css +66 -0
  5. package/app/assets/styles/extends-layer/srcdev-forms/components/_input-checkbox-radio-options-button.css +76 -0
  6. package/app/assets/styles/extends-layer/srcdev-forms/components/_input-error.css +54 -0
  7. package/app/assets/styles/extends-layer/srcdev-forms/components/_input-label.css +21 -0
  8. package/app/assets/styles/extends-layer/srcdev-forms/components/_input-select.css +140 -0
  9. package/app/assets/styles/extends-layer/srcdev-forms/components/_input-text.css +190 -0
  10. package/app/assets/styles/extends-layer/srcdev-forms/components/_input-textarea.css +96 -0
  11. package/{assets → app/assets}/styles/extends-layer/srcdev-forms/components/index.css +3 -4
  12. package/app/assets/styles/extends-layer/srcdev-forms/setup/_generic.css +21 -0
  13. package/app/assets/styles/extends-layer/srcdev-forms/setup/index.css +4 -0
  14. package/{assets → app/assets}/styles/extends-layer/srcdev-forms/setup/themes/_error.css +12 -12
  15. package/{assets → app/assets}/styles/extends-layer/srcdev-forms/setup/themes/_ghost.css +12 -12
  16. package/{assets → app/assets}/styles/extends-layer/srcdev-forms/setup/themes/_input-action-underlined.css +7 -7
  17. package/{assets → app/assets}/styles/extends-layer/srcdev-forms/setup/themes/_input-action.css +7 -7
  18. package/{assets → app/assets}/styles/extends-layer/srcdev-forms/setup/themes/_primary.css +12 -12
  19. package/{assets → app/assets}/styles/extends-layer/srcdev-forms/setup/themes/_secondary.css +12 -12
  20. package/{assets → app/assets}/styles/extends-layer/srcdev-forms/setup/themes/_success.css +12 -12
  21. package/{assets → app/assets}/styles/extends-layer/srcdev-forms/setup/themes/_tertiary.css +12 -12
  22. package/{assets → app/assets}/styles/extends-layer/srcdev-forms/setup/themes/_warning.css +12 -12
  23. package/app/assets/styles/extends-layer/srcdev-forms/setup/variables/_a11y.css +7 -0
  24. package/app/assets/styles/extends-layer/srcdev-forms/setup/variables/index.css +1 -0
  25. package/app/assets/styles/extends-layer/srcdev-forms/setup/variants/_normal.css +48 -0
  26. package/{assets → app/assets}/styles/extends-layer/srcdev-forms/setup/variants/_underlined.css +12 -12
  27. package/app/assets/styles/extends-layer/srcdev-forms/setup/variants/index.css +3 -0
  28. package/app/assets/styles/extends-layer/srcdev-forms/setup/variants/sizes/_default.css +13 -0
  29. package/app/assets/styles/extends-layer/srcdev-forms/setup/variants/sizes/_large.css +12 -0
  30. package/app/assets/styles/extends-layer/srcdev-forms/setup/variants/sizes/_medium.css +12 -0
  31. package/app/assets/styles/extends-layer/srcdev-forms/setup/variants/sizes/_small.css +12 -0
  32. package/app/assets/styles/extends-layer/srcdev-forms/setup/variants/sizes/_x-small.css +11 -0
  33. package/{assets/styles/extends-layer/srcdev-forms/setup → app/assets/styles/extends-layer/srcdev-forms/setup/variants}/sizes/index.css +2 -0
  34. package/app/assets/styles/setup/_head.css +36 -0
  35. package/app/assets/styles/setup/index.css +5 -0
  36. package/{assets/styles/setup/variables → app/assets/styles/setup/theming}/colors/_blue.css +1 -1
  37. package/{assets/styles/setup/variables → app/assets/styles/setup/theming}/index.css +1 -0
  38. package/app/assets/styles/setup/theming/themes/_default.css +66 -0
  39. package/app/assets/styles/setup/theming/themes/_error.css +66 -0
  40. package/app/assets/styles/setup/theming/themes/_ghost.css +31 -0
  41. package/app/assets/styles/setup/theming/themes/_info.css +31 -0
  42. package/app/assets/styles/setup/theming/themes/_primary.css +41 -0
  43. package/app/assets/styles/setup/theming/themes/_secondary.css +66 -0
  44. package/app/assets/styles/setup/theming/themes/_success.css +66 -0
  45. package/app/assets/styles/setup/theming/themes/_tertiary.css +31 -0
  46. package/app/assets/styles/setup/theming/themes/_warning.css +68 -0
  47. package/app/assets/styles/setup/theming/themes/index.css +9 -0
  48. package/app/assets/styles/setup/typography/index.css +2 -0
  49. package/app/assets/styles/setup/typography/utility-classes/_generic-font-classes.css +217 -0
  50. package/app/assets/styles/setup/typography/utility-classes/_generic-font-variation-settings.css +29 -0
  51. package/app/assets/styles/setup/typography/utility-classes/_generic-font-weights.css +39 -0
  52. package/app/assets/styles/setup/typography/vars/_colors.css +14 -0
  53. package/app/assets/styles/setup/typography/vars/_reponsive-font-sizes.css +12 -0
  54. package/{assets → app/assets}/styles/setup/typography/vars/index.css +1 -0
  55. package/app/assets/styles/setup/utility-classes/_fluid-spacing.css +13 -0
  56. package/app/assets/styles/setup/utility-classes/animations/_auto-rotate.css +13 -0
  57. package/app/assets/styles/setup/utility-classes/animations/_entry-exit-blur.css +16 -0
  58. package/app/assets/styles/setup/utility-classes/animations/_entry-slide-in.css +15 -0
  59. package/app/assets/styles/setup/utility-classes/animations/_entry-zoom-reveal.css +15 -0
  60. package/app/assets/styles/setup/utility-classes/animations/index.css +4 -0
  61. package/app/assets/styles/setup/utility-classes/index.css +2 -0
  62. package/app/assets/styles/setup/variables/index.css +1 -0
  63. package/{components → app/components}/forms/form-errors/InputError.vue +32 -49
  64. package/{components → app/components}/forms/form-fieldset/FormFieldset.vue +9 -9
  65. package/{components → app/components}/forms/input-button/InputButtonCore.vue +20 -18
  66. package/{components → app/components}/forms/input-button/variants/InputButtonConfirm.vue +1 -1
  67. package/app/components/forms/input-checkbox-radio/InputCheckboxRadioButton.vue +204 -0
  68. package/{components → app/components}/forms/input-checkbox-radio/InputCheckboxRadioCore.vue +29 -17
  69. package/{components → app/components}/forms/input-checkbox-radio/InputCheckboxRadioWithLabel.vue +1 -0
  70. package/{components → app/components}/forms/input-label/InputLabel.vue +26 -7
  71. package/{components → app/components}/forms/input-number/InputNumberCore.vue +7 -6
  72. package/{components → app/components}/forms/input-number/variants/InputNumberDefault.vue +5 -6
  73. package/{components → app/components}/forms/input-range/InputRangeCore.vue +1 -1
  74. package/{components → app/components}/forms/input-range/variants/InputRangeDefault.vue +5 -2
  75. package/{components → app/components}/forms/input-range-fancy/InputRangeFancyCore.vue +1 -1
  76. package/{components → app/components}/forms/input-range-fancy/InputRangeFancyWithLabel.vue +1 -1
  77. package/{components → app/components}/forms/input-select/InputSelectCore.vue +23 -21
  78. package/{components → app/components}/forms/input-select/variants/InputSelectWithLabel.vue +1 -1
  79. package/app/components/forms/input-text/InputTextCore.vue +341 -0
  80. package/{components → app/components}/forms/input-text/variants/InputPasswordWithLabel.vue +1 -1
  81. package/{components → app/components}/forms/input-text/variants/InputTextAsNumberWithLabel.vue +4 -2
  82. package/app/components/forms/input-text/variants/InputTextWithLabel.vue +158 -0
  83. package/{components → app/components}/forms/input-textarea/InputTextareaCore.vue +10 -131
  84. package/app/components/forms/input-textarea/variants/InputTextareaWithLabel.vue +125 -0
  85. package/{components → app/components}/forms/toggle-switch/ToggleSwitchCore.vue +1 -1
  86. package/{components → app/components}/forms/toggle-switch/ToggleSwitchCoreOld.vue +1 -1
  87. package/{components → app/components}/forms/toggle-switch/variants/ToggleSwitchWithLabel.vue +5 -2
  88. package/{components → app/components}/forms/toggle-switch/variants/ToggleSwitchWithLabelInline.vue +5 -2
  89. package/{components → app/components}/utils/colour-scheme-select/ColourSchemeSelect.vue +1 -1
  90. package/{components → app/components}/utils/colour-scheme-select/ColourSchemeSelectOld.vue +1 -1
  91. package/nuxt.config.ts +5 -2
  92. package/package.json +9 -11
  93. package/assets/styles/extends-layer/srcdev-forms/components/_form-core.css +0 -8
  94. package/assets/styles/extends-layer/srcdev-forms/components/_form-fieldset.css +0 -16
  95. package/assets/styles/extends-layer/srcdev-forms/components/_input-checkbox-radio-options-button.css +0 -59
  96. package/assets/styles/extends-layer/srcdev-forms/components/_input-checkbox.css +0 -72
  97. package/assets/styles/extends-layer/srcdev-forms/components/_input-error.css +0 -55
  98. package/assets/styles/extends-layer/srcdev-forms/components/_input-label.css +0 -18
  99. package/assets/styles/extends-layer/srcdev-forms/components/_input-radio.css +0 -68
  100. package/assets/styles/extends-layer/srcdev-forms/components/_input-select.css +0 -18
  101. package/assets/styles/extends-layer/srcdev-forms/components/_input-text-as-number.css +0 -22
  102. package/assets/styles/extends-layer/srcdev-forms/components/_input-textarea.css +0 -5
  103. package/assets/styles/extends-layer/srcdev-forms/setup/_generic.css +0 -7
  104. package/assets/styles/extends-layer/srcdev-forms/setup/index.css +0 -4
  105. package/assets/styles/extends-layer/srcdev-forms/setup/sizes/_default.css +0 -12
  106. package/assets/styles/extends-layer/srcdev-forms/setup/sizes/_large.css +0 -12
  107. package/assets/styles/extends-layer/srcdev-forms/setup/sizes/_medium.css +0 -12
  108. package/assets/styles/extends-layer/srcdev-forms/setup/sizes/_small.css +0 -12
  109. package/assets/styles/extends-layer/srcdev-forms/setup/sizes/_x-small.css +0 -11
  110. package/assets/styles/extends-layer/srcdev-forms/setup/variants/_normal.css +0 -48
  111. package/assets/styles/extends-layer/srcdev-forms/setup/variants/index.css +0 -2
  112. package/assets/styles/setup/_head.css +0 -5
  113. package/assets/styles/setup/index.css +0 -5
  114. package/assets/styles/setup/typography/index.css +0 -2
  115. package/assets/styles/setup/typography/utility-classes/_generic-font-classes.css +0 -192
  116. package/assets/styles/setup/typography/utility-classes/_generic-font-variation-settings.css +0 -29
  117. package/assets/styles/setup/typography/utility-classes/_generic-font-weights.css +0 -41
  118. package/assets/styles/setup/typography/vars/_reponsive-font-sizes.css +0 -10
  119. package/assets/styles/setup/utility-classes/_margin-helpers.css +0 -334
  120. package/assets/styles/setup/utility-classes/_padding-helpers.css +0 -308
  121. package/assets/styles/setup/utility-classes/_page.css +0 -49
  122. package/assets/styles/setup/utility-classes/index.css +0 -3
  123. package/components/forms/input-checkbox-radio/InputCheckboxRadioButton.vue +0 -218
  124. package/components/forms/input-text/InputTextCore.vue +0 -390
  125. package/components/forms/input-text/variants/InputTextWithLabel.vue +0 -300
  126. package/components/forms/input-textarea/variants/InputTextareaWithLabel.vue +0 -269
  127. package/{assets → app/assets}/styles/extends-layer/srcdev-forms/index.css +0 -0
  128. package/{assets → app/assets}/styles/extends-layer/srcdev-forms/setup/themes/index.css +0 -0
  129. package/{assets → app/assets}/styles/main.css +0 -0
  130. package/{assets → app/assets}/styles/setup/a11y/_utils.css +0 -0
  131. package/{assets → app/assets}/styles/setup/a11y/_variables.css +0 -0
  132. package/{assets → app/assets}/styles/setup/a11y/index.css +0 -0
  133. package/{assets/styles/setup/variables → app/assets/styles/setup/theming}/colors/_gray.css +0 -0
  134. package/{assets/styles/setup/variables → app/assets/styles/setup/theming}/colors/_green.css +0 -0
  135. package/{assets/styles/setup/variables → app/assets/styles/setup/theming}/colors/_orange.css +0 -0
  136. package/{assets/styles/setup/variables → app/assets/styles/setup/theming}/colors/_red.css +0 -0
  137. package/{assets/styles/setup/variables → app/assets/styles/setup/theming}/colors/_yellow.css +0 -0
  138. package/{assets/styles/setup/variables → app/assets/styles/setup/theming}/colors/index.css +3 -3
  139. package/{assets → app/assets}/styles/setup/typography/utility-classes/index.css +1 -1
  140. /package/{components → app/components}/forms/c12/prop-validators/index.ts +0 -0
  141. /package/{components → app/components}/forms/c12/utils.ts +0 -0
  142. /package/{components → app/components}/forms/form-errors/tests/InputError.spec.ts +0 -0
  143. /package/{components → app/components}/forms/input-button/variants/InputButtonSubmit.vue +0 -0
  144. /package/{components → app/components}/forms/input-checkbox/MultipleCheckboxes.vue +0 -0
  145. /package/{components → app/components}/forms/input-checkbox/SingleCheckbox.vue +0 -0
  146. /package/{components → app/components}/forms/input-checkbox/tests/MultipleCheckboxes.spec.ts +0 -0
  147. /package/{components → app/components}/forms/input-checkbox/tests/data/tags.json +0 -0
  148. /package/{components → app/components}/forms/input-radio/MultipleRadiobuttons.vue +0 -0
  149. /package/{components → app/components}/forms/input-radio/tests/MultipleRadioButtons.spec.ts +0 -0
  150. /package/{components → app/components}/forms/input-radio/tests/data/tags.json +0 -0
  151. /package/{components → app/components}/forms/ui/FormField.vue +0 -0
  152. /package/{components → app/components}/forms/ui/FormWrapper.vue +0 -0
  153. /package/{components → app/components}/utils/dark-mode-switcher/DarkModeSwitcher.vue +0 -0
  154. /package/{composables → app/composables}/useApiRequest.ts +0 -0
  155. /package/{composables → app/composables}/useColourScheme.ts +0 -0
  156. /package/{composables → app/composables}/useErrorMessages.ts +0 -0
  157. /package/{composables → app/composables}/useFormControl.ts +0 -0
  158. /package/{composables → app/composables}/useSleep.ts +0 -0
  159. /package/{composables → app/composables}/useStyleClassPassthrough.ts +0 -0
  160. /package/{composables → app/composables}/useZodValidation.ts +0 -0
  161. /package/{types → app/types}/types.forms.ts +0 -0
  162. /package/{types → app/types}/types.zodFormControl.ts +0 -0
@@ -1,390 +0,0 @@
1
- <template>
2
- <div
3
- class="input-text-wrapper"
4
- :data-form-theme="formTheme"
5
- :data-size="size"
6
- :data-inputmode="inputmode"
7
- :class="[inputVariant, { dirty: isDirty }, { active: isActive }, { error: fieldHasError }, { 'has-left-slot': hasLeftSlot }, { 'has-right-slot': hasRightSlot }]"
8
- >
9
- <span v-if="hasLeftSlot" class="slot left-slot">
10
- <slot name="left"></slot>
11
- </span>
12
-
13
- <input
14
- :type
15
- :placeholder
16
- :id
17
- :name
18
- :required
19
- :maxlength
20
- :class="['input-text-core', elementClasses, { dirty: isDirty }, { active: isActive }]"
21
- v-model="modelValue"
22
- ref="inputField"
23
- :aria-invalid="fieldHasError"
24
- :aria-describedby
25
- :pattern="inputPattern"
26
- :inputmode
27
- @focusin="updateFocus(true)"
28
- @focusout="updateFocus(false)"
29
- />
30
-
31
- <span v-if="hasRightSlot" class="slot right-slot">
32
- <slot name="right"></slot>
33
- </span>
34
- </div>
35
- </template>
36
-
37
- <script setup lang="ts">
38
- import propValidators from '../c12/prop-validators';
39
-
40
- const props = defineProps({
41
- type: {
42
- type: String as PropType<'text' | 'email' | 'password' | 'number' | 'tel' | 'url'>,
43
- // type: String,
44
- default: 'text',
45
- validator(value: string) {
46
- return propValidators.inputTypesText.includes(value);
47
- },
48
- },
49
- inputmode: {
50
- type: String as PropType<'text' | 'email' | 'tel' | 'url' | 'search' | 'numeric' | 'none' | 'decimal'>,
51
- default: 'text',
52
- validator(value: string) {
53
- return propValidators.inputMode.includes(value);
54
- },
55
- },
56
- maxlength: {
57
- type: Number,
58
- default: 255,
59
- },
60
- id: {
61
- type: String,
62
- required: true,
63
- },
64
- name: {
65
- type: String,
66
- required: true,
67
- },
68
- required: {
69
- type: Boolean,
70
- default: false,
71
- },
72
- placeholder: {
73
- type: String,
74
- default: '',
75
- },
76
- fieldHasError: {
77
- type: Boolean,
78
- default: false,
79
- },
80
- styleClassPassthrough: {
81
- type: Array as PropType<string[]>,
82
- default: () => [],
83
- },
84
- theme: {
85
- type: String as PropType<string>,
86
- default: 'primary',
87
- validator(value: string) {
88
- return propValidators.theme.includes(value);
89
- },
90
- },
91
- ariaDescribedby: {
92
- type: String,
93
- default: null,
94
- },
95
- size: {
96
- type: String as PropType<string>,
97
- default: 'default',
98
- validator(value: string) {
99
- return propValidators.size.includes(value);
100
- },
101
- },
102
- inputVariant: {
103
- type: String as PropType<string>,
104
- default: 'normal',
105
- validator(value: string) {
106
- return propValidators.inputVariant.includes(value);
107
- },
108
- },
109
- });
110
-
111
- const slots = useSlots();
112
- const hasLeftSlot = computed(() => slots.left !== undefined);
113
- const hasRightSlot = computed(() => slots.right !== undefined);
114
-
115
- const formTheme = computed(() => {
116
- return props.fieldHasError ? 'error' : props.theme;
117
- });
118
-
119
- const modelValue = defineModel();
120
- const isDirty = defineModel('isDirty');
121
- const isActive = defineModel('isActive');
122
-
123
- const inputPattern = computed(() => {
124
- return props.inputmode === 'numeric' ? '[0-9]+' : undefined;
125
- });
126
-
127
- const updateFocus = (isFocused: boolean) => {
128
- isActive.value = isFocused;
129
- };
130
-
131
- const inputField = ref<HTMLInputElement | null>(null);
132
-
133
- const { elementClasses } = useStyleClassPassthrough(props.styleClassPassthrough);
134
-
135
- // TODO: Move this to a utility function to allow removeEventListener on unmounted
136
- // Leaving like this could lead to memory leaks
137
- const validateInput = () => {
138
- if (inputField.value !== null) {
139
- inputField.value.addEventListener('beforeinput', (event: any) => {
140
- let beforeValue = modelValue.value;
141
- event.target.addEventListener(
142
- 'input',
143
- () => {
144
- if (inputField.value !== null && inputField.value.validity.patternMismatch) {
145
- inputField.value.value = beforeValue as string;
146
- }
147
- },
148
- { once: true }
149
- );
150
- });
151
- }
152
- };
153
-
154
- onMounted(() => {
155
- if (props.inputmode === 'numeric') validateInput();
156
- });
157
- </script>
158
-
159
- <style lang="css">
160
- .input-text-wrapper {
161
- background-color: var(--element-decorator-background-color);
162
- outline: var(--element-decorator-outline-default);
163
-
164
- border-top-left-radius: var(--element-decorator-border-top-left-radius);
165
- border-top-right-radius: var(--element-decorator-border-top-right-radius);
166
- border-bottom-left-radius: var(--element-decorator-border-bottom-left-radius);
167
- border-bottom-right-radius: var(--element-decorator-border-bottom-right-radius);
168
-
169
- border-top: var(--element-decorator-border-top-default);
170
- border-right: var(--element-decorator-border-right-default);
171
- border-bottom: var(--element-decorator-border-bottom-default);
172
- border-left: var(--element-decorator-border-left-default);
173
-
174
- padding-inline: var(--element-decorator-padding-inline);
175
-
176
- &:hover {
177
- /* background-color: lab(89.6502 -0.829279 -2.45323 / 0.1); */
178
- background-color: var(--form-core-background-color-hover);
179
- }
180
-
181
- display: flex;
182
- align-items: center;
183
- gap: 12px;
184
-
185
- .slot {
186
- display: flex;
187
- place-items: center;
188
- background-clip: padding-box;
189
-
190
- &.left-slot {
191
- /* background-color: green; */
192
- }
193
- &.right-slot {
194
- /* background-color: orange; */
195
- }
196
- }
197
-
198
- .input-text-core {
199
- all: unset;
200
- flex-grow: 1;
201
-
202
- font-family: var(--font-family);
203
- font-size: var(--form-element-font-size);
204
- line-height: var(--form-element-line-height);
205
- padding-block: var(--input-element-padding-block);
206
- padding-inline: var(--input-element-padding-inline);
207
-
208
- &::placeholder {
209
- color: var(--input-placeholder-color);
210
- font-size: var(--input-placeholder-font-size);
211
- font-style: var(--input-placeholder-font-style);
212
- line-height: var(--input-placeholder-line-height);
213
- font-weight: var(--input-placeholder-font-weight);
214
- }
215
- }
216
- }
217
-
218
- .input-text-wrapper-XXX {
219
- --_focus-box-shadow: var(--box-shadow-off);
220
- --_input-text-core-color: var(--theme-form-input-text-color-normal);
221
-
222
- --_input-text-wrapper-background-color: var(--theme-form-input-bg-normal);
223
-
224
- --_input-text-wrapper-border: var(--form-element-border-width) solid var(--theme-form-input-border);
225
- --_input-text-wrapper-border-radius: var(--form-input-border-radius);
226
-
227
- --_input-text-wrapper-outline: var(--form-element-outline-width) solid var(--theme-form-input-outline);
228
- --_input-text-wrapper-opacity: 1;
229
- --_input-text-wrapper-box-shadow: var(--_focus-box-shadow);
230
- --_input-text-wrapper-margin-inline: 0;
231
- --_input-text-wrapper-padding-block: 0;
232
-
233
- &.underlined {
234
- --_input-text-core-color: var(--theme-form-input-text-color-underlined);
235
- --_input-text-wrapper-background-color: transparent;
236
- --_input-text-wrapper-padding-block: 0.5rem;
237
- }
238
-
239
- &.outlined {
240
- --_input-text-wrapper-margin-inline: 1px;
241
- --_input-text-wrapper-background-color: var(--theme-form-input-bg-outlined);
242
- }
243
-
244
- &.normal {
245
- &:focus-within {
246
- --_input-text-wrapper-box-shadow: var(--box-shadow-on);
247
- --_input-text-wrapper-outline: var(--form-element-outline-width) solid hsl(from var(--theme-form-input-outline-focus) h s 90%);
248
- }
249
- }
250
-
251
- &:not(.normal) {
252
- --_input-text-wrapper-border: none;
253
- --_input-text-wrapper-box-shadow: none;
254
- --_input-text-wrapper-outline: none;
255
- --_input-text-wrapper-opacity: 0;
256
-
257
- &:focus {
258
- --_input-text-wrapper-border: none;
259
- --_input-text-wrapper-box-shadow: none;
260
- --_input-text-wrapper-outline: none;
261
- --_input-text-wrapper-background-color: transparent;
262
- }
263
-
264
- &:focus-within {
265
- --_input-text-wrapper-border: none;
266
- --_input-text-wrapper-box-shadow: none;
267
- --_input-text-wrapper-outline: none;
268
- --_input-text-wrapper-background-color: transparent;
269
- }
270
-
271
- &.active,
272
- &.dirty {
273
- --_input-text-wrapper-border: none;
274
- --_input-text-wrapper-box-shadow: none;
275
- --_input-text-wrapper-outline: none;
276
- --_input-text-wrapper-background-color: transparent;
277
-
278
- --_input-text-wrapper-opacity: 1;
279
- }
280
- }
281
-
282
- display: flex;
283
- align-items: center;
284
-
285
- background-color: var(--_input-text-wrapper-background-color);
286
- border-radius: var(--_input-text-wrapper-border-radius);
287
- border: var(--_input-text-wrapper-border);
288
- outline: var(--_input-text-wrapper-outline);
289
- box-shadow: var(--_input-text-wrapper-box-shadow);
290
- opacity: var(--_input-text-wrapper-opacity);
291
-
292
- margin-inline: var(--_input-text-wrapper-margin-inline);
293
- padding-block: var(--_input-text-wrapper-padding-block);
294
-
295
- &:not(.normal) {
296
- transition: opacity 0.2s ease-in-out;
297
- }
298
-
299
- &:not(:has(.input-button-core)) {
300
- .slot {
301
- display: inline-block;
302
-
303
- .icon {
304
- color: var(--_input-text-core-color);
305
- aspect-ratio: 1;
306
- height: var(--form-icon-size);
307
- width: var(--form-icon-size);
308
- margin: 0 !important;
309
- padding: 0 !important;
310
- }
311
- }
312
- }
313
-
314
- &.has-left-slot {
315
- .left-slot {
316
- display: flex;
317
- align-items: center;
318
- margin-inline-start: 1rem;
319
- }
320
- }
321
-
322
- &.has-right-slot {
323
- .right-slot {
324
- display: flex;
325
- align-items: center;
326
- margin-inline-end: 1rem;
327
- }
328
- }
329
-
330
- .input-text-core {
331
- background-color: transparent;
332
- border: none;
333
- outline: none;
334
- box-shadow: none;
335
- flex-grow: 1;
336
-
337
- color: var(--_input-text-core-color);
338
- font-family: var(--font-family);
339
- font-size: var(--form-element-font-size);
340
- line-height: var(--form-element-line-height);
341
-
342
- padding-inline: var(--form-text-padding-inline);
343
- padding-block-start: var(--form-element-padding-block-start);
344
- padding-block-end: var(--form-element-padding-block-end);
345
-
346
- &::placeholder,
347
- &::-webkit-input-placeholder {
348
- font-family: var(--font-family);
349
- font-size: var(--form-element-font-size);
350
- font-style: italic;
351
- font-weight: 400;
352
- }
353
- }
354
-
355
- &:has(.has-left-button),
356
- &:has(.has-right-button) {
357
- .slot {
358
- .input-button-core {
359
- border: initial;
360
- border-radius: 0;
361
- outline: initial;
362
- box-shadow: unset;
363
- }
364
- }
365
-
366
- .left-slot {
367
- margin-inline-end: 0;
368
- border-right: 2px solid var(--theme-btn-bg-hover);
369
- }
370
-
371
- .right-slot {
372
- margin-inline-end: 0;
373
- border-left: 2px solid var(--theme-btn-bg-hover);
374
- }
375
- }
376
- }
377
-
378
- input:autofill,
379
- input:-internal-autofill-selected,
380
- input:-webkit-autofill-strong-password,
381
- input:-webkit-autofill-strong-password-viewable,
382
- input:-webkit-autofill-and-obscured {
383
- background-color: var(--theme-form-input-bg-normal) !important;
384
- background-image: none !important;
385
- color: var(--_input-text-core-color) !important;
386
- -webkit-box-shadow: 0 0 0rem 1000px var(--theme-form-input-bg-normal) inset;
387
- -webkit-text-fill-color: var(--_input-text-core-color);
388
- transition: background-color 5000s ease-in-out 0s;
389
- }
390
- </style>
@@ -1,300 +0,0 @@
1
- <template>
2
- <div>
3
- <div class="input-text-with-label" :data-form-theme="formTheme" :class="[elementClasses, inputVariant, { dirty: isDirty }, { active: isActive }]">
4
- <InputLabel :for="id" :id :theme :name :input-variant :field-has-error :style-class-passthrough="['input-text-label']">
5
- <template #textLabel>{{ label }}</template>
6
- </InputLabel>
7
-
8
- <div v-if="inputVariant === 'normal' && hasDescriptionSlot" :id="`${id}-description`">
9
- <slot name="description"></slot>
10
- </div>
11
-
12
- <InputTextCore
13
- v-model="modelValue"
14
- v-model:isDirty="isDirty"
15
- v-model:isActive="isActive"
16
- :type
17
- :inputmode
18
- :maxlength
19
- :id
20
- :name
21
- :placeholder
22
- :label
23
- :errorMessage
24
- :fieldHasError
25
- :required
26
- :styleClassPassthrough
27
- :theme
28
- :ariaDescribedby
29
- :size
30
- :inputVariant
31
- >
32
- <template v-if="hasLeftSlot" #left>
33
- <slot name="left"></slot>
34
- </template>
35
- <template v-if="hasRightSlot" #right>
36
- <slot name="right"></slot>
37
- </template>
38
- </InputTextCore>
39
-
40
- <InputError :errorMessage :showError="fieldHasError" :id="errorId" :isDetached="false" :inputVariant />
41
- </div>
42
-
43
- <div v-if="inputVariant !== 'normal' && hasDescriptionSlot" :id="`${id}-description`">
44
- <slot name="description"></slot>
45
- </div>
46
- </div>
47
- </template>
48
-
49
- <script setup lang="ts">
50
- import propValidators from '../../c12/prop-validators';
51
- const props = defineProps({
52
- maxlength: {
53
- type: Number,
54
- default: 255,
55
- },
56
- type: {
57
- type: String as PropType<'text' | 'email' | 'password' | 'number' | 'tel' | 'url'>,
58
- required: true,
59
- },
60
- inputmode: {
61
- type: String as PropType<'text' | 'email' | 'tel' | 'url' | 'search' | 'numeric' | 'none' | 'decimal'>,
62
- default: 'text',
63
- validator(value: string) {
64
- return propValidators.inputMode.includes(value);
65
- },
66
- },
67
- name: {
68
- type: String,
69
- required: true,
70
- },
71
- placeholder: {
72
- type: String,
73
- default: '',
74
- },
75
- label: {
76
- type: String,
77
- required: true,
78
- },
79
- errorMessage: {
80
- type: [Object, String],
81
- required: true,
82
- },
83
- fieldHasError: {
84
- type: Boolean,
85
- default: false,
86
- },
87
- required: {
88
- type: Boolean,
89
- default: false,
90
- },
91
- styleClassPassthrough: {
92
- type: Array as PropType<string[]>,
93
- default: () => [],
94
- },
95
- theme: {
96
- type: String as PropType<string>,
97
- default: 'primary',
98
- validator(value: string) {
99
- return propValidators.theme.includes(value);
100
- },
101
- },
102
- size: {
103
- type: String as PropType<string>,
104
- default: 'default',
105
- validator(value: string) {
106
- return propValidators.size.includes(value);
107
- },
108
- },
109
- inputVariant: {
110
- type: String as PropType<string>,
111
- default: 'normal',
112
- validator(value: string) {
113
- return propValidators.inputVariant.includes(value);
114
- },
115
- },
116
- });
117
-
118
- const slots = useSlots();
119
- const hasDescriptionSlot = computed(() => slots.description !== undefined);
120
- const hasLeftSlot = computed(() => slots.left !== undefined);
121
- const hasRightSlot = computed(() => slots.right !== undefined);
122
-
123
- const formTheme = computed(() => {
124
- return props.fieldHasError ? 'error' : props.theme;
125
- });
126
-
127
- const id = `${props.name}-${useId()}`;
128
- const errorId = `${id}-error-message`;
129
- const ariaDescribedby = computed(() => {
130
- const ariaDescribedbyId = hasDescriptionSlot.value ? `${id}-description` : undefined;
131
- return props.fieldHasError ? errorId : ariaDescribedbyId;
132
- });
133
-
134
- const modelValue = defineModel();
135
- const isActive = ref<boolean>(false);
136
- const isDirty = ref<boolean>(false);
137
-
138
- const { elementClasses } = useStyleClassPassthrough(props.styleClassPassthrough);
139
-
140
- const testDirty = () => {
141
- const watchValue = modelValue.value ?? '';
142
-
143
- if (!isDirty.value && typeof watchValue === 'string' && watchValue.length > 0) {
144
- isDirty.value = true;
145
- }
146
- };
147
-
148
- onMounted(() => {
149
- testDirty();
150
- });
151
-
152
- watch(
153
- () => modelValue.value,
154
- () => {
155
- testDirty();
156
- }
157
- );
158
- </script>
159
-
160
- <style lang="css">
161
- .input-text-with-label-XXX {
162
- --_input-text-with-label-margin-block-start: 0;
163
- --_input-text-with-label-background-color: transparent;
164
-
165
- --_input-text-wrapper-border: var(--form-element-border-width) solid var(--theme-form-input-border);
166
- --_input-text-wrapper-border-radius: var(--form-input-border-radius);
167
- --_input-text-wrapper-border-underlined: var(--form-element-border-width-underlined) solid var(--theme-form-input-border);
168
- --_input-text-wrapper-outline: var(--form-element-outline-width) solid var(--theme-form-input-outline);
169
- --_input-text-wrapper-box-shadow: var(--_focus-box-shadow);
170
- --_input-text-wrapper-padding-block: 0;
171
-
172
- --_focus-box-shadow: var(--box-shadow-off);
173
-
174
- /* Label vars */
175
- --_label-text-color: var(--theme-form-input-text-label-color-normal);
176
- --_label-text-margin-block: 0.8rem;
177
- --_label-text-size: var(--step-2);
178
- --_label-text-weight: normal;
179
- --_label-text-line-height: 1.5;
180
- --_label-text-background-color: var(--_input-text-with-label-background-color);
181
-
182
- &.underlined {
183
- --_label-text-color: var(--theme-form-input-text-label-color-underlined);
184
- --_label-offset: 1rem 0.2rem;
185
- --_input-text-with-label-background-color: color-mix(in srgb, currentColor 5%, transparent);
186
-
187
- --_input-text-wrapper-underlined-border-radius-top-left: 0;
188
- --_input-text-wrapper-underlined-border-radius-top-right: 0;
189
- --_input-text-wrapper-underlined-border-radius-bottom-left: 4px;
190
- --_input-text-wrapper-underlined-border-radius-bottom-right: 4px;
191
-
192
- --_label-text-background-color: transparent;
193
-
194
- &:has(.input-text-wrapper.active),
195
- &:has(.input-text-wrapper.dirty) {
196
- --_label-offset: 0 -3.2rem;
197
- --_label-text-weight: bolder;
198
- --_label-text-size: var(--step-1);
199
- /* line-height: 1.5; */
200
- /* padding: 0.2rem 1.2rem; */
201
- }
202
- }
203
-
204
- &.outlined {
205
- --_label-text-color: var(--theme-form-input-text-label-color-outlined);
206
-
207
- --_label-offset: 1rem -0.2rem;
208
- --_input-text-with-label-background-color: var(--theme-form-input-bg-normal);
209
-
210
- --_input-text-wrapper-padding-block: 0.4em 0;
211
-
212
- &:has(.input-text-wrapper.active),
213
- &:has(.input-text-wrapper.dirty) {
214
- --_label-offset: 1rem -2.8rem;
215
- --_label-text-weight: normal;
216
- /* --_label-text-size: var(--step-1); */
217
- /* line-height: 1.5; */
218
- /* padding: 0.2rem 1.2rem; */
219
- }
220
- }
221
-
222
- &:not(.normal) {
223
- --_input-text-with-label-margin-block-start: 3em;
224
-
225
- &:has(.input-text-wrapper.active),
226
- &:has(.input-text-wrapper.dirty) {
227
- /* --_label-offset: 1rem -2.8rem; */
228
- /* font-size: var(--step-1); */
229
- /* line-height: 1.5; */
230
- /* padding: 0.2rem 1.2rem; */
231
- }
232
-
233
- &:focus-within {
234
- --_input-text-wrapper-box-shadow: var(--box-shadow-on);
235
- --_input-text-wrapper-outline: var(--form-element-outline-width) solid hsl(from var(--theme-form-input-outline-focus) h s 90%);
236
- }
237
- }
238
-
239
- /*
240
- * Apply generic styles
241
- **/
242
-
243
- background-color: var(--_input-text-with-label-background-color);
244
- border-radius: var(--_input-text-wrapper-border-radius);
245
-
246
- /* overflow: clip; */
247
-
248
- &.underlined {
249
- /* border-bottom: var(--_input-text-wrapper-border-underlined); */
250
- border-top-left-radius: var(--_input-text-wrapper-underlined-border-radius-top-left);
251
- border-top-right-radius: var(--_input-text-wrapper-underlined-border-radius-top-right);
252
- border-bottom-left-radius: var(--_input-text-wrapper-underlined-border-radius-bottom-left);
253
- border-bottom-right-radius: var(--_input-text-wrapper-underlined-border-radius-bottom-right);
254
- }
255
-
256
- &.outlined {
257
- border: var(--_input-text-wrapper-border);
258
- outline: var(--_input-text-wrapper-outline);
259
- box-shadow: var(--_input-text-wrapper-box-shadow);
260
- padding-block: var(--_input-text-wrapper-padding-block);
261
- }
262
-
263
- &:not(.normal) {
264
- display: grid;
265
- grid-template-columns: 1fr;
266
- grid-template-rows: 1fr;
267
- grid-template-areas: 'underlined-text-stack';
268
-
269
- margin-block-start: var(--_input-text-with-label-margin-block-start);
270
-
271
- /* .input-text-label {
272
- grid-area: underlined-text-stack;
273
- z-index: 2;
274
- } */
275
- .input-text-wrapper {
276
- grid-area: underlined-text-stack;
277
- z-index: 1;
278
- }
279
- }
280
-
281
- /* .input-text-label {
282
- display: inline-block;
283
- color: var(--_label-text-color);
284
- background-color: var(--_label-text-background-color);
285
- margin-block: var(--_label-text-margin-block);
286
- font-size: var(--_label-text-size);
287
- font-weight: var(--_label-text-weight);
288
- line-height: var(--_label-text-line-height);
289
- translate: var(--_label-offset);
290
- width: fit-content;
291
- height: fit-content;
292
- transition: font-size 0.2s ease-in-out, translate 0.2s ease-in-out;
293
-
294
- &:not(.normal) {
295
- display: flex;
296
- align-items: center;
297
- }
298
- } */
299
- }
300
- </style>