@neetechs/ui 0.1.0 → 0.3.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.
- package/CHANGELOG.md +74 -0
- package/LICENSE +21 -21
- package/README.md +862 -861
- package/dist/ai/ai-action-button/ai-action-button.css +271 -271
- package/dist/ai/ai-approval-card/ai-approval-card.css +323 -323
- package/dist/ai/ai-conversation-panel/ai-conversation-panel.css +447 -447
- package/dist/ai/ai-prompt-input/ai-prompt-input.css +380 -380
- package/dist/ai/ai-proposal-card/ai-proposal-card.css +358 -358
- package/dist/ai/ai-suggestion-card/ai-suggestion-card.css +295 -295
- package/dist/ai/ai-tool-call/ai-tool-call.css +256 -256
- package/dist/ai/index.css +7 -7
- package/dist/behaviors/index.d.ts +1 -0
- package/dist/behaviors/index.d.ts.map +1 -1
- package/dist/behaviors/index.js +1 -0
- package/dist/behaviors/index.js.map +1 -1
- package/dist/behaviors/selection-indicator.d.ts +35 -0
- package/dist/behaviors/selection-indicator.d.ts.map +1 -0
- package/dist/behaviors/selection-indicator.js +133 -0
- package/dist/behaviors/selection-indicator.js.map +1 -0
- package/dist/behaviors/sidebar.d.ts +3 -1
- package/dist/behaviors/sidebar.d.ts.map +1 -1
- package/dist/behaviors/sidebar.js +10 -3
- package/dist/behaviors/sidebar.js.map +1 -1
- package/dist/components/alert/alert.css +226 -220
- package/dist/components/avatar/avatar.css +298 -220
- package/dist/components/badge/badge.css +180 -174
- package/dist/components/breadcrumb/breadcrumb.css +207 -207
- package/dist/components/button/button.css +278 -238
- package/dist/components/card/card.css +336 -265
- package/dist/components/checkbox/checkbox.css +189 -189
- package/dist/components/chip/chip.css +269 -269
- package/dist/components/choice-card/choice-card.css +244 -0
- package/dist/components/data-grid/data-grid.css +520 -520
- package/dist/components/description-list/description-list.css +187 -187
- package/dist/components/dialog/dialog.css +348 -339
- package/dist/components/disclosure/disclosure.css +154 -0
- package/dist/components/dock/dock.css +319 -0
- package/dist/components/drawer/drawer.css +493 -484
- package/dist/components/dropdown/dropdown.css +325 -316
- package/dist/components/fab/fab.css +281 -0
- package/dist/components/icon-button/icon-button.css +162 -162
- package/dist/components/index.css +4 -0
- package/dist/components/input/input.css +163 -163
- package/dist/components/menu/menu.css +315 -315
- package/dist/components/pagination/pagination.css +250 -250
- package/dist/components/panel/panel.css +316 -284
- package/dist/components/popover/popover.css +22 -0
- package/dist/components/progress/progress.css +268 -256
- package/dist/components/radio/radio.css +166 -166
- package/dist/components/segmented-control/segmented-control.css +264 -205
- package/dist/components/select/select.css +117 -117
- package/dist/components/skeleton/skeleton.css +267 -267
- package/dist/components/split-button/split-button.css +292 -292
- package/dist/components/stat/stat.css +433 -403
- package/dist/components/switch/switch.css +195 -195
- package/dist/components/table/table.css +220 -220
- package/dist/components/tabs/tabs.css +393 -293
- package/dist/components/textarea/textarea.css +86 -86
- package/dist/components/toast/toast.css +345 -345
- package/dist/components/tooltip/tooltip.css +267 -258
- package/dist/domain/billing/index.css +629 -629
- package/dist/domain/calendar/agenda-list/agenda-list.css +224 -224
- package/dist/domain/calendar/day-slice/day-slice.css +384 -384
- package/dist/domain/calendar/day-timeline/day-timeline.css +332 -332
- package/dist/domain/calendar/event-card/event-card.css +338 -338
- package/dist/domain/calendar/index.css +5 -5
- package/dist/domain/calendar/month-grid/month-grid.css +426 -426
- package/dist/domain/calendar/week-grid/week-grid.css +487 -480
- package/dist/domain/companies/index.css +526 -526
- package/dist/domain/index.css +3 -3
- package/dist/index.css +5 -5
- package/dist/patterns/command-palette/command-palette.css +488 -447
- package/dist/patterns/company-switcher/company-switcher.css +390 -390
- package/dist/patterns/content-state/content-state.css +236 -236
- package/dist/patterns/document-preview/document-preview.css +169 -0
- package/dist/patterns/editor-workspace/editor-workspace.css +276 -0
- package/dist/patterns/empty-state/empty-state.css +260 -260
- package/dist/patterns/error-state/error-state.css +272 -272
- package/dist/patterns/form-layout/form-layout.css +106 -106
- package/dist/patterns/index.css +4 -0
- package/dist/patterns/loading-state/loading-state.css +287 -287
- package/dist/patterns/master-detail/master-detail.css +103 -103
- package/dist/patterns/notification-center/notification-center.css +443 -443
- package/dist/patterns/page/page.css +303 -303
- package/dist/patterns/profile-header/profile-header.css +205 -0
- package/dist/patterns/profile-menu/profile-menu.css +298 -298
- package/dist/patterns/record-list/record-list.css +302 -302
- package/dist/patterns/resource-card/resource-card.css +258 -0
- package/dist/patterns/search-bar/search-bar.css +457 -457
- package/dist/patterns/settings-layout/settings-layout.css +283 -150
- package/dist/patterns/workflow/workflow.css +168 -168
- package/dist/shell/app-shell/app-shell.css +429 -211
- package/dist/shell/content-frame/content-frame.css +93 -93
- package/dist/shell/header/header.css +328 -328
- package/dist/shell/index.css +8 -8
- package/dist/shell/mobile-nav/mobile-nav.css +254 -254
- package/dist/shell/navbar/navbar.css +28 -1
- package/dist/shell/sidebar/sidebar.css +923 -314
- package/dist/styles/accessibility.css +150 -150
- package/dist/styles/animations/motion.css +162 -162
- package/dist/styles/appearance/accent.css +215 -215
- package/dist/styles/appearance/density.css +61 -61
- package/dist/styles/appearance/motion.css +48 -40
- package/dist/styles/base.css +83 -83
- package/dist/styles/index.css +29 -28
- package/dist/styles/localization.css +56 -56
- package/dist/styles/reset.css +51 -51
- package/dist/styles/responsive.css +101 -101
- package/dist/styles/themes/dark.css +225 -202
- package/dist/styles/themes/high-contrast.css +378 -290
- package/dist/styles/themes/light.css +224 -201
- package/dist/styles/tokens/breakpoints.css +37 -37
- package/dist/styles/tokens/color.css +102 -102
- package/dist/styles/tokens/compatibility.css +33 -33
- package/dist/styles/tokens/elevation.css +33 -26
- package/dist/styles/tokens/index.css +9 -9
- package/dist/styles/tokens/motion.css +55 -36
- package/dist/styles/tokens/radius.css +26 -26
- package/dist/styles/tokens/spacing.css +56 -56
- package/dist/styles/tokens/typography.css +85 -85
- package/dist/styles/tokens/z-index.css +14 -14
- package/dist/styles/utilities/glass.css +97 -0
- package/dist/styles/utilities/layout.css +153 -153
- package/dist/styles/utilities/text.css +152 -152
- package/dist/styles/utilities/visibility.css +47 -47
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/docs/NEETECHS_UI_UPGRADE_PLAN.md +312 -192
- package/docs/accessibility.md +218 -218
- package/docs/appearance-and-theming.md +150 -150
- package/docs/brand-palette.md +36 -36
- package/docs/component-architecture.md +137 -137
- package/docs/component-guidelines.md +64 -64
- package/docs/components.md +326 -173
- package/docs/content-and-terminology.md +207 -207
- package/docs/design-system-baseline-audit.md +226 -226
- package/docs/design-token-contract.md +279 -279
- package/docs/glass-and-motion.md +310 -0
- package/docs/localization-and-rtl.md +147 -147
- package/docs/migration.md +193 -193
- package/docs/page-patterns-and-workflows.md +301 -275
- package/docs/responsive-and-adaptive-design.md +351 -351
- package/docs/semantic-role-migration-audit.md +77 -77
- package/docs/site-chrome.md +320 -313
- package/docs/states-feedback-and-recovery.md +206 -206
- package/docs/theming.md +5 -5
- package/package.json +2 -1
- package/src/ai/ai-action-button/ai-action-button.css +271 -271
- package/src/ai/ai-approval-card/ai-approval-card.css +323 -323
- package/src/ai/ai-conversation-panel/ai-conversation-panel.css +447 -447
- package/src/ai/ai-prompt-input/ai-prompt-input.css +380 -380
- package/src/ai/ai-proposal-card/ai-proposal-card.css +358 -358
- package/src/ai/ai-suggestion-card/ai-suggestion-card.css +295 -295
- package/src/ai/ai-tool-call/ai-tool-call.css +256 -256
- package/src/ai/index.css +7 -7
- package/src/appearance/cache.ts +236 -236
- package/src/appearance/cookie.ts +184 -184
- package/src/appearance/index.ts +86 -86
- package/src/appearance/preference.ts +121 -121
- package/src/appearance/theme-controller.ts +384 -384
- package/src/appearance/types.ts +61 -61
- package/src/behaviors/announcer.ts +222 -222
- package/src/behaviors/calendar.ts +92 -92
- package/src/behaviors/data-grid.ts +133 -133
- package/src/behaviors/dialog.ts +203 -203
- package/src/behaviors/direction.ts +34 -34
- package/src/behaviors/drawer.ts +210 -210
- package/src/behaviors/dropdown.ts +344 -344
- package/src/behaviors/focus-trap.ts +304 -304
- package/src/behaviors/forms.ts +205 -205
- package/src/behaviors/ids.ts +47 -47
- package/src/behaviors/index.ts +1 -0
- package/src/behaviors/keyboard.ts +305 -305
- package/src/behaviors/overlay.ts +344 -344
- package/src/behaviors/selection-indicator.ts +162 -0
- package/src/behaviors/sidebar.ts +14 -4
- package/src/behaviors/state.ts +282 -282
- package/src/behaviors/tabs.ts +137 -137
- package/src/behaviors/viewport.ts +61 -61
- package/src/components/alert/alert.css +226 -220
- package/src/components/avatar/avatar.css +298 -220
- package/src/components/badge/badge.css +180 -174
- package/src/components/breadcrumb/breadcrumb.css +207 -207
- package/src/components/button/button.css +278 -238
- package/src/components/card/card.css +336 -265
- package/src/components/checkbox/checkbox.css +189 -189
- package/src/components/chip/chip.css +269 -269
- package/src/components/choice-card/choice-card.css +244 -0
- package/src/components/data-grid/data-grid.css +520 -520
- package/src/components/description-list/description-list.css +187 -187
- package/src/components/dialog/dialog.css +348 -339
- package/src/components/disclosure/disclosure.css +154 -0
- package/src/components/dock/dock.css +319 -0
- package/src/components/drawer/drawer.css +493 -484
- package/src/components/dropdown/dropdown.css +325 -316
- package/src/components/fab/fab.css +281 -0
- package/src/components/icon-button/icon-button.css +162 -162
- package/src/components/index.css +4 -0
- package/src/components/input/input.css +163 -163
- package/src/components/menu/menu.css +315 -315
- package/src/components/pagination/pagination.css +250 -250
- package/src/components/panel/panel.css +316 -284
- package/src/components/popover/popover.css +22 -0
- package/src/components/progress/progress.css +268 -256
- package/src/components/radio/radio.css +166 -166
- package/src/components/segmented-control/segmented-control.css +264 -205
- package/src/components/select/select.css +117 -117
- package/src/components/skeleton/skeleton.css +267 -267
- package/src/components/split-button/split-button.css +292 -292
- package/src/components/stat/stat.css +433 -403
- package/src/components/switch/switch.css +195 -195
- package/src/components/table/table.css +220 -220
- package/src/components/tabs/tabs.css +393 -293
- package/src/components/textarea/textarea.css +86 -86
- package/src/components/toast/toast.css +345 -345
- package/src/components/tooltip/tooltip.css +267 -258
- package/src/domain/billing/index.css +629 -629
- package/src/domain/calendar/agenda-list/agenda-list.css +224 -224
- package/src/domain/calendar/day-slice/day-slice.css +384 -384
- package/src/domain/calendar/day-timeline/day-timeline.css +332 -332
- package/src/domain/calendar/event-card/event-card.css +338 -338
- package/src/domain/calendar/index.css +5 -5
- package/src/domain/calendar/month-grid/month-grid.css +426 -426
- package/src/domain/calendar/week-grid/week-grid.css +487 -480
- package/src/domain/companies/index.css +526 -526
- package/src/domain/index.css +3 -3
- package/src/index.css +5 -5
- package/src/index.ts +7 -7
- package/src/localization/index.ts +56 -56
- package/src/patterns/command-palette/command-palette.css +488 -447
- package/src/patterns/company-switcher/company-switcher.css +390 -390
- package/src/patterns/content-state/content-state.css +236 -236
- package/src/patterns/document-preview/document-preview.css +169 -0
- package/src/patterns/editor-workspace/editor-workspace.css +276 -0
- package/src/patterns/empty-state/empty-state.css +260 -260
- package/src/patterns/error-state/error-state.css +272 -272
- package/src/patterns/form-layout/form-layout.css +106 -106
- package/src/patterns/index.css +4 -0
- package/src/patterns/loading-state/loading-state.css +287 -287
- package/src/patterns/master-detail/master-detail.css +103 -103
- package/src/patterns/notification-center/notification-center.css +443 -443
- package/src/patterns/page/page.css +303 -303
- package/src/patterns/profile-header/profile-header.css +205 -0
- package/src/patterns/profile-menu/profile-menu.css +298 -298
- package/src/patterns/record-list/record-list.css +302 -302
- package/src/patterns/resource-card/resource-card.css +258 -0
- package/src/patterns/search-bar/search-bar.css +457 -457
- package/src/patterns/settings-layout/settings-layout.css +283 -150
- package/src/patterns/workflow/workflow.css +168 -168
- package/src/shell/app-shell/app-shell.css +429 -211
- package/src/shell/content-frame/content-frame.css +93 -93
- package/src/shell/header/header.css +328 -328
- package/src/shell/index.css +8 -8
- package/src/shell/mobile-nav/mobile-nav.css +254 -254
- package/src/shell/navbar/navbar.css +28 -1
- package/src/shell/sidebar/sidebar.css +923 -314
- package/src/styles/accessibility.css +150 -150
- package/src/styles/animations/motion.css +162 -162
- package/src/styles/appearance/accent.css +215 -215
- package/src/styles/appearance/density.css +61 -61
- package/src/styles/appearance/motion.css +48 -40
- package/src/styles/base.css +83 -83
- package/src/styles/index.css +29 -28
- package/src/styles/localization.css +56 -56
- package/src/styles/reset.css +51 -51
- package/src/styles/responsive.css +101 -101
- package/src/styles/themes/dark.css +225 -202
- package/src/styles/themes/high-contrast.css +378 -290
- package/src/styles/themes/light.css +224 -201
- package/src/styles/tokens/breakpoints.css +37 -37
- package/src/styles/tokens/color.css +102 -102
- package/src/styles/tokens/compatibility.css +33 -33
- package/src/styles/tokens/elevation.css +33 -26
- package/src/styles/tokens/index.css +9 -9
- package/src/styles/tokens/motion.css +55 -36
- package/src/styles/tokens/radius.css +26 -26
- package/src/styles/tokens/spacing.css +56 -56
- package/src/styles/tokens/typography.css +85 -85
- package/src/styles/tokens/z-index.css +14 -14
- package/src/styles/utilities/glass.css +97 -0
- package/src/styles/utilities/layout.css +153 -153
- package/src/styles/utilities/text.css +152 -152
- package/src/styles/utilities/visibility.css +47 -47
- package/src/types/index.ts +126 -126
- package/src/version.ts +1 -1
|
@@ -0,0 +1,310 @@
|
|
|
1
|
+
# Glass and motion
|
|
2
|
+
|
|
3
|
+
Opt-in premium surfaces for Neetechs workspaces: a glass sidebar that morphs
|
|
4
|
+
between a full panel and an icon rail, a selected item that connects to the
|
|
5
|
+
content panel with curved corners, reusable glass material, a sliding
|
|
6
|
+
selection indicator, and consistent enter/exit motion. Nothing here changes
|
|
7
|
+
an application that does not add the classes below.
|
|
8
|
+
|
|
9
|
+
Live fixture: `tests/pages/glass.html` (run `npm run build`, then
|
|
10
|
+
`node scripts/serve-test-gallery.mjs` and open
|
|
11
|
+
`http://127.0.0.1:4173/tests/pages/glass.html`). It toggles light theme, high
|
|
12
|
+
contrast, RTL, and reduced motion.
|
|
13
|
+
|
|
14
|
+
## Enable it in an application
|
|
15
|
+
|
|
16
|
+
1. Keep importing the full stylesheet (`@neetechs/ui/styles.css`) or add the
|
|
17
|
+
pieces you use: `shell/app-shell.css`, `shell/sidebar.css`,
|
|
18
|
+
`utilities/glass.css`, `components/dock.css`, `components/fab.css`.
|
|
19
|
+
2. Add the modifiers to the existing shell markup:
|
|
20
|
+
`nt-app-shell--glass` on `.nt-app-shell` and
|
|
21
|
+
`nt-sidebar--glass nt-sidebar--cutout` on `.nt-sidebar`. Optional:
|
|
22
|
+
`nt-app-shell--dock-tablet` keeps the sidebar docked on tablets, and
|
|
23
|
+
`nt-app-shell--connected` joins the content to one solid panel.
|
|
24
|
+
3. Keep `ntCreateSidebar` as it is; it already owns collapse state, titles,
|
|
25
|
+
groups, and the mobile off-canvas panel. It detects
|
|
26
|
+
`nt-app-shell--dock-tablet` and moves its off-canvas query to the phone
|
|
27
|
+
bound by itself.
|
|
28
|
+
4. Keep setting `aria-current="page"` on the current item from your router.
|
|
29
|
+
The CSS animates the connection; no JavaScript is involved.
|
|
30
|
+
|
|
31
|
+
```html
|
|
32
|
+
<div class="nt-app-shell nt-app-shell--glass nt-app-shell--dock-tablet nt-app-shell--offcanvas" id="shell">
|
|
33
|
+
<aside class="nt-app-shell__sidebar" id="workspace-sidebar" aria-label="Workspace">
|
|
34
|
+
<nav class="nt-sidebar nt-sidebar--glass nt-sidebar--cutout" aria-label="Workspace navigation">
|
|
35
|
+
<div class="nt-sidebar__brand">
|
|
36
|
+
<span class="nt-sidebar__logo" aria-hidden="true">N</span>
|
|
37
|
+
<span class="nt-sidebar__brand-text">Neetechs</span>
|
|
38
|
+
<button class="nt-icon-button nt-icon-button--ghost nt-sidebar__brand-action" type="button" data-nt-sidebar-close aria-label="Close navigation"></button>
|
|
39
|
+
</div>
|
|
40
|
+
<div class="nt-sidebar__search">
|
|
41
|
+
<label class="nt-search-bar__control">
|
|
42
|
+
<svg class="nt-search-bar__icon" aria-hidden="true"></svg>
|
|
43
|
+
<input class="nt-search-bar__input" type="search" placeholder="Search" aria-label="Search workspace">
|
|
44
|
+
<kbd class="nt-search-bar__kbd">⌘K</kbd>
|
|
45
|
+
</label>
|
|
46
|
+
</div>
|
|
47
|
+
<div class="nt-sidebar__nav">
|
|
48
|
+
<div class="nt-sidebar__section">
|
|
49
|
+
<span class="nt-sidebar__section-label">Workspace</span>
|
|
50
|
+
<a class="nt-sidebar__item" href="/overview" aria-current="page">
|
|
51
|
+
<svg class="nt-sidebar__item-icon" aria-hidden="true"></svg>
|
|
52
|
+
<span class="nt-sidebar__item-label">Overview</span>
|
|
53
|
+
</a>
|
|
54
|
+
<a class="nt-sidebar__item" href="/inbox">
|
|
55
|
+
<svg class="nt-sidebar__item-icon" aria-hidden="true"></svg>
|
|
56
|
+
<span class="nt-sidebar__item-label">Inbox</span>
|
|
57
|
+
<span class="nt-badge nt-badge--primary nt-sidebar__item-badge">4</span>
|
|
58
|
+
</a>
|
|
59
|
+
</div>
|
|
60
|
+
</div>
|
|
61
|
+
<div class="nt-sidebar__footer">
|
|
62
|
+
<div class="nt-sidebar__account">
|
|
63
|
+
<span class="nt-avatar nt-avatar--brand nt-sidebar__account-avatar" aria-hidden="true">N</span>
|
|
64
|
+
<span class="nt-sidebar__account-text">
|
|
65
|
+
<span class="nt-sidebar__account-name">Neetechs Team</span>
|
|
66
|
+
<span class="nt-sidebar__account-meta">Pro plan</span>
|
|
67
|
+
</span>
|
|
68
|
+
<button class="nt-icon-button nt-icon-button--ghost nt-sidebar__account-action" type="button" aria-label="Account options"></button>
|
|
69
|
+
</div>
|
|
70
|
+
</div>
|
|
71
|
+
</nav>
|
|
72
|
+
</aside>
|
|
73
|
+
<div class="nt-app-shell__overlay" id="shell-backdrop" hidden></div>
|
|
74
|
+
<div class="nt-app-shell__main">
|
|
75
|
+
<header class="nt-app-shell__header nt-header">
|
|
76
|
+
<button class="nt-icon-button nt-icon-button--ghost nt-app-shell__collapse-toggle" type="button" id="collapse-toggle" aria-label="Collapse sidebar"></button>
|
|
77
|
+
<button class="nt-icon-button nt-icon-button--ghost nt-app-shell__menu-toggle" type="button" id="menu-toggle" aria-label="Open navigation"></button>
|
|
78
|
+
</header>
|
|
79
|
+
<main class="nt-app-shell__content nt-content-frame"></main>
|
|
80
|
+
</div>
|
|
81
|
+
</div>
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
```js
|
|
85
|
+
import { ntCreateSidebar } from '@neetechs/ui/behaviors';
|
|
86
|
+
|
|
87
|
+
ntCreateSidebar({
|
|
88
|
+
shell: document.querySelector('#shell'),
|
|
89
|
+
sidebar: document.querySelector('#workspace-sidebar'),
|
|
90
|
+
collapseToggle: document.querySelector('#collapse-toggle'),
|
|
91
|
+
menuToggle: document.querySelector('#menu-toggle'),
|
|
92
|
+
backdrop: document.querySelector('#shell-backdrop'),
|
|
93
|
+
storageKey: 'workspace-sidebar-collapsed',
|
|
94
|
+
});
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
Angular and React apps render the same markup from their templates and call
|
|
98
|
+
the controller after the view mounts (and `destroy()` on teardown). Every
|
|
99
|
+
behavior is SSR-safe to import; the CSS is complete before hydration.
|
|
100
|
+
|
|
101
|
+
## Glass sidebar
|
|
102
|
+
|
|
103
|
+
| Class | Effect |
|
|
104
|
+
|---|---|
|
|
105
|
+
| `.nt-sidebar--glass` | Frosted material, highlight, glass border, glass item pills, and the smooth rail morph. |
|
|
106
|
+
| `.nt-sidebar--cutout` | The current item becomes a light tab that runs into the sidebar's inline-end edge with concave corners above and below. Pair with `--glass`. |
|
|
107
|
+
| `.nt-sidebar__search` | Optional search slot between brand and nav (search bar anatomy: icon, input, `kbd` hint). Hidden (and out of tab order) in the rail. |
|
|
108
|
+
| `.nt-sidebar__brand-action` | Control at the end of the brand row, such as the off-canvas close button. |
|
|
109
|
+
| `.nt-sidebar__account` (`__account-avatar`, `__account-text`, `__account-name`, `__account-meta`, `__account-action`) | Footer account summary; the rail keeps only the avatar. |
|
|
110
|
+
|
|
111
|
+
**Rail morph.** Icons keep one inline-start inset in both states, computed so
|
|
112
|
+
they sit centered in the collapsed rail; collapsing never moves an icon.
|
|
113
|
+
Labels, badges, and group text fade and slide out quickly when collapsing and
|
|
114
|
+
fade in after the width starts to grow when expanding. Section labels and
|
|
115
|
+
group triggers keep their height and show a divider in the rail, so items do
|
|
116
|
+
not jump vertically. Group triggers and the search slot leave the tab order
|
|
117
|
+
(`visibility`) once hidden; item labels stay in the accessibility tree and
|
|
118
|
+
the controller adds a `title` to each item.
|
|
119
|
+
|
|
120
|
+
**Connection.** The tab body (`::before`) and both corners (`::after`) are
|
|
121
|
+
painted in the nav gutter, so selecting another item changes no layout: the
|
|
122
|
+
old tab slides back toward the edge while the new one slides out of it. The
|
|
123
|
+
fill is `--nt-sidebar-cutout-surface` and the text `--nt-sidebar-cutout-fg`
|
|
124
|
+
(defaults: the selected-on-glass roles `--nt-glass-selected-bg` and
|
|
125
|
+
`--nt-glass-selected-fg`). `.nt-app-shell--connected` sets them to the
|
|
126
|
+
content panel's surface so the tab joins the panel. Set them on any ancestor
|
|
127
|
+
if the adjoining surface is different:
|
|
128
|
+
|
|
129
|
+
```css
|
|
130
|
+
.billing-workspace {
|
|
131
|
+
--nt-sidebar-cutout-surface: var(--nt-bg-surface);
|
|
132
|
+
}
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
In the rail, the floating tab settles into a centered tile and badges pin to
|
|
136
|
+
the icon's top corner; a connected rail keeps the tab. The connection works
|
|
137
|
+
in LTR and RTL (one gradient mirrored through `--nt-sidebar-cutout-x`) and
|
|
138
|
+
keeps the standard focus ring. High contrast keeps the connection and
|
|
139
|
+
outlines it; forced colors fall back to a `Highlight` item. The open
|
|
140
|
+
off-canvas panel shows a plain selected pill, without blur, and always opens
|
|
141
|
+
in full: the rail preference is kept but not applied off-canvas.
|
|
142
|
+
|
|
143
|
+
## Glass shell
|
|
144
|
+
|
|
145
|
+
| Class | Effect |
|
|
146
|
+
|---|---|
|
|
147
|
+
| `.nt-app-shell--glass` | Ambient frame behind the shell, floating glass sidebar, a strong-glass sticky header, and content on the frame (cards, tables, and forms keep their solid surfaces). Docked layouts only. |
|
|
148
|
+
| `.nt-app-shell--connected` | Puts the content on one solid panel joined to the sidebar, with a single frame shadow. Pair with `.nt-sidebar--cutout`. |
|
|
149
|
+
| `.nt-app-shell--dock-tablet` | Keeps the sidebar docked (full or rail) down to 40rem instead of going off-canvas below 64rem. |
|
|
150
|
+
|
|
151
|
+
Collapse animates `grid-template-columns` over `--nt-duration-layout` (300ms) with
|
|
152
|
+
`--nt-ease-glide`. The frosted layer is a pseudo-element of the sidebar, so
|
|
153
|
+
the sidebar does not become the containing block of `position: fixed` menus
|
|
154
|
+
in its footer.
|
|
155
|
+
|
|
156
|
+
## Glass material
|
|
157
|
+
|
|
158
|
+
Theme roles (defined in the dark, light, and high-contrast themes):
|
|
159
|
+
`--nt-glass-bg`, `--nt-glass-bg-strong`, `--nt-glass-border`,
|
|
160
|
+
`--nt-glass-highlight`, `--nt-glass-item-bg`, `--nt-glass-item-hover`,
|
|
161
|
+
`--nt-glass-selected-bg`, `--nt-glass-selected-fg`,
|
|
162
|
+
`--nt-glass-ambient-start`, `--nt-glass-ambient-end`, `--nt-glass-backdrop`.
|
|
163
|
+
Optical tokens: `--nt-glass-blur`, `--nt-glass-blur-strong`,
|
|
164
|
+
`--nt-glass-saturate`.
|
|
165
|
+
|
|
166
|
+
| Class | Use |
|
|
167
|
+
|---|---|
|
|
168
|
+
| `.nt-glass` (+ `--strong`, `--floating`, `--interactive`) | Any container: toolbars, inspectors, hero tiles. |
|
|
169
|
+
| `.nt-glass-backdrop` | Ambient gradient background that gives glass something to refract. |
|
|
170
|
+
| `.nt-card--glass`, `.nt-panel--glass` | Glass variants of the existing card and panel. |
|
|
171
|
+
| `.nt-command-palette--glass` | Strong glass palette over the dimmed workspace. |
|
|
172
|
+
| `.nt-card--lift` | Softer, slower hover lift for dashboard and showcase tiles. |
|
|
173
|
+
|
|
174
|
+
```html
|
|
175
|
+
<section class="nt-glass-backdrop nt-glass--floating nt-card--padded">
|
|
176
|
+
<article class="nt-card nt-card--glass nt-card--lift nt-card--padded">Summary</article>
|
|
177
|
+
<a class="nt-glass nt-glass--floating nt-glass--interactive nt-card--padded" href="/reports">Reports</a>
|
|
178
|
+
</section>
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
Use glass for navigation and floating chrome. Keep forms, tables, data grids,
|
|
182
|
+
and dialogs on their solid surfaces. Every glass role turns solid with zero
|
|
183
|
+
blur under `data-nt-contrast="high"`, the high-contrast theme,
|
|
184
|
+
`prefers-contrast: more`, `prefers-reduced-transparency: reduce`, and forced
|
|
185
|
+
colors; browsers without `backdrop-filter` use the strong tint.
|
|
186
|
+
|
|
187
|
+
## Sliding selection indicator
|
|
188
|
+
|
|
189
|
+
`ntCreateSelectionIndicator` measures the selected item and writes its
|
|
190
|
+
geometry to the container (`--nt-indicator-x/-y/-width/-height`,
|
|
191
|
+
`data-nt-indicator="placed|ready"`); the component draws and animates one
|
|
192
|
+
indicator in CSS. Until it runs, the static per-item indicator remains.
|
|
193
|
+
|
|
194
|
+
```html
|
|
195
|
+
<div class="nt-tabs nt-tabs--sliding" id="report-tabs">
|
|
196
|
+
<div class="nt-tabs__list" aria-label="Report period">
|
|
197
|
+
<button class="nt-tabs__trigger" type="button" aria-selected="true">Today</button>
|
|
198
|
+
<button class="nt-tabs__trigger" type="button">This week</button>
|
|
199
|
+
</div>
|
|
200
|
+
<div class="nt-tabs__panel">Today</div>
|
|
201
|
+
<div class="nt-tabs__panel" hidden>This week</div>
|
|
202
|
+
</div>
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
```js
|
|
206
|
+
import { ntCreateSelectionIndicator, ntCreateTabs } from '@neetechs/ui/behaviors';
|
|
207
|
+
|
|
208
|
+
const root = document.querySelector('#report-tabs');
|
|
209
|
+
ntCreateTabs({ root });
|
|
210
|
+
ntCreateSelectionIndicator({ container: root.querySelector('.nt-tabs__list') });
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
Supported: `.nt-tabs--sliding` (underline, `--boxed`, `--pills`,
|
|
214
|
+
`--vertical`) and `.nt-segmented-control--sliding` (default, `--accent`,
|
|
215
|
+
`--ghost`, `--sm`). The helper re-measures on selection attributes, radio
|
|
216
|
+
`change`, resize, font load, and `dir` changes; call `update()` after
|
|
217
|
+
re-rendering items and `destroy()` on teardown.
|
|
218
|
+
|
|
219
|
+
## Dock
|
|
220
|
+
|
|
221
|
+
`.nt-dock` is a compact glass bar of icon destinations or quick actions.
|
|
222
|
+
Labels are the accessible names and show as tooltips on hover and keyboard
|
|
223
|
+
focus; `.nt-dock--labels` shows them permanently.
|
|
224
|
+
|
|
225
|
+
```html
|
|
226
|
+
<nav class="nt-dock nt-dock--floating" aria-label="Quick navigation">
|
|
227
|
+
<a class="nt-dock__item" href="/home" aria-current="page">
|
|
228
|
+
<svg class="nt-dock__icon" aria-hidden="true"></svg>
|
|
229
|
+
<span class="nt-dock__label">Home</span>
|
|
230
|
+
</a>
|
|
231
|
+
<span class="nt-dock__separator" aria-hidden="true"></span>
|
|
232
|
+
<button class="nt-dock__item" type="button">
|
|
233
|
+
<svg class="nt-dock__icon" aria-hidden="true"></svg>
|
|
234
|
+
<span class="nt-dock__label">Search</span>
|
|
235
|
+
<span class="nt-badge nt-badge--info nt-dock__badge">2</span>
|
|
236
|
+
</button>
|
|
237
|
+
</nav>
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
Modifiers: `--floating` (fixed, bottom center, safe-area aware), `--vertical`,
|
|
241
|
+
`--labels`, `--sm`, `--lg`. The current item has a surface and a dot (a
|
|
242
|
+
non-color cue). Magnification only runs on precise pointers.
|
|
243
|
+
|
|
244
|
+
## Floating action menu
|
|
245
|
+
|
|
246
|
+
`.nt-fab` is one primary trigger that fans out related actions. It reuses the
|
|
247
|
+
menu behavior, so it gets menu roles, arrow keys, Escape, outside click, and
|
|
248
|
+
focus return without new JavaScript.
|
|
249
|
+
|
|
250
|
+
```html
|
|
251
|
+
<div class="nt-fab nt-fab--floating">
|
|
252
|
+
<button class="nt-fab__trigger" type="button" id="create-trigger" aria-label="Create">
|
|
253
|
+
<svg class="nt-fab__trigger-icon" aria-hidden="true"></svg>
|
|
254
|
+
</button>
|
|
255
|
+
<div class="nt-fab__actions" id="create-actions" hidden>
|
|
256
|
+
<button class="nt-fab__action" type="button">
|
|
257
|
+
<span class="nt-fab__action-label">New invoice</span>
|
|
258
|
+
<span class="nt-fab__action-icon"><svg aria-hidden="true"></svg></span>
|
|
259
|
+
</button>
|
|
260
|
+
</div>
|
|
261
|
+
</div>
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
```js
|
|
265
|
+
import { ntCreateMenuPopover } from '@neetechs/ui/behaviors';
|
|
266
|
+
|
|
267
|
+
ntCreateMenuPopover({
|
|
268
|
+
trigger: document.querySelector('#create-trigger'),
|
|
269
|
+
content: document.querySelector('#create-actions'),
|
|
270
|
+
itemSelector: '.nt-fab__action',
|
|
271
|
+
});
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
Modifiers: `--floating`, `--secondary`, `--extended` (trigger with a visible
|
|
275
|
+
text label), `--sm`, `--lg`. Actions enter one after another
|
|
276
|
+
(`--nt-motion-stagger`), nearest first.
|
|
277
|
+
|
|
278
|
+
## Motion system
|
|
279
|
+
|
|
280
|
+
| Token | Value | Use |
|
|
281
|
+
|---|---|---|
|
|
282
|
+
| `--nt-duration-layout` | 300ms | Rail-to-panel, drawers, other surfaces that change size or slide in. |
|
|
283
|
+
| `--nt-ease-glide` | `cubic-bezier(0.32, 0.72, 0, 1)` | Soft deceleration for layout and sliding indicators. |
|
|
284
|
+
| `--nt-ease-spring` | `cubic-bezier(0.34, 1.3, 0.64, 1)` | Small overshoot for entrances and pops (toasts, dock, FAB); never for layout. |
|
|
285
|
+
| `--nt-motion-stagger` | 24ms | Delay between sibling entrances. |
|
|
286
|
+
| `--nt-transition-selection` | — | Selection that moves between siblings. |
|
|
287
|
+
|
|
288
|
+
Overlays now share one rhythm: entrances use `--nt-ease-enter`, exits use
|
|
289
|
+
`--nt-ease-exit`, drawers slide in over `--nt-duration-layout` with
|
|
290
|
+
`--nt-ease-glide`, and toasts enter with `--nt-ease-spring`. Dialogs,
|
|
291
|
+
drawers, dropdowns, tooltips, popovers, the command palette, and the FAB keep
|
|
292
|
+
`display` for the exit duration (`transition-behavior: allow-discrete`) so
|
|
293
|
+
their closing keyframes actually play; browsers without support close
|
|
294
|
+
instantly as before.
|
|
295
|
+
|
|
296
|
+
`data-nt-motion="reduced"` and `prefers-reduced-motion: reduce` collapse every
|
|
297
|
+
duration above (including `--nt-duration-layout` and `--nt-motion-stagger`),
|
|
298
|
+
and each component also disables its own transitions under the media query.
|
|
299
|
+
|
|
300
|
+
## Limitations
|
|
301
|
+
|
|
302
|
+
- Rail tooltips are the native `title` attribute set by `ntCreateSidebar`;
|
|
303
|
+
a styled rail tooltip would need overflow-escaping positioning.
|
|
304
|
+
- The glass shell animates `grid-template-columns`, which re-lays out the
|
|
305
|
+
content column during the 300ms collapse. Very heavy pages may prefer
|
|
306
|
+
`data-nt-motion="reduced"`.
|
|
307
|
+
- The sliding indicator measures with `offsetLeft`. In a horizontally
|
|
308
|
+
scrolling RTL tab list (`.nt-tabs--scrollable` with `dir="rtl"`) browsers
|
|
309
|
+
report offsets from the scroll origin, so the indicator can be misplaced;
|
|
310
|
+
leave `--sliding` off for those lists.
|
|
@@ -1,147 +1,147 @@
|
|
|
1
|
-
# Localization and RTL
|
|
2
|
-
|
|
3
|
-
## Supported model
|
|
4
|
-
|
|
5
|
-
`@neetechs/ui` is tested with English (`en`, LTR), Swedish (`sv`, LTR), Arabic (`ar`, RTL), nested direction changes, and mixed Arabic/Latin technical content. Applications provide translated strings, locale selection, fonts, currency, and time zone. The design system owns layout, display, and interaction contracts; it does not provide translations, translation keys, backend persistence, or a translation framework.
|
|
6
|
-
|
|
7
|
-
Use native metadata. There is no parallel `data-nt-rtl` API:
|
|
8
|
-
|
|
9
|
-
```html
|
|
10
|
-
<html lang="ar" dir="rtl">
|
|
11
|
-
<html lang="sv" dir="ltr">
|
|
12
|
-
<html lang="en" dir="ltr">
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
Direction is inherited from the nearest native `dir`, so localized islands work:
|
|
16
|
-
|
|
17
|
-
```html
|
|
18
|
-
<section lang="ar" dir="rtl">
|
|
19
|
-
<code lang="en" dir="ltr" class="nt-technical-value">POST /api/v1/invoices</code>
|
|
20
|
-
</section>
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
`ntResolveDirection(element, fallback?)` resolves the nearest explicit `ltr`/`rtl` ancestor without `window`, computed styles, or layout reads. `dir="auto"` remains a content feature; behavior roots needing arrow mapping should inherit an explicit direction.
|
|
24
|
-
|
|
25
|
-
## Logical CSS and reviewed exceptions
|
|
26
|
-
|
|
27
|
-
Production layout uses `margin-inline-*`, `padding-inline-*`, `border-inline-*`, `inset-inline-*`, logical corners, and `text-align: start/end`. `npm run check:rtl` rejects new unexplained physical declarations, directional `translateX()`, physical origins/background positions, and broad SVG mirroring. Source is authoritative; generated output and dependencies are not scanned.
|
|
28
|
-
|
|
29
|
-
| Area | Intentional physical reason | Localized contract |
|
|
30
|
-
| --- | --- | --- |
|
|
31
|
-
| Drawer `--left` / `--right` | Existing east/west public classes | Prefer `inline-start` / `inline-end` |
|
|
32
|
-
| Tooltip left/right sides and arrows | Collision and arrow coordinate geometry | `data-align="start|end"` uses logical insets |
|
|
33
|
-
| Toast named left/right modifiers | Existing physical public names | Default is inline-end; swipe/progress respond to RTL |
|
|
34
|
-
| Detached search results | Public viewport-coordinate custom properties | Attached results start at inline-start |
|
|
35
|
-
| Calendar top/size math | Time is a coordinate system | Gutters, boundaries, sticky columns, and event insets are logical |
|
|
36
|
-
| Shimmer, shine, stripes | Decorative traversal carries no meaning | Reduced motion remains authoritative |
|
|
37
|
-
| Slide-left/right animations | Public names explicitly promise physical motion | Do not use for logical navigation |
|
|
38
|
-
|
|
39
|
-
The narrow authoritative allowlist and reasons are in `scripts/check-rtl.mjs`.
|
|
40
|
-
|
|
41
|
-
## Directional components
|
|
42
|
-
|
|
43
|
-
- App-shell/sidebar use inline-start placement and inline-end boundaries. Header leading/trailing groups retain DOM priority.
|
|
44
|
-
- Dropdown and tooltip start/end alignment is logical. Dialog action DOM order is not reversed by script.
|
|
45
|
-
- `NtDrawerSide` adds `inline-start` and `inline-end`; physical sides remain compatible.
|
|
46
|
-
- Sticky-first data-grid columns mean inline-start; resize handles are inline-end. Numeric cells use end alignment.
|
|
47
|
-
- Calendar grids follow visual inline order. Absolute event top/height math remains physical and isolated.
|
|
48
|
-
- Assistant/user message roles use logical start/end rather than assuming user means right.
|
|
49
|
-
|
|
50
|
-
## Icon mirroring
|
|
51
|
-
|
|
52
|
-
Never mirror every SVG. Mark only language-directional icons:
|
|
53
|
-
|
|
54
|
-
```html
|
|
55
|
-
<svg class="nt-icon--directional" aria-hidden="true">...</svg>
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
The class uses individual `scale`, composing safely with transform rotations/animations. Back/forward, previous/next, inline disclosure, language-sensitive reply, and inline collapse icons commonly mirror. Search, settings, calendar, delete, add/remove, status, upload/download, play/pause, external-link marks, and logos normally do not. Product semantics decide chronological arrow meaning.
|
|
59
|
-
|
|
60
|
-
## Arabic typography and fonts
|
|
61
|
-
|
|
62
|
-
`--nt-font-sans` prefers Inter, Noto Sans Arabic, Noto Sans, platform UI fonts, Segoe UI, and Arial. No font files are bundled; applications must load approved licensed fonts. Under `:lang(ar)`, heading/label tracking becomes normal, uppercase presentation is removed, and label/caption line-height is increased to reduce diacritic clipping.
|
|
63
|
-
|
|
64
|
-
Avoid fixed block sizes where localized content wraps. `.nt-button--wrap` is the opt-in multi-line action contract; it keeps the density minimum height. Normal buttons retain a single-line contract.
|
|
65
|
-
|
|
66
|
-
## Bidirectional content
|
|
67
|
-
|
|
68
|
-
```html
|
|
69
|
-
<bdi>اسم المستخدم — user@example.com</bdi>
|
|
70
|
-
<span dir="auto" class="nt-bidi-auto">User supplied text</span>
|
|
71
|
-
<code dir="ltr" class="nt-technical-value">C:\billing\invoice-2026.json</code>
|
|
72
|
-
```
|
|
73
|
-
|
|
74
|
-
| Utility | Contract |
|
|
75
|
-
| --- | --- |
|
|
76
|
-
| `.nt-bidi-auto` | `unicode-bidi: plaintext`; pair with `dir="auto"` |
|
|
77
|
-
| `.nt-bidi-isolate` | Isolates an inline run without choosing direction |
|
|
78
|
-
| `.nt-text-ltr` / `.nt-text-rtl` | Explicit isolated direction without forcing alignment |
|
|
79
|
-
| `.nt-technical-value` | LTR technical content with emergency wrapping |
|
|
80
|
-
| `.nt-numeric-value` | LTR numeric run with tabular figures |
|
|
81
|
-
|
|
82
|
-
Use explicit LTR for URLs, emails, paths, API routes, code, JSON, hashes, model IDs, IBAN/BIC, and similar identifiers—not surrounding prose. Direction and alignment are separate.
|
|
83
|
-
|
|
84
|
-
## Numbers, financial values, dates, and times
|
|
85
|
-
|
|
86
|
-
Formatting helpers require an explicit locale and delegate grammar/order to `Intl`:
|
|
87
|
-
|
|
88
|
-
```ts
|
|
89
|
-
import {
|
|
90
|
-
ntFormatCurrency,
|
|
91
|
-
ntFormatDate,
|
|
92
|
-
ntFormatDateRange,
|
|
93
|
-
ntFormatList,
|
|
94
|
-
ntFormatNumber,
|
|
95
|
-
ntFormatRelativeTime,
|
|
96
|
-
} from '@neetechs/ui/localization';
|
|
97
|
-
|
|
98
|
-
ntFormatCurrency(-1234.5, 'EUR', 'ar-EG');
|
|
99
|
-
ntFormatDate(date, locale, { dateStyle: 'long', timeZone });
|
|
100
|
-
ntFormatDateRange(start, end, locale, { dateStyle: 'medium', timeZone });
|
|
101
|
-
```
|
|
102
|
-
|
|
103
|
-
The package never guesses locale, currency, or time zone and never concatenates a translated range. Keep a formatted amount/sign/currency in one isolated run. Financial meaning still uses financial semantic tokens plus a non-color cue. Do not add display separators to editable numeric input while the user types without a dedicated tested input model.
|
|
104
|
-
|
|
105
|
-
## Long content and translation-safe APIs
|
|
106
|
-
|
|
107
|
-
Wrap prose, labels, errors, dialog titles, and essential actions. Truncate secondary identifiers only when complete accessible content remains available without relying solely on a tooltip. Tables and calendars may use contained scrolling rather than crushing data. At 200% text size, actions remain reachable; broader calendar/data-grid mobile adaptation is deferred to the responsive migration.
|
|
108
|
-
|
|
109
|
-
Pass complete translated labels, descriptions, announcements, and confirmations. Do not concatenate sentence fragments. Calendar range and data-grid sort behavior accept complete application-provided announcements.
|
|
110
|
-
|
|
111
|
-
State and recovery messages follow the same rule. Content-state headings, empty explanations, retry labels, permission errors, maintenance notices, toast text, form errors, and AI confirmation copy are application-provided complete strings. The design system exposes state attributes and layout; it does not provide English fallback strings or assemble sentences. Use `dir="auto"` or bidi utilities for user-generated names inside recovery messages, and keep technical identifiers such as invoice IDs, API routes, and provider names isolated with `.nt-technical-value` where appropriate.
|
|
112
|
-
|
|
113
|
-
## Keyboard behavior in RTL
|
|
114
|
-
|
|
115
|
-
`ntGetInlineArrowKeys(element)` maps visual inline movement. Horizontal tabs, interactive grids, and calendar grids use it. Vertical menus keep Up/Down; Home/End retain component meaning. Native inputs are untouched. Never globally swap ArrowLeft/ArrowRight.
|
|
116
|
-
|
|
117
|
-
## Testing commands
|
|
118
|
-
|
|
119
|
-
```bash
|
|
120
|
-
npm run check:tokens
|
|
121
|
-
npm run check:a11y
|
|
122
|
-
npm run check:rtl
|
|
123
|
-
npm run check:states
|
|
124
|
-
npm test
|
|
125
|
-
npm run test:browser
|
|
126
|
-
```
|
|
127
|
-
|
|
128
|
-
Tests cover explicit-locale formatting, validator failures, nested direction, RTL tabs/grid/calendar keys, logical drawer/shell/sidebar/header/toast edges, state-contract source validation, selective icon mirroring, bidi utilities, Arabic typography, AI messages and approval, 320px localized content, 200% text size, axe/focus/overlay behavior, and a rendered RTL review image.
|
|
129
|
-
|
|
130
|
-
## Manual QA checklist
|
|
131
|
-
|
|
132
|
-
- Test `en/ltr`, `sv/ltr`, and `ar/rtl` at 320px, mobile, tablet, and desktop.
|
|
133
|
-
- Test 200% text size in light/dark and compact/comfortable density.
|
|
134
|
-
- Load the approved Arabic font and inspect diacritics, buttons, badges, chips, tables, and calendar events.
|
|
135
|
-
- Keyboard-test tabs, menus, grids, calendars, drawers, and dialogs.
|
|
136
|
-
- Inspect mixed names, email, URLs, code, invoice IDs, IBAN, amounts, dates, and time zones with a native Arabic screen reader.
|
|
137
|
-
- Verify each previous/next icon's meaning instead of mirroring automatically.
|
|
138
|
-
- Confirm critical translated content is not available only through truncation or a tooltip.
|
|
139
|
-
- Confirm empty, error, offline, permission, maintenance, unsaved-change, and AI approval copy remains understandable in Swedish and Arabic without sentence-fragment concatenation.
|
|
140
|
-
|
|
141
|
-
## Known limitations
|
|
142
|
-
|
|
143
|
-
- Applications must load fonts, translate content, and choose/persist locale, time zone, and currency.
|
|
144
|
-
- Tooltip/calendar collision and event layout retain reviewed physical coordinate math.
|
|
145
|
-
- Responsive modes stay direction-aware: adaptive layouts use logical properties, sticky table columns follow `inset-inline-start`, master-detail panes and drawers follow logical placement, and long Swedish/Arabic content wraps via `overflow-wrap: anywhere` in titles and record values. Safe-area utilities are intentionally physical (device cutouts do not mirror with text direction). See [responsive-and-adaptive-design.md](./responsive-and-adaptive-design.md).
|
|
146
|
-
- Complex browser bidi rendering and native Arabic screen-reader speech require product-level manual QA.
|
|
147
|
-
- Automated checks prevent regressions but do not prove localization quality.
|
|
1
|
+
# Localization and RTL
|
|
2
|
+
|
|
3
|
+
## Supported model
|
|
4
|
+
|
|
5
|
+
`@neetechs/ui` is tested with English (`en`, LTR), Swedish (`sv`, LTR), Arabic (`ar`, RTL), nested direction changes, and mixed Arabic/Latin technical content. Applications provide translated strings, locale selection, fonts, currency, and time zone. The design system owns layout, display, and interaction contracts; it does not provide translations, translation keys, backend persistence, or a translation framework.
|
|
6
|
+
|
|
7
|
+
Use native metadata. There is no parallel `data-nt-rtl` API:
|
|
8
|
+
|
|
9
|
+
```html
|
|
10
|
+
<html lang="ar" dir="rtl">
|
|
11
|
+
<html lang="sv" dir="ltr">
|
|
12
|
+
<html lang="en" dir="ltr">
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
Direction is inherited from the nearest native `dir`, so localized islands work:
|
|
16
|
+
|
|
17
|
+
```html
|
|
18
|
+
<section lang="ar" dir="rtl">
|
|
19
|
+
<code lang="en" dir="ltr" class="nt-technical-value">POST /api/v1/invoices</code>
|
|
20
|
+
</section>
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
`ntResolveDirection(element, fallback?)` resolves the nearest explicit `ltr`/`rtl` ancestor without `window`, computed styles, or layout reads. `dir="auto"` remains a content feature; behavior roots needing arrow mapping should inherit an explicit direction.
|
|
24
|
+
|
|
25
|
+
## Logical CSS and reviewed exceptions
|
|
26
|
+
|
|
27
|
+
Production layout uses `margin-inline-*`, `padding-inline-*`, `border-inline-*`, `inset-inline-*`, logical corners, and `text-align: start/end`. `npm run check:rtl` rejects new unexplained physical declarations, directional `translateX()`, physical origins/background positions, and broad SVG mirroring. Source is authoritative; generated output and dependencies are not scanned.
|
|
28
|
+
|
|
29
|
+
| Area | Intentional physical reason | Localized contract |
|
|
30
|
+
| --- | --- | --- |
|
|
31
|
+
| Drawer `--left` / `--right` | Existing east/west public classes | Prefer `inline-start` / `inline-end` |
|
|
32
|
+
| Tooltip left/right sides and arrows | Collision and arrow coordinate geometry | `data-align="start|end"` uses logical insets |
|
|
33
|
+
| Toast named left/right modifiers | Existing physical public names | Default is inline-end; swipe/progress respond to RTL |
|
|
34
|
+
| Detached search results | Public viewport-coordinate custom properties | Attached results start at inline-start |
|
|
35
|
+
| Calendar top/size math | Time is a coordinate system | Gutters, boundaries, sticky columns, and event insets are logical |
|
|
36
|
+
| Shimmer, shine, stripes | Decorative traversal carries no meaning | Reduced motion remains authoritative |
|
|
37
|
+
| Slide-left/right animations | Public names explicitly promise physical motion | Do not use for logical navigation |
|
|
38
|
+
|
|
39
|
+
The narrow authoritative allowlist and reasons are in `scripts/check-rtl.mjs`.
|
|
40
|
+
|
|
41
|
+
## Directional components
|
|
42
|
+
|
|
43
|
+
- App-shell/sidebar use inline-start placement and inline-end boundaries. Header leading/trailing groups retain DOM priority.
|
|
44
|
+
- Dropdown and tooltip start/end alignment is logical. Dialog action DOM order is not reversed by script.
|
|
45
|
+
- `NtDrawerSide` adds `inline-start` and `inline-end`; physical sides remain compatible.
|
|
46
|
+
- Sticky-first data-grid columns mean inline-start; resize handles are inline-end. Numeric cells use end alignment.
|
|
47
|
+
- Calendar grids follow visual inline order. Absolute event top/height math remains physical and isolated.
|
|
48
|
+
- Assistant/user message roles use logical start/end rather than assuming user means right.
|
|
49
|
+
|
|
50
|
+
## Icon mirroring
|
|
51
|
+
|
|
52
|
+
Never mirror every SVG. Mark only language-directional icons:
|
|
53
|
+
|
|
54
|
+
```html
|
|
55
|
+
<svg class="nt-icon--directional" aria-hidden="true">...</svg>
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
The class uses individual `scale`, composing safely with transform rotations/animations. Back/forward, previous/next, inline disclosure, language-sensitive reply, and inline collapse icons commonly mirror. Search, settings, calendar, delete, add/remove, status, upload/download, play/pause, external-link marks, and logos normally do not. Product semantics decide chronological arrow meaning.
|
|
59
|
+
|
|
60
|
+
## Arabic typography and fonts
|
|
61
|
+
|
|
62
|
+
`--nt-font-sans` prefers Inter, Noto Sans Arabic, Noto Sans, platform UI fonts, Segoe UI, and Arial. No font files are bundled; applications must load approved licensed fonts. Under `:lang(ar)`, heading/label tracking becomes normal, uppercase presentation is removed, and label/caption line-height is increased to reduce diacritic clipping.
|
|
63
|
+
|
|
64
|
+
Avoid fixed block sizes where localized content wraps. `.nt-button--wrap` is the opt-in multi-line action contract; it keeps the density minimum height. Normal buttons retain a single-line contract.
|
|
65
|
+
|
|
66
|
+
## Bidirectional content
|
|
67
|
+
|
|
68
|
+
```html
|
|
69
|
+
<bdi>اسم المستخدم — user@example.com</bdi>
|
|
70
|
+
<span dir="auto" class="nt-bidi-auto">User supplied text</span>
|
|
71
|
+
<code dir="ltr" class="nt-technical-value">C:\billing\invoice-2026.json</code>
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
| Utility | Contract |
|
|
75
|
+
| --- | --- |
|
|
76
|
+
| `.nt-bidi-auto` | `unicode-bidi: plaintext`; pair with `dir="auto"` |
|
|
77
|
+
| `.nt-bidi-isolate` | Isolates an inline run without choosing direction |
|
|
78
|
+
| `.nt-text-ltr` / `.nt-text-rtl` | Explicit isolated direction without forcing alignment |
|
|
79
|
+
| `.nt-technical-value` | LTR technical content with emergency wrapping |
|
|
80
|
+
| `.nt-numeric-value` | LTR numeric run with tabular figures |
|
|
81
|
+
|
|
82
|
+
Use explicit LTR for URLs, emails, paths, API routes, code, JSON, hashes, model IDs, IBAN/BIC, and similar identifiers—not surrounding prose. Direction and alignment are separate.
|
|
83
|
+
|
|
84
|
+
## Numbers, financial values, dates, and times
|
|
85
|
+
|
|
86
|
+
Formatting helpers require an explicit locale and delegate grammar/order to `Intl`:
|
|
87
|
+
|
|
88
|
+
```ts
|
|
89
|
+
import {
|
|
90
|
+
ntFormatCurrency,
|
|
91
|
+
ntFormatDate,
|
|
92
|
+
ntFormatDateRange,
|
|
93
|
+
ntFormatList,
|
|
94
|
+
ntFormatNumber,
|
|
95
|
+
ntFormatRelativeTime,
|
|
96
|
+
} from '@neetechs/ui/localization';
|
|
97
|
+
|
|
98
|
+
ntFormatCurrency(-1234.5, 'EUR', 'ar-EG');
|
|
99
|
+
ntFormatDate(date, locale, { dateStyle: 'long', timeZone });
|
|
100
|
+
ntFormatDateRange(start, end, locale, { dateStyle: 'medium', timeZone });
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
The package never guesses locale, currency, or time zone and never concatenates a translated range. Keep a formatted amount/sign/currency in one isolated run. Financial meaning still uses financial semantic tokens plus a non-color cue. Do not add display separators to editable numeric input while the user types without a dedicated tested input model.
|
|
104
|
+
|
|
105
|
+
## Long content and translation-safe APIs
|
|
106
|
+
|
|
107
|
+
Wrap prose, labels, errors, dialog titles, and essential actions. Truncate secondary identifiers only when complete accessible content remains available without relying solely on a tooltip. Tables and calendars may use contained scrolling rather than crushing data. At 200% text size, actions remain reachable; broader calendar/data-grid mobile adaptation is deferred to the responsive migration.
|
|
108
|
+
|
|
109
|
+
Pass complete translated labels, descriptions, announcements, and confirmations. Do not concatenate sentence fragments. Calendar range and data-grid sort behavior accept complete application-provided announcements.
|
|
110
|
+
|
|
111
|
+
State and recovery messages follow the same rule. Content-state headings, empty explanations, retry labels, permission errors, maintenance notices, toast text, form errors, and AI confirmation copy are application-provided complete strings. The design system exposes state attributes and layout; it does not provide English fallback strings or assemble sentences. Use `dir="auto"` or bidi utilities for user-generated names inside recovery messages, and keep technical identifiers such as invoice IDs, API routes, and provider names isolated with `.nt-technical-value` where appropriate.
|
|
112
|
+
|
|
113
|
+
## Keyboard behavior in RTL
|
|
114
|
+
|
|
115
|
+
`ntGetInlineArrowKeys(element)` maps visual inline movement. Horizontal tabs, interactive grids, and calendar grids use it. Vertical menus keep Up/Down; Home/End retain component meaning. Native inputs are untouched. Never globally swap ArrowLeft/ArrowRight.
|
|
116
|
+
|
|
117
|
+
## Testing commands
|
|
118
|
+
|
|
119
|
+
```bash
|
|
120
|
+
npm run check:tokens
|
|
121
|
+
npm run check:a11y
|
|
122
|
+
npm run check:rtl
|
|
123
|
+
npm run check:states
|
|
124
|
+
npm test
|
|
125
|
+
npm run test:browser
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
Tests cover explicit-locale formatting, validator failures, nested direction, RTL tabs/grid/calendar keys, logical drawer/shell/sidebar/header/toast edges, state-contract source validation, selective icon mirroring, bidi utilities, Arabic typography, AI messages and approval, 320px localized content, 200% text size, axe/focus/overlay behavior, and a rendered RTL review image.
|
|
129
|
+
|
|
130
|
+
## Manual QA checklist
|
|
131
|
+
|
|
132
|
+
- Test `en/ltr`, `sv/ltr`, and `ar/rtl` at 320px, mobile, tablet, and desktop.
|
|
133
|
+
- Test 200% text size in light/dark and compact/comfortable density.
|
|
134
|
+
- Load the approved Arabic font and inspect diacritics, buttons, badges, chips, tables, and calendar events.
|
|
135
|
+
- Keyboard-test tabs, menus, grids, calendars, drawers, and dialogs.
|
|
136
|
+
- Inspect mixed names, email, URLs, code, invoice IDs, IBAN, amounts, dates, and time zones with a native Arabic screen reader.
|
|
137
|
+
- Verify each previous/next icon's meaning instead of mirroring automatically.
|
|
138
|
+
- Confirm critical translated content is not available only through truncation or a tooltip.
|
|
139
|
+
- Confirm empty, error, offline, permission, maintenance, unsaved-change, and AI approval copy remains understandable in Swedish and Arabic without sentence-fragment concatenation.
|
|
140
|
+
|
|
141
|
+
## Known limitations
|
|
142
|
+
|
|
143
|
+
- Applications must load fonts, translate content, and choose/persist locale, time zone, and currency.
|
|
144
|
+
- Tooltip/calendar collision and event layout retain reviewed physical coordinate math.
|
|
145
|
+
- Responsive modes stay direction-aware: adaptive layouts use logical properties, sticky table columns follow `inset-inline-start`, master-detail panes and drawers follow logical placement, and long Swedish/Arabic content wraps via `overflow-wrap: anywhere` in titles and record values. Safe-area utilities are intentionally physical (device cutouts do not mirror with text direction). See [responsive-and-adaptive-design.md](./responsive-and-adaptive-design.md).
|
|
146
|
+
- Complex browser bidi rendering and native Arabic screen-reader speech require product-level manual QA.
|
|
147
|
+
- Automated checks prevent regressions but do not prove localization quality.
|