@africanies/angular-web-sdk 0.1.5 → 0.1.7
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/.nx/cache/{13524438527920092277 → 13466509747676776487}/dist/libs/africanies-core/fesm2022/africanies-africanies-core.mjs +140 -52
- package/.nx/cache/13466509747676776487/dist/libs/africanies-core/fesm2022/africanies-africanies-core.mjs.map +1 -0
- package/.nx/cache/{13524438527920092277 → 13466509747676776487}/dist/libs/africanies-core/package.json +3 -3
- package/.nx/cache/{13524438527920092277 → 13466509747676776487}/dist/libs/africanies-core/types/africanies-africanies-core.d.ts +14 -11
- package/.nx/cache/{18132311043100376919 → 14995846848874973576}/dist/libs/africanies-ui/fesm2022/africanies-africanies-ui.mjs +539 -232
- package/.nx/cache/14995846848874973576/dist/libs/africanies-ui/fesm2022/africanies-africanies-ui.mjs.map +1 -0
- package/.nx/cache/{18132311043100376919 → 14995846848874973576}/dist/libs/africanies-ui/package.json +5 -5
- package/.nx/cache/{5741611231803799383 → 14995846848874973576}/dist/libs/africanies-ui/types/africanies-africanies-ui.d.ts +111 -28
- package/.nx/cache/{1275815545780424169 → 6673686859704879504}/dist/libs/africanies-theme/fesm2022/africanies-africanies-theme.mjs +16 -0
- package/.nx/cache/6673686859704879504/dist/libs/africanies-theme/fesm2022/africanies-africanies-theme.mjs.map +1 -0
- package/.nx/cache/{14153928176747262656 → 6673686859704879504}/dist/libs/africanies-theme/package.json +3 -3
- package/.nx/cache/{1275815545780424169 → 6673686859704879504}/dist/libs/africanies-theme/tailwind-preset.cjs +31 -14
- package/.nx/cache/{14153928176747262656 → 6673686859704879504}/dist/libs/africanies-theme/types/africanies-africanies-theme.d.ts +18 -1
- package/.nx/cache/run.json +18 -18
- package/.nx/cache/terminalOutputs/{4011892767661954819 → 13466509747676776487} +1 -1
- package/.nx/cache/terminalOutputs/1446890025183346611 +32 -0
- package/.nx/cache/terminalOutputs/{3064561615116090625 → 14995846848874973576} +7 -7
- package/.nx/cache/terminalOutputs/6337357866566791975 +6 -0
- package/.nx/cache/terminalOutputs/{1275815545780424169 → 6673686859704879504} +1 -1
- package/.nx/cache/terminalOutputs/{12148417737220755248 → 8032148447904822353} +182 -174
- package/.nx/workspace-data/0091ABA9-5C90-580D-953C-8C94E763ADB5-v3.db +0 -0
- package/.nx/workspace-data/0091ABA9-5C90-580D-953C-8C94E763ADB5-v3.db-shm +0 -0
- package/.nx/workspace-data/0091ABA9-5C90-580D-953C-8C94E763ADB5-v3.db-wal +0 -0
- package/.nx/workspace-data/d/daemon.log +2461 -0
- package/.nx/workspace-data/d/server-process.json +2 -2
- package/.nx/workspace-data/file-map.json +2747 -2747
- package/.nx/workspace-data/nx_files.nxt +0 -0
- package/.nx/workspace-data/project-graph.json +2 -2
- package/apps/playground/src/app/pages/button-page.ts +5 -3
- package/apps/playground/src/app/pages/feedback-page.ts +1 -1
- package/apps/playground/src/app/pages/home-page.ts +1 -1
- package/apps/playground/src/app/pages/icons-page.ts +3 -3
- package/apps/playground/src/app/pages/lecture-page.ts +3 -3
- package/apps/playground/src/app/pages/models-page.ts +1 -1
- package/apps/playground/src/app/pages/overlay-demos.ts +1 -1
- package/apps/playground/src/app/pages/tokens-page.ts +17 -3
- package/apps/playground/src/app/pages/usecases/onboarding-login.page.ts +1 -1
- package/apps/playground/src/app/pages/usecases/onboarding-reset-password.page.ts +1 -1
- package/apps/playground/src/app/pages/usecases/shipment-detail.page.ts +1 -1
- package/apps/playground/src/app/pages/viewport-preview.component.ts +1 -1
- package/apps/playground/src/app/snippets/button.snippets.ts +4 -3
- package/apps/playground/src/index.html +6 -0
- package/apps/playground/src/styles.css +4 -5
- package/dist/libs/africanies-core/fesm2022/africanies-africanies-core.mjs +131 -8
- package/dist/libs/africanies-core/fesm2022/africanies-africanies-core.mjs.map +1 -1
- package/dist/libs/africanies-core/types/africanies-africanies-core.d.ts +8 -6
- package/dist/libs/africanies-theme/fesm2022/africanies-africanies-theme.mjs +12 -2
- package/dist/libs/africanies-theme/fesm2022/africanies-africanies-theme.mjs.map +1 -1
- package/dist/libs/africanies-theme/tailwind-preset.cjs +16 -7
- package/dist/libs/africanies-theme/types/africanies-africanies-theme.d.ts +11 -3
- package/dist/libs/africanies-ui/fesm2022/africanies-africanies-ui.mjs +83 -63
- package/dist/libs/africanies-ui/fesm2022/africanies-africanies-ui.mjs.map +1 -1
- package/dist/libs/africanies-ui/types/africanies-africanies-ui.d.ts +11 -8
- package/libs/africanies-core/src/index.ts +1 -0
- package/libs/africanies-core/src/lib/notification/index.ts +1 -1
- package/libs/africanies-core/src/lib/notification/notification-link.spec.ts +40 -7
- package/libs/africanies-core/src/lib/notification/notification-link.ts +143 -7
- package/libs/africanies-theme/src/lib/mode-color.safelist.ts +8 -2
- package/libs/africanies-theme/src/lib/mode-color.service.ts +16 -0
- package/libs/africanies-theme/tailwind-preset.cjs +16 -7
- package/libs/africanies-ui/src/lib/button/button.component.ts +5 -1
- package/libs/africanies-ui/src/lib/feedback/empty-state.component.ts +1 -1
- package/libs/africanies-ui/src/lib/feedback/error-state.component.ts +1 -1
- package/libs/africanies-ui/src/lib/forms/file-upload/file-preview.dialog.ts +1 -1
- package/libs/africanies-ui/src/lib/forms/file-upload/file-upload.component.ts +4 -4
- package/libs/africanies-ui/src/lib/forms/form-field.classes.ts +2 -2
- package/libs/africanies-ui/src/lib/forms/select/select.component.ts +1 -1
- package/libs/africanies-ui/src/lib/layout/app-shell-header.component.ts +1 -1
- package/libs/africanies-ui/src/lib/layout/app-shell.component.ts +2 -2
- package/libs/africanies-ui/src/lib/navigation/shipping-mode-switch/shipping-mode-switch.component.ts +2 -2
- package/libs/africanies-ui/src/lib/navigation/side-nav/africanies-side-nav.component.html +2 -2
- package/libs/africanies-ui/src/lib/navigation/side-nav/africanies-side-nav.component.ts +10 -6
- package/libs/africanies-ui/src/lib/notifications/notification-drawer.panel.ts +21 -8
- package/libs/africanies-ui/src/lib/overlay/drawer.service.ts +1 -1
- package/libs/africanies-ui/src/lib/overlay/modal.service.ts +1 -1
- package/libs/africanies-ui/src/lib/pagination/pagination.component.ts +3 -3
- package/libs/africanies-ui/src/lib/table/table.component.ts +5 -5
- package/libs/africanies-ui/src/lib/toast/toast-host.component.ts +4 -4
- package/libs/africanies-ui/src/lib/toast/toast-item.component.ts +1 -1
- package/package.json +1 -1
- package/.nx/cache/1275815545780424169/dist/libs/africanies-theme/fesm2022/africanies-africanies-theme.mjs.map +0 -1
- package/.nx/cache/1275815545780424169/dist/libs/africanies-theme/package.json +0 -36
- package/.nx/cache/1275815545780424169/dist/libs/africanies-theme/types/africanies-africanies-theme.d.ts +0 -157
- package/.nx/cache/13524438527920092277/dist/libs/africanies-core/fesm2022/africanies-africanies-core.mjs.map +0 -1
- package/.nx/cache/14153928176747262656/dist/libs/africanies-theme/README.md +0 -46
- package/.nx/cache/14153928176747262656/dist/libs/africanies-theme/fesm2022/africanies-africanies-theme.mjs +0 -215
- package/.nx/cache/14153928176747262656/dist/libs/africanies-theme/fesm2022/africanies-africanies-theme.mjs.map +0 -1
- package/.nx/cache/14153928176747262656/dist/libs/africanies-theme/tailwind-preset.cjs +0 -245
- package/.nx/cache/18132311043100376919/dist/libs/africanies-ui/fesm2022/africanies-africanies-ui.mjs.map +0 -1
- package/.nx/cache/18132311043100376919/dist/libs/africanies-ui/types/africanies-africanies-ui.d.ts +0 -5410
- package/.nx/cache/2782605790118376385/dist/libs/africanies-icons/README.md +0 -69
- package/.nx/cache/2782605790118376385/dist/libs/africanies-icons/assets/icons.sprite.svg +0 -1844
- package/.nx/cache/2782605790118376385/dist/libs/africanies-icons/fesm2022/africanies-africanies-icons.mjs +0 -832
- package/.nx/cache/2782605790118376385/dist/libs/africanies-icons/fesm2022/africanies-africanies-icons.mjs.map +0 -1
- package/.nx/cache/2782605790118376385/dist/libs/africanies-icons/package.json +0 -31
- package/.nx/cache/2782605790118376385/dist/libs/africanies-icons/types/africanies-africanies-icons.d.ts +0 -108
- package/.nx/cache/3064561615116090625/dist/libs/africanies-storage/README.md +0 -31
- package/.nx/cache/3064561615116090625/dist/libs/africanies-storage/fesm2022/africanies-africanies-storage.mjs +0 -243
- package/.nx/cache/3064561615116090625/dist/libs/africanies-storage/fesm2022/africanies-africanies-storage.mjs.map +0 -1
- package/.nx/cache/3064561615116090625/dist/libs/africanies-storage/package.json +0 -27
- package/.nx/cache/3064561615116090625/dist/libs/africanies-storage/types/africanies-africanies-storage.d.ts +0 -210
- package/.nx/cache/4011892767661954819/dist/libs/africanies-core/README.md +0 -85
- package/.nx/cache/4011892767661954819/dist/libs/africanies-core/fesm2022/africanies-africanies-core.mjs +0 -4546
- package/.nx/cache/4011892767661954819/dist/libs/africanies-core/fesm2022/africanies-africanies-core.mjs.map +0 -1
- package/.nx/cache/4011892767661954819/dist/libs/africanies-core/package.json +0 -32
- package/.nx/cache/4011892767661954819/dist/libs/africanies-core/types/africanies-africanies-core.d.ts +0 -2740
- package/.nx/cache/5741611231803799383/dist/libs/africanies-ui/README.md +0 -68
- package/.nx/cache/5741611231803799383/dist/libs/africanies-ui/assets/brand/africanies-logo-mini.png +0 -0
- package/.nx/cache/5741611231803799383/dist/libs/africanies-ui/assets/brand/africanies-logo.png +0 -0
- package/.nx/cache/5741611231803799383/dist/libs/africanies-ui/assets/brand/africanies-logo.svg +0 -5
- package/.nx/cache/5741611231803799383/dist/libs/africanies-ui/assets/carriers/dhl.svg +0 -7
- package/.nx/cache/5741611231803799383/dist/libs/africanies-ui/fesm2022/africanies-africanies-ui.mjs +0 -19088
- package/.nx/cache/5741611231803799383/dist/libs/africanies-ui/fesm2022/africanies-africanies-ui.mjs.map +0 -1
- package/.nx/cache/5741611231803799383/dist/libs/africanies-ui/package.json +0 -36
- package/.nx/cache/6372470950255467653/dist/libs/africanies-models/README.md +0 -60
- package/.nx/cache/6372470950255467653/dist/libs/africanies-models/fesm2022/africanies-africanies-models.mjs +0 -599
- package/.nx/cache/6372470950255467653/dist/libs/africanies-models/fesm2022/africanies-africanies-models.mjs.map +0 -1
- package/.nx/cache/6372470950255467653/dist/libs/africanies-models/package.json +0 -24
- package/.nx/cache/6372470950255467653/dist/libs/africanies-models/types/africanies-africanies-models.d.ts +0 -1452
- package/.nx/cache/terminalOutputs/11768036696192889608 +0 -8
- package/.nx/cache/terminalOutputs/1227201614544602906 +0 -23
- package/.nx/cache/terminalOutputs/12538607787148205787 +0 -19
- package/.nx/cache/terminalOutputs/13524438527920092277 +0 -196
- package/.nx/cache/terminalOutputs/14153928176747262656 +0 -45
- package/.nx/cache/terminalOutputs/17404566492103808557 +0 -8
- package/.nx/cache/terminalOutputs/18132311043100376919 +0 -315
- package/.nx/cache/terminalOutputs/2436781291243085315 +0 -8
- package/.nx/cache/terminalOutputs/2782605790118376385 +0 -21
- package/.nx/cache/terminalOutputs/3681975492957101833 +0 -8
- package/.nx/cache/terminalOutputs/5741611231803799383 +0 -21
- package/.nx/cache/terminalOutputs/6037166070823946880 +0 -8
- package/.nx/cache/terminalOutputs/6372470950255467653 +0 -21
- package/.nx/cache/terminalOutputs/665190206482526466 +0 -175
- package/.nx/cache/terminalOutputs/7756595539965457927 +0 -23
- package/.nx/cache/terminalOutputs/9200013119269230075 +0 -8
- /package/.nx/cache/{13524438527920092277 → 13466509747676776487}/dist/libs/africanies-core/README.md +0 -0
- /package/.nx/cache/{18132311043100376919 → 14995846848874973576}/dist/libs/africanies-ui/README.md +0 -0
- /package/.nx/cache/{18132311043100376919 → 14995846848874973576}/dist/libs/africanies-ui/assets/brand/africanies-logo-mini.png +0 -0
- /package/.nx/cache/{18132311043100376919 → 14995846848874973576}/dist/libs/africanies-ui/assets/brand/africanies-logo.png +0 -0
- /package/.nx/cache/{18132311043100376919 → 14995846848874973576}/dist/libs/africanies-ui/assets/brand/africanies-logo.svg +0 -0
- /package/.nx/cache/{18132311043100376919 → 14995846848874973576}/dist/libs/africanies-ui/assets/carriers/dhl.svg +0 -0
- /package/.nx/cache/{1275815545780424169 → 6673686859704879504}/dist/libs/africanies-theme/README.md +0 -0
|
@@ -38,9 +38,10 @@ const DEFAULT_LINK_ACTIVE: IsActiveMatchOptions = {
|
|
|
38
38
|
/**
|
|
39
39
|
* App shell side navigation with icons, nested items, and a collapsible rail.
|
|
40
40
|
*
|
|
41
|
-
* **Design - ink spine:** a continuous mode-accent edge
|
|
42
|
-
*
|
|
43
|
-
*
|
|
41
|
+
* **Design - ink spine:** a continuous mode-accent edge; active leaves use
|
|
42
|
+
* primary fill + white text (portal parity); expanded parents of an active
|
|
43
|
+
* child use primary text on white. Collapsed mode keeps icons; hover opens a
|
|
44
|
+
* floating label blade (name + children) instead of a plain tooltip.
|
|
44
45
|
*
|
|
45
46
|
* ## Parent items with children
|
|
46
47
|
* **Expanded rail:** branches start open by default (`expandBranchesByDefault`).
|
|
@@ -244,12 +245,15 @@ export class SideNavComponent {
|
|
|
244
245
|
|
|
245
246
|
const leaf = this.isLeafActive(item);
|
|
246
247
|
const ancestor = !leaf && this.isItemActive(item);
|
|
248
|
+
const colors = this.modeColor.classes();
|
|
247
249
|
|
|
250
|
+
// Portal: active leaf / collapsed rail = primary fill + white text.
|
|
248
251
|
if (leaf) {
|
|
249
|
-
return `${base} ${
|
|
252
|
+
return `${base} ${colors.activeFill} font-semibold`;
|
|
250
253
|
}
|
|
254
|
+
// Portal: expanded parent of active child = primary text on white.
|
|
251
255
|
if (ancestor) {
|
|
252
|
-
return `${base}
|
|
256
|
+
return `${base} bg-transparent ${colors.text} font-semibold`;
|
|
253
257
|
}
|
|
254
258
|
return (
|
|
255
259
|
`${base} font-medium text-neutral-600 hover:bg-background-welcome hover:text-ink ` +
|
|
@@ -264,7 +268,7 @@ export class SideNavComponent {
|
|
|
264
268
|
(item.disabled ? 'cursor-not-allowed opacity-50 ' : 'cursor-pointer ');
|
|
265
269
|
|
|
266
270
|
if (this.isLeafActive(item)) {
|
|
267
|
-
return `${base} ${this.modeColor.classes().
|
|
271
|
+
return `${base} ${this.modeColor.classes().activeFill} font-semibold`;
|
|
268
272
|
}
|
|
269
273
|
return (
|
|
270
274
|
`${base} font-medium text-neutral-600 hover:bg-background-welcome hover:text-ink ` +
|
|
@@ -127,7 +127,7 @@ const MARK_ALL_CONFIRM_MS = 4000;
|
|
|
127
127
|
<button
|
|
128
128
|
africanies-button
|
|
129
129
|
type="button"
|
|
130
|
-
variant="
|
|
130
|
+
variant="flat"
|
|
131
131
|
size="sm"
|
|
132
132
|
(click)="retryInitialLoad()"
|
|
133
133
|
>
|
|
@@ -296,13 +296,14 @@ export class NotificationDrawerPanel {
|
|
|
296
296
|
});
|
|
297
297
|
|
|
298
298
|
protected readonly title = computed(() => this.data.title ?? 'Notifications');
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
);
|
|
299
|
+
private readonly seededItems = this.data.notifications ?? [];
|
|
300
|
+
protected readonly items = signal<AfricaniesNotification[]>(this.seededItems);
|
|
302
301
|
protected readonly markingId = signal<string | null>(null);
|
|
303
302
|
protected readonly markingAll = signal(false);
|
|
304
303
|
protected readonly confirmingMarkAll = signal(false);
|
|
305
|
-
protected readonly loadingInitial = signal(
|
|
304
|
+
protected readonly loadingInitial = signal(
|
|
305
|
+
!!this.data.onLoadPage && this.seededItems.length === 0,
|
|
306
|
+
);
|
|
306
307
|
protected readonly loadingMore = signal(false);
|
|
307
308
|
protected readonly loadError = signal<string | null>(null);
|
|
308
309
|
protected readonly hasMore = signal(false);
|
|
@@ -334,7 +335,12 @@ export class NotificationDrawerPanel {
|
|
|
334
335
|
|
|
335
336
|
constructor() {
|
|
336
337
|
if (this.data.onLoadPage) {
|
|
337
|
-
this.
|
|
338
|
+
if (this.seededItems.length > 0) {
|
|
339
|
+
this.currentPage.set(1);
|
|
340
|
+
this.fetchPage(1, 'refresh');
|
|
341
|
+
} else {
|
|
342
|
+
this.fetchPage(1, 'replace');
|
|
343
|
+
}
|
|
338
344
|
}
|
|
339
345
|
|
|
340
346
|
effect(() => {
|
|
@@ -578,7 +584,10 @@ export class NotificationDrawerPanel {
|
|
|
578
584
|
this.fetchPage(this.currentPage() + 1, 'append');
|
|
579
585
|
}
|
|
580
586
|
|
|
581
|
-
private fetchPage(
|
|
587
|
+
private fetchPage(
|
|
588
|
+
page: number,
|
|
589
|
+
mode: 'replace' | 'append' | 'refresh',
|
|
590
|
+
): void {
|
|
582
591
|
const loadPage = this.data.onLoadPage;
|
|
583
592
|
if (!loadPage) {
|
|
584
593
|
return;
|
|
@@ -587,6 +596,8 @@ export class NotificationDrawerPanel {
|
|
|
587
596
|
if (mode === 'replace') {
|
|
588
597
|
this.loadingInitial.set(true);
|
|
589
598
|
this.loadError.set(null);
|
|
599
|
+
} else if (mode === 'refresh') {
|
|
600
|
+
this.loadError.set(null);
|
|
590
601
|
} else {
|
|
591
602
|
this.loadingMore.set(true);
|
|
592
603
|
}
|
|
@@ -594,7 +605,7 @@ export class NotificationDrawerPanel {
|
|
|
594
605
|
this.runPageLoad(
|
|
595
606
|
() => loadPage(page),
|
|
596
607
|
(result) => {
|
|
597
|
-
if (mode === 'replace') {
|
|
608
|
+
if (mode === 'replace' || mode === 'refresh') {
|
|
598
609
|
this.items.set(result.items ?? []);
|
|
599
610
|
} else {
|
|
600
611
|
this.appendItems(result.items ?? []);
|
|
@@ -614,6 +625,8 @@ export class NotificationDrawerPanel {
|
|
|
614
625
|
if (mode === 'replace') {
|
|
615
626
|
this.loadError.set('Could not load notifications. Try again.');
|
|
616
627
|
this.loadingInitial.set(false);
|
|
628
|
+
} else if (mode === 'refresh' && this.items().length === 0) {
|
|
629
|
+
this.loadError.set('Could not load notifications. Try again.');
|
|
617
630
|
}
|
|
618
631
|
this.loadingMore.set(false);
|
|
619
632
|
},
|
|
@@ -134,7 +134,7 @@ type PageItem = number | 'ellipsis';
|
|
|
134
134
|
<button
|
|
135
135
|
africanies-button
|
|
136
136
|
type="button"
|
|
137
|
-
variant="
|
|
137
|
+
variant="flat"
|
|
138
138
|
size="sm"
|
|
139
139
|
[disabled]="controlsDisabled() || !meta().has_previous_page"
|
|
140
140
|
(click)="emitPage(meta().current_page - 1)"
|
|
@@ -155,7 +155,7 @@ type PageItem = number | 'ellipsis';
|
|
|
155
155
|
type="button"
|
|
156
156
|
size="sm"
|
|
157
157
|
class="min-w-8"
|
|
158
|
-
[variant]="item === meta().current_page ? 'primary' : '
|
|
158
|
+
[variant]="item === meta().current_page ? 'primary' : 'flat'"
|
|
159
159
|
[disabled]="controlsDisabled()"
|
|
160
160
|
[attr.aria-label]="'Page ' + item"
|
|
161
161
|
[attr.aria-current]="
|
|
@@ -170,7 +170,7 @@ type PageItem = number | 'ellipsis';
|
|
|
170
170
|
<button
|
|
171
171
|
africanies-button
|
|
172
172
|
type="button"
|
|
173
|
-
variant="
|
|
173
|
+
variant="flat"
|
|
174
174
|
size="sm"
|
|
175
175
|
[disabled]="controlsDisabled() || !meta().has_next_page"
|
|
176
176
|
(click)="emitPage(meta().current_page + 1)"
|
|
@@ -142,7 +142,7 @@ import { TableColumn, TableSortChange } from './table-column';
|
|
|
142
142
|
<button
|
|
143
143
|
africanies-button
|
|
144
144
|
type="button"
|
|
145
|
-
variant="
|
|
145
|
+
variant="flat"
|
|
146
146
|
size="sm"
|
|
147
147
|
[disabled]="loading() || refreshing()"
|
|
148
148
|
[attr.aria-label]="refreshLabel()"
|
|
@@ -162,7 +162,7 @@ import { TableColumn, TableSortChange } from './table-column';
|
|
|
162
162
|
<button
|
|
163
163
|
africanies-button
|
|
164
164
|
type="button"
|
|
165
|
-
variant="
|
|
165
|
+
variant="flat"
|
|
166
166
|
size="sm"
|
|
167
167
|
[attr.aria-label]="filterLabel()"
|
|
168
168
|
(click)="filterClick.emit()"
|
|
@@ -182,7 +182,7 @@ import { TableColumn, TableSortChange } from './table-column';
|
|
|
182
182
|
<button
|
|
183
183
|
africanies-button
|
|
184
184
|
type="button"
|
|
185
|
-
variant="
|
|
185
|
+
variant="flat"
|
|
186
186
|
size="sm"
|
|
187
187
|
[attr.aria-label]="exportLabel()"
|
|
188
188
|
(click)="exportClick.emit()"
|
|
@@ -208,7 +208,7 @@ import { TableColumn, TableSortChange } from './table-column';
|
|
|
208
208
|
}
|
|
209
209
|
|
|
210
210
|
<div
|
|
211
|
-
class="min-w-0 w-full overflow-x-auto rounded-md border border-border bg-white dark:border-white/10 dark:bg-ink"
|
|
211
|
+
class="min-w-0 w-full overflow-x-auto rounded-md border border-border bg-white dark:border-white/10 dark:bg-ink-surface"
|
|
212
212
|
>
|
|
213
213
|
<table
|
|
214
214
|
class="w-max min-w-full table-auto border-separate border-spacing-0 bg-inherit text-left text-body text-ink dark:text-white"
|
|
@@ -806,7 +806,7 @@ export class TableComponent<T = unknown> {
|
|
|
806
806
|
// Fill comes from {@link headerSoftClass} on the cell — do not re-tint.
|
|
807
807
|
return `${side} z-[2]`;
|
|
808
808
|
}
|
|
809
|
-
const fill = 'bg-white dark:bg-ink';
|
|
809
|
+
const fill = 'bg-white dark:bg-ink-surface';
|
|
810
810
|
return `${side} ${fill}`;
|
|
811
811
|
}
|
|
812
812
|
|
|
@@ -25,14 +25,14 @@ import { ToastItemComponent } from './toast-item.component';
|
|
|
25
25
|
<div class="flex w-full flex-col gap-2">
|
|
26
26
|
@if (toastService.showHostActions()) {
|
|
27
27
|
<div
|
|
28
|
-
class="sticky top-0 z-10 flex flex-wrap justify-end gap-2 bg-white/80 pb-1 backdrop-blur-sm dark:bg-ink/80"
|
|
28
|
+
class="sticky top-0 z-10 flex flex-wrap justify-end gap-2 bg-white/80 pb-1 backdrop-blur-sm dark:bg-ink-surface/80"
|
|
29
29
|
>
|
|
30
30
|
@if (toastService.hasStacks()) {
|
|
31
31
|
@if (toastService.allStacksExpanded()) {
|
|
32
32
|
<button
|
|
33
33
|
africanies-button
|
|
34
34
|
type="button"
|
|
35
|
-
variant="
|
|
35
|
+
variant="flat"
|
|
36
36
|
size="sm"
|
|
37
37
|
class="!min-h-0 !rounded-full !bg-white !px-2.5 !py-1 !text-caption dark:!bg-ink"
|
|
38
38
|
(click)="toastService.collapseAll()"
|
|
@@ -43,7 +43,7 @@ import { ToastItemComponent } from './toast-item.component';
|
|
|
43
43
|
<button
|
|
44
44
|
africanies-button
|
|
45
45
|
type="button"
|
|
46
|
-
variant="
|
|
46
|
+
variant="flat"
|
|
47
47
|
size="sm"
|
|
48
48
|
class="!min-h-0 !rounded-full !bg-white !px-2.5 !py-1 !text-caption dark:!bg-ink"
|
|
49
49
|
(click)="toastService.expandAll()"
|
|
@@ -55,7 +55,7 @@ import { ToastItemComponent } from './toast-item.component';
|
|
|
55
55
|
<button
|
|
56
56
|
africanies-button
|
|
57
57
|
type="button"
|
|
58
|
-
variant="
|
|
58
|
+
variant="flat"
|
|
59
59
|
size="sm"
|
|
60
60
|
class="!min-h-0 !rounded-full !bg-white !px-2.5 !py-1 !text-caption dark:!bg-ink"
|
|
61
61
|
(click)="toastService.clear()"
|
|
@@ -262,7 +262,7 @@ export class ToastItemComponent {
|
|
|
262
262
|
() =>
|
|
263
263
|
'africanies-toast-enter relative flex w-full overflow-hidden rounded-lg border border-border ' +
|
|
264
264
|
'bg-white/95 text-ink shadow-lg backdrop-blur-md ' +
|
|
265
|
-
'dark:border-white/15 dark:bg-ink/95 dark:text-white',
|
|
265
|
+
'dark:border-white/15 dark:bg-ink-950/95 dark:text-white',
|
|
266
266
|
);
|
|
267
267
|
|
|
268
268
|
protected readonly accentClass = computed(
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"africanies-africanies-theme.mjs","sources":["../../../../libs/africanies-theme/src/lib/mode-color.safelist.ts","../../../../libs/africanies-theme/src/lib/mode-color.service.ts","../../../../libs/africanies-theme/src/lib/theme.service.ts","../../../../libs/africanies-theme/src/africanies-africanies-theme.ts"],"sourcesContent":["/**\n * Tailwind safelist side-effect for shipping-mode color utilities.\n *\n * WHY this file exists: JIT/content scanning only keeps class names that appear\n * as *literal strings* in scanned sources. {@link ModeColorService} already\n * returns these literals, but keeping a dedicated comment list makes the\n * contract obvious for consumers who configure `safelist` or purge plugins.\n *\n * Do not rename these strings without updating ModeColorService and THEME.md.\n *\n * SFN (export / green):\n * text-export bg-export bg-export-subtle bg-export-light border-export\n * hover:bg-export-light hover:bg-export-subtle dark:bg-export/15 dark:hover:bg-export/15\n *\n * STN (import / orange):\n * text-import bg-import bg-import-subtle bg-import-light border-import\n * hover:bg-import-light hover:bg-import-subtle dark:bg-import/15 dark:hover:bg-import/15\n */\nexport const MODE_COLOR_SAFELIST = [\n 'text-export',\n 'bg-export',\n 'bg-export-subtle',\n 'bg-export-light',\n 'border-export',\n 'hover:bg-export-light',\n 'hover:bg-export-subtle',\n 'dark:bg-export/15',\n 'dark:hover:bg-export/15',\n 'text-import',\n 'bg-import',\n 'bg-import-subtle',\n 'bg-import-light',\n 'border-import',\n 'hover:bg-import-light',\n 'hover:bg-import-subtle',\n 'dark:bg-import/15',\n 'dark:hover:bg-import/15',\n] as const;\n","import { computed, inject, Injectable } from '@angular/core';\n\nimport { ShippingModeService } from '@africanies/africanies-core';\n\n/**\n * Tailwind class bundle for the active shipping mode (SFN export / STN import).\n *\n * Use these for **primary** product chrome: CTAs, selected controls, progress,\n * and accent text. Semantic colors (danger / warning) stay mode-independent.\n */\nexport interface ModeColorClasses {\n /** Text color utility, e.g. `text-export`. */\n text: string;\n /** Solid background utility, e.g. `bg-export`. */\n bg: string;\n /** Soft background utility, e.g. `bg-export-subtle`. */\n bgSubtle: string;\n /** Border matching the mode accent, e.g. `border-export`. */\n border: string;\n /**\n * Filled primary CTA — `variant=\"primary\"` on buttons.\n * Includes hover utility as a literal so Tailwind keeps it.\n */\n primary: string;\n /**\n * Transparent / text-only CTA — `variant=\"ghost-primary\"` on buttons.\n * Mode accent text + soft hover fill.\n */\n ghostPrimary: string;\n /**\n * Soft highlight for selected / active rows (works in dark mode).\n */\n soft: string;\n /**\n * Soft hover highlight for menus and lists.\n */\n softHover: string;\n}\n\n/**\n * Maps {@link ShippingModeService} to mode-accent Tailwind classes.\n *\n * - **SFN** → export green is primary\n * - **STN** → import orange is primary\n *\n * WHY literal class strings: Tailwind's scanner cannot see dynamically built\n * names like `` `text-${token}` ``. Returning full literals (`text-export`, …)\n * keeps utilities in the compiled CSS. See {@link MODE_COLOR_SAFELIST}.\n *\n * @example\n * ```html\n * @let colors = modeColor.classes();\n * <button type=\"button\" [class]=\"colors.primary\">Save</button>\n * <span [class]=\"colors.text\">Mode accent</span>\n * ```\n */\n@Injectable({ providedIn: 'root' })\nexport class ModeColorService {\n private readonly shippingMode = inject(ShippingModeService);\n\n /**\n * Mode-dependent utility classes. Recomputes when shipping mode changes.\n */\n readonly classes = computed<ModeColorClasses>(() => {\n // Literal strings required for Tailwind content detection — do not interpolate.\n if (this.shippingMode.mode() === 'sfn') {\n return {\n text: 'text-export',\n bg: 'bg-export',\n bgSubtle: 'bg-export-subtle',\n border: 'border-export',\n primary:\n 'bg-export text-white border-transparent hover:bg-export-light',\n ghostPrimary:\n 'bg-transparent text-export border-transparent hover:bg-export-subtle dark:hover:bg-export/15',\n soft: 'bg-export-subtle dark:bg-export/15',\n softHover: 'hover:bg-export-subtle dark:hover:bg-export/15',\n };\n }\n return {\n text: 'text-import',\n bg: 'bg-import',\n bgSubtle: 'bg-import-subtle',\n border: 'border-import',\n primary:\n 'bg-import text-white border-transparent hover:bg-import-light',\n ghostPrimary:\n 'bg-transparent text-import border-transparent hover:bg-import-subtle dark:hover:bg-import/15',\n soft: 'bg-import-subtle dark:bg-import/15',\n softHover: 'hover:bg-import-subtle dark:hover:bg-import/15',\n };\n });\n}\n","import { DOCUMENT } from '@angular/common';\nimport { inject, Injectable, signal } from '@angular/core';\n\nimport { AFRICANIES_THEME_KEY, STORAGE_TOKEN } from '@africanies/africanies-storage';\n\nimport type { Theme } from './theme.types';\n\n/**\n * Application light/dark theme preference.\n *\n * WHY signals (not BehaviorSubject): theme is synchronous UI state read from\n * templates and other services; a signal avoids RxJS subscription boilerplate\n * and matches Angular 22 change detection. Persistence goes through\n * {@link STORAGE_TOKEN} so tests can swap storage without touching `localStorage`.\n *\n * Applies the Tailwind `darkMode: 'class'` contract by toggling `dark` on\n * `document.documentElement`, and sets `color-scheme` so native UI (date\n * pickers, scrollbars, form controls) matches the app theme — class-based\n * dark mode alone does not restyle browser chrome.\n *\n * @example\n * ```ts\n * // app.config.ts\n * import { inject, provideAppInitializer } from '@angular/core';\n * import { ThemeService } from '@africanies/africanies-theme';\n *\n * export const appConfig = {\n * providers: [\n * provideAppInitializer(() => {\n * inject(ThemeService); // applies stored / system theme once\n * }),\n * ],\n * };\n *\n * // In a component\n * const theme = inject(ThemeService);\n * theme.toggle();\n * theme.setTheme('dark');\n * const current = theme.theme(); // 'light' | 'dark'\n * ```\n */\n@Injectable({ providedIn: 'root' })\nexport class ThemeService {\n private readonly storage = inject(STORAGE_TOKEN);\n private readonly document = inject(DOCUMENT);\n\n /**\n * Current theme. Prefer reading via `theme()` in templates / computed values\n * rather than caching the string, so dark-class consumers stay in sync.\n */\n readonly theme = signal<Theme>(this.resolveInitialTheme());\n\n constructor() {\n this.applyToDocument(this.theme());\n }\n\n /**\n * Sets and persists the theme, updating the `dark` class and `color-scheme`\n * on `<html>`.\n *\n * @param theme - Absolute preference to store.\n */\n setTheme(theme: Theme): void {\n this.theme.set(theme);\n this.applyToDocument(theme);\n try {\n this.storage.set(AFRICANIES_THEME_KEY, theme);\n } catch {\n // Persistence failure must not block the in-session visual toggle —\n // private browsing / quota issues are transient for theme preference.\n }\n }\n\n /**\n * Flips between light and dark.\n *\n * @returns The theme after the toggle.\n */\n toggle(): Theme {\n const next: Theme = this.theme() === 'light' ? 'dark' : 'light';\n this.setTheme(next);\n return next;\n }\n\n private resolveInitialTheme(): Theme {\n try {\n const stored = this.storage.get<Theme>(AFRICANIES_THEME_KEY);\n if (stored === 'light' || stored === 'dark') {\n return stored;\n }\n } catch {\n // Fall through to system preference when storage is unavailable.\n }\n return this.prefersDark() ? 'dark' : 'light';\n }\n\n private prefersDark(): boolean {\n const win = this.document.defaultView;\n return !!win?.matchMedia?.('(prefers-color-scheme: dark)').matches;\n }\n\n private applyToDocument(theme: Theme): void {\n const root = this.document.documentElement;\n if (theme === 'dark') {\n root.classList.add('dark');\n } else {\n root.classList.remove('dark');\n }\n // Native date/time pickers follow `color-scheme`, not Tailwind's `dark` class.\n root.style.colorScheme = theme;\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":"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"}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@africanies/africanies-theme",
|
|
3
|
-
"version": "0.0.1",
|
|
4
|
-
"peerDependencies": {
|
|
5
|
-
"@angular/common": "^22.0.0",
|
|
6
|
-
"@angular/core": "^22.0.0",
|
|
7
|
-
"@africanies/africanies-core": "^0.0.2",
|
|
8
|
-
"@africanies/africanies-storage": "^0.0.1"
|
|
9
|
-
},
|
|
10
|
-
"sideEffects": false,
|
|
11
|
-
"publishConfig": {
|
|
12
|
-
"registry": "https://npm.pkg.github.com",
|
|
13
|
-
"access": "restricted"
|
|
14
|
-
},
|
|
15
|
-
"exports": {
|
|
16
|
-
"./tailwind-preset": "./tailwind-preset.cjs",
|
|
17
|
-
"./package.json": {
|
|
18
|
-
"default": "./package.json"
|
|
19
|
-
},
|
|
20
|
-
".": {
|
|
21
|
-
"types": "./types/africanies-africanies-theme.d.ts",
|
|
22
|
-
"default": "./fesm2022/africanies-africanies-theme.mjs"
|
|
23
|
-
}
|
|
24
|
-
},
|
|
25
|
-
"files": [
|
|
26
|
-
"**/*",
|
|
27
|
-
"tailwind-preset.cjs",
|
|
28
|
-
"THEME.md"
|
|
29
|
-
],
|
|
30
|
-
"module": "fesm2022/africanies-africanies-theme.mjs",
|
|
31
|
-
"typings": "types/africanies-africanies-theme.d.ts",
|
|
32
|
-
"type": "module",
|
|
33
|
-
"dependencies": {
|
|
34
|
-
"tslib": "^2.3.0"
|
|
35
|
-
}
|
|
36
|
-
}
|
|
@@ -1,157 +0,0 @@
|
|
|
1
|
-
import * as i0 from '@angular/core';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Tailwind safelist side-effect for shipping-mode color utilities.
|
|
5
|
-
*
|
|
6
|
-
* WHY this file exists: JIT/content scanning only keeps class names that appear
|
|
7
|
-
* as *literal strings* in scanned sources. {@link ModeColorService} already
|
|
8
|
-
* returns these literals, but keeping a dedicated comment list makes the
|
|
9
|
-
* contract obvious for consumers who configure `safelist` or purge plugins.
|
|
10
|
-
*
|
|
11
|
-
* Do not rename these strings without updating ModeColorService and THEME.md.
|
|
12
|
-
*
|
|
13
|
-
* SFN (export / green):
|
|
14
|
-
* text-export bg-export bg-export-subtle bg-export-light border-export
|
|
15
|
-
* hover:bg-export-light hover:bg-export-subtle dark:bg-export/15 dark:hover:bg-export/15
|
|
16
|
-
*
|
|
17
|
-
* STN (import / orange):
|
|
18
|
-
* text-import bg-import bg-import-subtle bg-import-light border-import
|
|
19
|
-
* hover:bg-import-light hover:bg-import-subtle dark:bg-import/15 dark:hover:bg-import/15
|
|
20
|
-
*/
|
|
21
|
-
declare const MODE_COLOR_SAFELIST: readonly ["text-export", "bg-export", "bg-export-subtle", "bg-export-light", "border-export", "hover:bg-export-light", "hover:bg-export-subtle", "dark:bg-export/15", "dark:hover:bg-export/15", "text-import", "bg-import", "bg-import-subtle", "bg-import-light", "border-import", "hover:bg-import-light", "hover:bg-import-subtle", "dark:bg-import/15", "dark:hover:bg-import/15"];
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Tailwind class bundle for the active shipping mode (SFN export / STN import).
|
|
25
|
-
*
|
|
26
|
-
* Use these for **primary** product chrome: CTAs, selected controls, progress,
|
|
27
|
-
* and accent text. Semantic colors (danger / warning) stay mode-independent.
|
|
28
|
-
*/
|
|
29
|
-
interface ModeColorClasses {
|
|
30
|
-
/** Text color utility, e.g. `text-export`. */
|
|
31
|
-
text: string;
|
|
32
|
-
/** Solid background utility, e.g. `bg-export`. */
|
|
33
|
-
bg: string;
|
|
34
|
-
/** Soft background utility, e.g. `bg-export-subtle`. */
|
|
35
|
-
bgSubtle: string;
|
|
36
|
-
/** Border matching the mode accent, e.g. `border-export`. */
|
|
37
|
-
border: string;
|
|
38
|
-
/**
|
|
39
|
-
* Filled primary CTA — `variant="primary"` on buttons.
|
|
40
|
-
* Includes hover utility as a literal so Tailwind keeps it.
|
|
41
|
-
*/
|
|
42
|
-
primary: string;
|
|
43
|
-
/**
|
|
44
|
-
* Transparent / text-only CTA — `variant="ghost-primary"` on buttons.
|
|
45
|
-
* Mode accent text + soft hover fill.
|
|
46
|
-
*/
|
|
47
|
-
ghostPrimary: string;
|
|
48
|
-
/**
|
|
49
|
-
* Soft highlight for selected / active rows (works in dark mode).
|
|
50
|
-
*/
|
|
51
|
-
soft: string;
|
|
52
|
-
/**
|
|
53
|
-
* Soft hover highlight for menus and lists.
|
|
54
|
-
*/
|
|
55
|
-
softHover: string;
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* Maps {@link ShippingModeService} to mode-accent Tailwind classes.
|
|
59
|
-
*
|
|
60
|
-
* - **SFN** → export green is primary
|
|
61
|
-
* - **STN** → import orange is primary
|
|
62
|
-
*
|
|
63
|
-
* WHY literal class strings: Tailwind's scanner cannot see dynamically built
|
|
64
|
-
* names like `` `text-${token}` ``. Returning full literals (`text-export`, …)
|
|
65
|
-
* keeps utilities in the compiled CSS. See {@link MODE_COLOR_SAFELIST}.
|
|
66
|
-
*
|
|
67
|
-
* @example
|
|
68
|
-
* ```html
|
|
69
|
-
* @let colors = modeColor.classes();
|
|
70
|
-
* <button type="button" [class]="colors.primary">Save</button>
|
|
71
|
-
* <span [class]="colors.text">Mode accent</span>
|
|
72
|
-
* ```
|
|
73
|
-
*/
|
|
74
|
-
declare class ModeColorService {
|
|
75
|
-
private readonly shippingMode;
|
|
76
|
-
/**
|
|
77
|
-
* Mode-dependent utility classes. Recomputes when shipping mode changes.
|
|
78
|
-
*/
|
|
79
|
-
readonly classes: i0.Signal<ModeColorClasses>;
|
|
80
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<ModeColorService, never>;
|
|
81
|
-
static ɵprov: i0.ɵɵInjectableDeclaration<ModeColorService>;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
/**
|
|
85
|
-
* Supported UI color schemes for {@link ThemeService}.
|
|
86
|
-
*
|
|
87
|
-
* Kept as a closed string union so storage values and DOM class toggles stay
|
|
88
|
-
* aligned — unknown persisted strings are ignored and fall back to system
|
|
89
|
-
* preference / light.
|
|
90
|
-
*/
|
|
91
|
-
type Theme = 'light' | 'dark';
|
|
92
|
-
|
|
93
|
-
/**
|
|
94
|
-
* Application light/dark theme preference.
|
|
95
|
-
*
|
|
96
|
-
* WHY signals (not BehaviorSubject): theme is synchronous UI state read from
|
|
97
|
-
* templates and other services; a signal avoids RxJS subscription boilerplate
|
|
98
|
-
* and matches Angular 22 change detection. Persistence goes through
|
|
99
|
-
* {@link STORAGE_TOKEN} so tests can swap storage without touching `localStorage`.
|
|
100
|
-
*
|
|
101
|
-
* Applies the Tailwind `darkMode: 'class'` contract by toggling `dark` on
|
|
102
|
-
* `document.documentElement`, and sets `color-scheme` so native UI (date
|
|
103
|
-
* pickers, scrollbars, form controls) matches the app theme — class-based
|
|
104
|
-
* dark mode alone does not restyle browser chrome.
|
|
105
|
-
*
|
|
106
|
-
* @example
|
|
107
|
-
* ```ts
|
|
108
|
-
* // app.config.ts
|
|
109
|
-
* import { inject, provideAppInitializer } from '@angular/core';
|
|
110
|
-
* import { ThemeService } from '@africanies/africanies-theme';
|
|
111
|
-
*
|
|
112
|
-
* export const appConfig = {
|
|
113
|
-
* providers: [
|
|
114
|
-
* provideAppInitializer(() => {
|
|
115
|
-
* inject(ThemeService); // applies stored / system theme once
|
|
116
|
-
* }),
|
|
117
|
-
* ],
|
|
118
|
-
* };
|
|
119
|
-
*
|
|
120
|
-
* // In a component
|
|
121
|
-
* const theme = inject(ThemeService);
|
|
122
|
-
* theme.toggle();
|
|
123
|
-
* theme.setTheme('dark');
|
|
124
|
-
* const current = theme.theme(); // 'light' | 'dark'
|
|
125
|
-
* ```
|
|
126
|
-
*/
|
|
127
|
-
declare class ThemeService {
|
|
128
|
-
private readonly storage;
|
|
129
|
-
private readonly document;
|
|
130
|
-
/**
|
|
131
|
-
* Current theme. Prefer reading via `theme()` in templates / computed values
|
|
132
|
-
* rather than caching the string, so dark-class consumers stay in sync.
|
|
133
|
-
*/
|
|
134
|
-
readonly theme: i0.WritableSignal<Theme>;
|
|
135
|
-
constructor();
|
|
136
|
-
/**
|
|
137
|
-
* Sets and persists the theme, updating the `dark` class and `color-scheme`
|
|
138
|
-
* on `<html>`.
|
|
139
|
-
*
|
|
140
|
-
* @param theme - Absolute preference to store.
|
|
141
|
-
*/
|
|
142
|
-
setTheme(theme: Theme): void;
|
|
143
|
-
/**
|
|
144
|
-
* Flips between light and dark.
|
|
145
|
-
*
|
|
146
|
-
* @returns The theme after the toggle.
|
|
147
|
-
*/
|
|
148
|
-
toggle(): Theme;
|
|
149
|
-
private resolveInitialTheme;
|
|
150
|
-
private prefersDark;
|
|
151
|
-
private applyToDocument;
|
|
152
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<ThemeService, never>;
|
|
153
|
-
static ɵprov: i0.ɵɵInjectableDeclaration<ThemeService>;
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
export { MODE_COLOR_SAFELIST, ModeColorService, ThemeService };
|
|
157
|
-
export type { ModeColorClasses, Theme };
|