@equinor/eds-core-react 0.21.0 → 0.22.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/dist/eds-core-react.cjs.js +124 -72
- package/dist/esm/components/Autocomplete/Autocomplete.js +3 -2
- package/dist/esm/components/Button/ToggleButton/ToggleButton.js +55 -0
- package/dist/esm/components/Button/index.js +3 -0
- package/dist/esm/components/Dialog/Dialog.js +27 -20
- package/dist/esm/components/Divider/Divider.js +15 -7
- package/dist/esm/components/Divider/Divider.tokens.js +5 -16
- package/dist/esm/components/EdsProvider/eds.context.js +5 -3
- package/dist/esm/components/Menu/Menu.js +4 -4
- package/dist/esm/components/Popover/Popover.js +6 -6
- package/dist/esm/components/Popover/PopoverActions.js +1 -1
- package/dist/esm/components/Popover/PopoverContent.js +1 -1
- package/dist/esm/components/Scrim/Scrim.js +6 -11
- package/dist/esm/components/Scrim/Scrim.tokens.js +0 -2
- package/dist/esm/components/Tooltip/Tooltip.js +2 -2
- package/dist/esm/components/TopBar/TopBar.js +5 -2
- package/dist/types/components/Button/ToggleButton/ToggleButton.d.ts +18 -0
- package/dist/types/components/Button/ToggleButton/index.d.ts +1 -0
- package/dist/types/components/Button/index.d.ts +3 -1
- package/dist/types/components/Divider/Divider.d.ts +4 -0
- package/dist/types/components/Divider/Divider.tokens.d.ts +0 -1
- package/dist/types/components/EdsProvider/eds.context.d.ts +1 -0
- package/dist/types/components/Select/commonStyles.d.ts +5 -0
- package/dist/types/components/TopBar/TopBar.d.ts +4 -0
- package/package.json +2 -2
|
@@ -8,8 +8,8 @@ var edsTokens = require('@equinor/eds-tokens');
|
|
|
8
8
|
var edsUtils = require('@equinor/eds-utils');
|
|
9
9
|
var jsxRuntime = require('react/jsx-runtime');
|
|
10
10
|
var edsIcons = require('@equinor/eds-icons');
|
|
11
|
-
var ReactDom = require('react-dom');
|
|
12
11
|
var reactDomInteractions = require('@floating-ui/react-dom-interactions');
|
|
12
|
+
var ReactDom = require('react-dom');
|
|
13
13
|
var downshift = require('downshift');
|
|
14
14
|
|
|
15
15
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
@@ -873,16 +873,17 @@ const InnerFullWidth = /*#__PURE__*/react.forwardRef(function InnerFullWidth(_re
|
|
|
873
873
|
});
|
|
874
874
|
|
|
875
875
|
const initalState$3 = {
|
|
876
|
+
/** Density for all components inside `EdsProvider` */
|
|
876
877
|
density: 'comfortable'
|
|
877
878
|
};
|
|
878
879
|
const EdsContext = /*#__PURE__*/react.createContext(initalState$3);
|
|
879
880
|
const EdsProvider = _ref => {
|
|
880
881
|
let {
|
|
881
882
|
children,
|
|
882
|
-
density
|
|
883
|
+
density
|
|
883
884
|
} = _ref;
|
|
884
885
|
const [state, setState] = react.useState({ ...initalState$3,
|
|
885
|
-
density
|
|
886
|
+
density: density || 'comfortable'
|
|
886
887
|
});
|
|
887
888
|
|
|
888
889
|
const setDensity = density => setState(prevState => ({ ...prevState,
|
|
@@ -895,7 +896,8 @@ const EdsProvider = _ref => {
|
|
|
895
896
|
}
|
|
896
897
|
}, [density, state.density]);
|
|
897
898
|
const value = {
|
|
898
|
-
density: state.density
|
|
899
|
+
density: state.density,
|
|
900
|
+
setDensity
|
|
899
901
|
};
|
|
900
902
|
return /*#__PURE__*/jsxRuntime.jsx(EdsContext.Provider, {
|
|
901
903
|
value: value,
|
|
@@ -1048,9 +1050,60 @@ const ButtonGroup = /*#__PURE__*/react.forwardRef(function ButtonGroup(_ref2, re
|
|
|
1048
1050
|
});
|
|
1049
1051
|
});
|
|
1050
1052
|
|
|
1053
|
+
const ToggleButton = /*#__PURE__*/react.forwardRef(function ToggleButton(_ref, ref) {
|
|
1054
|
+
let {
|
|
1055
|
+
children,
|
|
1056
|
+
multiple,
|
|
1057
|
+
selectedIndexes,
|
|
1058
|
+
onChange,
|
|
1059
|
+
...props
|
|
1060
|
+
} = _ref;
|
|
1061
|
+
const [pickedIndexes, setPickedIndexes] = react.useState(selectedIndexes || []);
|
|
1062
|
+
react.useEffect(() => {
|
|
1063
|
+
if (Array.isArray(selectedIndexes)) {
|
|
1064
|
+
setPickedIndexes(selectedIndexes);
|
|
1065
|
+
}
|
|
1066
|
+
}, [selectedIndexes]);
|
|
1067
|
+
const updatedChildren = react.Children.map(children, (child, index) => {
|
|
1068
|
+
const isSelected = pickedIndexes.includes(index);
|
|
1069
|
+
const childElement = child;
|
|
1070
|
+
|
|
1071
|
+
if ( /*#__PURE__*/react.isValidElement(child) && child.type === Button$1) {
|
|
1072
|
+
const buttonProps = {
|
|
1073
|
+
'aria-pressed': isSelected ? true : undefined,
|
|
1074
|
+
variant: isSelected ? 'contained' : 'outlined',
|
|
1075
|
+
onClick: e => {
|
|
1076
|
+
var _childElement$props, _childElement$props$o;
|
|
1077
|
+
|
|
1078
|
+
(_childElement$props = childElement.props) === null || _childElement$props === void 0 ? void 0 : (_childElement$props$o = _childElement$props.onClick) === null || _childElement$props$o === void 0 ? void 0 : _childElement$props$o.call(_childElement$props, e);
|
|
1079
|
+
let updatedSelection = [index];
|
|
1080
|
+
|
|
1081
|
+
if (multiple) {
|
|
1082
|
+
updatedSelection = pickedIndexes.includes(index) ? pickedIndexes.filter(i => i !== index) : [...pickedIndexes, index];
|
|
1083
|
+
}
|
|
1084
|
+
|
|
1085
|
+
setPickedIndexes(updatedSelection);
|
|
1086
|
+
|
|
1087
|
+
if (onChange) {
|
|
1088
|
+
onChange(updatedSelection);
|
|
1089
|
+
}
|
|
1090
|
+
}
|
|
1091
|
+
};
|
|
1092
|
+
return /*#__PURE__*/react.cloneElement(child, buttonProps);
|
|
1093
|
+
}
|
|
1094
|
+
});
|
|
1095
|
+
return /*#__PURE__*/jsxRuntime.jsx(ButtonGroup, {
|
|
1096
|
+
ref: ref,
|
|
1097
|
+
...props,
|
|
1098
|
+
children: updatedChildren
|
|
1099
|
+
});
|
|
1100
|
+
});
|
|
1101
|
+
|
|
1051
1102
|
const Button = Button$1;
|
|
1052
1103
|
Button.Group = ButtonGroup;
|
|
1104
|
+
Button.Toggle = ToggleButton;
|
|
1053
1105
|
Button.Group.displayName = 'Button.Group';
|
|
1106
|
+
Button.Toggle.displayName = 'Button.Toggle';
|
|
1054
1107
|
|
|
1055
1108
|
const {
|
|
1056
1109
|
typography: typography$i,
|
|
@@ -1825,17 +1878,6 @@ const {
|
|
|
1825
1878
|
}
|
|
1826
1879
|
}
|
|
1827
1880
|
} = edsTokens.tokens;
|
|
1828
|
-
const dividerHeight = 1;
|
|
1829
|
-
|
|
1830
|
-
const reduceByValue = subtractValue => valueWithUnit => {
|
|
1831
|
-
const valueAndUnit = valueWithUnit.split(/(\d+)/).filter(val => val.length > 0);
|
|
1832
|
-
return "".concat(parseInt(valueAndUnit[0]) - subtractValue) + valueAndUnit[1];
|
|
1833
|
-
};
|
|
1834
|
-
|
|
1835
|
-
const reduceValueByDividerHeight = reduceByValue(dividerHeight);
|
|
1836
|
-
const baseDivider$1 = {
|
|
1837
|
-
height: "".concat(dividerHeight, "px")
|
|
1838
|
-
};
|
|
1839
1881
|
const divider$1 = {
|
|
1840
1882
|
lighter: {
|
|
1841
1883
|
background: lighter
|
|
@@ -1847,47 +1889,54 @@ const divider$1 = {
|
|
|
1847
1889
|
background: mediumColor
|
|
1848
1890
|
}
|
|
1849
1891
|
};
|
|
1850
|
-
const small$7 = {
|
|
1892
|
+
const small$7 = {
|
|
1851
1893
|
spacings: {
|
|
1852
1894
|
top: spacingSmall$5,
|
|
1853
|
-
bottom:
|
|
1895
|
+
bottom: spacingSmall$5
|
|
1854
1896
|
}
|
|
1855
1897
|
};
|
|
1856
|
-
const medium$3 = {
|
|
1898
|
+
const medium$3 = {
|
|
1857
1899
|
spacings: {
|
|
1858
1900
|
top: spacingMedium$9,
|
|
1859
|
-
bottom:
|
|
1901
|
+
bottom: spacingMedium$9
|
|
1860
1902
|
}
|
|
1861
1903
|
};
|
|
1862
1904
|
|
|
1863
1905
|
var tokens$7 = /*#__PURE__*/Object.freeze({
|
|
1864
1906
|
__proto__: null,
|
|
1865
|
-
baseDivider: baseDivider$1,
|
|
1866
1907
|
divider: divider$1,
|
|
1867
1908
|
small: small$7,
|
|
1868
1909
|
medium: medium$3
|
|
1869
1910
|
});
|
|
1870
1911
|
|
|
1871
1912
|
const {
|
|
1872
|
-
divider
|
|
1873
|
-
baseDivider
|
|
1913
|
+
divider
|
|
1874
1914
|
} = tokens$7;
|
|
1875
1915
|
const StyledDivider$3 = styled__default["default"].hr.withConfig({
|
|
1876
1916
|
displayName: "Divider__StyledDivider",
|
|
1877
1917
|
componentId: "sc-1d8osde-0"
|
|
1878
|
-
})(
|
|
1879
|
-
|
|
1918
|
+
})(_ref => {
|
|
1919
|
+
let {
|
|
1920
|
+
backgroundColor,
|
|
1921
|
+
marginTop,
|
|
1922
|
+
marginBottom,
|
|
1923
|
+
dividerHeight
|
|
1924
|
+
} = _ref;
|
|
1925
|
+
return styled.css(["border:none;background-color:", ";margin-top:", ";margin-bottom:calc(", " - ", "px);height:", "px;"], backgroundColor, marginTop, marginBottom, dividerHeight, dividerHeight);
|
|
1926
|
+
});
|
|
1927
|
+
const Divider = /*#__PURE__*/react.forwardRef(function Divider(_ref2, ref) {
|
|
1880
1928
|
let {
|
|
1881
1929
|
color = 'medium',
|
|
1882
1930
|
variant = 'medium',
|
|
1931
|
+
size = '1',
|
|
1883
1932
|
...rest
|
|
1884
|
-
} =
|
|
1933
|
+
} = _ref2;
|
|
1885
1934
|
const colorValue = color === 'medium' ? 'mediumColor' : color;
|
|
1886
1935
|
const props = {
|
|
1887
1936
|
backgroundColor: divider[colorValue].background,
|
|
1888
1937
|
marginTop: tokens$7[variant].spacings.top,
|
|
1889
1938
|
marginBottom: tokens$7[variant].spacings.bottom,
|
|
1890
|
-
dividerHeight:
|
|
1939
|
+
dividerHeight: parseInt(size),
|
|
1891
1940
|
...rest
|
|
1892
1941
|
};
|
|
1893
1942
|
return /*#__PURE__*/jsxRuntime.jsx(StyledDivider$3, { ...props,
|
|
@@ -4323,14 +4372,16 @@ const StyledTopBar = styled__default["default"](Paper).withConfig({
|
|
|
4323
4372
|
componentId: "sc-1yj236q-0"
|
|
4324
4373
|
})(_ref => {
|
|
4325
4374
|
let {
|
|
4326
|
-
theme
|
|
4375
|
+
theme,
|
|
4376
|
+
sticky
|
|
4327
4377
|
} = _ref;
|
|
4328
|
-
return styled.css(["height:", ";
|
|
4378
|
+
return styled.css(["height:", ";background:", ";box-sizing:border-box;display:grid;grid-column-gap:", ";grid-template-columns:auto 1fr auto;grid-template-areas:'left center right';align-items:center;", " ", ";", " ", ""], theme.height, theme.background, theme.spacings.left, edsUtils.bordersTemplate(theme.border), edsUtils.spacingsTemplate(theme.spacings), edsUtils.typographyTemplate(theme.typography), sticky && styled.css(["position:sticky;top:0;z-index:1100;"]));
|
|
4329
4379
|
});
|
|
4330
4380
|
const TopBar$1 = /*#__PURE__*/react.forwardRef(function TopBar(_ref2, ref) {
|
|
4331
4381
|
let {
|
|
4332
4382
|
children,
|
|
4333
4383
|
elevation = 'none',
|
|
4384
|
+
sticky = true,
|
|
4334
4385
|
...props
|
|
4335
4386
|
} = _ref2;
|
|
4336
4387
|
const {
|
|
@@ -4347,6 +4398,7 @@ const TopBar$1 = /*#__PURE__*/react.forwardRef(function TopBar(_ref2, ref) {
|
|
|
4347
4398
|
children: /*#__PURE__*/jsxRuntime.jsx(StyledTopBar, {
|
|
4348
4399
|
forwardedAs: 'header',
|
|
4349
4400
|
elevation: elevation,
|
|
4401
|
+
sticky: sticky,
|
|
4350
4402
|
...rest,
|
|
4351
4403
|
children: children
|
|
4352
4404
|
})
|
|
@@ -4419,20 +4471,16 @@ const {
|
|
|
4419
4471
|
}
|
|
4420
4472
|
} = edsTokens.tokens;
|
|
4421
4473
|
const scrim = {
|
|
4422
|
-
width: '100%',
|
|
4423
|
-
height: '100%',
|
|
4424
4474
|
background: background$a
|
|
4425
4475
|
};
|
|
4426
4476
|
|
|
4427
4477
|
const {
|
|
4428
|
-
height: height$1,
|
|
4429
|
-
width,
|
|
4430
4478
|
background: background$9
|
|
4431
4479
|
} = scrim;
|
|
4432
|
-
const StyledScrim = styled__default["default"].
|
|
4480
|
+
const StyledScrim = styled__default["default"](reactDomInteractions.FloatingOverlay).withConfig({
|
|
4433
4481
|
displayName: "Scrim__StyledScrim",
|
|
4434
4482
|
componentId: "sc-1fr7uvy-0"
|
|
4435
|
-
})(["
|
|
4483
|
+
})(["background:", ";z-index:1300;align-items:center;justify-content:center;display:flex;"], background$9);
|
|
4436
4484
|
const ScrimContent = styled__default["default"].div.withConfig({
|
|
4437
4485
|
displayName: "Scrim__ScrimContent",
|
|
4438
4486
|
componentId: "sc-1fr7uvy-1"
|
|
@@ -4447,11 +4495,6 @@ const Scrim = /*#__PURE__*/react.forwardRef(function Scrim(_ref, ref) {
|
|
|
4447
4495
|
} = _ref;
|
|
4448
4496
|
const scrimRef = react.useRef(null);
|
|
4449
4497
|
const combinedScrimRef = react.useMemo(() => edsUtils.mergeRefs(scrimRef, ref), [scrimRef, ref]);
|
|
4450
|
-
const props = { ...rest,
|
|
4451
|
-
open,
|
|
4452
|
-
isDismissable
|
|
4453
|
-
};
|
|
4454
|
-
edsUtils.useHideBodyScroll(open);
|
|
4455
4498
|
edsUtils.useGlobalKeyPress('Escape', () => {
|
|
4456
4499
|
if (isDismissable && onClose && open) {
|
|
4457
4500
|
onClose();
|
|
@@ -4471,9 +4514,10 @@ const Scrim = /*#__PURE__*/react.forwardRef(function Scrim(_ref, ref) {
|
|
|
4471
4514
|
}
|
|
4472
4515
|
|
|
4473
4516
|
return /*#__PURE__*/jsxRuntime.jsx(StyledScrim, {
|
|
4517
|
+
lockScroll: true,
|
|
4474
4518
|
onClick: handleMouseClose,
|
|
4475
4519
|
ref: combinedScrimRef,
|
|
4476
|
-
...
|
|
4520
|
+
...rest,
|
|
4477
4521
|
children: /*#__PURE__*/jsxRuntime.jsx(ScrimContent, {
|
|
4478
4522
|
children: children
|
|
4479
4523
|
})
|
|
@@ -4568,39 +4612,46 @@ const Dialog$1 = /*#__PURE__*/react.forwardRef(function Dialog(_ref2, ref) {
|
|
|
4568
4612
|
isDismissable = false,
|
|
4569
4613
|
...props
|
|
4570
4614
|
} = _ref2;
|
|
4571
|
-
const rest = { ...props,
|
|
4572
|
-
open,
|
|
4573
|
-
ref
|
|
4574
|
-
};
|
|
4575
4615
|
const {
|
|
4576
4616
|
density
|
|
4577
4617
|
} = useEds();
|
|
4578
4618
|
const token = edsUtils.useToken({
|
|
4579
4619
|
density
|
|
4580
4620
|
}, dialog);
|
|
4621
|
+
const {
|
|
4622
|
+
floating,
|
|
4623
|
+
context
|
|
4624
|
+
} = reactDomInteractions.useFloating();
|
|
4581
4625
|
|
|
4582
4626
|
const handleDismiss = () => {
|
|
4583
4627
|
onClose && onClose();
|
|
4584
4628
|
};
|
|
4585
4629
|
|
|
4586
|
-
|
|
4587
|
-
|
|
4588
|
-
|
|
4589
|
-
|
|
4590
|
-
return /*#__PURE__*/jsxRuntime.jsx(
|
|
4591
|
-
|
|
4630
|
+
const dialogRef = react.useMemo(() => edsUtils.mergeRefs(floating, ref), [floating, ref]);
|
|
4631
|
+
const rest = { ...props,
|
|
4632
|
+
open
|
|
4633
|
+
};
|
|
4634
|
+
return /*#__PURE__*/jsxRuntime.jsx(reactDomInteractions.FloatingPortal, {
|
|
4635
|
+
id: "eds-dialog-container",
|
|
4636
|
+
children: /*#__PURE__*/jsxRuntime.jsx(styled.ThemeProvider, {
|
|
4592
4637
|
theme: token,
|
|
4593
|
-
children: /*#__PURE__*/jsxRuntime.jsx(Scrim, {
|
|
4638
|
+
children: open && /*#__PURE__*/jsxRuntime.jsx(Scrim, {
|
|
4594
4639
|
open: true,
|
|
4595
4640
|
isDismissable: isDismissable,
|
|
4596
4641
|
onClose: handleDismiss,
|
|
4597
|
-
children: /*#__PURE__*/jsxRuntime.jsx(
|
|
4598
|
-
|
|
4599
|
-
|
|
4600
|
-
|
|
4642
|
+
children: /*#__PURE__*/jsxRuntime.jsx(reactDomInteractions.FloatingFocusManager, {
|
|
4643
|
+
context: context,
|
|
4644
|
+
modal: true,
|
|
4645
|
+
returnFocus: true,
|
|
4646
|
+
children: /*#__PURE__*/jsxRuntime.jsx(StyledDialog, {
|
|
4647
|
+
elevation: "above_scrim",
|
|
4648
|
+
...rest,
|
|
4649
|
+
ref: dialogRef,
|
|
4650
|
+
children: children
|
|
4651
|
+
})
|
|
4601
4652
|
})
|
|
4602
4653
|
})
|
|
4603
|
-
})
|
|
4654
|
+
})
|
|
4604
4655
|
});
|
|
4605
4656
|
}); // Dialog.displayName = 'EdsDialog'
|
|
4606
4657
|
|
|
@@ -6395,8 +6446,8 @@ const Tooltip = /*#__PURE__*/react.forwardRef(function Tooltip(_ref, ref) {
|
|
|
6395
6446
|
ref: tooltipRef,
|
|
6396
6447
|
style: { ...style,
|
|
6397
6448
|
position: strategy,
|
|
6398
|
-
top: y
|
|
6399
|
-
left: x
|
|
6449
|
+
top: y || 0,
|
|
6450
|
+
left: x || 0
|
|
6400
6451
|
}
|
|
6401
6452
|
}),
|
|
6402
6453
|
children: [title, /*#__PURE__*/jsxRuntime.jsx(ArrowWrapper$1, {
|
|
@@ -6643,9 +6694,9 @@ const PopoverPaper = styled__default["default"](Paper).withConfig({
|
|
|
6643
6694
|
theme,
|
|
6644
6695
|
open
|
|
6645
6696
|
} = _ref;
|
|
6646
|
-
return styled.css(["", " ", "
|
|
6647
|
-
|
|
6648
|
-
}, edsUtils.typographyTemplate(theme.typography), theme.background,
|
|
6697
|
+
return styled.css(["", " ", " background:", ";", " z-index:1400;"], {
|
|
6698
|
+
display: open ? 'block' : 'none'
|
|
6699
|
+
}, edsUtils.typographyTemplate(theme.typography), theme.background, edsUtils.bordersTemplate(theme.border));
|
|
6649
6700
|
});
|
|
6650
6701
|
const ArrowWrapper = styled__default["default"].div.withConfig({
|
|
6651
6702
|
displayName: "Popover__ArrowWrapper",
|
|
@@ -6663,7 +6714,7 @@ const InnerWrapper = styled__default["default"].div.withConfig({
|
|
|
6663
6714
|
let {
|
|
6664
6715
|
theme
|
|
6665
6716
|
} = _ref3;
|
|
6666
|
-
return styled.css(["display:grid;grid-gap:", ";"], theme.spacings.bottom);
|
|
6717
|
+
return styled.css(["display:grid;grid-gap:", ";max-height:", ";width:max-content;max-width:", ";overflow:auto;"], theme.spacings.bottom, theme.maxHeight, theme.maxWidth);
|
|
6667
6718
|
});
|
|
6668
6719
|
const PopoverArrow = styled__default["default"].svg.withConfig({
|
|
6669
6720
|
displayName: "Popover__PopoverArrow",
|
|
@@ -6779,8 +6830,8 @@ const Popover$1 = /*#__PURE__*/react.forwardRef(function Popover(_ref5, ref) {
|
|
|
6779
6830
|
ref: popoverRef,
|
|
6780
6831
|
style: { ...style,
|
|
6781
6832
|
position: strategy,
|
|
6782
|
-
top: y
|
|
6783
|
-
left: x
|
|
6833
|
+
top: y || 0,
|
|
6834
|
+
left: x || 0
|
|
6784
6835
|
}
|
|
6785
6836
|
}),
|
|
6786
6837
|
children: [/*#__PURE__*/jsxRuntime.jsx(ArrowWrapper, {
|
|
@@ -6828,7 +6879,7 @@ const ContentWrapper = styled__default["default"].div.withConfig({
|
|
|
6828
6879
|
let {
|
|
6829
6880
|
theme
|
|
6830
6881
|
} = _ref;
|
|
6831
|
-
return styled.css(["
|
|
6882
|
+
return styled.css(["padding:0 ", " 0 ", ";:first-child{padding-top:", ";}:last-child{padding-bottom:", ";}"], theme.spacings.right, theme.spacings.left, theme.spacings.top, theme.spacings.bottom);
|
|
6832
6883
|
});
|
|
6833
6884
|
const PopoverContent = /*#__PURE__*/react.forwardRef(function PopoverContent(_ref2, ref) {
|
|
6834
6885
|
let {
|
|
@@ -6880,7 +6931,7 @@ const StyledPopoverActions = styled__default["default"].div.withConfig({
|
|
|
6880
6931
|
let {
|
|
6881
6932
|
theme
|
|
6882
6933
|
} = _ref;
|
|
6883
|
-
return styled.css(["display:grid;grid-gap:8px;grid-auto-flow:column;align-items:center;padding:0 ", " 0 ", ";:
|
|
6934
|
+
return styled.css(["display:grid;grid-gap:8px;grid-auto-flow:column;align-items:center;padding:0 ", " 0 ", ";:first-child{padding-top:", ";}:last-child{padding-bottom:", ";}"], theme.spacings.right, theme.spacings.left, theme.spacings.top, theme.spacings.bottom);
|
|
6884
6935
|
});
|
|
6885
6936
|
const PopoverActions = /*#__PURE__*/react.forwardRef(function PopoverActions(_ref2, ref) {
|
|
6886
6937
|
let {
|
|
@@ -8159,12 +8210,12 @@ const {
|
|
|
8159
8210
|
const MenuPaper = styled__default["default"](Paper).withConfig({
|
|
8160
8211
|
displayName: "Menu__MenuPaper",
|
|
8161
8212
|
componentId: "sc-1vlnqcj-0"
|
|
8162
|
-
})(["position:absolute;z-index:1400;width:fit-content;min-width:fit-content;", ";", ""], edsUtils.bordersTemplate(border), _ref => {
|
|
8213
|
+
})(["position:absolute;z-index:1400;width:fit-content;min-width:fit-content;", ";", ";"], edsUtils.bordersTemplate(border), _ref => {
|
|
8163
8214
|
let {
|
|
8164
8215
|
open
|
|
8165
8216
|
} = _ref;
|
|
8166
8217
|
return styled.css({
|
|
8167
|
-
|
|
8218
|
+
display: open ? 'block' : 'none'
|
|
8168
8219
|
});
|
|
8169
8220
|
});
|
|
8170
8221
|
const MenuContainer = /*#__PURE__*/react.forwardRef(function MenuContainer(_ref2, ref) {
|
|
@@ -8304,8 +8355,8 @@ const Menu$1 = /*#__PURE__*/react.forwardRef(function Menu(_ref3, ref) {
|
|
|
8304
8355
|
ref: popoverRef,
|
|
8305
8356
|
style: { ...style,
|
|
8306
8357
|
position: strategy,
|
|
8307
|
-
top: y
|
|
8308
|
-
left: x
|
|
8358
|
+
top: y || 0,
|
|
8359
|
+
left: x || 0
|
|
8309
8360
|
}
|
|
8310
8361
|
}),
|
|
8311
8362
|
children: /*#__PURE__*/jsxRuntime.jsx(MenuProvider, {
|
|
@@ -10714,8 +10765,9 @@ function AutocompleteInner(props, ref) {
|
|
|
10714
10765
|
ref: floating,
|
|
10715
10766
|
style: {
|
|
10716
10767
|
position: strategy,
|
|
10717
|
-
top: y
|
|
10718
|
-
left: x
|
|
10768
|
+
top: y || 0,
|
|
10769
|
+
left: x || 0,
|
|
10770
|
+
zIndex: 1400
|
|
10719
10771
|
}
|
|
10720
10772
|
}),
|
|
10721
10773
|
children: /*#__PURE__*/jsxRuntime.jsx(StyledList, { ...getMenuProps({
|
|
@@ -463,8 +463,9 @@ function AutocompleteInner(props, ref) {
|
|
|
463
463
|
ref: floating,
|
|
464
464
|
style: {
|
|
465
465
|
position: strategy,
|
|
466
|
-
top: y
|
|
467
|
-
left: x
|
|
466
|
+
top: y || 0,
|
|
467
|
+
left: x || 0,
|
|
468
|
+
zIndex: 1400
|
|
468
469
|
}
|
|
469
470
|
}),
|
|
470
471
|
children: /*#__PURE__*/jsx(StyledList, { ...getMenuProps({
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { forwardRef, useState, useEffect, Children, isValidElement, cloneElement } from 'react';
|
|
2
|
+
import { Button } from '../Button.js';
|
|
3
|
+
import { ButtonGroup } from '../ButtonGroup/ButtonGroup.js';
|
|
4
|
+
import { jsx } from 'react/jsx-runtime';
|
|
5
|
+
|
|
6
|
+
const ToggleButton = /*#__PURE__*/forwardRef(function ToggleButton(_ref, ref) {
|
|
7
|
+
let {
|
|
8
|
+
children,
|
|
9
|
+
multiple,
|
|
10
|
+
selectedIndexes,
|
|
11
|
+
onChange,
|
|
12
|
+
...props
|
|
13
|
+
} = _ref;
|
|
14
|
+
const [pickedIndexes, setPickedIndexes] = useState(selectedIndexes || []);
|
|
15
|
+
useEffect(() => {
|
|
16
|
+
if (Array.isArray(selectedIndexes)) {
|
|
17
|
+
setPickedIndexes(selectedIndexes);
|
|
18
|
+
}
|
|
19
|
+
}, [selectedIndexes]);
|
|
20
|
+
const updatedChildren = Children.map(children, (child, index) => {
|
|
21
|
+
const isSelected = pickedIndexes.includes(index);
|
|
22
|
+
const childElement = child;
|
|
23
|
+
|
|
24
|
+
if ( /*#__PURE__*/isValidElement(child) && child.type === Button) {
|
|
25
|
+
const buttonProps = {
|
|
26
|
+
'aria-pressed': isSelected ? true : undefined,
|
|
27
|
+
variant: isSelected ? 'contained' : 'outlined',
|
|
28
|
+
onClick: e => {
|
|
29
|
+
var _childElement$props, _childElement$props$o;
|
|
30
|
+
|
|
31
|
+
(_childElement$props = childElement.props) === null || _childElement$props === void 0 ? void 0 : (_childElement$props$o = _childElement$props.onClick) === null || _childElement$props$o === void 0 ? void 0 : _childElement$props$o.call(_childElement$props, e);
|
|
32
|
+
let updatedSelection = [index];
|
|
33
|
+
|
|
34
|
+
if (multiple) {
|
|
35
|
+
updatedSelection = pickedIndexes.includes(index) ? pickedIndexes.filter(i => i !== index) : [...pickedIndexes, index];
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
setPickedIndexes(updatedSelection);
|
|
39
|
+
|
|
40
|
+
if (onChange) {
|
|
41
|
+
onChange(updatedSelection);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
return /*#__PURE__*/cloneElement(child, buttonProps);
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
return /*#__PURE__*/jsx(ButtonGroup, {
|
|
49
|
+
ref: ref,
|
|
50
|
+
...props,
|
|
51
|
+
children: updatedChildren
|
|
52
|
+
});
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
export { ToggleButton };
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import { Button as Button$1 } from './Button.js';
|
|
2
2
|
import { ButtonGroup } from './ButtonGroup/ButtonGroup.js';
|
|
3
|
+
import { ToggleButton } from './ToggleButton/ToggleButton.js';
|
|
3
4
|
|
|
4
5
|
const Button = Button$1;
|
|
5
6
|
Button.Group = ButtonGroup;
|
|
7
|
+
Button.Toggle = ToggleButton;
|
|
6
8
|
Button.Group.displayName = 'Button.Group';
|
|
9
|
+
Button.Toggle.displayName = 'Button.Toggle';
|
|
7
10
|
|
|
8
11
|
export { Button };
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { forwardRef } from 'react';
|
|
2
|
-
import { createPortal } from 'react-dom';
|
|
1
|
+
import { forwardRef, useMemo } from 'react';
|
|
3
2
|
import styled, { css, ThemeProvider } from 'styled-components';
|
|
4
|
-
import { typographyTemplate, bordersTemplate, useToken } from '@equinor/eds-utils';
|
|
3
|
+
import { typographyTemplate, bordersTemplate, useToken, mergeRefs } from '@equinor/eds-utils';
|
|
5
4
|
import { Paper } from '../Paper/Paper.js';
|
|
6
5
|
import { Scrim } from '../Scrim/Scrim.js';
|
|
7
6
|
import { dialog } from './Dialog.tokens.js';
|
|
8
7
|
import { useEds } from '../EdsProvider/eds.context.js';
|
|
9
|
-
import {
|
|
8
|
+
import { useFloating, FloatingPortal, FloatingFocusManager } from '@floating-ui/react-dom-interactions';
|
|
9
|
+
import { jsx } from 'react/jsx-runtime';
|
|
10
10
|
|
|
11
11
|
const StyledDialog = styled(Paper).attrs({
|
|
12
12
|
tabIndex: 0,
|
|
@@ -31,39 +31,46 @@ const Dialog = /*#__PURE__*/forwardRef(function Dialog(_ref2, ref) {
|
|
|
31
31
|
isDismissable = false,
|
|
32
32
|
...props
|
|
33
33
|
} = _ref2;
|
|
34
|
-
const rest = { ...props,
|
|
35
|
-
open,
|
|
36
|
-
ref
|
|
37
|
-
};
|
|
38
34
|
const {
|
|
39
35
|
density
|
|
40
36
|
} = useEds();
|
|
41
37
|
const token = useToken({
|
|
42
38
|
density
|
|
43
39
|
}, dialog);
|
|
40
|
+
const {
|
|
41
|
+
floating,
|
|
42
|
+
context
|
|
43
|
+
} = useFloating();
|
|
44
44
|
|
|
45
45
|
const handleDismiss = () => {
|
|
46
46
|
onClose && onClose();
|
|
47
47
|
};
|
|
48
48
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
return /*#__PURE__*/jsx(
|
|
54
|
-
|
|
49
|
+
const dialogRef = useMemo(() => mergeRefs(floating, ref), [floating, ref]);
|
|
50
|
+
const rest = { ...props,
|
|
51
|
+
open
|
|
52
|
+
};
|
|
53
|
+
return /*#__PURE__*/jsx(FloatingPortal, {
|
|
54
|
+
id: "eds-dialog-container",
|
|
55
|
+
children: /*#__PURE__*/jsx(ThemeProvider, {
|
|
55
56
|
theme: token,
|
|
56
|
-
children: /*#__PURE__*/jsx(Scrim, {
|
|
57
|
+
children: open && /*#__PURE__*/jsx(Scrim, {
|
|
57
58
|
open: true,
|
|
58
59
|
isDismissable: isDismissable,
|
|
59
60
|
onClose: handleDismiss,
|
|
60
|
-
children: /*#__PURE__*/jsx(
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
61
|
+
children: /*#__PURE__*/jsx(FloatingFocusManager, {
|
|
62
|
+
context: context,
|
|
63
|
+
modal: true,
|
|
64
|
+
returnFocus: true,
|
|
65
|
+
children: /*#__PURE__*/jsx(StyledDialog, {
|
|
66
|
+
elevation: "above_scrim",
|
|
67
|
+
...rest,
|
|
68
|
+
ref: dialogRef,
|
|
69
|
+
children: children
|
|
70
|
+
})
|
|
64
71
|
})
|
|
65
72
|
})
|
|
66
|
-
})
|
|
73
|
+
})
|
|
67
74
|
});
|
|
68
75
|
}); // Dialog.displayName = 'EdsDialog'
|
|
69
76
|
|
|
@@ -1,28 +1,36 @@
|
|
|
1
1
|
import { forwardRef } from 'react';
|
|
2
|
-
import styled from 'styled-components';
|
|
2
|
+
import styled, { css } from 'styled-components';
|
|
3
3
|
import * as Divider_tokens from './Divider.tokens.js';
|
|
4
4
|
import { jsx } from 'react/jsx-runtime';
|
|
5
5
|
|
|
6
6
|
const {
|
|
7
|
-
divider
|
|
8
|
-
baseDivider
|
|
7
|
+
divider
|
|
9
8
|
} = Divider_tokens;
|
|
10
9
|
const StyledDivider = styled.hr.withConfig({
|
|
11
10
|
displayName: "Divider__StyledDivider",
|
|
12
11
|
componentId: "sc-1d8osde-0"
|
|
13
|
-
})(
|
|
14
|
-
|
|
12
|
+
})(_ref => {
|
|
13
|
+
let {
|
|
14
|
+
backgroundColor,
|
|
15
|
+
marginTop,
|
|
16
|
+
marginBottom,
|
|
17
|
+
dividerHeight
|
|
18
|
+
} = _ref;
|
|
19
|
+
return css(["border:none;background-color:", ";margin-top:", ";margin-bottom:calc(", " - ", "px);height:", "px;"], backgroundColor, marginTop, marginBottom, dividerHeight, dividerHeight);
|
|
20
|
+
});
|
|
21
|
+
const Divider = /*#__PURE__*/forwardRef(function Divider(_ref2, ref) {
|
|
15
22
|
let {
|
|
16
23
|
color = 'medium',
|
|
17
24
|
variant = 'medium',
|
|
25
|
+
size = '1',
|
|
18
26
|
...rest
|
|
19
|
-
} =
|
|
27
|
+
} = _ref2;
|
|
20
28
|
const colorValue = color === 'medium' ? 'mediumColor' : color;
|
|
21
29
|
const props = {
|
|
22
30
|
backgroundColor: divider[colorValue].background,
|
|
23
31
|
marginTop: Divider_tokens[variant].spacings.top,
|
|
24
32
|
marginBottom: Divider_tokens[variant].spacings.bottom,
|
|
25
|
-
dividerHeight:
|
|
33
|
+
dividerHeight: parseInt(size),
|
|
26
34
|
...rest
|
|
27
35
|
};
|
|
28
36
|
return /*#__PURE__*/jsx(StyledDivider, { ...props,
|
|
@@ -21,17 +21,6 @@ const {
|
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
23
|
} = tokens$1;
|
|
24
|
-
const dividerHeight = 1;
|
|
25
|
-
|
|
26
|
-
const reduceByValue = subtractValue => valueWithUnit => {
|
|
27
|
-
const valueAndUnit = valueWithUnit.split(/(\d+)/).filter(val => val.length > 0);
|
|
28
|
-
return "".concat(parseInt(valueAndUnit[0]) - subtractValue) + valueAndUnit[1];
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
const reduceValueByDividerHeight = reduceByValue(dividerHeight);
|
|
32
|
-
const baseDivider = {
|
|
33
|
-
height: "".concat(dividerHeight, "px")
|
|
34
|
-
};
|
|
35
24
|
const divider = {
|
|
36
25
|
lighter: {
|
|
37
26
|
background: lighter
|
|
@@ -43,17 +32,17 @@ const divider = {
|
|
|
43
32
|
background: mediumColor
|
|
44
33
|
}
|
|
45
34
|
};
|
|
46
|
-
const small = {
|
|
35
|
+
const small = {
|
|
47
36
|
spacings: {
|
|
48
37
|
top: spacingSmall,
|
|
49
|
-
bottom:
|
|
38
|
+
bottom: spacingSmall
|
|
50
39
|
}
|
|
51
40
|
};
|
|
52
|
-
const medium = {
|
|
41
|
+
const medium = {
|
|
53
42
|
spacings: {
|
|
54
43
|
top: spacingMedium,
|
|
55
|
-
bottom:
|
|
44
|
+
bottom: spacingMedium
|
|
56
45
|
}
|
|
57
46
|
};
|
|
58
47
|
|
|
59
|
-
export {
|
|
48
|
+
export { divider, medium, small };
|
|
@@ -2,16 +2,17 @@ import { useState, useEffect, useContext, createContext } from 'react';
|
|
|
2
2
|
import { jsx } from 'react/jsx-runtime';
|
|
3
3
|
|
|
4
4
|
const initalState = {
|
|
5
|
+
/** Density for all components inside `EdsProvider` */
|
|
5
6
|
density: 'comfortable'
|
|
6
7
|
};
|
|
7
8
|
const EdsContext = /*#__PURE__*/createContext(initalState);
|
|
8
9
|
const EdsProvider = _ref => {
|
|
9
10
|
let {
|
|
10
11
|
children,
|
|
11
|
-
density
|
|
12
|
+
density
|
|
12
13
|
} = _ref;
|
|
13
14
|
const [state, setState] = useState({ ...initalState,
|
|
14
|
-
density
|
|
15
|
+
density: density || 'comfortable'
|
|
15
16
|
});
|
|
16
17
|
|
|
17
18
|
const setDensity = density => setState(prevState => ({ ...prevState,
|
|
@@ -24,7 +25,8 @@ const EdsProvider = _ref => {
|
|
|
24
25
|
}
|
|
25
26
|
}, [density, state.density]);
|
|
26
27
|
const value = {
|
|
27
|
-
density: state.density
|
|
28
|
+
density: state.density,
|
|
29
|
+
setDensity
|
|
28
30
|
};
|
|
29
31
|
return /*#__PURE__*/jsx(EdsContext.Provider, {
|
|
30
32
|
value: value,
|
|
@@ -15,12 +15,12 @@ const {
|
|
|
15
15
|
const MenuPaper = styled(Paper).withConfig({
|
|
16
16
|
displayName: "Menu__MenuPaper",
|
|
17
17
|
componentId: "sc-1vlnqcj-0"
|
|
18
|
-
})(["position:absolute;z-index:1400;width:fit-content;min-width:fit-content;", ";", ""], bordersTemplate(border), _ref => {
|
|
18
|
+
})(["position:absolute;z-index:1400;width:fit-content;min-width:fit-content;", ";", ";"], bordersTemplate(border), _ref => {
|
|
19
19
|
let {
|
|
20
20
|
open
|
|
21
21
|
} = _ref;
|
|
22
22
|
return css({
|
|
23
|
-
|
|
23
|
+
display: open ? 'block' : 'none'
|
|
24
24
|
});
|
|
25
25
|
});
|
|
26
26
|
const MenuContainer = /*#__PURE__*/forwardRef(function MenuContainer(_ref2, ref) {
|
|
@@ -160,8 +160,8 @@ const Menu = /*#__PURE__*/forwardRef(function Menu(_ref3, ref) {
|
|
|
160
160
|
ref: popoverRef,
|
|
161
161
|
style: { ...style,
|
|
162
162
|
position: strategy,
|
|
163
|
-
top: y
|
|
164
|
-
left: x
|
|
163
|
+
top: y || 0,
|
|
164
|
+
left: x || 0
|
|
165
165
|
}
|
|
166
166
|
}),
|
|
167
167
|
children: /*#__PURE__*/jsx(MenuProvider, {
|
|
@@ -15,9 +15,9 @@ const PopoverPaper = styled(Paper).withConfig({
|
|
|
15
15
|
theme,
|
|
16
16
|
open
|
|
17
17
|
} = _ref;
|
|
18
|
-
return css(["", " ", "
|
|
19
|
-
|
|
20
|
-
}, typographyTemplate(theme.typography), theme.background,
|
|
18
|
+
return css(["", " ", " background:", ";", " z-index:1400;"], {
|
|
19
|
+
display: open ? 'block' : 'none'
|
|
20
|
+
}, typographyTemplate(theme.typography), theme.background, bordersTemplate(theme.border));
|
|
21
21
|
});
|
|
22
22
|
const ArrowWrapper = styled.div.withConfig({
|
|
23
23
|
displayName: "Popover__ArrowWrapper",
|
|
@@ -35,7 +35,7 @@ const InnerWrapper = styled.div.withConfig({
|
|
|
35
35
|
let {
|
|
36
36
|
theme
|
|
37
37
|
} = _ref3;
|
|
38
|
-
return css(["display:grid;grid-gap:", ";"], theme.spacings.bottom);
|
|
38
|
+
return css(["display:grid;grid-gap:", ";max-height:", ";width:max-content;max-width:", ";overflow:auto;"], theme.spacings.bottom, theme.maxHeight, theme.maxWidth);
|
|
39
39
|
});
|
|
40
40
|
const PopoverArrow = styled.svg.withConfig({
|
|
41
41
|
displayName: "Popover__PopoverArrow",
|
|
@@ -151,8 +151,8 @@ const Popover = /*#__PURE__*/forwardRef(function Popover(_ref5, ref) {
|
|
|
151
151
|
ref: popoverRef,
|
|
152
152
|
style: { ...style,
|
|
153
153
|
position: strategy,
|
|
154
|
-
top: y
|
|
155
|
-
left: x
|
|
154
|
+
top: y || 0,
|
|
155
|
+
left: x || 0
|
|
156
156
|
}
|
|
157
157
|
}),
|
|
158
158
|
children: [/*#__PURE__*/jsx(ArrowWrapper, {
|
|
@@ -9,7 +9,7 @@ const StyledPopoverActions = styled.div.withConfig({
|
|
|
9
9
|
let {
|
|
10
10
|
theme
|
|
11
11
|
} = _ref;
|
|
12
|
-
return css(["display:grid;grid-gap:8px;grid-auto-flow:column;align-items:center;padding:0 ", " 0 ", ";:
|
|
12
|
+
return css(["display:grid;grid-gap:8px;grid-auto-flow:column;align-items:center;padding:0 ", " 0 ", ";:first-child{padding-top:", ";}:last-child{padding-bottom:", ";}"], theme.spacings.right, theme.spacings.left, theme.spacings.top, theme.spacings.bottom);
|
|
13
13
|
});
|
|
14
14
|
const PopoverActions = /*#__PURE__*/forwardRef(function PopoverActions(_ref2, ref) {
|
|
15
15
|
let {
|
|
@@ -9,7 +9,7 @@ const ContentWrapper = styled.div.withConfig({
|
|
|
9
9
|
let {
|
|
10
10
|
theme
|
|
11
11
|
} = _ref;
|
|
12
|
-
return css(["
|
|
12
|
+
return css(["padding:0 ", " 0 ", ";:first-child{padding-top:", ";}:last-child{padding-bottom:", ";}"], theme.spacings.right, theme.spacings.left, theme.spacings.top, theme.spacings.bottom);
|
|
13
13
|
});
|
|
14
14
|
const PopoverContent = /*#__PURE__*/forwardRef(function PopoverContent(_ref2, ref) {
|
|
15
15
|
let {
|
|
@@ -1,18 +1,17 @@
|
|
|
1
1
|
import { forwardRef, useRef, useMemo } from 'react';
|
|
2
2
|
import styled from 'styled-components';
|
|
3
3
|
import { scrim } from './Scrim.tokens.js';
|
|
4
|
-
import { mergeRefs,
|
|
4
|
+
import { mergeRefs, useGlobalKeyPress } from '@equinor/eds-utils';
|
|
5
|
+
import { FloatingOverlay } from '@floating-ui/react-dom-interactions';
|
|
5
6
|
import { jsx } from 'react/jsx-runtime';
|
|
6
7
|
|
|
7
8
|
const {
|
|
8
|
-
height,
|
|
9
|
-
width,
|
|
10
9
|
background
|
|
11
10
|
} = scrim;
|
|
12
|
-
const StyledScrim = styled.
|
|
11
|
+
const StyledScrim = styled(FloatingOverlay).withConfig({
|
|
13
12
|
displayName: "Scrim__StyledScrim",
|
|
14
13
|
componentId: "sc-1fr7uvy-0"
|
|
15
|
-
})(["
|
|
14
|
+
})(["background:", ";z-index:1300;align-items:center;justify-content:center;display:flex;"], background);
|
|
16
15
|
const ScrimContent = styled.div.withConfig({
|
|
17
16
|
displayName: "Scrim__ScrimContent",
|
|
18
17
|
componentId: "sc-1fr7uvy-1"
|
|
@@ -27,11 +26,6 @@ const Scrim = /*#__PURE__*/forwardRef(function Scrim(_ref, ref) {
|
|
|
27
26
|
} = _ref;
|
|
28
27
|
const scrimRef = useRef(null);
|
|
29
28
|
const combinedScrimRef = useMemo(() => mergeRefs(scrimRef, ref), [scrimRef, ref]);
|
|
30
|
-
const props = { ...rest,
|
|
31
|
-
open,
|
|
32
|
-
isDismissable
|
|
33
|
-
};
|
|
34
|
-
useHideBodyScroll(open);
|
|
35
29
|
useGlobalKeyPress('Escape', () => {
|
|
36
30
|
if (isDismissable && onClose && open) {
|
|
37
31
|
onClose();
|
|
@@ -51,9 +45,10 @@ const Scrim = /*#__PURE__*/forwardRef(function Scrim(_ref, ref) {
|
|
|
51
45
|
}
|
|
52
46
|
|
|
53
47
|
return /*#__PURE__*/jsx(StyledScrim, {
|
|
48
|
+
lockScroll: true,
|
|
54
49
|
onClick: handleMouseClose,
|
|
55
50
|
ref: combinedScrimRef,
|
|
56
|
-
...
|
|
51
|
+
...rest,
|
|
57
52
|
children: /*#__PURE__*/jsx(ScrimContent, {
|
|
58
53
|
children: children
|
|
59
54
|
})
|
|
@@ -116,8 +116,8 @@ const Tooltip = /*#__PURE__*/forwardRef(function Tooltip(_ref, ref) {
|
|
|
116
116
|
ref: tooltipRef,
|
|
117
117
|
style: { ...style,
|
|
118
118
|
position: strategy,
|
|
119
|
-
top: y
|
|
120
|
-
left: x
|
|
119
|
+
top: y || 0,
|
|
120
|
+
left: x || 0
|
|
121
121
|
}
|
|
122
122
|
}),
|
|
123
123
|
children: [title, /*#__PURE__*/jsx(ArrowWrapper, {
|
|
@@ -11,14 +11,16 @@ const StyledTopBar = styled(Paper).withConfig({
|
|
|
11
11
|
componentId: "sc-1yj236q-0"
|
|
12
12
|
})(_ref => {
|
|
13
13
|
let {
|
|
14
|
-
theme
|
|
14
|
+
theme,
|
|
15
|
+
sticky
|
|
15
16
|
} = _ref;
|
|
16
|
-
return css(["height:", ";
|
|
17
|
+
return css(["height:", ";background:", ";box-sizing:border-box;display:grid;grid-column-gap:", ";grid-template-columns:auto 1fr auto;grid-template-areas:'left center right';align-items:center;", " ", ";", " ", ""], theme.height, theme.background, theme.spacings.left, bordersTemplate(theme.border), spacingsTemplate(theme.spacings), typographyTemplate(theme.typography), sticky && css(["position:sticky;top:0;z-index:1100;"]));
|
|
17
18
|
});
|
|
18
19
|
const TopBar = /*#__PURE__*/forwardRef(function TopBar(_ref2, ref) {
|
|
19
20
|
let {
|
|
20
21
|
children,
|
|
21
22
|
elevation = 'none',
|
|
23
|
+
sticky = true,
|
|
22
24
|
...props
|
|
23
25
|
} = _ref2;
|
|
24
26
|
const {
|
|
@@ -35,6 +37,7 @@ const TopBar = /*#__PURE__*/forwardRef(function TopBar(_ref2, ref) {
|
|
|
35
37
|
children: /*#__PURE__*/jsx(StyledTopBar, {
|
|
36
38
|
forwardedAs: 'header',
|
|
37
39
|
elevation: elevation,
|
|
40
|
+
sticky: sticky,
|
|
38
41
|
...rest,
|
|
39
42
|
children: children
|
|
40
43
|
})
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { HTMLAttributes } from 'react';
|
|
2
|
+
import { ButtonGroupProps } from '../ButtonGroup';
|
|
3
|
+
export declare type ToggleButtonProps = {
|
|
4
|
+
/** Multiple */
|
|
5
|
+
multiple?: boolean;
|
|
6
|
+
/** Array of selected indexses. */
|
|
7
|
+
selectedIndexes?: number[];
|
|
8
|
+
/** OnChange */
|
|
9
|
+
onChange?: (indexes: number[]) => void;
|
|
10
|
+
} & Omit<HTMLAttributes<HTMLElement>, 'onChange'> & Pick<ButtonGroupProps, 'vertical'>;
|
|
11
|
+
export declare const ToggleButton: import("react").ForwardRefExoticComponent<{
|
|
12
|
+
/** Multiple */
|
|
13
|
+
multiple?: boolean;
|
|
14
|
+
/** Array of selected indexses. */
|
|
15
|
+
selectedIndexes?: number[];
|
|
16
|
+
/** OnChange */
|
|
17
|
+
onChange?: (indexes: number[]) => void;
|
|
18
|
+
} & Omit<HTMLAttributes<HTMLElement>, "onChange"> & Pick<ButtonGroupProps, "vertical"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './ToggleButton';
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { Button as ButtonWrapper, ButtonProps } from './Button';
|
|
2
2
|
import { ButtonGroup, ButtonGroupProps } from './ButtonGroup/ButtonGroup';
|
|
3
|
+
import { ToggleButton, ToggleButtonProps } from './ToggleButton/ToggleButton';
|
|
3
4
|
declare type ButtonCompoundProps = typeof ButtonWrapper & {
|
|
4
5
|
Group: typeof ButtonGroup;
|
|
6
|
+
Toggle: typeof ToggleButton;
|
|
5
7
|
};
|
|
6
8
|
declare const Button: ButtonCompoundProps;
|
|
7
9
|
export { Button };
|
|
8
|
-
export type { ButtonProps, ButtonGroupProps };
|
|
10
|
+
export type { ButtonProps, ButtonGroupProps, ToggleButtonProps };
|
|
@@ -4,6 +4,8 @@ export declare type DividerProps = {
|
|
|
4
4
|
color?: 'lighter' | 'light' | 'medium';
|
|
5
5
|
/** Vertical spacings */
|
|
6
6
|
variant?: 'small' | 'medium';
|
|
7
|
+
/** Divider thickness in px*/
|
|
8
|
+
size?: '1' | '2';
|
|
7
9
|
/** @ignore */
|
|
8
10
|
className?: string;
|
|
9
11
|
} & HTMLAttributes<HTMLHRElement>;
|
|
@@ -12,6 +14,8 @@ export declare const Divider: import("react").ForwardRefExoticComponent<{
|
|
|
12
14
|
color?: 'lighter' | 'light' | 'medium';
|
|
13
15
|
/** Vertical spacings */
|
|
14
16
|
variant?: 'small' | 'medium';
|
|
17
|
+
/** Divider thickness in px*/
|
|
18
|
+
size?: '1' | '2';
|
|
15
19
|
/** @ignore */
|
|
16
20
|
className?: string;
|
|
17
21
|
} & HTMLAttributes<HTMLHRElement> & import("react").RefAttributes<HTMLHRElement>>;
|
|
@@ -5,7 +5,6 @@ declare type DividerVariantsToken = {
|
|
|
5
5
|
light: DividerToken;
|
|
6
6
|
mediumColor: DividerToken;
|
|
7
7
|
};
|
|
8
|
-
export declare const baseDivider: DividerToken;
|
|
9
8
|
export declare const divider: DividerVariantsToken;
|
|
10
9
|
export declare const small: DividerToken;
|
|
11
10
|
export declare const medium: DividerToken;
|
|
@@ -23,6 +23,11 @@ export declare const StyledButton: import("styled-components").StyledComponent<i
|
|
|
23
23
|
Group: import("react").ForwardRefExoticComponent<{
|
|
24
24
|
vertical?: boolean;
|
|
25
25
|
} & HTMLAttributes<HTMLDivElement> & import("react").RefAttributes<HTMLDivElement>>;
|
|
26
|
+
Toggle: import("react").ForwardRefExoticComponent<{
|
|
27
|
+
multiple?: boolean;
|
|
28
|
+
selectedIndexes?: number[];
|
|
29
|
+
onChange?: (indexes: number[]) => void;
|
|
30
|
+
} & Omit<HTMLAttributes<HTMLElement>, "onChange"> & Pick<import("../Button").ButtonGroupProps, "vertical"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
26
31
|
}, import("styled-components").DefaultTheme, {}, never>;
|
|
27
32
|
export declare const StyledInputWrapper: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
28
33
|
export {};
|
|
@@ -3,8 +3,12 @@ import type { Elevations } from '@equinor/eds-tokens';
|
|
|
3
3
|
declare type AvailableElevations = keyof Pick<Elevations, 'none' | 'raised'>;
|
|
4
4
|
export declare type TopbarProps = {
|
|
5
5
|
elevation?: AvailableElevations;
|
|
6
|
+
/** Topbar will stick to top when scrolling. */
|
|
7
|
+
sticky?: boolean;
|
|
6
8
|
} & HTMLAttributes<HTMLDivElement>;
|
|
7
9
|
export declare const TopBar: import("react").ForwardRefExoticComponent<{
|
|
8
10
|
elevation?: AvailableElevations;
|
|
11
|
+
/** Topbar will stick to top when scrolling. */
|
|
12
|
+
sticky?: boolean;
|
|
9
13
|
} & HTMLAttributes<HTMLDivElement> & import("react").RefAttributes<HTMLDivElement>>;
|
|
10
14
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@equinor/eds-core-react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.22.0",
|
|
4
4
|
"description": "The React implementation of the Equinor Design System",
|
|
5
5
|
"sideEffects": [
|
|
6
6
|
"**/*.css"
|
|
@@ -86,7 +86,7 @@
|
|
|
86
86
|
},
|
|
87
87
|
"dependencies": {
|
|
88
88
|
"@babel/runtime": "^7.17.9",
|
|
89
|
-
"@equinor/eds-icons": "0.
|
|
89
|
+
"@equinor/eds-icons": "0.14.0",
|
|
90
90
|
"@equinor/eds-tokens": "0.7.1",
|
|
91
91
|
"@equinor/eds-utils": "0.3.0",
|
|
92
92
|
"@floating-ui/react-dom-interactions": "^0.6.6",
|