@isi-ui7/corporate-themes 0.2.0 → 0.2.2
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/LabelsContext.d.ts +8 -0
- package/dist/components/CorporateTheme.d.ts +3 -1
- 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 +4 -0
- package/dist/index.js +185 -84
- package/dist/labels.d.ts +38 -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
|
|
2
|
-
import {
|
|
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 E = {
|
|
|
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 E = {
|
|
|
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 E = {
|
|
|
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 E = {
|
|
|
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 E = {
|
|
|
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 E = {
|
|
|
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 E = {
|
|
|
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 E = {
|
|
|
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,127 +203,228 @@ const E = {
|
|
|
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
|
}
|
|
210
|
-
],
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
210
|
+
], b = {
|
|
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 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({
|
|
248
|
+
labels: e,
|
|
249
|
+
children: a
|
|
250
|
+
}) {
|
|
251
|
+
const t = e ? { ...b, ...e } : b;
|
|
252
|
+
return /* @__PURE__ */ n(E.Provider, { value: t, children: a });
|
|
253
|
+
}
|
|
254
|
+
function G() {
|
|
255
|
+
return h(E);
|
|
256
|
+
}
|
|
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;
|
|
214
261
|
}
|
|
215
|
-
function
|
|
216
|
-
const r =
|
|
217
|
-
|
|
262
|
+
function N({ corporateId: e, variant: a, children: t }) {
|
|
263
|
+
const r = k(() => P(e), [e]), [d, v] = A(
|
|
264
|
+
a ?? r.defaultVariant
|
|
218
265
|
);
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
}, [
|
|
266
|
+
C(() => {
|
|
267
|
+
a && r.supportedVariants.includes(a) && v(a);
|
|
268
|
+
}, [a, r]), C(() => {
|
|
222
269
|
if (typeof document > "u") return;
|
|
223
|
-
const
|
|
224
|
-
|
|
225
|
-
(s) => s.supportedVariants.map((
|
|
270
|
+
const m = document.documentElement, o = document.body;
|
|
271
|
+
y.flatMap(
|
|
272
|
+
(s) => s.supportedVariants.map((g) => `platform-theme-${s.id}-${g}`)
|
|
226
273
|
).forEach((s) => {
|
|
227
|
-
|
|
274
|
+
m.classList.remove(s), o.classList.remove(s);
|
|
228
275
|
});
|
|
229
|
-
const
|
|
230
|
-
return
|
|
231
|
-
|
|
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);
|
|
232
279
|
};
|
|
233
280
|
}, [r, d]);
|
|
234
|
-
const
|
|
281
|
+
const u = {
|
|
235
282
|
theme: r,
|
|
236
283
|
variant: d,
|
|
237
284
|
corporateId: r.id,
|
|
238
285
|
setVariant: v
|
|
239
286
|
};
|
|
240
|
-
return /* @__PURE__ */
|
|
287
|
+
return /* @__PURE__ */ n(p.Provider, { value: u, children: t });
|
|
241
288
|
}
|
|
242
|
-
function
|
|
243
|
-
const e =
|
|
289
|
+
function l() {
|
|
290
|
+
const e = h(p);
|
|
244
291
|
if (!e)
|
|
245
292
|
throw new Error("useTheme must be used inside ThemeProvider");
|
|
246
293
|
return e;
|
|
247
294
|
}
|
|
248
|
-
function
|
|
249
|
-
return /* @__PURE__ */
|
|
295
|
+
function w({ corporateId: e, variant: a, children: t }) {
|
|
296
|
+
return /* @__PURE__ */ n(N, { corporateId: e, variant: a, children: t });
|
|
250
297
|
}
|
|
251
|
-
function
|
|
298
|
+
function z({
|
|
252
299
|
as: e,
|
|
253
|
-
className:
|
|
254
|
-
corporateId:
|
|
300
|
+
className: a,
|
|
301
|
+
corporateId: t,
|
|
255
302
|
variant: r,
|
|
256
303
|
children: d,
|
|
257
304
|
...v
|
|
258
305
|
}) {
|
|
259
|
-
const
|
|
260
|
-
() =>
|
|
261
|
-
[
|
|
262
|
-
), [
|
|
263
|
-
r ??
|
|
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
|
|
264
311
|
);
|
|
265
|
-
|
|
266
|
-
r && o.supportedVariants.includes(r) ?
|
|
312
|
+
C(() => {
|
|
313
|
+
r && o.supportedVariants.includes(r) ? i(r) : r || i(o.defaultVariant);
|
|
267
314
|
}, [r, o]);
|
|
268
315
|
const s = {
|
|
269
316
|
theme: o,
|
|
270
|
-
variant:
|
|
317
|
+
variant: f,
|
|
271
318
|
corporateId: o.id,
|
|
272
|
-
setVariant:
|
|
273
|
-
},
|
|
274
|
-
return /* @__PURE__ */
|
|
319
|
+
setVariant: i
|
|
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 }) });
|
|
275
322
|
}
|
|
276
|
-
function
|
|
277
|
-
return /* @__PURE__ */
|
|
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 }) });
|
|
278
325
|
}
|
|
279
|
-
const
|
|
280
|
-
function
|
|
281
|
-
const { variant: e, setVariant:
|
|
282
|
-
return /* @__PURE__ */
|
|
283
|
-
/* @__PURE__ */
|
|
284
|
-
/* @__PURE__ */
|
|
326
|
+
const I = ["white", "g10", "g90", "g100"];
|
|
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: [
|
|
330
|
+
/* @__PURE__ */ n("span", { style: { fontSize: "0.85rem" }, children: t.displayName }),
|
|
331
|
+
/* @__PURE__ */ n(
|
|
285
332
|
"select",
|
|
286
333
|
{
|
|
287
334
|
value: e,
|
|
288
|
-
onChange: (r) =>
|
|
289
|
-
children:
|
|
335
|
+
onChange: (r) => a(r.target.value),
|
|
336
|
+
children: I.map((r) => /* @__PURE__ */ n("option", { value: r, children: r.toUpperCase() }, r))
|
|
290
337
|
}
|
|
291
338
|
)
|
|
292
339
|
] });
|
|
293
340
|
}
|
|
294
|
-
function
|
|
295
|
-
const { theme: e } =
|
|
341
|
+
function U() {
|
|
342
|
+
const { theme: e } = l();
|
|
296
343
|
return e.tokens;
|
|
297
344
|
}
|
|
298
|
-
function
|
|
299
|
-
return
|
|
345
|
+
function O() {
|
|
346
|
+
return U().brandColors;
|
|
300
347
|
}
|
|
301
|
-
function
|
|
302
|
-
const { variant: e, setVariant:
|
|
303
|
-
return { variant: e, setVariant:
|
|
348
|
+
function W() {
|
|
349
|
+
const { variant: e, setVariant: a } = l();
|
|
350
|
+
return { variant: e, setVariant: a };
|
|
304
351
|
}
|
|
305
|
-
function
|
|
306
|
-
const { theme: e } =
|
|
352
|
+
function J() {
|
|
353
|
+
const { theme: e } = l();
|
|
307
354
|
return {
|
|
308
355
|
logo: e.tokens.logoUrl,
|
|
309
356
|
brandColors: e.tokens.brandColors
|
|
310
357
|
};
|
|
311
358
|
}
|
|
312
|
-
function
|
|
313
|
-
const { theme: e } =
|
|
314
|
-
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
|
+
};
|
|
315
412
|
}
|
|
316
413
|
export {
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
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,
|
|
421
|
+
b as defaultLabels,
|
|
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
|
|
329
430
|
};
|
package/dist/labels.d.ts
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
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
|
+
clearSearchAriaLabel: string;
|
|
30
|
+
removeFavoriteAriaLabel: string;
|
|
31
|
+
addFavoriteAriaLabel: string;
|
|
32
|
+
profileButtonAriaLabel: string;
|
|
33
|
+
notificationsButtonAriaLabel: string;
|
|
34
|
+
notificationsUnreadSuffix: string;
|
|
35
|
+
branchLabel: string;
|
|
36
|
+
viewAll: string;
|
|
37
|
+
}
|
|
38
|
+
export declare const defaultLabels: Ui7Labels;
|