@equinor/eds-core-react 0.15.0-dev.20211116v2 → 0.16.1-dev.12072021
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/core-react.cjs.js +425 -143
- package/dist/esm/components/Accordion/AccordionHeader.js +2 -2
- package/dist/esm/components/Accordion/AccordionItem.js +2 -2
- package/dist/esm/components/Breadcrumbs/Breadcrumbs.js +1 -1
- package/dist/esm/components/Button/Button.js +1 -1
- package/dist/esm/components/Button/tokens/button.js +2 -2
- package/dist/esm/components/Button/tokens/contained.js +4 -4
- package/dist/esm/components/Button/tokens/ghost.js +4 -4
- package/dist/esm/components/Button/tokens/icon.js +6 -6
- package/dist/esm/components/Button/tokens/outlined.js +4 -4
- package/dist/esm/components/Card/Card.js +2 -3
- package/dist/esm/components/Card/CardActions.js +6 -2
- package/dist/esm/components/Card/CardContent.js +24 -0
- package/dist/esm/components/Card/CardHeader.js +1 -1
- package/dist/esm/components/Card/CardMedia.js +2 -2
- package/dist/esm/components/Card/index.js +3 -0
- package/dist/esm/components/Checkbox/Input.js +5 -3
- package/dist/esm/components/Chip/Chip.js +1 -1
- package/dist/esm/components/Divider/Divider.tokens.js +2 -2
- package/dist/esm/components/Icon/Icon.js +7 -7
- package/dist/esm/components/Input/Input.tokens.js +4 -4
- package/dist/esm/components/Menu/Menu.context.js +6 -1
- package/dist/esm/components/Menu/Menu.js +6 -0
- package/dist/esm/components/Menu/MenuItem.js +6 -6
- package/dist/esm/components/Menu/MenuList.js +2 -2
- package/dist/esm/components/Menu/MenuSection.js +4 -4
- package/dist/esm/components/Pagination/Pagination.js +5 -10
- package/dist/esm/components/Progress/Circular/CircularProgress.js +1 -1
- package/dist/esm/components/Progress/Linear/LinearProgress.js +1 -1
- package/dist/esm/components/Radio/Radio.js +4 -2
- package/dist/esm/components/Search/Search.js +10 -8
- package/dist/esm/components/Search/Search.tokens.js +7 -0
- package/dist/esm/components/Select/MultiSelect/MultiSelect.js +2 -2
- package/dist/esm/components/Select/Select.tokens.js +2 -2
- package/dist/esm/components/Select/SingleSelect/SingleSelect.js +1 -1
- package/dist/esm/components/Slider/Slider.js +4 -4
- package/dist/esm/components/Slider/SliderInput.js +1 -1
- package/dist/esm/components/Switch/Switch.styles.js +1 -1
- package/dist/esm/components/Switch/Switch.tokens.js +4 -4
- package/dist/esm/components/Switch/SwitchSmall.js +2 -1
- package/dist/esm/components/Table/DataCell/DataCell.tokens.js +2 -2
- package/dist/esm/components/Tabs/Tab.js +2 -2
- package/dist/esm/components/Tabs/TabList.js +2 -2
- package/dist/esm/components/Tabs/TabPanel.js +1 -1
- package/dist/esm/components/Tabs/TabPanels.js +2 -2
- package/dist/esm/components/TextField/Field.js +2 -2
- package/dist/esm/components/TextField/HelperText/HelperText.js +1 -1
- package/dist/esm/components/Textarea/Textarea.js +1 -1
- package/dist/esm/components/TopBar/Actions.js +1 -1
- package/dist/esm/components/Typography/Typography.js +3 -3
- package/dist/esm/hooks/useAutoResize.js +1 -1
- package/dist/esm/hooks/useId.js +1 -1
- package/dist/esm/hooks/useToken.js +2 -2
- package/dist/esm/index.js +0 -1
- package/dist/esm/node_modules/.pnpm/ramda@0.27.1/node_modules/ramda/src/internal/_curry1.js +25 -0
- package/dist/esm/node_modules/.pnpm/ramda@0.27.1/node_modules/ramda/src/internal/_curry2.js +38 -0
- package/dist/esm/node_modules/.pnpm/ramda@0.27.1/node_modules/ramda/src/internal/_curry3.js +57 -0
- package/dist/esm/node_modules/.pnpm/ramda@0.27.1/node_modules/ramda/src/internal/_has.js +7 -0
- package/dist/esm/node_modules/.pnpm/ramda@0.27.1/node_modules/ramda/src/internal/_isObject.js +7 -0
- package/dist/esm/node_modules/.pnpm/ramda@0.27.1/node_modules/ramda/src/internal/_isPlaceholder.js +7 -0
- package/dist/esm/node_modules/.pnpm/ramda@0.27.1/node_modules/ramda/src/mergeDeepRight.js +36 -0
- package/dist/esm/node_modules/.pnpm/ramda@0.27.1/node_modules/ramda/src/mergeDeepWithKey.js +49 -0
- package/dist/esm/node_modules/.pnpm/ramda@0.27.1/node_modules/ramda/src/mergeWithKey.js +53 -0
- package/dist/esm/utils/templates/common.js +1 -1
- package/dist/esm/utils/templates/index.js +8 -15
- package/dist/types/components/Card/CardContent.d.ts +3 -0
- package/dist/types/components/Card/index.d.ts +3 -1
- package/dist/types/components/Menu/Menu.d.ts +2 -2
- package/dist/types/components/Menu/MenuItem.d.ts +2 -2
- package/dist/types/components/Menu/MenuList.d.ts +1 -1
- package/dist/types/components/Table/Cell.d.ts +2 -2
- package/dist/types/components/Table/DataCell/DataCell.d.ts +1 -1
- package/dist/types/components/Table/HeaderCell/HeaderCell.d.ts +1 -1
- package/dist/types/components/Typography/Typography.tokens.d.ts +2 -1
- package/dist/types/index.d.ts +0 -1
- package/package.json +6 -6
|
@@ -44,7 +44,7 @@ const Text = styled(Typography).withConfig({
|
|
|
44
44
|
})(["white-space:nowrap;"]);
|
|
45
45
|
|
|
46
46
|
function getAriaLabel(page, selected) {
|
|
47
|
-
return
|
|
47
|
+
return "".concat(selected === page ? 'Current page, ' : 'Go to ', "page ").concat(page);
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
const Pagination = /*#__PURE__*/forwardRef(function Pagination({
|
|
@@ -95,7 +95,7 @@ const Pagination = /*#__PURE__*/forwardRef(function Pagination({
|
|
|
95
95
|
...props,
|
|
96
96
|
children: /*#__PURE__*/jsxs(OrderedList, {
|
|
97
97
|
style: {
|
|
98
|
-
gridTemplateColumns:
|
|
98
|
+
gridTemplateColumns: "repeat(".concat(columns, ", 48px)")
|
|
99
99
|
},
|
|
100
100
|
children: [/*#__PURE__*/jsx(ListItem, {
|
|
101
101
|
children: /*#__PURE__*/jsx(Button, {
|
|
@@ -122,13 +122,13 @@ const Pagination = /*#__PURE__*/forwardRef(function Pagination({
|
|
|
122
122
|
onPageChange(event, page);
|
|
123
123
|
}
|
|
124
124
|
})
|
|
125
|
-
},
|
|
125
|
+
}, "list-item ".concat(index)) : /*#__PURE__*/jsx(ListItem // eslint-disable-next-line react/no-array-index-key
|
|
126
126
|
, {
|
|
127
127
|
children: /*#__PURE__*/jsx(StyledIcon, {
|
|
128
128
|
name: "more_horizontal",
|
|
129
129
|
"aria-label": "Ellipsis of pages"
|
|
130
130
|
})
|
|
131
|
-
},
|
|
131
|
+
}, "ellipsis-".concat(index))) : undefined, /*#__PURE__*/jsx(ListItem, {
|
|
132
132
|
children: /*#__PURE__*/jsx(Button, {
|
|
133
133
|
variant: "ghost_icon",
|
|
134
134
|
onClick: activePage < pages ? event => {
|
|
@@ -146,12 +146,7 @@ const Pagination = /*#__PURE__*/forwardRef(function Pagination({
|
|
|
146
146
|
|
|
147
147
|
return withItemIndicator ? /*#__PURE__*/jsxs(FlexContainer, {
|
|
148
148
|
children: [/*#__PURE__*/jsx(Text, {
|
|
149
|
-
children: currentItemFirst !== currentItemLast ?
|
|
150
|
-
${' - '}
|
|
151
|
-
${currentItemLast}
|
|
152
|
-
${' of '}
|
|
153
|
-
${totalItems}
|
|
154
|
-
${' items'}` : `${currentItemFirst} ${' of '} ${totalItems} ${' items'}`
|
|
149
|
+
children: currentItemFirst !== currentItemLast ? "".concat(currentItemFirst, "\n ", ' - ', "\n ").concat(currentItemLast, "\n ", ' of ', "\n ").concat(totalItems, "\n ", ' items') : "".concat(currentItemFirst, " ", ' of ', " ").concat(totalItems, " ", ' items')
|
|
155
150
|
}), pagination]
|
|
156
151
|
}) : pagination;
|
|
157
152
|
});
|
|
@@ -53,7 +53,7 @@ const CircularProgress = /*#__PURE__*/forwardRef(function CircularProgress({
|
|
|
53
53
|
|
|
54
54
|
if (variant === 'determinate') {
|
|
55
55
|
trackStyle.stroke = circumference.toFixed(3);
|
|
56
|
-
trackStyle.strokeDashoffset =
|
|
56
|
+
trackStyle.strokeDashoffset = "".concat(((100 - progress) / 100 * circumference).toFixed(3), "px");
|
|
57
57
|
props['aria-valuenow'] = progress;
|
|
58
58
|
|
|
59
59
|
if (value !== undefined) {
|
|
@@ -32,7 +32,7 @@ const LinearProgress = /*#__PURE__*/forwardRef(function LinearProgress({
|
|
|
32
32
|
props['aria-valuemin'] = 0;
|
|
33
33
|
props['aria-valuemax'] = 100;
|
|
34
34
|
const transform = value - 100;
|
|
35
|
-
barStyle =
|
|
35
|
+
barStyle = "translateX(".concat(transform, "%)");
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
38
|
|
|
@@ -16,13 +16,15 @@ const Input = styled.input.attrs(({
|
|
|
16
16
|
})).withConfig({
|
|
17
17
|
displayName: "Radio__Input",
|
|
18
18
|
componentId: "sc-we59oz-0"
|
|
19
|
-
})(["--scale:", ";appearance:none;width:100%;height:100%;margin:0;grid-area:input;transform:scale(var(--scale));cursor:", ";&:focus{outline:none;}&[data-focus-visible-added]:focus + svg{", "}&:not(:checked) ~ svg path[name='selected']{display:none;}&:not(:checked) ~ svg path[name='unselected']{display:inline;}&:checked ~ svg path[name='unselected']{display:none;}&:checked ~ svg path[name='selected']{display:inline;}"], ({
|
|
19
|
+
})(["--scale:", ";appearance:none;width:100%;height:100%;margin:0;grid-area:input;transform:scale(var(--scale));cursor:", ";&:focus{outline:none;}&[data-focus-visible-added]:focus + svg{", "}&:focus-visible + svg{", "}&:not(:checked) ~ svg path[name='selected']{display:none;}&:not(:checked) ~ svg path[name='unselected']{display:inline;}&:checked ~ svg path[name='unselected']{display:none;}&:checked ~ svg path[name='selected']{display:inline;}"], ({
|
|
20
20
|
theme,
|
|
21
21
|
iconSize
|
|
22
22
|
}) => parseFloat(theme.clickbound.height) / iconSize, ({
|
|
23
23
|
disabled
|
|
24
24
|
}) => disabled ? 'not-allowed' : 'pointer', ({
|
|
25
25
|
theme
|
|
26
|
+
}) => outlineTemplate(theme.states.focus.outline), ({
|
|
27
|
+
theme
|
|
26
28
|
}) => outlineTemplate(theme.states.focus.outline));
|
|
27
29
|
const StyledLabel = styled.label.withConfig({
|
|
28
30
|
displayName: "Radio__StyledLabel",
|
|
@@ -86,7 +88,7 @@ const Radio = /*#__PURE__*/forwardRef(function Radio({
|
|
|
86
88
|
return /*#__PURE__*/jsxs(Svg, {
|
|
87
89
|
width: iconSize,
|
|
88
90
|
height: iconSize,
|
|
89
|
-
viewBox:
|
|
91
|
+
viewBox: "0 0 ".concat(iconSize, " ").concat(iconSize),
|
|
90
92
|
fill: fill,
|
|
91
93
|
"aria-hidden": true,
|
|
92
94
|
children: [/*#__PURE__*/jsx(StyledPath, {
|
|
@@ -8,6 +8,7 @@ import { useCombinedRefs } from '../../hooks/useCombinedRefs.js';
|
|
|
8
8
|
import { setReactInputValue } from '../../utils/setReactInputValue.js';
|
|
9
9
|
import { bordersTemplate } from '../../utils/templates/borders.js';
|
|
10
10
|
import { spacingsTemplate, typographyTemplate } from '../../utils/templates/index.js';
|
|
11
|
+
import { Button } from '../Button/Button.js';
|
|
11
12
|
|
|
12
13
|
const {
|
|
13
14
|
height,
|
|
@@ -18,7 +19,8 @@ const {
|
|
|
18
19
|
clickbound,
|
|
19
20
|
entities: {
|
|
20
21
|
icon,
|
|
21
|
-
placeholder
|
|
22
|
+
placeholder,
|
|
23
|
+
button
|
|
22
24
|
},
|
|
23
25
|
states
|
|
24
26
|
} = search;
|
|
@@ -36,12 +38,12 @@ const Input = styled.input.withConfig({
|
|
|
36
38
|
})(["min-height:0;min-width:0;width:100%;height:100%;margin:0;padding:0;border:none;appearance:none;box-sizing:border-box;background:transparent;&[type='search']::-webkit-search-decoration,&[type='search']::-webkit-search-cancel-button,&[type='search']::-webkit-search-results-button,&[type='search']::-webkit-search-results-decoration{-webkit-appearance:none;}", " &:focus{outline:none;}", ""], typographyTemplate(typography), ({
|
|
37
39
|
disabled
|
|
38
40
|
}) => disabled && css(["cursor:not-allowed;"]));
|
|
39
|
-
const InsideButton = styled.
|
|
41
|
+
const InsideButton = styled(Button).withConfig({
|
|
40
42
|
displayName: "Search__InsideButton",
|
|
41
43
|
componentId: "sc-v8l23u-2"
|
|
42
|
-
})(["
|
|
44
|
+
})(["visibility:hidden;position:absolute;right:", ";height:", ";width:", ";", ""], button.spacings.right, button.height, button.width, ({
|
|
43
45
|
isActive
|
|
44
|
-
}) => isActive && css(["visibility:visible
|
|
46
|
+
}) => isActive && css(["visibility:visible;"]));
|
|
45
47
|
const Search = /*#__PURE__*/forwardRef(function Search({
|
|
46
48
|
onChange,
|
|
47
49
|
defaultValue = '',
|
|
@@ -151,8 +153,6 @@ const Search = /*#__PURE__*/forwardRef(function Search({
|
|
|
151
153
|
}, value, defaultValue);
|
|
152
154
|
const clearButtonProps = {
|
|
153
155
|
isActive: state.isActive,
|
|
154
|
-
size,
|
|
155
|
-
role: 'button',
|
|
156
156
|
onClick: e => {
|
|
157
157
|
e.stopPropagation();
|
|
158
158
|
|
|
@@ -168,10 +168,12 @@ const Search = /*#__PURE__*/forwardRef(function Search({
|
|
|
168
168
|
size: size
|
|
169
169
|
}), /*#__PURE__*/jsx(Input, { ...inputProps
|
|
170
170
|
}), /*#__PURE__*/jsx(InsideButton, { ...clearButtonProps,
|
|
171
|
-
"aria-label":
|
|
171
|
+
"aria-label": 'clear search',
|
|
172
|
+
title: "clear",
|
|
173
|
+
variant: "ghost_icon",
|
|
172
174
|
children: /*#__PURE__*/jsx(Icon, {
|
|
173
175
|
data: close,
|
|
174
|
-
size:
|
|
176
|
+
size: 16
|
|
175
177
|
})
|
|
176
178
|
})]
|
|
177
179
|
});
|
|
@@ -126,7 +126,7 @@ const MultiSelect = /*#__PURE__*/forwardRef(function MultiSelect({
|
|
|
126
126
|
}
|
|
127
127
|
}
|
|
128
128
|
});
|
|
129
|
-
const placeholderText = items.length > 0 ?
|
|
129
|
+
const placeholderText = items.length > 0 ? "".concat(selectedItems.length, "/").concat(items.length, " selected") : '';
|
|
130
130
|
|
|
131
131
|
const openSelect = () => {
|
|
132
132
|
if (!isOpen && !(disabled || readOnly)) {
|
|
@@ -193,7 +193,7 @@ const MultiSelect = /*#__PURE__*/forwardRef(function MultiSelect({
|
|
|
193
193
|
}), /*#__PURE__*/jsx("span", {
|
|
194
194
|
children: item
|
|
195
195
|
})]
|
|
196
|
-
},
|
|
196
|
+
}, "".concat(item)))
|
|
197
197
|
})]
|
|
198
198
|
})
|
|
199
199
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { tokens } from '@equinor/eds-tokens';
|
|
2
|
-
import
|
|
2
|
+
import mergeDeepRight_1 from '../../node_modules/.pnpm/ramda@0.27.1/node_modules/ramda/src/mergeDeepRight.js';
|
|
3
3
|
|
|
4
4
|
const {
|
|
5
5
|
typography,
|
|
@@ -78,7 +78,7 @@ const select = {
|
|
|
78
78
|
}
|
|
79
79
|
}
|
|
80
80
|
};
|
|
81
|
-
const multiSelect =
|
|
81
|
+
const multiSelect = mergeDeepRight_1(select, {
|
|
82
82
|
spacings: {
|
|
83
83
|
top: '0',
|
|
84
84
|
bottom: '0',
|
|
@@ -16,7 +16,7 @@ const {
|
|
|
16
16
|
} = slider;
|
|
17
17
|
const fakeTrackBg = css(["background-image:url(\"data:image/svg+xml,<svg xmlns='http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg'><rect x='0' y='11' fill='", "' width='100%' height='4' rx='2' /></svg>\");background-size:cover;background-repeat:no-repeat;"], track.background);
|
|
18
18
|
const fakeTrackBgHover = css({
|
|
19
|
-
backgroundImage:
|
|
19
|
+
backgroundImage: "url(\"data:image/svg+xml,<svg xmlns='http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg'><rect x='0' y='11' fill='".concat(track.states.hover.background, "' width='100%' height='4' rx='2' /></svg>\")")
|
|
20
20
|
});
|
|
21
21
|
const trackFill = css(["grid-column:1 / span 2;grid-row:2;height:", ";margin-bottom:", ";align-self:end;content:'';"], track.height, track.spacings.bottom);
|
|
22
22
|
const wrapperGrid = css(["display:grid;grid-template-rows:max-content 24px;grid-template-columns:1fr 1fr;width:100%;position:relative;"]);
|
|
@@ -144,9 +144,9 @@ const Slider = /*#__PURE__*/forwardRef(function Slider({
|
|
|
144
144
|
}
|
|
145
145
|
};
|
|
146
146
|
|
|
147
|
-
const inputIdA =
|
|
148
|
-
const inputIdB =
|
|
149
|
-
const inputId =
|
|
147
|
+
const inputIdA = "".concat(ariaLabelledby, "-thumb-a");
|
|
148
|
+
const inputIdB = "".concat(ariaLabelledby, "-thumb-b");
|
|
149
|
+
const inputId = "".concat(ariaLabelledby, "-thumb");
|
|
150
150
|
return /*#__PURE__*/jsx(Fragment, {
|
|
151
151
|
children: isRangeSlider ? /*#__PURE__*/jsxs(RangeWrapper, { ...rest,
|
|
152
152
|
ref: ref,
|
|
@@ -23,7 +23,7 @@ const StyledSliderInput = styled.input.attrs(() => ({
|
|
|
23
23
|
})).withConfig({
|
|
24
24
|
displayName: "SliderInput__StyledSliderInput",
|
|
25
25
|
componentId: "sc-17orw4f-0"
|
|
26
|
-
})(["&::-webkit-slider-runnable-track,&::-webkit-slider-thumb,&{-webkit-appearance:none;}::-moz-focus-outer{border:0;}width:100%;background:transparent;background:none;grid-column:1 / -1;grid-row:2;font:inherit;margin:0;z-index:2;outline:none;&[data-focus-visible-added]:focus{z-index:2;&::-webkit-slider-thumb{", ";}&::-moz-range-thumb{", ";}}&:hover,&:active{&::-webkit-slider-thumb{", "}&::-moz-range-thumb{", "}}&:disabled{&::-webkit-slider-thumb{", "}&::-moz-range-thumb{", "}}&:disabled:hover,&:disabled:active{&::-webkit-slider-thumb{", "}&::-moz-range-thumb{", "}&::-webkit-slider-runnable-track{cursor:not-allowed;}&::-moz-range-track{cursor:not-allowed;}}&:before,&:after{}&:after{right:0;}&::-webkit-slider-thumb{", " margin-top:6px;}&::-moz-range-thumb{", " height:8px;width:8px;}&::-webkit-slider-runnable-track{", "}&::-moz-range-track{", "}"], outlineTemplate(handle.states.focus.outline), outlineTemplate(handle.states.focus.outline), thumbHover, thumbHover, thumbDisabled, thumbDisabled, thumbHoverAndDisabled, thumbHoverAndDisabled, thumb, thumb, track, track);
|
|
26
|
+
})(["&::-webkit-slider-runnable-track,&::-webkit-slider-thumb,&{-webkit-appearance:none;}::-moz-focus-outer{border:0;}width:100%;background:transparent;background:none;grid-column:1 / -1;grid-row:2;font:inherit;margin:0;z-index:2;outline:none;&[data-focus-visible-added]:focus{z-index:2;&::-webkit-slider-thumb{", ";}&::-moz-range-thumb{", ";}}&:focus-visible{z-index:2;&::-webkit-slider-thumb{", ";}&::-moz-range-thumb{", ";}}&:hover,&:active{&::-webkit-slider-thumb{", "}&::-moz-range-thumb{", "}}&:disabled{&::-webkit-slider-thumb{", "}&::-moz-range-thumb{", "}}&:disabled:hover,&:disabled:active{&::-webkit-slider-thumb{", "}&::-moz-range-thumb{", "}&::-webkit-slider-runnable-track{cursor:not-allowed;}&::-moz-range-track{cursor:not-allowed;}}&:before,&:after{}&:after{right:0;}&::-webkit-slider-thumb{", " margin-top:6px;}&::-moz-range-thumb{", " height:8px;width:8px;}&::-webkit-slider-runnable-track{", "}&::-moz-range-track{", "}"], outlineTemplate(handle.states.focus.outline), outlineTemplate(handle.states.focus.outline), outlineTemplate(handle.states.focus.outline), outlineTemplate(handle.states.focus.outline), thumbHover, thumbHover, thumbDisabled, thumbDisabled, thumbHoverAndDisabled, thumbHoverAndDisabled, thumb, thumb, track, track);
|
|
27
27
|
const SliderInput = /*#__PURE__*/forwardRef(function SliderInput({
|
|
28
28
|
value,
|
|
29
29
|
min,
|
|
@@ -25,7 +25,7 @@ const BaseInput = styled.input.attrs(({
|
|
|
25
25
|
})(({
|
|
26
26
|
disabled,
|
|
27
27
|
theme
|
|
28
|
-
}) => css(["appearance:none;width:100%;height:100%;grid-area:input;margin:0;cursor:", ";&:focus{outline:none;}&[data-focus-visible-added]:focus + span{", "}"], disabled ? 'not-allowed' : 'pointer', outlineTemplate(theme.states.focus.outline)));
|
|
28
|
+
}) => css(["appearance:none;width:100%;height:100%;grid-area:input;margin:0;cursor:", ";&:focus{outline:none;}&[data-focus-visible-added]:focus + span{", "}&:focus-visible + span{", "}"], disabled ? 'not-allowed' : 'pointer', outlineTemplate(theme.states.focus.outline), outlineTemplate(theme.states.focus.outline)));
|
|
29
29
|
const GridWrapper = styled.span.withConfig({
|
|
30
30
|
displayName: "Switchstyles__GridWrapper",
|
|
31
31
|
componentId: "sc-x39lde-2"
|
|
@@ -67,8 +67,8 @@ const comfortable = {
|
|
|
67
67
|
height: clickbounds.default__base,
|
|
68
68
|
width: clickbounds.default__base,
|
|
69
69
|
offset: {
|
|
70
|
-
top:
|
|
71
|
-
left:
|
|
70
|
+
top: "".concat((parseInt(clickbounds.default__base) - parseInt(circle.minHeight)) / 2, "px"),
|
|
71
|
+
left: "".concat((parseInt(clickbounds.default__base) - parseInt(circle.minWidth)) / 2, "px")
|
|
72
72
|
}
|
|
73
73
|
},
|
|
74
74
|
entities: {
|
|
@@ -117,8 +117,8 @@ const comfortable = {
|
|
|
117
117
|
height: clickbounds.compact__standard,
|
|
118
118
|
width: clickbounds.compact__standard,
|
|
119
119
|
offset: {
|
|
120
|
-
top:
|
|
121
|
-
left:
|
|
120
|
+
top: "".concat((parseInt(clickbounds.compact__standard) - parseInt(compactIconButton.minHeight)) / 2, "px"),
|
|
121
|
+
left: "".concat((parseInt(clickbounds.compact__standard) - parseInt(compactIconButton.minWidth)) / 2, "px")
|
|
122
122
|
}
|
|
123
123
|
},
|
|
124
124
|
entities: {
|
|
@@ -2,6 +2,7 @@ import { forwardRef } from 'react';
|
|
|
2
2
|
import styled, { css } from 'styled-components';
|
|
3
3
|
import { BaseInput, GridWrapper, BaseInputWrapper } from './Switch.styles.js';
|
|
4
4
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
5
|
+
import { outlineTemplate } from '../../utils/templates/focus.js';
|
|
5
6
|
|
|
6
7
|
const Input = styled(BaseInput).withConfig({
|
|
7
8
|
displayName: "SwitchSmall__Input",
|
|
@@ -15,7 +16,7 @@ const Input = styled(BaseInput).withConfig({
|
|
|
15
16
|
track
|
|
16
17
|
}
|
|
17
18
|
}
|
|
18
|
-
}) => css(["&[data-focus-visible-added]:focus + span{
|
|
19
|
+
}) => css(["&[data-focus-visible-added]:focus + span{", "}&:focus-visible + span{", "}&:checked + span > span{background-color:", ";}&:checked + span > span:last-child{transform:translate(180%,-50%);background-color:", ";}@media (hover:hover) and (pointer:fine){&:hover + span{background-color:", ";}}"], outlineTemplate(states.focus.outline), outlineTemplate(states.focus.outline), disabled ? states.disabled.background : track.states.active.background, handle.background, disabled ? 'transparent' : states.hover.background));
|
|
19
20
|
const Track = styled.span.withConfig({
|
|
20
21
|
displayName: "SwitchSmall__Track",
|
|
21
22
|
componentId: "sc-1a99mis-1"
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { tokens } from '@equinor/eds-tokens';
|
|
2
|
-
import
|
|
2
|
+
import mergeDeepRight_1 from '../../../node_modules/.pnpm/ramda@0.27.1/node_modules/ramda/src/mergeDeepRight.js';
|
|
3
3
|
|
|
4
4
|
const {
|
|
5
5
|
typography: {
|
|
@@ -141,7 +141,7 @@ const tableCell = {
|
|
|
141
141
|
const applyVariant = (variant, token) => {
|
|
142
142
|
switch (variant) {
|
|
143
143
|
case 'numeric':
|
|
144
|
-
return
|
|
144
|
+
return mergeDeepRight_1(token, token.variants.numeric);
|
|
145
145
|
|
|
146
146
|
default:
|
|
147
147
|
return token;
|
|
@@ -23,9 +23,9 @@ const StyledTab = styled.button.attrs(({
|
|
|
23
23
|
})).withConfig({
|
|
24
24
|
displayName: "Tab__StyledTab",
|
|
25
25
|
componentId: "sc-scjkct-0"
|
|
26
|
-
})(["appearance:none;box-sizing:border-box;font-family:inherit;border:none;outline:none;font-size:1rem;height:", ";", " color:", ";background-color:", ";position:relative;white-space:nowrap;text-overflow:ellipsis;overflow-x:hidden;&:focus{outline:none;}&[data-focus],&[data-focus-visible-added]:focus{", "}&::-moz-focus-inner{border:0;}@media (hover:hover) and (pointer:fine){&[data-hover],&:hover{color:", ";", "}}", " ", ""], tab.height, spacingsTemplate(tab.spacings), ({
|
|
26
|
+
})(["appearance:none;box-sizing:border-box;font-family:inherit;border:none;outline:none;font-size:1rem;height:", ";", " color:", ";background-color:", ";position:relative;white-space:nowrap;text-overflow:ellipsis;overflow-x:hidden;&:focus{outline:none;}&[data-focus],&[data-focus-visible-added]:focus{", "}&:focus-visible{", "}&::-moz-focus-inner{border:0;}@media (hover:hover) and (pointer:fine){&[data-hover],&:hover{color:", ";", "}}", " ", ""], tab.height, spacingsTemplate(tab.spacings), ({
|
|
27
27
|
active
|
|
28
|
-
}) => active ? tab.states.active.typography.color : tab.typography.color, tab.background, outlineTemplate(tab.states.focus.outline), ({
|
|
28
|
+
}) => active ? tab.states.active.typography.color : tab.typography.color, tab.background, outlineTemplate(tab.states.focus.outline), outlineTemplate(tab.states.focus.outline), ({
|
|
29
29
|
active
|
|
30
30
|
}) => active ? tab.states.active.states.hover.typography.color : tab.typography.color, ({
|
|
31
31
|
disabled
|
|
@@ -40,8 +40,8 @@ const TabList = /*#__PURE__*/forwardRef(function TabsList({
|
|
|
40
40
|
const tabRef = index === activeTab ? // eslint-disable-next-line react-hooks/rules-of-hooks
|
|
41
41
|
useCombinedRefs(child.ref, selectedTabRef) : child.ref;
|
|
42
42
|
return /*#__PURE__*/cloneElement(child, {
|
|
43
|
-
id:
|
|
44
|
-
'aria-controls':
|
|
43
|
+
id: "".concat(tabsId, "-tab-").concat(index + 1),
|
|
44
|
+
'aria-controls': "".concat(tabsId, "-panel-").concat(index + 1),
|
|
45
45
|
active: index === activeTab,
|
|
46
46
|
index,
|
|
47
47
|
onClick: () => handleChange(index),
|
|
@@ -16,7 +16,7 @@ const StyledTabPanel = styled.div.attrs(() => ({
|
|
|
16
16
|
})).withConfig({
|
|
17
17
|
displayName: "TabPanel__StyledTabPanel",
|
|
18
18
|
componentId: "sc-e8v1d4-0"
|
|
19
|
-
})(["", " &:focus{outline:none;}&[data-focus-visible-added]:focus{", "}"], spacingsTemplate(panel.spacings), outlineTemplate(panel.states.focus.outline));
|
|
19
|
+
})(["", " &:focus{outline:none;}&[data-focus-visible-added]:focus{", "}&:focus-visible{", "}"], spacingsTemplate(panel.spacings), outlineTemplate(panel.states.focus.outline), outlineTemplate(panel.states.focus.outline));
|
|
20
20
|
const TabPanel = /*#__PURE__*/forwardRef(function TabPanel({ ...props
|
|
21
21
|
}, ref) {
|
|
22
22
|
return /*#__PURE__*/jsx(StyledTabPanel, {
|
|
@@ -11,8 +11,8 @@ const TabPanels = /*#__PURE__*/forwardRef(function TabPanels({
|
|
|
11
11
|
tabsId
|
|
12
12
|
} = useContext(TabsContext);
|
|
13
13
|
const Panels = Children.map(children, (child, index) => /*#__PURE__*/cloneElement(child, {
|
|
14
|
-
id:
|
|
15
|
-
'aria-labelledby':
|
|
14
|
+
id: "".concat(tabsId, "-panel-").concat(index + 1),
|
|
15
|
+
'aria-labelledby': "".concat(tabsId, "-tab-").concat(index + 1),
|
|
16
16
|
hidden: activeTab !== index
|
|
17
17
|
}));
|
|
18
18
|
return /*#__PURE__*/jsx("div", {
|
|
@@ -22,10 +22,10 @@ const Variation = ({
|
|
|
22
22
|
var _token$border, _token$border2, _token$border3, _token$border4;
|
|
23
23
|
|
|
24
24
|
if (!variant) {
|
|
25
|
-
return
|
|
25
|
+
return "";
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
return css(["box-shadow:", ";", ""], isFocused ?
|
|
28
|
+
return css(["box-shadow:", ";", ""], isFocused ? "none" : variant === 'default' ? "inset 0 -1px 0 0 ".concat(((_token$border = token.border) === null || _token$border === void 0 ? void 0 : _token$border.type) === 'border' && ((_token$border2 = token.border) === null || _token$border2 === void 0 ? void 0 : _token$border2.color)) : "0 0 0 1px ".concat(((_token$border3 = token.border) === null || _token$border3 === void 0 ? void 0 : _token$border3.type) === 'border' && ((_token$border4 = token.border) === null || _token$border4 === void 0 ? void 0 : _token$border4.color)), isFocused && outlineTemplate(token.states.focus.outline));
|
|
29
29
|
};
|
|
30
30
|
|
|
31
31
|
const StrippedInput = styled(Input).withConfig({
|
|
@@ -5,7 +5,7 @@ import { jsx } from 'react/jsx-runtime';
|
|
|
5
5
|
const StyledActions = styled.div.withConfig({
|
|
6
6
|
displayName: "Actions__StyledActions",
|
|
7
7
|
componentId: "sc-1251ang-0"
|
|
8
|
-
})(["grid-area:right;text-align:right;"]);
|
|
8
|
+
})(["grid-area:right;text-align:right;align-items:center;display:flex;"]);
|
|
9
9
|
const Actions = /*#__PURE__*/forwardRef(function Actions({
|
|
10
10
|
children,
|
|
11
11
|
...props
|
|
@@ -41,7 +41,7 @@ const findTypography = (variantName, group) => {
|
|
|
41
41
|
|
|
42
42
|
const findColor = (inputColor = null) => typeof colors[inputColor] === 'undefined' ? inputColor : colors[inputColor];
|
|
43
43
|
|
|
44
|
-
const toVariantName = (variant, bold = false, italic = false, link = false) =>
|
|
44
|
+
const toVariantName = (variant, bold = false, italic = false, link = false) => "".concat(variant).concat(bold ? '_bold' : '').concat(italic ? '_italic' : '').concat(link ? '_link' : '');
|
|
45
45
|
|
|
46
46
|
const StyledTypography = styled.p.withConfig({
|
|
47
47
|
displayName: "Typography__StyledTypography",
|
|
@@ -58,7 +58,7 @@ const StyledTypography = styled.p.withConfig({
|
|
|
58
58
|
}) => //https://caniuse.com/#feat=css-line-clamp
|
|
59
59
|
lines > 0 && css(["&{display:-webkit-box;-webkit-line-clamp:", ";-webkit-box-orient:vertical;overflow:hidden;text-overflow:ellipsis;}"], lines), ({
|
|
60
60
|
link: link$1
|
|
61
|
-
}) => link$1 && css(["&:focus{outline:none;}&[data-focus-visible-added]:focus{", "}"], outlineTemplate(link.states.focus.outline)));
|
|
61
|
+
}) => link$1 && css(["&:focus{outline:none;}&[data-focus-visible-added]:focus{", "}&:focus-visible{", "}"], outlineTemplate(link.states.focus.outline), outlineTemplate(link.states.focus.outline)));
|
|
62
62
|
const Typography = /*#__PURE__*/forwardRef(function Typography({
|
|
63
63
|
variant = 'body_short',
|
|
64
64
|
children,
|
|
@@ -75,7 +75,7 @@ const Typography = /*#__PURE__*/forwardRef(function Typography({
|
|
|
75
75
|
const typography = findTypography(variantName, group);
|
|
76
76
|
|
|
77
77
|
if (typeof typography === 'undefined') {
|
|
78
|
-
throw new Error(
|
|
78
|
+
throw new Error("Typography variant not found for variant \"".concat(variantName, "\" (\"").concat(variant, "\") & group \"").concat(group || '', "\""));
|
|
79
79
|
}
|
|
80
80
|
|
|
81
81
|
return /*#__PURE__*/jsx(StyledTypography, {
|
package/dist/esm/hooks/useId.js
CHANGED
|
@@ -5,7 +5,7 @@ const useId = (idOverride, type) => {
|
|
|
5
5
|
const id = idOverride || defaultId;
|
|
6
6
|
useEffect(() => {
|
|
7
7
|
if (defaultId == null) {
|
|
8
|
-
setDefaultId(
|
|
8
|
+
setDefaultId("eds-".concat(type ? type + "-" : '').concat(Math.round(Math.random() * 1e5)));
|
|
9
9
|
}
|
|
10
10
|
}, [defaultId, type]);
|
|
11
11
|
return id;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useCallback } from 'react';
|
|
2
|
-
import
|
|
2
|
+
import mergeDeepRight_1 from '../node_modules/.pnpm/ramda@0.27.1/node_modules/ramda/src/mergeDeepRight.js';
|
|
3
3
|
|
|
4
4
|
const useToken = (options, token) => useCallback(() => {
|
|
5
5
|
const {
|
|
@@ -7,7 +7,7 @@ const useToken = (options, token) => useCallback(() => {
|
|
|
7
7
|
} = options;
|
|
8
8
|
|
|
9
9
|
if (density === 'compact') {
|
|
10
|
-
return
|
|
10
|
+
return mergeDeepRight_1(token, token.modes.compact);
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
return token;
|
package/dist/esm/index.js
CHANGED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import _isPlaceholder_1 from './_isPlaceholder.js';
|
|
2
|
+
|
|
3
|
+
var _isPlaceholder = _isPlaceholder_1;
|
|
4
|
+
/**
|
|
5
|
+
* Optimized internal one-arity curry function.
|
|
6
|
+
*
|
|
7
|
+
* @private
|
|
8
|
+
* @category Function
|
|
9
|
+
* @param {Function} fn The function to curry.
|
|
10
|
+
* @return {Function} The curried function.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
function _curry1(fn) {
|
|
14
|
+
return function f1(a) {
|
|
15
|
+
if (arguments.length === 0 || _isPlaceholder(a)) {
|
|
16
|
+
return f1;
|
|
17
|
+
} else {
|
|
18
|
+
return fn.apply(this, arguments);
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
var _curry1_1 = _curry1;
|
|
24
|
+
|
|
25
|
+
export default _curry1_1;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import _curry1_1 from './_curry1.js';
|
|
2
|
+
import _isPlaceholder_1 from './_isPlaceholder.js';
|
|
3
|
+
|
|
4
|
+
var _curry1 = _curry1_1;
|
|
5
|
+
var _isPlaceholder = _isPlaceholder_1;
|
|
6
|
+
/**
|
|
7
|
+
* Optimized internal two-arity curry function.
|
|
8
|
+
*
|
|
9
|
+
* @private
|
|
10
|
+
* @category Function
|
|
11
|
+
* @param {Function} fn The function to curry.
|
|
12
|
+
* @return {Function} The curried function.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
function _curry2(fn) {
|
|
16
|
+
return function f2(a, b) {
|
|
17
|
+
switch (arguments.length) {
|
|
18
|
+
case 0:
|
|
19
|
+
return f2;
|
|
20
|
+
|
|
21
|
+
case 1:
|
|
22
|
+
return _isPlaceholder(a) ? f2 : _curry1(function (_b) {
|
|
23
|
+
return fn(a, _b);
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
default:
|
|
27
|
+
return _isPlaceholder(a) && _isPlaceholder(b) ? f2 : _isPlaceholder(a) ? _curry1(function (_a) {
|
|
28
|
+
return fn(_a, b);
|
|
29
|
+
}) : _isPlaceholder(b) ? _curry1(function (_b) {
|
|
30
|
+
return fn(a, _b);
|
|
31
|
+
}) : fn(a, b);
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
var _curry2_1 = _curry2;
|
|
37
|
+
|
|
38
|
+
export default _curry2_1;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import _curry1_1 from './_curry1.js';
|
|
2
|
+
import _curry2_1 from './_curry2.js';
|
|
3
|
+
import _isPlaceholder_1 from './_isPlaceholder.js';
|
|
4
|
+
|
|
5
|
+
var _curry1 = _curry1_1;
|
|
6
|
+
var _curry2 = _curry2_1;
|
|
7
|
+
var _isPlaceholder = _isPlaceholder_1;
|
|
8
|
+
/**
|
|
9
|
+
* Optimized internal three-arity curry function.
|
|
10
|
+
*
|
|
11
|
+
* @private
|
|
12
|
+
* @category Function
|
|
13
|
+
* @param {Function} fn The function to curry.
|
|
14
|
+
* @return {Function} The curried function.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
function _curry3(fn) {
|
|
18
|
+
return function f3(a, b, c) {
|
|
19
|
+
switch (arguments.length) {
|
|
20
|
+
case 0:
|
|
21
|
+
return f3;
|
|
22
|
+
|
|
23
|
+
case 1:
|
|
24
|
+
return _isPlaceholder(a) ? f3 : _curry2(function (_b, _c) {
|
|
25
|
+
return fn(a, _b, _c);
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
case 2:
|
|
29
|
+
return _isPlaceholder(a) && _isPlaceholder(b) ? f3 : _isPlaceholder(a) ? _curry2(function (_a, _c) {
|
|
30
|
+
return fn(_a, b, _c);
|
|
31
|
+
}) : _isPlaceholder(b) ? _curry2(function (_b, _c) {
|
|
32
|
+
return fn(a, _b, _c);
|
|
33
|
+
}) : _curry1(function (_c) {
|
|
34
|
+
return fn(a, b, _c);
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
default:
|
|
38
|
+
return _isPlaceholder(a) && _isPlaceholder(b) && _isPlaceholder(c) ? f3 : _isPlaceholder(a) && _isPlaceholder(b) ? _curry2(function (_a, _b) {
|
|
39
|
+
return fn(_a, _b, c);
|
|
40
|
+
}) : _isPlaceholder(a) && _isPlaceholder(c) ? _curry2(function (_a, _c) {
|
|
41
|
+
return fn(_a, b, _c);
|
|
42
|
+
}) : _isPlaceholder(b) && _isPlaceholder(c) ? _curry2(function (_b, _c) {
|
|
43
|
+
return fn(a, _b, _c);
|
|
44
|
+
}) : _isPlaceholder(a) ? _curry1(function (_a) {
|
|
45
|
+
return fn(_a, b, c);
|
|
46
|
+
}) : _isPlaceholder(b) ? _curry1(function (_b) {
|
|
47
|
+
return fn(a, _b, c);
|
|
48
|
+
}) : _isPlaceholder(c) ? _curry1(function (_c) {
|
|
49
|
+
return fn(a, b, _c);
|
|
50
|
+
}) : fn(a, b, c);
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
var _curry3_1 = _curry3;
|
|
56
|
+
|
|
57
|
+
export default _curry3_1;
|