@equinor/eds-core-react 2.4.1-beta.0 → 2.5.0-beta.0
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/build/index.css +841 -80
- package/build/index.min.css +1 -1
- package/dist/eds-core-react.cjs +0 -6
- package/dist/esm/components/Autocomplete/useAutocomplete.js +0 -1
- package/dist/esm/components/Banner/Banner.tokens.js +0 -1
- package/dist/esm/components/Icon/Icon.js +0 -2
- package/dist/esm/components/Pagination/Pagination.js +0 -1
- package/dist/esm/components/Tabs/Tabs.js +0 -1
- package/dist/esm-next/components/next/Button/Button.js +51 -23
- package/dist/esm-next/components/next/Chip/Chip.js +77 -0
- package/dist/esm-next/index.next.js +1 -0
- package/dist/index.next.cjs +224 -125
- package/dist/types/components/Autocomplete/Autocomplete.d.ts +11 -2
- package/dist/types/components/Autocomplete/AutocompleteContext.d.ts +2 -2
- package/dist/types/components/Autocomplete/Option.d.ts +5 -3
- package/dist/types/components/Autocomplete/useAutocomplete.d.ts +1 -1
- package/dist/types/components/Chip/Icon.d.ts +18 -2
- package/dist/types/components/Datepicker/calendars/CalendarWrapper.d.ts +1 -1
- package/dist/types/components/Switch/Switch.styles.d.ts +3 -3
- package/dist/types/components/Typography/Typography.stories.shared.d.ts +18 -16
- package/dist/types/components/next/Button/Button.d.ts +4 -1
- package/dist/types/components/next/Button/Button.types.d.ts +12 -0
- package/dist/types/components/next/Chip/Chip.d.ts +8 -0
- package/dist/types/components/next/Chip/Chip.figma.d.ts +1 -0
- package/dist/types/components/next/Chip/Chip.types.d.ts +68 -0
- package/dist/types/components/next/Chip/index.d.ts +2 -0
- package/dist/types/components/next/index.d.ts +2 -0
- package/package.json +14 -13
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import { forwardRef } from 'react';
|
|
1
|
+
import { forwardRef, Children, isValidElement } from 'react';
|
|
2
2
|
import { jsx } from 'react/jsx-runtime';
|
|
3
|
-
import {
|
|
3
|
+
import { Slot } from '../Slot/Slot.js';
|
|
4
4
|
|
|
5
5
|
const SIZE_MAPPING = {
|
|
6
6
|
small: 'sm',
|
|
7
7
|
default: 'md'
|
|
8
8
|
};
|
|
9
|
-
const sizeToTypography = SIZE_MAPPING;
|
|
10
9
|
const sizeToSelectableSpace = SIZE_MAPPING;
|
|
11
10
|
const Button = /*#__PURE__*/forwardRef(function Button({
|
|
12
11
|
variant = 'primary',
|
|
@@ -14,6 +13,8 @@ const Button = /*#__PURE__*/forwardRef(function Button({
|
|
|
14
13
|
tone = 'accent',
|
|
15
14
|
icon = false,
|
|
16
15
|
round = false,
|
|
16
|
+
multiline = false,
|
|
17
|
+
asChild,
|
|
17
18
|
children,
|
|
18
19
|
className,
|
|
19
20
|
disabled,
|
|
@@ -21,29 +22,56 @@ const Button = /*#__PURE__*/forwardRef(function Button({
|
|
|
21
22
|
...rest
|
|
22
23
|
}, ref) {
|
|
23
24
|
const classes = ['eds-button', className].filter(Boolean).join(' ');
|
|
24
|
-
const typographySize = sizeToTypography[size];
|
|
25
25
|
const selectableSpace = sizeToSelectableSpace[size];
|
|
26
|
-
|
|
27
|
-
ref
|
|
28
|
-
type: type,
|
|
26
|
+
const sharedProps = {
|
|
27
|
+
ref,
|
|
29
28
|
className: classes,
|
|
30
|
-
disabled
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
lineHeight: "squished",
|
|
44
|
-
baseline: "center",
|
|
29
|
+
disabled,
|
|
30
|
+
'data-variant': variant,
|
|
31
|
+
'data-selectable-space': selectableSpace,
|
|
32
|
+
'data-space-proportions': 'squished',
|
|
33
|
+
'data-color-appearance': disabled ? 'neutral' : tone,
|
|
34
|
+
'data-icon-only': icon || undefined,
|
|
35
|
+
'data-round': icon && round ? true : undefined,
|
|
36
|
+
'data-multiline': multiline || undefined,
|
|
37
|
+
...rest
|
|
38
|
+
};
|
|
39
|
+
if (asChild) {
|
|
40
|
+
return /*#__PURE__*/jsx(Slot, {
|
|
41
|
+
...sharedProps,
|
|
45
42
|
children: children
|
|
46
|
-
})
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
return /*#__PURE__*/jsx("button", {
|
|
46
|
+
type: type,
|
|
47
|
+
...sharedProps,
|
|
48
|
+
children: (() => {
|
|
49
|
+
const out = [];
|
|
50
|
+
let buf = [];
|
|
51
|
+
let labelGroupIndex = 0;
|
|
52
|
+
Children.toArray(children).forEach(child => {
|
|
53
|
+
const isLabelNode = typeof child === 'string' || typeof child === 'number' || /*#__PURE__*/isValidElement(child) && child.type === 'br';
|
|
54
|
+
if (isLabelNode) {
|
|
55
|
+
buf.push(child);
|
|
56
|
+
} else {
|
|
57
|
+
if (buf.length) {
|
|
58
|
+
out.push(/*#__PURE__*/jsx("span", {
|
|
59
|
+
className: "label",
|
|
60
|
+
children: buf
|
|
61
|
+
}, `label-${labelGroupIndex++}`));
|
|
62
|
+
buf = [];
|
|
63
|
+
}
|
|
64
|
+
out.push(child);
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
if (buf.length) {
|
|
68
|
+
out.push(/*#__PURE__*/jsx("span", {
|
|
69
|
+
className: "label",
|
|
70
|
+
children: buf
|
|
71
|
+
}, "label-end"));
|
|
72
|
+
}
|
|
73
|
+
return out;
|
|
74
|
+
})()
|
|
47
75
|
});
|
|
48
76
|
});
|
|
49
77
|
Button.displayName = 'Button';
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { forwardRef } from 'react';
|
|
2
|
+
import { check, close, arrow_drop_up, arrow_drop_down } from '@equinor/eds-icons';
|
|
3
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
4
|
+
import { Icon } from '../Icon/Icon.js';
|
|
5
|
+
import { TypographyNext } from '../../Typography/Typography.new.js';
|
|
6
|
+
|
|
7
|
+
const Chip = /*#__PURE__*/forwardRef(function Chip({
|
|
8
|
+
tone = 'neutral',
|
|
9
|
+
variant = 'default',
|
|
10
|
+
selected = false,
|
|
11
|
+
onDelete,
|
|
12
|
+
dropdown = false,
|
|
13
|
+
onClick,
|
|
14
|
+
children,
|
|
15
|
+
className,
|
|
16
|
+
onKeyDown,
|
|
17
|
+
...rest
|
|
18
|
+
}, ref) {
|
|
19
|
+
const classes = ['eds-chip', className].filter(Boolean).join(' ');
|
|
20
|
+
const deletable = typeof onDelete === 'function';
|
|
21
|
+
const toggleable = !deletable && !dropdown;
|
|
22
|
+
const handleClick = event => {
|
|
23
|
+
if (deletable) {
|
|
24
|
+
onDelete?.(event);
|
|
25
|
+
} else {
|
|
26
|
+
onClick?.(event);
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
const handleKeyDown = event => {
|
|
30
|
+
if (deletable && (event.key === 'Backspace' || event.key === 'Delete')) {
|
|
31
|
+
event.preventDefault();
|
|
32
|
+
onDelete?.(event);
|
|
33
|
+
}
|
|
34
|
+
onKeyDown?.(event);
|
|
35
|
+
};
|
|
36
|
+
return /*#__PURE__*/jsxs("button", {
|
|
37
|
+
ref: ref,
|
|
38
|
+
type: "button",
|
|
39
|
+
className: classes,
|
|
40
|
+
"data-variant": variant,
|
|
41
|
+
"data-color-appearance": tone,
|
|
42
|
+
"data-font-family": "ui",
|
|
43
|
+
"data-font-size": "md",
|
|
44
|
+
"data-selectable-space": "sm",
|
|
45
|
+
"data-space-proportions": "squished",
|
|
46
|
+
"data-selected": selected || undefined,
|
|
47
|
+
"aria-pressed": toggleable ? selected : undefined,
|
|
48
|
+
"aria-expanded": dropdown ? selected : undefined,
|
|
49
|
+
onClick: handleClick,
|
|
50
|
+
onKeyDown: handleKeyDown,
|
|
51
|
+
...rest,
|
|
52
|
+
children: [selected && !dropdown && !deletable && /*#__PURE__*/jsx(Icon, {
|
|
53
|
+
data: check,
|
|
54
|
+
"aria-hidden": true,
|
|
55
|
+
className: "icon"
|
|
56
|
+
}), /*#__PURE__*/jsx(TypographyNext, {
|
|
57
|
+
as: "span",
|
|
58
|
+
className: "label",
|
|
59
|
+
family: "ui",
|
|
60
|
+
size: "md",
|
|
61
|
+
lineHeight: "squished",
|
|
62
|
+
baseline: "center",
|
|
63
|
+
children: children
|
|
64
|
+
}), deletable && /*#__PURE__*/jsx(Icon, {
|
|
65
|
+
data: close,
|
|
66
|
+
title: "Remove",
|
|
67
|
+
className: "icon"
|
|
68
|
+
}), !deletable && dropdown && /*#__PURE__*/jsx(Icon, {
|
|
69
|
+
data: selected ? arrow_drop_up : arrow_drop_down,
|
|
70
|
+
"aria-hidden": true,
|
|
71
|
+
className: "icon"
|
|
72
|
+
})]
|
|
73
|
+
});
|
|
74
|
+
});
|
|
75
|
+
Chip.displayName = 'Chip';
|
|
76
|
+
|
|
77
|
+
export { Chip };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export { Banner } from './components/next/Banner/Banner.js';
|
|
2
2
|
export { Button } from './components/next/Button/Button.js';
|
|
3
3
|
export { Checkbox } from './components/next/Checkbox/Checkbox.js';
|
|
4
|
+
export { Chip } from './components/next/Chip/Chip.js';
|
|
4
5
|
export { Field } from './components/next/Field/Field.js';
|
|
5
6
|
export { Icon } from './components/next/Icon/Icon.js';
|
|
6
7
|
export { Input } from './components/next/Input/Input.js';
|
package/dist/index.next.cjs
CHANGED
|
@@ -13,74 +13,54 @@ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
|
13
13
|
|
|
14
14
|
var styled__default = /*#__PURE__*/_interopDefault(styled);
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
size,
|
|
57
|
-
baseline,
|
|
58
|
-
lineHeight,
|
|
59
|
-
weight,
|
|
60
|
-
tracking,
|
|
61
|
-
debug,
|
|
62
|
-
...rest
|
|
63
|
-
}, ref) => {
|
|
64
|
-
const Component = as;
|
|
65
|
-
return /*#__PURE__*/jsxRuntime.jsx(Component, {
|
|
66
|
-
ref: ref,
|
|
67
|
-
"data-font-family": family,
|
|
68
|
-
"data-font-size": size,
|
|
69
|
-
"data-baseline": baseline || undefined,
|
|
70
|
-
"data-line-height": lineHeight || undefined,
|
|
71
|
-
"data-font-weight": weight || undefined,
|
|
72
|
-
"data-tracking": tracking || undefined,
|
|
73
|
-
"data-debug": debug ? '' : undefined,
|
|
74
|
-
...rest
|
|
16
|
+
function mergeClassNames(...classNames) {
|
|
17
|
+
return classNames.filter(Boolean).join(' ');
|
|
18
|
+
}
|
|
19
|
+
function mergeProps(slotProps, childProps) {
|
|
20
|
+
const merged = {
|
|
21
|
+
...childProps
|
|
22
|
+
};
|
|
23
|
+
for (const key of Object.keys(slotProps)) {
|
|
24
|
+
const slotValue = slotProps[key];
|
|
25
|
+
const childValue = childProps[key];
|
|
26
|
+
if (key === 'className') {
|
|
27
|
+
merged[key] = mergeClassNames(slotValue, childValue);
|
|
28
|
+
} else if (key === 'style') {
|
|
29
|
+
merged[key] = {
|
|
30
|
+
...slotValue,
|
|
31
|
+
...childValue
|
|
32
|
+
};
|
|
33
|
+
} else if (typeof slotValue === 'function' && typeof childValue === 'function') {
|
|
34
|
+
merged[key] = (...args) => {
|
|
35
|
+
childValue(...args);
|
|
36
|
+
slotValue(...args);
|
|
37
|
+
};
|
|
38
|
+
} else if (slotValue !== undefined) {
|
|
39
|
+
merged[key] = slotValue;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
return merged;
|
|
43
|
+
}
|
|
44
|
+
const Slot = /*#__PURE__*/react.forwardRef(function Slot({
|
|
45
|
+
children,
|
|
46
|
+
...slotProps
|
|
47
|
+
}, ref) {
|
|
48
|
+
if (! /*#__PURE__*/react.isValidElement(children)) {
|
|
49
|
+
return null;
|
|
50
|
+
}
|
|
51
|
+
const child = children;
|
|
52
|
+
const merged = mergeProps(slotProps, child.props);
|
|
53
|
+
return /*#__PURE__*/react.cloneElement(child, {
|
|
54
|
+
...merged,
|
|
55
|
+
ref
|
|
75
56
|
});
|
|
76
57
|
});
|
|
77
|
-
|
|
58
|
+
Slot.displayName = 'Slot';
|
|
78
59
|
|
|
79
60
|
const SIZE_MAPPING = {
|
|
80
61
|
small: 'sm',
|
|
81
62
|
default: 'md'
|
|
82
63
|
};
|
|
83
|
-
const sizeToTypography = SIZE_MAPPING;
|
|
84
64
|
const sizeToSelectableSpace = SIZE_MAPPING;
|
|
85
65
|
const Button = /*#__PURE__*/react.forwardRef(function Button({
|
|
86
66
|
variant = 'primary',
|
|
@@ -88,6 +68,8 @@ const Button = /*#__PURE__*/react.forwardRef(function Button({
|
|
|
88
68
|
tone = 'accent',
|
|
89
69
|
icon = false,
|
|
90
70
|
round = false,
|
|
71
|
+
multiline = false,
|
|
72
|
+
asChild,
|
|
91
73
|
children,
|
|
92
74
|
className,
|
|
93
75
|
disabled,
|
|
@@ -95,29 +77,56 @@ const Button = /*#__PURE__*/react.forwardRef(function Button({
|
|
|
95
77
|
...rest
|
|
96
78
|
}, ref) {
|
|
97
79
|
const classes = ['eds-button', className].filter(Boolean).join(' ');
|
|
98
|
-
const typographySize = sizeToTypography[size];
|
|
99
80
|
const selectableSpace = sizeToSelectableSpace[size];
|
|
100
|
-
|
|
101
|
-
ref
|
|
102
|
-
type: type,
|
|
81
|
+
const sharedProps = {
|
|
82
|
+
ref,
|
|
103
83
|
className: classes,
|
|
104
|
-
disabled
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
lineHeight: "squished",
|
|
118
|
-
baseline: "center",
|
|
84
|
+
disabled,
|
|
85
|
+
'data-variant': variant,
|
|
86
|
+
'data-selectable-space': selectableSpace,
|
|
87
|
+
'data-space-proportions': 'squished',
|
|
88
|
+
'data-color-appearance': disabled ? 'neutral' : tone,
|
|
89
|
+
'data-icon-only': icon || undefined,
|
|
90
|
+
'data-round': icon && round ? true : undefined,
|
|
91
|
+
'data-multiline': multiline || undefined,
|
|
92
|
+
...rest
|
|
93
|
+
};
|
|
94
|
+
if (asChild) {
|
|
95
|
+
return /*#__PURE__*/jsxRuntime.jsx(Slot, {
|
|
96
|
+
...sharedProps,
|
|
119
97
|
children: children
|
|
120
|
-
})
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
return /*#__PURE__*/jsxRuntime.jsx("button", {
|
|
101
|
+
type: type,
|
|
102
|
+
...sharedProps,
|
|
103
|
+
children: (() => {
|
|
104
|
+
const out = [];
|
|
105
|
+
let buf = [];
|
|
106
|
+
let labelGroupIndex = 0;
|
|
107
|
+
react.Children.toArray(children).forEach(child => {
|
|
108
|
+
const isLabelNode = typeof child === 'string' || typeof child === 'number' || /*#__PURE__*/react.isValidElement(child) && child.type === 'br';
|
|
109
|
+
if (isLabelNode) {
|
|
110
|
+
buf.push(child);
|
|
111
|
+
} else {
|
|
112
|
+
if (buf.length) {
|
|
113
|
+
out.push(/*#__PURE__*/jsxRuntime.jsx("span", {
|
|
114
|
+
className: "label",
|
|
115
|
+
children: buf
|
|
116
|
+
}, `label-${labelGroupIndex++}`));
|
|
117
|
+
buf = [];
|
|
118
|
+
}
|
|
119
|
+
out.push(child);
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
if (buf.length) {
|
|
123
|
+
out.push(/*#__PURE__*/jsxRuntime.jsx("span", {
|
|
124
|
+
className: "label",
|
|
125
|
+
children: buf
|
|
126
|
+
}, "label-end"));
|
|
127
|
+
}
|
|
128
|
+
return out;
|
|
129
|
+
})()
|
|
121
130
|
});
|
|
122
131
|
});
|
|
123
132
|
Button.displayName = 'Button';
|
|
@@ -200,6 +209,69 @@ const Icon = /*#__PURE__*/react.forwardRef(function Icon({
|
|
|
200
209
|
});
|
|
201
210
|
});
|
|
202
211
|
|
|
212
|
+
/**
|
|
213
|
+
* TypographyNext component for flexible typography with baseline grid support.
|
|
214
|
+
*
|
|
215
|
+
* Provides full control over typography properties including family, size,
|
|
216
|
+
* lineHeight, baseline alignment, weight, and tracking.
|
|
217
|
+
*
|
|
218
|
+
* **Display behavior:** Elements render as `display: block` by default for
|
|
219
|
+
* text-box trimming and baseline grid alignment. Override with CSS if needed.
|
|
220
|
+
*
|
|
221
|
+
* @example
|
|
222
|
+
* ```tsx
|
|
223
|
+
* import { TypographyNext as Typography } from '@equinor/eds-core-react'
|
|
224
|
+
*
|
|
225
|
+
* <Typography
|
|
226
|
+
* family="ui"
|
|
227
|
+
* size="md"
|
|
228
|
+
* lineHeight="default"
|
|
229
|
+
* baseline="grid"
|
|
230
|
+
* weight="normal"
|
|
231
|
+
* tracking="normal"
|
|
232
|
+
* >
|
|
233
|
+
* Text content (renders as block-level by default)
|
|
234
|
+
* </Typography>
|
|
235
|
+
*
|
|
236
|
+
* <Typography
|
|
237
|
+
* as="h1"
|
|
238
|
+
* family="header"
|
|
239
|
+
* size="3xl"
|
|
240
|
+
* lineHeight="squished"
|
|
241
|
+
* baseline="grid"
|
|
242
|
+
* weight="bolder"
|
|
243
|
+
* tracking="tight"
|
|
244
|
+
* >
|
|
245
|
+
* Page heading
|
|
246
|
+
* </Typography>
|
|
247
|
+
* ```
|
|
248
|
+
*/
|
|
249
|
+
const TypographyNext = /*#__PURE__*/react.forwardRef(({
|
|
250
|
+
as = 'span',
|
|
251
|
+
family,
|
|
252
|
+
size,
|
|
253
|
+
baseline,
|
|
254
|
+
lineHeight,
|
|
255
|
+
weight,
|
|
256
|
+
tracking,
|
|
257
|
+
debug,
|
|
258
|
+
...rest
|
|
259
|
+
}, ref) => {
|
|
260
|
+
const Component = as;
|
|
261
|
+
return /*#__PURE__*/jsxRuntime.jsx(Component, {
|
|
262
|
+
ref: ref,
|
|
263
|
+
"data-font-family": family,
|
|
264
|
+
"data-font-size": size,
|
|
265
|
+
"data-baseline": baseline || undefined,
|
|
266
|
+
"data-line-height": lineHeight || undefined,
|
|
267
|
+
"data-font-weight": weight || undefined,
|
|
268
|
+
"data-tracking": tracking || undefined,
|
|
269
|
+
"data-debug": debug ? '' : undefined,
|
|
270
|
+
...rest
|
|
271
|
+
});
|
|
272
|
+
});
|
|
273
|
+
TypographyNext.displayName = 'TypographyNext';
|
|
274
|
+
|
|
203
275
|
const FieldDescription = /*#__PURE__*/react.forwardRef(function FieldDescription({
|
|
204
276
|
children,
|
|
205
277
|
className,
|
|
@@ -1126,50 +1198,6 @@ const Search = /*#__PURE__*/react.forwardRef(function Search({
|
|
|
1126
1198
|
});
|
|
1127
1199
|
Search.displayName = 'Search';
|
|
1128
1200
|
|
|
1129
|
-
function mergeClassNames(...classNames) {
|
|
1130
|
-
return classNames.filter(Boolean).join(' ');
|
|
1131
|
-
}
|
|
1132
|
-
function mergeProps(slotProps, childProps) {
|
|
1133
|
-
const merged = {
|
|
1134
|
-
...childProps
|
|
1135
|
-
};
|
|
1136
|
-
for (const key of Object.keys(slotProps)) {
|
|
1137
|
-
const slotValue = slotProps[key];
|
|
1138
|
-
const childValue = childProps[key];
|
|
1139
|
-
if (key === 'className') {
|
|
1140
|
-
merged[key] = mergeClassNames(slotValue, childValue);
|
|
1141
|
-
} else if (key === 'style') {
|
|
1142
|
-
merged[key] = {
|
|
1143
|
-
...slotValue,
|
|
1144
|
-
...childValue
|
|
1145
|
-
};
|
|
1146
|
-
} else if (typeof slotValue === 'function' && typeof childValue === 'function') {
|
|
1147
|
-
merged[key] = (...args) => {
|
|
1148
|
-
childValue(...args);
|
|
1149
|
-
slotValue(...args);
|
|
1150
|
-
};
|
|
1151
|
-
} else if (slotValue !== undefined) {
|
|
1152
|
-
merged[key] = slotValue;
|
|
1153
|
-
}
|
|
1154
|
-
}
|
|
1155
|
-
return merged;
|
|
1156
|
-
}
|
|
1157
|
-
const Slot = /*#__PURE__*/react.forwardRef(function Slot({
|
|
1158
|
-
children,
|
|
1159
|
-
...slotProps
|
|
1160
|
-
}, ref) {
|
|
1161
|
-
if (! /*#__PURE__*/react.isValidElement(children)) {
|
|
1162
|
-
return null;
|
|
1163
|
-
}
|
|
1164
|
-
const child = children;
|
|
1165
|
-
const merged = mergeProps(slotProps, child.props);
|
|
1166
|
-
return /*#__PURE__*/react.cloneElement(child, {
|
|
1167
|
-
...merged,
|
|
1168
|
-
ref
|
|
1169
|
-
});
|
|
1170
|
-
});
|
|
1171
|
-
Slot.displayName = 'Slot';
|
|
1172
|
-
|
|
1173
1201
|
const Link = /*#__PURE__*/react.forwardRef(function Link({
|
|
1174
1202
|
variant = 'inline',
|
|
1175
1203
|
asChild,
|
|
@@ -1361,9 +1389,80 @@ Banner.Icon = BannerIcon;
|
|
|
1361
1389
|
Banner.Message = BannerMessage;
|
|
1362
1390
|
Banner.Actions = BannerActions;
|
|
1363
1391
|
|
|
1392
|
+
const Chip = /*#__PURE__*/react.forwardRef(function Chip({
|
|
1393
|
+
tone = 'neutral',
|
|
1394
|
+
variant = 'default',
|
|
1395
|
+
selected = false,
|
|
1396
|
+
onDelete,
|
|
1397
|
+
dropdown = false,
|
|
1398
|
+
onClick,
|
|
1399
|
+
children,
|
|
1400
|
+
className,
|
|
1401
|
+
onKeyDown,
|
|
1402
|
+
...rest
|
|
1403
|
+
}, ref) {
|
|
1404
|
+
const classes = ['eds-chip', className].filter(Boolean).join(' ');
|
|
1405
|
+
const deletable = typeof onDelete === 'function';
|
|
1406
|
+
const toggleable = !deletable && !dropdown;
|
|
1407
|
+
const handleClick = event => {
|
|
1408
|
+
if (deletable) {
|
|
1409
|
+
onDelete?.(event);
|
|
1410
|
+
} else {
|
|
1411
|
+
onClick?.(event);
|
|
1412
|
+
}
|
|
1413
|
+
};
|
|
1414
|
+
const handleKeyDown = event => {
|
|
1415
|
+
if (deletable && (event.key === 'Backspace' || event.key === 'Delete')) {
|
|
1416
|
+
event.preventDefault();
|
|
1417
|
+
onDelete?.(event);
|
|
1418
|
+
}
|
|
1419
|
+
onKeyDown?.(event);
|
|
1420
|
+
};
|
|
1421
|
+
return /*#__PURE__*/jsxRuntime.jsxs("button", {
|
|
1422
|
+
ref: ref,
|
|
1423
|
+
type: "button",
|
|
1424
|
+
className: classes,
|
|
1425
|
+
"data-variant": variant,
|
|
1426
|
+
"data-color-appearance": tone,
|
|
1427
|
+
"data-font-family": "ui",
|
|
1428
|
+
"data-font-size": "md",
|
|
1429
|
+
"data-selectable-space": "sm",
|
|
1430
|
+
"data-space-proportions": "squished",
|
|
1431
|
+
"data-selected": selected || undefined,
|
|
1432
|
+
"aria-pressed": toggleable ? selected : undefined,
|
|
1433
|
+
"aria-expanded": dropdown ? selected : undefined,
|
|
1434
|
+
onClick: handleClick,
|
|
1435
|
+
onKeyDown: handleKeyDown,
|
|
1436
|
+
...rest,
|
|
1437
|
+
children: [selected && !dropdown && !deletable && /*#__PURE__*/jsxRuntime.jsx(Icon, {
|
|
1438
|
+
data: edsIcons.check,
|
|
1439
|
+
"aria-hidden": true,
|
|
1440
|
+
className: "icon"
|
|
1441
|
+
}), /*#__PURE__*/jsxRuntime.jsx(TypographyNext, {
|
|
1442
|
+
as: "span",
|
|
1443
|
+
className: "label",
|
|
1444
|
+
family: "ui",
|
|
1445
|
+
size: "md",
|
|
1446
|
+
lineHeight: "squished",
|
|
1447
|
+
baseline: "center",
|
|
1448
|
+
children: children
|
|
1449
|
+
}), deletable && /*#__PURE__*/jsxRuntime.jsx(Icon, {
|
|
1450
|
+
data: edsIcons.close,
|
|
1451
|
+
title: "Remove",
|
|
1452
|
+
className: "icon"
|
|
1453
|
+
}), !deletable && dropdown && /*#__PURE__*/jsxRuntime.jsx(Icon, {
|
|
1454
|
+
data: selected ? edsIcons.arrow_drop_up : edsIcons.arrow_drop_down,
|
|
1455
|
+
"aria-hidden": true,
|
|
1456
|
+
className: "icon"
|
|
1457
|
+
})]
|
|
1458
|
+
});
|
|
1459
|
+
});
|
|
1460
|
+
Chip.displayName = 'Chip';
|
|
1461
|
+
|
|
1364
1462
|
exports.Banner = Banner;
|
|
1365
1463
|
exports.Button = Button;
|
|
1366
1464
|
exports.Checkbox = Checkbox;
|
|
1465
|
+
exports.Chip = Chip;
|
|
1367
1466
|
exports.Field = Field;
|
|
1368
1467
|
exports.Icon = Icon;
|
|
1369
1468
|
exports.Input = Input;
|
|
@@ -6,12 +6,21 @@ export declare const StyledButton: import("styled-components/dist/types").IStyle
|
|
|
6
6
|
as?: import("react").ElementType;
|
|
7
7
|
} & {
|
|
8
8
|
color?: "primary" | "secondary" | "danger";
|
|
9
|
-
variant?: "ghost" | "
|
|
9
|
+
variant?: "ghost" | "outlined" | "contained" | "contained_icon" | "ghost_icon";
|
|
10
10
|
href?: string;
|
|
11
11
|
disabled?: boolean;
|
|
12
12
|
type?: string;
|
|
13
13
|
fullWidth?: boolean;
|
|
14
|
-
} & import("react").ButtonHTMLAttributes<HTMLButtonElement> & Omit<any, keyof import("react").ButtonHTMLAttributes<HTMLButtonElement> | "variant" | "href" | "fullWidth">, never
|
|
14
|
+
} & import("react").ButtonHTMLAttributes<HTMLButtonElement> & Omit<any, keyof import("react").ButtonHTMLAttributes<HTMLButtonElement> | "variant" | "href" | "fullWidth">, never> & Partial<Pick<{
|
|
15
|
+
as?: import("react").ElementType;
|
|
16
|
+
} & {
|
|
17
|
+
color?: "primary" | "secondary" | "danger";
|
|
18
|
+
variant?: "ghost" | "outlined" | "contained" | "contained_icon" | "ghost_icon";
|
|
19
|
+
href?: string;
|
|
20
|
+
disabled?: boolean;
|
|
21
|
+
type?: string;
|
|
22
|
+
fullWidth?: boolean;
|
|
23
|
+
} & import("react").ButtonHTMLAttributes<HTMLButtonElement> & Omit<any, keyof import("react").ButtonHTMLAttributes<HTMLButtonElement> | "variant" | "href" | "fullWidth">, never>>> & string & Omit<import("@equinor/eds-utils").OverridableComponent<import("../Button").ButtonProps, HTMLButtonElement> & {
|
|
15
24
|
Group: typeof import("../Button").ButtonGroup;
|
|
16
25
|
Toggle: typeof import("../Button").ToggleButton;
|
|
17
26
|
}, keyof import("react").Component<any, {}, any>>;
|
|
@@ -96,7 +96,7 @@ export declare const AutocompleteContext: import("react").Context<{
|
|
|
96
96
|
optionLabel?: (option: unknown) => string;
|
|
97
97
|
} & {
|
|
98
98
|
ref?: React.Ref<HTMLInputElement>;
|
|
99
|
-
}, "disabled" | "className" | "id" | "style" | "
|
|
99
|
+
}, "disabled" | "className" | "id" | "style" | "ref" | "label" | "meta" | "variant" | "multiline" | "multiple" | "placeholder" | "readOnly" | "options" | "onClear" | "helperText" | "helperIcon" | "loading" | "optionDisabled" | "totalOptions" | "initialSelectedOptions" | "noOptionsText" | "hideClearButton" | "selectedOptions" | "selectionDisplay" | "chipCount" | "onOptionsChange" | "onInputChange" | "onAddNewOption" | "allowSelectAll" | "optionComponent" | "optionsFilter" | "autoWidth" | "clearSearchOnChange" | "dropdownHeight" | "itemToKey" | "itemCompare" | "optionLabel">;
|
|
100
100
|
highlightedIndex: number;
|
|
101
101
|
selectedItem: unknown;
|
|
102
102
|
isOpen: boolean;
|
|
@@ -212,7 +212,7 @@ export declare const useAutocompleteContext: () => {
|
|
|
212
212
|
optionLabel?: (option: unknown) => string;
|
|
213
213
|
} & {
|
|
214
214
|
ref?: React.Ref<HTMLInputElement>;
|
|
215
|
-
}, "disabled" | "className" | "id" | "style" | "
|
|
215
|
+
}, "disabled" | "className" | "id" | "style" | "ref" | "label" | "meta" | "variant" | "multiline" | "multiple" | "placeholder" | "readOnly" | "options" | "onClear" | "helperText" | "helperIcon" | "loading" | "optionDisabled" | "totalOptions" | "initialSelectedOptions" | "noOptionsText" | "hideClearButton" | "selectedOptions" | "selectionDisplay" | "chipCount" | "onOptionsChange" | "onInputChange" | "onAddNewOption" | "allowSelectAll" | "optionComponent" | "optionsFilter" | "autoWidth" | "clearSearchOnChange" | "dropdownHeight" | "itemToKey" | "itemCompare" | "optionLabel">;
|
|
216
216
|
highlightedIndex: number;
|
|
217
217
|
selectedItem: unknown;
|
|
218
218
|
isOpen: boolean;
|
|
@@ -4,10 +4,12 @@ type StyledListItemType = {
|
|
|
4
4
|
$active?: string;
|
|
5
5
|
$isdisabled?: string;
|
|
6
6
|
};
|
|
7
|
-
export declare const StyledListItem: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components
|
|
8
|
-
export declare const AutocompleteOptionLabel: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components
|
|
7
|
+
export declare const StyledListItem: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").LiHTMLAttributes<HTMLLIElement>, HTMLLIElement>, keyof StyledListItemType> & StyledListItemType, never> & Partial<Pick<import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").LiHTMLAttributes<HTMLLIElement>, HTMLLIElement>, keyof StyledListItemType> & StyledListItemType, never>>> & string;
|
|
8
|
+
export declare const AutocompleteOptionLabel: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "$multiline"> & {
|
|
9
9
|
$multiline: boolean;
|
|
10
|
-
}
|
|
10
|
+
}, never> & Partial<Pick<import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "$multiline"> & {
|
|
11
|
+
$multiline: boolean;
|
|
12
|
+
}, never>>> & string;
|
|
11
13
|
export type AutocompleteOptionProps = {
|
|
12
14
|
index: number;
|
|
13
15
|
virtualItem: VirtualItem;
|
|
@@ -105,7 +105,7 @@ export declare const useAutocomplete: <T>({ options, totalOptions, label, meta,
|
|
|
105
105
|
optionLabel?: (option: T) => string;
|
|
106
106
|
}) & {
|
|
107
107
|
ref?: React.Ref<HTMLInputElement>;
|
|
108
|
-
}, "disabled" | "className" | "id" | "style" | "
|
|
108
|
+
}, "disabled" | "className" | "id" | "style" | "ref" | "label" | "meta" | "variant" | "multiline" | "multiple" | "placeholder" | "readOnly" | "options" | "onClear" | "helperText" | "helperIcon" | "loading" | "optionDisabled" | "totalOptions" | "initialSelectedOptions" | "noOptionsText" | "hideClearButton" | "selectedOptions" | "selectionDisplay" | "chipCount" | "onOptionsChange" | "onInputChange" | "onAddNewOption" | "allowSelectAll" | "optionComponent" | "optionsFilter" | "autoWidth" | "clearSearchOnChange" | "dropdownHeight" | "itemToKey" | "itemCompare" | "optionLabel">;
|
|
109
109
|
highlightedIndex: number;
|
|
110
110
|
selectedItem: T;
|
|
111
111
|
isOpen: boolean;
|