@isi-ui7/corporate-themes 0.2.1 → 0.2.3
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/dist/components.css +14 -0
- package/dist/globals.css +590 -0
- package/dist/hooks/useFormVisualContract.d.ts +24 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +154 -90
- package/dist/labels.d.ts +13 -0
- package/dist/style.css +1 -1
- package/dist/types.d.ts +1 -1
- package/package.json +16 -3
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { jsx as n, jsxs as
|
|
2
|
-
import { useContext as
|
|
3
|
-
const
|
|
1
|
+
import { jsx as n, jsxs as S } from "react/jsx-runtime";
|
|
2
|
+
import { useContext as h, createContext as F, useMemo as k, useState as A, useEffect as C } from "react";
|
|
3
|
+
const B = {
|
|
4
4
|
brandColors: {
|
|
5
5
|
primary: "#0F62FE",
|
|
6
6
|
primaryHover: "#0043CE",
|
|
@@ -31,7 +31,7 @@ const H = {
|
|
|
31
31
|
headerBackground: "#0F62FE",
|
|
32
32
|
sidebarBackground: "#393939",
|
|
33
33
|
navigationBackground: "#F4F4F4"
|
|
34
|
-
},
|
|
34
|
+
}, D = {
|
|
35
35
|
brandColors: {
|
|
36
36
|
primary: "#0066CC",
|
|
37
37
|
// BCA Blue
|
|
@@ -70,7 +70,7 @@ const H = {
|
|
|
70
70
|
headerBackground: "#0066CC",
|
|
71
71
|
sidebarBackground: "#00A651",
|
|
72
72
|
navigationBackground: "#F5F5F5"
|
|
73
|
-
},
|
|
73
|
+
}, T = {
|
|
74
74
|
brandColors: {
|
|
75
75
|
primary: "#C8102E",
|
|
76
76
|
// BJB Red (main brand color)
|
|
@@ -104,7 +104,7 @@ const H = {
|
|
|
104
104
|
headerBackground: "#C8102E",
|
|
105
105
|
sidebarBackground: "#8B0000",
|
|
106
106
|
navigationBackground: "#FFF5F5"
|
|
107
|
-
},
|
|
107
|
+
}, V = {
|
|
108
108
|
brandColors: {
|
|
109
109
|
primary: "#ED1C24",
|
|
110
110
|
primaryHover: "#C61018",
|
|
@@ -135,7 +135,7 @@ const H = {
|
|
|
135
135
|
headerBackground: "#ED1C24",
|
|
136
136
|
sidebarBackground: "#FF7F00",
|
|
137
137
|
navigationBackground: "#FFF4E6"
|
|
138
|
-
},
|
|
138
|
+
}, L = {
|
|
139
139
|
brandColors: {
|
|
140
140
|
primary: "#0F62FE",
|
|
141
141
|
primaryHover: "#0043CE",
|
|
@@ -166,12 +166,12 @@ const H = {
|
|
|
166
166
|
headerBackground: "#0F62FE",
|
|
167
167
|
sidebarBackground: "#1192E8",
|
|
168
168
|
navigationBackground: "#F4F7FF"
|
|
169
|
-
},
|
|
169
|
+
}, y = [
|
|
170
170
|
{
|
|
171
171
|
id: "carbon-default",
|
|
172
172
|
name: "carbon-default",
|
|
173
173
|
displayName: "ISI",
|
|
174
|
-
tokens:
|
|
174
|
+
tokens: B,
|
|
175
175
|
supportedVariants: ["white", "g10", "g90", "g100"],
|
|
176
176
|
defaultVariant: "g10"
|
|
177
177
|
},
|
|
@@ -179,7 +179,7 @@ const H = {
|
|
|
179
179
|
id: "ihsan",
|
|
180
180
|
name: "ihsan",
|
|
181
181
|
displayName: "ISI",
|
|
182
|
-
tokens:
|
|
182
|
+
tokens: L,
|
|
183
183
|
supportedVariants: ["white", "g10", "g90", "g100"],
|
|
184
184
|
defaultVariant: "g10"
|
|
185
185
|
},
|
|
@@ -187,7 +187,7 @@ const H = {
|
|
|
187
187
|
id: "bca-syariah",
|
|
188
188
|
name: "bca-syariah",
|
|
189
189
|
displayName: "BCAS",
|
|
190
|
-
tokens:
|
|
190
|
+
tokens: D,
|
|
191
191
|
supportedVariants: ["white", "g10", "g90", "g100"],
|
|
192
192
|
defaultVariant: "g10"
|
|
193
193
|
},
|
|
@@ -195,7 +195,7 @@ const H = {
|
|
|
195
195
|
id: "bjb-syariah",
|
|
196
196
|
name: "bjb-syariah",
|
|
197
197
|
displayName: "BJBS",
|
|
198
|
-
tokens:
|
|
198
|
+
tokens: T,
|
|
199
199
|
supportedVariants: ["white", "g10", "g90", "g100"],
|
|
200
200
|
defaultVariant: "g90"
|
|
201
201
|
},
|
|
@@ -203,7 +203,7 @@ const H = {
|
|
|
203
203
|
id: "pos-indonesia",
|
|
204
204
|
name: "pos-indonesia",
|
|
205
205
|
displayName: "PosInd",
|
|
206
|
-
tokens:
|
|
206
|
+
tokens: V,
|
|
207
207
|
supportedVariants: ["white", "g10", "g90", "g100"],
|
|
208
208
|
defaultVariant: "g10"
|
|
209
209
|
}
|
|
@@ -229,138 +229,202 @@ const H = {
|
|
|
229
229
|
markAllRead: "Tandai Semua Dibaca",
|
|
230
230
|
noNotifications: "Tidak ada notifikasi",
|
|
231
231
|
apps: "Aplikasi",
|
|
232
|
-
required: "Wajib diisi"
|
|
233
|
-
|
|
234
|
-
|
|
232
|
+
required: "Wajib diisi",
|
|
233
|
+
profile: "Profil Saya",
|
|
234
|
+
changePassword: "Ganti Password",
|
|
235
|
+
logout: "Keluar",
|
|
236
|
+
searchMenuPlaceholder: "Cari menu...",
|
|
237
|
+
searchMenuAriaLabel: "Cari menu navigasi",
|
|
238
|
+
clearSearchAriaLabel: "Hapus pencarian",
|
|
239
|
+
removeFavoriteAriaLabel: "Hapus favorit",
|
|
240
|
+
addFavoriteAriaLabel: "Tandai favorit",
|
|
241
|
+
profileButtonAriaLabel: "Profil pengguna",
|
|
242
|
+
notificationsButtonAriaLabel: "Notifikasi",
|
|
243
|
+
notificationsUnreadSuffix: "belum dibaca",
|
|
244
|
+
branchLabel: "Cabang",
|
|
245
|
+
viewAll: "Lihat semua"
|
|
246
|
+
}, E = F(b);
|
|
247
|
+
function x({
|
|
235
248
|
labels: e,
|
|
236
|
-
children:
|
|
249
|
+
children: a
|
|
237
250
|
}) {
|
|
238
251
|
const t = e ? { ...b, ...e } : b;
|
|
239
|
-
return /* @__PURE__ */ n(
|
|
252
|
+
return /* @__PURE__ */ n(E.Provider, { value: t, children: a });
|
|
240
253
|
}
|
|
241
|
-
function
|
|
242
|
-
return
|
|
254
|
+
function G() {
|
|
255
|
+
return h(E);
|
|
243
256
|
}
|
|
244
|
-
const
|
|
245
|
-
function
|
|
246
|
-
const
|
|
247
|
-
return e ?
|
|
257
|
+
const p = F(null);
|
|
258
|
+
function P(e) {
|
|
259
|
+
const a = y.find((t) => t.id === "carbon-default") ?? y.find((t) => t.id === "ihsan") ?? y[0];
|
|
260
|
+
return e ? y.find((t) => t.id === e) ?? a : a;
|
|
248
261
|
}
|
|
249
|
-
function
|
|
250
|
-
const
|
|
251
|
-
|
|
262
|
+
function N({ corporateId: e, variant: a, children: t }) {
|
|
263
|
+
const r = k(() => P(e), [e]), [d, v] = A(
|
|
264
|
+
a ?? r.defaultVariant
|
|
252
265
|
);
|
|
253
266
|
C(() => {
|
|
254
|
-
|
|
255
|
-
}, [
|
|
267
|
+
a && r.supportedVariants.includes(a) && v(a);
|
|
268
|
+
}, [a, r]), C(() => {
|
|
256
269
|
if (typeof document > "u") return;
|
|
257
|
-
const
|
|
258
|
-
|
|
270
|
+
const m = document.documentElement, o = document.body;
|
|
271
|
+
y.flatMap(
|
|
259
272
|
(s) => s.supportedVariants.map((g) => `platform-theme-${s.id}-${g}`)
|
|
260
273
|
).forEach((s) => {
|
|
261
|
-
|
|
274
|
+
m.classList.remove(s), o.classList.remove(s);
|
|
262
275
|
});
|
|
263
|
-
const i = `platform-theme-${
|
|
264
|
-
return
|
|
265
|
-
|
|
276
|
+
const i = `platform-theme-${r.id}-${d}`;
|
|
277
|
+
return m.classList.add(i), o.classList.add(i), () => {
|
|
278
|
+
m.classList.remove(i), o.classList.remove(i);
|
|
266
279
|
};
|
|
267
|
-
}, [
|
|
268
|
-
const
|
|
269
|
-
theme:
|
|
280
|
+
}, [r, d]);
|
|
281
|
+
const u = {
|
|
282
|
+
theme: r,
|
|
270
283
|
variant: d,
|
|
271
|
-
corporateId:
|
|
284
|
+
corporateId: r.id,
|
|
272
285
|
setVariant: v
|
|
273
286
|
};
|
|
274
|
-
return /* @__PURE__ */ n(
|
|
287
|
+
return /* @__PURE__ */ n(p.Provider, { value: u, children: t });
|
|
275
288
|
}
|
|
276
|
-
function
|
|
277
|
-
const e =
|
|
289
|
+
function l() {
|
|
290
|
+
const e = h(p);
|
|
278
291
|
if (!e)
|
|
279
292
|
throw new Error("useTheme must be used inside ThemeProvider");
|
|
280
293
|
return e;
|
|
281
294
|
}
|
|
282
|
-
function
|
|
283
|
-
return /* @__PURE__ */ n(
|
|
295
|
+
function w({ corporateId: e, variant: a, children: t }) {
|
|
296
|
+
return /* @__PURE__ */ n(N, { corporateId: e, variant: a, children: t });
|
|
284
297
|
}
|
|
285
|
-
function
|
|
298
|
+
function z({
|
|
286
299
|
as: e,
|
|
287
|
-
className:
|
|
300
|
+
className: a,
|
|
288
301
|
corporateId: t,
|
|
289
|
-
variant:
|
|
302
|
+
variant: r,
|
|
290
303
|
children: d,
|
|
291
304
|
...v
|
|
292
305
|
}) {
|
|
293
|
-
const
|
|
294
|
-
() => t ?
|
|
295
|
-
[t,
|
|
296
|
-
), [
|
|
297
|
-
|
|
306
|
+
const u = l(), m = e ?? "div", o = k(
|
|
307
|
+
() => t ? P(t) : u.theme,
|
|
308
|
+
[t, u.theme]
|
|
309
|
+
), [f, i] = A(
|
|
310
|
+
r ?? u.variant ?? o.defaultVariant
|
|
298
311
|
);
|
|
299
312
|
C(() => {
|
|
300
|
-
|
|
301
|
-
}, [
|
|
313
|
+
r && o.supportedVariants.includes(r) ? i(r) : r || i(o.defaultVariant);
|
|
314
|
+
}, [r, o]);
|
|
302
315
|
const s = {
|
|
303
316
|
theme: o,
|
|
304
|
-
variant:
|
|
317
|
+
variant: f,
|
|
305
318
|
corporateId: o.id,
|
|
306
319
|
setVariant: i
|
|
307
|
-
}, g = [
|
|
308
|
-
return /* @__PURE__ */ n(
|
|
320
|
+
}, g = [a, `platform-theme-${o.id}-${f}`].filter(Boolean).join(" ");
|
|
321
|
+
return /* @__PURE__ */ n(p.Provider, { value: s, children: /* @__PURE__ */ n(m, { className: g, ...v, children: d }) });
|
|
309
322
|
}
|
|
310
|
-
function
|
|
311
|
-
return /* @__PURE__ */ n(
|
|
323
|
+
function K({ corporateId: e, variant: a, labels: t, children: r }) {
|
|
324
|
+
return /* @__PURE__ */ n(x, { labels: t, children: /* @__PURE__ */ n(w, { corporateId: e, variant: a, children: r }) });
|
|
312
325
|
}
|
|
313
326
|
const I = ["white", "g10", "g90", "g100"];
|
|
314
|
-
function
|
|
315
|
-
const { variant: e, setVariant:
|
|
316
|
-
return /* @__PURE__ */
|
|
327
|
+
function q() {
|
|
328
|
+
const { variant: e, setVariant: a, theme: t } = l();
|
|
329
|
+
return /* @__PURE__ */ S("div", { style: { display: "inline-flex", gap: "0.5rem", alignItems: "center" }, children: [
|
|
317
330
|
/* @__PURE__ */ n("span", { style: { fontSize: "0.85rem" }, children: t.displayName }),
|
|
318
331
|
/* @__PURE__ */ n(
|
|
319
332
|
"select",
|
|
320
333
|
{
|
|
321
334
|
value: e,
|
|
322
|
-
onChange: (
|
|
323
|
-
children: I.map((
|
|
335
|
+
onChange: (r) => a(r.target.value),
|
|
336
|
+
children: I.map((r) => /* @__PURE__ */ n("option", { value: r, children: r.toUpperCase() }, r))
|
|
324
337
|
}
|
|
325
338
|
)
|
|
326
339
|
] });
|
|
327
340
|
}
|
|
328
|
-
function
|
|
329
|
-
const { theme: e } =
|
|
341
|
+
function U() {
|
|
342
|
+
const { theme: e } = l();
|
|
330
343
|
return e.tokens;
|
|
331
344
|
}
|
|
332
|
-
function
|
|
333
|
-
return
|
|
345
|
+
function O() {
|
|
346
|
+
return U().brandColors;
|
|
334
347
|
}
|
|
335
|
-
function
|
|
336
|
-
const { variant: e, setVariant:
|
|
337
|
-
return { variant: e, setVariant:
|
|
348
|
+
function W() {
|
|
349
|
+
const { variant: e, setVariant: a } = l();
|
|
350
|
+
return { variant: e, setVariant: a };
|
|
338
351
|
}
|
|
339
|
-
function
|
|
340
|
-
const { theme: e } =
|
|
352
|
+
function J() {
|
|
353
|
+
const { theme: e } = l();
|
|
341
354
|
return {
|
|
342
355
|
logo: e.tokens.logoUrl,
|
|
343
356
|
brandColors: e.tokens.brandColors
|
|
344
357
|
};
|
|
345
358
|
}
|
|
346
|
-
function
|
|
347
|
-
const { theme: e } =
|
|
348
|
-
return e.tokens.density
|
|
359
|
+
function Q() {
|
|
360
|
+
const { theme: e } = l();
|
|
361
|
+
return e.tokens.density === "normal" ? "normal" : "compact";
|
|
362
|
+
}
|
|
363
|
+
const j = {
|
|
364
|
+
labelSpacing: "6px",
|
|
365
|
+
labelFontSize: "12px",
|
|
366
|
+
labelFontWeight: 500,
|
|
367
|
+
labelLineHeight: "16px",
|
|
368
|
+
inputFontSize: "14px",
|
|
369
|
+
inputFontWeight: 400,
|
|
370
|
+
inputLineHeight: "20px",
|
|
371
|
+
controlHeight: "40px",
|
|
372
|
+
textareaMinHeight: "88px",
|
|
373
|
+
rowGap: "16px",
|
|
374
|
+
sectionGap: "24px",
|
|
375
|
+
columnGap: "16px",
|
|
376
|
+
readonlyBackground: "#f4f4f4",
|
|
377
|
+
readonlyCursor: "default"
|
|
378
|
+
}, c = {
|
|
379
|
+
scope: "ui7-form-contract",
|
|
380
|
+
densityCompact: "ui7-form-contract--density-compact",
|
|
381
|
+
densityComfortable: "ui7-form-contract--density-comfortable",
|
|
382
|
+
readonly: "ui7-form-contract--readonly",
|
|
383
|
+
row: "ui7-form-row",
|
|
384
|
+
section: "ui7-form-section",
|
|
385
|
+
column: "ui7-form-column",
|
|
386
|
+
label: "ui7-form-label",
|
|
387
|
+
labelRequired: "ui7-form-label__required",
|
|
388
|
+
control: "ui7-form-control",
|
|
389
|
+
controlReadonly: "ui7-form-control--readonly",
|
|
390
|
+
helper: "ui7-form-helper",
|
|
391
|
+
readonlyValue: "ui7-form-readonly-value"
|
|
392
|
+
};
|
|
393
|
+
function H(e, a = "compact") {
|
|
394
|
+
return e === "compact" ? "compact" : e === "comfortable" || e === "normal" ? "comfortable" : a;
|
|
395
|
+
}
|
|
396
|
+
function M(e, a = "compact") {
|
|
397
|
+
return H(e, a) === "compact" ? c.densityCompact : c.densityComfortable;
|
|
398
|
+
}
|
|
399
|
+
function R(e) {
|
|
400
|
+
const a = [c.scope];
|
|
401
|
+
return (e == null ? void 0 : e.density) !== void 0 && a.push(M(e.density)), e != null && e.readonly && a.push(c.readonly), e != null && e.className && a.push(e.className), a.join(" ");
|
|
402
|
+
}
|
|
403
|
+
function X() {
|
|
404
|
+
const { theme: e } = l(), a = H(e.tokens.density ?? "compact"), t = a === "compact" ? c.densityCompact : c.densityComfortable;
|
|
405
|
+
return {
|
|
406
|
+
density: a,
|
|
407
|
+
densityClassName: t,
|
|
408
|
+
scopeClassName: R({ density: a }),
|
|
409
|
+
classNames: c,
|
|
410
|
+
tokens: j
|
|
411
|
+
};
|
|
349
412
|
}
|
|
350
413
|
export {
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
414
|
+
z as CorporateTheme,
|
|
415
|
+
K as GlobalCorporateTheme,
|
|
416
|
+
x as LabelsProvider,
|
|
417
|
+
N as ThemeContextProvider,
|
|
418
|
+
w as ThemeProvider,
|
|
419
|
+
q as ThemeSwitcher,
|
|
420
|
+
y as corporateThemes,
|
|
358
421
|
b as defaultLabels,
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
422
|
+
O as useBrandColors,
|
|
423
|
+
J as useCorporateFeatures,
|
|
424
|
+
Q as useDensity,
|
|
425
|
+
X as useFormVisualContract,
|
|
426
|
+
G as useLabels,
|
|
427
|
+
l as useTheme,
|
|
428
|
+
U as useThemeTokens,
|
|
429
|
+
W as useThemeVariant
|
|
366
430
|
};
|
package/dist/labels.d.ts
CHANGED
|
@@ -21,5 +21,18 @@ export interface Ui7Labels {
|
|
|
21
21
|
noNotifications: string;
|
|
22
22
|
apps: string;
|
|
23
23
|
required: string;
|
|
24
|
+
profile: string;
|
|
25
|
+
changePassword: string;
|
|
26
|
+
logout: string;
|
|
27
|
+
searchMenuPlaceholder: string;
|
|
28
|
+
searchMenuAriaLabel: string;
|
|
29
|
+
clearSearchAriaLabel: string;
|
|
30
|
+
removeFavoriteAriaLabel: string;
|
|
31
|
+
addFavoriteAriaLabel: string;
|
|
32
|
+
profileButtonAriaLabel: string;
|
|
33
|
+
notificationsButtonAriaLabel: string;
|
|
34
|
+
notificationsUnreadSuffix: string;
|
|
35
|
+
branchLabel: string;
|
|
36
|
+
viewAll: string;
|
|
24
37
|
}
|
|
25
38
|
export declare const defaultLabels: Ui7Labels;
|