@africanies/angular-web-sdk 0.1.12 → 0.1.13

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.
Files changed (181) hide show
  1. package/.nx/cache/13293303228070520113/dist/libs/africanies-core/README.md +85 -0
  2. package/.nx/cache/13293303228070520113/dist/libs/africanies-core/fesm2022/africanies-africanies-core.mjs +4699 -0
  3. package/.nx/cache/13293303228070520113/dist/libs/africanies-core/fesm2022/africanies-africanies-core.mjs.map +1 -0
  4. package/.nx/cache/13293303228070520113/dist/libs/africanies-core/package.json +31 -0
  5. package/.nx/cache/13293303228070520113/dist/libs/africanies-core/types/africanies-africanies-core.d.ts +2748 -0
  6. package/.nx/cache/13387631073062967069/dist/libs/africanies-theme/README.md +46 -0
  7. package/.nx/cache/13387631073062967069/dist/libs/africanies-theme/fesm2022/africanies-africanies-theme.mjs +249 -0
  8. package/.nx/cache/13387631073062967069/dist/libs/africanies-theme/fesm2022/africanies-africanies-theme.mjs.map +1 -0
  9. package/.nx/cache/13387631073062967069/dist/libs/africanies-theme/package.json +35 -0
  10. package/.nx/cache/13387631073062967069/dist/libs/africanies-theme/tailwind-preset.cjs +330 -0
  11. package/.nx/cache/13387631073062967069/dist/libs/africanies-theme/types/africanies-africanies-theme.d.ts +178 -0
  12. package/.nx/cache/16704640000606796352/dist/libs/africanies-storage/README.md +31 -0
  13. package/.nx/cache/16704640000606796352/dist/libs/africanies-storage/fesm2022/africanies-africanies-storage.mjs +249 -0
  14. package/.nx/cache/16704640000606796352/dist/libs/africanies-storage/fesm2022/africanies-africanies-storage.mjs.map +1 -0
  15. package/.nx/cache/16704640000606796352/dist/libs/africanies-storage/package.json +26 -0
  16. package/.nx/cache/16704640000606796352/dist/libs/africanies-storage/types/africanies-africanies-storage.d.ts +210 -0
  17. package/.nx/cache/2427575433215940812/dist/libs/africanies-ui/README.md +68 -0
  18. package/.nx/cache/2427575433215940812/dist/libs/africanies-ui/assets/brand/africanies-logo-mini.png +0 -0
  19. package/.nx/cache/2427575433215940812/dist/libs/africanies-ui/assets/brand/africanies-logo.png +0 -0
  20. package/.nx/cache/2427575433215940812/dist/libs/africanies-ui/assets/brand/africanies-logo.svg +5 -0
  21. package/.nx/cache/2427575433215940812/dist/libs/africanies-ui/assets/carriers/dhl.svg +7 -0
  22. package/.nx/cache/2427575433215940812/dist/libs/africanies-ui/fesm2022/africanies-africanies-ui.mjs +21251 -0
  23. package/.nx/cache/2427575433215940812/dist/libs/africanies-ui/fesm2022/africanies-africanies-ui.mjs.map +1 -0
  24. package/.nx/cache/2427575433215940812/dist/libs/africanies-ui/package.json +35 -0
  25. package/.nx/cache/2427575433215940812/dist/libs/africanies-ui/types/africanies-africanies-ui.d.ts +5803 -0
  26. package/.nx/cache/7730350229628359718/dist/libs/africanies-icons/README.md +69 -0
  27. package/.nx/cache/7730350229628359718/dist/libs/africanies-icons/assets/icons.sprite.svg +1851 -0
  28. package/.nx/cache/7730350229628359718/dist/libs/africanies-icons/fesm2022/africanies-africanies-icons.mjs +839 -0
  29. package/.nx/cache/7730350229628359718/dist/libs/africanies-icons/fesm2022/africanies-africanies-icons.mjs.map +1 -0
  30. package/.nx/cache/7730350229628359718/dist/libs/africanies-icons/package.json +30 -0
  31. package/.nx/cache/7730350229628359718/dist/libs/africanies-icons/types/africanies-africanies-icons.d.ts +108 -0
  32. package/.nx/cache/run.json +35 -35
  33. package/.nx/cache/terminalOutputs/10603154579345867998 +397 -0
  34. package/.nx/cache/terminalOutputs/12354163057083828162 +80 -0
  35. package/.nx/cache/terminalOutputs/13293303228070520113 +21 -0
  36. package/.nx/cache/terminalOutputs/13387631073062967069 +21 -0
  37. package/.nx/cache/terminalOutputs/14876351543379349919 +176 -0
  38. package/.nx/cache/terminalOutputs/15336883221450327589 +21 -0
  39. package/.nx/cache/terminalOutputs/16208231681037145050 +86 -84
  40. package/.nx/cache/terminalOutputs/16704640000606796352 +21 -0
  41. package/.nx/cache/terminalOutputs/1811006905937373707 +74 -0
  42. package/.nx/cache/terminalOutputs/2005781115771702035 +8 -0
  43. package/.nx/cache/terminalOutputs/2360743690449633551 +21 -0
  44. package/.nx/cache/terminalOutputs/2427575433215940812 +21 -0
  45. package/.nx/cache/terminalOutputs/2981230413857865352 +8 -0
  46. package/.nx/cache/terminalOutputs/3243550283886864639 +8 -0
  47. package/.nx/cache/terminalOutputs/3380188914363501109 +231 -0
  48. package/.nx/cache/terminalOutputs/3699068646900552690 +8 -0
  49. package/.nx/cache/terminalOutputs/5175669339257931410 +8 -0
  50. package/.nx/cache/terminalOutputs/6040230831125637867 +8 -0
  51. package/.nx/cache/terminalOutputs/7730350229628359718 +21 -0
  52. package/.nx/cache/terminalOutputs/8098730470212963224 +87 -0
  53. package/.nx/cache/terminalOutputs/8928690901537686687 +21 -0
  54. package/.nx/workspace-data/0091ABA9-5C90-580D-953C-8C94E763ADB5-v3.db +0 -0
  55. package/.nx/workspace-data/0091ABA9-5C90-580D-953C-8C94E763ADB5-v3.db-shm +0 -0
  56. package/.nx/workspace-data/0091ABA9-5C90-580D-953C-8C94E763ADB5-v3.db-wal +0 -0
  57. package/.nx/workspace-data/d/daemon.log +2859 -0
  58. package/.nx/workspace-data/d/server-process.json +2 -2
  59. package/.nx/workspace-data/file-map.json +2155 -2183
  60. package/.nx/workspace-data/nx_files.nxt +0 -0
  61. package/.nx/workspace-data/project-graph.json +2 -2
  62. package/dist/libs/africanies-core/fesm2022/africanies-africanies-core.mjs +60 -0
  63. package/dist/libs/africanies-core/fesm2022/africanies-africanies-core.mjs.map +1 -1
  64. package/dist/libs/africanies-icons/fesm2022/africanies-africanies-icons.mjs +6 -0
  65. package/dist/libs/africanies-icons/fesm2022/africanies-africanies-icons.mjs.map +1 -1
  66. package/dist/libs/africanies-storage/fesm2022/africanies-africanies-storage.mjs +6 -0
  67. package/dist/libs/africanies-storage/fesm2022/africanies-africanies-storage.mjs.map +1 -1
  68. package/dist/libs/africanies-theme/fesm2022/africanies-africanies-theme.mjs +6 -0
  69. package/dist/libs/africanies-theme/fesm2022/africanies-africanies-theme.mjs.map +1 -1
  70. package/dist/libs/africanies-ui/fesm2022/africanies-africanies-ui.mjs +297 -51
  71. package/dist/libs/africanies-ui/fesm2022/africanies-africanies-ui.mjs.map +1 -1
  72. package/dist/libs/africanies-ui/types/africanies-africanies-ui.d.ts +12 -12
  73. package/libs/africanies-core/src/lib/auth/auth-token.service.ts +3 -0
  74. package/libs/africanies-core/src/lib/auth/auth.service.ts +3 -0
  75. package/libs/africanies-core/src/lib/country/country.service.ts +3 -0
  76. package/libs/africanies-core/src/lib/currency/currency.service.ts +3 -0
  77. package/libs/africanies-core/src/lib/document/document.service.ts +3 -0
  78. package/libs/africanies-core/src/lib/file/file.service.ts +3 -0
  79. package/libs/africanies-core/src/lib/filters/filter-options.resolver.ts +3 -0
  80. package/libs/africanies-core/src/lib/http/api-client.ts +3 -0
  81. package/libs/africanies-core/src/lib/mode/mode-config.service.ts +3 -0
  82. package/libs/africanies-core/src/lib/notification/notification.service.ts +3 -0
  83. package/libs/africanies-core/src/lib/overlay/route-overlay.service.ts +3 -0
  84. package/libs/africanies-core/src/lib/payment-method/payment-method.service.ts +3 -0
  85. package/libs/africanies-core/src/lib/plan/plan.service.ts +3 -0
  86. package/libs/africanies-core/src/lib/product/product.service.ts +3 -0
  87. package/libs/africanies-core/src/lib/service/service.service.ts +3 -0
  88. package/libs/africanies-core/src/lib/shipment-method/shipment-method.service.ts +3 -0
  89. package/libs/africanies-core/src/lib/shipping/shipping-mode.service.ts +3 -0
  90. package/libs/africanies-core/src/lib/user/user.service.ts +3 -0
  91. package/libs/africanies-core/src/lib/warehouse/warehouse.service.ts +3 -0
  92. package/libs/africanies-core/src/lib/zone/zone.service.ts +3 -0
  93. package/libs/africanies-icons/src/lib/africanies-icon.component.ts +3 -0
  94. package/libs/africanies-icons/src/lib/icon-registry.service.ts +3 -0
  95. package/libs/africanies-storage/src/lib/local-storage.service.ts +3 -0
  96. package/libs/africanies-storage/src/lib/session-storage.service.ts +3 -0
  97. package/libs/africanies-theme/src/lib/mode-color.service.ts +3 -0
  98. package/libs/africanies-theme/src/lib/theme.service.ts +3 -0
  99. package/libs/africanies-ui/src/index.ts +11 -11
  100. package/libs/africanies-ui/src/lib/accordion/accordion.component.ts +3 -0
  101. package/libs/africanies-ui/src/lib/action-menu/action-menu-trigger.directive.ts +3 -0
  102. package/libs/africanies-ui/src/lib/action-menu/action-menu.component.ts +3 -0
  103. package/libs/africanies-ui/src/lib/alert/alert.component.ts +3 -0
  104. package/libs/africanies-ui/src/lib/avatar/avatar-menu.component.ts +3 -0
  105. package/libs/africanies-ui/src/lib/avatar/avatar.component.ts +3 -0
  106. package/libs/africanies-ui/src/lib/brand/brand-logo.component.ts +3 -0
  107. package/libs/africanies-ui/src/lib/button/button.component.ts +3 -0
  108. package/libs/africanies-ui/src/lib/carrier/carrier-logo.component.ts +3 -0
  109. package/libs/africanies-ui/src/lib/chip/chip.component.ts +3 -0
  110. package/libs/africanies-ui/src/lib/content-stack/content-stack.component.ts +3 -0
  111. package/libs/africanies-ui/src/lib/copy-button/copy-button.component.ts +3 -0
  112. package/libs/africanies-ui/src/lib/feedback/async-state.component.ts +3 -0
  113. package/libs/africanies-ui/src/lib/feedback/empty-state.component.ts +3 -0
  114. package/libs/africanies-ui/src/lib/feedback/error-indicator.component.ts +3 -0
  115. package/libs/africanies-ui/src/lib/feedback/error-state.component.ts +3 -0
  116. package/libs/africanies-ui/src/lib/feedback/loading-state.component.ts +3 -0
  117. package/libs/africanies-ui/src/lib/filters/filter-drawer.panel.ts +3 -0
  118. package/libs/africanies-ui/src/lib/filters/filter-drawer.service.ts +3 -0
  119. package/libs/africanies-ui/src/lib/filters/filter-query.service.ts +3 -0
  120. package/libs/africanies-ui/src/lib/forms/address-input/address-input.component.ts +3 -0
  121. package/libs/africanies-ui/src/lib/forms/address-input/google-places.service.ts +3 -0
  122. package/libs/africanies-ui/src/lib/forms/checkbox/checkbox.component.ts +3 -0
  123. package/libs/africanies-ui/src/lib/forms/date-picker/date-picker.component.ts +3 -0
  124. package/libs/africanies-ui/src/lib/forms/file-upload/camera-capture.dialog.ts +3 -0
  125. package/libs/africanies-ui/src/lib/forms/file-upload/file-preview.dialog.ts +3 -0
  126. package/libs/africanies-ui/src/lib/forms/file-upload/file-upload.component.ts +3 -0
  127. package/libs/africanies-ui/src/lib/forms/index.ts +3 -3
  128. package/libs/africanies-ui/src/lib/forms/number-input/number-input.component.ts +3 -0
  129. package/libs/africanies-ui/src/lib/forms/otp-input/otp-input.component.ts +3 -0
  130. package/libs/africanies-ui/src/lib/forms/phone-input/phone-input.component.ts +9 -6
  131. package/libs/africanies-ui/src/lib/forms/radio/radio.component.ts +3 -0
  132. package/libs/africanies-ui/src/lib/forms/search-combobox/search-combobox.component.ts +3 -0
  133. package/libs/africanies-ui/src/lib/forms/select/select.component.ts +3 -0
  134. package/libs/africanies-ui/src/lib/forms/text-input/text-input.component.ts +3 -0
  135. package/libs/africanies-ui/src/lib/forms/textarea/textarea.component.ts +3 -0
  136. package/libs/africanies-ui/src/lib/forms/toggle/toggle.component.ts +3 -0
  137. package/libs/africanies-ui/src/lib/image/image.component.ts +3 -0
  138. package/libs/africanies-ui/src/lib/info-popover/info-popover-content.directive.ts +3 -0
  139. package/libs/africanies-ui/src/lib/info-popover/info-popover-trigger.directive.ts +3 -0
  140. package/libs/africanies-ui/src/lib/info-popover/info-popover.component.ts +3 -0
  141. package/libs/africanies-ui/src/lib/layout/app-shell-content-header.component.ts +3 -0
  142. package/libs/africanies-ui/src/lib/layout/app-shell-header-slot.directive.ts +3 -0
  143. package/libs/africanies-ui/src/lib/layout/app-shell-header.component.ts +9 -0
  144. package/libs/africanies-ui/src/lib/layout/app-shell.component.ts +3 -0
  145. package/libs/africanies-ui/src/lib/layout/header-weather.spec.ts +62 -94
  146. package/libs/africanies-ui/src/lib/layout/header-weather.ts +54 -61
  147. package/libs/africanies-ui/src/lib/layout/page-header.component.ts +3 -0
  148. package/libs/africanies-ui/src/lib/modules/africanies-actions.module.ts +3 -0
  149. package/libs/africanies-ui/src/lib/modules/africanies-feedback.module.ts +3 -0
  150. package/libs/africanies-ui/src/lib/modules/africanies-forms.module.ts +3 -0
  151. package/libs/africanies-ui/src/lib/modules/africanies-info-popover.module.ts +3 -0
  152. package/libs/africanies-ui/src/lib/modules/africanies-navigation.module.ts +3 -0
  153. package/libs/africanies-ui/src/lib/modules/africanies-stepper.module.ts +3 -0
  154. package/libs/africanies-ui/src/lib/modules/africanies-table.module.ts +3 -0
  155. package/libs/africanies-ui/src/lib/modules/africanies-tooltip.module.ts +3 -0
  156. package/libs/africanies-ui/src/lib/navigation/breadcrumb/breadcrumb.component.ts +3 -0
  157. package/libs/africanies-ui/src/lib/navigation/segment/segment.component.ts +3 -0
  158. package/libs/africanies-ui/src/lib/navigation/shipping-mode-switch/shipping-mode-switch.component.ts +3 -0
  159. package/libs/africanies-ui/src/lib/navigation/side-nav/africanies-side-nav.component.ts +3 -0
  160. package/libs/africanies-ui/src/lib/navigation/tabs/tab-def.directive.ts +3 -0
  161. package/libs/africanies-ui/src/lib/navigation/tabs/tabs.component.ts +3 -0
  162. package/libs/africanies-ui/src/lib/notifications/notification-drawer.panel.ts +3 -0
  163. package/libs/africanies-ui/src/lib/notifications/notification-drawer.service.ts +3 -0
  164. package/libs/africanies-ui/src/lib/overlay/confirm-dialog.component.ts +3 -0
  165. package/libs/africanies-ui/src/lib/overlay/confirm.service.ts +3 -0
  166. package/libs/africanies-ui/src/lib/overlay/drawer.service.ts +3 -0
  167. package/libs/africanies-ui/src/lib/overlay/modal.service.ts +3 -0
  168. package/libs/africanies-ui/src/lib/overlay/overlay-frame.component.ts +9 -0
  169. package/libs/africanies-ui/src/lib/pagination/pagination.component.ts +3 -0
  170. package/libs/africanies-ui/src/lib/stepper/step-def.directive.ts +3 -0
  171. package/libs/africanies-ui/src/lib/stepper/stepper.component.ts +3 -0
  172. package/libs/africanies-ui/src/lib/table/cell-def.directive.ts +3 -0
  173. package/libs/africanies-ui/src/lib/table/header-cell-def.directive.ts +3 -0
  174. package/libs/africanies-ui/src/lib/table/row-detail-def.directive.ts +3 -0
  175. package/libs/africanies-ui/src/lib/table/table.component.ts +3 -0
  176. package/libs/africanies-ui/src/lib/toast/toast-host.component.ts +4 -1
  177. package/libs/africanies-ui/src/lib/toast/toast-item.component.ts +3 -0
  178. package/libs/africanies-ui/src/lib/toast/toast.service.ts +3 -0
  179. package/libs/africanies-ui/src/lib/tooltip/tooltip-trigger.directive.ts +3 -0
  180. package/libs/africanies-ui/src/lib/tooltip/tooltip.component.ts +3 -0
  181. package/package.json +1 -1
@@ -0,0 +1,249 @@
1
+ import * as i0 from '@angular/core';
2
+ import { Injectable, InjectionToken, inject, makeEnvironmentProviders } from '@angular/core';
3
+
4
+ /**
5
+ * Browser key-value persistence abstraction used by theme, shipping mode,
6
+ * and auth token flows.
7
+ *
8
+ * Implementations JSON-serialize values so callers work with typed objects
9
+ * rather than raw strings. Prefer injecting via {@link STORAGE_TOKEN} so
10
+ * tests can swap in an in-memory fake.
11
+ */
12
+ class StorageService {
13
+ }
14
+
15
+ /**
16
+ * JSON helpers over the Web Storage API.
17
+ *
18
+ * Kept internal so Local/Session services stay thin; failure modes are
19
+ * documented on {@link StorageService} for consumers.
20
+ */
21
+ /**
22
+ * @param store - `localStorage` or `sessionStorage`.
23
+ * @param key - Key to read.
24
+ * @returns Parsed value, or `null` when missing/empty.
25
+ */
26
+ function readJson(store, key) {
27
+ const raw = store.getItem(key);
28
+ if (raw === null || raw === '') {
29
+ return null;
30
+ }
31
+ return JSON.parse(raw);
32
+ }
33
+ /**
34
+ * @param store - `localStorage` or `sessionStorage`.
35
+ * @param key - Key to write.
36
+ * @param value - JSON-serializable value.
37
+ */
38
+ function writeJson(store, key, value) {
39
+ store.setItem(key, JSON.stringify(value));
40
+ }
41
+
42
+ /**
43
+ * `localStorage`-backed {@link StorageService}.
44
+ *
45
+ * Default root implementation behind {@link STORAGE_TOKEN}. Values survive
46
+ * browser restarts for the origin.
47
+ *
48
+ * @example
49
+ * ```ts
50
+ * const storage = inject(LocalStorageService);
51
+ * try {
52
+ * storage.set('user', { id: 1 });
53
+ * } catch (err) {
54
+ * // QuotaExceededError or private-browsing denial
55
+ * console.warn('persist failed', err);
56
+ * }
57
+ * ```
58
+ */
59
+ /**
60
+ * `localStorage`-backed {@link StorageService}.
61
+ */
62
+ class LocalStorageService extends StorageService {
63
+ /**
64
+ * @inheritdoc
65
+ * @throws {DOMException} Quota exceeded or storage disabled in private browsing.
66
+ * @throws {SyntaxError} Stored value is not valid JSON.
67
+ */
68
+ get(key) {
69
+ return readJson(localStorage, key);
70
+ }
71
+ /**
72
+ * @inheritdoc
73
+ * @throws {DOMException} Quota exceeded or storage disabled in private browsing.
74
+ * @throws {TypeError} Value is not JSON-serializable.
75
+ */
76
+ set(key, value) {
77
+ writeJson(localStorage, key, value);
78
+ }
79
+ /**
80
+ * @inheritdoc
81
+ * @throws {DOMException} When storage is inaccessible.
82
+ */
83
+ remove(key) {
84
+ localStorage.removeItem(key);
85
+ }
86
+ /**
87
+ * @inheritdoc
88
+ * @throws {DOMException} When storage is inaccessible.
89
+ */
90
+ clear() {
91
+ localStorage.clear();
92
+ }
93
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: LocalStorageService, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
94
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: LocalStorageService, providedIn: 'root' });
95
+ }
96
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: LocalStorageService, decorators: [{
97
+ type: Injectable,
98
+ args: [{ providedIn: 'root' }]
99
+ }] });
100
+
101
+ /**
102
+ * `sessionStorage`-backed {@link StorageService}.
103
+ *
104
+ * Scope is limited to the current tab/window lifetime — use when values must
105
+ * not outlive the session (e.g. ephemeral UI flags). Register via
106
+ * {@link provideSessionStorage} to bind {@link STORAGE_TOKEN} to this class.
107
+ *
108
+ * @example
109
+ * ```ts
110
+ * // app.config.ts
111
+ * providers: [provideSessionStorage()]
112
+ *
113
+ * // elsewhere
114
+ * const storage = inject(STORAGE_TOKEN);
115
+ * try {
116
+ * storage.set('wizard.step', 2);
117
+ * } catch (err) {
118
+ * // QuotaExceededError or private-browsing denial
119
+ * }
120
+ * ```
121
+ */
122
+ /**
123
+ * `sessionStorage`-backed {@link StorageService}.
124
+ */
125
+ class SessionStorageService extends StorageService {
126
+ /**
127
+ * @inheritdoc
128
+ * @throws {DOMException} Quota exceeded or storage disabled in private browsing.
129
+ * @throws {SyntaxError} Stored value is not valid JSON.
130
+ */
131
+ get(key) {
132
+ return readJson(sessionStorage, key);
133
+ }
134
+ /**
135
+ * @inheritdoc
136
+ * @throws {DOMException} Quota exceeded or storage disabled in private browsing.
137
+ * @throws {TypeError} Value is not JSON-serializable.
138
+ */
139
+ set(key, value) {
140
+ writeJson(sessionStorage, key, value);
141
+ }
142
+ /**
143
+ * @inheritdoc
144
+ * @throws {DOMException} When storage is inaccessible.
145
+ */
146
+ remove(key) {
147
+ sessionStorage.removeItem(key);
148
+ }
149
+ /**
150
+ * @inheritdoc
151
+ * @throws {DOMException} When storage is inaccessible.
152
+ */
153
+ clear() {
154
+ sessionStorage.clear();
155
+ }
156
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: SessionStorageService, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
157
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: SessionStorageService, providedIn: 'root' });
158
+ }
159
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: SessionStorageService, decorators: [{
160
+ type: Injectable,
161
+ args: [{ providedIn: 'root' }]
162
+ }] });
163
+
164
+ /**
165
+ * DI token for the active {@link StorageService} implementation.
166
+ *
167
+ * Defaults to {@link LocalStorageService} via `providedIn: 'root'`. Override
168
+ * in tests or at bootstrap with {@link provideSessionStorage} /
169
+ * {@link provideLocalStorage}.
170
+ *
171
+ * @example
172
+ * ```ts
173
+ * const storage = inject(STORAGE_TOKEN);
174
+ * storage.set('prefs', { dense: true });
175
+ * ```
176
+ */
177
+ const STORAGE_TOKEN = new InjectionToken('AFRICANIES_STORAGE', {
178
+ providedIn: 'root',
179
+ factory: () => inject(LocalStorageService),
180
+ });
181
+
182
+ /**
183
+ * Explicitly binds {@link STORAGE_TOKEN} to {@link LocalStorageService}.
184
+ *
185
+ * Redundant with the token's root factory, but useful when an app previously
186
+ * registered session storage and needs to switch back, or for clarity in
187
+ * `app.config.ts`.
188
+ *
189
+ * @returns Environment providers wiring `STORAGE_TOKEN` → localStorage.
190
+ *
191
+ * @example
192
+ * ```ts
193
+ * bootstrapApplication(App, {
194
+ * providers: [provideLocalStorage()],
195
+ * });
196
+ * ```
197
+ */
198
+ function provideLocalStorage() {
199
+ return makeEnvironmentProviders([
200
+ LocalStorageService,
201
+ { provide: STORAGE_TOKEN, useExisting: LocalStorageService },
202
+ ]);
203
+ }
204
+ /**
205
+ * Binds {@link STORAGE_TOKEN} to {@link SessionStorageService}.
206
+ *
207
+ * Prefer this when SDK consumers (theme, auth token) should persist only
208
+ * for the current tab rather than across sessions.
209
+ *
210
+ * Shipping mode always uses {@link SessionStorageService} directly and is
211
+ * unaffected by this override.
212
+ *
213
+ * @returns Environment providers wiring `STORAGE_TOKEN` → sessionStorage.
214
+ *
215
+ * @example
216
+ * ```ts
217
+ * bootstrapApplication(App, {
218
+ * providers: [provideSessionStorage()],
219
+ * });
220
+ * ```
221
+ */
222
+ function provideSessionStorage() {
223
+ return makeEnvironmentProviders([
224
+ SessionStorageService,
225
+ { provide: STORAGE_TOKEN, useExisting: SessionStorageService },
226
+ ]);
227
+ }
228
+
229
+ /**
230
+ * Well-known local/session storage keys used across AFRICANIES SDK packages.
231
+ *
232
+ * Centralizing these avoids typos between theme, shipping-mode, and
233
+ * auth persistence layers that all go through {@link StorageService}.
234
+ */
235
+ /** Persisted UI theme preference (`'light' | 'dark'` or equivalent). */
236
+ const AFRICANIES_THEME_KEY = 'africanies.theme';
237
+ /** Tab-scoped shipping mode (`'stn' | 'sfn'`) — {@link SessionStorageService}. */
238
+ const AFRICANIES_SHIPPING_MODE_KEY = 'africanies.shippingMode';
239
+ /** Cached public mode-config payload (mapped {@link ModeConfigDataModel}). */
240
+ const AFRICANIES_MODE_CONFIG_KEY = 'africanies.modeConfig';
241
+ /** Persisted bearer access token for authenticated SDK HTTP calls. */
242
+ const AFRICANIES_ACCESS_TOKEN_KEY = 'africanies.accessToken';
243
+
244
+ /**
245
+ * Generated bundle index. Do not edit.
246
+ */
247
+
248
+ export { AFRICANIES_ACCESS_TOKEN_KEY, AFRICANIES_MODE_CONFIG_KEY, AFRICANIES_SHIPPING_MODE_KEY, AFRICANIES_THEME_KEY, LocalStorageService, STORAGE_TOKEN, SessionStorageService, StorageService, provideLocalStorage, provideSessionStorage };
249
+ //# sourceMappingURL=africanies-africanies-storage.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"africanies-africanies-storage.mjs","sources":["../../../../libs/africanies-storage/src/lib/storage.service.ts","../../../../libs/africanies-storage/src/lib/storage-json.ts","../../../../libs/africanies-storage/src/lib/local-storage.service.ts","../../../../libs/africanies-storage/src/lib/session-storage.service.ts","../../../../libs/africanies-storage/src/lib/storage.token.ts","../../../../libs/africanies-storage/src/lib/provide-storage.ts","../../../../libs/africanies-storage/src/lib/storage.keys.ts","../../../../libs/africanies-storage/src/africanies-africanies-storage.ts"],"sourcesContent":["/**\n * Browser key-value persistence abstraction used by theme, shipping mode,\n * and auth token flows.\n *\n * Implementations JSON-serialize values so callers work with typed objects\n * rather than raw strings. Prefer injecting via {@link STORAGE_TOKEN} so\n * tests can swap in an in-memory fake.\n */\nexport abstract class StorageService {\n /**\n * Reads and deserializes a previously stored value.\n *\n * @typeParam T - Expected value type after JSON parse.\n * @param key - Storage key.\n * @returns The parsed value, or `null` when the key is missing or empty.\n * @throws {DOMException} When storage is inaccessible (e.g. private browsing\n * with storage disabled) or when reading fails for security reasons.\n * @throws {SyntaxError} When stored content is not valid JSON.\n */\n abstract get<T>(key: string): T | null;\n\n /**\n * Serializes and writes a value under `key`.\n *\n * @typeParam T - Value type to persist (must be JSON-serializable).\n * @param key - Storage key.\n * @param value - Value to serialize with `JSON.stringify`.\n * @throws {DOMException} `QuotaExceededError` when the storage quota is\n * exceeded, or when storage is disabled (private browsing).\n * @throws {TypeError} When `value` cannot be serialized to JSON\n * (e.g. circular structures).\n */\n abstract set<T>(key: string, value: T): void;\n\n /**\n * Removes a single key if present.\n *\n * @param key - Storage key to delete.\n * @throws {DOMException} When storage is inaccessible.\n */\n abstract remove(key: string): void;\n\n /**\n * Removes all keys in this storage partition.\n *\n * @throws {DOMException} When storage is inaccessible.\n */\n abstract clear(): void;\n}\n","/**\n * JSON helpers over the Web Storage API.\n *\n * Kept internal so Local/Session services stay thin; failure modes are\n * documented on {@link StorageService} for consumers.\n */\n\n/**\n * @param store - `localStorage` or `sessionStorage`.\n * @param key - Key to read.\n * @returns Parsed value, or `null` when missing/empty.\n */\nexport function readJson<T>(store: Storage, key: string): T | null {\n const raw = store.getItem(key);\n if (raw === null || raw === '') {\n return null;\n }\n return JSON.parse(raw) as T;\n}\n\n/**\n * @param store - `localStorage` or `sessionStorage`.\n * @param key - Key to write.\n * @param value - JSON-serializable value.\n */\nexport function writeJson<T>(store: Storage, key: string, value: T): void {\n store.setItem(key, JSON.stringify(value));\n}\n","import { Injectable } from '@angular/core';\n\nimport { StorageService } from './storage.service';\nimport { readJson, writeJson } from './storage-json';\n\n/**\n * `localStorage`-backed {@link StorageService}.\n *\n * Default root implementation behind {@link STORAGE_TOKEN}. Values survive\n * browser restarts for the origin.\n *\n * @example\n * ```ts\n * const storage = inject(LocalStorageService);\n * try {\n * storage.set('user', { id: 1 });\n * } catch (err) {\n * // QuotaExceededError or private-browsing denial\n * console.warn('persist failed', err);\n * }\n * ```\n */\n@Injectable({ providedIn: 'root' })\n/**\n * `localStorage`-backed {@link StorageService}.\n */\nexport class LocalStorageService extends StorageService {\n /**\n * @inheritdoc\n * @throws {DOMException} Quota exceeded or storage disabled in private browsing.\n * @throws {SyntaxError} Stored value is not valid JSON.\n */\n override get<T>(key: string): T | null {\n return readJson<T>(localStorage, key);\n }\n\n /**\n * @inheritdoc\n * @throws {DOMException} Quota exceeded or storage disabled in private browsing.\n * @throws {TypeError} Value is not JSON-serializable.\n */\n override set<T>(key: string, value: T): void {\n writeJson(localStorage, key, value);\n }\n\n /**\n * @inheritdoc\n * @throws {DOMException} When storage is inaccessible.\n */\n override remove(key: string): void {\n localStorage.removeItem(key);\n }\n\n /**\n * @inheritdoc\n * @throws {DOMException} When storage is inaccessible.\n */\n override clear(): void {\n localStorage.clear();\n }\n}\n","import { Injectable } from '@angular/core';\n\nimport { StorageService } from './storage.service';\nimport { readJson, writeJson } from './storage-json';\n\n/**\n * `sessionStorage`-backed {@link StorageService}.\n *\n * Scope is limited to the current tab/window lifetime — use when values must\n * not outlive the session (e.g. ephemeral UI flags). Register via\n * {@link provideSessionStorage} to bind {@link STORAGE_TOKEN} to this class.\n *\n * @example\n * ```ts\n * // app.config.ts\n * providers: [provideSessionStorage()]\n *\n * // elsewhere\n * const storage = inject(STORAGE_TOKEN);\n * try {\n * storage.set('wizard.step', 2);\n * } catch (err) {\n * // QuotaExceededError or private-browsing denial\n * }\n * ```\n */\n@Injectable({ providedIn: 'root' })\n/**\n * `sessionStorage`-backed {@link StorageService}.\n */\nexport class SessionStorageService extends StorageService {\n /**\n * @inheritdoc\n * @throws {DOMException} Quota exceeded or storage disabled in private browsing.\n * @throws {SyntaxError} Stored value is not valid JSON.\n */\n override get<T>(key: string): T | null {\n return readJson<T>(sessionStorage, key);\n }\n\n /**\n * @inheritdoc\n * @throws {DOMException} Quota exceeded or storage disabled in private browsing.\n * @throws {TypeError} Value is not JSON-serializable.\n */\n override set<T>(key: string, value: T): void {\n writeJson(sessionStorage, key, value);\n }\n\n /**\n * @inheritdoc\n * @throws {DOMException} When storage is inaccessible.\n */\n override remove(key: string): void {\n sessionStorage.removeItem(key);\n }\n\n /**\n * @inheritdoc\n * @throws {DOMException} When storage is inaccessible.\n */\n override clear(): void {\n sessionStorage.clear();\n }\n}\n","import { inject,InjectionToken } from '@angular/core';\n\nimport { LocalStorageService } from './local-storage.service';\nimport { StorageService } from './storage.service';\n\n/**\n * DI token for the active {@link StorageService} implementation.\n *\n * Defaults to {@link LocalStorageService} via `providedIn: 'root'`. Override\n * in tests or at bootstrap with {@link provideSessionStorage} /\n * {@link provideLocalStorage}.\n *\n * @example\n * ```ts\n * const storage = inject(STORAGE_TOKEN);\n * storage.set('prefs', { dense: true });\n * ```\n */\nexport const STORAGE_TOKEN = new InjectionToken<StorageService>('AFRICANIES_STORAGE', {\n providedIn: 'root',\n factory: () => inject(LocalStorageService),\n});\n","import { type EnvironmentProviders, makeEnvironmentProviders } from '@angular/core';\n\nimport { LocalStorageService } from './local-storage.service';\nimport { SessionStorageService } from './session-storage.service';\nimport { STORAGE_TOKEN } from './storage.token';\n\n/**\n * Explicitly binds {@link STORAGE_TOKEN} to {@link LocalStorageService}.\n *\n * Redundant with the token's root factory, but useful when an app previously\n * registered session storage and needs to switch back, or for clarity in\n * `app.config.ts`.\n *\n * @returns Environment providers wiring `STORAGE_TOKEN` → localStorage.\n *\n * @example\n * ```ts\n * bootstrapApplication(App, {\n * providers: [provideLocalStorage()],\n * });\n * ```\n */\nexport function provideLocalStorage(): EnvironmentProviders {\n return makeEnvironmentProviders([\n LocalStorageService,\n { provide: STORAGE_TOKEN, useExisting: LocalStorageService },\n ]);\n}\n\n/**\n * Binds {@link STORAGE_TOKEN} to {@link SessionStorageService}.\n *\n * Prefer this when SDK consumers (theme, auth token) should persist only\n * for the current tab rather than across sessions.\n *\n * Shipping mode always uses {@link SessionStorageService} directly and is\n * unaffected by this override.\n *\n * @returns Environment providers wiring `STORAGE_TOKEN` → sessionStorage.\n *\n * @example\n * ```ts\n * bootstrapApplication(App, {\n * providers: [provideSessionStorage()],\n * });\n * ```\n */\nexport function provideSessionStorage(): EnvironmentProviders {\n return makeEnvironmentProviders([\n SessionStorageService,\n { provide: STORAGE_TOKEN, useExisting: SessionStorageService },\n ]);\n}\n","/**\n * Well-known local/session storage keys used across AFRICANIES SDK packages.\n *\n * Centralizing these avoids typos between theme, shipping-mode, and\n * auth persistence layers that all go through {@link StorageService}.\n */\n\n/** Persisted UI theme preference (`'light' | 'dark'` or equivalent). */\nexport const AFRICANIES_THEME_KEY = 'africanies.theme';\n\n/** Tab-scoped shipping mode (`'stn' | 'sfn'`) — {@link SessionStorageService}. */\nexport const AFRICANIES_SHIPPING_MODE_KEY = 'africanies.shippingMode';\n\n/** Cached public mode-config payload (mapped {@link ModeConfigDataModel}). */\nexport const AFRICANIES_MODE_CONFIG_KEY = 'africanies.modeConfig';\n\n/** Persisted bearer access token for authenticated SDK HTTP calls. */\nexport const AFRICANIES_ACCESS_TOKEN_KEY = 'africanies.accessToken';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":"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"}
@@ -0,0 +1,26 @@
1
+ {
2
+ "name": "@africanies/africanies-storage",
3
+ "version": "0.0.1",
4
+ "peerDependencies": {
5
+ "@angular/core": "^22.0.0"
6
+ },
7
+ "sideEffects": false,
8
+ "publishConfig": {
9
+ "access": "public"
10
+ },
11
+ "module": "fesm2022/africanies-africanies-storage.mjs",
12
+ "typings": "types/africanies-africanies-storage.d.ts",
13
+ "exports": {
14
+ "./package.json": {
15
+ "default": "./package.json"
16
+ },
17
+ ".": {
18
+ "types": "./types/africanies-africanies-storage.d.ts",
19
+ "default": "./fesm2022/africanies-africanies-storage.mjs"
20
+ }
21
+ },
22
+ "type": "module",
23
+ "dependencies": {
24
+ "tslib": "^2.3.0"
25
+ }
26
+ }
@@ -0,0 +1,210 @@
1
+ import * as i0 from '@angular/core';
2
+ import { EnvironmentProviders, InjectionToken } from '@angular/core';
3
+
4
+ /**
5
+ * Browser key-value persistence abstraction used by theme, shipping mode,
6
+ * and auth token flows.
7
+ *
8
+ * Implementations JSON-serialize values so callers work with typed objects
9
+ * rather than raw strings. Prefer injecting via {@link STORAGE_TOKEN} so
10
+ * tests can swap in an in-memory fake.
11
+ */
12
+ declare abstract class StorageService {
13
+ /**
14
+ * Reads and deserializes a previously stored value.
15
+ *
16
+ * @typeParam T - Expected value type after JSON parse.
17
+ * @param key - Storage key.
18
+ * @returns The parsed value, or `null` when the key is missing or empty.
19
+ * @throws {DOMException} When storage is inaccessible (e.g. private browsing
20
+ * with storage disabled) or when reading fails for security reasons.
21
+ * @throws {SyntaxError} When stored content is not valid JSON.
22
+ */
23
+ abstract get<T>(key: string): T | null;
24
+ /**
25
+ * Serializes and writes a value under `key`.
26
+ *
27
+ * @typeParam T - Value type to persist (must be JSON-serializable).
28
+ * @param key - Storage key.
29
+ * @param value - Value to serialize with `JSON.stringify`.
30
+ * @throws {DOMException} `QuotaExceededError` when the storage quota is
31
+ * exceeded, or when storage is disabled (private browsing).
32
+ * @throws {TypeError} When `value` cannot be serialized to JSON
33
+ * (e.g. circular structures).
34
+ */
35
+ abstract set<T>(key: string, value: T): void;
36
+ /**
37
+ * Removes a single key if present.
38
+ *
39
+ * @param key - Storage key to delete.
40
+ * @throws {DOMException} When storage is inaccessible.
41
+ */
42
+ abstract remove(key: string): void;
43
+ /**
44
+ * Removes all keys in this storage partition.
45
+ *
46
+ * @throws {DOMException} When storage is inaccessible.
47
+ */
48
+ abstract clear(): void;
49
+ }
50
+
51
+ /**
52
+ * `localStorage`-backed {@link StorageService}.
53
+ *
54
+ * Default root implementation behind {@link STORAGE_TOKEN}. Values survive
55
+ * browser restarts for the origin.
56
+ *
57
+ * @example
58
+ * ```ts
59
+ * const storage = inject(LocalStorageService);
60
+ * try {
61
+ * storage.set('user', { id: 1 });
62
+ * } catch (err) {
63
+ * // QuotaExceededError or private-browsing denial
64
+ * console.warn('persist failed', err);
65
+ * }
66
+ * ```
67
+ */
68
+ declare class LocalStorageService extends StorageService {
69
+ /**
70
+ * @inheritdoc
71
+ * @throws {DOMException} Quota exceeded or storage disabled in private browsing.
72
+ * @throws {SyntaxError} Stored value is not valid JSON.
73
+ */
74
+ get<T>(key: string): T | null;
75
+ /**
76
+ * @inheritdoc
77
+ * @throws {DOMException} Quota exceeded or storage disabled in private browsing.
78
+ * @throws {TypeError} Value is not JSON-serializable.
79
+ */
80
+ set<T>(key: string, value: T): void;
81
+ /**
82
+ * @inheritdoc
83
+ * @throws {DOMException} When storage is inaccessible.
84
+ */
85
+ remove(key: string): void;
86
+ /**
87
+ * @inheritdoc
88
+ * @throws {DOMException} When storage is inaccessible.
89
+ */
90
+ clear(): void;
91
+ static ɵfac: i0.ɵɵFactoryDeclaration<LocalStorageService, never>;
92
+ static ɵprov: i0.ɵɵInjectableDeclaration<LocalStorageService>;
93
+ }
94
+
95
+ /**
96
+ * Explicitly binds {@link STORAGE_TOKEN} to {@link LocalStorageService}.
97
+ *
98
+ * Redundant with the token's root factory, but useful when an app previously
99
+ * registered session storage and needs to switch back, or for clarity in
100
+ * `app.config.ts`.
101
+ *
102
+ * @returns Environment providers wiring `STORAGE_TOKEN` → localStorage.
103
+ *
104
+ * @example
105
+ * ```ts
106
+ * bootstrapApplication(App, {
107
+ * providers: [provideLocalStorage()],
108
+ * });
109
+ * ```
110
+ */
111
+ declare function provideLocalStorage(): EnvironmentProviders;
112
+ /**
113
+ * Binds {@link STORAGE_TOKEN} to {@link SessionStorageService}.
114
+ *
115
+ * Prefer this when SDK consumers (theme, auth token) should persist only
116
+ * for the current tab rather than across sessions.
117
+ *
118
+ * Shipping mode always uses {@link SessionStorageService} directly and is
119
+ * unaffected by this override.
120
+ *
121
+ * @returns Environment providers wiring `STORAGE_TOKEN` → sessionStorage.
122
+ *
123
+ * @example
124
+ * ```ts
125
+ * bootstrapApplication(App, {
126
+ * providers: [provideSessionStorage()],
127
+ * });
128
+ * ```
129
+ */
130
+ declare function provideSessionStorage(): EnvironmentProviders;
131
+
132
+ /**
133
+ * `sessionStorage`-backed {@link StorageService}.
134
+ *
135
+ * Scope is limited to the current tab/window lifetime — use when values must
136
+ * not outlive the session (e.g. ephemeral UI flags). Register via
137
+ * {@link provideSessionStorage} to bind {@link STORAGE_TOKEN} to this class.
138
+ *
139
+ * @example
140
+ * ```ts
141
+ * // app.config.ts
142
+ * providers: [provideSessionStorage()]
143
+ *
144
+ * // elsewhere
145
+ * const storage = inject(STORAGE_TOKEN);
146
+ * try {
147
+ * storage.set('wizard.step', 2);
148
+ * } catch (err) {
149
+ * // QuotaExceededError or private-browsing denial
150
+ * }
151
+ * ```
152
+ */
153
+ declare class SessionStorageService extends StorageService {
154
+ /**
155
+ * @inheritdoc
156
+ * @throws {DOMException} Quota exceeded or storage disabled in private browsing.
157
+ * @throws {SyntaxError} Stored value is not valid JSON.
158
+ */
159
+ get<T>(key: string): T | null;
160
+ /**
161
+ * @inheritdoc
162
+ * @throws {DOMException} Quota exceeded or storage disabled in private browsing.
163
+ * @throws {TypeError} Value is not JSON-serializable.
164
+ */
165
+ set<T>(key: string, value: T): void;
166
+ /**
167
+ * @inheritdoc
168
+ * @throws {DOMException} When storage is inaccessible.
169
+ */
170
+ remove(key: string): void;
171
+ /**
172
+ * @inheritdoc
173
+ * @throws {DOMException} When storage is inaccessible.
174
+ */
175
+ clear(): void;
176
+ static ɵfac: i0.ɵɵFactoryDeclaration<SessionStorageService, never>;
177
+ static ɵprov: i0.ɵɵInjectableDeclaration<SessionStorageService>;
178
+ }
179
+
180
+ /**
181
+ * Well-known local/session storage keys used across AFRICANIES SDK packages.
182
+ *
183
+ * Centralizing these avoids typos between theme, shipping-mode, and
184
+ * auth persistence layers that all go through {@link StorageService}.
185
+ */
186
+ /** Persisted UI theme preference (`'light' | 'dark'` or equivalent). */
187
+ declare const AFRICANIES_THEME_KEY = "africanies.theme";
188
+ /** Tab-scoped shipping mode (`'stn' | 'sfn'`) — {@link SessionStorageService}. */
189
+ declare const AFRICANIES_SHIPPING_MODE_KEY = "africanies.shippingMode";
190
+ /** Cached public mode-config payload (mapped {@link ModeConfigDataModel}). */
191
+ declare const AFRICANIES_MODE_CONFIG_KEY = "africanies.modeConfig";
192
+ /** Persisted bearer access token for authenticated SDK HTTP calls. */
193
+ declare const AFRICANIES_ACCESS_TOKEN_KEY = "africanies.accessToken";
194
+
195
+ /**
196
+ * DI token for the active {@link StorageService} implementation.
197
+ *
198
+ * Defaults to {@link LocalStorageService} via `providedIn: 'root'`. Override
199
+ * in tests or at bootstrap with {@link provideSessionStorage} /
200
+ * {@link provideLocalStorage}.
201
+ *
202
+ * @example
203
+ * ```ts
204
+ * const storage = inject(STORAGE_TOKEN);
205
+ * storage.set('prefs', { dense: true });
206
+ * ```
207
+ */
208
+ declare const STORAGE_TOKEN: InjectionToken<StorageService>;
209
+
210
+ export { AFRICANIES_ACCESS_TOKEN_KEY, AFRICANIES_MODE_CONFIG_KEY, AFRICANIES_SHIPPING_MODE_KEY, AFRICANIES_THEME_KEY, LocalStorageService, STORAGE_TOKEN, SessionStorageService, StorageService, provideLocalStorage, provideSessionStorage };
@@ -0,0 +1,68 @@
1
+ # @africanies/africanies-ui
2
+
3
+ Standalone Angular UI for AFRICANIES apps — buttons, forms, filters, toasts, overlays,
4
+ tables, and the rest. Styles come from the `@africanies/africanies-theme` Tailwind preset.
5
+
6
+ ## Install
7
+
8
+ ```bash
9
+ npm install @africanies/africanies-ui @africanies/africanies-theme @africanies/africanies-icons @africanies/africanies-models @africanies/africanies-core
10
+ ```
11
+
12
+ Peer stack: Angular 22+, `@angular/cdk`, `@angular/forms`, `/*` packages
13
+ above. Configure Tailwind with the theme preset (see `@africanies/africanies-theme`).
14
+
15
+ Import CDK overlay styles once in the app (needed for select dismiss / modal /
16
+ drawer positioning):
17
+
18
+ ```css
19
+ @import '@angular/cdk/overlay-prebuilt.css';
20
+ ```
21
+
22
+ ## Quick start
23
+
24
+ ```ts
25
+ import { ApplicationConfig } from '@angular/core';
26
+ import { provideAfricaniesUiOverlays, provideAfricaniesToasts, ButtonComponent } from '@africanies/africanies-ui';
27
+
28
+ export const appConfig: ApplicationConfig = {
29
+ providers: [provideAfricaniesUiOverlays(), provideAfricaniesToasts()],
30
+ };
31
+ ```
32
+
33
+ ```html
34
+ <button africanies-button type="button" variant="primary">Save</button>
35
+ <africanies-table
36
+ [columns]="columns"
37
+ [rows]="state().data ?? []"
38
+ [loading]="state().isLoading"
39
+ [error]="state().error"
40
+ emptyMessage="No results match these filters."
41
+ />
42
+ ```
43
+
44
+ ## Modules
45
+
46
+ | Area | Highlights |
47
+ | --- | --- |
48
+ | Button | `button[africanies-button]` / `a[africanies-button]` |
49
+ | Copy | `africanies-copy` — clipboard icon button (`copyToClipboard`) |
50
+ | Action menu | `ActionMenu` (+ `africaniesActionMenuTrigger`) — overflow / row actions |
51
+ | Avatar | `Avatar`, `AvatarMenu` — initials/image + account dropdown |
52
+ | Feedback | `LoadingState`, `ErrorState`, `EmptyState`, `AsyncState`, `ErrorIndicator`, `Alert`, `Chip`, `Toast` (`provideAfricaniesToasts`) |
53
+ | Filters | `FilterDrawerService`, `FilterQueryService` — hydrate/write list queries on the URL |
54
+ | Overlay | `ModalService`, `DrawerService`, `ConfirmService`, `provideAfricaniesUiOverlays` |
55
+ | Forms | Text, select, address (Places API New REST), number, file upload, checkbox, radio, toggle, textarea, date, OTP — address needs `provideGooglePlaces({ apiKey })` |
56
+ | Navigation | `AppShell` (clock, notifications, avatar menu, page title + subtitle), `SideNav` (SDK logo), `ShippingModeSwitch`, `Breadcrumb`, `PageHeader`, `Tabs`, `Segment` |
57
+ | Notifications | `NotificationDrawerService` — inbox drawer (via `DrawerService`) |
58
+ | Data | `Table` (+ `africaniesCellDef`), `Pagination`, `Stepper` |
59
+ | NgModules | `AfricaniesFormsModule`, `AfricaniesFeedbackModule`, `AfricaniesActionsModule`, `AfricaniesNavigationModule`, `AfricaniesTableModule`, `AfricaniesStepperModule`, `AfricaniesTooltipModule` — optional one-import facades over the standalones |
60
+
61
+ Live examples: run the workspace playground (`npx nx serve playground`).
62
+
63
+ ## Build / test
64
+
65
+ ```bash
66
+ npx nx build africanies-ui
67
+ npx nx test africanies-ui
68
+ ```
@@ -0,0 +1,5 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 88 24" role="img" aria-label="AIES">
2
+ <rect x="0" y="2" width="20" height="20" rx="5" fill="#2563eb"/>
3
+ <path d="M6.2 16.5 10 7.5h1.6l3.8 9h-1.9l-.8-2H8.9l-.8 2H6.2Zm2.5-3.6h2.6l-1.3-3.4-1.3 3.4Z" fill="#ffffff"/>
4
+ <text x="26" y="17" font-family="system-ui, -apple-system, sans-serif" font-size="15" font-weight="700" fill="#111827">AIES</text>
5
+ </svg>
@@ -0,0 +1,7 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" overflow="visible" version="1.0" viewBox="-26.3622 -9.6965 228.4724 58.179">
2
+ <path fill="#FECC00" d="M0 38.786V0h175.748v38.786z" />
3
+ <path
4
+ fill="#D50029"
5
+ d="M56.665 16.206c-.768 1.04-2.053 2.848-2.835 3.904-.397.537-1.114 1.512 1.263 1.512h12.515s2.017-2.744 3.708-5.039c2.3-3.122.199-9.618-8.024-9.618H30.908l-5.615 7.629h30.603c1.545 0 1.524.588.769 1.612zm-9.194 7.298c-2.377 0-1.66-.977-1.263-1.514.782-1.056 2.088-2.845 2.856-3.885.756-1.024.776-1.612-.771-1.612H34.297L23.02 31.819h27.501c9.083 0 14.14-6.178 15.699-8.314 0-.001-16.235-.001-18.749-.001zm17.89 8.315h16.133l6.116-8.316-16.131.002c-.005-.001-6.118 8.314-6.118 8.314zm41.625-24.854l-6.188 8.405h-7.2l6.185-8.405H83.655l-10.79 14.657h39.46l10.787-14.657zM88.694 31.819h16.127l6.119-8.314H94.813c-.006-.001-6.119 8.314-6.119 8.314zM0 26.784v1.766h22.468l1.298-1.766zm26.181-3.28H0v1.764h24.88zM0 31.819h20.061l1.292-1.756H0zm152.072-3.27h23.676v-1.766h-22.376zm-2.405 3.27h26.081v-1.756h-24.79zm6.116-8.315l-1.297 1.766h21.262v-1.766zm-21.124-1.882l10.789-14.657h-17.081c-.006 0-10.797 14.657-10.797 14.657zm-18.472 1.882s-1.179 1.611-1.752 2.387c-2.025 2.736-.234 5.928 6.376 5.928h25.901l6.119-8.314h-36.644z"
6
+ />
7
+ </svg>