@entur/layout 3.1.8 → 3.1.9-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/dist/index.d.ts +310 -11
- package/dist/layout.cjs.js +280 -0
- package/dist/layout.cjs.js.map +1 -0
- package/dist/layout.esm.js +269 -228
- package/dist/layout.esm.js.map +1 -1
- package/dist/styles.css +650 -668
- package/package.json +32 -14
- package/dist/Badge/Badge.d.ts +0 -39
- package/dist/Badge/BulletBadge.d.ts +0 -26
- package/dist/Badge/NotificationBadge.d.ts +0 -34
- package/dist/Badge/StatusBadge.d.ts +0 -26
- package/dist/BaseCard.d.ts +0 -16
- package/dist/Contrast.d.ts +0 -13
- package/dist/MediaCard.d.ts +0 -44
- package/dist/NavigationCard.d.ts +0 -27
- package/dist/Tag.d.ts +0 -20
- package/dist/index.js +0 -8
- package/dist/layout.cjs.development.js +0 -253
- package/dist/layout.cjs.development.js.map +0 -1
- package/dist/layout.cjs.production.min.js +0 -2
- package/dist/layout.cjs.production.min.js.map +0 -1
package/dist/layout.esm.js
CHANGED
|
@@ -1,239 +1,280 @@
|
|
|
1
|
-
import { ConditionalWrapper, warnAboutMissingStyles } from
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import { Heading3, Paragraph, Label } from
|
|
5
|
-
import { ForwardIcon } from
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
return _extends = Object.assign ? Object.assign.bind() : function (n) {
|
|
9
|
-
for (var e = 1; e < arguments.length; e++) {
|
|
10
|
-
var t = arguments[e];
|
|
11
|
-
for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
|
|
12
|
-
}
|
|
13
|
-
return n;
|
|
14
|
-
}, _extends.apply(null, arguments);
|
|
1
|
+
import { ConditionalWrapper, warnAboutMissingStyles } from "@entur/utils";
|
|
2
|
+
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
3
|
+
import React from "react";
|
|
4
|
+
import { Heading3, Paragraph, Label } from "@entur/typography";
|
|
5
|
+
import { ForwardIcon } from "@entur/icons";
|
|
6
|
+
function getDefaultExportFromCjs(x) {
|
|
7
|
+
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
|
|
15
8
|
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
9
|
+
var classnames = { exports: {} };
|
|
10
|
+
/*!
|
|
11
|
+
Copyright (c) 2018 Jed Watson.
|
|
12
|
+
Licensed under the MIT License (MIT), see
|
|
13
|
+
http://jedwatson.github.io/classnames
|
|
14
|
+
*/
|
|
15
|
+
var hasRequiredClassnames;
|
|
16
|
+
function requireClassnames() {
|
|
17
|
+
if (hasRequiredClassnames) return classnames.exports;
|
|
18
|
+
hasRequiredClassnames = 1;
|
|
19
|
+
(function(module) {
|
|
20
|
+
(function() {
|
|
21
|
+
var hasOwn = {}.hasOwnProperty;
|
|
22
|
+
function classNames2() {
|
|
23
|
+
var classes = "";
|
|
24
|
+
for (var i = 0; i < arguments.length; i++) {
|
|
25
|
+
var arg = arguments[i];
|
|
26
|
+
if (arg) {
|
|
27
|
+
classes = appendClass(classes, parseValue(arg));
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
return classes;
|
|
31
|
+
}
|
|
32
|
+
function parseValue(arg) {
|
|
33
|
+
if (typeof arg === "string" || typeof arg === "number") {
|
|
34
|
+
return arg;
|
|
35
|
+
}
|
|
36
|
+
if (typeof arg !== "object") {
|
|
37
|
+
return "";
|
|
38
|
+
}
|
|
39
|
+
if (Array.isArray(arg)) {
|
|
40
|
+
return classNames2.apply(null, arg);
|
|
41
|
+
}
|
|
42
|
+
if (arg.toString !== Object.prototype.toString && !arg.toString.toString().includes("[native code]")) {
|
|
43
|
+
return arg.toString();
|
|
44
|
+
}
|
|
45
|
+
var classes = "";
|
|
46
|
+
for (var key in arg) {
|
|
47
|
+
if (hasOwn.call(arg, key) && arg[key]) {
|
|
48
|
+
classes = appendClass(classes, key);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
return classes;
|
|
52
|
+
}
|
|
53
|
+
function appendClass(value, newClass) {
|
|
54
|
+
if (!newClass) {
|
|
55
|
+
return value;
|
|
56
|
+
}
|
|
57
|
+
if (value) {
|
|
58
|
+
return value + " " + newClass;
|
|
59
|
+
}
|
|
60
|
+
return value + newClass;
|
|
61
|
+
}
|
|
62
|
+
if (module.exports) {
|
|
63
|
+
classNames2.default = classNames2;
|
|
64
|
+
module.exports = classNames2;
|
|
65
|
+
} else {
|
|
66
|
+
window.classNames = classNames2;
|
|
67
|
+
}
|
|
68
|
+
})();
|
|
69
|
+
})(classnames);
|
|
70
|
+
return classnames.exports;
|
|
24
71
|
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}, rest)));
|
|
72
|
+
var classnamesExports = requireClassnames();
|
|
73
|
+
const classNames = /* @__PURE__ */ getDefaultExportFromCjs(classnamesExports);
|
|
74
|
+
const defaultElement$8 = "div";
|
|
75
|
+
const Contrast = React.forwardRef(function Contrast2({ className, as, ...rest }, ref) {
|
|
76
|
+
const Element = as || defaultElement$8;
|
|
77
|
+
return /* @__PURE__ */ jsx(ContrastContext.Provider, { value: true, children: /* @__PURE__ */ jsx(
|
|
78
|
+
Element,
|
|
79
|
+
{
|
|
80
|
+
className: classNames("eds-contrast", className),
|
|
81
|
+
ref,
|
|
82
|
+
...rest
|
|
83
|
+
}
|
|
84
|
+
) });
|
|
39
85
|
});
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
var Element = as || defaultElement$7;
|
|
53
|
-
var classList = classNames('eds-base-card', className);
|
|
54
|
-
return React.createElement(Element, _extends({
|
|
55
|
-
className: classList
|
|
56
|
-
}, rest), children);
|
|
86
|
+
const ContrastContext = React.createContext(false);
|
|
87
|
+
const useContrast = () => React.useContext(ContrastContext);
|
|
88
|
+
const defaultElement$7 = "div";
|
|
89
|
+
const BaseCard = ({
|
|
90
|
+
children,
|
|
91
|
+
className,
|
|
92
|
+
as,
|
|
93
|
+
...rest
|
|
94
|
+
}) => {
|
|
95
|
+
const Element = as || defaultElement$7;
|
|
96
|
+
const classList = classNames("eds-base-card", className);
|
|
97
|
+
return /* @__PURE__ */ jsx(Element, { className: classList, ...rest, children });
|
|
57
98
|
};
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
'eds-base-card--red-line': compact,
|
|
73
|
-
'eds-navigation-card--compact': compact
|
|
99
|
+
const defaultElement$6 = "a";
|
|
100
|
+
const NavigationCard = ({
|
|
101
|
+
title,
|
|
102
|
+
children,
|
|
103
|
+
titleIcon,
|
|
104
|
+
compact = false,
|
|
105
|
+
className,
|
|
106
|
+
as,
|
|
107
|
+
...rest
|
|
108
|
+
}) => {
|
|
109
|
+
const Element = as || defaultElement$6;
|
|
110
|
+
const classList = classNames("eds-navigation-card", className, {
|
|
111
|
+
"eds-base-card--red-line": compact,
|
|
112
|
+
"eds-navigation-card--compact": compact
|
|
74
113
|
});
|
|
75
|
-
return
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
})
|
|
114
|
+
return /* @__PURE__ */ jsxs(BaseCard, { as: Element, className: classList, ...rest, children: [
|
|
115
|
+
/* @__PURE__ */ jsxs("div", { className: "eds-navigation-card-header", children: [
|
|
116
|
+
/* @__PURE__ */ jsxs("div", { className: "eds-navigation-card-header__content", children: [
|
|
117
|
+
titleIcon && /* @__PURE__ */ jsx(
|
|
118
|
+
"div",
|
|
119
|
+
{
|
|
120
|
+
className: "eds-navigation-card-header__title-icon",
|
|
121
|
+
"aria-hidden": "true",
|
|
122
|
+
children: titleIcon
|
|
123
|
+
}
|
|
124
|
+
),
|
|
125
|
+
/* @__PURE__ */ jsx("span", { className: "eds-navigation-card-header__title", children: /* @__PURE__ */ jsx(Heading3, { as: "span", children: title }) })
|
|
126
|
+
] }),
|
|
127
|
+
!compact && /* @__PURE__ */ jsx("div", { className: "eds-navigation-card-header__highlight" })
|
|
128
|
+
] }),
|
|
129
|
+
!compact && /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(Paragraph, { children }) })
|
|
130
|
+
] });
|
|
92
131
|
};
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
var classList = classNames('eds-base-card, eds-media-card', className, {
|
|
115
|
-
'eds-media-card--horizontal': orientation === 'horizontal'
|
|
132
|
+
const defaultElement$5 = "a";
|
|
133
|
+
const MediaCard = ({
|
|
134
|
+
title,
|
|
135
|
+
description,
|
|
136
|
+
children,
|
|
137
|
+
className,
|
|
138
|
+
category,
|
|
139
|
+
style,
|
|
140
|
+
as,
|
|
141
|
+
headingLevel = "h2",
|
|
142
|
+
wholeCardAsElement: whole,
|
|
143
|
+
hideArrow,
|
|
144
|
+
wrapperProps,
|
|
145
|
+
orientation,
|
|
146
|
+
...rest
|
|
147
|
+
}) => {
|
|
148
|
+
const Element = as || defaultElement$5;
|
|
149
|
+
const Heading = Heading3;
|
|
150
|
+
const _wrapperProps = whole ? { ...wrapperProps, ...rest } : { ...wrapperProps };
|
|
151
|
+
const classList = classNames("eds-base-card, eds-media-card", className, {
|
|
152
|
+
"eds-media-card--horizontal": orientation === "horizontal"
|
|
116
153
|
});
|
|
117
|
-
return
|
|
118
|
-
className:
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
154
|
+
return /* @__PURE__ */ jsxs(BaseCard, { className: classList, style, ..._wrapperProps, children: [
|
|
155
|
+
/* @__PURE__ */ jsx("div", { className: "eds-media-card__media", children }),
|
|
156
|
+
/* @__PURE__ */ jsxs("div", { className: "eds-media-card__text", children: [
|
|
157
|
+
category && /* @__PURE__ */ jsx(Label, { className: "eds-media-card__text__category", children: category }),
|
|
158
|
+
/* @__PURE__ */ jsx(
|
|
159
|
+
ConditionalWrapper,
|
|
160
|
+
{
|
|
161
|
+
condition: description !== void 0,
|
|
162
|
+
wrapper: (children2) => /* @__PURE__ */ jsx(Heading, { as: headingLevel, className: "eds-media-card__text__title", children: children2 }),
|
|
163
|
+
children: /* @__PURE__ */ jsx(
|
|
164
|
+
Element,
|
|
165
|
+
{
|
|
166
|
+
tabIndex: 0,
|
|
167
|
+
className: "eds-media-card__text__title-link",
|
|
168
|
+
...rest,
|
|
169
|
+
children: title
|
|
170
|
+
}
|
|
171
|
+
)
|
|
172
|
+
}
|
|
173
|
+
),
|
|
174
|
+
description !== void 0 && /* @__PURE__ */ jsx(Paragraph, { children: description }),
|
|
175
|
+
!hideArrow && /* @__PURE__ */ jsx(
|
|
176
|
+
ForwardIcon,
|
|
177
|
+
{
|
|
178
|
+
className: "eds-media-card__arrow-icon",
|
|
179
|
+
"aria-hidden": "true"
|
|
180
|
+
}
|
|
181
|
+
)
|
|
182
|
+
] })
|
|
183
|
+
] });
|
|
141
184
|
};
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
185
|
+
const defaultElement$4 = "span";
|
|
186
|
+
const Badge = React.forwardRef(
|
|
187
|
+
({
|
|
188
|
+
children,
|
|
189
|
+
className,
|
|
190
|
+
max = 99,
|
|
191
|
+
variant,
|
|
192
|
+
showZero = false,
|
|
193
|
+
invisible: invisibleProp = false,
|
|
194
|
+
hide: hideProp = false,
|
|
195
|
+
as,
|
|
196
|
+
type = "status",
|
|
197
|
+
...rest
|
|
198
|
+
}, ref) => {
|
|
199
|
+
const Element = as || defaultElement$4;
|
|
200
|
+
const computedHide = hideProp || invisibleProp || children === 0 && !showZero || children == null;
|
|
201
|
+
let displayValue;
|
|
202
|
+
if (typeof children === "number") {
|
|
203
|
+
displayValue = children > max ? `${max}+` : children;
|
|
204
|
+
} else {
|
|
205
|
+
displayValue = children;
|
|
206
|
+
}
|
|
207
|
+
const classList = classNames(
|
|
208
|
+
className,
|
|
209
|
+
"eds-badge",
|
|
210
|
+
{
|
|
211
|
+
"eds-badge--hide": computedHide,
|
|
212
|
+
"eds-badge--show-zero": showZero
|
|
213
|
+
},
|
|
214
|
+
`eds-badge--variant-${variant}`,
|
|
215
|
+
`eds-badge--type-${type}`
|
|
216
|
+
);
|
|
217
|
+
return /* @__PURE__ */ jsx(Element, { className: classList, ref, ...rest, children: displayValue });
|
|
168
218
|
}
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
'eds-tag--leading-icon': hasLeadingIcon,
|
|
230
|
-
'eds-tag--trailing-icon': hasTrailingIcon,
|
|
231
|
-
'eds-tag--compact': compact
|
|
232
|
-
})
|
|
233
|
-
}, rest), children);
|
|
219
|
+
);
|
|
220
|
+
const defaultElement$3 = "span";
|
|
221
|
+
const BulletBadge = React.forwardRef(
|
|
222
|
+
(props, ref) => {
|
|
223
|
+
const Element = props.as || defaultElement$3;
|
|
224
|
+
return /* @__PURE__ */ jsx(Badge, { as: Element, ...props, ref, type: "bullet" });
|
|
225
|
+
}
|
|
226
|
+
);
|
|
227
|
+
const defaultElement$2 = "span";
|
|
228
|
+
const NotificationBadge = React.forwardRef(
|
|
229
|
+
(props, ref) => {
|
|
230
|
+
const Element = props.as || defaultElement$2;
|
|
231
|
+
return /* @__PURE__ */ jsx(Badge, { as: Element, ...props, ref, type: "notification" });
|
|
232
|
+
}
|
|
233
|
+
);
|
|
234
|
+
const defaultElement$1 = "span";
|
|
235
|
+
const StatusBadge = React.forwardRef(
|
|
236
|
+
(props, ref) => {
|
|
237
|
+
const Element = props.as || defaultElement$1;
|
|
238
|
+
return /* @__PURE__ */ jsx(Badge, { as: Element, ...props, ref, type: "status" });
|
|
239
|
+
}
|
|
240
|
+
);
|
|
241
|
+
const defaultElement = "div";
|
|
242
|
+
const Tag = ({
|
|
243
|
+
className,
|
|
244
|
+
children,
|
|
245
|
+
compact,
|
|
246
|
+
as,
|
|
247
|
+
...rest
|
|
248
|
+
}) => {
|
|
249
|
+
const Element = as || defaultElement;
|
|
250
|
+
const childrenArray = React.Children.toArray(children);
|
|
251
|
+
const hasLeadingIcon = childrenArray.length > 1 && typeof childrenArray[0] !== "string";
|
|
252
|
+
const hasTrailingIcon = childrenArray.length > 1 && typeof childrenArray[childrenArray.length - 1] !== "string";
|
|
253
|
+
return /* @__PURE__ */ jsx(
|
|
254
|
+
Element,
|
|
255
|
+
{
|
|
256
|
+
className: classNames("eds-tag", className, {
|
|
257
|
+
"eds-tag--leading-icon": hasLeadingIcon,
|
|
258
|
+
"eds-tag--trailing-icon": hasTrailingIcon,
|
|
259
|
+
"eds-tag--compact": compact
|
|
260
|
+
}),
|
|
261
|
+
...rest,
|
|
262
|
+
children
|
|
263
|
+
}
|
|
264
|
+
);
|
|
265
|
+
};
|
|
266
|
+
warnAboutMissingStyles("layout", "typography");
|
|
267
|
+
export {
|
|
268
|
+
Badge,
|
|
269
|
+
BaseCard,
|
|
270
|
+
BulletBadge,
|
|
271
|
+
Contrast,
|
|
272
|
+
ContrastContext,
|
|
273
|
+
MediaCard,
|
|
274
|
+
NavigationCard,
|
|
275
|
+
NotificationBadge,
|
|
276
|
+
StatusBadge,
|
|
277
|
+
Tag,
|
|
278
|
+
useContrast
|
|
234
279
|
};
|
|
235
|
-
|
|
236
|
-
warnAboutMissingStyles('layout', 'typography');
|
|
237
|
-
|
|
238
|
-
export { Badge, BaseCard, BulletBadge, Contrast, ContrastContext, MediaCard, NavigationCard, NotificationBadge, StatusBadge, Tag, useContrast };
|
|
239
280
|
//# sourceMappingURL=layout.esm.js.map
|