Skip to content

Commit a1bc1fb

Browse files
deodorhunterpnicolligiuliaghisini
authored
feat: it-header (#94)
* chore: fix merge conflicts * fix: remove unused file * wip: cleanup * feat: added it-dropdown * docs: added stories and tests * fix: alignment icons and disabled items keyboard navigation * chore: updated lockfile * wip: header storybook * fix: merge * fix: stories * feat: header * fix: header slim desktop/mobile items * feat: sticky docs * fix: sticky * chore: changeset * fix: header modal * feat: mobile menu * fix: styles mobile * fix: megamenu on mobile styles * fix: styles * fix: mobile * fix: header class light * feat: sticky * feat: header modal theme * fix: modal-header-theme * docs: mobile header * fix: examples * fix: focus trap in modal * fix: prettier * fix: examples * fix: angular example * fix: deps * chore: changeset * fix: meagamenu styles * fix: megamenu code examples * fix: examples * fix: modal aria label --------- Co-authored-by: Piero Nicolli <piero.nicolli@redturtle.it> Co-authored-by: Giulia Ghisini <giulia.ghisini@redturtle.it>
1 parent 381996d commit a1bc1fb

92 files changed

Lines changed: 12196 additions & 3059 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.changeset/khaki-sloths-end.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@italia/sticky': patch
3+
---
4+
5+
fixed sticky to prevent flapping on scroll

.changeset/some-worlds-stare.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@italia/dropdown': minor
3+
---
4+
5+
Added offset property to chage offset position of dropdown menu

.changeset/spicy-cameras-punch.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
'@italia/dev-kit-italia': patch
3+
'@italia/dropdown': patch
4+
'@italia/megamenu': patch
5+
'@italia/globals': patch
6+
'@italia/popover': patch
7+
'@italia/header': patch
8+
'@italia/sticky': patch
9+
'@italia/modal': patch
10+
---
11+
12+
Added header component

.storybook/elements.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import '../packages/checkbox/dist/src';
1313
import '../packages/chip/dist/src';
1414
import '../packages/dimmer/dist/src';
1515
import '../packages/dropdown/dist/src';
16+
import '../packages/header/dist/src';
1617
import '../packages/hero/dist/src';
1718
import '../packages/icon/dist/src';
1819
import '../packages/input/dist/src';

.storybook/storybook-styles.scss

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ table.docblock-argstable {
231231

232232
#anchor--componenti-icona--informazioni-utili .sbdocs-preview,
233233
#anchor--componenti-sticky--custom-events .sbdocs-preview,
234-
#anchor--componenti-footer--placeholder .sbdocs-preview {
234+
#anchor--componenti-footer--placeholder .sbdocs-preview{
235235
display: none;
236236
}
237237

@@ -340,6 +340,7 @@ it-select {
340340
.test-desktop it-notification::part(notification) {
341341
position: absolute;
342342
display: block;
343+
min-width: 250px;
343344
}
344345

345346
#storybook-root:has(.test-desktop) {

AGENTS.md

Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
# AGENTS.md
2+
3+
## Project Overview
4+
5+
Dev Kit Italia is a Web Components library implementing the Italian design system (.italia). Components are built with **Lit 3** and published to NPM under the `@italia` scope. The project is a **pnpm monorepo** orchestrated by **Turborepo**.
6+
7+
## Common Commands
8+
9+
```bash
10+
pnpm install # Install dependencies
11+
pnpm build # Build all packages (turbo run build analyze)
12+
pnpm test # Run all tests (serial via turbo)
13+
pnpm lint # Lint all packages
14+
pnpm format # Format all packages
15+
pnpm storybook # Start Storybook dev server on port 6006
16+
pnpm storybook:build # Build storybook static folder for production docs
17+
```
18+
19+
### Working with individual packages
20+
21+
```bash
22+
pnpm --filter=@italia/button build # Build a single package
23+
pnpm --filter=@italia/button test # Test a single package
24+
pnpm --filter=@italia/button lint # Lint a single package
25+
```
26+
27+
Build must run before tests (configured in turbo.json). Build depends on upstream packages (`^build`), so building a leaf package also builds its dependencies.
28+
29+
## Architecture
30+
31+
### Monorepo Layout
32+
33+
- **`packages/*`** — All workspace packages (components, utilities, bundle)
34+
- **`examples/`** — Framework integration examples (React, Vue, Svelte, Angular, Vanilla JS)
35+
- **`.storybook/`** — Storybook configuration (discovers stories from `packages/**/stories/**/*.stories.ts`)
36+
37+
### Package Types
38+
39+
| Package | Purpose |
40+
| --------------------------- | -------------------------------------------------------------------------------------- |
41+
| `@italia/globals` | Base classes, controllers, directives, form utilities, mixins shared by all components |
42+
| `@italia/i18n` | Internationalization (LocalizeMixin) |
43+
| `@italia/test-config` | Shared Web Test Runner config and test utilities |
44+
| `@italia/typescript-config` | Shared tsconfig presets |
45+
| `@italia/dev-kit-italia` | Meta-package that re-exports all components |
46+
| `@italia/<component>` | Individual component packages (button, input, modal, etc.) |
47+
48+
### Component Structure
49+
50+
Each component package follows this layout:
51+
52+
```
53+
packages/<name>/
54+
src/
55+
it-<name>.ts # Lit component class (tagged as <it-name>)
56+
<name>.scss # Component styles (compiled via rollup-plugin-scss-lit)
57+
types.ts # Component-specific types/enums
58+
index.ts # Barrel exports
59+
test/
60+
it-<name>.test.ts # Tests using @open-wc/testing
61+
stories/
62+
it-<name>.stories.ts # Storybook stories
63+
it-<name>.mdx # Storybook docs
64+
rollup.config.js # Rollup build config
65+
web-test-runner.config.js # Extends @italia/test-config
66+
tsconfig.build.json # Extends @italia/typescript-config
67+
```
68+
69+
### Component Base Classes
70+
71+
All components extend `BaseComponent` (from `@italia/globals`), which extends `LitElement` and provides:
72+
73+
- `composeClass` (clsx) for className composition
74+
- `_ariaAttributes` getter that maps `it-aria-*` / `it-role` host attributes to standard ARIA attributes
75+
- `generateId()` for internal element IDs
76+
- `prefersReducedMotion` check
77+
- `Logger` instance
78+
79+
Form components use the `FormControl` mixin and `FormControlController` from `@italia/globals/form`.
80+
81+
### Build Pipeline
82+
83+
- **Rollup** bundles each component: TypeScript + SCSS (via `rollup-plugin-scss-lit`) + node-resolve
84+
- `lit` is marked as external (peer dependency)
85+
- **Custom Elements Manifest Analyzer** generates `custom-elements.json` per component (the `analyze` turbo task)
86+
- SCSS imports resolve from `node_modules` (Bootstrap Italia, design-tokens-italia)
87+
88+
### Testing
89+
90+
- **@web/test-runner** with **Playwright** browsers
91+
- Tests use `@open-wc/testing` (fixture, expect, html helpers)
92+
- Each package has its own `web-test-runner.config.js` extending the shared base config
93+
94+
### Releases
95+
96+
Managed via **Changesets**: run `pnpm changeset` to document changes, then merging the changeset PR bumps versions. Publishing is triggered by git tags via GitHub Actions.
97+
98+
## Key Dependencies
99+
100+
- **lit** ^3.3.0 — Web Component framework
101+
- **bootstrap-italia** — Italian design system CSS (pinned to specific commit)
102+
- **design-tokens-italia** ^1.3.3 — Design tokens
103+
- **sass** ^1.89.0 — SCSS compilation
104+
105+
## Code Style
106+
107+
- Prettier: single quotes, trailing commas, 120 char width
108+
- ESLint: `@open-wc` config + `@typescript-eslint` + lit/lit-a11y plugins
109+
- Pre-commit hooks via Husky + lint-staged
110+
- Node.js 20.x / 22.x / 24.x, pnpm 10.11.0
111+
112+
## Naming Conventions
113+
114+
- Component tag names: `it-<name>` (e.g., `it-button`, `it-accordion`)
115+
- Component classes: PascalCase (e.g., `ItButton`, `ItAccordion`)
116+
- Package names: `@italia/<name>`
117+
- ARIA passthrough: use `it-aria-*` and `it-role` attributes on the host element (mapped internally by BaseComponent)

examples/angular-app/package-lock.json

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)