minsky-webform-formkit 1.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 (35) hide show
  1. package/.pnp.cjs +11555 -0
  2. package/.pnp.loader.mjs +2126 -0
  3. package/LICENSE +21 -0
  4. package/README.md +324 -0
  5. package/dist/index.css +1 -0
  6. package/dist/index.js +1 -0
  7. package/package.json +55 -0
  8. package/src/components/FormKit/FormKitPhoneEnhanced/FormKitPhoneEnhanced.js +100 -0
  9. package/src/components/FormKit/FormKitPhoneEnhanced/FormKitPhoneEnhanced.vue +30 -0
  10. package/src/components/FormKit/FormKitPhoneEnhanced/countryCodes.js +1214 -0
  11. package/src/components/FormKit/FormKitRecaptcha/FormKitRecaptcha.vue +46 -0
  12. package/src/components/Icon.vue +38 -0
  13. package/src/components/InfoTooltip.vue +16 -0
  14. package/src/components/MinksyWebformFormKit/MinskyWebformFormKit.vue +357 -0
  15. package/src/components/MinksyWebformFormKit/_MinskyWebformFormKit.js +282 -0
  16. package/src/composables/useExample.js +0 -0
  17. package/src/formkit.config.js +72 -0
  18. package/src/index.mjs +20 -0
  19. package/src/plugins/customLabelPlugin.js +42 -0
  20. package/src/plugins/htmlHelpPlugin.js +23 -0
  21. package/src/rules/iban.js +9 -0
  22. package/src/rules/insz.js +21 -0
  23. package/src/rules/phone.js +29 -0
  24. package/src/rules/time.js +79 -0
  25. package/src/rules/vat.js +42 -0
  26. package/src/styles/_functions.scss +96 -0
  27. package/src/styles/_mixins.scss +29 -0
  28. package/src/styles/_variables.scss +7 -0
  29. package/src/styles/main.scss +11 -0
  30. package/src/styles/webform-formkit-multistep.scss +98 -0
  31. package/src/styles/webform-formkit.scss +215 -0
  32. package/src/styles/webform.scss +400 -0
  33. package/src/utils/functions.js +78 -0
  34. package/src/utils/lodash.js +208 -0
  35. package/src/utils/messages.js +37 -0
@@ -0,0 +1,96 @@
1
+ /* ========================================================================= */
2
+ /* SVG */
3
+ /* ========================================================================= */
4
+
5
+ @function strip-units($number) {
6
+ @return math.div($number, $number * 0 + 1);
7
+ }
8
+
9
+ /**
10
+ * Characters to escape from SVGs
11
+ * Source: https://github.com/Threespot/frontline-sass/blob/master/src/functions/_inline-svg.scss
12
+ */
13
+ $fs-escape-chars: (
14
+ ' ': '%20',
15
+ "'": '%22',
16
+ '"': '%27',
17
+ '#': '%23',
18
+ '/': '%2F',
19
+ ':': '%3A',
20
+ '(': '%28',
21
+ ')': '%29',
22
+ '%': '%25',
23
+ '<': '%3C',
24
+ '>': '%3E',
25
+ '\\':'%5C',
26
+ '^': '%5E',
27
+ '{': '%7B',
28
+ '|': '%7C',
29
+ '}': '%7D',
30
+ );
31
+
32
+ /// URL-encode SVG code
33
+ /// @param {string} $string - SVG code
34
+ /// @requires $fs-escape-chars
35
+ /// @return {string} - URL-encoded SVG code
36
+ @function url-encode($string) {
37
+ $escaped-string: '';
38
+
39
+ // Loop through each character in string
40
+ @for $i from 1 through str-length($string) {
41
+ $char: str-slice($string, $i, $i);
42
+
43
+ // Check if character is in symbol map
44
+ $char-lookup: map-get($fs-escape-chars, $char);
45
+
46
+ // If it is, use escaped version
47
+ @if $char-lookup != null {
48
+ $char: $char-lookup;
49
+ }
50
+
51
+ // Append character to escaped string
52
+ $escaped-string: $escaped-string + $char;
53
+ }
54
+
55
+ // Return escaped string
56
+ @return $escaped-string; /* stylelint-disable-line */
57
+ }
58
+
59
+ /// Replace `$search` with `$replace` in `$string`
60
+ /// @param {string} $string - Initial string
61
+ /// @param {string} $search - Substring to replace
62
+ /// @param {string} $replace ('') - New value
63
+ /// @return {string} - Updated string
64
+ @function str-replace($string, $search, $replace: '') {
65
+ $index: str-index($string, $search);
66
+
67
+ @if $index {
68
+ @return str-slice($string, 1, $index - 1) + $replace + str-replace(str-slice($string, $index + str-length($search)), $search, $replace);
69
+ }
70
+
71
+ @return $string; /* stylelint-disable-line */
72
+ }
73
+
74
+ /// Helper to get URL-escaped inline SVG code for use with `background-image`
75
+ /// @param {string} $name - Icon name
76
+ /// @param {string} $color (false) - Fill color
77
+ /// @return {string} - URL-encoded SVG code
78
+ @function svg($name, $color: false) {
79
+ // Check if icon exists
80
+ @if not map-has-key($svg-icons, $name) {
81
+ @error 'icon “#{$name}” does not exists in $svg-icons map';
82
+ @return false;
83
+ }
84
+
85
+ // Get icon data
86
+ $icon-map: map-get($svg-icons, $name);
87
+
88
+ @if $color {
89
+ // Replace color
90
+ $icon-map: str-replace($icon-map, 'fill="currentColor"', 'fill="#{$color}"');
91
+ $icon-map: str-replace($icon-map, 'stroke="currentColor"', 'stroke="#{$color}"');
92
+ }
93
+
94
+ // Return inline SVG data
95
+ @return url('data:image/svg+xml, #{url-encode(unquote($icon-map))} '); /* stylelint-disable-line */
96
+ }
@@ -0,0 +1,29 @@
1
+ // make element invisible for rendering but accessible
2
+ @mixin _noRenderProps() {
3
+ position: absolute !important;
4
+ height: 1px;
5
+ width: 1px;
6
+ overflow: hidden;
7
+ clip: rect(1px 1px 1px 1px);
8
+ clip: rect(1px, 1px, 1px, 1px);
9
+ z-index: -1;
10
+ }
11
+
12
+ // @include noRender(--bp-min-medium, --bp-max-large);
13
+ @mixin noRender($bp-min: null, $bp-max: null) {
14
+ @if ($bp-min != null and $bp-max != null) {
15
+ @media (#{$bp-min}) and (#{$bp-max}) {
16
+ @include _noRenderProps();
17
+ }
18
+ } @else if ($bp-min != null) {
19
+ @media (#{$bp-min}) {
20
+ @include _noRenderProps();
21
+ }
22
+ } @else if ($bp-max != null) {
23
+ @media (#{$bp-max}) {
24
+ @include _noRenderProps();
25
+ }
26
+ } @else {
27
+ @include _noRenderProps();
28
+ }
29
+ }
@@ -0,0 +1,7 @@
1
+ /**
2
+ * SVG icon map to be used with the `svg` function
3
+ */
4
+ $svg-icons: (
5
+ 'f-chevron-down': '<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 12 7"><path fill="currentColor" fill-rule="evenodd" d="M.244.244a.833.833 0 0 1 1.179 0l4.41 4.41 4.411-4.41a.833.833 0 1 1 1.179 1.179l-5 5a.833.833 0 0 1-1.179 0l-5-5a.833.833 0 0 1 0-1.179" clip-rule="evenodd"/></svg>',
6
+ 'f-check': '<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 14 11"><path fill="currentColor" d="M4.896 11 0 5.786l1.224-1.304 3.672 3.91L12.776 0 14 1.304z"/></svg>',
7
+ );
@@ -0,0 +1,11 @@
1
+ @import './functions';
2
+ @import './mixins';
3
+ @import './variables';
4
+
5
+ // dependencies
6
+ @import 'floating-vue/dist/style.css';
7
+
8
+ // styles
9
+ @import './webform';
10
+ @import './webform-formkit';
11
+ @import './webform-formkit-multistep';
@@ -0,0 +1,98 @@
1
+ .webform-formkit {
2
+ .formkit-step-inner {
3
+ display: grid;
4
+ gap: var(--f-form-gap);
5
+ }
6
+
7
+ .formkit-step-actions {
8
+ display: flex;
9
+ gap: 1rem;
10
+ justify-content: space-between;
11
+ margin-top: 1.8rem;
12
+
13
+ button {
14
+ &:disabled {
15
+ pointer-events: none;
16
+ opacity: 0.5;
17
+ background-color: var(--f-submit-btn-disabled-background-color);
18
+ }
19
+ }
20
+ }
21
+
22
+ .formkit-tabs {
23
+ display: flex;
24
+ justify-content: space-between;
25
+ counter-reset: tabs;
26
+ }
27
+
28
+ .formkit-tab {
29
+ position: relative;
30
+ counter-increment: tabs;
31
+ appearance: none;
32
+ padding-top: 4rem;
33
+ padding-bottom: 3.6rem;
34
+ color: var(--f-color);
35
+ font-family: var(--f-input-font-family);
36
+ text-align: center;
37
+ background-color: transparent;
38
+ border: 0;
39
+ font-size: 0.875em;
40
+ cursor: pointer;
41
+
42
+ &::before {
43
+ font-weight: 700;
44
+ position: absolute;
45
+ left: calc(50% - 1.5rem);
46
+ top: 0;
47
+ content: counter(tabs);
48
+ color: var(--f-multistep-color-tab);
49
+ width: 3rem;
50
+ height: 3rem;
51
+ background-color: var(--f-multistep-background-color-tab);
52
+ display: flex;
53
+ justify-content: center;
54
+ align-items: center;
55
+ border-radius: 1.5rem;
56
+ }
57
+
58
+ &[data-active='true'] {
59
+ font-weight: 700;
60
+
61
+ &::before {
62
+ color: var(--f-multistep-color-tab-active);
63
+ background-color: var(--f-multistep-background-color-tab-active);
64
+ }
65
+ }
66
+
67
+ &[data-valid='true'][data-visited='true'] {
68
+ &::before {
69
+ color: var(--f-multistep-color-tab-active);
70
+ background-color: var(--f-multistep-background-color-tab-active);
71
+ }
72
+
73
+ .formkit-badge {
74
+ background-image: svg('f-check');
75
+ background-color: var(--f-success-color);
76
+ background-size: 50%;
77
+ background-position: center;
78
+ background-repeat: no-repeat;
79
+ }
80
+ }
81
+
82
+ .formkit-badge {
83
+ font-size: 0.75em;
84
+ width: 2rem;
85
+ color: white;
86
+ height: 2rem;
87
+ background-color: var(--f-error-color);
88
+ border-radius: 1rem;
89
+ display: flex;
90
+ justify-content: center;
91
+ align-items: center;
92
+ font-weight: 700;
93
+ position: absolute;
94
+ top: -0.5rem;
95
+ left: calc(50% + 0.5rem);
96
+ }
97
+ }
98
+ }
@@ -0,0 +1,215 @@
1
+ .webform-formkit {
2
+ /* ========================================================================= */
3
+ /* styles */
4
+ /* ========================================================================= */
5
+ position: relative;
6
+
7
+ .formkit-outer[data-type='recaptcha'] {
8
+ .formkit-label {
9
+ @include noRender();
10
+ }
11
+ }
12
+
13
+ .webform-formkit__errors {
14
+ display: grid;
15
+ gap: 0.5rem;
16
+ color: var(--f-error-color);
17
+ margin-top: 0.3em;
18
+ }
19
+
20
+ //formkit-checkbox
21
+ .formkit-outer[data-type='radio'],
22
+ .formkit-outer[data-type='actionSelect'],
23
+ .formkit-outer[data-type='checkbox'] {
24
+ .formkit-wrapper {
25
+ display: flex;
26
+ align-items: flex-start;
27
+ margin: 0;
28
+ padding: 0;
29
+ }
30
+
31
+ .formkit-fieldset {
32
+ padding: 0;
33
+ border: 0;
34
+ margin: 0;
35
+ display: flex;
36
+ gap: 0;
37
+ flex-direction: column;
38
+ }
39
+
40
+ .formkit-legend {
41
+ text-transform: initial;
42
+ font-weight: initial;
43
+ margin-bottom: var(--f-label-margin-bottom);
44
+ padding-right: 0.6em;
45
+ display: block;
46
+ width: fit-content;
47
+ font-weight: 700;
48
+ }
49
+
50
+ .formkit-label {
51
+ margin-left: 1em;
52
+ margin-top: 0.1em;
53
+ font-weight: 400;
54
+ margin-bottom: 0;
55
+ cursor: pointer;
56
+ }
57
+
58
+ .formkit-options {
59
+ order: -1;
60
+ padding: 0;
61
+ margin: 0;
62
+ list-style-type: none;
63
+ }
64
+
65
+ .formkit-option {
66
+ margin-top: 0.5rem;
67
+
68
+ &:first-of-type {
69
+ margin-top: 0;
70
+ }
71
+ }
72
+
73
+ .formkit-input {
74
+ @include noRender();
75
+ }
76
+
77
+ .formkit-option-help {
78
+ font-style: italic;
79
+ font-size: 1.4rem;
80
+ margin-bottom: var(--f-label-margin-bottom);
81
+ margin-left: 4.2rem;
82
+ margin-top: calc(var(--f-label-margin-bottom) * -1 + 0.4em);
83
+ }
84
+
85
+ .formkit-decorator {
86
+ --width: var(--f-radio-check-decorater-height);
87
+ width: var(--width);
88
+ min-width: var(--width);
89
+ height: var(--width);
90
+ border: var(--f-submit-btn-border-width) solid var(--f-radio-check-border-color);
91
+ border-radius: 0.4rem;
92
+ background-color: var(--f-radio-check-background-color);
93
+ cursor: pointer;
94
+
95
+ display: flex;
96
+ align-items: center;
97
+ justify-content: center;
98
+
99
+ margin: 0;
100
+
101
+ &::before {
102
+ --width: calc(var(--f-radio-check-decorater-height) - 0.5em);
103
+ content: '';
104
+ width: var(--width);
105
+ height: var(--width);
106
+ background-image: svg('f-check');
107
+ background-size: contain;
108
+ background-repeat: no-repeat;
109
+ background-position: center;
110
+ transform-origin: center;
111
+ transform: scale(0);
112
+ transition: transform 150ms ease;
113
+ }
114
+ }
115
+
116
+ .formkit-input:focus + .formkit-decorator {
117
+ outline: var(--input-outline);
118
+ }
119
+
120
+ .formkit-input:checked + .formkit-decorator {
121
+ background-color: var(--f-radio-check-background-color-active);
122
+
123
+ &::before {
124
+ transform: scale(1);
125
+ }
126
+ }
127
+ }
128
+
129
+ .formkit-outer[data-type='actionSelect'] {
130
+ > .formkit-wrapper {
131
+ display: block;
132
+
133
+ > .formkit-label {
134
+ margin: 0;
135
+ display: flex;
136
+ }
137
+ }
138
+ }
139
+
140
+ .formkit-outer[data-type='radio']:not(.formkit-radio-toggle, .formkit-radio-buttons) {
141
+ .formkit-decorator {
142
+ border-radius: var(--width);
143
+
144
+ &::before {
145
+ --width: calc(var(--f-radio-check-decorater-height) - 0.8rem);
146
+ border-radius: var(--width);
147
+ background: none;
148
+ background-color: var(--f-radio-check-background-color-active);
149
+ }
150
+ }
151
+
152
+ .formkit-input:checked + .formkit-decorator {
153
+ background-color: var(--f-radio-check-background-color);
154
+ }
155
+ }
156
+
157
+ .formkit-optional {
158
+ font-size: 1em;
159
+ color: var(--f-input-placeholder-color);
160
+ margin-left: 0.25em;
161
+ }
162
+
163
+ label.form-required::after,
164
+ .formkit-asterisk {
165
+ margin-left: 0.1em;
166
+ }
167
+
168
+ .webform-formkit__success {
169
+ display: flex;
170
+ flex-direction: column;
171
+ align-items: center;
172
+ text-align: center;
173
+ }
174
+
175
+ .webform-flexbox {
176
+ display: flex;
177
+ flex-direction: column;
178
+ gap: var(--f-form-gap);
179
+ margin: 0;
180
+
181
+ @media (--bp-min-medium) {
182
+ flex-direction: row;
183
+ align-items: flex-start;
184
+ }
185
+
186
+ .formkit-outer {
187
+ flex-grow: 1;
188
+ width: 100%;
189
+ }
190
+ }
191
+ }
192
+
193
+ .webform-formkit__loader {
194
+ position: absolute;
195
+ left: 0;
196
+ right: 0;
197
+ top: 0;
198
+ bottom: 0;
199
+ display: flex;
200
+ justify-content: center;
201
+ align-items: center;
202
+
203
+ .icon {
204
+ font-size: 5em;
205
+ color: var(--f-loader-color);
206
+ }
207
+ }
208
+
209
+ .webform-formkit--loading {
210
+ min-height: 10rem; // for loading state
211
+
212
+ .formkit-form {
213
+ opacity: 0.25;
214
+ }
215
+ }