@dbcdk/react-components 0.0.9 → 0.0.12

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 (113) hide show
  1. package/dist/components/accordion/Accordion.d.ts +27 -0
  2. package/dist/components/accordion/Accordion.js +66 -0
  3. package/dist/components/accordion/Accordion.module.css +87 -0
  4. package/dist/components/button/Button.module.css +1 -0
  5. package/dist/components/card/Card.d.ts +21 -3
  6. package/dist/components/card/Card.js +17 -2
  7. package/dist/components/card/Card.module.css +59 -0
  8. package/dist/components/circle/Circle.d.ts +5 -1
  9. package/dist/components/circle/Circle.js +2 -2
  10. package/dist/components/circle/Circle.module.css +60 -4
  11. package/dist/components/code-block/CodeBlock.js +1 -1
  12. package/dist/components/code-block/CodeBlock.module.css +30 -17
  13. package/dist/components/copy-button/CopyButton.d.ts +1 -0
  14. package/dist/components/copy-button/CopyButton.js +10 -2
  15. package/dist/components/datetime-picker/DateTimePicker.d.ts +4 -8
  16. package/dist/components/datetime-picker/DateTimePicker.js +72 -92
  17. package/dist/components/datetime-picker/dateTimeHelpers.d.ts +14 -12
  18. package/dist/components/datetime-picker/dateTimeHelpers.js +25 -45
  19. package/dist/components/filter-field/FilterField.js +16 -11
  20. package/dist/components/filter-field/FilterField.module.css +133 -12
  21. package/dist/components/forms/checkbox/Checkbox.d.ts +4 -10
  22. package/dist/components/forms/checkbox/Checkbox.js +3 -5
  23. package/dist/components/forms/checkbox-group/CheckboxGroup.js +1 -1
  24. package/dist/components/forms/checkbox-group/CheckboxGroup.module.css +1 -1
  25. package/dist/components/forms/input/Input.d.ts +1 -0
  26. package/dist/components/forms/input/Input.js +2 -4
  27. package/dist/components/forms/input/Input.module.css +10 -11
  28. package/dist/components/forms/input-container/InputContainer.d.ts +2 -1
  29. package/dist/components/forms/input-container/InputContainer.js +3 -3
  30. package/dist/components/forms/input-container/InputContainer.module.css +65 -0
  31. package/dist/components/forms/radio-buttons/RadioButton.d.ts +36 -0
  32. package/dist/components/forms/radio-buttons/RadioButton.js +26 -0
  33. package/dist/components/forms/radio-buttons/RadioButtonGroup.d.ts +25 -0
  34. package/dist/components/forms/radio-buttons/RadioButtonGroup.js +19 -0
  35. package/dist/components/forms/radio-buttons/RadioButtons.module.css +117 -0
  36. package/dist/components/forms/select/Select.d.ts +1 -1
  37. package/dist/components/forms/select/Select.js +3 -3
  38. package/dist/components/forms/text-area/Textarea.js +3 -3
  39. package/dist/components/forms/text-area/Textarea.module.css +8 -1
  40. package/dist/components/headline/Headline.d.ts +2 -7
  41. package/dist/components/headline/Headline.js +5 -2
  42. package/dist/components/headline/Headline.module.css +61 -2
  43. package/dist/components/hyperlink/Hyperlink.d.ts +19 -6
  44. package/dist/components/hyperlink/Hyperlink.js +35 -7
  45. package/dist/components/hyperlink/Hyperlink.module.css +50 -2
  46. package/dist/components/icon/Icon.module.css +1 -0
  47. package/dist/components/interval-select/IntervalSelect.js +1 -1
  48. package/dist/components/menu/Menu.d.ts +32 -0
  49. package/dist/components/menu/Menu.js +73 -13
  50. package/dist/components/menu/Menu.module.css +72 -4
  51. package/dist/components/nav-bar/NavBar.d.ts +24 -6
  52. package/dist/components/overlay/modal/Modal.module.css +2 -2
  53. package/dist/components/overlay/side-panel/SidePanel.d.ts +12 -4
  54. package/dist/components/overlay/side-panel/SidePanel.js +77 -4
  55. package/dist/components/overlay/side-panel/SidePanel.module.css +149 -28
  56. package/dist/components/overlay/side-panel/useSidePanel.d.ts +1 -1
  57. package/dist/components/overlay/side-panel/useSidePanel.js +2 -2
  58. package/dist/components/overlay/tooltip/useTooltipTrigger.js +4 -2
  59. package/dist/components/page-layout/PageLayout.js +0 -2
  60. package/dist/components/popover/Popover.js +1 -1
  61. package/dist/components/sidebar/components/expandable-sidebar-item/ExpandableSidebarItem.d.ts +5 -5
  62. package/dist/components/sidebar/components/expandable-sidebar-item/ExpandableSidebarItem.js +36 -24
  63. package/dist/components/sidebar/components/expandable-sidebar-item/ExpandableSidebarItem.module.css +0 -3
  64. package/dist/components/sidebar/components/sidebar-container/SidebarContainer.d.ts +3 -1
  65. package/dist/components/sidebar/components/sidebar-container/SidebarContainer.js +4 -3
  66. package/dist/components/sidebar/components/sidebar-container/SidebarContainer.module.css +109 -79
  67. package/dist/components/sidebar/components/sidebar-items/SidebarItems.js +16 -3
  68. package/dist/components/sidebar/components/sidebar-items/SidebarItems.module.css +20 -0
  69. package/dist/components/sidebar/providers/SidebarProvider.d.ts +4 -1
  70. package/dist/components/sidebar/providers/SidebarProvider.js +85 -58
  71. package/dist/components/skeleton-loader/SkeletonLoader.d.ts +1 -1
  72. package/dist/components/skeleton-loader/SkeletonLoader.js +15 -12
  73. package/dist/components/split-button/SplitButton.d.ts +1 -1
  74. package/dist/components/split-button/SplitButton.js +3 -1
  75. package/dist/components/split-button/SplitButton.module.css +4 -4
  76. package/dist/components/state-page/StatePage.d.ts +9 -0
  77. package/dist/components/state-page/StatePage.js +20 -0
  78. package/dist/components/state-page/StatePage.module.css +9 -0
  79. package/dist/components/state-page/empty.d.ts +2 -0
  80. package/dist/components/state-page/empty.js +2 -0
  81. package/dist/components/state-page/error.d.ts +2 -0
  82. package/dist/components/state-page/error.js +2 -0
  83. package/dist/components/state-page/notFound.d.ts +2 -0
  84. package/dist/components/state-page/notFound.js +2 -0
  85. package/dist/components/sticky-footer-layout/StickyFooterLayout.d.ts +19 -0
  86. package/dist/components/sticky-footer-layout/StickyFooterLayout.js +27 -0
  87. package/dist/components/table/Table.d.ts +9 -4
  88. package/dist/components/table/Table.js +6 -9
  89. package/dist/components/table/Table.module.css +180 -59
  90. package/dist/components/table/components/empty-state/EmptyState.d.ts +1 -1
  91. package/dist/components/table/components/empty-state/EmptyState.js +6 -7
  92. package/dist/components/table/components/table-settings/TableSettings.d.ts +13 -3
  93. package/dist/components/table/components/table-settings/TableSettings.js +55 -4
  94. package/dist/components/table/tanstack.d.ts +12 -1
  95. package/dist/components/table/tanstack.js +75 -23
  96. package/dist/components/toast/Toast.js +5 -1
  97. package/dist/components/toast/Toast.module.css +40 -15
  98. package/dist/components/toast/provider/ToastProvider.js +1 -0
  99. package/dist/hooks/useTableSettings.d.ts +23 -4
  100. package/dist/hooks/useTableSettings.js +64 -17
  101. package/dist/hooks/useTimeDuration.js +9 -3
  102. package/dist/hooks/useViewportFill.js +1 -0
  103. package/dist/index.d.ts +6 -0
  104. package/dist/index.js +6 -1
  105. package/dist/src/styles/styles.css +60 -25
  106. package/dist/styles/animation.d.ts +5 -0
  107. package/dist/styles/animation.js +5 -0
  108. package/dist/styles/styles.css +60 -25
  109. package/dist/styles/themes/dbc/dark.css +1 -1
  110. package/dist/styles/themes/dbc/light.css +2 -1
  111. package/dist/utils/localStorage.utils.d.ts +19 -0
  112. package/dist/utils/localStorage.utils.js +78 -0
  113. package/package.json +1 -1
@@ -30,6 +30,8 @@ body {
30
30
  color: var(--color-fg-default);
31
31
  background-color: var(--color-bg-page);
32
32
  --density: var(--density-comfortable);
33
+ font-size: var(--font-size-sm);
34
+ margin: 0;
33
35
  }
34
36
 
35
37
  h1 {
@@ -45,7 +47,7 @@ h3 {
45
47
  }
46
48
 
47
49
  h4 {
48
- font-size: var(--font-size-md);
50
+ font-size: var(--font-size-sm);
49
51
  font-weight: var(--font-weight-medium);
50
52
  }
51
53
 
@@ -53,46 +55,79 @@ body.dbc-app {
53
55
  max-width: 1600px;
54
56
  }
55
57
 
58
+ .dbc-font-mono {
59
+ font-family: monospace;
60
+ }
61
+
56
62
  .dbc-table {
57
63
  --card-label-width: 260px;
64
+
58
65
  border-collapse: collapse;
59
66
  font-size: var(--font-size-sm);
60
67
  line-height: var(--line-height-normal);
61
- tr + tr th,
62
- tr + tr td {
63
- padding-block: var(--spacing-xxs);
64
- }
68
+ }
65
69
 
66
- th {
67
- white-space: nowrap;
68
- color: var(--color-fg-subtle);
69
- font-weight: var(--font-weight-default);
70
- padding-right: var(--spacing-lg);
71
- vertical-align: top;
72
- text-align: left;
73
- }
70
+ .dbc-table tr + tr th,
71
+ .dbc-table tr + tr td {
72
+ padding-block: var(--spacing-xxs);
73
+ }
74
74
 
75
- td {
76
- color: var(--color-fg-default);
77
- vertical-align: top;
78
- min-width: 0;
79
- }
75
+ /* LABELS (th) → match .metaLabel */
76
+ .dbc-table th {
77
+ white-space: nowrap;
78
+ text-align: left;
79
+ vertical-align: top;
80
+ max-width: var(--card-label-width);
81
+ overflow: hidden;
82
+ text-overflow: ellipsis;
83
+ font-size: var(--font-size-xs);
84
+ color: var(--color-fg-subtle);
85
+ letter-spacing: var(--letter-spacing-wide);
86
+ text-transform: uppercase;
87
+ font-weight: var(--font-weight-default);
88
+ padding-right: var(--spacing-lg);
89
+ }
80
90
 
81
- th {
82
- max-width: var(--card-label-width);
83
- overflow: hidden;
84
- text-overflow: ellipsis;
85
- }
91
+ /* VALUES (td) → match .metaValue */
92
+ .dbc-table td {
93
+ vertical-align: top;
94
+ min-width: 0;
95
+
96
+ margin: 0; /* harmless on td, keeps parity with metaValue */
97
+ font-size: var(--font-size-sm);
98
+ color: var(--color-fg-default);
99
+ font-weight: var(--font-weight-medium);
100
+
101
+ word-break: break-word;
102
+ }
103
+
104
+ /* Optional: baseline alignment closer to metaRow */
105
+ .dbc-table th,
106
+ .dbc-table td {
107
+ vertical-align: baseline;
108
+ }
109
+
110
+ .dbc-full-width {
111
+ width: 100%;
112
+ }
113
+
114
+ .dbc-highlight {
115
+ background-color: var(--color-status-warning-bg);
116
+ }
117
+
118
+ .dbc-muted-text {
119
+ color: var(--color-fg-subtle);
86
120
  }
87
121
 
88
122
  .dbc-table--bordered {
89
123
  width: auto;
90
- border: 1px solid var(--color-border-default);
124
+ border: var(--border-width-thin) solid var(--color-border-default);
125
+ border-collapse: collapse;
91
126
  }
92
127
 
93
128
  .dbc-table--bordered th,
94
129
  .dbc-table--bordered td {
95
- border: 1px solid var(--color-border-default);
130
+ border: var(--border-width-thin) solid var(--color-border-default);
96
131
  padding: var(--spacing-xs) var(--spacing-sm);
97
132
  }
98
133
 
@@ -215,7 +215,7 @@ html[data-theme='dark'] {
215
215
  --component-size-md: 36px;
216
216
  --component-size-lg: 44px;
217
217
  --component-size-xl: 435px;
218
- --sidebar-width: 200px;
218
+ --sidebar-width: 180px;
219
219
 
220
220
  /* Control paddings */
221
221
  --control-padding-x: 12px;
@@ -202,12 +202,13 @@ html[data-theme='light'] {
202
202
  --icon-size-md: 20px;
203
203
  --icon-size-lg: 24px;
204
204
 
205
+ --component-size-xxs: 12px;
205
206
  --component-size-xs: 20px;
206
207
  --component-size-sm: 30px;
207
208
  --component-size-md: 36px;
208
209
  --component-size-lg: 44px;
209
210
  --component-size-xl: 435px;
210
- --sidebar-width: 200px;
211
+ --sidebar-width: 180px;
211
212
 
212
213
  /* Control paddings */
213
214
  --control-padding-x: 12px;
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Safely read from localStorage.
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 readLocalStorage<T = unknown>(key: string): T | string | undefined;
9
+ /**
10
+ * Safely write to localStorage.
11
+ * - Automatically JSON.stringifies objects/arrays
12
+ * - Stores plain strings as-is
13
+ * - Never throws
14
+ */
15
+ export declare function writeLocalStorage(key: string, value: unknown): void;
16
+ /**
17
+ * Remove key safely
18
+ */
19
+ export declare function removeLocalStorage(key: string): void;
@@ -0,0 +1,78 @@
1
+ function isBrowser() {
2
+ return typeof window !== 'undefined' && typeof window.localStorage !== 'undefined';
3
+ }
4
+ /**
5
+ * Safely read from localStorage.
6
+ * - Returns undefined if not in browser
7
+ * - Returns parsed JSON if value is JSON
8
+ * - Returns plain string if not JSON
9
+ * - Never throws
10
+ */
11
+ export function readLocalStorage(key) {
12
+ if (!isBrowser())
13
+ return undefined;
14
+ try {
15
+ const raw = window.localStorage.getItem(key);
16
+ if (raw == null)
17
+ return undefined;
18
+ // Try parse once
19
+ try {
20
+ const parsed = JSON.parse(raw);
21
+ // Handle double-stringified JSON
22
+ if (typeof parsed === 'string') {
23
+ try {
24
+ return JSON.parse(parsed);
25
+ }
26
+ catch {
27
+ return parsed;
28
+ }
29
+ }
30
+ return parsed;
31
+ }
32
+ catch {
33
+ // Not JSON — return as plain string
34
+ return raw;
35
+ }
36
+ }
37
+ catch {
38
+ return undefined;
39
+ }
40
+ }
41
+ /**
42
+ * Safely write to localStorage.
43
+ * - Automatically JSON.stringifies objects/arrays
44
+ * - Stores plain strings as-is
45
+ * - Never throws
46
+ */
47
+ export function writeLocalStorage(key, value) {
48
+ if (!isBrowser())
49
+ return;
50
+ try {
51
+ if (value === undefined) {
52
+ window.localStorage.removeItem(key);
53
+ return;
54
+ }
55
+ if (typeof value === 'string') {
56
+ window.localStorage.setItem(key, value);
57
+ }
58
+ else {
59
+ window.localStorage.setItem(key, JSON.stringify(value));
60
+ }
61
+ }
62
+ catch {
63
+ // ignore quota errors etc.
64
+ }
65
+ }
66
+ /**
67
+ * Remove key safely
68
+ */
69
+ export function removeLocalStorage(key) {
70
+ if (!isBrowser())
71
+ return;
72
+ try {
73
+ window.localStorage.removeItem(key);
74
+ }
75
+ catch {
76
+ // ignore
77
+ }
78
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dbcdk/react-components",
3
- "version": "0.0.9",
3
+ "version": "0.0.12",
4
4
  "description": "Reusable React components for DBC projects",
5
5
  "license": "ISC",
6
6
  "author": "",