@stenajs-webui/core 14.1.1 → 15.0.0-alpha.10
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/components/heading/Heading.d.ts +1 -0
- package/dist/components/layout/box/Box.d.ts +6 -2
- package/dist/components/layout/box/Box.stories.d.ts +3 -2
- package/dist/components/text/Text.d.ts +1 -0
- package/dist/hooks/UseEventListener.d.ts +1 -1
- package/dist/hooks/UseOnClickOutside.d.ts +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.es.js +66 -61
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +85 -60
- package/dist/index.js.map +1 -1
- package/dist/types/PickByValue.d.ts +3 -0
- package/dist/utils/TruthyKeysAsList.d.ts +1 -0
- package/dist/utils/__tests__/TruthyKeysAsList.test.d.ts +1 -0
- package/package.json +4 -5
package/dist/index.js
CHANGED
|
@@ -13,9 +13,29 @@ var lodash = require('lodash');
|
|
|
13
13
|
|
|
14
14
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
15
15
|
|
|
16
|
+
function _interopNamespace(e) {
|
|
17
|
+
if (e && e.__esModule) return e;
|
|
18
|
+
var n = Object.create(null);
|
|
19
|
+
if (e) {
|
|
20
|
+
Object.keys(e).forEach(function (k) {
|
|
21
|
+
if (k !== 'default') {
|
|
22
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
23
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
24
|
+
enumerable: true,
|
|
25
|
+
get: function () { return e[k]; }
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
n["default"] = e;
|
|
31
|
+
return Object.freeze(n);
|
|
32
|
+
}
|
|
33
|
+
|
|
16
34
|
var styled__default = /*#__PURE__*/_interopDefaultLegacy(styled);
|
|
35
|
+
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
17
36
|
var isPropValid__default = /*#__PURE__*/_interopDefaultLegacy(isPropValid);
|
|
18
37
|
var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
|
|
38
|
+
var ReactDOM__namespace = /*#__PURE__*/_interopNamespace(ReactDOM);
|
|
19
39
|
|
|
20
40
|
/*! *****************************************************************************
|
|
21
41
|
Copyright (c) Microsoft Corporation.
|
|
@@ -55,35 +75,33 @@ function __rest(s, e) {
|
|
|
55
75
|
return t;
|
|
56
76
|
}
|
|
57
77
|
|
|
58
|
-
function
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
78
|
+
function __spreadArray(to, from, pack) {
|
|
79
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
80
|
+
if (ar || !(i in from)) {
|
|
81
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
82
|
+
ar[i] = from[i];
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
64
86
|
}
|
|
87
|
+
|
|
65
88
|
function __makeTemplateObject(cooked, raw) {
|
|
66
89
|
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
67
90
|
return cooked;
|
|
68
91
|
}
|
|
69
92
|
|
|
70
|
-
var SeparatorLineComponent = styled__default[
|
|
71
|
-
";\n width: ",
|
|
72
|
-
";\n"])), function (props) { return props.color; }, function (props) {
|
|
93
|
+
var SeparatorLineComponent = styled__default["default"].hr(templateObject_1$3 || (templateObject_1$3 = __makeTemplateObject(["\n display: flex;\n border: 0;\n margin: 0;\n background-color: ", ";\n height: ", ";\n width: ", ";\n"], ["\n display: flex;\n border: 0;\n margin: 0;\n background-color: ", ";\n height: ", ";\n width: ", ";\n"])), function (props) { return props.color; }, function (props) {
|
|
73
94
|
return props.vertical ? props.size || "100%" : props.width || "1px";
|
|
74
95
|
}, function (props) {
|
|
75
96
|
return props.vertical ? props.width || "1px" : props.size || "100%";
|
|
76
97
|
});
|
|
77
98
|
var SeparatorLine = React.forwardRef(function (_a, ref) {
|
|
78
99
|
var _b = _a.color, color = _b === void 0 ? "var(--lhds-color-ui-300)" : _b, _c = _a.size, size = _c === void 0 ? "100%" : _c, _d = _a.width, width = _d === void 0 ? "1px" : _d, _e = _a.vertical, vertical = _e === void 0 ? false : _e;
|
|
79
|
-
return (
|
|
100
|
+
return (React__namespace.createElement(SeparatorLineComponent, { color: color, size: size, width: width, vertical: vertical, ref: ref }));
|
|
80
101
|
});
|
|
81
|
-
var templateObject_1;
|
|
102
|
+
var templateObject_1$3;
|
|
82
103
|
|
|
83
|
-
var ClickableElement = styled__default[
|
|
84
|
-
"\n }\n :focus {\n outline: 0;\n ",
|
|
85
|
-
"\n ", "\n }\n ", "\n ", "\n ",
|
|
86
|
-
"\n"])), function (_a) {
|
|
104
|
+
var ClickableElement = styled__default["default"].button(templateObject_1$2 || (templateObject_1$2 = __makeTemplateObject(["\n display: inline-block;\n user-select: none;\n border: 0;\n padding: 0;\n background: ", ";\n ", "\n\n :hover {\n ", ";\n ", "\n }\n :active {\n ", "\n }\n :focus {\n outline: 0;\n ", "\n ", "\n }\n ", "\n ", "\n ", "\n"], ["\n display: inline-block;\n user-select: none;\n border: 0;\n padding: 0;\n background: ", ";\n ", "\n\n :hover {\n ", ";\n ", "\n }\n :active {\n ", "\n }\n :focus {\n outline: 0;\n ", "\n ", "\n }\n ", "\n ", "\n ", "\n"])), function (_a) {
|
|
87
105
|
var background = _a.background;
|
|
88
106
|
return background;
|
|
89
107
|
}, function (_a) {
|
|
@@ -116,9 +134,9 @@ var ClickableElement = styled__default['default'].button(templateObject_1$1 || (
|
|
|
116
134
|
var Clickable = React.forwardRef(function (_a, ref) {
|
|
117
135
|
var disableFocusHighlight = _a.disableFocusHighlight, onClick = _a.onClick, onDblClick = _a.onDblClick, tooltip = _a.tooltip, disableOpacityOnClick = _a.disableOpacityOnClick, disablePointer = _a.disablePointer, opacityOnHover = _a.opacityOnHover, disabled = _a.disabled, children = _a.children, _b = _a.background, background = _b === void 0 ? "transparent" : _b, hoverBackground = _a.hoverBackground, focusBackground = _a.focusBackground, _c = _a.type, type = _c === void 0 ? "button" : _c, restProps = __rest(_a, ["disableFocusHighlight", "onClick", "onDblClick", "tooltip", "disableOpacityOnClick", "disablePointer", "opacityOnHover", "disabled", "children", "background", "hoverBackground", "focusBackground", "type"]);
|
|
118
136
|
var hasClickHandler = !!(onClick || onDblClick);
|
|
119
|
-
return (
|
|
137
|
+
return (React__namespace.createElement(ClickableElement, __assign({ opacityOnHover: opacityOnHover, title: tooltip, disabled: disabled, disableOpacityOnClick: disableOpacityOnClick, onClick: onClick, onDoubleClick: onDblClick, disableFocusHighlight: disableFocusHighlight, pointer: hasClickHandler && !disablePointer, ref: ref, background: background, hoverBackground: hoverBackground, focusBackground: focusBackground, type: type }, restProps), children));
|
|
120
138
|
});
|
|
121
|
-
var templateObject_1$
|
|
139
|
+
var templateObject_1$2;
|
|
122
140
|
|
|
123
141
|
var booleanOrNumberToNumber = function (num) {
|
|
124
142
|
if (num == null) {
|
|
@@ -138,6 +156,7 @@ var shadows = {
|
|
|
138
156
|
var excludedProps = [
|
|
139
157
|
"spacing",
|
|
140
158
|
"indent",
|
|
159
|
+
"gap",
|
|
141
160
|
"width",
|
|
142
161
|
"height",
|
|
143
162
|
"overflow",
|
|
@@ -161,24 +180,25 @@ var box = styledSystem.system({
|
|
|
161
180
|
property: "--current-spacing",
|
|
162
181
|
transform: booleanOrNumberToNumber,
|
|
163
182
|
},
|
|
183
|
+
gap: {
|
|
184
|
+
// @ts-ignore
|
|
185
|
+
property: "--current-gap",
|
|
186
|
+
transform: booleanOrNumberToNumber,
|
|
187
|
+
},
|
|
164
188
|
shadow: {
|
|
165
189
|
property: "boxShadow",
|
|
166
190
|
transform: function (value) { var _a; return (_a = shadows[value]) !== null && _a !== void 0 ? _a : value; },
|
|
167
191
|
},
|
|
168
192
|
});
|
|
169
|
-
var Box = styled__default[
|
|
193
|
+
var Box = styled__default["default"]("div", {
|
|
170
194
|
shouldForwardProp: function (propName) {
|
|
171
195
|
return typeof propName === "string"
|
|
172
196
|
? isExcludedWebUiProp(propName)
|
|
173
197
|
? false
|
|
174
|
-
: isPropValid__default[
|
|
198
|
+
: isPropValid__default["default"](propName)
|
|
175
199
|
: false;
|
|
176
200
|
},
|
|
177
|
-
})(templateObject_1$
|
|
178
|
-
"\n ", "\n }\n :focus {\n ",
|
|
179
|
-
"\n ", "\n }\n :focus-within {\n ",
|
|
180
|
-
"\n ",
|
|
181
|
-
"\n }\n"])), box, styledSystem.background, styledSystem.border, styledSystem.borderRight, styledSystem.borderLeft, styledSystem.borderTop, styledSystem.borderBottom, styledSystem.borderColor, styledSystem.borderRadius, styledSystem.borderStyle, styledSystem.borderWidth, styledSystem.boxShadow, styledSystem.flexbox, styledSystem.overflow, styledSystem.position, styledSystem.layout, styledSystem.zIndex, styledSystem.left, styledSystem.right, styledSystem.top, styledSystem.bottom, function (_a) {
|
|
201
|
+
})(templateObject_1$1 || (templateObject_1$1 = __makeTemplateObject(["\n --current-spacing: 0;\n --current-indent: 0;\n --current-gap: 0;\n box-sizing: border-box;\n display: flex;\n flex-direction: column;\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n\n gap: calc(var(--current-gap) * var(--swui-metrics-space));\n\n padding: calc(var(--current-spacing) * var(--swui-metrics-spacing))\n calc(var(--current-indent) * var(--swui-metrics-indent));\n :hover {\n ", "\n ", "\n }\n :focus {\n ", "\n ", "\n }\n :focus-within {\n ", "\n ", "\n }\n"], ["\n --current-spacing: 0;\n --current-indent: 0;\n --current-gap: 0;\n box-sizing: border-box;\n display: flex;\n flex-direction: column;\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n\n gap: calc(var(--current-gap) * var(--swui-metrics-space));\n\n padding: calc(var(--current-spacing) * var(--swui-metrics-spacing))\n calc(var(--current-indent) * var(--swui-metrics-indent));\n :hover {\n ", "\n ", "\n }\n :focus {\n ", "\n ", "\n }\n :focus-within {\n ", "\n ", "\n }\n"])), box, styledSystem.background, styledSystem.border, styledSystem.borderRight, styledSystem.borderLeft, styledSystem.borderTop, styledSystem.borderBottom, styledSystem.borderColor, styledSystem.borderRadius, styledSystem.borderStyle, styledSystem.borderWidth, styledSystem.boxShadow, styledSystem.flexbox, styledSystem.overflow, styledSystem.position, styledSystem.layout, styledSystem.zIndex, styledSystem.left, styledSystem.right, styledSystem.top, styledSystem.bottom, function (_a) {
|
|
182
202
|
var hoverBackground = _a.hoverBackground;
|
|
183
203
|
return hoverBackground ? "background: " + hoverBackground + ";" : "";
|
|
184
204
|
}, function (_a) {
|
|
@@ -197,10 +217,10 @@ var Box = styled__default['default']("div", {
|
|
|
197
217
|
var focusWithinBorder = _a.focusWithinBorder;
|
|
198
218
|
return focusWithinBorder ? "border: " + focusWithinBorder + ";" : "";
|
|
199
219
|
});
|
|
200
|
-
var templateObject_1$
|
|
220
|
+
var templateObject_1$1;
|
|
201
221
|
|
|
202
222
|
var Column = React.forwardRef(function Column(props, ref) {
|
|
203
|
-
return
|
|
223
|
+
return React__namespace.createElement(Box, __assign({ ref: ref }, props));
|
|
204
224
|
});
|
|
205
225
|
|
|
206
226
|
var getDimensionObject = function (node) {
|
|
@@ -255,42 +275,42 @@ var ResizeAwareBox = React.forwardRef(function ResizeAwareBox(_a, ref) {
|
|
|
255
275
|
var localRef = React.useRef(null);
|
|
256
276
|
var currentRef = (_b = ref) !== null && _b !== void 0 ? _b : localRef;
|
|
257
277
|
useElementDimensions(currentRef, onResize);
|
|
258
|
-
return
|
|
278
|
+
return React__namespace.createElement(Box, __assign({}, boxProps, { ref: ref }));
|
|
259
279
|
});
|
|
260
280
|
|
|
261
281
|
var Row = React.forwardRef(function Row(props, ref) {
|
|
262
|
-
return
|
|
282
|
+
return React__namespace.createElement(Box, __assign({ row: true, ref: ref }, props));
|
|
263
283
|
});
|
|
264
284
|
|
|
265
285
|
var Indent = React.forwardRef(function Indent(_a, ref) {
|
|
266
286
|
var _b = _a.num, num = _b === void 0 ? 1 : _b, props = __rest(_a, ["num"]);
|
|
267
|
-
return
|
|
287
|
+
return React__namespace.createElement(Box, __assign({ indent: num, ref: ref }, props));
|
|
268
288
|
});
|
|
269
289
|
|
|
270
290
|
var Spacing = React.forwardRef(function Spacing(_a, ref) {
|
|
271
291
|
var _b = _a.num, num = _b === void 0 ? 1 : _b, props = __rest(_a, ["num"]);
|
|
272
|
-
return
|
|
292
|
+
return React__namespace.createElement(Box, __assign({ spacing: num, ref: ref }, props));
|
|
273
293
|
});
|
|
274
294
|
|
|
275
|
-
var InnerSpace = styled__default[
|
|
295
|
+
var InnerSpace = styled__default["default"].div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n --current-size: 1;\n flex: none;\n width: calc(var(--current-size) * var(--swui-metrics-space));\n height: calc(var(--current-size) * var(--swui-metrics-space));\n"], ["\n --current-size: 1;\n flex: none;\n width: calc(var(--current-size) * var(--swui-metrics-space));\n height: calc(var(--current-size) * var(--swui-metrics-space));\n"])));
|
|
276
296
|
var Space = function (_a) {
|
|
277
297
|
var _b;
|
|
278
298
|
var _c = _a.half, half = _c === void 0 ? false : _c, _d = _a.horizontal, horizontal = _d === void 0 ? false : _d, _e = _a.num, num = _e === void 0 ? 1 : _e, _f = _a.vertical, vertical = _f === void 0 ? false : _f;
|
|
279
299
|
var size = num * (half ? 0.5 : 1);
|
|
280
|
-
return (
|
|
300
|
+
return (React__namespace.createElement(InnerSpace, { style: (_b = {},
|
|
281
301
|
_b["--current-size"] = size,
|
|
282
302
|
_b.height = horizontal ? 1 : undefined,
|
|
283
303
|
_b.width = vertical ? 1 : undefined,
|
|
284
304
|
_b) }));
|
|
285
305
|
};
|
|
286
|
-
var templateObject_1
|
|
306
|
+
var templateObject_1;
|
|
287
307
|
|
|
288
308
|
var Nest = function (_a) {
|
|
289
309
|
var children = _a.children, nest = _a.nest, render = _a.render;
|
|
290
310
|
if (nest) {
|
|
291
|
-
return
|
|
311
|
+
return React__namespace.createElement(React__namespace.Fragment, null, render(children));
|
|
292
312
|
}
|
|
293
|
-
return
|
|
313
|
+
return React__namespace.createElement(React__namespace.Fragment, null, children);
|
|
294
314
|
};
|
|
295
315
|
|
|
296
316
|
function styleInject(css, ref) {
|
|
@@ -320,13 +340,13 @@ function styleInject(css, ref) {
|
|
|
320
340
|
}
|
|
321
341
|
}
|
|
322
342
|
|
|
323
|
-
var css_248z = ".Text-module_text__2FYaC {\n /* Theme vars */\n --swui-text-color: var(--swui-text-primary-color);\n --swui-text-color-caption: var(--swui-text-primary-color);\n --swui-text-color-overline: var(--lhds-color-ui-600);\n --swui-text-font-family: var(--swui-font-primary);\n --swui-text-font-weight: var(--swui-font-weight-text);\n\n /* Current */\n --current-color: var(--swui-text-color);\n --current-font-size: var(--swui-font-size-medium);\n --current-line-height: var(--swui-line-height-medium);\n --current-font-weight: var(--swui-text-font-weight);\n --current-letter-spacing: var(--swui-text-letter-spacing);\n\n /* Styling */\n font-size: var(--current-font-size);\n line-height: var(--current-line-height);\n color: var(--current-color);\n letter-spacing: var(--current-letter-spacing);\n font-family: var(--swui-text-font-family);\n font-weight: var(--current-font-weight);\n}\n\n .Text-module_text__2FYaC.Text-module_standard__2-bur {\n }\n\n .Text-module_text__2FYaC.Text-module_bold__1Knlz {\n --current-font-weight: var(--swui-font-weight-text-bold);\n }\n\n .Text-module_text__2FYaC.Text-module_caption__153CS {\n --current-font-size: var(--swui-font-size-small);\n --current-line-height: var(--swui-line-height-small);\n --current-color: var(--swui-text-color-caption);\n --current-letter-spacing: 0;\n font-style: italic;\n }\n\n .Text-module_text__2FYaC.Text-module_overline__22jee {\n --current-font-size: var(--swui-font-size-smaller);\n --current-line-height: var(--swui-line-height-smaller);\n --current-color: var(--swui-text-color-overline);\n --current-font-weight: var(--swui-font-weight-text-bold);\n --current-letter-spacing: 1px;\n text-transform: uppercase;\n }\n\n .Text-module_text__2FYaC.Text-module_large__3TF1O {\n --current-font-size: var(--swui-font-size-large);\n --current-line-height: var(--swui-line-height-large);\n }\n\n .Text-module_text__2FYaC.Text-module_medium__1yeKe {\n --current-font-size: var(--swui-font-size-medium);\n --current-line-height: var(--swui-line-height-medium);\n }\n\n .Text-module_text__2FYaC.Text-module_small__3KAee {\n --current-font-size: var(--swui-font-size-small);\n --current-line-height: var(--swui-line-height-small);\n }\n\n .Text-module_text__2FYaC.Text-module_smaller__1mD_7 {\n --current-font-size: var(--swui-font-size-smaller);\n --current-line-height: var(--swui-line-height-smaller);\n }\n";
|
|
324
|
-
var styles = {"text":"Text-module_text__2FYaC","standard":"Text-module_standard__2-bur","bold":"Text-module_bold__1Knlz","caption":"Text-module_caption__153CS","overline":"Text-module_overline__22jee","large":"Text-module_large__3TF1O","medium":"Text-module_medium__1yeKe","small":"Text-module_small__3KAee","smaller":"Text-module_smaller__1mD_7"};
|
|
325
|
-
styleInject(css_248z);
|
|
343
|
+
var css_248z$1 = ".Text-module_text__2FYaC {\n /* Theme vars */\n --swui-text-color: var(--swui-text-primary-color);\n --swui-text-color-caption: var(--swui-text-primary-color);\n --swui-text-color-overline: var(--lhds-color-ui-600);\n --swui-text-font-family: var(--swui-font-primary);\n --swui-text-font-weight: var(--swui-font-weight-text);\n\n /* Current */\n --current-color: var(--swui-text-color);\n --current-font-size: var(--swui-font-size-medium);\n --current-line-height: var(--swui-line-height-medium);\n --current-font-weight: var(--swui-text-font-weight);\n --current-letter-spacing: var(--swui-text-letter-spacing);\n\n /* Styling */\n font-size: var(--current-font-size);\n line-height: var(--current-line-height);\n color: var(--current-color);\n letter-spacing: var(--current-letter-spacing);\n font-family: var(--swui-text-font-family);\n font-weight: var(--current-font-weight);\n}\n\n .Text-module_text__2FYaC.Text-module_standard__2-bur {\n }\n\n .Text-module_text__2FYaC.Text-module_bold__1Knlz {\n --current-font-weight: var(--swui-font-weight-text-bold);\n }\n\n .Text-module_text__2FYaC.Text-module_caption__153CS {\n --current-font-size: var(--swui-font-size-small);\n --current-line-height: var(--swui-line-height-small);\n --current-color: var(--swui-text-color-caption);\n --current-letter-spacing: 0;\n font-style: italic;\n }\n\n .Text-module_text__2FYaC.Text-module_overline__22jee {\n --current-font-size: var(--swui-font-size-smaller);\n --current-line-height: var(--swui-line-height-smaller);\n --current-color: var(--swui-text-color-overline);\n --current-font-weight: var(--swui-font-weight-text-bold);\n --current-letter-spacing: 1px;\n text-transform: uppercase;\n }\n\n .Text-module_text__2FYaC.Text-module_large__3TF1O {\n --current-font-size: var(--swui-font-size-large);\n --current-line-height: var(--swui-line-height-large);\n }\n\n .Text-module_text__2FYaC.Text-module_medium__1yeKe {\n --current-font-size: var(--swui-font-size-medium);\n --current-line-height: var(--swui-line-height-medium);\n }\n\n .Text-module_text__2FYaC.Text-module_small__3KAee {\n --current-font-size: var(--swui-font-size-small);\n --current-line-height: var(--swui-line-height-small);\n }\n\n .Text-module_text__2FYaC.Text-module_smaller__1mD_7 {\n --current-font-size: var(--swui-font-size-smaller);\n --current-line-height: var(--swui-line-height-smaller);\n }\n";
|
|
344
|
+
var styles$1 = {"text":"Text-module_text__2FYaC","standard":"Text-module_standard__2-bur","bold":"Text-module_bold__1Knlz","caption":"Text-module_caption__153CS","overline":"Text-module_overline__22jee","large":"Text-module_large__3TF1O","medium":"Text-module_medium__1yeKe","small":"Text-module_small__3KAee","smaller":"Text-module_smaller__1mD_7"};
|
|
345
|
+
styleInject(css_248z$1);
|
|
326
346
|
|
|
327
347
|
var Text = React.forwardRef(function (_a, ref) {
|
|
328
|
-
var children = _a.children, _b = _a.variant, variant = _b === void 0 ? "standard" : _b, _c = _a.size, size = _c === void 0 ? "medium" : _c, className = _a.className, color = _a.color, userSelect = _a.userSelect, whiteSpace = _a.whiteSpace, style = _a.style, spanProps = __rest(_a, ["children", "variant", "size", "className", "color", "userSelect", "whiteSpace", "style"]);
|
|
329
|
-
return (
|
|
348
|
+
var children = _a.children, _b = _a.variant, variant = _b === void 0 ? "standard" : _b, _c = _a.size, size = _c === void 0 ? "medium" : _c, className = _a.className, color = _a.color, userSelect = _a.userSelect, whiteSpace = _a.whiteSpace, wordBreak = _a.wordBreak, style = _a.style, spanProps = __rest(_a, ["children", "variant", "size", "className", "color", "userSelect", "whiteSpace", "wordBreak", "style"]);
|
|
349
|
+
return (React__namespace.createElement("span", __assign({ className: cx__default["default"](styles$1.text, styles$1[variant], styles$1[size], className), ref: ref, style: __assign({ color: color, userSelect: userSelect, whiteSpace: whiteSpace, wordBreak: wordBreak }, style) }, spanProps), children));
|
|
330
350
|
});
|
|
331
351
|
var Txt = Text;
|
|
332
352
|
|
|
@@ -334,45 +354,45 @@ var Txt = Text;
|
|
|
334
354
|
* @deprecated Please use `Text` instead.
|
|
335
355
|
*/
|
|
336
356
|
var SmallText = function (props) {
|
|
337
|
-
return
|
|
357
|
+
return React__namespace.createElement(Text, __assign({ size: "small" }, props));
|
|
338
358
|
};
|
|
339
359
|
|
|
340
360
|
/**
|
|
341
361
|
* @deprecated Please use `Text` instead.
|
|
342
362
|
*/
|
|
343
363
|
var SmallerText = function (props) {
|
|
344
|
-
return
|
|
364
|
+
return React__namespace.createElement(Text, __assign({ size: "smaller" }, props));
|
|
345
365
|
};
|
|
346
366
|
|
|
347
367
|
/**
|
|
348
368
|
* @deprecated Please use `Text` instead.
|
|
349
369
|
*/
|
|
350
370
|
var StandardText = function (props) {
|
|
351
|
-
return
|
|
371
|
+
return React__namespace.createElement(Text, __assign({ size: "medium" }, props));
|
|
352
372
|
};
|
|
353
373
|
|
|
354
374
|
/**
|
|
355
375
|
* @deprecated Please use `Text` instead.
|
|
356
376
|
*/
|
|
357
377
|
var LargeText = function (props) {
|
|
358
|
-
return
|
|
378
|
+
return React__namespace.createElement(Text, __assign({ size: "large" }, props));
|
|
359
379
|
};
|
|
360
380
|
|
|
361
|
-
var css_248z
|
|
362
|
-
var styles
|
|
363
|
-
styleInject(css_248z
|
|
381
|
+
var css_248z = ".Heading-module_heading__1Y-tN {\n font-size: var(--swui-heading-font-size);\n color: var(--lhds-color-ui-900);\n letter-spacing: 0;\n margin: 0;\n line-height: var(--swui-heading-line-height);\n font-family: var(--swui-font-primary);\n font-weight: var(--swui-font-weight-text);\n}\n\n .Heading-module_heading__1Y-tN.Heading-module_h1__3hICB {\n --swui-heading-font-size: 28px;\n --swui-heading-line-height: 32px;\n }\n\n .Heading-module_heading__1Y-tN.Heading-module_h2__2p_cD {\n --swui-heading-font-size: 24px;\n --swui-heading-line-height: 28px;\n }\n\n .Heading-module_heading__1Y-tN.Heading-module_h3__3qTgm {\n --swui-heading-font-size: 20px;\n --swui-heading-line-height: 24px;\n }\n\n .Heading-module_heading__1Y-tN.Heading-module_h4__2ishv {\n --swui-heading-font-size: 16px;\n --swui-heading-line-height: 20px;\n }\n\n .Heading-module_heading__1Y-tN.Heading-module_h5__bYa6B {\n --swui-heading-font-size: 14px;\n --swui-heading-line-height: 18px;\n font-weight: var(--swui-font-weight-text-bold);\n }\n\n .Heading-module_heading__1Y-tN.Heading-module_h6__4yp37 {\n --swui-heading-font-size: 12px;\n --swui-heading-line-height: 16px;\n font-weight: var(--swui-font-weight-text-bold);\n }\n";
|
|
382
|
+
var styles = {"heading":"Heading-module_heading__1Y-tN","h1":"Heading-module_h1__3hICB","h2":"Heading-module_h2__2p_cD","h3":"Heading-module_h3__3qTgm","h4":"Heading-module_h4__2ishv","h5":"Heading-module_h5__bYa6B","h6":"Heading-module_h6__4yp37"};
|
|
383
|
+
styleInject(css_248z);
|
|
364
384
|
|
|
365
385
|
var Heading = React.forwardRef(function (_a, ref) {
|
|
366
|
-
var _b = _a.variant, variant = _b === void 0 ? "h3" : _b, className = _a.className, color = _a.color, whiteSpace = _a.whiteSpace, style = _a.style, children = _a.children, as = _a.as, hProps = __rest(_a, ["variant", "className", "color", "whiteSpace", "style", "children", "as"]);
|
|
386
|
+
var _b = _a.variant, variant = _b === void 0 ? "h3" : _b, className = _a.className, color = _a.color, whiteSpace = _a.whiteSpace, wordBreak = _a.wordBreak, style = _a.style, children = _a.children, as = _a.as, hProps = __rest(_a, ["variant", "className", "color", "whiteSpace", "wordBreak", "style", "children", "as"]);
|
|
367
387
|
var Element = as !== null && as !== void 0 ? as : variant;
|
|
368
|
-
return (
|
|
388
|
+
return (React__namespace.createElement(Element, __assign({ className: cx__default["default"](styles.heading, styles[variant], className), style: __assign({ color: color, whiteSpace: whiteSpace, wordBreak: wordBreak }, style), ref: ref }, hProps), children));
|
|
369
389
|
});
|
|
370
390
|
|
|
371
391
|
/**
|
|
372
392
|
* @deprecated Please use `Heading` instead.
|
|
373
393
|
*/
|
|
374
394
|
var HeaderText = function (props) {
|
|
375
|
-
return
|
|
395
|
+
return React__namespace.createElement(Heading, __assign({ variant: "h2" }, props));
|
|
376
396
|
};
|
|
377
397
|
|
|
378
398
|
var defaultComparator = function (a, b) { return a === b; };
|
|
@@ -380,13 +400,13 @@ var useArraySet = function (list, setList, comparator) {
|
|
|
380
400
|
if (comparator === void 0) { comparator = defaultComparator; }
|
|
381
401
|
var add = React.useCallback(function (item) {
|
|
382
402
|
if (!list.some(function (l) { return comparator(l, item); })) {
|
|
383
|
-
setList(
|
|
403
|
+
setList(__spreadArray(__spreadArray([], list, true), [item], false));
|
|
384
404
|
}
|
|
385
405
|
}, [list, setList, comparator]);
|
|
386
406
|
var addMultiple = React.useCallback(function (items) {
|
|
387
407
|
setList(items.reduce(function (list, item) {
|
|
388
408
|
if (!list.some(function (l) { return comparator(l, item); })) {
|
|
389
|
-
return
|
|
409
|
+
return __spreadArray(__spreadArray([], list, true), [item], false);
|
|
390
410
|
}
|
|
391
411
|
return list;
|
|
392
412
|
}, list));
|
|
@@ -517,7 +537,7 @@ var useEventListener = function (ref, eventName, handler) {
|
|
|
517
537
|
var useElementFocus = function (ref) {
|
|
518
538
|
var _a = useBoolean(false), isInFocus = _a[0], setIsInFocus = _a[1], setIsNotInFocus = _a[2];
|
|
519
539
|
React.useEffect(function () {
|
|
520
|
-
if (document.activeElement ===
|
|
540
|
+
if (document.activeElement === ReactDOM__namespace.findDOMNode(ref.current)) {
|
|
521
541
|
setIsInFocus();
|
|
522
542
|
}
|
|
523
543
|
else {
|
|
@@ -580,10 +600,10 @@ var useMultiOnClickOutside = function (refs, handler) {
|
|
|
580
600
|
document.removeEventListener("touchstart", listener);
|
|
581
601
|
};
|
|
582
602
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
583
|
-
},
|
|
603
|
+
}, __spreadArray([], refs, true));
|
|
584
604
|
};
|
|
585
605
|
|
|
586
|
-
var useOnClickOutside = function (ref, handler) {
|
|
606
|
+
var useOnClickOutside = function (ref, handler, options) {
|
|
587
607
|
var eventHandler = React.useRef(function () {
|
|
588
608
|
return;
|
|
589
609
|
});
|
|
@@ -598,13 +618,13 @@ var useOnClickOutside = function (ref, handler) {
|
|
|
598
618
|
}
|
|
599
619
|
eventHandler.current(event);
|
|
600
620
|
};
|
|
601
|
-
document.addEventListener("mousedown", listener);
|
|
602
|
-
document.addEventListener("touchstart", listener);
|
|
621
|
+
document.addEventListener("mousedown", listener, options);
|
|
622
|
+
document.addEventListener("touchstart", listener, options);
|
|
603
623
|
return function () {
|
|
604
|
-
document.removeEventListener("mousedown", listener);
|
|
605
|
-
document.removeEventListener("touchstart", listener);
|
|
624
|
+
document.removeEventListener("mousedown", listener, options);
|
|
625
|
+
document.removeEventListener("touchstart", listener, options);
|
|
606
626
|
};
|
|
607
|
-
}, [ref]);
|
|
627
|
+
}, [ref, options]);
|
|
608
628
|
};
|
|
609
629
|
|
|
610
630
|
var events = ["mousemove", "mousedown", "keydown", "touchstart", "scroll"];
|
|
@@ -692,6 +712,10 @@ var exhaustSwitchCase = function (_arg, fallback) {
|
|
|
692
712
|
return fallback;
|
|
693
713
|
};
|
|
694
714
|
|
|
715
|
+
var truthyKeysAsList = function (r) {
|
|
716
|
+
return Object.keys(r).filter(function (key) { return r[key]; });
|
|
717
|
+
};
|
|
718
|
+
|
|
695
719
|
var parseFloatElseUndefined = function (s) {
|
|
696
720
|
try {
|
|
697
721
|
var f = parseFloat(s);
|
|
@@ -745,6 +769,7 @@ exports.exhaustSwitchCaseElseThrow = exhaustSwitchCaseElseThrow;
|
|
|
745
769
|
exports.getDimensionObject = getDimensionObject;
|
|
746
770
|
exports.parseFloatElseUndefined = parseFloatElseUndefined;
|
|
747
771
|
exports.parseIntElseUndefined = parseIntElseUndefined;
|
|
772
|
+
exports.truthyKeysAsList = truthyKeysAsList;
|
|
748
773
|
exports.useArraySet = useArraySet;
|
|
749
774
|
exports.useBoolean = useBoolean;
|
|
750
775
|
exports.useDebounce = useDebounce;
|