@hubpav/hwio-ui 0.7.9 → 0.7.10

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": "@hubpav/hwio-ui",
3
- "version": "0.7.9",
3
+ "version": "0.7.10",
4
4
  "description": "HARDWARIO web design system for Astro: DaisyUI 5 themes generated from the brand tokens, the Tailwind entry stylesheet and the HWio* components.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -32,9 +32,9 @@
32
32
  "test": "node --test \"test/**/*.test.mjs\""
33
33
  },
34
34
  "dependencies": {
35
- "@hubpav/hwio-brand": "0.7.9",
36
- "@hubpav/hwio-web-runtime": "0.7.9",
37
- "@hubpav/hwio-web-worker": "0.7.9",
35
+ "@hubpav/hwio-brand": "0.7.10",
36
+ "@hubpav/hwio-web-runtime": "0.7.10",
37
+ "@hubpav/hwio-web-worker": "0.7.10",
38
38
  "daisyui": "5.7.47"
39
39
  },
40
40
  "peerDependencies": {
@@ -8,6 +8,10 @@
8
8
  * nav runtime keeps the checkbox, `aria-expanded` and focus in sync (into the panel on open, back to the
9
9
  * trigger on close, Escape closes). Below `sm` the bar drops the language dropdown (the drawer carries the
10
10
  * pills), so logo, theme toggle and the 48 px trigger fit a 320 px viewport without horizontal overflow.
11
+ *
12
+ * `navDensity="tight"` with `desktopFrom="xl"`: between 1280 and 1535 px, where the container is still
13
+ * 1280 px wide, the nav labels drop from 15 to 14 px and the item padding from 12 to 8 px, so a long nav
14
+ * plus CTAs (SK/PL/CS labels) fits without sideways scroll. From 1536 px the nav is back to default.
11
15
  */
12
16
  import type { HWioCta, HWioLinkItem } from '../types';
13
17
  import HWioButton from './HWioButton.astro';
@@ -30,13 +34,15 @@ interface Props {
30
34
  labels: { nav: string; menu: string; close: string; theme?: string; languages?: string };
31
35
  /** Viewport from which the inline nav and CTAs replace the drawer (default lg; xl for long navs). */
32
36
  desktopFrom?: 'lg' | 'xl';
37
+ /** 'tight' (with desktopFrom xl only): smaller nav labels and padding from 1280 to 1535 px. Default 'default'. */
38
+ navDensity?: 'default' | 'tight';
33
39
  id?: string;
34
40
  class?: string;
35
41
  }
36
- const { nav, ctas = [], languages = [], showThemeToggle = true, scrollspy = false, labels, desktopFrom = 'lg', id = 'hwio-nav-drawer', class: className = '' } = Astro.props;
42
+ const { nav, ctas = [], languages = [], showThemeToggle = true, scrollspy = false, labels, desktopFrom = 'lg', navDensity = 'default', id = 'hwio-nav-drawer', class: className = '' } = Astro.props;
37
43
  const BREAK = {
38
- lg: { nav: 'hidden flex-1 self-stretch justify-center lg:flex', ctas: 'hidden items-center gap-2 lg:flex', drawer: 'drawer drawer-end w-auto lg:hidden', panels: 'hidden lg:block' },
39
- xl: { nav: 'hidden flex-1 self-stretch justify-center xl:flex', ctas: 'hidden items-center gap-2 xl:flex', drawer: 'drawer drawer-end w-auto xl:hidden', panels: 'hidden xl:block' },
44
+ lg: { nav: 'hidden flex-1 self-stretch justify-center lg:flex', ctas: 'hidden items-center gap-2 lg:flex', drawer: 'drawer drawer-end w-auto lg:hidden', panels: 'hidden lg:block', densityTight: '' },
45
+ xl: { nav: 'hidden flex-1 self-stretch justify-center xl:flex', ctas: 'hidden items-center gap-2 xl:flex', drawer: 'drawer drawer-end w-auto xl:hidden', panels: 'hidden xl:block', densityTight: 'hwio-nav-tight' },
40
46
  } as const;
41
47
  const bp = BREAK[desktopFrom];
42
48
  const CTA_VARIANT = { primary: 'primary', secondary: 'secondary', ghost: 'ghost' } as const;
@@ -50,7 +56,7 @@ const linkAttrs = (item: HWioLinkItem) => (item.external ? { target: '_blank', r
50
56
  </div>
51
57
 
52
58
  <nav class={bp.nav} aria-label={labels.nav} data-hwio-scrollspy={scrollspy ? 'true' : undefined}>
53
- <ul class="menu hwio-nav menu-horizontal h-full flex-nowrap items-stretch gap-0 px-0 py-0 whitespace-nowrap">
59
+ <ul class:list={['menu hwio-nav menu-horizontal h-full flex-nowrap items-stretch gap-0 px-0 py-0 whitespace-nowrap', navDensity === 'tight' && bp.densityTight]}>
54
60
  {nav.map((item) => (
55
61
  <li class:list={[item.current && 'hwio-nav-current']}>
56
62
  {item.mega ? (
@@ -297,6 +297,19 @@
297
297
  --menu-active-bg: transparent;
298
298
  --menu-active-fg: currentColor;
299
299
  }
300
+ /* HWioHeader navDensity="tight" (desktopFrom="xl"): from 1280 to 1535 px the container is 1280 px wide
301
+ while the full nav and CTAs show, and long SK/PL/CS labels overflowed it. Labels drop from 15 to 14 px
302
+ and item padding from 12 to 8 px in that range only; the current-page bar follows the padding.
303
+ Unlayered so it wins over the links' px-3 and text-[15px] utilities. */
304
+ @media (80rem <= width < 96rem) {
305
+ .hwio-nav-tight > li > :is(a, button) {
306
+ padding-inline: 0.5rem;
307
+ font-size: 14px;
308
+ }
309
+ .hwio-nav-tight > .hwio-nav-current::after {
310
+ inset-inline: 0.5rem;
311
+ }
312
+ }
300
313
  /* DaisyUI 5.7.30+ also gives pressed buttons (aria-pressed / aria-checked) a filled ground. A ghost
301
314
  toggle shows its state in its own content (HWioThemeToggle swaps moon and sun and sets
302
315
  aria-pressed="true" in dark mode), so it keeps the transparent ground at rest; hover and focus