srcdev-nuxt-forms 0.0.20 → 0.0.21

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.
@@ -22,4 +22,7 @@
22
22
 
23
23
  --input-border-width-thin: 1px;
24
24
  --input-border-width-thick: 2px;
25
+
26
+ --font-family: futura-pt, Seravek, 'Gill Sans Nova', Ubuntu, Calibri,
27
+ 'DejaVu Sans', source-sans-pro, sans-serif;
25
28
  }
@@ -1 +1,2 @@
1
- @import "./forms/index.css";
1
+ @import './variables';
2
+ @import './forms';
@@ -1 +1 @@
1
- @import './_colours/index.css';
1
+ @import './colors/index.css';
@@ -7,7 +7,12 @@
7
7
  :pattern="componentValidation.pattern"
8
8
  :maxlength="componentValidation.maxlength"
9
9
  :required
10
- :class="['input-text', 'text-normal', { error: fieldHasError() }]"
10
+ :class="[
11
+ 'input-text',
12
+ 'text-normal',
13
+ styleClassPassthrough,
14
+ { error: fieldHasError() },
15
+ ]"
11
16
  v-model="modelValue.data[name]"
12
17
  ref="inputField"
13
18
  @focusin="isFocused = true"
@@ -54,6 +59,10 @@ const props = defineProps({
54
59
  type: Object as PropType<InpuTextC12>,
55
60
  required: true,
56
61
  },
62
+ styleClassPassthrough: {
63
+ type: String,
64
+ default: '',
65
+ },
57
66
  });
58
67
 
59
68
  const modelValue = defineModel() as Ref<IFormData>;
@@ -1,16 +1,21 @@
1
1
  <template>
2
2
  <div class="input-text-material">
3
- <label :for="id">{{ c12.label }}</label>
4
- <InputTextCore
5
- :id
6
- :name
7
- :type
8
- :validation
9
- :required
10
- v-model="modelValue"
11
- v-model:isFocused="isFocused"
12
- :c12
13
- />
3
+ <label class="label" :class="[{ active: isFocused }]" :for="id"
4
+ >{{ c12.label }} - isFocused({{ isFocused }})</label
5
+ >
6
+ <div class="input-placeholder">
7
+ <InputTextCore
8
+ :id
9
+ :name
10
+ :type
11
+ :validation
12
+ :required
13
+ v-model="modelValue"
14
+ v-model:isFocused="isFocused"
15
+ :c12
16
+ :style-class-passthrough="styleClassPassthrough"
17
+ />
18
+ </div>
14
19
  </div>
15
20
  </template>
16
21
 
@@ -59,30 +64,80 @@ const name = computed(() => {
59
64
  return props.name !== null ? props.name : props.id;
60
65
  });
61
66
 
67
+ const styleClassPassthrough = computed(() => {
68
+ return isFocused.value ? 'is-active' : '';
69
+ });
70
+
62
71
  const modelValue = defineModel() as Ref<IFormData>;
63
72
  const isFocused = ref(false);
64
73
  </script>
65
74
 
66
75
  <style lang="css">
67
76
  .input-text-material {
68
- display: flex;
69
- flex-direction: column;
77
+ --_gutter: 12px;
78
+
79
+ display: grid;
80
+ grid-template-columns: 1fr;
81
+ /* grid-template-rows: var(--_gutter) 1fr var(--_gutter); */
82
+ grid-template-rows: var(--_gutter) 1fr var(--_gutter);
83
+ gap: calc(var(--_gutter) / 2);
70
84
 
71
- border: 1px solid black;
85
+ border: 1px solid red;
72
86
  border-radius: 2px;
73
87
 
74
88
  margin-bottom: 20px;
89
+ /* padding: calc(2 * var(--_gutter)); */
90
+
91
+ .label {
92
+ grid-row: 2;
93
+ grid-column: 1;
94
+
95
+ font-family: var(--font-family);
96
+ font-size: 16px;
97
+ font-weight: 700;
98
+ padding: var(--_gutter);
99
+ /* transform: translateY(12px); */
100
+
101
+ z-index: 2;
75
102
 
76
- .input-text {
77
- border: 1px solid red;
78
- margin: 5px;
103
+ transition: all linear 0.2s;
79
104
 
80
- /* &::placeholder,
105
+ &.active {
106
+ grid-row: 1;
107
+ grid-column: 1;
108
+ /* padding: 0; */
109
+ transform: translateY(-10px);
110
+ }
111
+ }
112
+
113
+ .input-placeholder {
114
+ grid-row: 2;
115
+ grid-column: 1;
116
+ align-content: center;
117
+ padding-inline: var(--_gutter);
118
+ transform: translateY(12px);
119
+
120
+ .input-text {
121
+ font-family: var(--font-family);
122
+ border: 0px solid green;
123
+ padding: var(--_gutter);
124
+ font-size: 16px;
125
+
126
+ /* &::placeholder,
81
127
  &:-ms-input-placeholder,
82
128
  &::-moz-placeholder, */
83
- &::-webkit-input-placeholder {
84
- color: rgb(128, 0, 117);
85
- font-size: 30px;
129
+ &::-webkit-input-placeholder {
130
+ font-family: var(--font-family);
131
+ color: var(--gray-5);
132
+ font-size: 14px;
133
+ font-style: italic;
134
+ font-weight: 700;
135
+ opacity: 0;
136
+
137
+ &.is-active {
138
+ opacity: 1;
139
+ }
140
+ }
86
141
  }
87
142
  }
88
143
  }
@@ -16,7 +16,7 @@ defineProps({
16
16
  type: Boolean as PropType<boolean>,
17
17
  default: true,
18
18
  },
19
- })
19
+ });
20
20
  </script>
21
21
 
22
22
  <style lang="css">
@@ -26,7 +26,7 @@ defineProps({
26
26
 
27
27
  margin-inline: auto;
28
28
  width: min(100% - calc(2 * var(--_gutter-width)), var(--_max-width));
29
- outline: 1px solid #571818;
29
+ outline: 1px solid var(--gray-5);
30
30
 
31
31
  &.has-gutter {
32
32
  --_gutter-width: 16px;
@@ -12,12 +12,12 @@ defineProps({
12
12
  default: 'narrow',
13
13
  validator: (val: string) => ['narrow', 'medium', 'wide'].includes(val),
14
14
  },
15
- })
15
+ });
16
16
  </script>
17
17
 
18
18
  <style lang="css">
19
19
  .form-wrapper {
20
- outline: 1px solid #000;
20
+ outline: 1px solid var(--gray-12);
21
21
 
22
22
  &.narrow {
23
23
  max-width: 400px;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "srcdev-nuxt-forms",
3
3
  "type": "module",
4
- "version": "0.0.20",
4
+ "version": "0.0.21",
5
5
  "main": "./nuxt.config.ts",
6
6
  "scripts": {
7
7
  "reinstall": "rm -rf node_modules && npm install",
@@ -1,10 +0,0 @@
1
- :root {
2
- --colour-primary: #ff0000;
3
- --colour-secondary: #00ff00;
4
- --colour-tertiary: #0000ff;
5
- --colour-quaternary: #ffff00;
6
- --colour-quinary: #ff00ff;
7
- --colour-senary: #00ffff;
8
- --colour-septenary: #000000;
9
- --colour-octonary: #ffffff;
10
- }