@equinor/eds-core-react 0.42.4 → 0.42.6-dev-11212024
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/eds-core-react.cjs +16 -13
- package/dist/esm/components/Autocomplete/Autocomplete.js +1 -1
- package/dist/esm/components/Datepicker/DateRangePicker.js +1 -0
- package/dist/esm/components/Datepicker/fields/DateField.js +2 -1
- package/dist/esm/components/Datepicker/fields/DateFieldSegments.js +2 -5
- package/dist/esm/components/Datepicker/fields/DateRangeField.js +4 -2
- package/dist/esm/components/Tooltip/Tooltip.js +8 -6
- package/dist/types/components/Datepicker/fields/DateField.d.ts +1 -1
- package/dist/types/components/Datepicker/fields/DateRangeField.d.ts +1 -0
- package/package.json +2 -2
package/dist/eds-core-react.cjs
CHANGED
|
@@ -1165,7 +1165,8 @@ const Tooltip$2 = /*#__PURE__*/react.forwardRef(function Tooltip({
|
|
|
1165
1165
|
y: arrowY
|
|
1166
1166
|
} = {}
|
|
1167
1167
|
},
|
|
1168
|
-
placement: finalPlacement
|
|
1168
|
+
placement: finalPlacement,
|
|
1169
|
+
elements
|
|
1169
1170
|
} = react$1.useFloating({
|
|
1170
1171
|
placement,
|
|
1171
1172
|
open,
|
|
@@ -1228,11 +1229,12 @@ const Tooltip$2 = /*#__PURE__*/react.forwardRef(function Tooltip({
|
|
|
1228
1229
|
...children.props
|
|
1229
1230
|
})
|
|
1230
1231
|
});
|
|
1231
|
-
|
|
1232
|
-
if (
|
|
1233
|
-
|
|
1232
|
+
react.useEffect(() => {
|
|
1233
|
+
if (!elements.floating) return;
|
|
1234
|
+
if (elements.floating.isConnected && shouldOpen && open) {
|
|
1235
|
+
elements.floating.showPopover();
|
|
1234
1236
|
}
|
|
1235
|
-
}, [open, shouldOpen,
|
|
1237
|
+
}, [open, shouldOpen, elements.floating]);
|
|
1236
1238
|
const TooltipEl = /*#__PURE__*/jsxRuntime.jsxs(StyledTooltip, {
|
|
1237
1239
|
popover: "manual",
|
|
1238
1240
|
...rest,
|
|
@@ -9772,7 +9774,7 @@ function AutocompleteInner(props, ref) {
|
|
|
9772
9774
|
return inputOptions.filter(x => !disabledItemsSet.has(x));
|
|
9773
9775
|
}, [inputOptions, optionDisabled]);
|
|
9774
9776
|
const allDisabled = enabledItems.length === 0;
|
|
9775
|
-
const selectedDisabledItemsSet = react.useMemo(() => new Set(selectedItems.filter(optionDisabled)), [selectedItems, optionDisabled]);
|
|
9777
|
+
const selectedDisabledItemsSet = react.useMemo(() => new Set(selectedItems.filter(x => x !== null && optionDisabled(x))), [selectedItems, optionDisabled]);
|
|
9776
9778
|
const selectedEnabledItems = react.useMemo(() => selectedItems.filter(x => !selectedDisabledItemsSet.has(x)), [selectedItems, selectedDisabledItemsSet]);
|
|
9777
9779
|
const allSelectedState = react.useMemo(() => {
|
|
9778
9780
|
if (!enabledItems || !selectedEnabledItems) return 'NONE';
|
|
@@ -11881,12 +11883,9 @@ function DateSegment({
|
|
|
11881
11883
|
* A field that wraps segments for inputting a date / date-time
|
|
11882
11884
|
*/
|
|
11883
11885
|
const DateFieldSegments = /*#__PURE__*/react.forwardRef((props, ref) => {
|
|
11884
|
-
const {
|
|
11885
|
-
locale
|
|
11886
|
-
} = reactAria.useLocale();
|
|
11887
11886
|
const state = datepicker.useDateFieldState({
|
|
11888
11887
|
...props,
|
|
11889
|
-
locale,
|
|
11888
|
+
locale: props.locale,
|
|
11890
11889
|
createCalendar: date.createCalendar
|
|
11891
11890
|
});
|
|
11892
11891
|
const {
|
|
@@ -11911,7 +11910,7 @@ const DateFieldSegments = /*#__PURE__*/react.forwardRef((props, ref) => {
|
|
|
11911
11910
|
DateFieldSegments.displayName = 'SingleDateField';
|
|
11912
11911
|
|
|
11913
11912
|
/**
|
|
11914
|
-
*
|
|
11913
|
+
* DateField is the input field used in {@link DatePicker} to type in a single date.
|
|
11915
11914
|
* Encapsulates styling / functionality for typing a date
|
|
11916
11915
|
*/
|
|
11917
11916
|
const DateField = /*#__PURE__*/react.forwardRef(function ({
|
|
@@ -11933,6 +11932,7 @@ const DateField = /*#__PURE__*/react.forwardRef(function ({
|
|
|
11933
11932
|
children: [/*#__PURE__*/jsxRuntime.jsx(DateFieldSegments, {
|
|
11934
11933
|
...state,
|
|
11935
11934
|
...fieldProps,
|
|
11935
|
+
locale: dateCreateProps.locale,
|
|
11936
11936
|
ref: inputRef
|
|
11937
11937
|
}), /*#__PURE__*/jsxRuntime.jsx("span", {
|
|
11938
11938
|
style: {
|
|
@@ -12268,7 +12268,8 @@ const DateRangeField = /*#__PURE__*/react.forwardRef(function (props, ref) {
|
|
|
12268
12268
|
...props.groupProps,
|
|
12269
12269
|
children: [/*#__PURE__*/jsxRuntime.jsx(DateFieldSegments, {
|
|
12270
12270
|
...props.startFieldProps,
|
|
12271
|
-
ref: fromRef
|
|
12271
|
+
ref: fromRef,
|
|
12272
|
+
locale: props.locale
|
|
12272
12273
|
}), /*#__PURE__*/jsxRuntime.jsx(Typography, {
|
|
12273
12274
|
as: 'span',
|
|
12274
12275
|
variant: 'text',
|
|
@@ -12279,7 +12280,8 @@ const DateRangeField = /*#__PURE__*/react.forwardRef(function (props, ref) {
|
|
|
12279
12280
|
children: "\u2014"
|
|
12280
12281
|
}), /*#__PURE__*/jsxRuntime.jsx(DateFieldSegments, {
|
|
12281
12282
|
...props.endFieldProps,
|
|
12282
|
-
ref: toRef
|
|
12283
|
+
ref: toRef,
|
|
12284
|
+
locale: props.locale
|
|
12283
12285
|
}), /*#__PURE__*/jsxRuntime.jsx("span", {
|
|
12284
12286
|
style: {
|
|
12285
12287
|
flex: '1 1 auto'
|
|
@@ -12423,6 +12425,7 @@ const DateRangePicker = /*#__PURE__*/react.forwardRef(({
|
|
|
12423
12425
|
ref: ref,
|
|
12424
12426
|
variant: props.variant,
|
|
12425
12427
|
disabled: isDisabled,
|
|
12428
|
+
locale: locale,
|
|
12426
12429
|
rightAdornments: /*#__PURE__*/jsxRuntime.jsx(Toggle, {
|
|
12427
12430
|
showClearButton: showClearButton,
|
|
12428
12431
|
buttonProps: buttonProps,
|
|
@@ -266,7 +266,7 @@ function AutocompleteInner(props, ref) {
|
|
|
266
266
|
return inputOptions.filter(x => !disabledItemsSet.has(x));
|
|
267
267
|
}, [inputOptions, optionDisabled]);
|
|
268
268
|
const allDisabled = enabledItems.length === 0;
|
|
269
|
-
const selectedDisabledItemsSet = useMemo(() => new Set(selectedItems.filter(optionDisabled)), [selectedItems, optionDisabled]);
|
|
269
|
+
const selectedDisabledItemsSet = useMemo(() => new Set(selectedItems.filter(x => x !== null && optionDisabled(x))), [selectedItems, optionDisabled]);
|
|
270
270
|
const selectedEnabledItems = useMemo(() => selectedItems.filter(x => !selectedDisabledItemsSet.has(x)), [selectedItems, selectedDisabledItemsSet]);
|
|
271
271
|
const allSelectedState = useMemo(() => {
|
|
272
272
|
if (!enabledItems || !selectedEnabledItems) return 'NONE';
|
|
@@ -149,6 +149,7 @@ const DateRangePicker = /*#__PURE__*/forwardRef(({
|
|
|
149
149
|
ref: ref,
|
|
150
150
|
variant: props.variant,
|
|
151
151
|
disabled: isDisabled,
|
|
152
|
+
locale: locale,
|
|
152
153
|
rightAdornments: /*#__PURE__*/jsx(Toggle, {
|
|
153
154
|
showClearButton: showClearButton,
|
|
154
155
|
buttonProps: buttonProps,
|
|
@@ -5,7 +5,7 @@ import { DateFieldSegments } from './DateFieldSegments.js';
|
|
|
5
5
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
|
-
*
|
|
8
|
+
* DateField is the input field used in {@link DatePicker} to type in a single date.
|
|
9
9
|
* Encapsulates styling / functionality for typing a date
|
|
10
10
|
*/
|
|
11
11
|
const DateField = /*#__PURE__*/forwardRef(function ({
|
|
@@ -27,6 +27,7 @@ const DateField = /*#__PURE__*/forwardRef(function ({
|
|
|
27
27
|
children: [/*#__PURE__*/jsx(DateFieldSegments, {
|
|
28
28
|
...state,
|
|
29
29
|
...fieldProps,
|
|
30
|
+
locale: dateCreateProps.locale,
|
|
30
31
|
ref: inputRef
|
|
31
32
|
}), /*#__PURE__*/jsx("span", {
|
|
32
33
|
style: {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useDateFieldState } from '@react-stately/datepicker';
|
|
2
|
-
import {
|
|
2
|
+
import { useDateField } from 'react-aria';
|
|
3
3
|
import { createCalendar } from '@internationalized/date';
|
|
4
4
|
import { DateSegment } from './DateSegment.js';
|
|
5
5
|
import { forwardRef } from 'react';
|
|
@@ -11,12 +11,9 @@ import { jsx } from 'react/jsx-runtime';
|
|
|
11
11
|
* A field that wraps segments for inputting a date / date-time
|
|
12
12
|
*/
|
|
13
13
|
const DateFieldSegments = /*#__PURE__*/forwardRef((props, ref) => {
|
|
14
|
-
const {
|
|
15
|
-
locale
|
|
16
|
-
} = useLocale();
|
|
17
14
|
const state = useDateFieldState({
|
|
18
15
|
...props,
|
|
19
|
-
locale,
|
|
16
|
+
locale: props.locale,
|
|
20
17
|
createCalendar
|
|
21
18
|
});
|
|
22
19
|
const {
|
|
@@ -19,7 +19,8 @@ const DateRangeField = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
19
19
|
...props.groupProps,
|
|
20
20
|
children: [/*#__PURE__*/jsx(DateFieldSegments, {
|
|
21
21
|
...props.startFieldProps,
|
|
22
|
-
ref: fromRef
|
|
22
|
+
ref: fromRef,
|
|
23
|
+
locale: props.locale
|
|
23
24
|
}), /*#__PURE__*/jsx(Typography, {
|
|
24
25
|
as: 'span',
|
|
25
26
|
variant: 'text',
|
|
@@ -30,7 +31,8 @@ const DateRangeField = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
30
31
|
children: "\u2014"
|
|
31
32
|
}), /*#__PURE__*/jsx(DateFieldSegments, {
|
|
32
33
|
...props.endFieldProps,
|
|
33
|
-
ref: toRef
|
|
34
|
+
ref: toRef,
|
|
35
|
+
locale: props.locale
|
|
34
36
|
}), /*#__PURE__*/jsx("span", {
|
|
35
37
|
style: {
|
|
36
38
|
flex: '1 1 auto'
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { forwardRef, useRef, useState, useMemo, useEffect, cloneElement } from 'react';
|
|
2
2
|
import { createPortal } from 'react-dom';
|
|
3
3
|
import styled from 'styled-components';
|
|
4
|
-
import { typographyTemplate, spacingsTemplate, bordersTemplate, mergeRefs
|
|
4
|
+
import { typographyTemplate, spacingsTemplate, bordersTemplate, mergeRefs } from '@equinor/eds-utils';
|
|
5
5
|
import { tooltip } from './Tooltip.tokens.js';
|
|
6
6
|
import { useFloating, offset, flip, shift, arrow, autoUpdate, useInteractions, useHover, useFocus, useRole, useDismiss } from '@floating-ui/react';
|
|
7
7
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
@@ -43,7 +43,8 @@ const Tooltip = /*#__PURE__*/forwardRef(function Tooltip({
|
|
|
43
43
|
y: arrowY
|
|
44
44
|
} = {}
|
|
45
45
|
},
|
|
46
|
-
placement: finalPlacement
|
|
46
|
+
placement: finalPlacement,
|
|
47
|
+
elements
|
|
47
48
|
} = useFloating({
|
|
48
49
|
placement,
|
|
49
50
|
open,
|
|
@@ -106,11 +107,12 @@ const Tooltip = /*#__PURE__*/forwardRef(function Tooltip({
|
|
|
106
107
|
...children.props
|
|
107
108
|
})
|
|
108
109
|
});
|
|
109
|
-
|
|
110
|
-
if (
|
|
111
|
-
|
|
110
|
+
useEffect(() => {
|
|
111
|
+
if (!elements.floating) return;
|
|
112
|
+
if (elements.floating.isConnected && shouldOpen && open) {
|
|
113
|
+
elements.floating.showPopover();
|
|
112
114
|
}
|
|
113
|
-
}, [open, shouldOpen,
|
|
115
|
+
}, [open, shouldOpen, elements.floating]);
|
|
114
116
|
const TooltipEl = /*#__PURE__*/jsxs(StyledTooltip, {
|
|
115
117
|
popover: "manual",
|
|
116
118
|
...rest,
|
|
@@ -13,7 +13,7 @@ type Props = {
|
|
|
13
13
|
dateCreateProps: DateFieldStateOptions<CalendarDate | CalendarDateTime>;
|
|
14
14
|
};
|
|
15
15
|
/**
|
|
16
|
-
*
|
|
16
|
+
* DateField is the input field used in {@link DatePicker} to type in a single date.
|
|
17
17
|
* Encapsulates styling / functionality for typing a date
|
|
18
18
|
*/
|
|
19
19
|
export declare const DateField: import("react").ForwardRefExoticComponent<Props & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -8,4 +8,5 @@ export declare const DateRangeField: import("react").ForwardRefExoticComponent<{
|
|
|
8
8
|
startFieldProps: AriaDatePickerProps<DateValue>;
|
|
9
9
|
endFieldProps: AriaDatePickerProps<DateValue>;
|
|
10
10
|
groupProps: GroupDOMAttributes;
|
|
11
|
+
locale: string;
|
|
11
12
|
} & Partial<InputProps> & import("react").RefAttributes<HTMLDivElement>>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@equinor/eds-core-react",
|
|
3
|
-
"version": "0.42.
|
|
3
|
+
"version": "0.42.6-dev-11212024",
|
|
4
4
|
"description": "The React implementation of the Equinor Design System",
|
|
5
5
|
"sideEffects": [
|
|
6
6
|
"**/*.css"
|
|
@@ -87,8 +87,8 @@
|
|
|
87
87
|
"@tanstack/react-virtual": "3.10.8",
|
|
88
88
|
"downshift": "9.0.8",
|
|
89
89
|
"react-aria": "^3.34.1",
|
|
90
|
-
"@equinor/eds-icons": "^0.21.0",
|
|
91
90
|
"@equinor/eds-tokens": "0.9.2",
|
|
91
|
+
"@equinor/eds-icons": "^0.21.0",
|
|
92
92
|
"@equinor/eds-utils": "0.8.5"
|
|
93
93
|
},
|
|
94
94
|
"scripts": {
|