picocrank 1.21.4 → 1.22.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.
@@ -19,35 +19,20 @@
19
19
  </FormField>
20
20
 
21
21
  <FormField label="Role" fake>
22
- <div class="radio-group">
23
- <label>
24
- <input
25
- type="radio"
26
- name="role"
27
- value="sales"
28
- v-model="formData.role"
29
- />
30
- <span>Sales</span>
31
- </label>
32
- <label>
33
- <input
34
- type="radio"
35
- name="role"
36
- value="engineering"
37
- v-model="formData.role"
38
- />
39
- <span>Engineering</span>
40
- </label>
41
- <label>
42
- <input
43
- type="radio"
44
- name="role"
45
- value="hr"
46
- v-model="formData.role"
47
- />
48
- <span>HR</span>
49
- </label>
50
- </div>
22
+ <RadioGroup
23
+ v-model="formData.role"
24
+ name="role"
25
+ :options="roleOptions"
26
+ />
27
+ </FormField>
28
+
29
+ <FormField label="Term" fake>
30
+ <RadioGroup
31
+ v-model="formData.term"
32
+ name="term"
33
+ variant="boolean"
34
+ :options="termOptions"
35
+ />
51
36
  </FormField>
52
37
 
53
38
  <FormField label="Salary" for="salary">
@@ -61,6 +46,23 @@
61
46
  </select>
62
47
  </FormField>
63
48
 
49
+ <FormField label="Compensation" fake>
50
+ <RadioGroup
51
+ v-model="formData.compensation"
52
+ name="compensation"
53
+ variant="list"
54
+ :options="compensationOptions"
55
+ />
56
+ </FormField>
57
+
58
+ <FormField label="Accessibility requirements" fake>
59
+ <CheckGroup
60
+ v-model="formData.accessibility"
61
+ name="accessibility"
62
+ :options="accessibilityOptions"
63
+ />
64
+ </FormField>
65
+
64
66
  <FormField label="Email" for="email">
65
67
  <input
66
68
  id="email"
@@ -190,11 +192,41 @@ import { ref } from 'vue'
190
192
  import Section from '../components/Section.vue'
191
193
  import FormLayout from '../components/FormLayout.vue'
192
194
  import FormField from '../components/FormField.vue'
195
+ import RadioGroup from '../components/RadioGroup.vue'
196
+ import CheckGroup from '../components/CheckGroup.vue'
197
+
198
+ // From femtocrank/tests/simple.html — Role (default), Term (boolean), Compensation (list)
199
+ const roleOptions = [
200
+ { label: 'Sales', value: 'sales' },
201
+ { label: 'Engineering', value: 'engineering' },
202
+ { label: 'HR', value: 'hr' },
203
+ ]
204
+
205
+ const termOptions = [
206
+ { label: 'Full Time', value: 'full-time' },
207
+ { label: 'Part Time', value: 'part-time' },
208
+ ]
209
+
210
+ const compensationOptions = [
211
+ { label: 'Performance Incentive', value: 'performance-incentive' },
212
+ { label: 'Sales Target Incentive', value: 'sales-target-incentive' },
213
+ { label: 'Objective Incentive', value: 'objective-incentive' },
214
+ ]
215
+
216
+ const accessibilityOptions = [
217
+ { label: 'Screen reader support', value: 'screen-reader' },
218
+ { label: 'Keyboard navigation', value: 'keyboard-navigation' },
219
+ { label: 'High contrast', value: 'high-contrast' },
220
+ { label: 'Captions / transcripts', value: 'captions' },
221
+ ]
193
222
 
194
223
  const formData = ref({
195
224
  name: '',
196
225
  role: '',
226
+ term: '',
197
227
  salary: '0',
228
+ compensation: '',
229
+ accessibility: [],
198
230
  email: '',
199
231
  isAdmin: false,
200
232
  website: '',
@@ -227,7 +259,10 @@ function resetForm() {
227
259
  formData.value = {
228
260
  name: '',
229
261
  role: '',
262
+ term: '',
230
263
  salary: '0',
264
+ compensation: '',
265
+ accessibility: [],
231
266
  email: '',
232
267
  isAdmin: false,
233
268
  website: '',
@@ -10,103 +10,132 @@
10
10
  </Section>
11
11
 
12
12
  <Section title="Header" subtitle="Branding, search, and top navigation">
13
- <dl>
14
- <dt>Logo and title</dt>
15
- <dd>
16
- <label class="page-structure-control">
17
- <input
18
- type="checkbox"
19
- :checked="brandingEnabled"
20
- @change="toggleBrandingEnabled"
21
- />
22
- <span>Show logo and title in the header</span>
23
- </label>
24
- </dd>
25
-
26
- <dt>QuickSearch</dt>
27
- <dd>
28
- <label class="page-structure-control">
29
- <input
30
- type="checkbox"
31
- :checked="quickSearchEnabled"
32
- @change="toggleQuickSearchEnabled"
33
- />
34
- <span>Show QuickSearch in the header toolbar</span>
35
- </label>
36
- <p class="subtle">
37
- On narrow screens it collapses to a search button that opens search in an overlay.
38
- </p>
39
- </dd>
40
-
41
- <dt>Top bar</dt>
42
- <dd>
43
- <label class="page-structure-control">
44
- <input
45
- type="checkbox"
46
- :checked="topBarEnabled"
47
- @change="toggleTopBarEnabled"
13
+ <FormLayout @submit.prevent>
14
+ <FormField label="Logo and title" fake>
15
+ <RadioGroup
16
+ name="ps-branding"
17
+ variant="boolean"
18
+ aria-label="Logo and title"
19
+ :model-value="brandingEnabled"
20
+ :options="showHideOptions"
21
+ @update:model-value="setBrandingEnabled"
22
+ />
23
+ </FormField>
24
+
25
+ <FormField label="QuickSearch" fake>
26
+ <RadioGroup
27
+ name="ps-quicksearch"
28
+ variant="boolean"
29
+ aria-label="QuickSearch"
30
+ :model-value="quickSearchEnabled"
31
+ :options="showHideOptions"
32
+ @update:model-value="setQuickSearchEnabled"
33
+ />
34
+ </FormField>
35
+
36
+ <FormField label="Dummy background search" fake :disabled="!quickSearchEnabled">
37
+ <div>
38
+ <RadioGroup
39
+ name="ps-dummy-search"
40
+ variant="boolean"
41
+ aria-label="Dummy background search"
42
+ :model-value="dummySearchFetchEnabled"
43
+ :options="onOffOptions"
44
+ :disabled="!quickSearchEnabled"
45
+ @update:model-value="setDummySearchFetchEnabled"
48
46
  />
49
- <span>Show horizontal navigation links below the header</span>
50
- </label>
51
- <p class="subtle">
52
- On narrow screens: if both are on, the sidebar takes precedence and the top bar is hidden.
53
- If only the top bar is on, Header collapses it into a mobile sidebar automatically.
54
- </p>
55
- </dd>
56
-
57
- <dt>Breadcrumbs</dt>
58
- <dd>
59
- <label class="page-structure-control">
60
- <input
61
- type="checkbox"
62
- :checked="breadcrumbsEnabled"
63
- @change="toggleBreadcrumbsEnabled"
47
+ <p class="subtle">
48
+ Turns on QuickSearch’s background-fetch loading UI. Local matches still
49
+ appear immediately while the dummy request runs.
50
+ </p>
51
+ </div>
52
+ </FormField>
53
+
54
+ <FormField label="Dark/Light mode button" fake>
55
+ <RadioGroup
56
+ name="ps-theme-toggle"
57
+ variant="boolean"
58
+ aria-label="Dark/Light mode button"
59
+ :model-value="themeToggleEnabled"
60
+ :options="showHideOptions"
61
+ @update:model-value="setThemeToggleEnabled"
62
+ />
63
+ </FormField>
64
+
65
+ <FormField label="Top bar" fake>
66
+ <div>
67
+ <RadioGroup
68
+ name="ps-topbar"
69
+ variant="boolean"
70
+ aria-label="Top bar"
71
+ :model-value="topBarEnabled"
72
+ :options="showHideOptions"
73
+ @update:model-value="setTopBarEnabled"
64
74
  />
65
- <span>Show route breadcrumbs in the header</span>
66
- </label>
67
- </dd>
68
- </dl>
75
+ <p class="subtle">
76
+ On narrow screens: if both are on, the sidebar takes precedence and the top bar is hidden.
77
+ If only the top bar is on, Header collapses it into a mobile sidebar automatically.
78
+ </p>
79
+ </div>
80
+ </FormField>
81
+
82
+ <FormField label="Breadcrumbs" fake>
83
+ <RadioGroup
84
+ name="ps-breadcrumbs"
85
+ variant="boolean"
86
+ aria-label="Breadcrumbs"
87
+ :model-value="breadcrumbsEnabled"
88
+ :options="showHideOptions"
89
+ @update:model-value="setBreadcrumbsEnabled"
90
+ />
91
+ </FormField>
92
+ </FormLayout>
69
93
  </Section>
70
94
 
71
95
  <Section title="Sidebar" subtitle="Primary navigation panel">
72
- <dl>
73
- <dt>Sidebar navigation</dt>
74
- <dd>
75
- <label class="page-structure-control">
76
- <input
77
- type="checkbox"
78
- :checked="sidebarEnabled"
79
- @change="toggleSidebarEnabled"
96
+ <FormLayout @submit.prevent>
97
+ <FormField label="Sidebar navigation" fake>
98
+ <div>
99
+ <RadioGroup
100
+ name="ps-sidebar"
101
+ variant="boolean"
102
+ aria-label="Sidebar navigation"
103
+ :model-value="sidebarEnabled"
104
+ :options="showHideOptions"
105
+ @update:model-value="setSidebarEnabled"
80
106
  />
81
- <span>Show the sidebar navigation panel</span>
82
- </label>
83
- <p class="subtle">
84
- When enabled, use the menu button in the header to open and pin the sidebar.
85
- </p>
86
- </dd>
87
-
88
- <dt>Example link states</dt>
89
- <dd>
90
- <label class="page-structure-control">
91
- <input
92
- type="checkbox"
93
- :checked="exampleLinksEnabled"
94
- @change="toggleExampleLinks"
107
+ <p class="subtle">
108
+ When enabled, use the menu button in the header to open and pin the sidebar.
109
+ </p>
110
+ </div>
111
+ </FormField>
112
+
113
+ <FormField label="Example link states" fake>
114
+ <div>
115
+ <RadioGroup
116
+ name="ps-example-links"
117
+ variant="boolean"
118
+ aria-label="Example link states"
119
+ :model-value="exampleLinksEnabled"
120
+ :options="onOffOptions"
121
+ @update:model-value="setExampleLinks"
95
122
  />
96
- <span>Add example links that demonstrate indicator, count, and disabled states</span>
97
- </label>
98
- <p class="subtle">
99
- Adds a “Link states” section to the sidebar with an attention indicator,
100
- a notification count badge, and a disabled item.
101
- </p>
102
- </dd>
103
- </dl>
123
+ <p class="subtle">
124
+ Adds a “Link states” section to the sidebar with an attention indicator,
125
+ a notification count badge, and a disabled item.
126
+ </p>
127
+ </div>
128
+ </FormField>
129
+ </FormLayout>
104
130
  </Section>
105
131
  </template>
106
132
 
107
133
  <script setup>
108
134
  import { inject, ref, onBeforeUnmount } from 'vue'
109
135
  import Section from '../components/Section.vue'
136
+ import FormLayout from '../components/FormLayout.vue'
137
+ import FormField from '../components/FormField.vue'
138
+ import RadioGroup from '../components/RadioGroup.vue'
110
139
  import {
111
140
  Notification01Icon,
112
141
  Alert02Icon,
@@ -121,12 +150,26 @@ const EXAMPLE_LINK_NAMES = [
121
150
  'example-disabled',
122
151
  ]
123
152
 
153
+ const showHideOptions = [
154
+ { label: 'Shown', value: true },
155
+ { label: 'Hidden', value: false },
156
+ ]
157
+
158
+ const onOffOptions = [
159
+ { label: 'On', value: true },
160
+ { label: 'Off', value: false },
161
+ ]
162
+
124
163
  const sidebarEnabled = inject('sidebarEnabled')
125
164
  const toggleSidebarEnabled = inject('toggleSidebarEnabled')
126
165
  const brandingEnabled = inject('brandingEnabled')
127
166
  const toggleBrandingEnabled = inject('toggleBrandingEnabled')
128
167
  const quickSearchEnabled = inject('quickSearchEnabled')
129
168
  const toggleQuickSearchEnabled = inject('toggleQuickSearchEnabled')
169
+ const dummySearchFetchEnabled = inject('dummySearchFetchEnabled')
170
+ const toggleDummySearchFetchEnabled = inject('toggleDummySearchFetchEnabled')
171
+ const themeToggleEnabled = inject('themeToggleEnabled')
172
+ const toggleThemeToggleEnabled = inject('toggleThemeToggleEnabled')
130
173
  const topBarEnabled = inject('topBarEnabled')
131
174
  const toggleTopBarEnabled = inject('toggleTopBarEnabled')
132
175
  const breadcrumbsEnabled = inject('breadcrumbsEnabled')
@@ -135,6 +178,40 @@ const navigation = inject('navigation', null)
135
178
 
136
179
  const exampleLinksEnabled = ref(false)
137
180
 
181
+ function setFlag(flag, toggle, want) {
182
+ if (flag.value !== want) {
183
+ toggle()
184
+ }
185
+ }
186
+
187
+ function setBrandingEnabled(want) {
188
+ setFlag(brandingEnabled, toggleBrandingEnabled, want)
189
+ }
190
+
191
+ function setQuickSearchEnabled(want) {
192
+ setFlag(quickSearchEnabled, toggleQuickSearchEnabled, want)
193
+ }
194
+
195
+ function setDummySearchFetchEnabled(want) {
196
+ setFlag(dummySearchFetchEnabled, toggleDummySearchFetchEnabled, want)
197
+ }
198
+
199
+ function setThemeToggleEnabled(want) {
200
+ setFlag(themeToggleEnabled, toggleThemeToggleEnabled, want)
201
+ }
202
+
203
+ function setTopBarEnabled(want) {
204
+ setFlag(topBarEnabled, toggleTopBarEnabled, want)
205
+ }
206
+
207
+ function setBreadcrumbsEnabled(want) {
208
+ setFlag(breadcrumbsEnabled, toggleBreadcrumbsEnabled, want)
209
+ }
210
+
211
+ function setSidebarEnabled(want) {
212
+ setFlag(sidebarEnabled, toggleSidebarEnabled, want)
213
+ }
214
+
138
215
  function removeExampleLinks() {
139
216
  if (!navigation) {
140
217
  return
@@ -178,9 +255,12 @@ function addExampleLinks() {
178
255
  })
179
256
  }
180
257
 
181
- function toggleExampleLinks() {
182
- exampleLinksEnabled.value = !exampleLinksEnabled.value
183
- if (exampleLinksEnabled.value) {
258
+ function setExampleLinks(want) {
259
+ if (exampleLinksEnabled.value === want) {
260
+ return
261
+ }
262
+ exampleLinksEnabled.value = want
263
+ if (want) {
184
264
  if (!sidebarEnabled.value) {
185
265
  toggleSidebarEnabled()
186
266
  }
@@ -198,14 +278,7 @@ onBeforeUnmount(() => {
198
278
  </script>
199
279
 
200
280
  <style scoped>
201
- .page-structure-control {
202
- display: flex;
203
- align-items: center;
204
- gap: 0.5rem;
205
- cursor: pointer;
206
- }
207
-
208
- .page-structure-control + .subtle {
281
+ .subtle {
209
282
  margin-top: 0.5rem;
210
283
  }
211
284
  </style>
@@ -30,6 +30,7 @@
30
30
 
31
31
  <script setup>
32
32
  import { ref, onMounted } from 'vue'
33
+ import { getExampleTableRows } from '../data/examplePeople.js'
33
34
 
34
35
  const headers = ref([
35
36
  { key: "name", label: "Name", sortable: true, hidden: false, width: "20%" },
@@ -40,81 +41,6 @@
40
41
  const data = ref([])
41
42
 
42
43
  onMounted(() => {
43
- data.value = [
44
- { name: "Alice", age: 30, city: "New York", foo: "bar" },
45
- { name: "Bob", age: 25, city: "Los Angeles" },
46
- { name: "Charlie", age: 35, city: "Chicago" },
47
- { name: "David", age: 28, city: "Houston" },
48
- { name: "Eve", age: 22, city: "Phoenix" },
49
- { name: "Frank", age: 40, city: "Philadelphia" },
50
- { name: "Grace", age: 29, city: "San Antonio" },
51
- { name: "Hannah", age: 32, city: "San Diego" },
52
- { name: "Ian", age: 27, city: "Dallas" },
53
- { name: "Jack", age: 31, city: "San Jose" },
54
- { name: "Kathy", age: 26, city: "Austin" },
55
- { name: "Leo", age: 33, city: "Jacksonville" },
56
- { name: "Mia", age: 24, city: "Fort Worth" },
57
- { name: "Nina", age: 38, city: "Columbus" },
58
- { name: "Oscar", age: 36, city: "Charlotte" },
59
- { name: "Paul", age: 34, city: "San Francisco" },
60
- { name: "Quinn", age: 23, city: "Indianapolis" },
61
- { name: "Rita", age: 37, city: "Seattle" },
62
- { name: "Sam", age: 39, city: "Denver" },
63
- { name: "Tina", age: 21, city: "Washington D.C." },
64
- { name: "Uma", age: 28, city: "Miami" },
65
- { name: "Victor", age: 30, city: "Portland" },
66
- { name: "Wendy", age: 29, city: "Nashville" },
67
- { name: "Xavier", age: 31, city: "Oklahoma City" },
68
- { name: "Yara", age: 27, city: "Tampa" },
69
- { name: "Zane", age: 32, city: "Albuquerque" },
70
- { name: "Ava", age: 26, city: "Las Vegas" },
71
- { name: "Ben", age: 33, city: "New Orleans" },
72
- { name: "Cara", age: 25, city: "San Francisco" },
73
- { name: "Drew", age: 34, city: "Seattle" },
74
- { name: "Ethan", age: 28, city: "Denver" },
75
- { name: "Fiona", age: 30, city: "Washington D.C." },
76
- { name: "George", age: 29, city: "Miami" },
77
- { name: "Hannah", age: 32, city: "San Diego" },
78
- { name: "Ian", age: 27, city: "Dallas" },
79
- { name: "Jack", age: 31, city: "San Jose" },
80
- { name: "Kathy", age: 26, city: "Austin" },
81
- { name: "Leo", age: 33, city: "Jacksonville" },
82
- { name: "Mia", age: 24, city: "Fort Worth" },
83
- { name: "Nina", age: 38, city: "Columbus" },
84
- { name: "Oscar", age: 36, city: "Charlotte" },
85
- { name: "Paul", age: 34, city: "San Francisco" },
86
- { name: "Quinn", age: 23, city: "Indianapolis" },
87
- { name: "Rita", age: 37, city: "Seattle" },
88
- { name: "Sam", age: 39, city: "Denver" },
89
- { name: "Tina", age: 21, city: "Washington D.C." },
90
- { name: "Uma", age: 28, city: "Miami" },
91
- { name: "Victor", age: 30, city: "Portland" },
92
- { name: "Wendy", age: 29, city: "Nashville" },
93
- { name: "Xavier", age: 31, city: "Oklahoma City" },
94
- { name: "Yara", age: 27, city: "Tampa" },
95
- { name: "Zane", age: 32, city: "Albuquerque" },
96
- { name: "Ava", age: 26, city: "Las Vegas" },
97
- { name: "Ben", age: 33, city: "New Orleans" },
98
- { name: "Cara", age: 25, city: "San Francisco" },
99
- { name: "Drew", age: 34, city: "Seattle" },
100
- { name: "Ethan", age: 28, city: "Denver" },
101
- { name: "Fiona", age: 30, city: "Washington D.C." },
102
- { name: "George", age: 29, city: "Miami" },
103
- { name: "Hannah", age: 32, city: "San Diego" },
104
- { name: "Ian", age: 27, city: "Dallas" },
105
- { name: "Jack", age: 31, city: "San Jose" },
106
- { name: "Kathy", age: 26, city: "Austin" },
107
- { name: "Leo", age: 33, city: "Jacksonville" },
108
- { name: "Mia", age: 24, city: "Fort Worth" },
109
- { name: "Nina", age: 38, city: "Columbus" },
110
- { name: "Oscar", age: 36, city: "Charlotte" },
111
- { name: "Paul", age: 34, city: "San Francisco" },
112
- { name: "Quinn", age: 23, city: "Indianapolis" },
113
- { name: "Rita", age: 37, city: "Seattle" },
114
- { name: "Sam", age: 39, city: "Denver" },
115
- { name: "Tina", age: 21, city: "Washington D.C." },
116
- { name: "Uma", age: 28, city: "Miami" },
117
- { name: "Victor", age: 30, city: "Portland" },
118
- ]
44
+ data.value = getExampleTableRows()
119
45
  })
120
46
  </script>