@dbcdk/react-components 0.0.46 → 0.0.48
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/circle/Circle.js +1 -1
- package/dist/components/circle/Circle.module.css +6 -1
- package/dist/components/datetime-picker/DateTimePicker.js +1 -1
- package/dist/components/datetime-picker/DateTimePicker.module.css +0 -5
- package/dist/components/filter-field/FilterField.js +7 -3
- package/dist/components/filter-field/FilterField.module.css +8 -3
- package/dist/components/forms/input/Input.d.ts +1 -0
- package/dist/components/forms/input/Input.js +4 -2
- package/dist/components/forms/input/Input.module.css +14 -12
- package/dist/components/forms/typeahead/Typeahead.js +2 -2
- package/dist/components/menu/Menu.module.css +2 -2
- package/dist/components/meta-bar/MetaBar.js +1 -1
- package/dist/components/meta-bar/MetaBar.module.css +8 -0
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import styles from './Circle.module.css';
|
|
3
3
|
export function Circle({ severity, children, glow, muted, pulse, size = 'sm', }) {
|
|
4
|
-
return (_jsxs("span", { className: styles.container, children: [_jsx("span", { "data-glow": glow, "data-pulse": pulse, "data-size": size, "data-muted": muted, className: `${styles.circle} ${styles[severity]}` }), children] }));
|
|
4
|
+
return (_jsxs("span", { className: styles.container, "data-size": size, children: [_jsx("span", { "data-glow": glow, "data-pulse": pulse, "data-size": size, "data-muted": muted, className: `${styles.circle} ${styles[severity]}` }), children] }));
|
|
5
5
|
}
|
|
@@ -5,10 +5,15 @@
|
|
|
5
5
|
gap: var(--spacing-xs);
|
|
6
6
|
white-space: nowrap;
|
|
7
7
|
font-family: var(--font-family);
|
|
8
|
-
color:
|
|
8
|
+
color: inherit;
|
|
9
9
|
line-height: 1;
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
+
.container[data-size='2xs'] {
|
|
13
|
+
gap: var(--spacing-xxs);
|
|
14
|
+
font-size: var(--font-size-xs);
|
|
15
|
+
}
|
|
16
|
+
|
|
12
17
|
.circle {
|
|
13
18
|
position: relative;
|
|
14
19
|
display: inline-block;
|
|
@@ -346,7 +346,7 @@ export const DateTimePicker = forwardRef(function DateTimePicker({ mode = 'singl
|
|
|
346
346
|
var _a, _b;
|
|
347
347
|
return (_jsx("div", { onClick: toggle, className: [styles.triggerWrap, fullWidth ? styles.triggerWrapFullWidth : '']
|
|
348
348
|
.filter(Boolean)
|
|
349
|
-
.join(' '), children: _jsx(Input, { ...inputProps, fieldClassName: styles.compactTriggerField, autoComplete: "off", autoCorrect: "off", autoCapitalize: "
|
|
349
|
+
.join(' '), children: _jsx(Input, { ...inputProps, fieldClassName: styles.compactTriggerField, autoComplete: "off", autoCorrect: "off", autoCapitalize: "none", spellCheck: "false", placeholder: (_a = inputProps === null || inputProps === void 0 ? void 0 : inputProps.placeholder) !== null && _a !== void 0 ? _a : fallbackPlaceholder, value: dirty ? text : formatted, onInput: e => {
|
|
350
350
|
setDirty(true);
|
|
351
351
|
const raw = e.target.value;
|
|
352
352
|
const masked = mode === 'single' ? maskSingle(raw, enableTime) : maskRange(raw, false);
|
|
@@ -160,16 +160,20 @@ export function FilterField({ field, control, operator, value, onChange, operato
|
|
|
160
160
|
.filter(Boolean)
|
|
161
161
|
.join(' '), children: [label ? _jsx("span", { className: `${styles.label} ${styles[size]}`, children: label }) : null, _jsx(OperatorDropdown, { value: selectedOperator, onChange: handleOperatorChange, operators: ops, size: size, disabled: disabled }), _jsx("div", { className: [styles.valueWrapper, control === 'input' ? 'dbc-flex dbc-flex-grow' : '']
|
|
162
162
|
.filter(Boolean)
|
|
163
|
-
.join(' '), style: { width, maxWidth }, children: control === 'input' ? (_jsx(Input, { variant: "embedded", ...inputProps, value: localValue, onChange: e => {
|
|
163
|
+
.join(' '), style: { width, maxWidth }, children: control === 'input' ? (_jsx(Input, { variant: "embedded", ...inputProps, fieldClassName: styles.embeddedInputField, inputClassName: styles.embeddedInputElement, value: localValue, onChange: e => {
|
|
164
164
|
const next = e.currentTarget.value;
|
|
165
165
|
setLocalValue(next);
|
|
166
166
|
scheduleEmitValue(next);
|
|
167
167
|
}, onBlur: () => {
|
|
168
168
|
flushPendingValue();
|
|
169
|
-
}, fullWidth: true, inputSize: size, placeholder: placeholder, disabled: disabled, autoComplete: (_b = inputProps.autoComplete) !== null && _b !== void 0 ? _b : 'off', autoCorrect: (_c = inputProps.autoCorrect) !== null && _c !== void 0 ? _c : 'off', autoCapitalize: (_d = inputProps.autoCapitalize) !== null && _d !== void 0 ? _d : '
|
|
169
|
+
}, fullWidth: true, inputSize: size, placeholder: placeholder, disabled: disabled, autoComplete: (_b = inputProps.autoComplete) !== null && _b !== void 0 ? _b : 'off', autoCorrect: (_c = inputProps.autoCorrect) !== null && _c !== void 0 ? _c : 'off', autoCapitalize: (_d = inputProps.autoCapitalize) !== null && _d !== void 0 ? _d : 'none', spellCheck: (_e = inputProps.spellCheck) !== null && _e !== void 0 ? _e : false, onClear: () => {
|
|
170
170
|
clearDebounce();
|
|
171
171
|
pendingValueRef.current = '';
|
|
172
172
|
setLocalValue('');
|
|
173
173
|
emit({ value: '' });
|
|
174
|
-
} })) : (_jsx(Typeahead, { options: options, mode: single ? 'single' : 'multi', selectedValue: single ? ((_f = value) !== null && _f !== void 0 ? _f : null) : Array.isArray(value) ? value : [], onChange: v => emit({ value: v }), placeholder: placeholder, variant: "embedded", inputProps: {
|
|
174
|
+
} })) : (_jsx(Typeahead, { options: options, mode: single ? 'single' : 'multi', selectedValue: single ? ((_f = value) !== null && _f !== void 0 ? _f : null) : Array.isArray(value) ? value : [], onChange: v => emit({ value: v }), placeholder: placeholder, variant: "embedded", inputProps: {
|
|
175
|
+
inputSize: size,
|
|
176
|
+
fieldClassName: styles.embeddedInputField,
|
|
177
|
+
inputClassName: styles.embeddedInputElement,
|
|
178
|
+
}, onClear: () => emit({ value: single ? '' : [] }), disabled: disabled, fullWidth: true })) })] }));
|
|
175
179
|
}
|
|
@@ -291,7 +291,6 @@
|
|
|
291
291
|
min-width: 0;
|
|
292
292
|
}
|
|
293
293
|
|
|
294
|
-
/* Embedded typeahead tweaks */
|
|
295
294
|
.filterField .valueWrapper .field {
|
|
296
295
|
min-height: unset;
|
|
297
296
|
height: 100%;
|
|
@@ -299,16 +298,22 @@
|
|
|
299
298
|
box-shadow: none;
|
|
300
299
|
border: none;
|
|
301
300
|
background: transparent;
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
.embeddedInputField {
|
|
302
304
|
padding: 0;
|
|
303
305
|
}
|
|
304
|
-
|
|
306
|
+
|
|
307
|
+
.embeddedInputElement {
|
|
305
308
|
height: 100%;
|
|
306
309
|
block-size: 100%;
|
|
307
310
|
min-height: unset;
|
|
308
311
|
background: transparent;
|
|
309
312
|
border: none;
|
|
310
313
|
box-shadow: none;
|
|
311
|
-
padding: 0;
|
|
314
|
+
padding-block: 0;
|
|
315
|
+
padding-inline: 0;
|
|
316
|
+
padding-inline-start: 0;
|
|
312
317
|
margin: 0;
|
|
313
318
|
}
|
|
314
319
|
.filterField .valueWrapper .startAdornment {
|
|
@@ -26,6 +26,7 @@ export type InputProps = Omit<React.InputHTMLAttributes<HTMLInputElement>, 'size
|
|
|
26
26
|
*/
|
|
27
27
|
endAdornment?: React.ReactNode;
|
|
28
28
|
fieldClassName?: string;
|
|
29
|
+
inputClassName?: string;
|
|
29
30
|
'data-cy'?: string;
|
|
30
31
|
};
|
|
31
32
|
export declare const Input: React.ForwardRefExoticComponent<React.PropsWithoutRef<InputProps> & React.RefAttributes<HTMLInputElement>>;
|
|
@@ -18,7 +18,7 @@ function mergeRefs(...refs) {
|
|
|
18
18
|
}
|
|
19
19
|
};
|
|
20
20
|
}
|
|
21
|
-
export const Input = forwardRef(function Input({ label, error, helpText, orientation = 'vertical', labelWidth = '160px', fullWidth = false, required, tooltip, tooltipPlacement = 'right', modified = false, icon, autoFocus, minWidth, width, maxWidth, inputSize = 'md', variant = 'outlined', onClear, onButtonClick, buttonLabel, buttonIcon, id, style, className, fieldClassName, startAdornment, endAdornment, ...inputProps }, ref) {
|
|
21
|
+
export const Input = forwardRef(function Input({ label, error, helpText, orientation = 'vertical', labelWidth = '160px', fullWidth = false, required, tooltip, tooltipPlacement = 'right', modified = false, icon, autoFocus, minWidth, width, maxWidth, inputSize = 'md', variant = 'outlined', onClear, onButtonClick, buttonLabel, buttonIcon, id, style, className, fieldClassName, inputClassName, startAdornment, endAdornment, ...inputProps }, ref) {
|
|
22
22
|
const inputRef = useRef(null);
|
|
23
23
|
const reactId = useId();
|
|
24
24
|
const inputId = id !== null && id !== void 0 ? id : `input-${reactId}`;
|
|
@@ -57,6 +57,8 @@ export const Input = forwardRef(function Input({ label, error, helpText, orienta
|
|
|
57
57
|
fieldClassName !== null && fieldClassName !== void 0 ? fieldClassName : '',
|
|
58
58
|
]
|
|
59
59
|
.filter(Boolean)
|
|
60
|
-
.join(' '), "data-forminput": "field", "data-modified": modified ? 'true' : undefined, "aria-disabled": inputProps.disabled ? 'true' : undefined, ...(tooltip ? triggerProps : {}), children: [icon && _jsx("span", { className: styles.icon, children: icon }), startAdornment && _jsx("span", { className: styles.startAdornment, children: startAdornment }), _jsx("input", { ...inputProps, id: inputId, ref: mergeRefs(inputRef, ref), className: [styles.input, inputSize ? styles[inputSize] : ''
|
|
60
|
+
.join(' '), "data-forminput": "field", "data-modified": modified ? 'true' : undefined, "aria-disabled": inputProps.disabled ? 'true' : undefined, ...(tooltip ? triggerProps : {}), children: [icon && _jsx("span", { className: styles.icon, children: icon }), startAdornment && _jsx("span", { className: styles.startAdornment, children: startAdornment }), _jsx("input", { ...inputProps, id: inputId, ref: mergeRefs(inputRef, ref), className: [styles.input, inputSize ? styles[inputSize] : '', inputClassName !== null && inputClassName !== void 0 ? inputClassName : '']
|
|
61
|
+
.filter(Boolean)
|
|
62
|
+
.join(' ') }), endAdornment && _jsx("span", { className: styles.endAdornment, children: endAdornment }), onClear && inputProps.value && _jsx(ClearButton, { onClick: onClear, absolute: true })] }), hasButton && (_jsxs(Button, { onClick: onButtonClick, className: styles.trailingButton, type: "button", variant: trailingButtonVariant, children: [buttonIcon !== null && buttonIcon !== void 0 ? buttonIcon : null, buttonLabel !== null && buttonLabel !== void 0 ? buttonLabel : null] }))] }) }));
|
|
61
63
|
});
|
|
62
64
|
Input.displayName = 'Input';
|
|
@@ -28,8 +28,6 @@
|
|
|
28
28
|
background: var(--color-bg-surface);
|
|
29
29
|
border: var(--border-width-thin) solid var(--color-border-default);
|
|
30
30
|
border-radius: var(--border-radius-default);
|
|
31
|
-
padding-inline: var(--spacing-sm);
|
|
32
|
-
padding-block: var(--spacing-xs);
|
|
33
31
|
box-sizing: border-box;
|
|
34
32
|
transition:
|
|
35
33
|
background-color var(--transition-fast) var(--ease-standard),
|
|
@@ -52,7 +50,8 @@
|
|
|
52
50
|
line-height: var(--line-height-normal);
|
|
53
51
|
border: none;
|
|
54
52
|
outline: none;
|
|
55
|
-
padding:
|
|
53
|
+
padding-inline: var(--spacing-sm);
|
|
54
|
+
padding-block: var(--spacing-xs);
|
|
56
55
|
margin: 0;
|
|
57
56
|
}
|
|
58
57
|
|
|
@@ -69,13 +68,13 @@
|
|
|
69
68
|
}
|
|
70
69
|
|
|
71
70
|
/* Button group styling */
|
|
72
|
-
.withButton .
|
|
71
|
+
.withButton .field {
|
|
73
72
|
border-top-right-radius: 0;
|
|
74
73
|
border-bottom-right-radius: 0;
|
|
75
74
|
}
|
|
76
75
|
|
|
77
|
-
.withClear .
|
|
78
|
-
padding-inline-end: calc(var(--spacing-
|
|
76
|
+
.withClear .input {
|
|
77
|
+
padding-inline-end: calc(var(--spacing-xs) + 16px + var(--spacing-xs));
|
|
79
78
|
}
|
|
80
79
|
|
|
81
80
|
/* Global focus reset - variants own visible focus treatment */
|
|
@@ -139,7 +138,6 @@
|
|
|
139
138
|
border-color: transparent;
|
|
140
139
|
border-radius: 0;
|
|
141
140
|
box-shadow: none;
|
|
142
|
-
padding-inline: var(--spacing-xs);
|
|
143
141
|
padding-block: 0;
|
|
144
142
|
block-size: 100%;
|
|
145
143
|
}
|
|
@@ -331,17 +329,17 @@
|
|
|
331
329
|
}
|
|
332
330
|
|
|
333
331
|
/* Leading icon */
|
|
334
|
-
.fieldWithIcon {
|
|
335
|
-
padding-inline-start: calc(var(--icon-size-md) + var(--spacing-
|
|
332
|
+
.fieldWithIcon .input {
|
|
333
|
+
padding-inline-start: calc(var(--spacing-sm) + var(--icon-size-md) + var(--spacing-xs));
|
|
336
334
|
}
|
|
337
335
|
|
|
338
|
-
.embedded.fieldWithIcon {
|
|
339
|
-
padding-inline-start: calc(var(--icon-size-md) + var(--spacing-
|
|
336
|
+
.embedded.fieldWithIcon .input {
|
|
337
|
+
padding-inline-start: calc(var(--spacing-xs) + var(--icon-size-md) + var(--spacing-xs));
|
|
340
338
|
}
|
|
341
339
|
|
|
342
340
|
.icon {
|
|
343
341
|
position: absolute;
|
|
344
|
-
inset-inline-start: var(--spacing-
|
|
342
|
+
inset-inline-start: var(--spacing-sm);
|
|
345
343
|
top: 50%;
|
|
346
344
|
transform: translateY(-50%);
|
|
347
345
|
display: inline-flex;
|
|
@@ -354,6 +352,10 @@
|
|
|
354
352
|
transition: color var(--transition-fast) var(--ease-standard);
|
|
355
353
|
}
|
|
356
354
|
|
|
355
|
+
.embedded .icon {
|
|
356
|
+
inset-inline-start: var(--spacing-xs);
|
|
357
|
+
}
|
|
358
|
+
|
|
357
359
|
.field:focus-within .icon {
|
|
358
360
|
color: var(--color-fg-muted);
|
|
359
361
|
}
|
|
@@ -6,7 +6,7 @@ import { Chip } from '../../../components/chip/Chip';
|
|
|
6
6
|
import { Input } from '../../../components/forms/input/Input';
|
|
7
7
|
import { Menu } from '../../../components/menu/Menu';
|
|
8
8
|
import { Popover } from '../../../components/popover/Popover';
|
|
9
|
-
export function Typeahead({ options, mode = 'single', multiValueDisplayMode = 'chips', multiSelectedValuesDisplayMode = 'hidden', multiSelectedValueChipContent = 'label', selectedValue = null, onChange, placeholder, variant = 'outlined', disabled = false, fullWidth = false, onClear, emptyMessage = '
|
|
9
|
+
export function Typeahead({ options, mode = 'single', multiValueDisplayMode = 'chips', multiSelectedValuesDisplayMode = 'hidden', multiSelectedValueChipContent = 'label', selectedValue = null, onChange, placeholder, variant = 'outlined', disabled = false, fullWidth = false, onClear, emptyMessage = 'Ingen resultater', filterOptions, inputProps, inputSize, width, autoComplete, autoCorrect, autoCapitalize, spellCheck, }) {
|
|
10
10
|
var _a;
|
|
11
11
|
const inputRef = useRef(null);
|
|
12
12
|
const listboxRef = useRef(null);
|
|
@@ -308,7 +308,7 @@ export function Typeahead({ options, mode = 'single', multiValueDisplayMode = 'c
|
|
|
308
308
|
if (e.defaultPrevented)
|
|
309
309
|
return;
|
|
310
310
|
handleKeyDown(e);
|
|
311
|
-
}, placeholder: placeholder, variant: variant, inputSize: (_a = inputSize !== null && inputSize !== void 0 ? inputSize : inputProps === null || inputProps === void 0 ? void 0 : inputProps.inputSize) !== null && _a !== void 0 ? _a : 'md', width: width !== null && width !== void 0 ? width : inputProps === null || inputProps === void 0 ? void 0 : inputProps.width, autoComplete: (_b = autoComplete !== null && autoComplete !== void 0 ? autoComplete : inputProps === null || inputProps === void 0 ? void 0 : inputProps.autoComplete) !== null && _b !== void 0 ? _b : 'off', autoCorrect: (_c = autoCorrect !== null && autoCorrect !== void 0 ? autoCorrect : inputProps === null || inputProps === void 0 ? void 0 : inputProps.autoCorrect) !== null && _c !== void 0 ? _c : 'off', autoCapitalize: (_d = autoCapitalize !== null && autoCapitalize !== void 0 ? autoCapitalize : inputProps === null || inputProps === void 0 ? void 0 : inputProps.autoCapitalize) !== null && _d !== void 0 ? _d : '
|
|
311
|
+
}, placeholder: placeholder, variant: variant, inputSize: (_a = inputSize !== null && inputSize !== void 0 ? inputSize : inputProps === null || inputProps === void 0 ? void 0 : inputProps.inputSize) !== null && _a !== void 0 ? _a : 'md', width: width !== null && width !== void 0 ? width : inputProps === null || inputProps === void 0 ? void 0 : inputProps.width, autoComplete: (_b = autoComplete !== null && autoComplete !== void 0 ? autoComplete : inputProps === null || inputProps === void 0 ? void 0 : inputProps.autoComplete) !== null && _b !== void 0 ? _b : 'off', autoCorrect: (_c = autoCorrect !== null && autoCorrect !== void 0 ? autoCorrect : inputProps === null || inputProps === void 0 ? void 0 : inputProps.autoCorrect) !== null && _c !== void 0 ? _c : 'off', autoCapitalize: (_d = autoCapitalize !== null && autoCapitalize !== void 0 ? autoCapitalize : inputProps === null || inputProps === void 0 ? void 0 : inputProps.autoCapitalize) !== null && _d !== void 0 ? _d : 'none', spellCheck: (_e = spellCheck !== null && spellCheck !== void 0 ? spellCheck : inputProps === null || inputProps === void 0 ? void 0 : inputProps.spellCheck) !== null && _e !== void 0 ? _e : false, disabled: disabled, fullWidth: fullWidth, onClear: () => {
|
|
312
312
|
setInputValue('');
|
|
313
313
|
setQuery('');
|
|
314
314
|
setActiveIndex(-1);
|
|
@@ -91,7 +91,7 @@
|
|
|
91
91
|
/* Hover: support both cases (interactive element, or wrapper child) */
|
|
92
92
|
.interactive:hover:not(.selected),
|
|
93
93
|
.row:hover > .interactiveChild:not(.selected) {
|
|
94
|
-
background-color: var(--color-bg-hover
|
|
94
|
+
background-color: var(--color-bg-toolbar-hover);
|
|
95
95
|
}
|
|
96
96
|
|
|
97
97
|
/* Focus ring: support both cases */
|
|
@@ -110,7 +110,7 @@
|
|
|
110
110
|
.active,
|
|
111
111
|
.interactive.active,
|
|
112
112
|
.row > .interactiveChild.active {
|
|
113
|
-
background-color: var(--color-bg-hover
|
|
113
|
+
background-color: var(--color-bg-toolbar-hover);
|
|
114
114
|
}
|
|
115
115
|
|
|
116
116
|
/* Selected item */
|
|
@@ -5,5 +5,5 @@ export function MetaBar({ items, separator = '•' }) {
|
|
|
5
5
|
const visibleItems = items.filter(item => item.value !== null && item.value !== undefined && item.value !== '');
|
|
6
6
|
if (visibleItems.length === 0)
|
|
7
7
|
return null;
|
|
8
|
-
return (_jsx("div", { className: styles.meta, children: visibleItems.map((item, index) => (_jsxs(Fragment, { children: [_jsxs("span", { className: item.muted === false ? styles.itemDefault : styles.itemMuted, children: [item.label && _jsxs("span", { children: [item.label, "
|
|
8
|
+
return (_jsx("div", { className: styles.meta, children: visibleItems.map((item, index) => (_jsxs(Fragment, { children: [_jsxs("span", { className: item.muted === false ? styles.itemDefault : styles.itemMuted, children: [item.label && _jsxs("span", { children: [item.label, ":\u00A0"] }), _jsx("span", { children: item.value })] }), index < visibleItems.length - 1 && (_jsx("span", { "aria-hidden": "true", className: styles.dot, children: separator }))] }, index))) }));
|
|
9
9
|
}
|