picocrank 1.23.1 → 1.24.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "picocrank",
3
- "version": "1.23.1",
3
+ "version": "1.24.0",
4
4
  "description": "A set of zero dependency Vue components built on the Femtocrank global CSS theme.",
5
5
  "main": "vite.config.js",
6
6
  "scripts": {
@@ -1,7 +1,35 @@
1
1
  <template>
2
2
  <label v-if="!fake" :for="controlId" :class="{ disabled }">{{ label }}</label>
3
3
  <span v-else class="fake-label" :class="{ disabled }">{{ label }}</span>
4
- <slot />
4
+ <div v-if="hasFieldMeta" class="form-field-control">
5
+ <template v-if="descriptionAbove">
6
+ <div v-if="description || docsUrl" class="form-field-meta">
7
+ <p v-if="description" class="subtle form-field-description">{{ description }}</p>
8
+ <a
9
+ v-if="docsUrl"
10
+ class="form-field-docs-link"
11
+ :href="docsUrl"
12
+ target="_blank"
13
+ rel="noopener noreferrer"
14
+ >{{ docsLinkTitle }}</a>
15
+ </div>
16
+ <slot />
17
+ </template>
18
+ <template v-else>
19
+ <slot />
20
+ <div v-if="description || docsUrl" class="form-field-meta">
21
+ <p v-if="description" class="subtle form-field-description">{{ description }}</p>
22
+ <a
23
+ v-if="docsUrl"
24
+ class="form-field-docs-link"
25
+ :href="docsUrl"
26
+ target="_blank"
27
+ rel="noopener noreferrer"
28
+ >{{ docsLinkTitle }}</a>
29
+ </div>
30
+ </template>
31
+ </div>
32
+ <slot v-else />
5
33
  </template>
6
34
 
7
35
  <script setup>
@@ -12,6 +40,22 @@ const props = defineProps({
12
40
  type: String,
13
41
  required: true,
14
42
  },
43
+ description: {
44
+ type: String,
45
+ default: '',
46
+ },
47
+ descriptionAbove: {
48
+ type: Boolean,
49
+ default: false,
50
+ },
51
+ docsUrl: {
52
+ type: String,
53
+ default: '',
54
+ },
55
+ docsUrlTitle: {
56
+ type: String,
57
+ default: '',
58
+ },
15
59
  for: {
16
60
  type: String,
17
61
  default: '',
@@ -31,6 +75,8 @@ const props = defineProps({
31
75
  })
32
76
 
33
77
  const controlId = computed(() => props.htmlFor || props.for)
78
+ const hasFieldMeta = computed(() => Boolean(props.description || props.docsUrl))
79
+ const docsLinkTitle = computed(() => props.docsUrlTitle || props.docsUrl)
34
80
  </script>
35
81
 
36
82
  <style scoped>
@@ -39,4 +85,26 @@ label.disabled,
39
85
  color: var(--disabled-text-color);
40
86
  cursor: not-allowed;
41
87
  }
88
+
89
+ .form-field-control {
90
+ display: flex;
91
+ flex-direction: column;
92
+ gap: 0.5rem;
93
+ width: 100%;
94
+ }
95
+
96
+ .form-field-meta {
97
+ display: flex;
98
+ flex-direction: column;
99
+ gap: 0.35rem;
100
+ }
101
+
102
+ .form-field-description {
103
+ margin: 0;
104
+ }
105
+
106
+ .form-field-docs-link {
107
+ font-size: 0.9em;
108
+ align-self: flex-start;
109
+ }
42
110
  </style>
@@ -8,7 +8,11 @@
8
8
  </template>
9
9
 
10
10
  <FormLayout @submit.prevent="handleSubmit">
11
- <FormField label="Name" for="name">
11
+ <FormField
12
+ label="Name"
13
+ for="name"
14
+ description="Your full name as it will appear on your profile."
15
+ >
12
16
  <input
13
17
  id="name"
14
18
  v-model="formData.name"
@@ -46,7 +50,14 @@
46
50
  </select>
47
51
  </FormField>
48
52
 
49
- <FormField label="Compensation" fake>
53
+ <FormField
54
+ label="Compensation"
55
+ fake
56
+ description-above
57
+ description="Select the incentive plan that applies to this role."
58
+ docs-url="https://github.com/jamesread/femtocrank"
59
+ docs-url-title="Femtocrank documentation"
60
+ >
50
61
  <RadioGroup
51
62
  v-model="formData.compensation"
52
63
  name="compensation"
@@ -55,7 +66,14 @@
55
66
  />
56
67
  </FormField>
57
68
 
58
- <FormField label="Accessibility requirements" fake>
69
+ <FormField
70
+ label="Accessibility requirements"
71
+ fake
72
+ description-above
73
+ description="Choose any accommodations needed for this role."
74
+ docs-url="https://www.w3.org/WAI/fundamentals/accessibility-intro/"
75
+ docs-url-title="Web accessibility introduction"
76
+ >
59
77
  <CheckGroup
60
78
  v-model="formData.accessibility"
61
79
  name="accessibility"
@@ -63,7 +81,13 @@
63
81
  />
64
82
  </FormField>
65
83
 
66
- <FormField label="Email" for="email">
84
+ <FormField
85
+ label="Email"
86
+ for="email"
87
+ description="We'll use this address for account notifications only."
88
+ docs-url="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/email"
89
+ docs-url-title="HTML email input reference"
90
+ >
67
91
  <input
68
92
  id="email"
69
93
  v-model="formData.email"
@@ -81,7 +105,13 @@
81
105
  />
82
106
  </FormField>
83
107
 
84
- <FormField label="Website" for="website">
108
+ <FormField
109
+ label="Website"
110
+ for="website"
111
+ description="Include https:// for external links."
112
+ docs-url="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/url"
113
+ docs-url-title="HTML URL input reference"
114
+ >
85
115
  <input
86
116
  id="website"
87
117
  v-model="formData.website"
@@ -141,7 +171,11 @@
141
171
  </div>
142
172
  </FormField>
143
173
 
144
- <FormField label="Comments" for="comments">
174
+ <FormField
175
+ label="Comments"
176
+ for="comments"
177
+ description="Optional feedback or notes about this submission."
178
+ >
145
179
  <textarea
146
180
  id="comments"
147
181
  v-model="formData.comments"