@dbcdk/react-components 0.0.157 → 0.0.159
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/components/accordion/components/AccordionRow.cjs +1 -1
- package/dist/components/accordion/components/AccordionRow.js +1 -1
- package/dist/components/breadcrumbs/Breadcrumbs.module.css +3 -6
- package/dist/components/button/Button.module.css +1 -1
- package/dist/components/forms/input/Input.module.css +12 -0
- package/dist/components/forms/radio-buttons/RadioButtons.module.css +10 -3
- package/dist/components/headline/CollapsibleHeadline.cjs +1 -0
- package/dist/components/headline/CollapsibleHeadline.js +1 -0
- package/dist/components/headline/Headline.module.css +2 -26
- package/dist/components/icon/Icon.cjs +16 -5
- package/dist/components/icon/Icon.d.ts +3 -1
- package/dist/components/icon/Icon.js +17 -6
- package/dist/components/icon/Icon.module.css +1 -1
- package/dist/components/menu/Menu.module.css +12 -0
- package/dist/components/nav-bar/NavBar.cjs +4 -1
- package/dist/components/nav-bar/NavBar.js +4 -1
- package/dist/components/nav-bar/NavBar.module.css +18 -0
- package/dist/components/sidebar/Sidebar.cjs +2 -0
- package/dist/components/sidebar/Sidebar.d.ts +1 -1
- package/dist/components/sidebar/Sidebar.js +2 -0
- package/dist/components/sidebar/components/sidebar-container/SidebarContainer.cjs +6 -1
- package/dist/components/sidebar/components/sidebar-container/SidebarContainer.d.ts +1 -1
- package/dist/components/sidebar/components/sidebar-container/SidebarContainer.js +6 -1
- package/dist/components/sidebar/components/sidebar-container/SidebarContainer.module.css +30 -2
- package/dist/components/table/Table.cjs +17 -3
- package/dist/components/table/Table.d.ts +1 -1
- package/dist/components/table/Table.js +18 -4
- package/dist/components/table/Table.module.css +57 -50
- package/dist/components/table/Table.types.d.ts +1 -1
- package/dist/components/table/components/TableBody.cjs +9 -5
- package/dist/components/table/components/TableBody.d.ts +4 -2
- package/dist/components/table/components/TableBody.js +9 -5
- package/dist/components/table/components/TableHeaderCell.cjs +3 -4
- package/dist/components/table/components/TableHeaderCell.js +4 -5
- package/dist/components/table/components/TableRow.cjs +39 -18
- package/dist/components/table/components/TableRow.d.ts +4 -1
- package/dist/components/table/components/TableRow.js +40 -19
- package/dist/components/table/components/table-settings/TableSettings.cjs +1 -1
- package/dist/components/table/components/table-settings/TableSettings.js +2 -2
- package/dist/components/table/table.utils.cjs +2 -0
- package/dist/components/table/table.utils.d.ts +1 -0
- package/dist/components/table/table.utils.js +2 -1
- package/dist/components/tabs/Tabs.module.css +1 -1
- package/dist/styles/styles.css +37 -61
- package/dist/styles/themes/dbc/colors.css +8 -3
- package/dist/styles/themes/filmstriben-budget/theme.css +22 -0
- package/dist/styles.css +37 -61
- package/dist/themes/filmstriben-budget.css +3 -0
- package/dist/utils/date/formatDate.cjs +15 -1
- package/dist/utils/date/formatDate.d.ts +9 -1
- package/dist/utils/date/formatDate.js +15 -1
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
-
import { MoreVertical } from 'lucide-react';
|
|
2
|
+
import { MoreVertical, ChevronsUpDown } from 'lucide-react';
|
|
3
3
|
import { useRef } from 'react';
|
|
4
4
|
import { Checkbox } from '../../../components/forms/checkbox/Checkbox';
|
|
5
5
|
import { RadioButton } from '../../../components/forms/radio-buttons/RadioButton';
|
|
@@ -24,14 +24,19 @@ function TableRow({
|
|
|
24
24
|
getRowSeverity,
|
|
25
25
|
getContextMenuItems,
|
|
26
26
|
showContextMenuOnHover,
|
|
27
|
+
expandableRows,
|
|
28
|
+
expandedRows,
|
|
27
29
|
onRowClick,
|
|
28
30
|
onRowMouseEnter,
|
|
29
|
-
onRowSelect
|
|
31
|
+
onRowSelect,
|
|
32
|
+
onToggleRowExpand
|
|
30
33
|
}) {
|
|
31
|
-
var _a;
|
|
34
|
+
var _a, _b;
|
|
32
35
|
const isSelected = (_a = selectedRows == null ? void 0 : selectedRows.has(rowId)) != null ? _a : false;
|
|
36
|
+
const isExpanded = (_b = expandedRows == null ? void 0 : expandedRows.has(rowId)) != null ? _b : false;
|
|
33
37
|
const rowSeverity = getRowSeverity == null ? void 0 : getRowSeverity(row);
|
|
34
38
|
const canSelect = Boolean(selectedRows && onRowSelect);
|
|
39
|
+
const canExpand = Boolean(expandableRows && onToggleRowExpand);
|
|
35
40
|
const contextMenuItems = getContextMenuItems == null ? void 0 : getContextMenuItems({
|
|
36
41
|
row,
|
|
37
42
|
rowId,
|
|
@@ -122,32 +127,32 @@ function TableRow({
|
|
|
122
127
|
)
|
|
123
128
|
}
|
|
124
129
|
) }) : null,
|
|
125
|
-
columns.map((column) => {
|
|
126
|
-
var _a2,
|
|
127
|
-
const allowWrap = shouldAllowWrap(column.allowWrap, isSelected, viewMode);
|
|
130
|
+
columns.map((column, index) => {
|
|
131
|
+
var _a2, _b2, _c, _d;
|
|
132
|
+
const allowWrap = shouldAllowWrap(column.allowWrap, isSelected || isExpanded, viewMode);
|
|
128
133
|
const allowOverflow = column.allowOverflow;
|
|
129
134
|
const cellValue = getCellDisplayValue(row, column);
|
|
130
|
-
const
|
|
135
|
+
const showRowActions = index === columns.length - 1 && hasContextMenu;
|
|
131
136
|
return /* @__PURE__ */ jsx(
|
|
132
137
|
"td",
|
|
133
138
|
{
|
|
134
139
|
className: cx(
|
|
135
140
|
styles.cell,
|
|
141
|
+
showRowActions && styles.actionCell,
|
|
136
142
|
allowOverflow && styles.allowOverflow,
|
|
137
143
|
allowWrap ? styles.allowWrap : styles.nowrap,
|
|
138
|
-
hasContextMenu && isLastColumn && styles.contextMenuAnchorCell,
|
|
139
144
|
column.divider === "left" && styles.dividerLeft,
|
|
140
145
|
column.divider === "right" && styles.dividerRight
|
|
141
146
|
),
|
|
142
|
-
"data-align": (
|
|
143
|
-
"data-vertical-align": (
|
|
147
|
+
"data-align": (_a2 = column.align) != null ? _a2 : "left",
|
|
148
|
+
"data-vertical-align": (_b2 = column.verticalAlign) != null ? _b2 : "top",
|
|
144
149
|
"data-divider": column.divider,
|
|
145
150
|
children: /* @__PURE__ */ jsxs(
|
|
146
151
|
"div",
|
|
147
152
|
{
|
|
148
|
-
className: styles.cellContent,
|
|
149
|
-
"data-align": (
|
|
150
|
-
"data-vertical-align": (
|
|
153
|
+
className: cx(styles.cellContent, showRowActions && styles.cellContentWithActions),
|
|
154
|
+
"data-align": (_c = column.align) != null ? _c : "left",
|
|
155
|
+
"data-vertical-align": (_d = column.verticalAlign) != null ? _d : "top",
|
|
151
156
|
children: [
|
|
152
157
|
/* @__PURE__ */ jsx(
|
|
153
158
|
"div",
|
|
@@ -156,11 +161,14 @@ function TableRow({
|
|
|
156
161
|
children: cellValue
|
|
157
162
|
}
|
|
158
163
|
),
|
|
159
|
-
|
|
160
|
-
|
|
164
|
+
showRowActions ? /* @__PURE__ */ jsx(
|
|
165
|
+
RowActions,
|
|
161
166
|
{
|
|
162
167
|
rowId,
|
|
163
168
|
items: contextMenuItems,
|
|
169
|
+
expandable: canExpand && viewMode !== "wrapped",
|
|
170
|
+
isExpanded,
|
|
171
|
+
onToggleExpand: onToggleRowExpand ? () => onToggleRowExpand(rowId) : void 0,
|
|
164
172
|
onRowClick: onRowClick ? () => onRowClick(row) : void 0
|
|
165
173
|
}
|
|
166
174
|
) : null
|
|
@@ -175,12 +183,23 @@ function TableRow({
|
|
|
175
183
|
}
|
|
176
184
|
);
|
|
177
185
|
}
|
|
178
|
-
function
|
|
186
|
+
function RowActions({
|
|
179
187
|
rowId,
|
|
180
188
|
items,
|
|
189
|
+
expandable,
|
|
190
|
+
isExpanded,
|
|
191
|
+
onToggleExpand,
|
|
181
192
|
onRowClick
|
|
182
193
|
}) {
|
|
183
194
|
const toggleRef = useRef(null);
|
|
195
|
+
const expandItem = expandable ? {
|
|
196
|
+
label: "Udvid r\xE6kke",
|
|
197
|
+
active: isExpanded,
|
|
198
|
+
icon: /* @__PURE__ */ jsx(ChevronsUpDown, { size: 16 }),
|
|
199
|
+
onClick: () => onToggleExpand == null ? void 0 : onToggleExpand()
|
|
200
|
+
} : null;
|
|
201
|
+
const menuItems = [...expandItem ? [expandItem] : [], ...items != null ? items : []];
|
|
202
|
+
const hasMenu = Boolean(menuItems.length);
|
|
184
203
|
return /* @__PURE__ */ jsx(
|
|
185
204
|
"div",
|
|
186
205
|
{
|
|
@@ -188,15 +207,17 @@ function RowContextMenu({
|
|
|
188
207
|
"data-row-context-menu": "true",
|
|
189
208
|
onClick: (e) => {
|
|
190
209
|
var _a;
|
|
210
|
+
if (!hasMenu) return;
|
|
191
211
|
e.stopPropagation();
|
|
192
212
|
(_a = toggleRef.current) == null ? void 0 : _a.call(toggleRef, e);
|
|
193
213
|
},
|
|
194
214
|
onContextMenu: (e) => {
|
|
215
|
+
if (!hasMenu) return;
|
|
195
216
|
e.preventDefault();
|
|
196
217
|
e.stopPropagation();
|
|
197
218
|
onRowClick == null ? void 0 : onRowClick();
|
|
198
219
|
},
|
|
199
|
-
children: /* @__PURE__ */ jsx(
|
|
220
|
+
children: hasMenu ? /* @__PURE__ */ jsx(
|
|
200
221
|
Popover,
|
|
201
222
|
{
|
|
202
223
|
matchTriggerWidth: false,
|
|
@@ -223,7 +244,7 @@ function RowContextMenu({
|
|
|
223
244
|
}
|
|
224
245
|
);
|
|
225
246
|
},
|
|
226
|
-
children: (close) => /* @__PURE__ */ jsx(Menu, { children:
|
|
247
|
+
children: (close) => /* @__PURE__ */ jsx(Menu, { children: menuItems.map(
|
|
227
248
|
(item, index) => item.type === "header" ? /* @__PURE__ */ jsx(Menu.Header, { children: item.label }, index) : /* @__PURE__ */ jsx(
|
|
228
249
|
Menu.Item,
|
|
229
250
|
{
|
|
@@ -252,7 +273,7 @@ function RowContextMenu({
|
|
|
252
273
|
)
|
|
253
274
|
) })
|
|
254
275
|
}
|
|
255
|
-
)
|
|
276
|
+
) : null
|
|
256
277
|
}
|
|
257
278
|
);
|
|
258
279
|
}
|
|
@@ -73,7 +73,7 @@ function TableSettings({
|
|
|
73
73
|
children: (close) => /* @__PURE__ */ jsxRuntime.jsxs(Menu.Menu, { children: [
|
|
74
74
|
additionalSettings == null ? void 0 : additionalSettings(close),
|
|
75
75
|
/* @__PURE__ */ jsxRuntime.jsx(Menu.Menu.Item, { active: viewMode === "wrapped", children: /* @__PURE__ */ jsxRuntime.jsxs("button", { type: "button", onClick: () => handleViewModeChange(viewMode, close), children: [
|
|
76
|
-
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.
|
|
76
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.ListChevronsUpDown, {}),
|
|
77
77
|
"Ombryd tekst"
|
|
78
78
|
] }) }),
|
|
79
79
|
hideableColumns.length > 0 && onVisibleColumnIdsChange ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
3
|
-
import {
|
|
3
|
+
import { ListChevronsUpDown, Settings } from 'lucide-react';
|
|
4
4
|
import { useMemo } from 'react';
|
|
5
5
|
import { Button } from '../../../button/Button';
|
|
6
6
|
import { Menu } from '../../../menu/Menu';
|
|
@@ -71,7 +71,7 @@ function TableSettings({
|
|
|
71
71
|
children: (close) => /* @__PURE__ */ jsxs(Menu, { children: [
|
|
72
72
|
additionalSettings == null ? void 0 : additionalSettings(close),
|
|
73
73
|
/* @__PURE__ */ jsx(Menu.Item, { active: viewMode === "wrapped", children: /* @__PURE__ */ jsxs("button", { type: "button", onClick: () => handleViewModeChange(viewMode, close), children: [
|
|
74
|
-
/* @__PURE__ */ jsx(
|
|
74
|
+
/* @__PURE__ */ jsx(ListChevronsUpDown, {}),
|
|
75
75
|
"Ombryd tekst"
|
|
76
76
|
] }) }),
|
|
77
77
|
hideableColumns.length > 0 && onVisibleColumnIdsChange ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const SELECTION_COLUMN_PX = 40;
|
|
4
|
+
const ACTIONS_COLUMN_PX = 0;
|
|
4
5
|
const DEFAULT_COLUMN_PX = 150;
|
|
5
6
|
function getVisibleColumns(columns) {
|
|
6
7
|
return columns.filter((column) => !column.hidden);
|
|
@@ -44,6 +45,7 @@ function getCellDisplayValue(row, column) {
|
|
|
44
45
|
return empty;
|
|
45
46
|
}
|
|
46
47
|
|
|
48
|
+
exports.ACTIONS_COLUMN_PX = ACTIONS_COLUMN_PX;
|
|
47
49
|
exports.DEFAULT_COLUMN_PX = DEFAULT_COLUMN_PX;
|
|
48
50
|
exports.SELECTION_COLUMN_PX = SELECTION_COLUMN_PX;
|
|
49
51
|
exports.getAriaSort = getAriaSort;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
2
|
import type { ColumnItem } from './Table.types';
|
|
3
3
|
export declare const SELECTION_COLUMN_PX: 40;
|
|
4
|
+
export declare const ACTIONS_COLUMN_PX: 0;
|
|
4
5
|
export declare const DEFAULT_COLUMN_PX: 150;
|
|
5
6
|
export type SortDirection = 'asc' | 'desc' | null;
|
|
6
7
|
export declare function getVisibleColumns<T>(columns: Array<ColumnItem<T>>): Array<ColumnItem<T>>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
const SELECTION_COLUMN_PX = 40;
|
|
2
|
+
const ACTIONS_COLUMN_PX = 0;
|
|
2
3
|
const DEFAULT_COLUMN_PX = 150;
|
|
3
4
|
function getVisibleColumns(columns) {
|
|
4
5
|
return columns.filter((column) => !column.hidden);
|
|
@@ -42,4 +43,4 @@ function getCellDisplayValue(row, column) {
|
|
|
42
43
|
return empty;
|
|
43
44
|
}
|
|
44
45
|
|
|
45
|
-
export { DEFAULT_COLUMN_PX, SELECTION_COLUMN_PX, getAriaSort, getCellDisplayValue, getHeaderLabel, getNextSortDirection, getVisibleColumns, isActiveSort, isModifierClick, shouldAllowWrap, shouldToggleOnKey };
|
|
46
|
+
export { ACTIONS_COLUMN_PX, DEFAULT_COLUMN_PX, SELECTION_COLUMN_PX, getAriaSort, getCellDisplayValue, getHeaderLabel, getNextSortDirection, getVisibleColumns, isActiveSort, isModifierClick, shouldAllowWrap, shouldToggleOnKey };
|
package/dist/styles/styles.css
CHANGED
|
@@ -89,6 +89,7 @@ body.dbc-app {
|
|
|
89
89
|
.dbc-table th,
|
|
90
90
|
.dbc-table td {
|
|
91
91
|
padding-block: var(--spacing-xxs);
|
|
92
|
+
padding-inline: var(--spacing-xxs);
|
|
92
93
|
vertical-align: baseline;
|
|
93
94
|
}
|
|
94
95
|
|
|
@@ -101,9 +102,7 @@ body.dbc-app {
|
|
|
101
102
|
font-size: var(--font-size-xs);
|
|
102
103
|
color: var(--color-fg-subtle);
|
|
103
104
|
letter-spacing: var(--letter-spacing-wide);
|
|
104
|
-
text-transform: uppercase;
|
|
105
105
|
font-weight: var(--font-weight-default);
|
|
106
|
-
padding-right: var(--spacing-lg);
|
|
107
106
|
}
|
|
108
107
|
|
|
109
108
|
.dbc-table td {
|
|
@@ -115,8 +114,37 @@ body.dbc-app {
|
|
|
115
114
|
word-break: break-word;
|
|
116
115
|
}
|
|
117
116
|
|
|
118
|
-
|
|
117
|
+
/* Larger vertical padding (default is --spacing-xxs) */
|
|
118
|
+
.dbc-table--md th,
|
|
119
|
+
.dbc-table--md td {
|
|
120
|
+
padding-block: var(--spacing-xs);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/* --hover can go on the <table> (every row hovers) or directly on a <tr>
|
|
124
|
+
(opt in only specific rows, leaving the rest unaffected). */
|
|
125
|
+
.dbc-table--hover tbody tr:hover,
|
|
126
|
+
tr.dbc-table--hover:hover {
|
|
119
127
|
background-color: var(--color-bg-contextual);
|
|
128
|
+
cursor: pointer;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/* Round the hovered row's leading/trailing edge (tr itself can't take a
|
|
132
|
+
border-radius reliably in table layout) — same token as Menu.item's
|
|
133
|
+
hover background. */
|
|
134
|
+
.dbc-table--hover tbody tr:hover th:first-child,
|
|
135
|
+
.dbc-table--hover tbody tr:hover td:first-child,
|
|
136
|
+
tr.dbc-table--hover:hover th:first-child,
|
|
137
|
+
tr.dbc-table--hover:hover td:first-child {
|
|
138
|
+
border-top-left-radius: var(--border-radius-md);
|
|
139
|
+
border-bottom-left-radius: var(--border-radius-md);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
.dbc-table--hover tbody tr:hover th:last-child,
|
|
143
|
+
.dbc-table--hover tbody tr:hover td:last-child,
|
|
144
|
+
tr.dbc-table--hover:hover th:last-child,
|
|
145
|
+
tr.dbc-table--hover:hover td:last-child {
|
|
146
|
+
border-top-right-radius: var(--border-radius-md);
|
|
147
|
+
border-bottom-right-radius: var(--border-radius-md);
|
|
120
148
|
}
|
|
121
149
|
|
|
122
150
|
.dbc-table--clickableRow tbody tr:hover {
|
|
@@ -128,7 +156,8 @@ body.dbc-app {
|
|
|
128
156
|
background-color: var(--table-row-bg-alt);
|
|
129
157
|
}
|
|
130
158
|
|
|
131
|
-
.dbc-table--striped.dbc-table--hover tbody tr:hover
|
|
159
|
+
.dbc-table--striped.dbc-table--hover tbody tr:hover,
|
|
160
|
+
.dbc-table--striped tr.dbc-table--hover:hover {
|
|
132
161
|
background-color: var(--table-row-bg-hover);
|
|
133
162
|
}
|
|
134
163
|
|
|
@@ -162,66 +191,13 @@ body.dbc-app {
|
|
|
162
191
|
vertical-align: middle;
|
|
163
192
|
}
|
|
164
193
|
|
|
165
|
-
/*
|
|
166
|
-
|
|
167
|
-
.dbc-table--
|
|
168
|
-
|
|
169
|
-
border-collapse: collapse;
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
.dbc-table--matrix th,
|
|
173
|
-
.dbc-table--matrix td {
|
|
174
|
-
padding: var(--spacing-xxs) var(--spacing-sm);
|
|
175
|
-
border-bottom: var(--border-width-thin) solid var(--table-border-subtle);
|
|
176
|
-
line-height: var(--line-height-tight);
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
.dbc-table--matrix thead th {
|
|
180
|
-
color: var(--table-header-fg);
|
|
181
|
-
background-color: transparent;
|
|
182
|
-
font-size: var(--font-size-xs);
|
|
183
|
-
font-weight: var(--font-weight-medium);
|
|
184
|
-
letter-spacing: var(--letter-spacing-wide);
|
|
185
|
-
text-transform: uppercase;
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
.dbc-table--matrix tbody th {
|
|
189
|
-
color: var(--color-fg-default);
|
|
190
|
-
font-size: var(--font-size-sm);
|
|
191
|
-
font-weight: var(--font-weight-medium);
|
|
192
|
-
letter-spacing: normal;
|
|
193
|
-
text-transform: none;
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
.dbc-table--matrix td {
|
|
197
|
-
color: var(--table-cell-fg);
|
|
198
|
-
text-align: right;
|
|
199
|
-
font-variant-numeric: tabular-nums;
|
|
200
|
-
white-space: nowrap;
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
.dbc-table--matrix th:not(:first-child) {
|
|
194
|
+
/* Per-cell text alignment. Apply directly to a th/td to right-align that
|
|
195
|
+
column's header/content. */
|
|
196
|
+
.dbc-table th.dbc-table--align-right,
|
|
197
|
+
.dbc-table td.dbc-table--align-right {
|
|
204
198
|
text-align: right;
|
|
205
199
|
}
|
|
206
200
|
|
|
207
|
-
.dbc-table--matrix tr:last-child th,
|
|
208
|
-
.dbc-table--matrix tr:last-child td {
|
|
209
|
-
border-bottom: 0;
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
.dbc-table--matrix-group-header th {
|
|
213
|
-
border-bottom: 0;
|
|
214
|
-
text-align: center;
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
.dbc-table--matrix-group-header th:first-child {
|
|
218
|
-
text-align: left;
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
.dbc-table--matrix-current {
|
|
222
|
-
background-color: color-mix(in srgb, var(--color-bg-selected) 45%, var(--color-bg-surface));
|
|
223
|
-
}
|
|
224
|
-
|
|
225
201
|
/* ==========================================================================
|
|
226
202
|
Text / utility classes
|
|
227
203
|
========================================================================== */
|
|
@@ -239,8 +239,14 @@ html {
|
|
|
239
239
|
--button-bg-primary-hover: var(--color-brand-hover);
|
|
240
240
|
--button-fg-primary: var(--color-fg-on-brand);
|
|
241
241
|
|
|
242
|
+
/* Product / logo lockup — generic defaults; apps with a custom identity
|
|
243
|
+
override these tokens only (see e.g. filmstriben-budget/theme.css) */
|
|
244
|
+
--color-logo: var(--color-brand);
|
|
245
|
+
--color-logo-bg: color-mix(in srgb, var(--color-logo) 10%, var(--color-bg-surface));
|
|
246
|
+
--color-logo-fg: var(--color-fg-default);
|
|
247
|
+
|
|
242
248
|
/* Tables */
|
|
243
|
-
--table-header-bg: light-dark(#
|
|
249
|
+
--table-header-bg: light-dark(#f8f9fb, #1b2533);
|
|
244
250
|
--table-row-bg: light-dark(#ffffff, #111827);
|
|
245
251
|
--table-row-bg-alt: light-dark(#f7f9fc, #141d2a);
|
|
246
252
|
--table-row-bg-hover: light-dark(#eef2f7, #172131);
|
|
@@ -248,10 +254,9 @@ html {
|
|
|
248
254
|
--table-row-bg-selected-hover: var(--dbc-blue-150);
|
|
249
255
|
|
|
250
256
|
--table-border-subtle: light-dark(#eef1f4, rgba(255, 255, 255, 0.08));
|
|
251
|
-
--table-border-header: light-dark(#e2e6ea, rgba(255, 255, 255, 0.12));
|
|
252
257
|
--table-divider: light-dark(#e8ebef, rgba(255, 255, 255, 0.08));
|
|
253
258
|
|
|
254
|
-
--table-header-fg: var(--color-fg-
|
|
259
|
+
--table-header-fg: var(--color-fg-subtle);
|
|
255
260
|
--table-cell-fg: var(--color-fg-default);
|
|
256
261
|
|
|
257
262
|
/* ==========================================================================
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/* Filmstriben Budget theme entrypoint.
|
|
2
|
+
*
|
|
3
|
+
* Usage in the consuming app — only two imports needed:
|
|
4
|
+
* @import '@dbcdk/react-components/styles/themes/dbc/base.css';
|
|
5
|
+
* @import '@dbcdk/react-components/styles/themes/filmstriben-budget/theme.css';
|
|
6
|
+
*
|
|
7
|
+
* Pulls in the shared DBC color layer, then overrides only the
|
|
8
|
+
* --color-logo-* tokens. --color-brand and every other semantic/app color
|
|
9
|
+
* stay on the shared DBC palette — buttons, links, focus rings, selected
|
|
10
|
+
* states, charts, and warnings are unaffected.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
@import '../dbc/colors.css';
|
|
14
|
+
|
|
15
|
+
:root {
|
|
16
|
+
--filmstriben-yellow: #ffc107;
|
|
17
|
+
--filmstriben-black: #212529;
|
|
18
|
+
|
|
19
|
+
--color-logo: var(--filmstriben-yellow);
|
|
20
|
+
--color-logo-bg: color-mix(in srgb, var(--color-logo) 10%, var(--color-bg-surface));
|
|
21
|
+
--color-logo-fg: var(--filmstriben-black);
|
|
22
|
+
}
|
package/dist/styles.css
CHANGED
|
@@ -89,6 +89,7 @@ body.dbc-app {
|
|
|
89
89
|
.dbc-table th,
|
|
90
90
|
.dbc-table td {
|
|
91
91
|
padding-block: var(--spacing-xxs);
|
|
92
|
+
padding-inline: var(--spacing-xxs);
|
|
92
93
|
vertical-align: baseline;
|
|
93
94
|
}
|
|
94
95
|
|
|
@@ -101,9 +102,7 @@ body.dbc-app {
|
|
|
101
102
|
font-size: var(--font-size-xs);
|
|
102
103
|
color: var(--color-fg-subtle);
|
|
103
104
|
letter-spacing: var(--letter-spacing-wide);
|
|
104
|
-
text-transform: uppercase;
|
|
105
105
|
font-weight: var(--font-weight-default);
|
|
106
|
-
padding-right: var(--spacing-lg);
|
|
107
106
|
}
|
|
108
107
|
|
|
109
108
|
.dbc-table td {
|
|
@@ -115,8 +114,37 @@ body.dbc-app {
|
|
|
115
114
|
word-break: break-word;
|
|
116
115
|
}
|
|
117
116
|
|
|
118
|
-
|
|
117
|
+
/* Larger vertical padding (default is --spacing-xxs) */
|
|
118
|
+
.dbc-table--md th,
|
|
119
|
+
.dbc-table--md td {
|
|
120
|
+
padding-block: var(--spacing-xs);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/* --hover can go on the <table> (every row hovers) or directly on a <tr>
|
|
124
|
+
(opt in only specific rows, leaving the rest unaffected). */
|
|
125
|
+
.dbc-table--hover tbody tr:hover,
|
|
126
|
+
tr.dbc-table--hover:hover {
|
|
119
127
|
background-color: var(--color-bg-contextual);
|
|
128
|
+
cursor: pointer;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/* Round the hovered row's leading/trailing edge (tr itself can't take a
|
|
132
|
+
border-radius reliably in table layout) — same token as Menu.item's
|
|
133
|
+
hover background. */
|
|
134
|
+
.dbc-table--hover tbody tr:hover th:first-child,
|
|
135
|
+
.dbc-table--hover tbody tr:hover td:first-child,
|
|
136
|
+
tr.dbc-table--hover:hover th:first-child,
|
|
137
|
+
tr.dbc-table--hover:hover td:first-child {
|
|
138
|
+
border-top-left-radius: var(--border-radius-md);
|
|
139
|
+
border-bottom-left-radius: var(--border-radius-md);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
.dbc-table--hover tbody tr:hover th:last-child,
|
|
143
|
+
.dbc-table--hover tbody tr:hover td:last-child,
|
|
144
|
+
tr.dbc-table--hover:hover th:last-child,
|
|
145
|
+
tr.dbc-table--hover:hover td:last-child {
|
|
146
|
+
border-top-right-radius: var(--border-radius-md);
|
|
147
|
+
border-bottom-right-radius: var(--border-radius-md);
|
|
120
148
|
}
|
|
121
149
|
|
|
122
150
|
.dbc-table--clickableRow tbody tr:hover {
|
|
@@ -128,7 +156,8 @@ body.dbc-app {
|
|
|
128
156
|
background-color: var(--table-row-bg-alt);
|
|
129
157
|
}
|
|
130
158
|
|
|
131
|
-
.dbc-table--striped.dbc-table--hover tbody tr:hover
|
|
159
|
+
.dbc-table--striped.dbc-table--hover tbody tr:hover,
|
|
160
|
+
.dbc-table--striped tr.dbc-table--hover:hover {
|
|
132
161
|
background-color: var(--table-row-bg-hover);
|
|
133
162
|
}
|
|
134
163
|
|
|
@@ -162,66 +191,13 @@ body.dbc-app {
|
|
|
162
191
|
vertical-align: middle;
|
|
163
192
|
}
|
|
164
193
|
|
|
165
|
-
/*
|
|
166
|
-
|
|
167
|
-
.dbc-table--
|
|
168
|
-
|
|
169
|
-
border-collapse: collapse;
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
.dbc-table--matrix th,
|
|
173
|
-
.dbc-table--matrix td {
|
|
174
|
-
padding: var(--spacing-xxs) var(--spacing-sm);
|
|
175
|
-
border-bottom: var(--border-width-thin) solid var(--table-border-subtle);
|
|
176
|
-
line-height: var(--line-height-tight);
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
.dbc-table--matrix thead th {
|
|
180
|
-
color: var(--table-header-fg);
|
|
181
|
-
background-color: transparent;
|
|
182
|
-
font-size: var(--font-size-xs);
|
|
183
|
-
font-weight: var(--font-weight-medium);
|
|
184
|
-
letter-spacing: var(--letter-spacing-wide);
|
|
185
|
-
text-transform: uppercase;
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
.dbc-table--matrix tbody th {
|
|
189
|
-
color: var(--color-fg-default);
|
|
190
|
-
font-size: var(--font-size-sm);
|
|
191
|
-
font-weight: var(--font-weight-medium);
|
|
192
|
-
letter-spacing: normal;
|
|
193
|
-
text-transform: none;
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
.dbc-table--matrix td {
|
|
197
|
-
color: var(--table-cell-fg);
|
|
198
|
-
text-align: right;
|
|
199
|
-
font-variant-numeric: tabular-nums;
|
|
200
|
-
white-space: nowrap;
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
.dbc-table--matrix th:not(:first-child) {
|
|
194
|
+
/* Per-cell text alignment. Apply directly to a th/td to right-align that
|
|
195
|
+
column's header/content. */
|
|
196
|
+
.dbc-table th.dbc-table--align-right,
|
|
197
|
+
.dbc-table td.dbc-table--align-right {
|
|
204
198
|
text-align: right;
|
|
205
199
|
}
|
|
206
200
|
|
|
207
|
-
.dbc-table--matrix tr:last-child th,
|
|
208
|
-
.dbc-table--matrix tr:last-child td {
|
|
209
|
-
border-bottom: 0;
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
.dbc-table--matrix-group-header th {
|
|
213
|
-
border-bottom: 0;
|
|
214
|
-
text-align: center;
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
.dbc-table--matrix-group-header th:first-child {
|
|
218
|
-
text-align: left;
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
.dbc-table--matrix-current {
|
|
222
|
-
background-color: color-mix(in srgb, var(--color-bg-selected) 45%, var(--color-bg-surface));
|
|
223
|
-
}
|
|
224
|
-
|
|
225
201
|
/* ==========================================================================
|
|
226
202
|
Text / utility classes
|
|
227
203
|
========================================================================== */
|
|
@@ -3,7 +3,15 @@
|
|
|
3
3
|
function formatDate(date, options = {}) {
|
|
4
4
|
const d = date instanceof Date ? date : new Date(date);
|
|
5
5
|
if (isNaN(d.getTime())) return "";
|
|
6
|
-
const {
|
|
6
|
+
const {
|
|
7
|
+
showTime = false,
|
|
8
|
+
showSeconds = false,
|
|
9
|
+
userFriendlyLabel = false,
|
|
10
|
+
timeOnly = false,
|
|
11
|
+
ignoreDate = false,
|
|
12
|
+
ignoreDateIfSame = false
|
|
13
|
+
} = options;
|
|
14
|
+
const useTimeOnly = timeOnly || ignoreDate;
|
|
7
15
|
const pad = (n) => n.toString().padStart(2, "0");
|
|
8
16
|
const formatTime = () => {
|
|
9
17
|
const hours = pad(d.getHours());
|
|
@@ -13,6 +21,12 @@ function formatDate(date, options = {}) {
|
|
|
13
21
|
return `${hours}:${minutes}:${seconds}`;
|
|
14
22
|
};
|
|
15
23
|
const isSameCalendarDay = (a, b) => a.getDate() === b.getDate() && a.getMonth() === b.getMonth() && a.getFullYear() === b.getFullYear();
|
|
24
|
+
if (useTimeOnly) {
|
|
25
|
+
return formatTime();
|
|
26
|
+
}
|
|
27
|
+
if (ignoreDateIfSame && isSameCalendarDay(d, /* @__PURE__ */ new Date())) {
|
|
28
|
+
return formatTime();
|
|
29
|
+
}
|
|
16
30
|
if (userFriendlyLabel) {
|
|
17
31
|
const now = /* @__PURE__ */ new Date();
|
|
18
32
|
const yesterday = new Date(now);
|
|
@@ -1,20 +1,28 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Formats a Date as "dd/mm/yyyy"
|
|
2
|
+
* Formats a Date as "dd/mm/yyyy", "dd/mm/yyyy hh:mm:ss", or time-only.
|
|
3
3
|
* Optionally returns user-friendly Danish labels like "I dag" or "I går".
|
|
4
4
|
*
|
|
5
5
|
* Examples:
|
|
6
6
|
* - formatDate(new Date(), { userFriendlyLabel: true }) => "I dag"
|
|
7
7
|
* - formatDate(new Date(), { userFriendlyLabel: true, showTime: true }) => "I dag, kl. 14:30"
|
|
8
8
|
* - formatDate(date, { showTime: true }) => "10.03.2026 14:30"
|
|
9
|
+
* - formatDate(date, { timeOnly: true }) => "14:30"
|
|
10
|
+
* - formatDate(date, { showTime: true, ignoreDateIfSame: true }) => "14:30" for today, otherwise "10.03.2026 14:30"
|
|
9
11
|
*
|
|
10
12
|
* @param date - The Date or date-parsable value to format
|
|
11
13
|
* @param options.showTime - If true, append time "hh:mm" or "hh:mm:ss"
|
|
12
14
|
* @param options.showSeconds - If true, append seconds when showTime is enabled
|
|
13
15
|
* @param options.userFriendlyLabel - If true, use "I dag" / "I går" when applicable
|
|
16
|
+
* @param options.timeOnly - If true, return only the time portion
|
|
17
|
+
* @param options.ignoreDate - Alias for timeOnly
|
|
18
|
+
* @param options.ignoreDateIfSame - If true, return only the time when the date is today
|
|
14
19
|
* @returns A formatted string
|
|
15
20
|
*/
|
|
16
21
|
export declare function formatDate(date: Date | string | number, options?: {
|
|
17
22
|
showTime?: boolean;
|
|
18
23
|
showSeconds?: boolean;
|
|
19
24
|
userFriendlyLabel?: boolean;
|
|
25
|
+
timeOnly?: boolean;
|
|
26
|
+
ignoreDate?: boolean;
|
|
27
|
+
ignoreDateIfSame?: boolean;
|
|
20
28
|
}): string;
|
|
@@ -1,7 +1,15 @@
|
|
|
1
1
|
function formatDate(date, options = {}) {
|
|
2
2
|
const d = date instanceof Date ? date : new Date(date);
|
|
3
3
|
if (isNaN(d.getTime())) return "";
|
|
4
|
-
const {
|
|
4
|
+
const {
|
|
5
|
+
showTime = false,
|
|
6
|
+
showSeconds = false,
|
|
7
|
+
userFriendlyLabel = false,
|
|
8
|
+
timeOnly = false,
|
|
9
|
+
ignoreDate = false,
|
|
10
|
+
ignoreDateIfSame = false
|
|
11
|
+
} = options;
|
|
12
|
+
const useTimeOnly = timeOnly || ignoreDate;
|
|
5
13
|
const pad = (n) => n.toString().padStart(2, "0");
|
|
6
14
|
const formatTime = () => {
|
|
7
15
|
const hours = pad(d.getHours());
|
|
@@ -11,6 +19,12 @@ function formatDate(date, options = {}) {
|
|
|
11
19
|
return `${hours}:${minutes}:${seconds}`;
|
|
12
20
|
};
|
|
13
21
|
const isSameCalendarDay = (a, b) => a.getDate() === b.getDate() && a.getMonth() === b.getMonth() && a.getFullYear() === b.getFullYear();
|
|
22
|
+
if (useTimeOnly) {
|
|
23
|
+
return formatTime();
|
|
24
|
+
}
|
|
25
|
+
if (ignoreDateIfSame && isSameCalendarDay(d, /* @__PURE__ */ new Date())) {
|
|
26
|
+
return formatTime();
|
|
27
|
+
}
|
|
14
28
|
if (userFriendlyLabel) {
|
|
15
29
|
const now = /* @__PURE__ */ new Date();
|
|
16
30
|
const yesterday = new Date(now);
|