@dbcdk/react-components 0.0.172 → 0.0.174
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/client.cjs +14 -0
- package/dist/client.d.ts +2 -0
- package/dist/client.js +2 -0
- package/dist/components/app-header/AppHeader.module.css +2 -2
- package/dist/components/button/Button.d.ts +3 -1
- package/dist/components/button/Button.module.css +26 -0
- package/dist/components/color-scheme-button/ColorSchemeButton.cjs +78 -0
- package/dist/components/color-scheme-button/ColorSchemeButton.d.ts +8 -0
- package/dist/components/color-scheme-button/ColorSchemeButton.js +75 -0
- package/dist/components/forms/form-select/FormSelect.d.ts +1 -1
- package/dist/components/forms/form-select/FormSelect.module.css +19 -0
- package/dist/components/forms/input/Input.cjs +1 -1
- package/dist/components/forms/input/Input.d.ts +1 -1
- package/dist/components/forms/input/Input.js +1 -1
- package/dist/components/forms/input/Input.module.css +32 -0
- package/dist/components/forms/typeahead/Typeahead.cjs +1 -0
- package/dist/components/forms/typeahead/Typeahead.js +1 -0
- package/dist/components/grid/Grid.cjs +4 -3
- package/dist/components/grid/Grid.d.ts +3 -3
- package/dist/components/grid/Grid.js +4 -3
- package/dist/components/grid/Grid.module.css +1 -1
- package/dist/components/hyperlink/Hyperlink.cjs +2 -1
- package/dist/components/hyperlink/Hyperlink.d.ts +2 -1
- package/dist/components/hyperlink/Hyperlink.js +2 -1
- package/dist/components/hyperlink/Hyperlink.module.css +16 -0
- package/dist/components/metric-tile/MetricTile.cjs +77 -8
- package/dist/components/metric-tile/MetricTile.d.ts +17 -4
- package/dist/components/metric-tile/MetricTile.js +78 -9
- package/dist/components/metric-tile/MetricTile.module.css +122 -19
- package/dist/components/nav-bar/NavBar.cjs +1 -0
- package/dist/components/nav-bar/NavBar.js +1 -0
- package/dist/components/nav-bar/NavBar.module.css +10 -10
- package/dist/components/page-layout/PageLayout.module.css +1 -1
- package/dist/components/popover/Popover.cjs +4 -2
- package/dist/components/popover/Popover.d.ts +2 -0
- package/dist/components/popover/Popover.js +4 -2
- package/dist/components/popover/Popover.module.css +5 -0
- package/dist/components/theme-button/ThemeButton.cjs +30 -23
- package/dist/components/theme-button/ThemeButton.d.ts +9 -3
- package/dist/components/theme-button/ThemeButton.js +31 -24
- package/dist/components/theme-script/ThemeScript.cjs +50 -12
- package/dist/components/theme-script/ThemeScript.d.ts +35 -12
- package/dist/components/theme-script/ThemeScript.js +51 -13
- package/dist/hooks/useColorScheme.cjs +74 -0
- package/dist/hooks/useColorScheme.d.ts +6 -0
- package/dist/hooks/useColorScheme.js +72 -0
- package/dist/hooks/useTheme.cjs +116 -50
- package/dist/hooks/useTheme.d.ts +17 -5
- package/dist/hooks/useTheme.js +117 -51
- package/dist/index.cjs +14 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/styles/themes/dbc/colors.css +13 -2
- package/dist/styles/themes/filmstriben/theme.css +55 -0
- package/dist/styles/themes/types.cjs +8 -0
- package/dist/styles/themes/types.d.ts +24 -16
- package/dist/styles/themes/types.js +6 -0
- package/dist/themes/filmstriben.css +4 -0
- package/dist/utils/color-scheme.constants.cjs +11 -0
- package/dist/utils/color-scheme.constants.d.ts +4 -0
- package/dist/utils/color-scheme.constants.js +7 -0
- package/dist/utils/theme.constants.cjs +3 -7
- package/dist/utils/theme.constants.d.ts +2 -4
- package/dist/utils/theme.constants.js +3 -6
- package/package.json +1 -1
- package/dist/styles/themes/filmstriben-budget/theme.css +0 -22
- package/dist/themes/filmstriben-budget.css +0 -3
package/dist/client.cjs
CHANGED
|
@@ -18,6 +18,7 @@ var EnvironmentBanner = require('./components/environment-banner/EnvironmentBann
|
|
|
18
18
|
var Footer = require('./components/page-layout/components/footer/Footer');
|
|
19
19
|
var Input = require('./components/forms/input/Input');
|
|
20
20
|
var SearchBox = require('./components/search-box/SearchBox');
|
|
21
|
+
var useColorScheme = require('./hooks/useColorScheme');
|
|
21
22
|
var useTheme = require('./hooks/useTheme');
|
|
22
23
|
var usePersistentState = require('./hooks/usePersistentState');
|
|
23
24
|
var Chip = require('./components/chip/Chip');
|
|
@@ -80,6 +81,7 @@ var StatePage = require('./components/state-page/StatePage');
|
|
|
80
81
|
var StickyFooterLayout = require('./components/sticky-footer-layout/StickyFooterLayout');
|
|
81
82
|
var Typeahead = require('./components/forms/typeahead/Typeahead');
|
|
82
83
|
var useDeviceSize = require('./hooks/useDeviceSize');
|
|
84
|
+
var ColorSchemeButton = require('./components/color-scheme-button/ColorSchemeButton');
|
|
83
85
|
var ThemeButton = require('./components/theme-button/ThemeButton');
|
|
84
86
|
var CopyButton = require('./components/copy-button/CopyButton');
|
|
85
87
|
var Divider = require('./components/divider/Divider');
|
|
@@ -195,6 +197,12 @@ Object.keys(SearchBox).forEach(function (k) {
|
|
|
195
197
|
get: function () { return SearchBox[k]; }
|
|
196
198
|
});
|
|
197
199
|
});
|
|
200
|
+
Object.keys(useColorScheme).forEach(function (k) {
|
|
201
|
+
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
202
|
+
enumerable: true,
|
|
203
|
+
get: function () { return useColorScheme[k]; }
|
|
204
|
+
});
|
|
205
|
+
});
|
|
198
206
|
Object.keys(useTheme).forEach(function (k) {
|
|
199
207
|
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
200
208
|
enumerable: true,
|
|
@@ -567,6 +575,12 @@ Object.keys(useDeviceSize).forEach(function (k) {
|
|
|
567
575
|
get: function () { return useDeviceSize[k]; }
|
|
568
576
|
});
|
|
569
577
|
});
|
|
578
|
+
Object.keys(ColorSchemeButton).forEach(function (k) {
|
|
579
|
+
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
580
|
+
enumerable: true,
|
|
581
|
+
get: function () { return ColorSchemeButton[k]; }
|
|
582
|
+
});
|
|
583
|
+
});
|
|
570
584
|
Object.keys(ThemeButton).forEach(function (k) {
|
|
571
585
|
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
572
586
|
enumerable: true,
|
package/dist/client.d.ts
CHANGED
|
@@ -15,6 +15,7 @@ export * from './components/environment-banner/EnvironmentBanner';
|
|
|
15
15
|
export * from './components/page-layout/components/footer/Footer';
|
|
16
16
|
export * from './components/forms/input/Input';
|
|
17
17
|
export * from './components/search-box/SearchBox';
|
|
18
|
+
export * from './hooks/useColorScheme';
|
|
18
19
|
export * from './hooks/useTheme';
|
|
19
20
|
export * from './hooks/usePersistentState';
|
|
20
21
|
export * from './components/chip/Chip';
|
|
@@ -77,6 +78,7 @@ export * from './components/state-page/StatePage';
|
|
|
77
78
|
export * from './components/sticky-footer-layout/StickyFooterLayout';
|
|
78
79
|
export * from './components/forms/typeahead/Typeahead';
|
|
79
80
|
export * from './hooks/useDeviceSize';
|
|
81
|
+
export * from './components/color-scheme-button/ColorSchemeButton';
|
|
80
82
|
export * from './components/theme-button/ThemeButton';
|
|
81
83
|
export * from './components/copy-button/CopyButton';
|
|
82
84
|
export * from './components/divider/Divider';
|
package/dist/client.js
CHANGED
|
@@ -16,6 +16,7 @@ export * from './components/environment-banner/EnvironmentBanner';
|
|
|
16
16
|
export * from './components/page-layout/components/footer/Footer';
|
|
17
17
|
export * from './components/forms/input/Input';
|
|
18
18
|
export * from './components/search-box/SearchBox';
|
|
19
|
+
export * from './hooks/useColorScheme';
|
|
19
20
|
export * from './hooks/useTheme';
|
|
20
21
|
export * from './hooks/usePersistentState';
|
|
21
22
|
export * from './components/chip/Chip';
|
|
@@ -78,6 +79,7 @@ export * from './components/state-page/StatePage';
|
|
|
78
79
|
export * from './components/sticky-footer-layout/StickyFooterLayout';
|
|
79
80
|
export * from './components/forms/typeahead/Typeahead';
|
|
80
81
|
export * from './hooks/useDeviceSize';
|
|
82
|
+
export * from './components/color-scheme-button/ColorSchemeButton';
|
|
81
83
|
export * from './components/theme-button/ThemeButton';
|
|
82
84
|
export * from './components/copy-button/CopyButton';
|
|
83
85
|
export * from './components/divider/Divider';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
.header {
|
|
2
2
|
inline-size: 100%;
|
|
3
|
-
background-color: var(--color-bg
|
|
3
|
+
background-color: var(--color-navbar-bg);
|
|
4
4
|
}
|
|
5
5
|
|
|
6
6
|
.container {
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
box-sizing: border-box;
|
|
17
17
|
|
|
18
18
|
/* chrome */
|
|
19
|
-
color: var(--color-fg
|
|
19
|
+
color: var(--color-navbar-fg);
|
|
20
20
|
|
|
21
21
|
/* density-aware vertical rhythm */
|
|
22
22
|
padding-block: calc(var(--control-padding-y) + var(--density));
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import type { Size } from '../../types/sizes.types';
|
|
3
|
-
export type ButtonVariant = 'primary' | 'secondary' | 'outlined' | 'default' | 'inline' | 'success' | 'danger'
|
|
3
|
+
export type ButtonVariant = 'primary' | 'secondary' | 'outlined' | 'default' | 'inline' | 'success' | 'danger'
|
|
4
|
+
/** Ghost button using --color-navbar-fg tokens — only meaningful inside/near AppHeader */
|
|
5
|
+
| 'header';
|
|
4
6
|
export type ButtonSize = Exclude<Size, 'xl'>;
|
|
5
7
|
export interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
6
8
|
variant?: ButtonVariant;
|
|
@@ -252,6 +252,32 @@
|
|
|
252
252
|
color: var(--button-bg-primary-hover);
|
|
253
253
|
}
|
|
254
254
|
|
|
255
|
+
.header {
|
|
256
|
+
background-color: transparent;
|
|
257
|
+
color: var(--color-navbar-fg);
|
|
258
|
+
border-color: var(--color-navbar-border);
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
.header:hover {
|
|
262
|
+
background-color: color-mix(in srgb, var(--color-navbar-fg) 12%, transparent);
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
.header:focus-visible {
|
|
266
|
+
outline: none;
|
|
267
|
+
border-color: var(--color-navbar-fg);
|
|
268
|
+
box-shadow: inset 0 0 0 1px var(--color-navbar-fg);
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
.header.active {
|
|
272
|
+
background-color: color-mix(in srgb, var(--color-navbar-fg) 16%, transparent);
|
|
273
|
+
color: var(--color-navbar-fg);
|
|
274
|
+
border-color: var(--color-navbar-fg);
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
.header.active:hover {
|
|
278
|
+
background-color: color-mix(in srgb, var(--color-navbar-fg) 22%, transparent);
|
|
279
|
+
}
|
|
280
|
+
|
|
255
281
|
.button.xs {
|
|
256
282
|
height: auto;
|
|
257
283
|
min-block-size: 0;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
5
|
+
var lucideReact = require('lucide-react');
|
|
6
|
+
var Button = require('../../components/button/Button');
|
|
7
|
+
var Menu = require('../../components/menu/Menu');
|
|
8
|
+
var Popover = require('../../components/popover/Popover');
|
|
9
|
+
var useColorScheme = require('../../hooks/useColorScheme');
|
|
10
|
+
|
|
11
|
+
const COLOR_SCHEME_OPTIONS = [
|
|
12
|
+
{ value: "system", label: "System", icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Monitor, { size: 16 }) },
|
|
13
|
+
{ value: "light", label: "Lyst", icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Sun, { size: 16 }) },
|
|
14
|
+
{ value: "dark", label: "M\xF8rkt", icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Moon, { size: 16 }) }
|
|
15
|
+
];
|
|
16
|
+
function ColorSchemeMenuSection() {
|
|
17
|
+
const { colorScheme, switchColorScheme } = useColorScheme.useColorScheme();
|
|
18
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
19
|
+
/* @__PURE__ */ jsxRuntime.jsx(Menu.Menu.Header, { children: "Udseende" }),
|
|
20
|
+
COLOR_SCHEME_OPTIONS.map((option) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
21
|
+
Menu.Menu.RadioItem,
|
|
22
|
+
{
|
|
23
|
+
name: "color-scheme",
|
|
24
|
+
value: option.value,
|
|
25
|
+
checked: colorScheme === option.value,
|
|
26
|
+
label: option.label,
|
|
27
|
+
onValueChange: (value) => switchColorScheme(value)
|
|
28
|
+
},
|
|
29
|
+
option.value
|
|
30
|
+
))
|
|
31
|
+
] });
|
|
32
|
+
}
|
|
33
|
+
function ColorSchemeButton({
|
|
34
|
+
size,
|
|
35
|
+
variant = "outlined"
|
|
36
|
+
}) {
|
|
37
|
+
const { colorScheme, switchColorScheme } = useColorScheme.useColorScheme();
|
|
38
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
39
|
+
Popover.Popover,
|
|
40
|
+
{
|
|
41
|
+
matchTriggerWidth: false,
|
|
42
|
+
minWidth: "140px",
|
|
43
|
+
trigger: (handleClick, chevron) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
44
|
+
Button.Button,
|
|
45
|
+
{
|
|
46
|
+
variant,
|
|
47
|
+
size,
|
|
48
|
+
onClick: handleClick,
|
|
49
|
+
"aria-label": "Skift udseende",
|
|
50
|
+
"aria-haspopup": "menu",
|
|
51
|
+
children: [
|
|
52
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Palette, {}),
|
|
53
|
+
chevron
|
|
54
|
+
]
|
|
55
|
+
}
|
|
56
|
+
),
|
|
57
|
+
children: (close) => /* @__PURE__ */ jsxRuntime.jsxs(Menu.Menu, { children: [
|
|
58
|
+
/* @__PURE__ */ jsxRuntime.jsx(Menu.Menu.Header, { children: "Udseende" }),
|
|
59
|
+
COLOR_SCHEME_OPTIONS.map((option) => /* @__PURE__ */ jsxRuntime.jsx(Menu.Menu.Item, { active: colorScheme === option.value, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
60
|
+
"button",
|
|
61
|
+
{
|
|
62
|
+
onClick: () => {
|
|
63
|
+
switchColorScheme(option.value);
|
|
64
|
+
close();
|
|
65
|
+
},
|
|
66
|
+
children: [
|
|
67
|
+
option.icon,
|
|
68
|
+
option.label
|
|
69
|
+
]
|
|
70
|
+
}
|
|
71
|
+
) }, option.value))
|
|
72
|
+
] })
|
|
73
|
+
}
|
|
74
|
+
);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
exports.ColorSchemeButton = ColorSchemeButton;
|
|
78
|
+
exports.ColorSchemeMenuSection = ColorSchemeMenuSection;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { JSX } from 'react';
|
|
2
|
+
import type { ButtonSize, ButtonVariant } from '../../components/button/Button';
|
|
3
|
+
export interface ColorSchemeButtonProps {
|
|
4
|
+
size?: ButtonSize;
|
|
5
|
+
variant?: ButtonVariant;
|
|
6
|
+
}
|
|
7
|
+
export declare function ColorSchemeMenuSection(): JSX.Element;
|
|
8
|
+
export declare function ColorSchemeButton({ size, variant, }: ColorSchemeButtonProps): JSX.Element;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { Palette, Monitor, Sun, Moon } from 'lucide-react';
|
|
4
|
+
import { Button } from '../../components/button/Button';
|
|
5
|
+
import { Menu } from '../../components/menu/Menu';
|
|
6
|
+
import { Popover } from '../../components/popover/Popover';
|
|
7
|
+
import { useColorScheme } from '../../hooks/useColorScheme';
|
|
8
|
+
|
|
9
|
+
const COLOR_SCHEME_OPTIONS = [
|
|
10
|
+
{ value: "system", label: "System", icon: /* @__PURE__ */ jsx(Monitor, { size: 16 }) },
|
|
11
|
+
{ value: "light", label: "Lyst", icon: /* @__PURE__ */ jsx(Sun, { size: 16 }) },
|
|
12
|
+
{ value: "dark", label: "M\xF8rkt", icon: /* @__PURE__ */ jsx(Moon, { size: 16 }) }
|
|
13
|
+
];
|
|
14
|
+
function ColorSchemeMenuSection() {
|
|
15
|
+
const { colorScheme, switchColorScheme } = useColorScheme();
|
|
16
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
17
|
+
/* @__PURE__ */ jsx(Menu.Header, { children: "Udseende" }),
|
|
18
|
+
COLOR_SCHEME_OPTIONS.map((option) => /* @__PURE__ */ jsx(
|
|
19
|
+
Menu.RadioItem,
|
|
20
|
+
{
|
|
21
|
+
name: "color-scheme",
|
|
22
|
+
value: option.value,
|
|
23
|
+
checked: colorScheme === option.value,
|
|
24
|
+
label: option.label,
|
|
25
|
+
onValueChange: (value) => switchColorScheme(value)
|
|
26
|
+
},
|
|
27
|
+
option.value
|
|
28
|
+
))
|
|
29
|
+
] });
|
|
30
|
+
}
|
|
31
|
+
function ColorSchemeButton({
|
|
32
|
+
size,
|
|
33
|
+
variant = "outlined"
|
|
34
|
+
}) {
|
|
35
|
+
const { colorScheme, switchColorScheme } = useColorScheme();
|
|
36
|
+
return /* @__PURE__ */ jsx(
|
|
37
|
+
Popover,
|
|
38
|
+
{
|
|
39
|
+
matchTriggerWidth: false,
|
|
40
|
+
minWidth: "140px",
|
|
41
|
+
trigger: (handleClick, chevron) => /* @__PURE__ */ jsxs(
|
|
42
|
+
Button,
|
|
43
|
+
{
|
|
44
|
+
variant,
|
|
45
|
+
size,
|
|
46
|
+
onClick: handleClick,
|
|
47
|
+
"aria-label": "Skift udseende",
|
|
48
|
+
"aria-haspopup": "menu",
|
|
49
|
+
children: [
|
|
50
|
+
/* @__PURE__ */ jsx(Palette, {}),
|
|
51
|
+
chevron
|
|
52
|
+
]
|
|
53
|
+
}
|
|
54
|
+
),
|
|
55
|
+
children: (close) => /* @__PURE__ */ jsxs(Menu, { children: [
|
|
56
|
+
/* @__PURE__ */ jsx(Menu.Header, { children: "Udseende" }),
|
|
57
|
+
COLOR_SCHEME_OPTIONS.map((option) => /* @__PURE__ */ jsx(Menu.Item, { active: colorScheme === option.value, children: /* @__PURE__ */ jsxs(
|
|
58
|
+
"button",
|
|
59
|
+
{
|
|
60
|
+
onClick: () => {
|
|
61
|
+
switchColorScheme(option.value);
|
|
62
|
+
close();
|
|
63
|
+
},
|
|
64
|
+
children: [
|
|
65
|
+
option.icon,
|
|
66
|
+
option.label
|
|
67
|
+
]
|
|
68
|
+
}
|
|
69
|
+
) }, option.value))
|
|
70
|
+
] })
|
|
71
|
+
}
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export { ColorSchemeButton, ColorSchemeMenuSection };
|
|
@@ -10,7 +10,7 @@ export type FormSelectProps<T> = Omit<InputContainerProps, 'children' | 'htmlFor
|
|
|
10
10
|
onChange: (value: T) => void;
|
|
11
11
|
placeholder?: string;
|
|
12
12
|
size?: 'sm' | 'md' | 'lg';
|
|
13
|
-
variant?: 'outlined' | 'filled' | 'standalone';
|
|
13
|
+
variant?: 'outlined' | 'filled' | 'standalone' | 'header';
|
|
14
14
|
onClear?: () => void;
|
|
15
15
|
/**
|
|
16
16
|
* Needed if T is an object and you want to use native select.
|
|
@@ -129,6 +129,25 @@
|
|
|
129
129
|
background-color: transparent;
|
|
130
130
|
}
|
|
131
131
|
|
|
132
|
+
/* Ghost field for use inside/near AppHeader — only meaningful there */
|
|
133
|
+
.header {
|
|
134
|
+
background-color: transparent;
|
|
135
|
+
border-color: var(--color-navbar-border);
|
|
136
|
+
color: var(--color-navbar-fg);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
.header:hover:not(:disabled) {
|
|
140
|
+
background-color: color-mix(in srgb, var(--color-navbar-fg) 8%, transparent);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
.container:focus-within .header {
|
|
144
|
+
border-color: var(--color-navbar-fg);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
.field:has(.header) .chevron {
|
|
148
|
+
color: var(--color-navbar-fg-muted);
|
|
149
|
+
}
|
|
150
|
+
|
|
132
151
|
/* =========================================
|
|
133
152
|
Sizes
|
|
134
153
|
========================================= */
|
|
@@ -87,7 +87,7 @@ const Input = react.forwardRef(function Input2({
|
|
|
87
87
|
focusOpenMode: tooltipOpenOnFocus ? "any" : "focus-visible",
|
|
88
88
|
closeOnPointerDown: false
|
|
89
89
|
});
|
|
90
|
-
const trailingButtonVariant = variant === "outlined" || variant === "standalone" ? "outlined" : "default";
|
|
90
|
+
const trailingButtonVariant = variant === "header" ? "header" : variant === "outlined" || variant === "standalone" ? "outlined" : "default";
|
|
91
91
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
92
92
|
InputContainer.InputContainer,
|
|
93
93
|
{
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import type { Size } from '../../../types/sizes.types';
|
|
3
3
|
import type { InputContainerProps } from '../input-container/InputContainer';
|
|
4
|
-
export type InputVariant = 'outlined' | 'surface' | 'subtle' | 'standalone' | 'embedded';
|
|
4
|
+
export type InputVariant = 'outlined' | 'surface' | 'subtle' | 'standalone' | 'embedded' | 'header';
|
|
5
5
|
export type InputProps = Omit<React.InputHTMLAttributes<HTMLInputElement>, 'size' | 'width'> & Omit<InputContainerProps, 'children' | 'htmlFor' | 'tooltip' | 'tooltipPlacement' | 'size'> & {
|
|
6
6
|
icon?: React.ReactNode;
|
|
7
7
|
autoFocus?: boolean;
|
|
@@ -81,7 +81,7 @@ const Input = forwardRef(function Input2({
|
|
|
81
81
|
focusOpenMode: tooltipOpenOnFocus ? "any" : "focus-visible",
|
|
82
82
|
closeOnPointerDown: false
|
|
83
83
|
});
|
|
84
|
-
const trailingButtonVariant = variant === "outlined" || variant === "standalone" ? "outlined" : "default";
|
|
84
|
+
const trailingButtonVariant = variant === "header" ? "header" : variant === "outlined" || variant === "standalone" ? "outlined" : "default";
|
|
85
85
|
return /* @__PURE__ */ jsx(
|
|
86
86
|
InputContainer,
|
|
87
87
|
{
|
|
@@ -183,6 +183,38 @@
|
|
|
183
183
|
inset 0 0 0 1px var(--color-border-selected);
|
|
184
184
|
}
|
|
185
185
|
|
|
186
|
+
/* Ghost field for use inside/near AppHeader — only meaningful there */
|
|
187
|
+
.header {
|
|
188
|
+
background-color: transparent;
|
|
189
|
+
border-color: var(--color-navbar-border);
|
|
190
|
+
color: var(--color-navbar-fg);
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
.header:hover:not([aria-disabled='true']) {
|
|
194
|
+
background-color: color-mix(in srgb, var(--color-navbar-fg) 8%, transparent);
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
.header:focus-within:not([aria-disabled='true']) {
|
|
198
|
+
border-color: var(--color-navbar-fg);
|
|
199
|
+
box-shadow: inset 0 0 0 1px var(--color-navbar-fg);
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
.header .input {
|
|
203
|
+
color: var(--color-navbar-fg);
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
.header .input::placeholder {
|
|
207
|
+
color: var(--color-navbar-fg-muted) !important;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
.header .icon {
|
|
211
|
+
color: var(--color-navbar-fg-muted);
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
.header:focus-within .icon {
|
|
215
|
+
color: var(--color-navbar-fg);
|
|
216
|
+
}
|
|
217
|
+
|
|
186
218
|
/* =========================
|
|
187
219
|
Modified state
|
|
188
220
|
========================= */
|
|
@@ -39,14 +39,15 @@ function Grid({
|
|
|
39
39
|
);
|
|
40
40
|
}
|
|
41
41
|
function GridItem({ children, base = 12, md, lg, className, style }) {
|
|
42
|
+
const toTrackSpan = (span) => span * 2;
|
|
42
43
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
43
44
|
"div",
|
|
44
45
|
{
|
|
45
46
|
className: [styles__default.default.item, className].filter(Boolean).join(" "),
|
|
46
47
|
style: {
|
|
47
|
-
"--span-base": base,
|
|
48
|
-
...md != null ? { "--span-md": md } : {},
|
|
49
|
-
...lg != null ? { "--span-lg": lg } : {},
|
|
48
|
+
"--span-base": toTrackSpan(base),
|
|
49
|
+
...md != null ? { "--span-md": toTrackSpan(md) } : {},
|
|
50
|
+
...lg != null ? { "--span-lg": toTrackSpan(lg) } : {},
|
|
50
51
|
...style
|
|
51
52
|
},
|
|
52
53
|
children
|
|
@@ -17,11 +17,11 @@ export interface GridProps {
|
|
|
17
17
|
export declare function Grid({ children, gap, equalHeight, maxWidth, className, style, }: GridProps): import("react/jsx-runtime").JSX.Element;
|
|
18
18
|
export interface GridItemProps {
|
|
19
19
|
children?: ReactNode;
|
|
20
|
-
/** Default span: <768px */
|
|
20
|
+
/** Default span: <768px. Supports 0.5 increments, e.g. 4.5 */
|
|
21
21
|
base?: number;
|
|
22
|
-
/** Medium span: ≥768px */
|
|
22
|
+
/** Medium span: ≥768px. Supports 0.5 increments, e.g. 4.5 */
|
|
23
23
|
md?: number;
|
|
24
|
-
/** Large span: ≥1200px */
|
|
24
|
+
/** Large span: ≥1200px. Supports 0.5 increments, e.g. 4.5 */
|
|
25
25
|
lg?: number;
|
|
26
26
|
className?: string;
|
|
27
27
|
style?: CSSProperties;
|
|
@@ -33,14 +33,15 @@ function Grid({
|
|
|
33
33
|
);
|
|
34
34
|
}
|
|
35
35
|
function GridItem({ children, base = 12, md, lg, className, style }) {
|
|
36
|
+
const toTrackSpan = (span) => span * 2;
|
|
36
37
|
return /* @__PURE__ */ jsx(
|
|
37
38
|
"div",
|
|
38
39
|
{
|
|
39
40
|
className: [styles.item, className].filter(Boolean).join(" "),
|
|
40
41
|
style: {
|
|
41
|
-
"--span-base": base,
|
|
42
|
-
...md != null ? { "--span-md": md } : {},
|
|
43
|
-
...lg != null ? { "--span-lg": lg } : {},
|
|
42
|
+
"--span-base": toTrackSpan(base),
|
|
43
|
+
...md != null ? { "--span-md": toTrackSpan(md) } : {},
|
|
44
|
+
...lg != null ? { "--span-lg": toTrackSpan(lg) } : {},
|
|
44
45
|
...style
|
|
45
46
|
},
|
|
46
47
|
children
|
|
@@ -56,10 +56,11 @@ function Hyperlink(props) {
|
|
|
56
56
|
disabled = false,
|
|
57
57
|
...rest
|
|
58
58
|
} = props;
|
|
59
|
+
const variantClassName = variant === "secondary" ? styles__default.default.secondary : variant === "header" ? styles__default.default.header : styles__default.default.primary;
|
|
59
60
|
const linkClassName = cx(
|
|
60
61
|
styles__default.default.link,
|
|
61
62
|
className,
|
|
62
|
-
|
|
63
|
+
variantClassName,
|
|
63
64
|
inline ? "" : styles__default.default.block,
|
|
64
65
|
disabled ? styles__default.default.disabled : ""
|
|
65
66
|
);
|
|
@@ -9,7 +9,8 @@ type BaseProps = {
|
|
|
9
9
|
* Instead, it will clone its only child (e.g. Next <Link>) and apply styling/props to it.
|
|
10
10
|
*/
|
|
11
11
|
asChild?: boolean;
|
|
12
|
-
|
|
12
|
+
/** 'header' uses --color-navbar-fg tokens — only meaningful when rendered inside/near AppHeader */
|
|
13
|
+
variant?: 'primary' | 'secondary' | 'header';
|
|
13
14
|
inline?: boolean;
|
|
14
15
|
disabled?: boolean;
|
|
15
16
|
};
|
|
@@ -31,10 +31,11 @@ function Hyperlink(props) {
|
|
|
31
31
|
disabled = false,
|
|
32
32
|
...rest
|
|
33
33
|
} = props;
|
|
34
|
+
const variantClassName = variant === "secondary" ? styles.secondary : variant === "header" ? styles.header : styles.primary;
|
|
34
35
|
const linkClassName = cx(
|
|
35
36
|
styles.link,
|
|
36
37
|
className,
|
|
37
|
-
|
|
38
|
+
variantClassName,
|
|
38
39
|
inline ? "" : styles.block,
|
|
39
40
|
disabled ? styles.disabled : ""
|
|
40
41
|
);
|
|
@@ -23,6 +23,22 @@
|
|
|
23
23
|
color: var(--color-fg-default);
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
+
.link.header {
|
|
27
|
+
color: var(--color-navbar-fg-muted);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.link.header:hover {
|
|
31
|
+
color: var(--color-navbar-fg);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.link.header:active {
|
|
35
|
+
color: var(--color-navbar-fg);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.link.header:focus-visible {
|
|
39
|
+
outline-color: var(--color-navbar-fg);
|
|
40
|
+
}
|
|
41
|
+
|
|
26
42
|
.link:hover {
|
|
27
43
|
color: var(--color-brand);
|
|
28
44
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
+
var react = require('react');
|
|
4
5
|
var client = require('../../client');
|
|
5
6
|
var styles = require('./MetricTile.module.css');
|
|
6
7
|
|
|
@@ -11,23 +12,91 @@ var styles__default = /*#__PURE__*/_interopDefault(styles);
|
|
|
11
12
|
function toSize(v) {
|
|
12
13
|
return typeof v === "number" ? `${v}px` : v;
|
|
13
14
|
}
|
|
14
|
-
function
|
|
15
|
+
function getSlotName(el) {
|
|
16
|
+
var _a;
|
|
17
|
+
const t = el.type;
|
|
18
|
+
return (_a = t.__METRIC_TILE_SLOT__) != null ? _a : null;
|
|
19
|
+
}
|
|
20
|
+
function splitSlots(children) {
|
|
21
|
+
const slots = {};
|
|
22
|
+
const rest = [];
|
|
23
|
+
react.Children.forEach(children, (child) => {
|
|
24
|
+
if (!react.isValidElement(child)) {
|
|
25
|
+
if (child != null) rest.push(child);
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
const slot = getSlotName(child);
|
|
29
|
+
if (!slot) {
|
|
30
|
+
rest.push(child);
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
slots[slot] = child;
|
|
34
|
+
});
|
|
35
|
+
return { slots, rest };
|
|
36
|
+
}
|
|
37
|
+
const MetricTileValue = ({
|
|
38
|
+
children
|
|
39
|
+
}) => {
|
|
40
|
+
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children });
|
|
41
|
+
};
|
|
42
|
+
MetricTileValue.__METRIC_TILE_SLOT__ = "Value";
|
|
43
|
+
MetricTileValue.displayName = "MetricTile.Value";
|
|
44
|
+
const MetricTileAdornment = ({ children }) => {
|
|
45
|
+
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children });
|
|
46
|
+
};
|
|
47
|
+
MetricTileAdornment.__METRIC_TILE_SLOT__ = "Adornment";
|
|
48
|
+
MetricTileAdornment.displayName = "MetricTile.Adornment";
|
|
49
|
+
const MetricTileBase = ({
|
|
15
50
|
severity,
|
|
16
51
|
label,
|
|
52
|
+
icon,
|
|
17
53
|
value,
|
|
18
54
|
tooltip,
|
|
19
55
|
size = "md",
|
|
56
|
+
variant = "filled",
|
|
20
57
|
minWidth,
|
|
21
|
-
maxWidth
|
|
22
|
-
|
|
58
|
+
maxWidth,
|
|
59
|
+
secondaryLabel,
|
|
60
|
+
secondaryValue,
|
|
61
|
+
children
|
|
62
|
+
}) => {
|
|
63
|
+
var _a, _b, _c;
|
|
23
64
|
const style = minWidth != null || maxWidth != null ? {
|
|
24
65
|
...minWidth != null ? { minWidth: toSize(minWidth) } : {},
|
|
25
66
|
...maxWidth != null ? { maxWidth: toSize(maxWidth) } : {}
|
|
26
67
|
} : void 0;
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
68
|
+
const { slots } = splitSlots(children);
|
|
69
|
+
const resolvedValue = (_b = (_a = slots.Value) == null ? void 0 : _a.props.children) != null ? _b : value;
|
|
70
|
+
const resolvedAdornment = (_c = slots.Adornment) == null ? void 0 : _c.props.children;
|
|
71
|
+
const showValueRow = resolvedValue != null || resolvedAdornment != null;
|
|
72
|
+
return /* @__PURE__ */ jsxRuntime.jsx(client.Tooltip, { content: tooltip, placement: "bottom", children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
73
|
+
"span",
|
|
74
|
+
{
|
|
75
|
+
className: styles__default.default.tile,
|
|
76
|
+
"data-severity": severity,
|
|
77
|
+
"data-size": size,
|
|
78
|
+
"data-variant": variant,
|
|
79
|
+
style,
|
|
80
|
+
children: [
|
|
81
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: styles__default.default.labelRow, children: [
|
|
82
|
+
icon != null ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: styles__default.default.icon, children: icon }) : null,
|
|
83
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: styles__default.default.label, children: label })
|
|
84
|
+
] }),
|
|
85
|
+
showValueRow ? /* @__PURE__ */ jsxRuntime.jsxs("span", { className: styles__default.default.valueRow, children: [
|
|
86
|
+
resolvedValue != null ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: styles__default.default.value, children: resolvedValue }) : null,
|
|
87
|
+
resolvedAdornment != null ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: styles__default.default.adornment, children: resolvedAdornment }) : null
|
|
88
|
+
] }) : null,
|
|
89
|
+
secondaryLabel != null && /* @__PURE__ */ jsxRuntime.jsxs("span", { className: styles__default.default.secondary, children: [
|
|
90
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: styles__default.default.secondaryLabel, children: secondaryLabel }),
|
|
91
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: styles__default.default.secondaryValue, children: secondaryValue })
|
|
92
|
+
] })
|
|
93
|
+
]
|
|
94
|
+
}
|
|
95
|
+
) });
|
|
96
|
+
};
|
|
97
|
+
const MetricTile = Object.assign(MetricTileBase, {
|
|
98
|
+
Value: MetricTileValue,
|
|
99
|
+
Adornment: MetricTileAdornment
|
|
100
|
+
});
|
|
32
101
|
|
|
33
102
|
exports.MetricTile = MetricTile;
|