@dbcdk/react-components 0.0.203 → 0.0.205
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 +5 -0
- package/dist/client.d.ts +2 -0
- package/dist/client.js +1 -0
- package/dist/components/alert/Alert.module.css +10 -30
- package/dist/components/callout/Callout.cjs +14 -0
- package/dist/components/callout/Callout.d.ts +15 -0
- package/dist/components/callout/Callout.js +8 -0
- package/dist/components/callout/Callout.module.css +44 -0
- package/dist/components/chip/Chip.d.ts +2 -1
- package/dist/components/chip/Chip.module.css +13 -0
- package/dist/components/forms/checkbox/Checkbox.cjs +7 -6
- package/dist/components/forms/checkbox/Checkbox.d.ts +4 -1
- package/dist/components/forms/checkbox/Checkbox.js +7 -6
- package/dist/components/forms/checkbox/Checkbox.module.css +6 -7
- package/dist/components/forms/form-select/FormSelect.module.css +10 -0
- package/dist/components/forms/input/Input.cjs +2 -1
- package/dist/components/forms/input/Input.js +2 -1
- package/dist/components/forms/input/Input.module.css +11 -130
- package/dist/components/forms/input-container/InputContainer.cjs +20 -7
- package/dist/components/forms/input-container/InputContainer.d.ts +4 -1
- package/dist/components/forms/input-container/InputContainer.js +21 -8
- package/dist/components/forms/input-container/InputContainer.module.css +33 -3
- package/dist/components/forms/select/Select.cjs +1 -1
- package/dist/components/forms/select/Select.js +1 -1
- package/dist/components/forms/select/Select.module.css +11 -33
- package/dist/components/forms/text-area/Textarea.cjs +1 -7
- package/dist/components/forms/text-area/Textarea.js +1 -7
- package/dist/components/forms/text-area/Textarea.module.css +11 -32
- package/dist/components/inline-status/InlineStatus.module.css +17 -28
- package/dist/index.cjs +7 -0
- package/dist/index.css +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/styles/styles.css +8 -0
- package/package.json +1 -1
package/dist/client.cjs
CHANGED
|
@@ -98,6 +98,7 @@ var CopyButton = require('./components/copy-button/CopyButton');
|
|
|
98
98
|
var Divider = require('./components/divider/Divider');
|
|
99
99
|
var Grid = require('./components/grid/Grid');
|
|
100
100
|
var Alert = require('./components/alert/Alert');
|
|
101
|
+
var Callout = require('./components/callout/Callout');
|
|
101
102
|
var InlineStatus = require('./components/inline-status/InlineStatus');
|
|
102
103
|
var MediaCard = require('./components/media-card/MediaCard');
|
|
103
104
|
var Lightbox = require('./components/lightbox/Lightbox');
|
|
@@ -570,6 +571,10 @@ Object.defineProperty(exports, "Alert", {
|
|
|
570
571
|
enumerable: true,
|
|
571
572
|
get: function () { return Alert.Alert; }
|
|
572
573
|
});
|
|
574
|
+
Object.defineProperty(exports, "Callout", {
|
|
575
|
+
enumerable: true,
|
|
576
|
+
get: function () { return Callout.Callout; }
|
|
577
|
+
});
|
|
573
578
|
Object.defineProperty(exports, "InlineStatus", {
|
|
574
579
|
enumerable: true,
|
|
575
580
|
get: function () { return InlineStatus.InlineStatus; }
|
package/dist/client.d.ts
CHANGED
|
@@ -164,6 +164,8 @@ export { Grid, GridItem } from './components/grid/Grid';
|
|
|
164
164
|
export type { GridGap, GridMaxWidth, GridProps, GridItemProps } from './components/grid/Grid';
|
|
165
165
|
export { Alert } from './components/alert/Alert';
|
|
166
166
|
export type { AlertProps } from './components/alert/Alert';
|
|
167
|
+
export { Callout } from './components/callout/Callout';
|
|
168
|
+
export type { CalloutProps } from './components/callout/Callout';
|
|
167
169
|
export { InlineStatus } from './components/inline-status/InlineStatus';
|
|
168
170
|
export type { InlineStatusProps } from './components/inline-status/InlineStatus';
|
|
169
171
|
export { MediaCard } from './components/media-card/MediaCard';
|
package/dist/client.js
CHANGED
|
@@ -96,6 +96,7 @@ export { CopyButton } from './components/copy-button/CopyButton';
|
|
|
96
96
|
export { Divider } from './components/divider/Divider';
|
|
97
97
|
export { Grid, GridItem } from './components/grid/Grid';
|
|
98
98
|
export { Alert } from './components/alert/Alert';
|
|
99
|
+
export { Callout } from './components/callout/Callout';
|
|
99
100
|
export { InlineStatus } from './components/inline-status/InlineStatus';
|
|
100
101
|
export { MediaCard } from './components/media-card/MediaCard';
|
|
101
102
|
export { Lightbox } from './components/lightbox/Lightbox';
|
|
@@ -1,18 +1,16 @@
|
|
|
1
1
|
.container {
|
|
2
|
-
--alert-bg: var(--color-bg-toolbar);
|
|
3
|
-
--alert-fg: var(--color-fg-default);
|
|
4
|
-
|
|
5
2
|
display: flex;
|
|
6
3
|
align-items: flex-start;
|
|
7
4
|
gap: var(--spacing-sm);
|
|
8
5
|
inline-size: min(100%, var(--alert-max-width, 72ch));
|
|
9
6
|
max-inline-size: 100%;
|
|
10
7
|
padding: var(--spacing-sm) var(--spacing-md);
|
|
8
|
+
border: var(--border-width-thin) solid var(--color-border-default);
|
|
9
|
+
/* Severity accent on the left edge, as on toasts. */
|
|
10
|
+
border-inline-start: var(--border-width-thick) solid var(--alert-accent);
|
|
11
11
|
border-radius: var(--border-radius-default);
|
|
12
|
-
background: var(--alert-bg);
|
|
13
|
-
color: var(--
|
|
14
|
-
/* Severity stripe on the left edge. An inset shadow keeps size and padding unchanged. */
|
|
15
|
-
box-shadow: inset var(--border-width-thick) 0 0 var(--alert-accent, transparent);
|
|
12
|
+
background: color-mix(in srgb, var(--alert-accent) 4%, var(--color-bg-surface));
|
|
13
|
+
color: var(--color-fg-default);
|
|
16
14
|
box-sizing: border-box;
|
|
17
15
|
}
|
|
18
16
|
|
|
@@ -66,53 +64,35 @@
|
|
|
66
64
|
}
|
|
67
65
|
|
|
68
66
|
.neutral {
|
|
69
|
-
--alert-
|
|
70
|
-
|
|
67
|
+
--alert-accent: var(--color-border-default);
|
|
68
|
+
background: var(--color-bg-surface-subtle);
|
|
71
69
|
}
|
|
72
70
|
|
|
73
71
|
.success {
|
|
74
|
-
--alert-bg: var(--color-status-success-bg);
|
|
75
|
-
--alert-fg: var(--color-status-success-fg);
|
|
76
72
|
--alert-accent: var(--color-status-success);
|
|
77
73
|
}
|
|
78
74
|
|
|
79
75
|
.warning {
|
|
80
|
-
--alert-bg: var(--color-status-warning-bg);
|
|
81
|
-
--alert-fg: var(--color-status-warning-fg);
|
|
82
76
|
--alert-accent: var(--color-status-warning);
|
|
83
77
|
}
|
|
84
78
|
|
|
85
79
|
.error {
|
|
86
|
-
--alert-bg: var(--color-status-error-bg);
|
|
87
|
-
--alert-fg: var(--color-status-error-fg);
|
|
88
80
|
--alert-accent: var(--color-status-error);
|
|
89
81
|
}
|
|
90
82
|
|
|
91
83
|
.info {
|
|
92
|
-
--alert-bg: var(--color-status-info-bg);
|
|
93
|
-
--alert-fg: var(--color-status-info-fg);
|
|
94
84
|
--alert-accent: var(--color-status-info);
|
|
95
85
|
}
|
|
96
86
|
|
|
97
87
|
.brand {
|
|
98
|
-
--alert-bg: color-mix(in srgb, var(--color-brand) 10%, var(--color-bg-surface));
|
|
99
|
-
--alert-fg: var(--color-brand);
|
|
100
88
|
--alert-accent: var(--color-brand);
|
|
101
89
|
}
|
|
102
90
|
|
|
103
91
|
.accent {
|
|
104
|
-
--alert-bg: var(--color-accent-bg);
|
|
105
|
-
--alert-fg: var(--color-accent-fg);
|
|
106
92
|
--alert-accent: var(--color-accent);
|
|
107
93
|
}
|
|
108
94
|
|
|
109
|
-
/*
|
|
110
|
-
.
|
|
111
|
-
|
|
112
|
-
.error,
|
|
113
|
-
.info,
|
|
114
|
-
.brand,
|
|
115
|
-
.accent {
|
|
116
|
-
border-top-left-radius: 0;
|
|
117
|
-
border-bottom-left-radius: 0;
|
|
95
|
+
/* The brand icon is light (made for brand backgrounds), so use the brand colour here. */
|
|
96
|
+
.brand .leading svg {
|
|
97
|
+
color: var(--color-brand);
|
|
118
98
|
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
+
var styles = require('./Callout.module.css');
|
|
5
|
+
|
|
6
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
7
|
+
|
|
8
|
+
var styles__default = /*#__PURE__*/_interopDefault(styles);
|
|
9
|
+
|
|
10
|
+
function Callout({ children, severity = "neutral" }) {
|
|
11
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: `${styles__default.default.callout} ${styles__default.default[severity]}`, children });
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
exports.Callout = Callout;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { JSX, ReactNode } from 'react';
|
|
2
|
+
import type { Severity } from '../../constants/severity.types';
|
|
3
|
+
export interface CalloutProps {
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
/** Colour of the bar on the left edge. */
|
|
6
|
+
severity?: Severity;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* A quiet box for extra content that belongs to what is right above it, e.g.
|
|
10
|
+
* help or examples under a form field. A light background and a bar on the
|
|
11
|
+
* left, without an outer border, so it doesn't look like an input or a card.
|
|
12
|
+
*
|
|
13
|
+
* Unlike Alert it has no icon, title or role: it isn't a message.
|
|
14
|
+
*/
|
|
15
|
+
export declare function Callout({ children, severity }: CalloutProps): JSX.Element;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import styles from './Callout.module.css';
|
|
3
|
+
|
|
4
|
+
function Callout({ children, severity = "neutral" }) {
|
|
5
|
+
return /* @__PURE__ */ jsx("div", { className: `${styles.callout} ${styles[severity]}`, children });
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export { Callout };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
.callout {
|
|
2
|
+
padding: var(--spacing-xs) var(--spacing-sm);
|
|
3
|
+
border-inline-start: var(--border-width-thick) solid var(--callout-accent);
|
|
4
|
+
border-radius: var(--border-radius-default);
|
|
5
|
+
background: var(--callout-bg);
|
|
6
|
+
color: var(--color-fg-default);
|
|
7
|
+
font-size: var(--font-size-sm);
|
|
8
|
+
overflow-wrap: anywhere;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.neutral {
|
|
12
|
+
--callout-accent: var(--color-border-strong);
|
|
13
|
+
--callout-bg: var(--color-bg-surface-subtle);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.success {
|
|
17
|
+
--callout-accent: var(--color-status-success);
|
|
18
|
+
--callout-bg: color-mix(in srgb, var(--color-status-success) 8%, var(--color-bg-surface));
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.warning {
|
|
22
|
+
--callout-accent: var(--color-status-warning);
|
|
23
|
+
--callout-bg: color-mix(in srgb, var(--color-status-warning) 8%, var(--color-bg-surface));
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.error {
|
|
27
|
+
--callout-accent: var(--color-status-error);
|
|
28
|
+
--callout-bg: color-mix(in srgb, var(--color-status-error) 8%, var(--color-bg-surface));
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.info {
|
|
32
|
+
--callout-accent: var(--color-status-info);
|
|
33
|
+
--callout-bg: color-mix(in srgb, var(--color-status-info) 8%, var(--color-bg-surface));
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.brand {
|
|
37
|
+
--callout-accent: var(--color-brand);
|
|
38
|
+
--callout-bg: color-mix(in srgb, var(--color-brand) 8%, var(--color-bg-surface));
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.accent {
|
|
42
|
+
--callout-accent: var(--color-accent);
|
|
43
|
+
--callout-bg: color-mix(in srgb, var(--color-accent) 8%, var(--color-bg-surface));
|
|
44
|
+
}
|
|
@@ -8,7 +8,8 @@ interface ChipProps {
|
|
|
8
8
|
loading?: boolean;
|
|
9
9
|
fullWidth?: boolean;
|
|
10
10
|
onClose?: () => void;
|
|
11
|
-
|
|
11
|
+
/** 'xs' fits inside a line of text, e.g. next to a form label */
|
|
12
|
+
size?: 'xs' | 'sm' | 'md' | 'lg';
|
|
12
13
|
type?: 'default' | 'rounded' | 'outlined';
|
|
13
14
|
selected?: boolean;
|
|
14
15
|
}
|
|
@@ -94,6 +94,19 @@
|
|
|
94
94
|
|
|
95
95
|
/* Sizes */
|
|
96
96
|
|
|
97
|
+
.xs {
|
|
98
|
+
height: auto;
|
|
99
|
+
padding-block: 0;
|
|
100
|
+
padding-inline: var(--spacing-xs);
|
|
101
|
+
font-size: var(--font-size-xs);
|
|
102
|
+
line-height: var(--line-height-tight);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.xs .leading svg {
|
|
106
|
+
inline-size: var(--icon-size-xs);
|
|
107
|
+
block-size: var(--icon-size-xs);
|
|
108
|
+
}
|
|
109
|
+
|
|
97
110
|
.sm {
|
|
98
111
|
height: var(--component-size-xs);
|
|
99
112
|
font-size: var(--font-size-xs);
|
|
@@ -6,6 +6,7 @@ var lucideReact = require('lucide-react');
|
|
|
6
6
|
var react = require('react');
|
|
7
7
|
var Tooltip = require('../../../components/overlay/tooltip/Tooltip');
|
|
8
8
|
var styles = require('./Checkbox.module.css');
|
|
9
|
+
var Circle = require('../../circle/Circle');
|
|
9
10
|
var InputContainer = require('../input-container/InputContainer');
|
|
10
11
|
var messageIds = require('../input-container/messageIds');
|
|
11
12
|
|
|
@@ -25,6 +26,7 @@ function Checkbox({
|
|
|
25
26
|
labelAction,
|
|
26
27
|
size = "md",
|
|
27
28
|
modified,
|
|
29
|
+
modifiedLabel = "\xC6ndret",
|
|
28
30
|
containerLabel,
|
|
29
31
|
error,
|
|
30
32
|
helpText,
|
|
@@ -52,12 +54,9 @@ function Checkbox({
|
|
|
52
54
|
const content = /* @__PURE__ */ jsxRuntime.jsxs(
|
|
53
55
|
"span",
|
|
54
56
|
{
|
|
55
|
-
className: [
|
|
56
|
-
styles__default.default.container,
|
|
57
|
-
size === "sm" ? styles__default.default.containerSm : "",
|
|
58
|
-
modified ? styles__default.default.modified : ""
|
|
59
|
-
].filter(Boolean).join(" "),
|
|
57
|
+
className: [styles__default.default.container, size === "sm" ? styles__default.default.containerSm : ""].filter(Boolean).join(" "),
|
|
60
58
|
"data-cy": dataCy,
|
|
59
|
+
"data-modified": modified ? "true" : void 0,
|
|
61
60
|
children: [
|
|
62
61
|
/* @__PURE__ */ jsxRuntime.jsx(Tooltip.Tooltip, { content: tooltip, placement: tooltipPlacement, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
63
62
|
"button",
|
|
@@ -82,6 +81,7 @@ function Checkbox({
|
|
|
82
81
|
}
|
|
83
82
|
) }),
|
|
84
83
|
label && (labelAs === "label" ? /* @__PURE__ */ jsxRuntime.jsx("label", { className: styles__default.default.label, htmlFor: controlId, children: label }) : /* @__PURE__ */ jsxRuntime.jsx("span", { className: styles__default.default.label, children: label })),
|
|
84
|
+
modified && label && !containerLabel && /* @__PURE__ */ jsxRuntime.jsx("span", { className: styles__default.default.modifiedTag, children: /* @__PURE__ */ jsxRuntime.jsx(Circle.Circle, { size: "2xs", severity: "info", children: modifiedLabel }) }),
|
|
85
85
|
labelAction && !containerLabel && /* @__PURE__ */ jsxRuntime.jsx("span", { className: styles__default.default.labelAction, "data-checkbox-label-action": "true", children: labelAction }),
|
|
86
86
|
endAdornment && /* @__PURE__ */ jsxRuntime.jsx("span", { className: styles__default.default.endAdornment, "aria-hidden": endAdornmentAriaHidden, children: endAdornment })
|
|
87
87
|
]
|
|
@@ -91,7 +91,8 @@ function Checkbox({
|
|
|
91
91
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
92
92
|
InputContainer.InputContainer,
|
|
93
93
|
{
|
|
94
|
-
modified,
|
|
94
|
+
modified: containerLabel ? modified : false,
|
|
95
|
+
modifiedLabel,
|
|
95
96
|
label: containerLabel,
|
|
96
97
|
labelAction: containerLabel ? labelAction : void 0,
|
|
97
98
|
htmlFor: controlId,
|
|
@@ -8,7 +8,10 @@ interface CheckboxProps {
|
|
|
8
8
|
onChange?: (checked: boolean, event: React.MouseEvent<HTMLButtonElement>) => void;
|
|
9
9
|
variant?: Variant;
|
|
10
10
|
disabled?: boolean;
|
|
11
|
+
/** Marks the checkbox as changed since it was last saved. */
|
|
11
12
|
modified?: boolean;
|
|
13
|
+
/** Text shown for a modified checkbox. */
|
|
14
|
+
modifiedLabel?: string;
|
|
12
15
|
label?: ReactNode;
|
|
13
16
|
labelAs?: 'label' | 'span';
|
|
14
17
|
/**
|
|
@@ -43,5 +46,5 @@ interface CheckboxProps {
|
|
|
43
46
|
tooltip?: ReactNode;
|
|
44
47
|
tooltipPlacement?: TooltipPlacement;
|
|
45
48
|
}
|
|
46
|
-
export declare function Checkbox({ checked: controlled, onChange, variant, disabled, label, labelAs, endAdornment, endAdornmentAriaHidden, labelAction, size, modified, containerLabel, error, helpText, helpTextAddition, orientation, labelWidth, fullWidth, required, noContainer, id, 'data-cy': dataCy, tooltip, tooltipPlacement, }: CheckboxProps): JSX.Element;
|
|
49
|
+
export declare function Checkbox({ checked: controlled, onChange, variant, disabled, label, labelAs, endAdornment, endAdornmentAriaHidden, labelAction, size, modified, modifiedLabel, containerLabel, error, helpText, helpTextAddition, orientation, labelWidth, fullWidth, required, noContainer, id, 'data-cy': dataCy, tooltip, tooltipPlacement, }: CheckboxProps): JSX.Element;
|
|
47
50
|
export {};
|
|
@@ -4,6 +4,7 @@ import { Check } from 'lucide-react';
|
|
|
4
4
|
import { useState, useId } from 'react';
|
|
5
5
|
import { Tooltip } from '../../../components/overlay/tooltip/Tooltip';
|
|
6
6
|
import styles from './Checkbox.module.css';
|
|
7
|
+
import { Circle } from '../../circle/Circle';
|
|
7
8
|
import { InputContainer } from '../input-container/InputContainer';
|
|
8
9
|
import { getDescribedBy } from '../input-container/messageIds';
|
|
9
10
|
|
|
@@ -19,6 +20,7 @@ function Checkbox({
|
|
|
19
20
|
labelAction,
|
|
20
21
|
size = "md",
|
|
21
22
|
modified,
|
|
23
|
+
modifiedLabel = "\xC6ndret",
|
|
22
24
|
containerLabel,
|
|
23
25
|
error,
|
|
24
26
|
helpText,
|
|
@@ -46,12 +48,9 @@ function Checkbox({
|
|
|
46
48
|
const content = /* @__PURE__ */ jsxs(
|
|
47
49
|
"span",
|
|
48
50
|
{
|
|
49
|
-
className: [
|
|
50
|
-
styles.container,
|
|
51
|
-
size === "sm" ? styles.containerSm : "",
|
|
52
|
-
modified ? styles.modified : ""
|
|
53
|
-
].filter(Boolean).join(" "),
|
|
51
|
+
className: [styles.container, size === "sm" ? styles.containerSm : ""].filter(Boolean).join(" "),
|
|
54
52
|
"data-cy": dataCy,
|
|
53
|
+
"data-modified": modified ? "true" : void 0,
|
|
55
54
|
children: [
|
|
56
55
|
/* @__PURE__ */ jsx(Tooltip, { content: tooltip, placement: tooltipPlacement, children: /* @__PURE__ */ jsx(
|
|
57
56
|
"button",
|
|
@@ -76,6 +75,7 @@ function Checkbox({
|
|
|
76
75
|
}
|
|
77
76
|
) }),
|
|
78
77
|
label && (labelAs === "label" ? /* @__PURE__ */ jsx("label", { className: styles.label, htmlFor: controlId, children: label }) : /* @__PURE__ */ jsx("span", { className: styles.label, children: label })),
|
|
78
|
+
modified && label && !containerLabel && /* @__PURE__ */ jsx("span", { className: styles.modifiedTag, children: /* @__PURE__ */ jsx(Circle, { size: "2xs", severity: "info", children: modifiedLabel }) }),
|
|
79
79
|
labelAction && !containerLabel && /* @__PURE__ */ jsx("span", { className: styles.labelAction, "data-checkbox-label-action": "true", children: labelAction }),
|
|
80
80
|
endAdornment && /* @__PURE__ */ jsx("span", { className: styles.endAdornment, "aria-hidden": endAdornmentAriaHidden, children: endAdornment })
|
|
81
81
|
]
|
|
@@ -85,7 +85,8 @@ function Checkbox({
|
|
|
85
85
|
return /* @__PURE__ */ jsx(
|
|
86
86
|
InputContainer,
|
|
87
87
|
{
|
|
88
|
-
modified,
|
|
88
|
+
modified: containerLabel ? modified : false,
|
|
89
|
+
modifiedLabel,
|
|
89
90
|
label: containerLabel,
|
|
90
91
|
labelAction: containerLabel ? labelAction : void 0,
|
|
91
92
|
htmlFor: controlId,
|
|
@@ -7,13 +7,6 @@
|
|
|
7
7
|
color: var(--color-fg-default);
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
-
.container.modified {
|
|
11
|
-
background-color: color-mix(in srgb, var(--color-status-warning-bg) 75%, transparent);
|
|
12
|
-
border-radius: var(--border-radius-default);
|
|
13
|
-
padding: 0;
|
|
14
|
-
display: inline-flex;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
10
|
.containerSm {
|
|
18
11
|
gap: var(--spacing-xs);
|
|
19
12
|
}
|
|
@@ -135,3 +128,9 @@
|
|
|
135
128
|
color: var(--color-fg-on-brand);
|
|
136
129
|
}
|
|
137
130
|
}
|
|
131
|
+
|
|
132
|
+
.modifiedTag {
|
|
133
|
+
display: inline-flex;
|
|
134
|
+
flex-shrink: 0;
|
|
135
|
+
color: var(--color-fg-subtle);
|
|
136
|
+
}
|
|
@@ -253,3 +253,13 @@
|
|
|
253
253
|
.trailingButton:disabled svg {
|
|
254
254
|
opacity: 0.4;
|
|
255
255
|
}
|
|
256
|
+
|
|
257
|
+
/* Error */
|
|
258
|
+
.input[aria-invalid='true'],
|
|
259
|
+
.input[aria-invalid='true']:hover {
|
|
260
|
+
border-color: var(--color-status-error);
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
.container:has(.input[aria-invalid='true']):focus-within {
|
|
264
|
+
box-shadow: 0 0 0 2px var(--color-status-error);
|
|
265
|
+
}
|
|
@@ -126,7 +126,7 @@ const Input = react.forwardRef(function Input2({
|
|
|
126
126
|
styles__default.default[variant],
|
|
127
127
|
icon ? styles__default.default.fieldWithIcon : "",
|
|
128
128
|
inputSize ? styles__default.default[inputSize] : "",
|
|
129
|
-
|
|
129
|
+
error ? styles__default.default.invalid : "",
|
|
130
130
|
fieldClassName != null ? fieldClassName : ""
|
|
131
131
|
].filter(Boolean).join(" "),
|
|
132
132
|
"data-forminput": "field",
|
|
@@ -141,6 +141,7 @@ const Input = react.forwardRef(function Input2({
|
|
|
141
141
|
{
|
|
142
142
|
...inputProps,
|
|
143
143
|
id: inputId,
|
|
144
|
+
"aria-invalid": error ? true : inputProps["aria-invalid"],
|
|
144
145
|
"aria-describedby": messageIds.getDescribedBy(
|
|
145
146
|
inputId,
|
|
146
147
|
{ error, helpText },
|
|
@@ -120,7 +120,7 @@ const Input = forwardRef(function Input2({
|
|
|
120
120
|
styles[variant],
|
|
121
121
|
icon ? styles.fieldWithIcon : "",
|
|
122
122
|
inputSize ? styles[inputSize] : "",
|
|
123
|
-
|
|
123
|
+
error ? styles.invalid : "",
|
|
124
124
|
fieldClassName != null ? fieldClassName : ""
|
|
125
125
|
].filter(Boolean).join(" "),
|
|
126
126
|
"data-forminput": "field",
|
|
@@ -135,6 +135,7 @@ const Input = forwardRef(function Input2({
|
|
|
135
135
|
{
|
|
136
136
|
...inputProps,
|
|
137
137
|
id: inputId,
|
|
138
|
+
"aria-invalid": error ? true : inputProps["aria-invalid"],
|
|
138
139
|
"aria-describedby": getDescribedBy(
|
|
139
140
|
inputId,
|
|
140
141
|
{ error, helpText },
|
|
@@ -140,14 +140,6 @@
|
|
|
140
140
|
--input-autofill-ring: var(--color-navbar-fg);
|
|
141
141
|
}
|
|
142
142
|
|
|
143
|
-
.modified {
|
|
144
|
-
--input-autofill-ring: color-mix(
|
|
145
|
-
in srgb,
|
|
146
|
-
var(--color-status-warning-border) 55%,
|
|
147
|
-
var(--color-border-default)
|
|
148
|
-
);
|
|
149
|
-
}
|
|
150
|
-
|
|
151
143
|
.embedded:has(.input:-webkit-autofill)::after {
|
|
152
144
|
content: none;
|
|
153
145
|
}
|
|
@@ -309,128 +301,6 @@
|
|
|
309
301
|
color: var(--color-navbar-fg);
|
|
310
302
|
}
|
|
311
303
|
|
|
312
|
-
/* =========================
|
|
313
|
-
Modified state
|
|
314
|
-
========================= */
|
|
315
|
-
|
|
316
|
-
.modified {
|
|
317
|
-
background-color: color-mix(in srgb, var(--color-status-warning-bg) 22%, var(--color-bg-surface));
|
|
318
|
-
border-color: color-mix(
|
|
319
|
-
in srgb,
|
|
320
|
-
var(--color-status-warning-border) 45%,
|
|
321
|
-
var(--color-border-default)
|
|
322
|
-
);
|
|
323
|
-
border-left-color: var(--color-status-warning-border);
|
|
324
|
-
border-left-width: 4px;
|
|
325
|
-
}
|
|
326
|
-
|
|
327
|
-
/* Hover should stay warm, not switch back to the normal border */
|
|
328
|
-
.modified:hover:not([aria-disabled='true']) {
|
|
329
|
-
background-color: color-mix(in srgb, var(--color-status-warning-bg) 28%, var(--color-bg-surface));
|
|
330
|
-
border-color: color-mix(
|
|
331
|
-
in srgb,
|
|
332
|
-
var(--color-status-warning-border) 60%,
|
|
333
|
-
var(--color-border-default)
|
|
334
|
-
);
|
|
335
|
-
border-left-color: var(--color-status-warning-border);
|
|
336
|
-
}
|
|
337
|
-
|
|
338
|
-
/* Focus should also stay warm and readable */
|
|
339
|
-
.modified:focus-within:not([aria-disabled='true']) {
|
|
340
|
-
background-color: color-mix(in srgb, var(--color-status-warning-bg) 28%, var(--color-bg-surface));
|
|
341
|
-
border-color: color-mix(
|
|
342
|
-
in srgb,
|
|
343
|
-
var(--color-status-warning-border) 75%,
|
|
344
|
-
var(--color-border-default)
|
|
345
|
-
);
|
|
346
|
-
border-left-color: var(--color-status-warning-border);
|
|
347
|
-
box-shadow: inset 0 0 0 1px
|
|
348
|
-
color-mix(in srgb, var(--color-status-warning-border) 55%, var(--color-border-default));
|
|
349
|
-
}
|
|
350
|
-
|
|
351
|
-
/* Variant-specific tweaks when modified */
|
|
352
|
-
.surface.modified {
|
|
353
|
-
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
|
|
354
|
-
}
|
|
355
|
-
|
|
356
|
-
.surface.modified:hover:not([aria-disabled='true']) {
|
|
357
|
-
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
|
|
358
|
-
}
|
|
359
|
-
|
|
360
|
-
.surface.modified:focus-within:not([aria-disabled='true']) {
|
|
361
|
-
box-shadow: inset 0 0 0 1px
|
|
362
|
-
color-mix(in srgb, var(--color-status-warning-border) 55%, var(--color-border-default));
|
|
363
|
-
}
|
|
364
|
-
|
|
365
|
-
.subtle.modified {
|
|
366
|
-
background-color: color-mix(in srgb, var(--color-status-warning-bg) 30%, var(--color-bg-toolbar));
|
|
367
|
-
border-color: transparent;
|
|
368
|
-
border-left-color: var(--color-status-warning-border);
|
|
369
|
-
border-left-width: 4px;
|
|
370
|
-
box-shadow: none;
|
|
371
|
-
}
|
|
372
|
-
|
|
373
|
-
.subtle.modified:hover:not([aria-disabled='true']) {
|
|
374
|
-
background-color: color-mix(
|
|
375
|
-
in srgb,
|
|
376
|
-
var(--color-status-warning-bg) 36%,
|
|
377
|
-
var(--color-bg-toolbar-hover)
|
|
378
|
-
);
|
|
379
|
-
}
|
|
380
|
-
|
|
381
|
-
.subtle.modified:focus-within:not([aria-disabled='true']) {
|
|
382
|
-
border-color: color-mix(
|
|
383
|
-
in srgb,
|
|
384
|
-
var(--color-status-warning-border) 75%,
|
|
385
|
-
var(--color-border-default)
|
|
386
|
-
);
|
|
387
|
-
border-left-color: var(--color-status-warning-border);
|
|
388
|
-
box-shadow: inset 0 0 0 1px
|
|
389
|
-
color-mix(in srgb, var(--color-status-warning-border) 55%, var(--color-border-default));
|
|
390
|
-
}
|
|
391
|
-
|
|
392
|
-
.standalone.modified {
|
|
393
|
-
box-shadow: var(--shadow-xs), var(--shadow-md);
|
|
394
|
-
}
|
|
395
|
-
|
|
396
|
-
.standalone.modified:hover:not([aria-disabled='true']) {
|
|
397
|
-
box-shadow: var(--shadow-sm), var(--shadow-md);
|
|
398
|
-
}
|
|
399
|
-
|
|
400
|
-
.standalone.modified:focus-within:not([aria-disabled='true']) {
|
|
401
|
-
box-shadow:
|
|
402
|
-
var(--shadow-xs),
|
|
403
|
-
var(--shadow-md),
|
|
404
|
-
inset 0 0 0 1px
|
|
405
|
-
color-mix(in srgb, var(--color-status-warning-border) 55%, var(--color-border-default));
|
|
406
|
-
}
|
|
407
|
-
|
|
408
|
-
/* Embedded should stay visually light, but can still get the marker */
|
|
409
|
-
.embedded.modified {
|
|
410
|
-
background-color: color-mix(in srgb, var(--color-status-warning-bg) 18%, transparent);
|
|
411
|
-
border-color: transparent;
|
|
412
|
-
border-left-color: var(--color-status-warning-border);
|
|
413
|
-
border-left-width: 3px;
|
|
414
|
-
box-shadow: none;
|
|
415
|
-
}
|
|
416
|
-
|
|
417
|
-
.embedded.modified:hover:not([aria-disabled='true']),
|
|
418
|
-
.embedded.modified:focus-within:not([aria-disabled='true']) {
|
|
419
|
-
background-color: color-mix(in srgb, var(--color-status-warning-bg) 22%, transparent);
|
|
420
|
-
border-color: transparent;
|
|
421
|
-
border-left-color: var(--color-status-warning-border);
|
|
422
|
-
box-shadow: none;
|
|
423
|
-
}
|
|
424
|
-
|
|
425
|
-
/* Disabled modified state */
|
|
426
|
-
.modified[aria-disabled='true'] {
|
|
427
|
-
background-color: var(--color-disabled-bg);
|
|
428
|
-
border-color: var(--color-disabled-border);
|
|
429
|
-
border-left-color: var(--color-disabled-border);
|
|
430
|
-
border-left-width: var(--border-width-thin);
|
|
431
|
-
box-shadow: none;
|
|
432
|
-
}
|
|
433
|
-
|
|
434
304
|
/* Sizes */
|
|
435
305
|
.xs {
|
|
436
306
|
block-size: var(--component-size-xs);
|
|
@@ -602,3 +472,14 @@
|
|
|
602
472
|
opacity: 1;
|
|
603
473
|
pointer-events: auto;
|
|
604
474
|
}
|
|
475
|
+
|
|
476
|
+
/* Error: wins over the variant's own border, hover and focus colours */
|
|
477
|
+
.field.invalid,
|
|
478
|
+
.field.invalid:hover:not([aria-disabled='true']) {
|
|
479
|
+
border-color: var(--color-status-error);
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
.field.invalid:focus-within:not([aria-disabled='true']) {
|
|
483
|
+
border-color: var(--color-status-error);
|
|
484
|
+
box-shadow: inset 0 0 0 1px var(--color-status-error);
|
|
485
|
+
}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
+
var lucideReact = require('lucide-react');
|
|
4
5
|
var styles = require('./InputContainer.module.css');
|
|
5
6
|
var messageIds = require('./messageIds');
|
|
6
|
-
var
|
|
7
|
+
var Circle = require('../../circle/Circle');
|
|
7
8
|
|
|
8
9
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
10
|
|
|
@@ -23,18 +24,28 @@ function InputContainer({
|
|
|
23
24
|
size = "md",
|
|
24
25
|
labelWidth = "160px",
|
|
25
26
|
labelAlignment = "center",
|
|
26
|
-
modified = false
|
|
27
|
+
modified = false,
|
|
28
|
+
modifiedLabel = "\xC6ndret"
|
|
27
29
|
}) {
|
|
28
|
-
const
|
|
30
|
+
const modifiedTag = modified && label ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: styles__default.default.modifiedTag, children: /* @__PURE__ */ jsxRuntime.jsx(Circle.Circle, { size: "2xs", severity: "info", children: modifiedLabel }) }) : null;
|
|
31
|
+
const labelRow = (withModifiedTag) => (label || labelAction) && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `${styles__default.default.labelRow} dbc-flex dbc-items-center dbc-gap-xs`, children: [
|
|
29
32
|
label && /* @__PURE__ */ jsxRuntime.jsxs("label", { className: styles__default.default.label, htmlFor, children: [
|
|
30
33
|
label,
|
|
31
34
|
required && /* @__PURE__ */ jsxRuntime.jsx("span", { className: styles__default.default.required, children: " *" })
|
|
32
35
|
] }),
|
|
36
|
+
withModifiedTag && modifiedTag,
|
|
33
37
|
labelAction && /* @__PURE__ */ jsxRuntime.jsx("span", { "data-input-container-label-action": "true", children: labelAction })
|
|
34
38
|
] });
|
|
39
|
+
const renderLabelRow = orientation === "vertical" ? labelRow(true) : modifiedTag ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles__default.default.horizontalLabel, children: [
|
|
40
|
+
labelRow(false),
|
|
41
|
+
modifiedTag
|
|
42
|
+
] }) : labelRow(false);
|
|
35
43
|
const messageIds$1 = htmlFor ? messageIds.getMessageIds(htmlFor) : void 0;
|
|
36
44
|
const renderMessageRow = (error || helpText || helpTextAddition) && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "dbc-flex dbc-flex-column dbc-gap-xxs", children: [
|
|
37
|
-
error && /* @__PURE__ */ jsxRuntime.
|
|
45
|
+
error && /* @__PURE__ */ jsxRuntime.jsxs("div", { id: messageIds$1 == null ? void 0 : messageIds$1.errorId, className: `${styles__default.default.errorText} ${styles__default.default.messageRow}`, children: [
|
|
46
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.CircleAlert, { className: styles__default.default.errorIcon, "aria-hidden": "true" }),
|
|
47
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: error })
|
|
48
|
+
] }),
|
|
38
49
|
(helpText || helpTextAddition) && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `${styles__default.default.helpText} ${styles__default.default.messageRow}`, children: [
|
|
39
50
|
/* @__PURE__ */ jsxRuntime.jsx("span", { id: messageIds$1 == null ? void 0 : messageIds$1.helpTextId, children: helpText }),
|
|
40
51
|
helpTextAddition && /* @__PURE__ */ jsxRuntime.jsx("span", { className: styles__default.default.helpTextAddition, children: helpTextAddition })
|
|
@@ -49,8 +60,10 @@ function InputContainer({
|
|
|
49
60
|
style: { width: fullWidth ? "100%" : void 0 },
|
|
50
61
|
children: [
|
|
51
62
|
renderLabelRow,
|
|
52
|
-
children
|
|
53
|
-
|
|
63
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "dbc-flex dbc-flex-column dbc-gap-xxs", children: [
|
|
64
|
+
children,
|
|
65
|
+
renderMessageRow
|
|
66
|
+
] })
|
|
54
67
|
]
|
|
55
68
|
}
|
|
56
69
|
);
|
|
@@ -64,7 +77,7 @@ function InputContainer({
|
|
|
64
77
|
"--label-width": labelWidth,
|
|
65
78
|
width: fullWidth ? "100%" : void 0
|
|
66
79
|
},
|
|
67
|
-
children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `${styles__default.default.horizontal} dbc-flex dbc-flex-column dbc-gap-
|
|
80
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `${styles__default.default.horizontal} dbc-flex dbc-flex-column dbc-gap-xxs`, "data-size": size, children: [
|
|
68
81
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
69
82
|
"div",
|
|
70
83
|
{
|
|
@@ -13,6 +13,9 @@ export interface InputContainerProps {
|
|
|
13
13
|
size?: 'sm' | 'md' | 'lg';
|
|
14
14
|
labelWidth?: string;
|
|
15
15
|
labelAlignment?: 'top' | 'center';
|
|
16
|
+
/** Marks the field as changed since it was last saved. */
|
|
16
17
|
modified?: boolean;
|
|
18
|
+
/** Text shown for a modified field. */
|
|
19
|
+
modifiedLabel?: string;
|
|
17
20
|
}
|
|
18
|
-
export declare function InputContainer({ label, labelAction, htmlFor, error, helpText, helpTextAddition, fullWidth, required, children, orientation, size, labelWidth, labelAlignment, modified, }: InputContainerProps): React.ReactElement;
|
|
21
|
+
export declare function InputContainer({ label, labelAction, htmlFor, error, helpText, helpTextAddition, fullWidth, required, children, orientation, size, labelWidth, labelAlignment, modified, modifiedLabel, }: InputContainerProps): React.ReactElement;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
|
+
import { CircleAlert } from 'lucide-react';
|
|
2
3
|
import styles from './InputContainer.module.css';
|
|
3
4
|
import { getMessageIds } from './messageIds';
|
|
4
|
-
import {
|
|
5
|
+
import { Circle } from '../../circle/Circle';
|
|
5
6
|
|
|
6
7
|
function InputContainer({
|
|
7
8
|
label,
|
|
@@ -17,18 +18,28 @@ function InputContainer({
|
|
|
17
18
|
size = "md",
|
|
18
19
|
labelWidth = "160px",
|
|
19
20
|
labelAlignment = "center",
|
|
20
|
-
modified = false
|
|
21
|
+
modified = false,
|
|
22
|
+
modifiedLabel = "\xC6ndret"
|
|
21
23
|
}) {
|
|
22
|
-
const
|
|
24
|
+
const modifiedTag = modified && label ? /* @__PURE__ */ jsx("span", { className: styles.modifiedTag, children: /* @__PURE__ */ jsx(Circle, { size: "2xs", severity: "info", children: modifiedLabel }) }) : null;
|
|
25
|
+
const labelRow = (withModifiedTag) => (label || labelAction) && /* @__PURE__ */ jsxs("div", { className: `${styles.labelRow} dbc-flex dbc-items-center dbc-gap-xs`, children: [
|
|
23
26
|
label && /* @__PURE__ */ jsxs("label", { className: styles.label, htmlFor, children: [
|
|
24
27
|
label,
|
|
25
28
|
required && /* @__PURE__ */ jsx("span", { className: styles.required, children: " *" })
|
|
26
29
|
] }),
|
|
30
|
+
withModifiedTag && modifiedTag,
|
|
27
31
|
labelAction && /* @__PURE__ */ jsx("span", { "data-input-container-label-action": "true", children: labelAction })
|
|
28
32
|
] });
|
|
33
|
+
const renderLabelRow = orientation === "vertical" ? labelRow(true) : modifiedTag ? /* @__PURE__ */ jsxs("div", { className: styles.horizontalLabel, children: [
|
|
34
|
+
labelRow(false),
|
|
35
|
+
modifiedTag
|
|
36
|
+
] }) : labelRow(false);
|
|
29
37
|
const messageIds = htmlFor ? getMessageIds(htmlFor) : void 0;
|
|
30
38
|
const renderMessageRow = (error || helpText || helpTextAddition) && /* @__PURE__ */ jsxs("div", { className: "dbc-flex dbc-flex-column dbc-gap-xxs", children: [
|
|
31
|
-
error && /* @__PURE__ */
|
|
39
|
+
error && /* @__PURE__ */ jsxs("div", { id: messageIds == null ? void 0 : messageIds.errorId, className: `${styles.errorText} ${styles.messageRow}`, children: [
|
|
40
|
+
/* @__PURE__ */ jsx(CircleAlert, { className: styles.errorIcon, "aria-hidden": "true" }),
|
|
41
|
+
/* @__PURE__ */ jsx("span", { children: error })
|
|
42
|
+
] }),
|
|
32
43
|
(helpText || helpTextAddition) && /* @__PURE__ */ jsxs("div", { className: `${styles.helpText} ${styles.messageRow}`, children: [
|
|
33
44
|
/* @__PURE__ */ jsx("span", { id: messageIds == null ? void 0 : messageIds.helpTextId, children: helpText }),
|
|
34
45
|
helpTextAddition && /* @__PURE__ */ jsx("span", { className: styles.helpTextAddition, children: helpTextAddition })
|
|
@@ -43,8 +54,10 @@ function InputContainer({
|
|
|
43
54
|
style: { width: fullWidth ? "100%" : void 0 },
|
|
44
55
|
children: [
|
|
45
56
|
renderLabelRow,
|
|
46
|
-
children
|
|
47
|
-
|
|
57
|
+
/* @__PURE__ */ jsxs("div", { className: "dbc-flex dbc-flex-column dbc-gap-xxs", children: [
|
|
58
|
+
children,
|
|
59
|
+
renderMessageRow
|
|
60
|
+
] })
|
|
48
61
|
]
|
|
49
62
|
}
|
|
50
63
|
);
|
|
@@ -58,7 +71,7 @@ function InputContainer({
|
|
|
58
71
|
"--label-width": labelWidth,
|
|
59
72
|
width: fullWidth ? "100%" : void 0
|
|
60
73
|
},
|
|
61
|
-
children: /* @__PURE__ */ jsxs("div", { className: `${styles.horizontal} dbc-flex dbc-flex-column dbc-gap-
|
|
74
|
+
children: /* @__PURE__ */ jsxs("div", { className: `${styles.horizontal} dbc-flex dbc-flex-column dbc-gap-xxs`, "data-size": size, children: [
|
|
62
75
|
/* @__PURE__ */ jsxs(
|
|
63
76
|
"div",
|
|
64
77
|
{
|
|
@@ -23,14 +23,19 @@
|
|
|
23
23
|
|
|
24
24
|
.helpText {
|
|
25
25
|
color: var(--color-fg-subtle);
|
|
26
|
-
font-size: var(--font-size-
|
|
26
|
+
font-size: var(--font-size-xs);
|
|
27
27
|
display: flex;
|
|
28
|
-
|
|
28
|
+
/* Line the addition up with the first line of text, also when it wraps */
|
|
29
|
+
align-items: baseline;
|
|
29
30
|
justify-content: space-between;
|
|
31
|
+
gap: var(--spacing-sm);
|
|
30
32
|
}
|
|
31
33
|
|
|
32
34
|
.helpTextAddition {
|
|
33
35
|
color: var(--color-fg-subtle);
|
|
36
|
+
/* Never squeezed or wrapped by a long help text */
|
|
37
|
+
flex-shrink: 0;
|
|
38
|
+
white-space: nowrap;
|
|
34
39
|
}
|
|
35
40
|
|
|
36
41
|
.horizontal label {
|
|
@@ -38,8 +43,19 @@
|
|
|
38
43
|
}
|
|
39
44
|
|
|
40
45
|
.errorText {
|
|
46
|
+
display: flex;
|
|
47
|
+
align-items: flex-start;
|
|
48
|
+
gap: var(--spacing-xxs);
|
|
41
49
|
color: var(--color-status-error);
|
|
42
|
-
font-size: var(--font-size-
|
|
50
|
+
font-size: var(--font-size-xs);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/* Centred on the first line of the error text */
|
|
54
|
+
.errorIcon {
|
|
55
|
+
flex-shrink: 0;
|
|
56
|
+
inline-size: var(--icon-size-xs);
|
|
57
|
+
block-size: var(--icon-size-xs);
|
|
58
|
+
margin-block: calc((1lh - var(--icon-size-xs)) / 2);
|
|
43
59
|
}
|
|
44
60
|
|
|
45
61
|
.required {
|
|
@@ -50,3 +66,17 @@
|
|
|
50
66
|
.messageRow {
|
|
51
67
|
min-height: 1lh;
|
|
52
68
|
}
|
|
69
|
+
|
|
70
|
+
/* Modified: a status dot with text next to the label, not a style on the field */
|
|
71
|
+
.modifiedTag {
|
|
72
|
+
display: inline-flex;
|
|
73
|
+
flex-shrink: 0;
|
|
74
|
+
color: var(--color-fg-subtle);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.horizontalLabel {
|
|
78
|
+
display: flex;
|
|
79
|
+
flex-direction: column;
|
|
80
|
+
align-items: flex-start;
|
|
81
|
+
flex-shrink: 0;
|
|
82
|
+
}
|
|
@@ -240,7 +240,7 @@ function Select({
|
|
|
240
240
|
"aria-controls": listboxId,
|
|
241
241
|
"aria-invalid": Boolean(error) || void 0,
|
|
242
242
|
"aria-describedby": describedBy,
|
|
243
|
-
className:
|
|
243
|
+
className: error ? styles__default.default.triggerInvalid : void 0,
|
|
244
244
|
children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
245
245
|
"span",
|
|
246
246
|
{
|
|
@@ -234,7 +234,7 @@ function Select({
|
|
|
234
234
|
"aria-controls": listboxId,
|
|
235
235
|
"aria-invalid": Boolean(error) || void 0,
|
|
236
236
|
"aria-describedby": describedBy,
|
|
237
|
-
className:
|
|
237
|
+
className: error ? styles.triggerInvalid : void 0,
|
|
238
238
|
children: /* @__PURE__ */ jsxs(
|
|
239
239
|
"span",
|
|
240
240
|
{
|
|
@@ -1,36 +1,3 @@
|
|
|
1
|
-
.triggerModified {
|
|
2
|
-
background-color: color-mix(in srgb, var(--color-status-warning-bg) 22%, var(--color-bg-surface));
|
|
3
|
-
border-color: color-mix(
|
|
4
|
-
in srgb,
|
|
5
|
-
var(--color-status-warning-border) 45%,
|
|
6
|
-
var(--color-border-default)
|
|
7
|
-
);
|
|
8
|
-
border-left-color: var(--color-status-warning-border);
|
|
9
|
-
border-left-width: 4px;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
.triggerModified:hover:not([disabled]) {
|
|
13
|
-
background-color: color-mix(in srgb, var(--color-status-warning-bg) 28%, var(--color-bg-surface));
|
|
14
|
-
border-color: color-mix(
|
|
15
|
-
in srgb,
|
|
16
|
-
var(--color-status-warning-border) 60%,
|
|
17
|
-
var(--color-border-default)
|
|
18
|
-
);
|
|
19
|
-
border-left-color: var(--color-status-warning-border);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
.triggerModified:focus-visible {
|
|
23
|
-
background-color: color-mix(in srgb, var(--color-status-warning-bg) 28%, var(--color-bg-surface));
|
|
24
|
-
border-color: color-mix(
|
|
25
|
-
in srgb,
|
|
26
|
-
var(--color-status-warning-border) 75%,
|
|
27
|
-
var(--color-border-default)
|
|
28
|
-
);
|
|
29
|
-
border-left-color: var(--color-status-warning-border);
|
|
30
|
-
box-shadow: inset 0 0 0 1px
|
|
31
|
-
color-mix(in srgb, var(--color-status-warning-border) 55%, var(--color-border-default));
|
|
32
|
-
}
|
|
33
|
-
|
|
34
1
|
.selectedOption > button {
|
|
35
2
|
background-color: var(--color-bg-toolbar-hover);
|
|
36
3
|
}
|
|
@@ -39,3 +6,14 @@
|
|
|
39
6
|
.selectedOption > button:focus-visible {
|
|
40
7
|
background-color: var(--color-bg-toolbar-hover);
|
|
41
8
|
}
|
|
9
|
+
|
|
10
|
+
/* Error (the attribute raises specificity above Button's own border styles) */
|
|
11
|
+
.triggerInvalid[data-forminput],
|
|
12
|
+
.triggerInvalid[data-forminput]:hover:not([disabled]) {
|
|
13
|
+
border-color: var(--color-status-error);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.triggerInvalid[data-forminput]:focus-visible {
|
|
17
|
+
border-color: var(--color-status-error);
|
|
18
|
+
box-shadow: inset 0 0 0 1px var(--color-status-error);
|
|
19
|
+
}
|
|
@@ -107,13 +107,7 @@ const Textarea = function Textarea2({
|
|
|
107
107
|
fullWidth,
|
|
108
108
|
required,
|
|
109
109
|
labelAction,
|
|
110
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
111
|
-
"div",
|
|
112
|
-
{
|
|
113
|
-
className: [styles__default.default.container, modified ? styles__default.default.modified : ""].filter(Boolean).join(" "),
|
|
114
|
-
children: /* @__PURE__ */ jsxRuntime.jsx("div", { ...tooltipEnabled ? triggerProps : {}, children: inputField })
|
|
115
|
-
}
|
|
116
|
-
)
|
|
110
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: [styles__default.default.container, error ? styles__default.default.invalid : ""].filter(Boolean).join(" "), children: /* @__PURE__ */ jsxRuntime.jsx("div", { ...tooltipEnabled ? triggerProps : {}, children: inputField }) })
|
|
117
111
|
}
|
|
118
112
|
);
|
|
119
113
|
};
|
|
@@ -101,13 +101,7 @@ const Textarea = function Textarea2({
|
|
|
101
101
|
fullWidth,
|
|
102
102
|
required,
|
|
103
103
|
labelAction,
|
|
104
|
-
children: /* @__PURE__ */ jsx(
|
|
105
|
-
"div",
|
|
106
|
-
{
|
|
107
|
-
className: [styles.container, modified ? styles.modified : ""].filter(Boolean).join(" "),
|
|
108
|
-
children: /* @__PURE__ */ jsx("div", { ...tooltipEnabled ? triggerProps : {}, children: inputField })
|
|
109
|
-
}
|
|
110
|
-
)
|
|
104
|
+
children: /* @__PURE__ */ jsx("div", { className: [styles.container, error ? styles.invalid : ""].filter(Boolean).join(" "), children: /* @__PURE__ */ jsx("div", { ...tooltipEnabled ? triggerProps : {}, children: inputField }) })
|
|
111
105
|
}
|
|
112
106
|
);
|
|
113
107
|
};
|
|
@@ -2,38 +2,6 @@
|
|
|
2
2
|
flex-grow: 1;
|
|
3
3
|
}
|
|
4
4
|
|
|
5
|
-
.container.modified textarea {
|
|
6
|
-
background-color: color-mix(in srgb, var(--color-status-warning-bg) 22%, var(--color-bg-surface));
|
|
7
|
-
border-color: color-mix(
|
|
8
|
-
in srgb,
|
|
9
|
-
var(--color-status-warning-border) 45%,
|
|
10
|
-
var(--color-border-default)
|
|
11
|
-
);
|
|
12
|
-
border-left-color: var(--color-status-warning-border);
|
|
13
|
-
border-left-width: 4px;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
.container.modified textarea:hover {
|
|
17
|
-
background-color: color-mix(in srgb, var(--color-status-warning-bg) 28%, var(--color-bg-surface));
|
|
18
|
-
border-color: color-mix(
|
|
19
|
-
in srgb,
|
|
20
|
-
var(--color-status-warning-border) 60%,
|
|
21
|
-
var(--color-border-default)
|
|
22
|
-
);
|
|
23
|
-
border-left-color: var(--color-status-warning-border);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
.container.modified textarea:focus-visible {
|
|
27
|
-
background-color: color-mix(in srgb, var(--color-status-warning-bg) 28%, var(--color-bg-surface));
|
|
28
|
-
border-color: color-mix(
|
|
29
|
-
in srgb,
|
|
30
|
-
var(--color-status-warning-border) 75%,
|
|
31
|
-
var(--color-border-default)
|
|
32
|
-
);
|
|
33
|
-
border-left-color: var(--color-status-warning-border);
|
|
34
|
-
box-shadow: inset 0 0 0 1px
|
|
35
|
-
color-mix(in srgb, var(--color-status-warning-border) 55%, var(--color-border-default));
|
|
36
|
-
}
|
|
37
5
|
.container textarea {
|
|
38
6
|
width: 100%;
|
|
39
7
|
padding: var(--spacing-xs);
|
|
@@ -69,3 +37,14 @@
|
|
|
69
37
|
border-color: var(--color-field-focus);
|
|
70
38
|
box-shadow: inset 0 0 0 1px var(--color-field-focus);
|
|
71
39
|
}
|
|
40
|
+
|
|
41
|
+
/* Error */
|
|
42
|
+
.container.invalid textarea,
|
|
43
|
+
.container.invalid textarea:hover {
|
|
44
|
+
border-color: var(--color-status-error);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.container.invalid textarea:focus-visible {
|
|
48
|
+
border-color: var(--color-status-error);
|
|
49
|
+
box-shadow: inset 0 0 0 1px var(--color-status-error);
|
|
50
|
+
}
|
|
@@ -1,18 +1,15 @@
|
|
|
1
1
|
.container {
|
|
2
|
-
--inline-status-bg: var(--color-bg-toolbar);
|
|
3
|
-
--inline-status-fg: var(--color-fg-default);
|
|
4
|
-
--inline-status-border: var(--color-border-subtle);
|
|
5
|
-
|
|
6
2
|
display: inline-flex;
|
|
7
3
|
align-items: flex-start;
|
|
8
4
|
gap: var(--spacing-xs);
|
|
9
5
|
max-inline-size: 100%;
|
|
10
6
|
|
|
11
7
|
padding: var(--spacing-2xs) var(--spacing-sm);
|
|
12
|
-
border:
|
|
8
|
+
border: var(--border-width-thin) solid
|
|
9
|
+
color-mix(in srgb, var(--inline-status-accent) 25%, var(--color-border-default));
|
|
13
10
|
border-radius: var(--border-radius-default);
|
|
14
|
-
background: var(--inline-status-bg);
|
|
15
|
-
color: var(--
|
|
11
|
+
background: color-mix(in srgb, var(--inline-status-accent) 4%, var(--color-bg-surface));
|
|
12
|
+
color: var(--color-fg-default);
|
|
16
13
|
|
|
17
14
|
font-family: var(--font-family);
|
|
18
15
|
font-size: var(--font-size-sm);
|
|
@@ -56,43 +53,35 @@
|
|
|
56
53
|
}
|
|
57
54
|
|
|
58
55
|
.neutral {
|
|
59
|
-
--inline-status-
|
|
60
|
-
|
|
61
|
-
--inline-status-border: transparent;
|
|
56
|
+
--inline-status-accent: var(--color-border-default);
|
|
57
|
+
background: var(--color-bg-surface-subtle);
|
|
62
58
|
}
|
|
63
59
|
|
|
64
60
|
.success {
|
|
65
|
-
--inline-status-
|
|
66
|
-
--inline-status-fg: var(--color-status-success-fg);
|
|
67
|
-
--inline-status-border: var(--color-status-success-border);
|
|
61
|
+
--inline-status-accent: var(--color-status-success);
|
|
68
62
|
}
|
|
69
63
|
|
|
70
64
|
.warning {
|
|
71
|
-
--inline-status-
|
|
72
|
-
--inline-status-fg: var(--color-status-warning-fg);
|
|
73
|
-
--inline-status-border: var(--color-status-warning-border);
|
|
65
|
+
--inline-status-accent: var(--color-status-warning);
|
|
74
66
|
}
|
|
75
67
|
|
|
76
68
|
.error {
|
|
77
|
-
--inline-status-
|
|
78
|
-
--inline-status-fg: var(--color-status-error-fg);
|
|
79
|
-
--inline-status-border: var(--color-status-error-border);
|
|
69
|
+
--inline-status-accent: var(--color-status-error);
|
|
80
70
|
}
|
|
81
71
|
|
|
82
72
|
.info {
|
|
83
|
-
--inline-status-
|
|
84
|
-
--inline-status-fg: var(--color-status-info-fg);
|
|
85
|
-
--inline-status-border: var(--color-status-info-border);
|
|
73
|
+
--inline-status-accent: var(--color-status-info);
|
|
86
74
|
}
|
|
87
75
|
|
|
88
76
|
.brand {
|
|
89
|
-
--inline-status-
|
|
90
|
-
--inline-status-fg: var(--color-brand);
|
|
91
|
-
--inline-status-border: color-mix(in srgb, var(--color-brand) 35%, transparent);
|
|
77
|
+
--inline-status-accent: var(--color-brand);
|
|
92
78
|
}
|
|
93
79
|
|
|
94
80
|
.accent {
|
|
95
|
-
--inline-status-
|
|
96
|
-
|
|
97
|
-
|
|
81
|
+
--inline-status-accent: var(--color-accent);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/* The shared brand icon uses an on-brand colour; keep it visible on the faint tint. */
|
|
85
|
+
.brand .leading svg {
|
|
86
|
+
color: var(--color-brand);
|
|
98
87
|
}
|
package/dist/index.cjs
CHANGED
|
@@ -41,6 +41,7 @@ var Toast = require('./components/toast/Toast');
|
|
|
41
41
|
var Hyperlink = require('./components/hyperlink/Hyperlink');
|
|
42
42
|
var StatePage = require('./components/state-page/StatePage');
|
|
43
43
|
var Alert = require('./components/alert/Alert');
|
|
44
|
+
var Callout = require('./components/callout/Callout');
|
|
44
45
|
var InlineStatus = require('./components/inline-status/InlineStatus');
|
|
45
46
|
var MediaCard = require('./components/media-card/MediaCard');
|
|
46
47
|
var HighlightedText = require('./components/highlighted-text/HighlightedText');
|
|
@@ -299,6 +300,12 @@ Object.keys(Alert).forEach(function (k) {
|
|
|
299
300
|
get: function () { return Alert[k]; }
|
|
300
301
|
});
|
|
301
302
|
});
|
|
303
|
+
Object.keys(Callout).forEach(function (k) {
|
|
304
|
+
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
305
|
+
enumerable: true,
|
|
306
|
+
get: function () { return Callout[k]; }
|
|
307
|
+
});
|
|
308
|
+
});
|
|
302
309
|
Object.keys(InlineStatus).forEach(function (k) {
|
|
303
310
|
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
304
311
|
enumerable: true,
|
package/dist/index.css
CHANGED
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
@import './components/breadcrumbs/Breadcrumbs.module.css';
|
|
11
11
|
@import './components/button-select/ButtonSelect.module.css';
|
|
12
12
|
@import './components/button/Button.module.css';
|
|
13
|
+
@import './components/callout/Callout.module.css';
|
|
13
14
|
@import './components/card-container/CardContainer.module.css';
|
|
14
15
|
@import './components/card/Card.module.css';
|
|
15
16
|
@import './components/card/components/CardMeta.module.css';
|
package/dist/index.d.ts
CHANGED
|
@@ -40,6 +40,7 @@ export * from './components/toast/Toast';
|
|
|
40
40
|
export * from './components/hyperlink/Hyperlink';
|
|
41
41
|
export * from './components/state-page/StatePage';
|
|
42
42
|
export * from './components/alert/Alert';
|
|
43
|
+
export * from './components/callout/Callout';
|
|
43
44
|
export * from './components/inline-status/InlineStatus';
|
|
44
45
|
export * from './components/media-card/MediaCard';
|
|
45
46
|
export * from './components/highlighted-text/HighlightedText';
|
package/dist/index.js
CHANGED
|
@@ -39,6 +39,7 @@ export * from './components/toast/Toast';
|
|
|
39
39
|
export * from './components/hyperlink/Hyperlink';
|
|
40
40
|
export * from './components/state-page/StatePage';
|
|
41
41
|
export * from './components/alert/Alert';
|
|
42
|
+
export * from './components/callout/Callout';
|
|
42
43
|
export * from './components/inline-status/InlineStatus';
|
|
43
44
|
export * from './components/media-card/MediaCard';
|
|
44
45
|
export * from './components/highlighted-text/HighlightedText';
|
package/dist/styles/styles.css
CHANGED
|
@@ -251,10 +251,18 @@ tr.dbc-table--hover:hover td:last-child {
|
|
|
251
251
|
color: var(--color-fg-subtle);
|
|
252
252
|
}
|
|
253
253
|
|
|
254
|
+
.dbc-default-text {
|
|
255
|
+
color: var(--color-fg-default);
|
|
256
|
+
}
|
|
257
|
+
|
|
254
258
|
.dbc-tabular-nums {
|
|
255
259
|
font-variant-numeric: tabular-nums;
|
|
256
260
|
}
|
|
257
261
|
|
|
262
|
+
.dbc-xs-text {
|
|
263
|
+
font-size: var(--font-size-xs);
|
|
264
|
+
}
|
|
265
|
+
|
|
258
266
|
.dbc-sm-text {
|
|
259
267
|
font-size: var(--font-size-sm);
|
|
260
268
|
}
|