design-angular-kit icon indicating copy to clipboard operation
design-angular-kit copied to clipboard

feat(gap): add itGap, itGapX, itGapY directives for CSS gap control (#580)

Open giulio-leone opened this issue 8 months ago • 3 comments

Closes #580

Problem

Bootstrap Italia's .g-*, .gx-*, .gy-* classes only set CSS variables consumed by the .row class, forcing developers to use row/column wrappers for simple flex gap spacing.

Solution

Add three standalone Angular directives that apply real CSS gap properties:

Directive CSS Property Description
[itGap] gap Both axes
[itGapX] column-gap Horizontal axis only
[itGapY] row-gap Vertical axis only

All directives use Bootstrap Italia's spacer scale (0-5):

Scale Value
0 0
1 0.25rem
2 0.5rem
3 1rem
4 1.5rem
5 3rem

Usage:

<div class="row gx-3">
  <div class="col-auto">Text 1</div>
  <div class="col-auto">Text 2</div>
</div>

<div class="d-flex" [itGapX]="3">
  <span>Text 1</span>
  <span>Text 2</span>
</div>

<div class="d-flex flex-wrap" [itGapX]="2" [itGapY]="4">...</div>

Testing

  • 7 tests covering gap (4 scales), column-gap, row-gap, and combined usage
  • Double gate passed: 116/116 tests ✅, 0 lint errors ✅

Checklist

  • [x] Follows CONTRIBUTING.md guidelines
  • [x] Standalone components (no NgModule)
  • [x] Selector prefix it enforced
  • [x] Exported from public_api.ts
  • [x] Conventional commit message

⚠️ This reopens #644 which was accidentally closed due to fork deletion.

giulio-leone avatar Mar 25 '26 19:03 giulio-leone

@simionato-ennovaresearch this is the active successor to #644 and it already includes the follow-up you asked for there: both the Angular-friendly directive API and the plain CSS class path, with examples/docs.

Current checks are green. If the approach looks right now, I would appreciate a review on this open PR rather than on the closed predecessor. Thanks!

giulio-leone avatar Mar 27 '26 20:03 giulio-leone

@astagi will investigate the problem reported in #580

valeriocomo avatar Apr 07 '26 15:04 valeriocomo

@valeriocomo it wasn't really a problem, I added this comment afterwards