@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/index.js CHANGED
@@ -1,6 +1,6 @@
1
- import { jsx as i, jsxs as k } from "react/jsx-runtime";
2
- import { useMemo as h, useState as b, useEffect as g, createContext as f, useContext as A } from "react";
3
- const E = {
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
- }, H = {
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
- }, B = {
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
- }, P = {
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
- }, D = {
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
- }, m = [
169
+ }, y = [
170
170
  {
171
171
  id: "carbon-default",
172
172
  name: "carbon-default",
173
173
  displayName: "ISI",
174
- tokens: E,
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: D,
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: H,
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: B,
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: P,
206
+ tokens: V,
207
207
  supportedVariants: ["white", "g10", "g90", "g100"],
208
208
  defaultVariant: "g10"
209
209
  }
210
- ], F = f(null);
211
- function p(e) {
212
- const t = m.find((a) => a.id === "carbon-default") ?? m.find((a) => a.id === "ihsan") ?? m[0];
213
- return e ? m.find((a) => a.id === e) ?? t : t;
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 S({ corporateId: e, variant: t, children: a }) {
216
- const r = h(() => p(e), [e]), [d, v] = b(
217
- t ?? r.defaultVariant
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
- g(() => {
220
- t && r.supportedVariants.includes(t) && v(t);
221
- }, [t, r]), g(() => {
266
+ C(() => {
267
+ a && r.supportedVariants.includes(a) && v(a);
268
+ }, [a, r]), C(() => {
222
269
  if (typeof document > "u") return;
223
- const u = document.documentElement, o = document.body;
224
- m.flatMap(
225
- (s) => s.supportedVariants.map((C) => `platform-theme-${s.id}-${C}`)
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
- u.classList.remove(s), o.classList.remove(s);
274
+ m.classList.remove(s), o.classList.remove(s);
228
275
  });
229
- const n = `platform-theme-${r.id}-${d}`;
230
- return u.classList.add(n), o.classList.add(n), () => {
231
- u.classList.remove(n), o.classList.remove(n);
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 l = {
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__ */ i(F.Provider, { value: l, children: a });
287
+ return /* @__PURE__ */ n(p.Provider, { value: u, children: t });
241
288
  }
242
- function c() {
243
- const e = A(F);
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 V({ corporateId: e, variant: t, children: a }) {
249
- return /* @__PURE__ */ i(S, { corporateId: e, variant: t, children: a });
295
+ function w({ corporateId: e, variant: a, children: t }) {
296
+ return /* @__PURE__ */ n(N, { corporateId: e, variant: a, children: t });
250
297
  }
251
- function j({
298
+ function z({
252
299
  as: e,
253
- className: t,
254
- corporateId: a,
300
+ className: a,
301
+ corporateId: t,
255
302
  variant: r,
256
303
  children: d,
257
304
  ...v
258
305
  }) {
259
- const l = c(), u = e ?? "div", o = h(
260
- () => a ? p(a) : l.theme,
261
- [a, l.theme]
262
- ), [y, n] = b(
263
- r ?? l.variant ?? o.defaultVariant
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
- g(() => {
266
- r && o.supportedVariants.includes(r) ? n(r) : r || n(o.defaultVariant);
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: y,
317
+ variant: f,
271
318
  corporateId: o.id,
272
- setVariant: n
273
- }, C = [t, `platform-theme-${o.id}-${y}`].filter(Boolean).join(" ");
274
- return /* @__PURE__ */ i(F.Provider, { value: s, children: /* @__PURE__ */ i(u, { className: C, ...v, children: d }) });
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 N({ corporateId: e, variant: t, children: a }) {
277
- return /* @__PURE__ */ i(V, { corporateId: e, variant: t, children: a });
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 T = ["white", "g10", "g90", "g100"];
280
- function U() {
281
- const { variant: e, setVariant: t, theme: a } = c();
282
- return /* @__PURE__ */ k("div", { style: { display: "inline-flex", gap: "0.5rem", alignItems: "center" }, children: [
283
- /* @__PURE__ */ i("span", { style: { fontSize: "0.85rem" }, children: a.displayName }),
284
- /* @__PURE__ */ i(
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) => t(r.target.value),
289
- children: T.map((r) => /* @__PURE__ */ i("option", { value: r, children: r.toUpperCase() }, r))
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 I() {
295
- const { theme: e } = c();
341
+ function U() {
342
+ const { theme: e } = l();
296
343
  return e.tokens;
297
344
  }
298
- function L() {
299
- return I().brandColors;
345
+ function O() {
346
+ return U().brandColors;
300
347
  }
301
- function $() {
302
- const { variant: e, setVariant: t } = c();
303
- return { variant: e, setVariant: t };
348
+ function W() {
349
+ const { variant: e, setVariant: a } = l();
350
+ return { variant: e, setVariant: a };
304
351
  }
305
- function M() {
306
- const { theme: e } = c();
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 z() {
313
- const { theme: e } = c();
314
- return e.tokens.density ?? "compact";
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
- j as CorporateTheme,
318
- N as GlobalCorporateTheme,
319
- S as ThemeContextProvider,
320
- V as ThemeProvider,
321
- U as ThemeSwitcher,
322
- m as corporateThemes,
323
- L as useBrandColors,
324
- M as useCorporateFeatures,
325
- z as useDensity,
326
- c as useTheme,
327
- I as useThemeTokens,
328
- $ as useThemeVariant
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
  };
@@ -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;