@dbcdk/react-components 0.0.194 → 0.0.196
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/README.md +78 -10
- package/dist/client.cjs +486 -614
- package/dist/client.d.ts +176 -102
- package/dist/client.js +102 -102
- package/dist/components/color-scheme-button/ColorSchemeButton.cjs +7 -4
- package/dist/components/color-scheme-button/ColorSchemeButton.d.ts +7 -3
- package/dist/components/color-scheme-button/ColorSchemeButton.js +7 -4
- package/dist/components/forms/text-area/Textarea.cjs +2 -1
- package/dist/components/forms/text-area/Textarea.d.ts +1 -0
- package/dist/components/forms/text-area/Textarea.js +2 -1
- package/dist/components/highlighted-text/HighlightedText.cjs +6 -3
- package/dist/components/highlighted-text/HighlightedText.js +7 -4
- package/dist/components/json-viewer/JsonNode.cjs +27 -67
- package/dist/components/json-viewer/JsonNode.d.ts +10 -0
- package/dist/components/json-viewer/JsonNode.js +28 -68
- package/dist/components/json-viewer/JsonRow.cjs +85 -0
- package/dist/components/json-viewer/JsonRow.d.ts +5 -0
- package/dist/components/json-viewer/JsonRow.js +79 -0
- package/dist/components/json-viewer/JsonViewer.cjs +36 -256
- package/dist/components/json-viewer/JsonViewer.js +37 -253
- package/dist/components/json-viewer/JsonViewerShell.cjs +208 -0
- package/dist/components/json-viewer/JsonViewerShell.d.ts +25 -0
- package/dist/components/json-viewer/JsonViewerShell.js +202 -0
- package/dist/components/json-viewer/TanstackJsonViewer.cjs +127 -0
- package/dist/components/json-viewer/TanstackJsonViewer.d.ts +17 -0
- package/dist/components/json-viewer/TanstackJsonViewer.js +121 -0
- package/dist/components/json-viewer/types.d.ts +27 -0
- package/dist/components/json-viewer/useJsonViewerState.cjs +111 -0
- package/dist/components/json-viewer/useJsonViewerState.d.ts +42 -0
- package/dist/components/json-viewer/useJsonViewerState.js +108 -0
- package/dist/components/json-viewer/utils.cjs +36 -0
- package/dist/components/json-viewer/utils.d.ts +21 -1
- package/dist/components/json-viewer/utils.js +35 -1
- package/dist/components/lightbox/Lightbox.cjs +2 -2
- package/dist/components/lightbox/Lightbox.d.ts +1 -1
- package/dist/components/lightbox/Lightbox.js +1 -1
- package/dist/components/line-viewer/LineViewer.cjs +2 -3
- package/dist/components/line-viewer/LineViewer.js +2 -3
- package/dist/components/line-viewer/tokenizeLineFormat.cjs +37 -17
- package/dist/components/line-viewer/tokenizeLineFormat.d.ts +5 -4
- package/dist/components/line-viewer/tokenizeLineFormat.js +37 -17
- package/dist/components/menu/Menu.cjs +3 -23
- package/dist/components/menu/Menu.js +3 -23
- package/dist/components/menu/Menu.module.css +4 -3
- package/dist/components/metric-tile/MetricTile.cjs +3 -2
- package/dist/components/metric-tile/MetricTile.js +2 -1
- package/dist/components/overlay/tooltip/Tooltip.cjs +7 -2
- package/dist/components/overlay/tooltip/Tooltip.d.ts +7 -1
- package/dist/components/overlay/tooltip/Tooltip.js +7 -2
- package/dist/components/overlay/tooltip/useTooltipTrigger.cjs +7 -1
- package/dist/components/overlay/tooltip/useTooltipTrigger.js +7 -1
- package/dist/components/page-layout/PageLayout.module.css +1 -1
- package/dist/components/table/Table.cjs +45 -16
- package/dist/components/table/Table.d.ts +1 -1
- package/dist/components/table/Table.js +47 -18
- package/dist/components/table/Table.module.css +135 -7
- package/dist/components/table/Table.types.d.ts +47 -1
- package/dist/components/table/TanstackTable.cjs +30 -2
- package/dist/components/table/TanstackTable.js +31 -3
- package/dist/components/table/components/TableBody.d.ts +1 -2
- package/dist/components/table/components/TableHeader.cjs +6 -4
- package/dist/components/table/components/TableHeader.d.ts +2 -1
- package/dist/components/table/components/TableHeader.js +6 -4
- package/dist/components/table/components/TableHeaderCell.cjs +5 -4
- package/dist/components/table/components/TableHeaderCell.d.ts +3 -1
- package/dist/components/table/components/TableHeaderCell.js +5 -4
- package/dist/components/table/components/TableRow.cjs +1 -1
- package/dist/components/table/components/TableRow.d.ts +1 -2
- package/dist/components/table/components/TableRow.js +1 -1
- package/dist/components/table/components/TableSkeletonBody.cjs +30 -0
- package/dist/components/table/components/TableSkeletonBody.d.ts +13 -0
- package/dist/components/table/components/TableSkeletonBody.js +24 -0
- package/dist/components/table/components/table-settings/TableHeaderSettings.cjs +28 -0
- package/dist/components/table/components/table-settings/TableHeaderSettings.d.ts +11 -0
- package/dist/components/table/components/table-settings/TableHeaderSettings.js +26 -0
- package/dist/components/table/components/table-settings/TableSettings.cjs +82 -32
- package/dist/components/table/components/table-settings/TableSettings.d.ts +14 -6
- package/dist/components/table/components/table-settings/TableSettings.js +84 -34
- package/dist/components/table/table.utils.cjs +2 -0
- package/dist/components/table/table.utils.d.ts +6 -0
- package/dist/components/table/table.utils.js +2 -1
- package/dist/components/table/tableSettings.utils.cjs +29 -0
- package/dist/components/table/tableSettings.utils.d.ts +9 -0
- package/dist/components/table/tableSettings.utils.js +24 -0
- package/dist/components/table/tanstackTable.utils.cjs +18 -0
- package/dist/components/table/tanstackTable.utils.js +19 -1
- package/dist/components/theme-button/ThemeButton.cjs +9 -4
- package/dist/components/theme-button/ThemeButton.d.ts +4 -2
- package/dist/components/theme-button/ThemeButton.js +9 -4
- package/dist/components/theme-script/ThemeScript.cjs +10 -4
- package/dist/components/theme-script/ThemeScript.d.ts +9 -1
- package/dist/components/theme-script/ThemeScript.js +10 -4
- package/dist/components/xml-viewer/XmlViewer.cjs +2 -3
- package/dist/components/xml-viewer/XmlViewer.js +2 -3
- package/dist/hooks/useColorScheme.cjs +18 -14
- package/dist/hooks/useColorScheme.d.ts +11 -1
- package/dist/hooks/useColorScheme.js +19 -15
- package/dist/hooks/useGetActiveTheme.cjs +4 -3
- package/dist/hooks/useGetActiveTheme.d.ts +7 -1
- package/dist/hooks/useGetActiveTheme.js +4 -3
- package/dist/hooks/useTableData.cjs +11 -7
- package/dist/hooks/useTableData.d.ts +8 -2
- package/dist/hooks/useTableData.js +11 -7
- package/dist/hooks/useTableSettings.cjs +25 -9
- package/dist/hooks/useTableSettings.d.ts +9 -6
- package/dist/hooks/useTableSettings.js +25 -9
- package/dist/hooks/useTheme.d.ts +6 -0
- package/dist/styles/styles.css +7 -3
- package/dist/styles/themes/dbc/colors.css +1 -1
- package/dist/styles.css +1 -476
- package/dist/tanstack-virtual.cjs +12 -0
- package/dist/tanstack-virtual.d.ts +1 -0
- package/dist/tanstack-virtual.js +1 -0
- package/package.json +13 -1
package/README.md
CHANGED
|
@@ -39,7 +39,7 @@ npm install @dbcdk/react-components
|
|
|
39
39
|
> **Important:** The component library requires global styles to be imported once in your application.
|
|
40
40
|
|
|
41
41
|
```ts
|
|
42
|
-
import '@dbcdk/react-components/
|
|
42
|
+
import '@dbcdk/react-components/themes/dbc.css'
|
|
43
43
|
```
|
|
44
44
|
|
|
45
45
|
---
|
|
@@ -55,14 +55,18 @@ paint, so the app avoids a flash of the wrong theme on first load.
|
|
|
55
55
|
import { ReactNode } from 'react'
|
|
56
56
|
|
|
57
57
|
import { ThemeScript } from '@dbcdk/react-components'
|
|
58
|
-
import '@dbcdk/react-components/
|
|
58
|
+
import { TooltipProvider } from '@dbcdk/react-components/client'
|
|
59
59
|
import '@dbcdk/react-components/themes/dbc.css'
|
|
60
60
|
|
|
61
61
|
export default function RootLayout({ children }: Readonly<{ children: ReactNode }>) {
|
|
62
62
|
return (
|
|
63
|
-
<html lang="da">
|
|
64
|
-
<head
|
|
65
|
-
|
|
63
|
+
<html lang="da" suppressHydrationWarning>
|
|
64
|
+
<head>
|
|
65
|
+
<ThemeScript defaultTheme="dbc" />
|
|
66
|
+
</head>
|
|
67
|
+
<body>
|
|
68
|
+
<TooltipProvider>{children}</TooltipProvider>
|
|
69
|
+
</body>
|
|
66
70
|
</html>
|
|
67
71
|
)
|
|
68
72
|
}
|
|
@@ -77,7 +81,7 @@ Example using `useTheme()` when you want to control the theme:
|
|
|
77
81
|
```tsx
|
|
78
82
|
'use client'
|
|
79
83
|
|
|
80
|
-
import { AppHeader, Button, useTheme } from '@dbcdk/react-components'
|
|
84
|
+
import { AppHeader, Button, useTheme } from '@dbcdk/react-components/client'
|
|
81
85
|
import { Moon, Sun } from 'lucide-react'
|
|
82
86
|
|
|
83
87
|
export default function Header() {
|
|
@@ -114,13 +118,77 @@ export function ThemeBadge() {
|
|
|
114
118
|
}
|
|
115
119
|
```
|
|
116
120
|
|
|
117
|
-
`useGetActiveTheme()` is intentionally read-only
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
+
`useGetActiveTheme()` is intentionally read-only. It reports the current
|
|
122
|
+
active theme state as established by `ThemeScript`, persisted storage, or
|
|
123
|
+
another mounted theme control. `themeKey` is only set when both `theme` and
|
|
124
|
+
`colorScheme` are resolved, and is otherwise `null`. If your app passes a
|
|
125
|
+
custom `storageKey`/`colorSchemeStorageKey` (see below), pass the same values
|
|
126
|
+
here so it reads the right persisted state.
|
|
121
127
|
|
|
122
128
|
---
|
|
123
129
|
|
|
130
|
+
### 5) Running multiple apps on the same origin
|
|
131
|
+
|
|
132
|
+
`useTheme`, `useColorScheme`, `useGetActiveTheme`, `ThemeScript`,
|
|
133
|
+
`ThemeButton`/`ThemeMenuSection`, and `ColorSchemeButton`/`ColorSchemeMenuSection`
|
|
134
|
+
all persist to a cookie + `localStorage` under a shared default key. If two
|
|
135
|
+
different apps built on this library run on the same origin (e.g. two
|
|
136
|
+
products under one domain), they'll read and overwrite each other's theme
|
|
137
|
+
selection by default.
|
|
138
|
+
|
|
139
|
+
To keep them independent, give each app its own key via `storageKey` (product
|
|
140
|
+
theme) and/or `colorSchemeStorageKey` (color scheme, `ThemeScript` only —
|
|
141
|
+
elsewhere it's the `storageKey` option passed to `useColorScheme`):
|
|
142
|
+
|
|
143
|
+
```tsx
|
|
144
|
+
<ThemeScript
|
|
145
|
+
defaultTheme="dbc"
|
|
146
|
+
storageKey="my-app-theme"
|
|
147
|
+
colorSchemeStorageKey="my-app-color-scheme"
|
|
148
|
+
/>
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
```tsx
|
|
152
|
+
const { theme, switchTheme } = useTheme({ defaultTheme: 'dbc', storageKey: 'my-app-theme' })
|
|
153
|
+
const { colorScheme, switchColorScheme } = useColorScheme('system', {
|
|
154
|
+
storageKey: 'my-app-color-scheme',
|
|
155
|
+
})
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
Use the same keys everywhere in a given app (`ThemeScript`, the hooks, and
|
|
159
|
+
any switcher components), or the values will resolve inconsistently.
|
|
160
|
+
|
|
161
|
+
---
|
|
162
|
+
|
|
163
|
+
## Package integration
|
|
164
|
+
|
|
165
|
+
### Optional table integration
|
|
166
|
+
|
|
167
|
+
`Table` and `useTableData` are available from `@dbcdk/react-components/client`
|
|
168
|
+
without TanStack. Pass the same `ColumnItem<T>[]` to the table and the hook's
|
|
169
|
+
`sorting.columns`; the hook uses each column's `accessor` and optional
|
|
170
|
+
`sortFunction`. Use the column `id` as `sortBy`.
|
|
171
|
+
|
|
172
|
+
Existing accessor-shaped columns (`accessorKey` / `accessorFn`), including typed
|
|
173
|
+
TanStack columns, also work with the hook without introducing a TanStack dependency
|
|
174
|
+
into core declarations. Explicit `columnComparators` override column-derived sorting.
|
|
175
|
+
|
|
176
|
+
`useTableSettings`, `TableSettings`, and `TableSettingsMenuSection` are also
|
|
177
|
+
available from `/client`, together with their types and
|
|
178
|
+
`localStorageTableSettingsStorage`. They accept the normal Table's columns and
|
|
179
|
+
honor `hidden` and `canHide`. Existing TanStack columns with `accessorKey`,
|
|
180
|
+
`meta.hidden`, and `enableHiding` remain compatible.
|
|
181
|
+
|
|
182
|
+
Install `@tanstack/react-table` for `TanstackTable` from `/tanstack`. Existing
|
|
183
|
+
settings exports from `/tanstack` remain available as compatibility aliases.
|
|
184
|
+
|
|
185
|
+
### Next.js configuration
|
|
186
|
+
|
|
187
|
+
Add `transpilePackages: ['@dbcdk/react-components']` to your Next.js configuration
|
|
188
|
+
so it processes the library's CSS Modules. Import interactive components and
|
|
189
|
+
providers from `/client`. The packed-package integration check covers Next.js
|
|
190
|
+
16.2.6 with webpack and React 19.2.4.
|
|
191
|
+
|
|
124
192
|
## Using Storybook
|
|
125
193
|
|
|
126
194
|
Storybook is the primary documentation and exploration tool for this library.
|