srcdev-nuxt-forms 0.0.20 → 0.0.22

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 +1,2 @@
1
- @import "./variables/_theme.css";
1
+ @import './variables/_theme.css';
2
+ @import './themes/index.css';
@@ -0,0 +1,3 @@
1
+ :where(html) {
2
+ --primary-border-default: var(--blue-8);
3
+ }
@@ -0,0 +1 @@
1
+ @import './_primary.css';
@@ -1,25 +1,9 @@
1
1
  :root {
2
- --form-bg-color: #f9f9f9; /* Background color for form */
3
- --form-border-color: #cccccc; /* Border color for form elements */
4
- --form-text-color: #333333; /* Text color for form elements */
5
- --form-placeholder-color: #888888; /* Placeholder text color */
6
- --form-focus-border-color: #0076c6; /* Border color on focus */
7
- --form-button-bg-color: #0076c6; /* Button background color */
8
- --form-button-text-color: #ffffff; /* Button text color */
9
- --form-error-color: #ce0606; /* Error message color */
10
- --form-success-color: #008000; /* Success message color */
11
- --form-warning-color: #ffcc00; /* Warning message color */
12
- --form-info-color: #0076c6; /* Info message color */
13
- --form-required-color: #ce0606; /* Required field color */
14
- --form-disabled-color: #cccccc; /* Disabled field color */
15
- --form-disabled-bg-color: #f9f9f9; /* Disabled field background color */
16
- --form-disabled-border-color: #cccccc; /* Disabled field border color */
17
- --form-disabled-text-color: #999999; /* Disabled field text color */
18
-
19
- --input-border: #121212;
20
-
21
2
  --input-border-radius: 4px;
22
-
23
3
  --input-border-width-thin: 1px;
24
- --input-border-width-thick: 2px;
4
+ --input-border-width-default: 2px;
5
+ --input-border-width-thick: 3px;
6
+
7
+ --font-family: futura-pt, Seravek, 'Gill Sans Nova', Ubuntu, Calibri,
8
+ 'DejaVu Sans', source-sans-pro, sans-serif;
25
9
  }
@@ -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,24 @@
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
4
+ class="label"
5
+ :class="[{ active: isFocused }, { dirty: isDirty }]"
6
+ :for="id"
7
+ >{{ c12.label }}</label
8
+ >
9
+ <div class="input-text-container">
10
+ <InputTextCore
11
+ :id
12
+ :name
13
+ :type
14
+ :validation
15
+ :required
16
+ v-model="modelValue"
17
+ v-model:isFocused="isFocused"
18
+ :c12
19
+ :style-class-passthrough="styleClassPassthrough"
20
+ />
21
+ </div>
14
22
  </div>
15
23
  </template>
16
24
 
@@ -59,30 +67,92 @@ const name = computed(() => {
59
67
  return props.name !== null ? props.name : props.id;
60
68
  });
61
69
 
70
+ const styleClassPassthrough = computed(() => {
71
+ return isFocused.value ? 'is-active' : '';
72
+ });
73
+
62
74
  const modelValue = defineModel() as Ref<IFormData>;
63
75
  const isFocused = ref(false);
76
+ const isDirty = computed(() => {
77
+ return modelValue.value.data[name.value] !== '';
78
+ });
64
79
  </script>
65
80
 
66
81
  <style lang="css">
67
82
  .input-text-material {
68
- display: flex;
69
- flex-direction: column;
83
+ input {
84
+ background-color: transparent;
85
+ &:focus {
86
+ outline: none;
87
+ box-shadow: none;
88
+ border: none;
89
+ }
90
+ }
91
+
92
+ --_gutter: 12px;
93
+ --_border-default: var(--primary-border-default);
94
+ --_border-width: var(--input-border-width-default);
70
95
 
71
- border: 1px solid black;
96
+ display: grid;
72
97
  border-radius: 2px;
98
+ outline: var(--_border-width) solid var(--_border-default);
73
99
 
74
100
  margin-bottom: 20px;
101
+ overflow: hidden;
102
+
103
+ &:focus-within {
104
+ outline: calc(var(--_border-width) * 2) solid var(--_border-default);
105
+ background-color: hsl(from var(--_border-default) h s 95%);
106
+ }
75
107
 
76
- .input-text {
77
- border: 1px solid red;
78
- margin: 5px;
108
+ .label {
109
+ grid-row: 1;
110
+ grid-column: 1;
79
111
 
80
- /* &::placeholder,
112
+ font-family: var(--font-family);
113
+ font-size: 20px;
114
+ font-weight: 700;
115
+ padding: var(--_gutter);
116
+ transform: translateY(10px);
117
+ transition: all linear 0.2s;
118
+ background-color: transparent;
119
+
120
+ &.active,
121
+ &.dirty {
122
+ font-size: 14px;
123
+ transform: translateY(0);
124
+ }
125
+ }
126
+
127
+ .input-text-container {
128
+ display: grid;
129
+ grid-row: 1;
130
+ grid-column: 1;
131
+ margin-top: 2rem;
132
+ background-color: transparent;
133
+
134
+ .input-text {
135
+ font-family: var(--font-family);
136
+ border: 0px solid green;
137
+ padding: calc(var(--_gutter) / 2) var(--_gutter);
138
+ font-size: 16px;
139
+ margin: 0;
140
+
141
+ /* &::placeholder,
81
142
  &:-ms-input-placeholder,
82
143
  &::-moz-placeholder, */
83
- &::-webkit-input-placeholder {
84
- color: rgb(128, 0, 117);
85
- font-size: 30px;
144
+ &::-webkit-input-placeholder {
145
+ font-family: var(--font-family);
146
+ color: var(--gray-5);
147
+ font-size: 14px;
148
+ font-style: italic;
149
+ font-weight: 700;
150
+ opacity: 0;
151
+
152
+ &.is-active {
153
+ opacity: 1;
154
+ }
155
+ }
86
156
  }
87
157
  }
88
158
  }
@@ -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: 0px 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.22",
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
- }