@isi-ui7/corporate-themes 0.2.9 → 0.2.11

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.
@@ -0,0 +1,7 @@
1
+ export declare function useCorporateFeatures(): {
2
+ logo: {
3
+ light: string;
4
+ dark: string;
5
+ };
6
+ brandColors: import('..').BrandColors;
7
+ };
@@ -0,0 +1 @@
1
+ export declare function useDensity(): "compact" | "normal";
@@ -0,0 +1,27 @@
1
+ import { Ui7FormDensity } from '@isi-ui7/bos7-shared/style-contract';
2
+
3
+ export declare function useFormVisualContract(): {
4
+ density: Ui7FormDensity;
5
+ densityClassName: "ui7-form-contract--density-compact" | "ui7-form-contract--density-comfortable";
6
+ scopeClassName: string;
7
+ classNames: {
8
+ readonly scope: "ui7-form-contract";
9
+ readonly densityCompact: "ui7-form-contract--density-compact";
10
+ readonly densityComfortable: "ui7-form-contract--density-comfortable";
11
+ readonly widthHalf: "ui7-form-contract--width-half";
12
+ readonly widthTwoThirds: "ui7-form-contract--width-two-thirds";
13
+ readonly widthFull: "ui7-form-contract--width-full";
14
+ readonly readonly: "ui7-form-contract--readonly";
15
+ readonly row: "ui7-form-row";
16
+ readonly section: "ui7-form-section";
17
+ readonly column: "ui7-form-column";
18
+ readonly label: "ui7-form-label";
19
+ readonly labelRequired: "ui7-form-label__required";
20
+ readonly control: "ui7-form-control";
21
+ readonly controlReadonly: "ui7-form-control--readonly";
22
+ readonly helper: "ui7-form-helper";
23
+ readonly readonlyValue: "ui7-form-readonly-value";
24
+ };
25
+ tokens: import('@isi-ui7/bos7-shared/style-contract').Ui7FormVisualTokens;
26
+ };
27
+ export type { Ui7FormDensity };
@@ -0,0 +1 @@
1
+ export declare function useThemeTokens(): import('..').ThemeTokens;
@@ -0,0 +1,4 @@
1
+ export declare function useThemeVariant(): {
2
+ variant: import('..').CarbonThemeVariant;
3
+ setVariant: (variant: import('..').CarbonThemeVariant) => void;
4
+ };
@@ -0,0 +1,15 @@
1
+ export * from './types';
2
+ export * from './tokens';
3
+ export { useLabels, LabelsProvider } from './LabelsContext';
4
+ export type { Ui7Labels } from './labels';
5
+ export { defaultLabels } from './labels';
6
+ export { ThemeContextProvider, useTheme, corporateThemes } from './context/ThemeContext';
7
+ export { ThemeProvider } from './components/ThemeProvider';
8
+ export { CorporateTheme, GlobalCorporateTheme } from './components/CorporateTheme';
9
+ export { ThemeSwitcher } from './components/ThemeSwitcher';
10
+ export { useThemeTokens } from './hooks/useThemeTokens';
11
+ export { useBrandColors } from './hooks/useBrandColors';
12
+ export { useThemeVariant } from './hooks/useThemeVariant';
13
+ export { useCorporateFeatures } from './hooks/useCorporateFeatures';
14
+ export { useDensity } from './hooks/useDensity';
15
+ export { useFormVisualContract } from './hooks/useFormVisualContract';
package/dist/index.js ADDED
@@ -0,0 +1,447 @@
1
+ import { jsx as n, jsxs as S } from "react/jsx-runtime";
2
+ import { useContext as p, createContext as F, useMemo as k, useState as A, useEffect as g } from "react";
3
+ const B = {
4
+ brandColors: {
5
+ primary: "#0F62FE",
6
+ primaryHover: "#0043CE",
7
+ primaryActive: "#002D9C",
8
+ secondary: "#393939",
9
+ secondaryHover: "#4C4C4C",
10
+ secondaryActive: "#6F6F6F",
11
+ accent: "#4589FF",
12
+ accentHover: "#1F70FF"
13
+ },
14
+ logoUrl: {
15
+ light: "/assets/logos/carbon-light.svg",
16
+ dark: "/assets/logos/carbon-dark.svg"
17
+ },
18
+ interactive: "#0F62FE",
19
+ interactiveHover: "#0043CE",
20
+ interactiveActive: "#002D9C",
21
+ buttonPrimary: "#0F62FE",
22
+ buttonPrimaryHover: "#0043CE",
23
+ buttonPrimaryActive: "#002D9C",
24
+ buttonSecondary: "#393939",
25
+ buttonSecondaryHover: "#4C4C4C",
26
+ linkPrimary: "#0F62FE",
27
+ linkPrimaryHover: "#002D9C",
28
+ linkSecondary: "#4589FF",
29
+ focus: "#0F62FE",
30
+ borderInteractive: "#0F62FE",
31
+ headerBackground: "#0F62FE",
32
+ sidebarBackground: "#393939",
33
+ navigationBackground: "#F4F4F4"
34
+ }, D = {
35
+ brandColors: {
36
+ primary: "#0066CC",
37
+ // BCA Blue
38
+ primaryHover: "#0052A3",
39
+ primaryActive: "#003D7A",
40
+ secondary: "#00A651",
41
+ // Islamic Green
42
+ secondaryHover: "#008542",
43
+ secondaryActive: "#006633",
44
+ accent: "#FFB81C",
45
+ // Gold accent
46
+ accentHover: "#E6A519"
47
+ },
48
+ logoUrl: {
49
+ light: "/assets/logos/bca-syariah-light.svg",
50
+ dark: "/assets/logos/bca-syariah-dark.svg"
51
+ },
52
+ // Interactive - gunakan primary blue
53
+ interactive: "#0066CC",
54
+ interactiveHover: "#0052A3",
55
+ interactiveActive: "#003D7A",
56
+ // Buttons
57
+ buttonPrimary: "#0066CC",
58
+ buttonPrimaryHover: "#0052A3",
59
+ buttonPrimaryActive: "#003D7A",
60
+ buttonSecondary: "#00A651",
61
+ buttonSecondaryHover: "#008542",
62
+ // Links
63
+ linkPrimary: "#0066CC",
64
+ linkPrimaryHover: "#003D7A",
65
+ linkSecondary: "#00A651",
66
+ // Focus
67
+ focus: "#0066CC",
68
+ borderInteractive: "#0066CC",
69
+ // Custom UI
70
+ headerBackground: "#0066CC",
71
+ sidebarBackground: "#00A651",
72
+ navigationBackground: "#F5F5F5"
73
+ }, w = {
74
+ brandColors: {
75
+ primary: "#C8102E",
76
+ // BJB Red (main brand color)
77
+ primaryHover: "#A00D25",
78
+ primaryActive: "#7A0A1C",
79
+ secondary: "#8B0000",
80
+ // Dark Red
81
+ secondaryHover: "#6B0000",
82
+ secondaryActive: "#4B0000",
83
+ accent: "#E31837",
84
+ // Bright Red accent
85
+ accentHover: "#C8102E"
86
+ },
87
+ logoUrl: {
88
+ light: "/assets/logos/bjb-syariah-light.svg",
89
+ dark: "/assets/logos/bjb-syariah-dark.svg"
90
+ },
91
+ interactive: "#C8102E",
92
+ interactiveHover: "#A00D25",
93
+ interactiveActive: "#7A0A1C",
94
+ buttonPrimary: "#C8102E",
95
+ buttonPrimaryHover: "#A00D25",
96
+ buttonPrimaryActive: "#7A0A1C",
97
+ buttonSecondary: "#8B0000",
98
+ buttonSecondaryHover: "#6B0000",
99
+ linkPrimary: "#C8102E",
100
+ linkPrimaryHover: "#7A0A1C",
101
+ linkSecondary: "#E31837",
102
+ focus: "#C8102E",
103
+ borderInteractive: "#C8102E",
104
+ headerBackground: "#C8102E",
105
+ sidebarBackground: "#8B0000",
106
+ navigationBackground: "#FFF5F5"
107
+ }, T = {
108
+ brandColors: {
109
+ primary: "#ED1C24",
110
+ primaryHover: "#C61018",
111
+ primaryActive: "#A00D14",
112
+ secondary: "#FF7F00",
113
+ secondaryHover: "#E66F00",
114
+ secondaryActive: "#CC6300",
115
+ accent: "#FFD100",
116
+ accentHover: "#E6BC00"
117
+ },
118
+ logoUrl: {
119
+ light: "/assets/logos/pos-indonesia-light.svg",
120
+ dark: "/assets/logos/pos-indonesia-dark.svg"
121
+ },
122
+ interactive: "#ED1C24",
123
+ interactiveHover: "#C61018",
124
+ interactiveActive: "#A00D14",
125
+ buttonPrimary: "#ED1C24",
126
+ buttonPrimaryHover: "#C61018",
127
+ buttonPrimaryActive: "#A00D14",
128
+ buttonSecondary: "#FF7F00",
129
+ buttonSecondaryHover: "#E66F00",
130
+ linkPrimary: "#ED1C24",
131
+ linkPrimaryHover: "#A00D14",
132
+ linkSecondary: "#FF7F00",
133
+ focus: "#ED1C24",
134
+ borderInteractive: "#ED1C24",
135
+ headerBackground: "#ED1C24",
136
+ sidebarBackground: "#FF7F00",
137
+ navigationBackground: "#FFF4E6"
138
+ }, V = {
139
+ brandColors: {
140
+ primary: "#0F62FE",
141
+ primaryHover: "#0043CE",
142
+ primaryActive: "#002D9C",
143
+ secondary: "#1192E8",
144
+ secondaryHover: "#0F7EC8",
145
+ secondaryActive: "#0C6AAA",
146
+ accent: "#08BDBA",
147
+ accentHover: "#07A6A4"
148
+ },
149
+ logoUrl: {
150
+ light: "/assets/logos/ihsan-solusi-light.svg",
151
+ dark: "/assets/logos/ihsan-solusi-dark.svg"
152
+ },
153
+ interactive: "#0F62FE",
154
+ interactiveHover: "#0043CE",
155
+ interactiveActive: "#002D9C",
156
+ buttonPrimary: "#0F62FE",
157
+ buttonPrimaryHover: "#0043CE",
158
+ buttonPrimaryActive: "#002D9C",
159
+ buttonSecondary: "#1192E8",
160
+ buttonSecondaryHover: "#0F7EC8",
161
+ linkPrimary: "#0F62FE",
162
+ linkPrimaryHover: "#002D9C",
163
+ linkSecondary: "#1192E8",
164
+ focus: "#0F62FE",
165
+ borderInteractive: "#0F62FE",
166
+ headerBackground: "#0F62FE",
167
+ sidebarBackground: "#1192E8",
168
+ navigationBackground: "#F4F7FF"
169
+ }, f = [
170
+ {
171
+ id: "carbon-default",
172
+ name: "carbon-default",
173
+ displayName: "ISI",
174
+ tokens: B,
175
+ supportedVariants: ["white", "g10", "g90", "g100"],
176
+ defaultVariant: "g10"
177
+ },
178
+ {
179
+ id: "ihsan",
180
+ name: "ihsan",
181
+ displayName: "ISI",
182
+ tokens: V,
183
+ supportedVariants: ["white", "g10", "g90", "g100"],
184
+ defaultVariant: "g10"
185
+ },
186
+ {
187
+ id: "bca-syariah",
188
+ name: "bca-syariah",
189
+ displayName: "BCAS",
190
+ tokens: D,
191
+ supportedVariants: ["white", "g10", "g90", "g100"],
192
+ defaultVariant: "g10"
193
+ },
194
+ {
195
+ id: "bjb-syariah",
196
+ name: "bjb-syariah",
197
+ displayName: "BJBS",
198
+ tokens: w,
199
+ supportedVariants: ["white", "g10", "g90", "g100"],
200
+ defaultVariant: "g90"
201
+ },
202
+ {
203
+ id: "pos-indonesia",
204
+ name: "pos-indonesia",
205
+ displayName: "PosInd",
206
+ tokens: T,
207
+ supportedVariants: ["white", "g10", "g90", "g100"],
208
+ defaultVariant: "g10"
209
+ }
210
+ ], C = {
211
+ rowsPerPage: "Tampil",
212
+ search: "Cari",
213
+ noData: "Tidak ada data",
214
+ loading: "Memuat...",
215
+ nextPage: "Selanjutnya",
216
+ prevPage: "Sebelumnya",
217
+ firstPage: "Halaman pertama",
218
+ lastPage: "Halaman terakhir",
219
+ filterColumns: "Kolom",
220
+ lookupPlaceholder: "Ketik untuk mencari...",
221
+ lookupNoResults: "Tidak ditemukan",
222
+ lookupLoading: "Mencari...",
223
+ addRow: "Tambah Baris",
224
+ deleteRow: "Hapus",
225
+ editableNoData: "Belum ada data",
226
+ modalClose: "Tutup",
227
+ modalCancel: "Batal",
228
+ notifications: "Notifikasi",
229
+ markAllRead: "Tandai Semua Dibaca",
230
+ noNotifications: "Tidak ada notifikasi",
231
+ apps: "Aplikasi",
232
+ required: "Wajib diisi",
233
+ profile: "Profil Saya",
234
+ changePassword: "Ganti Password",
235
+ logout: "Keluar",
236
+ searchMenuPlaceholder: "Cari navigasi...",
237
+ searchMenuAriaLabel: "Cari navigasi menu",
238
+ openSearchNavigationButtonAriaLabel: "Buka pencarian navigasi",
239
+ clearSearchAriaLabel: "Hapus pencarian",
240
+ removeFavoriteAriaLabel: "Hapus favorit",
241
+ addFavoriteAriaLabel: "Tandai favorit",
242
+ favoritesTitle: "Favorit",
243
+ appSwitcherButtonAriaLabel: "Ganti aplikasi",
244
+ profileButtonAriaLabel: "Profil pengguna",
245
+ notificationsButtonAriaLabel: "Notifikasi",
246
+ notificationsUnreadSuffix: "belum dibaca",
247
+ branchLabel: "Cabang",
248
+ viewAll: "Lihat semua"
249
+ }, E = F(C);
250
+ function L({
251
+ labels: e,
252
+ children: a
253
+ }) {
254
+ const t = e ? { ...C, ...e } : C;
255
+ return /* @__PURE__ */ n(E.Provider, { value: t, children: a });
256
+ }
257
+ function z() {
258
+ return p(E);
259
+ }
260
+ const b = F(null);
261
+ function H(e) {
262
+ const a = f.find((t) => t.id === "carbon-default") ?? f.find((t) => t.id === "ihsan") ?? f[0];
263
+ return e ? f.find((t) => t.id === e) ?? a : a;
264
+ }
265
+ function x({ corporateId: e, variant: a, children: t }) {
266
+ const r = k(() => H(e), [e]), [d, v] = A(
267
+ a ?? r.defaultVariant
268
+ );
269
+ g(() => {
270
+ a && r.supportedVariants.includes(a) && v(a);
271
+ }, [a, r]), g(() => {
272
+ if (typeof document > "u") return;
273
+ const m = document.documentElement, o = document.body;
274
+ f.flatMap(
275
+ (c) => c.supportedVariants.map((h) => `platform-theme-${c.id}-${h}`)
276
+ ).forEach((c) => {
277
+ m.classList.remove(c), o.classList.remove(c);
278
+ });
279
+ const s = `platform-theme-${r.id}-${d}`;
280
+ return m.classList.add(s), o.classList.add(s), () => {
281
+ m.classList.remove(s), o.classList.remove(s);
282
+ };
283
+ }, [r, d]);
284
+ const u = {
285
+ theme: r,
286
+ variant: d,
287
+ corporateId: r.id,
288
+ setVariant: v
289
+ };
290
+ return /* @__PURE__ */ n(b.Provider, { value: u, children: t });
291
+ }
292
+ function l() {
293
+ const e = p(b);
294
+ if (!e)
295
+ throw new Error("useTheme must be used inside ThemeProvider");
296
+ return e;
297
+ }
298
+ function N({ corporateId: e, variant: a, children: t }) {
299
+ return /* @__PURE__ */ n(x, { corporateId: e, variant: a, children: t });
300
+ }
301
+ function K({
302
+ as: e,
303
+ className: a,
304
+ corporateId: t,
305
+ variant: r,
306
+ children: d,
307
+ ...v
308
+ }) {
309
+ const u = l(), m = e ?? "div", o = k(
310
+ () => t ? H(t) : u.theme,
311
+ [t, u.theme]
312
+ ), [y, s] = A(
313
+ r ?? u.variant ?? o.defaultVariant
314
+ );
315
+ g(() => {
316
+ r && o.supportedVariants.includes(r) ? s(r) : r || s(o.defaultVariant);
317
+ }, [r, o]);
318
+ const c = {
319
+ theme: o,
320
+ variant: y,
321
+ corporateId: o.id,
322
+ setVariant: s
323
+ }, h = [a, `platform-theme-${o.id}-${y}`].filter(Boolean).join(" ");
324
+ return /* @__PURE__ */ n(b.Provider, { value: c, children: /* @__PURE__ */ n(m, { className: h, ...v, children: d }) });
325
+ }
326
+ function W({ corporateId: e, variant: a, labels: t, children: r }) {
327
+ return /* @__PURE__ */ n(L, { labels: t, children: /* @__PURE__ */ n(N, { corporateId: e, variant: a, children: r }) });
328
+ }
329
+ const U = ["white", "g10", "g90", "g100"];
330
+ function q() {
331
+ const { variant: e, setVariant: a, theme: t } = l();
332
+ return /* @__PURE__ */ S("div", { style: { display: "inline-flex", gap: "0.5rem", alignItems: "center" }, children: [
333
+ /* @__PURE__ */ n("span", { style: { fontSize: "0.85rem" }, children: t.displayName }),
334
+ /* @__PURE__ */ n(
335
+ "select",
336
+ {
337
+ value: e,
338
+ onChange: (r) => a(r.target.value),
339
+ children: U.map((r) => /* @__PURE__ */ n("option", { value: r, children: r.toUpperCase() }, r))
340
+ }
341
+ )
342
+ ] });
343
+ }
344
+ function I() {
345
+ const { theme: e } = l();
346
+ return e.tokens;
347
+ }
348
+ function O() {
349
+ return I().brandColors;
350
+ }
351
+ function J() {
352
+ const { variant: e, setVariant: a } = l();
353
+ return { variant: e, setVariant: a };
354
+ }
355
+ function Q() {
356
+ const { theme: e } = l();
357
+ return {
358
+ logo: e.tokens.logoUrl,
359
+ brandColors: e.tokens.brandColors
360
+ };
361
+ }
362
+ function X() {
363
+ const { theme: e } = l();
364
+ return e.tokens.density === "normal" ? "normal" : "compact";
365
+ }
366
+ const j = {
367
+ labelSpacing: "6px",
368
+ labelFontSize: "12px",
369
+ labelFontWeight: 500,
370
+ labelLineHeight: "16px",
371
+ inputFontSize: "14px",
372
+ inputFontWeight: 400,
373
+ inputLineHeight: "20px",
374
+ controlHeight: "40px",
375
+ textareaMinHeight: "88px",
376
+ rowGap: "16px",
377
+ sectionGap: "24px",
378
+ columnGap: "16px",
379
+ readonlyBackground: "#f4f4f4",
380
+ readonlyCursor: "default"
381
+ }, i = {
382
+ scope: "ui7-form-contract",
383
+ densityCompact: "ui7-form-contract--density-compact",
384
+ densityComfortable: "ui7-form-contract--density-comfortable",
385
+ widthHalf: "ui7-form-contract--width-half",
386
+ widthTwoThirds: "ui7-form-contract--width-two-thirds",
387
+ widthFull: "ui7-form-contract--width-full",
388
+ readonly: "ui7-form-contract--readonly",
389
+ row: "ui7-form-row",
390
+ section: "ui7-form-section",
391
+ column: "ui7-form-column",
392
+ label: "ui7-form-label",
393
+ labelRequired: "ui7-form-label__required",
394
+ control: "ui7-form-control",
395
+ controlReadonly: "ui7-form-control--readonly",
396
+ helper: "ui7-form-helper",
397
+ readonlyValue: "ui7-form-readonly-value"
398
+ };
399
+ function P(e, a = "compact") {
400
+ return e === "compact" ? "compact" : e === "comfortable" || e === "normal" ? "comfortable" : a;
401
+ }
402
+ function M(e, a = "compact") {
403
+ return P(e, a) === "compact" ? i.densityCompact : i.densityComfortable;
404
+ }
405
+ function R(e) {
406
+ switch (e) {
407
+ case "half":
408
+ return i.widthHalf;
409
+ case "full":
410
+ return i.widthFull;
411
+ case "two-thirds":
412
+ default:
413
+ return i.widthTwoThirds;
414
+ }
415
+ }
416
+ function _(e) {
417
+ const a = [i.scope];
418
+ return (e == null ? void 0 : e.density) !== void 0 && a.push(M(e.density)), a.push(R(e == null ? void 0 : e.width)), e != null && e.readonly && a.push(i.readonly), e != null && e.className && a.push(e.className), a.join(" ");
419
+ }
420
+ function Y() {
421
+ const { theme: e } = l(), a = P(e.tokens.density ?? "compact"), t = a === "compact" ? i.densityCompact : i.densityComfortable;
422
+ return {
423
+ density: a,
424
+ densityClassName: t,
425
+ scopeClassName: _({ density: a }),
426
+ classNames: i,
427
+ tokens: j
428
+ };
429
+ }
430
+ export {
431
+ K as CorporateTheme,
432
+ W as GlobalCorporateTheme,
433
+ L as LabelsProvider,
434
+ x as ThemeContextProvider,
435
+ N as ThemeProvider,
436
+ q as ThemeSwitcher,
437
+ f as corporateThemes,
438
+ C as defaultLabels,
439
+ O as useBrandColors,
440
+ Q as useCorporateFeatures,
441
+ X as useDensity,
442
+ Y as useFormVisualContract,
443
+ z as useLabels,
444
+ l as useTheme,
445
+ I as useThemeTokens,
446
+ J as useThemeVariant
447
+ };
@@ -0,0 +1,41 @@
1
+ export interface Ui7Labels {
2
+ rowsPerPage: string;
3
+ search: string;
4
+ noData: string;
5
+ loading: string;
6
+ nextPage: string;
7
+ prevPage: string;
8
+ firstPage: string;
9
+ lastPage: string;
10
+ filterColumns: string;
11
+ lookupPlaceholder: string;
12
+ lookupNoResults: string;
13
+ lookupLoading: string;
14
+ addRow: string;
15
+ deleteRow: string;
16
+ editableNoData: string;
17
+ modalClose: string;
18
+ modalCancel: string;
19
+ notifications: string;
20
+ markAllRead: string;
21
+ noNotifications: string;
22
+ apps: string;
23
+ required: string;
24
+ profile: string;
25
+ changePassword: string;
26
+ logout: string;
27
+ searchMenuPlaceholder: string;
28
+ searchMenuAriaLabel: string;
29
+ openSearchNavigationButtonAriaLabel: string;
30
+ clearSearchAriaLabel: string;
31
+ removeFavoriteAriaLabel: string;
32
+ addFavoriteAriaLabel: string;
33
+ favoritesTitle: string;
34
+ appSwitcherButtonAriaLabel: string;
35
+ profileButtonAriaLabel: string;
36
+ notificationsButtonAriaLabel: string;
37
+ notificationsUnreadSuffix: string;
38
+ branchLabel: string;
39
+ viewAll: string;
40
+ }
41
+ export declare const defaultLabels: Ui7Labels;