anentrypoint-design 0.0.157 → 0.0.158

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": "anentrypoint-design",
3
- "version": "0.0.157",
3
+ "version": "0.0.158",
4
4
  "description": "247420 design system SDK — webjsx + modified ripple-ui, single-file ESM bundle for reproducible use of the AnEntrypoint design.",
5
5
  "type": "module",
6
6
  "main": "./dist/247420.js",
@@ -278,7 +278,7 @@ export function TextField({ label, value = '', type = 'text', placeholder = '',
278
278
  );
279
279
  }
280
280
 
281
- export function Select({ label, value = '', options = [], onChange, name, key, placeholder, hint }) {
281
+ export function Select({ label, value = '', options = [], onChange, name, key, placeholder, hint, title, 'aria-label': ariaLabel }) {
282
282
  const opts = [];
283
283
  if (placeholder != null) opts.push(h('option', { key: '_ph', value: '', disabled: true, selected: value === '' || value == null }, placeholder));
284
284
  for (const o of options) {
@@ -288,6 +288,9 @@ export function Select({ label, value = '', options = [], onChange, name, key, p
288
288
  }
289
289
  const select = h('select', {
290
290
  key: 'i', name, class: 'ds-select',
291
+ // Guarantee an accessible name even when rendered without a visible label.
292
+ 'aria-label': ariaLabel || (label == null ? (title || placeholder || name) : null),
293
+ title,
291
294
  onchange: onChange ? (e) => onChange(e.target.value, e) : null
292
295
  }, ...opts);
293
296
  if (label == null && hint == null) return select;
@@ -141,25 +141,30 @@ export function Crumb({ trail = [], leaf = '', right } = {}) {
141
141
  }
142
142
 
143
143
  export function Side({ sections = [] } = {}) {
144
- return h('aside', { class: 'app-side', role: 'navigation', 'aria-label': 'sidebar navigation' }, ...sections.flatMap(sec => [
145
- h('div', { class: 'group', key: sec.group, role: 'heading', 'aria-level': '2' }, sec.group),
146
- ...sec.items.map((item, i) => {
147
- const { glyph, label, href = '#', active, count, color, onClick } = item;
148
- const countLabel = (count != null && count !== 0 && count !== '0') ? ` (${count})` : '';
149
- return h('a', {
150
- key: sec.group + i,
151
- href,
152
- class: active ? 'active' : '',
153
- 'aria-current': active ? 'page' : null,
154
- 'aria-label': label + countLabel,
155
- onclick: onClick
156
- },
157
- glyph != null ? Glyph({ children: glyph, color }) : h('span', { class: 'glyph', 'aria-hidden': 'true' }),
158
- h('span', {}, label),
159
- (count != null && count !== 0 && count !== '0') ? h('span', { class: 'count', 'aria-hidden': 'true' }, String(count)) : null
160
- );
161
- })
162
- ]));
144
+ return h('aside', { class: 'app-side', role: 'navigation', 'aria-label': 'sidebar navigation' }, ...sections.map(sec => {
145
+ const groupId = 'side-group-' + String(sec.group).replace(/\W+/g, '-').toLowerCase();
146
+ // Each section is a group labelled by its heading, so AT users hear the
147
+ // heading as the group name instead of an orphan heading.
148
+ return h('div', { class: 'app-side-group', key: sec.group, role: 'group', 'aria-labelledby': groupId },
149
+ h('div', { class: 'group', id: groupId, role: 'heading', 'aria-level': '2' }, sec.group),
150
+ ...sec.items.map((item, i) => {
151
+ const { glyph, label, href = '#', active, count, color, onClick } = item;
152
+ const countLabel = (count != null && count !== 0 && count !== '0') ? ` (${count})` : '';
153
+ return h('a', {
154
+ key: sec.group + i,
155
+ href,
156
+ class: active ? 'active' : '',
157
+ 'aria-current': active ? 'page' : null,
158
+ 'aria-label': label + countLabel,
159
+ onclick: onClick
160
+ },
161
+ glyph != null ? Glyph({ children: glyph, color }) : h('span', { class: 'glyph', 'aria-hidden': 'true' }),
162
+ h('span', {}, label),
163
+ (count != null && count !== 0 && count !== '0') ? h('span', { class: 'count', 'aria-hidden': 'true' }, String(count)) : null
164
+ );
165
+ })
166
+ );
167
+ }));
163
168
  }
164
169
 
165
170
  export function Status({ left = [], right = [] } = {}) {