@dbcdk/react-components 0.0.174 → 0.0.176

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 (40) hide show
  1. package/README.md +17 -18
  2. package/dist/components/filter-field/FilterField.module.css +2 -2
  3. package/dist/components/forms/file-upload/FileUpload.module.css +3 -3
  4. package/dist/components/forms/form-select/FormSelect.module.css +1 -1
  5. package/dist/components/forms/input/Input.module.css +8 -8
  6. package/dist/components/forms/text-area/Textarea.module.css +2 -1
  7. package/dist/components/nav-bar/NavBar.module.css +1 -1
  8. package/dist/components/theme-button/ThemeButton.cjs +4 -15
  9. package/dist/components/theme-button/ThemeButton.d.ts +3 -4
  10. package/dist/components/theme-button/ThemeButton.js +4 -15
  11. package/dist/components/theme-script/ThemeScript.cjs +23 -16
  12. package/dist/components/theme-script/ThemeScript.d.ts +2 -6
  13. package/dist/components/theme-script/ThemeScript.js +24 -17
  14. package/dist/hooks/usePersistentState.cjs +6 -1
  15. package/dist/hooks/usePersistentState.d.ts +1 -1
  16. package/dist/hooks/usePersistentState.js +6 -1
  17. package/dist/hooks/useTheme.cjs +33 -96
  18. package/dist/hooks/useTheme.d.ts +3 -10
  19. package/dist/hooks/useTheme.js +34 -97
  20. package/dist/styles/themes/apply-product-theme.cjs +20 -0
  21. package/dist/styles/themes/apply-product-theme.d.ts +3 -0
  22. package/dist/styles/themes/apply-product-theme.js +18 -0
  23. package/dist/styles/themes/dbc/colors.css +2 -1
  24. package/dist/styles/themes/product-theme-tokens.cjs +39 -0
  25. package/dist/styles/themes/product-theme-tokens.d.ts +3 -0
  26. package/dist/styles/themes/product-theme-tokens.js +37 -0
  27. package/dist/styles/themes/product-themes.cjs +143 -0
  28. package/dist/styles/themes/product-themes.d.ts +11 -0
  29. package/dist/styles/themes/product-themes.js +140 -0
  30. package/dist/styles/themes/types.cjs +3 -2
  31. package/dist/styles/themes/types.d.ts +1 -13
  32. package/dist/styles/themes/types.js +3 -2
  33. package/dist/utils/sessionStorage.utils.cjs +53 -0
  34. package/dist/utils/sessionStorage.utils.d.ts +19 -0
  35. package/dist/utils/sessionStorage.utils.js +49 -0
  36. package/package.json +1 -1
  37. package/dist/styles/themes/filmstriben/theme.css +0 -55
  38. package/dist/themes/filmstriben.css +0 -4
  39. package/dist/types/assets.d.cjs +0 -2
  40. package/dist/types/assets.d.js +0 -1
@@ -1,7 +1,8 @@
1
- const THEME_IDS = ["dbc", "filmstriben"];
1
+ const THEME_IDS = ["dbc", "filmstriben", "valentines"];
2
2
  const THEME_LABELS = {
3
3
  dbc: "DBC",
4
- filmstriben: "Filmstriben"
4
+ filmstriben: "Filmstriben",
5
+ valentines: "Valentines"
5
6
  };
6
7
 
7
8
  export { THEME_IDS, THEME_LABELS };
@@ -0,0 +1,53 @@
1
+ 'use strict';
2
+
3
+ function isBrowser() {
4
+ return typeof window !== "undefined" && typeof window.sessionStorage !== "undefined";
5
+ }
6
+ function readSessionStorage(key) {
7
+ if (!isBrowser()) return void 0;
8
+ try {
9
+ const raw = window.sessionStorage.getItem(key);
10
+ if (raw == null) return void 0;
11
+ try {
12
+ const parsed = JSON.parse(raw);
13
+ if (typeof parsed === "string") {
14
+ try {
15
+ return JSON.parse(parsed);
16
+ } catch {
17
+ return parsed;
18
+ }
19
+ }
20
+ return parsed;
21
+ } catch {
22
+ return raw;
23
+ }
24
+ } catch {
25
+ return void 0;
26
+ }
27
+ }
28
+ function writeSessionStorage(key, value) {
29
+ if (!isBrowser()) return;
30
+ try {
31
+ if (value === void 0) {
32
+ window.sessionStorage.removeItem(key);
33
+ return;
34
+ }
35
+ if (typeof value === "string") {
36
+ window.sessionStorage.setItem(key, value);
37
+ } else {
38
+ window.sessionStorage.setItem(key, JSON.stringify(value));
39
+ }
40
+ } catch {
41
+ }
42
+ }
43
+ function removeSessionStorage(key) {
44
+ if (!isBrowser()) return;
45
+ try {
46
+ window.sessionStorage.removeItem(key);
47
+ } catch {
48
+ }
49
+ }
50
+
51
+ exports.readSessionStorage = readSessionStorage;
52
+ exports.removeSessionStorage = removeSessionStorage;
53
+ exports.writeSessionStorage = writeSessionStorage;
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Safely read from sessionStorage.
3
+ * - Returns undefined if not in browser
4
+ * - Returns parsed JSON if value is JSON
5
+ * - Returns plain string if not JSON
6
+ * - Never throws
7
+ */
8
+ export declare function readSessionStorage<T = unknown>(key: string): T | string | undefined;
9
+ /**
10
+ * Safely write to sessionStorage.
11
+ * - Automatically JSON.stringifies objects/arrays
12
+ * - Stores plain strings as-is
13
+ * - Never throws
14
+ */
15
+ export declare function writeSessionStorage(key: string, value: unknown): void;
16
+ /**
17
+ * Remove key safely
18
+ */
19
+ export declare function removeSessionStorage(key: string): void;
@@ -0,0 +1,49 @@
1
+ function isBrowser() {
2
+ return typeof window !== "undefined" && typeof window.sessionStorage !== "undefined";
3
+ }
4
+ function readSessionStorage(key) {
5
+ if (!isBrowser()) return void 0;
6
+ try {
7
+ const raw = window.sessionStorage.getItem(key);
8
+ if (raw == null) return void 0;
9
+ try {
10
+ const parsed = JSON.parse(raw);
11
+ if (typeof parsed === "string") {
12
+ try {
13
+ return JSON.parse(parsed);
14
+ } catch {
15
+ return parsed;
16
+ }
17
+ }
18
+ return parsed;
19
+ } catch {
20
+ return raw;
21
+ }
22
+ } catch {
23
+ return void 0;
24
+ }
25
+ }
26
+ function writeSessionStorage(key, value) {
27
+ if (!isBrowser()) return;
28
+ try {
29
+ if (value === void 0) {
30
+ window.sessionStorage.removeItem(key);
31
+ return;
32
+ }
33
+ if (typeof value === "string") {
34
+ window.sessionStorage.setItem(key, value);
35
+ } else {
36
+ window.sessionStorage.setItem(key, JSON.stringify(value));
37
+ }
38
+ } catch {
39
+ }
40
+ }
41
+ function removeSessionStorage(key) {
42
+ if (!isBrowser()) return;
43
+ try {
44
+ window.sessionStorage.removeItem(key);
45
+ } catch {
46
+ }
47
+ }
48
+
49
+ export { readSessionStorage, removeSessionStorage, writeSessionStorage };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dbcdk/react-components",
3
- "version": "0.0.174",
3
+ "version": "0.0.176",
4
4
  "description": "Reusable React components for DBC projects",
5
5
  "license": "ISC",
6
6
  "author": "",
@@ -1,55 +0,0 @@
1
- /* Filmstriben theme entrypoint.
2
- *
3
- * Usage in the consuming app:
4
- * - Simplest: import the convenience bundle instead of this file directly —
5
- * @import '@dbcdk/react-components/themes/filmstriben.css';
6
- * (bundles dbc/base.css + dbc/colors.css + this file + the shared index.css)
7
- * - Or, for runtime theme switching (see useTheme/ThemeScript), import
8
- * dbc's base + colors as your permanent foundation, then load this
9
- * file — just the delta below — only when this theme is actually active:
10
- * @import '@dbcdk/react-components/styles/themes/dbc/base.css';
11
- * @import '@dbcdk/react-components/styles/themes/dbc/colors.css';
12
- * @import '@dbcdk/react-components/styles/themes/filmstriben/theme.css';
13
- *
14
- * This file deliberately does NOT import dbc/colors.css itself (unlike a
15
- * typical single-theme entrypoint) and scopes every override behind
16
- * [data-product-theme='filmstriben'] instead of a bare :root — both are what
17
- * let it be safely loaded *alongside* dbc's palette and toggled at runtime by
18
- * flipping that attribute, without re-declaring or clobbering the whole dbc
19
- * palette a second time.
20
- *
21
- * Only overrides the navbar/header identity (fixed dark bar + logo lockup).
22
- * General-purpose brand tokens (--color-brand and everything derived from it
23
- * — buttons, links, tabs, chips, alerts, focus rings, charts) are
24
- * deliberately left on the shared DBC blue: #ffc107 doesn't have a value
25
- * that works well both as flat text/borders on white AND as a vivid identity
26
- * color (see TASK_filmstriben_theme.md for the contrast math and the
27
- * earlier, abandoned attempt at a mixed "text-safe gold"). Scoping the
28
- * yellow to the navbar/logo — where it always sits on its own guaranteed
29
- * background — sidesteps that tradeoff entirely instead of picking a
30
- * compromise shade.
31
- */
32
-
33
- :root[data-product-theme='filmstriben'] {
34
- --filmstriben-yellow: #ffc107;
35
- --filmstriben-black: #212529;
36
-
37
- /* Navbar — fixed dark bar regardless of light/dark color-scheme */
38
- --color-navbar-bg: var(--filmstriben-black);
39
- --color-navbar-fg: #ffffff;
40
- --color-navbar-fg-muted: rgba(255, 255, 255, 0.9);
41
- /* Softer than full navbar-fg at rest — header components escalate to full
42
- strength on hover/focus (see Button/Input/FormSelect's .header variant) */
43
- --color-navbar-border: color-mix(in srgb, var(--color-navbar-fg) 25%, transparent);
44
- /* Active nav-link accent — the raw vivid yellow is safe here specifically
45
- because it always sits on this fixed dark bar, unlike --color-brand
46
- (which follows light-dark() for the page's own background) */
47
- --color-navbar-brand: var(--filmstriben-yellow);
48
-
49
- /* Logo lockup — sits on the light page surface (via --color-logo-bg's
50
- tint) or the dark navbar, never as flat text on a plain white bg, so
51
- the raw vivid yellow is safe here unlike a general --color-brand value */
52
- --color-logo: var(--filmstriben-yellow);
53
- --color-logo-bg: color-mix(in srgb, var(--color-logo) 10%, var(--color-bg-surface));
54
- --color-logo-fg: var(--filmstriben-black);
55
- }
@@ -1,4 +0,0 @@
1
- @import '../styles/themes/dbc/base.css';
2
- @import '../styles/themes/dbc/colors.css';
3
- @import '../styles/themes/filmstriben/theme.css';
4
- @import '../index.css';
@@ -1,2 +0,0 @@
1
- 'use strict';
2
-
@@ -1 +0,0 @@
1
-