@stenajs-webui/core 17.6.0 → 17.7.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/CHANGELOG.md +12 -0
- package/dist/components/decorators/separatorline/SeparatorLine.d.ts +9 -9
- package/dist/components/deprecated-text/HeaderText.d.ts +6 -6
- package/dist/components/deprecated-text/LargeText.d.ts +6 -6
- package/dist/components/deprecated-text/SmallText.d.ts +6 -6
- package/dist/components/deprecated-text/SmallerText.d.ts +6 -6
- package/dist/components/deprecated-text/StandardText.d.ts +6 -6
- package/dist/components/heading/Heading.d.ts +11 -11
- package/dist/components/interaction/Clickable.d.ts +48 -48
- package/dist/components/layout/box/Box.d.ts +75 -75
- package/dist/components/layout/box/ResizeAwareBox.d.ts +7 -7
- package/dist/components/layout/column/Column.d.ts +3 -3
- package/dist/components/layout/indent/Indent.d.ts +7 -7
- package/dist/components/layout/row/Row.d.ts +3 -3
- package/dist/components/layout/space/Space.d.ts +8 -8
- package/dist/components/layout/spacing/Spacing.d.ts +7 -7
- package/dist/components/text/Text.d.ts +15 -15
- package/dist/components/util/Nest.d.ts +9 -9
- package/dist/hooks/UseArraySet.d.ts +9 -9
- package/dist/hooks/UseBoolean.d.ts +7 -7
- package/dist/hooks/UseDebounce.d.ts +1 -1
- package/dist/hooks/UseDelayedFalse.d.ts +1 -1
- package/dist/hooks/UseDomId.d.ts +1 -1
- package/dist/hooks/UseElementDimensions.d.ts +15 -15
- package/dist/hooks/UseElementFocus.d.ts +6 -6
- package/dist/hooks/UseEventListener.d.ts +4 -4
- package/dist/hooks/UseForwardedRef.d.ts +2 -2
- package/dist/hooks/UseMouseIsEntered.d.ts +2 -2
- package/dist/hooks/UseMouseIsOver.d.ts +2 -2
- package/dist/hooks/UseMultiOnClickOutside.d.ts +2 -2
- package/dist/hooks/UseOnClickOutside.d.ts +2 -2
- package/dist/hooks/UseOnNoMouseInput.d.ts +1 -1
- package/dist/hooks/UseOnScreen.d.ts +2 -2
- package/dist/hooks/UseTimeoutState.d.ts +1 -1
- package/dist/index.d.ts +44 -44
- package/dist/index.es.js +711 -690
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +80 -793
- package/dist/index.js.map +1 -1
- package/dist/storybook-helpers/storybook-controls.d.ts +46 -46
- package/dist/types/DeepPartial.d.ts +3 -3
- package/dist/types/ElementProps.d.ts +18 -18
- package/dist/types/FlattenUnion.d.ts +5 -5
- package/dist/types/Omit.d.ts +1 -1
- package/dist/types/PickByValue.d.ts +3 -3
- package/dist/utils/BooleanOrNumberToNumber.d.ts +1 -1
- package/dist/utils/PropsForwarder.d.ts +1 -1
- package/dist/utils/SwitchCaseExhauster.d.ts +2 -2
- package/dist/utils/TruthyKeysAsList.d.ts +1 -1
- package/dist/utils/parsers/NumberParser.d.ts +2 -2
- package/package.json +7 -10
- package/dist/components/decorators/separatorline/SeparatorLine.stories.d.ts +0 -29
- package/dist/components/heading/Heading.stories.d.ts +0 -16
- package/dist/components/interaction/Clickable.stories.d.ts +0 -13
- package/dist/components/layout/box/Box.stories.d.ts +0 -68
- package/dist/components/layout/box/ResponsiveBox.stories.d.ts +0 -10
- package/dist/components/layout/column/Column.stories.d.ts +0 -13
- package/dist/components/layout/indent/Indent.stories.d.ts +0 -8
- package/dist/components/layout/row/Row.stories.d.ts +0 -8
- package/dist/components/layout/space/Space.stories.d.ts +0 -8
- package/dist/components/layout/spacing/Spacing.stories.d.ts +0 -8
- package/dist/components/text/Text.stories.d.ts +0 -31
- package/dist/components/util/__tests__/Nest.test.d.ts +0 -0
- package/dist/hooks/__tests__/UseArraySet.test.d.ts +0 -1
- package/dist/hooks/__tests__/UseBoolean.test.d.ts +0 -1
- package/dist/hooks/__tests__/UseDebounce.test.d.ts +0 -1
- package/dist/hooks/__tests__/UseMultiOnClickOutside.test.d.ts +0 -1
- package/dist/hooks/__tests__/UseOnClickOutside.test.d.ts +0 -1
- package/dist/utils/__tests__/PropsForwarder.test.d.ts +0 -1
- package/dist/utils/__tests__/TruthyKeysAsList.test.d.ts +0 -1
package/dist/index.js
CHANGED
|
@@ -1,796 +1,83 @@
|
|
|
1
|
-
'use strict
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
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
|
-
|
|
34
|
-
var styled__default = /*#__PURE__*/_interopDefaultLegacy(styled);
|
|
35
|
-
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
36
|
-
var isPropValid__default = /*#__PURE__*/_interopDefaultLegacy(isPropValid);
|
|
37
|
-
var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
|
|
38
|
-
var ReactDOM__namespace = /*#__PURE__*/_interopNamespace(ReactDOM);
|
|
39
|
-
|
|
40
|
-
/*! *****************************************************************************
|
|
41
|
-
Copyright (c) Microsoft Corporation.
|
|
42
|
-
|
|
43
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
44
|
-
purpose with or without fee is hereby granted.
|
|
45
|
-
|
|
46
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
47
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
48
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
49
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
50
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
51
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
52
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
53
|
-
***************************************************************************** */
|
|
54
|
-
|
|
55
|
-
var __assign = function() {
|
|
56
|
-
__assign = Object.assign || function __assign(t) {
|
|
57
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
58
|
-
s = arguments[i];
|
|
59
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
60
|
-
}
|
|
61
|
-
return t;
|
|
62
|
-
};
|
|
63
|
-
return __assign.apply(this, arguments);
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
function __rest(s, e) {
|
|
67
|
-
var t = {};
|
|
68
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
69
|
-
t[p] = s[p];
|
|
70
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
71
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
72
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
73
|
-
t[p[i]] = s[p[i]];
|
|
74
|
-
}
|
|
75
|
-
return t;
|
|
76
|
-
}
|
|
77
|
-
|
|
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));
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
function __makeTemplateObject(cooked, raw) {
|
|
89
|
-
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
90
|
-
return cooked;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
var SeparatorLineComponent = styled__default["default"].hr(templateObject_1$3 || (templateObject_1$3 = __makeTemplateObject(["\n display: flex;\n border: 0;\n margin: 0;\n flex: none;\n background-color: ", ";\n height: ", ";\n width: ", ";\n"], ["\n display: flex;\n border: 0;\n margin: 0;\n flex: none;\n background-color: ", ";\n height: ", ";\n width: ", ";\n"])), function (props) { return props.color; }, function (props) {
|
|
94
|
-
return props.vertical ? props.size || "100%" : props.width || "1px";
|
|
95
|
-
}, function (props) {
|
|
96
|
-
return props.vertical ? props.width || "1px" : props.size || "100%";
|
|
97
|
-
});
|
|
98
|
-
var SeparatorLine = React.forwardRef(function (_a, ref) {
|
|
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;
|
|
100
|
-
return (React__namespace.createElement(SeparatorLineComponent, { color: color, size: size, width: width, vertical: vertical, ref: ref }));
|
|
101
|
-
});
|
|
102
|
-
var templateObject_1$3;
|
|
103
|
-
|
|
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) {
|
|
105
|
-
var background = _a.background;
|
|
106
|
-
return background;
|
|
107
|
-
}, function (_a) {
|
|
108
|
-
var pointer = _a.pointer;
|
|
109
|
-
return (pointer ? "cursor: pointer;" : "");
|
|
110
|
-
}, function (props) { return (props.opacityOnHover ? "opacity: 0.7;" : ""); }, function (_a) {
|
|
111
|
-
var hoverBackground = _a.hoverBackground;
|
|
112
|
-
return "background: ".concat(hoverBackground, ";");
|
|
113
|
-
}, function (_a) {
|
|
114
|
-
var disableOpacityOnClick = _a.disableOpacityOnClick;
|
|
115
|
-
return !disableOpacityOnClick ? "opacity: 0.5;" : "";
|
|
116
|
-
}, function (_a) {
|
|
117
|
-
var disableFocusHighlight = _a.disableFocusHighlight;
|
|
118
|
-
return disableFocusHighlight
|
|
119
|
-
? ""
|
|
120
|
-
: "box-shadow: 0 0 3pt 2pt rgba(0, 0, 100, 0.3);";
|
|
121
|
-
}, function (_a) {
|
|
122
|
-
var focusBackground = _a.focusBackground;
|
|
123
|
-
return "background: ".concat(focusBackground, ";");
|
|
124
|
-
}, function (_a) {
|
|
125
|
-
var width = _a.width;
|
|
126
|
-
return (width ? "width: ".concat(width, ";") : "");
|
|
127
|
-
}, function (_a) {
|
|
128
|
-
var height = _a.height;
|
|
129
|
-
return (height ? "height: ".concat(height, ";") : "");
|
|
130
|
-
}, function (_a) {
|
|
131
|
-
var borderRadius = _a.borderRadius;
|
|
132
|
-
return borderRadius ? "border-radius: ".concat(borderRadius, ";") : "";
|
|
133
|
-
});
|
|
134
|
-
var Clickable = React.forwardRef(function (_a, ref) {
|
|
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"]);
|
|
136
|
-
var hasClickHandler = !!(onClick || onDblClick);
|
|
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));
|
|
138
|
-
});
|
|
139
|
-
var templateObject_1$2;
|
|
140
|
-
|
|
141
|
-
var booleanOrNumberToNumber = function (num) {
|
|
142
|
-
if (num == null) {
|
|
143
|
-
return 0;
|
|
144
|
-
}
|
|
145
|
-
if (typeof num === "boolean") {
|
|
146
|
-
return num ? 1 : 0;
|
|
147
|
-
}
|
|
148
|
-
return num;
|
|
149
|
-
};
|
|
150
|
-
|
|
151
|
-
var shadows = {
|
|
152
|
-
box: "var(--swui-shadow-box)",
|
|
153
|
-
popover: "var(--swui-shadow-popover)",
|
|
154
|
-
modal: "var(--swui-shadow-modal)",
|
|
155
|
-
};
|
|
156
|
-
var excludedProps = [
|
|
157
|
-
"spacing",
|
|
158
|
-
"indent",
|
|
159
|
-
"gap",
|
|
160
|
-
"width",
|
|
161
|
-
"height",
|
|
162
|
-
"overflow",
|
|
163
|
-
"display",
|
|
164
|
-
];
|
|
165
|
-
var isExcludedWebUiProp = function (propName) {
|
|
166
|
-
return excludedProps.includes(propName);
|
|
167
|
-
};
|
|
168
|
-
var box = styledSystem.system({
|
|
169
|
-
row: {
|
|
170
|
-
property: "flexDirection",
|
|
171
|
-
transform: function (row) { return (row ? "row" : "column"); },
|
|
172
|
-
},
|
|
173
|
-
indent: {
|
|
174
|
-
// @ts-ignore
|
|
175
|
-
property: "--current-indent",
|
|
176
|
-
transform: booleanOrNumberToNumber,
|
|
177
|
-
},
|
|
178
|
-
spacing: {
|
|
179
|
-
// @ts-ignore
|
|
180
|
-
property: "--current-spacing",
|
|
181
|
-
transform: booleanOrNumberToNumber,
|
|
182
|
-
},
|
|
183
|
-
gap: {
|
|
184
|
-
// @ts-ignore
|
|
185
|
-
property: "--current-gap",
|
|
186
|
-
transform: booleanOrNumberToNumber,
|
|
187
|
-
},
|
|
188
|
-
shadow: {
|
|
189
|
-
property: "boxShadow",
|
|
190
|
-
transform: function (value) { var _a; return (_a = shadows[value]) !== null && _a !== void 0 ? _a : value; },
|
|
191
|
-
},
|
|
192
|
-
});
|
|
193
|
-
var Box = styled__default["default"]("div", {
|
|
194
|
-
shouldForwardProp: function (propName) {
|
|
195
|
-
return typeof propName === "string"
|
|
196
|
-
? isExcludedWebUiProp(propName)
|
|
197
|
-
? false
|
|
198
|
-
: isPropValid__default["default"](propName)
|
|
199
|
-
: false;
|
|
200
|
-
},
|
|
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) {
|
|
202
|
-
var hoverBackground = _a.hoverBackground;
|
|
203
|
-
return hoverBackground ? "background: ".concat(hoverBackground, ";") : "";
|
|
204
|
-
}, function (_a) {
|
|
205
|
-
var hoverBorder = _a.hoverBorder;
|
|
206
|
-
return (hoverBorder ? "border: ".concat(hoverBorder, ";") : "");
|
|
207
|
-
}, function (_a) {
|
|
208
|
-
var focusBackground = _a.focusBackground;
|
|
209
|
-
return focusBackground ? "background: ".concat(focusBackground, ";") : "";
|
|
210
|
-
}, function (_a) {
|
|
211
|
-
var focusBorder = _a.focusBorder;
|
|
212
|
-
return (focusBorder ? "border: ".concat(focusBorder, ";") : "");
|
|
213
|
-
}, function (_a) {
|
|
214
|
-
var focusWithinBackground = _a.focusWithinBackground;
|
|
215
|
-
return focusWithinBackground ? "background: ".concat(focusWithinBackground, ";") : "";
|
|
216
|
-
}, function (_a) {
|
|
217
|
-
var focusWithinBorder = _a.focusWithinBorder;
|
|
218
|
-
return focusWithinBorder ? "border: ".concat(focusWithinBorder, ";") : "";
|
|
219
|
-
});
|
|
220
|
-
var templateObject_1$1;
|
|
221
|
-
|
|
222
|
-
var Column = React.forwardRef(function Column(props, ref) {
|
|
223
|
-
return React__namespace.createElement(Box, __assign({ ref: ref }, props));
|
|
224
|
-
});
|
|
225
|
-
|
|
226
|
-
var getDimensionObject = function (node) {
|
|
227
|
-
var _a = node.getBoundingClientRect(), x = _a.x, y = _a.y, width = _a.width, height = _a.height, bottom = _a.bottom, top = _a.top, left = _a.left, right = _a.right;
|
|
228
|
-
return {
|
|
229
|
-
width: width,
|
|
230
|
-
height: height,
|
|
231
|
-
top: top,
|
|
232
|
-
left: left,
|
|
233
|
-
x: x,
|
|
234
|
-
y: y,
|
|
235
|
-
right: right,
|
|
236
|
-
bottom: bottom,
|
|
237
|
-
};
|
|
238
|
-
};
|
|
239
|
-
var isEqualDimensions = function (a, b) {
|
|
240
|
-
return a.x === b.x &&
|
|
241
|
-
a.y === b.y &&
|
|
242
|
-
a.width === b.width &&
|
|
243
|
-
a.height === b.height &&
|
|
244
|
-
a.bottom === b.bottom &&
|
|
245
|
-
a.top === b.top &&
|
|
246
|
-
a.left === b.left &&
|
|
247
|
-
a.right === b.right;
|
|
248
|
-
};
|
|
249
|
-
var useElementDimensions = function (ref, onResizeElement) {
|
|
250
|
-
var _a = React.useState(), dimensions = _a[0], setDimensions = _a[1];
|
|
251
|
-
var updateDimensions = React.useCallback(function () {
|
|
252
|
-
window.requestAnimationFrame(function () {
|
|
253
|
-
if (ref.current) {
|
|
254
|
-
var newDimensions = getDimensionObject(ref.current);
|
|
255
|
-
if (!dimensions || !isEqualDimensions(dimensions, newDimensions)) {
|
|
256
|
-
if (onResizeElement) {
|
|
257
|
-
onResizeElement(newDimensions);
|
|
258
|
-
}
|
|
259
|
-
}
|
|
260
|
-
setDimensions(newDimensions);
|
|
261
|
-
}
|
|
262
|
-
});
|
|
263
|
-
}, [ref, dimensions, setDimensions, onResizeElement]);
|
|
264
|
-
React.useLayoutEffect(function () {
|
|
265
|
-
updateDimensions();
|
|
266
|
-
}, [updateDimensions]);
|
|
267
|
-
return {
|
|
268
|
-
dimensions: dimensions,
|
|
269
|
-
};
|
|
270
|
-
};
|
|
271
|
-
|
|
272
|
-
var ResizeAwareBox = React.forwardRef(function ResizeAwareBox(_a, ref) {
|
|
273
|
-
var _b;
|
|
274
|
-
var onResize = _a.onResize, boxProps = __rest(_a, ["onResize"]);
|
|
275
|
-
var localRef = React.useRef(null);
|
|
276
|
-
var currentRef = (_b = ref) !== null && _b !== void 0 ? _b : localRef;
|
|
277
|
-
useElementDimensions(currentRef, onResize);
|
|
278
|
-
return React__namespace.createElement(Box, __assign({}, boxProps, { ref: ref }));
|
|
279
|
-
});
|
|
280
|
-
|
|
281
|
-
var Row = React.forwardRef(function Row(props, ref) {
|
|
282
|
-
return React__namespace.createElement(Box, __assign({ row: true, ref: ref }, props));
|
|
283
|
-
});
|
|
284
|
-
|
|
285
|
-
var Indent = React.forwardRef(function Indent(_a, ref) {
|
|
286
|
-
var _b = _a.num, num = _b === void 0 ? 1 : _b, props = __rest(_a, ["num"]);
|
|
287
|
-
return React__namespace.createElement(Box, __assign({ indent: num, ref: ref }, props));
|
|
288
|
-
});
|
|
289
|
-
|
|
290
|
-
var Spacing = React.forwardRef(function Spacing(_a, ref) {
|
|
291
|
-
var _b = _a.num, num = _b === void 0 ? 1 : _b, props = __rest(_a, ["num"]);
|
|
292
|
-
return React__namespace.createElement(Box, __assign({ spacing: num, ref: ref }, props));
|
|
293
|
-
});
|
|
294
|
-
|
|
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"])));
|
|
296
|
-
var Space = function (_a) {
|
|
297
|
-
var _b;
|
|
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;
|
|
299
|
-
var size = num * (half ? 0.5 : 1);
|
|
300
|
-
return (React__namespace.createElement(InnerSpace, { style: (_b = {},
|
|
301
|
-
_b["--current-size"] = size,
|
|
302
|
-
_b.height = horizontal ? 1 : undefined,
|
|
303
|
-
_b.width = vertical ? 1 : undefined,
|
|
304
|
-
_b) }));
|
|
305
|
-
};
|
|
306
|
-
var templateObject_1;
|
|
307
|
-
|
|
308
|
-
var Nest = function (_a) {
|
|
309
|
-
var children = _a.children, nest = _a.nest, render = _a.render;
|
|
310
|
-
if (nest) {
|
|
311
|
-
return React__namespace.createElement(React__namespace.Fragment, null, render(children));
|
|
312
|
-
}
|
|
313
|
-
return React__namespace.createElement(React__namespace.Fragment, null, children);
|
|
314
|
-
};
|
|
315
|
-
|
|
316
|
-
function styleInject(css, ref) {
|
|
317
|
-
if ( ref === void 0 ) ref = {};
|
|
318
|
-
var insertAt = ref.insertAt;
|
|
319
|
-
|
|
320
|
-
if (!css || typeof document === 'undefined') { return; }
|
|
321
|
-
|
|
322
|
-
var head = document.head || document.getElementsByTagName('head')[0];
|
|
323
|
-
var style = document.createElement('style');
|
|
324
|
-
style.type = 'text/css';
|
|
325
|
-
|
|
326
|
-
if (insertAt === 'top') {
|
|
327
|
-
if (head.firstChild) {
|
|
328
|
-
head.insertBefore(style, head.firstChild);
|
|
329
|
-
} else {
|
|
330
|
-
head.appendChild(style);
|
|
331
|
-
}
|
|
332
|
-
} else {
|
|
333
|
-
head.appendChild(style);
|
|
1
|
+
(function(){ try {var elementStyle = document.createElement('style'); elementStyle.appendChild(document.createTextNode("._text_1iisw_1{--swui-text-color: var(--swui-text-primary-color);--swui-text-color-caption: var(--lhds-color-ui-600);--swui-text-color-overline: var(--lhds-color-ui-600);--swui-text-font-family: var(--swui-font-primary);--swui-text-font-weight: var(--swui-font-weight-text);--current-color: var(--swui-text-color);--current-font-size: var(--swui-font-size-medium);--current-line-height: var(--swui-line-height-medium);--current-font-weight: var(--swui-text-font-weight);--current-letter-spacing: var(--swui-text-letter-spacing);font-size:var(--current-font-size);line-height:var(--current-line-height);color:var(--current-color);letter-spacing:var(--current-letter-spacing);font-family:var(--swui-text-font-family);font-weight:var(--current-font-weight)}._text_1iisw_1._bold_1iisw_27{--current-font-weight: var(--swui-font-weight-text-bold)}._text_1iisw_1._caption_1iisw_31{--current-font-size: var(--swui-font-size-small);--current-line-height: var(--swui-line-height-small);--current-color: var(--swui-text-color-caption);--current-letter-spacing: 0;font-style:italic}._text_1iisw_1._overline_1iisw_39{--current-font-size: var(--swui-font-size-smaller);--current-line-height: var(--swui-line-height-smaller);--current-color: var(--swui-text-color-overline);--current-font-weight: var(--swui-font-weight-text-bold);--current-letter-spacing: .1rem;text-transform:uppercase}._text_1iisw_1._large_1iisw_48{--current-font-size: var(--swui-font-size-large);--current-line-height: var(--swui-line-height-large)}._text_1iisw_1._medium_1iisw_53{--current-font-size: var(--swui-font-size-medium);--current-line-height: var(--swui-line-height-medium)}._text_1iisw_1._small_1iisw_58{--current-font-size: var(--swui-font-size-small);--current-line-height: var(--swui-line-height-small)}._text_1iisw_1._smaller_1iisw_63{--current-font-size: var(--swui-font-size-smaller);--current-line-height: var(--swui-line-height-smaller)}._heading_1u7xw_1{font-size:var(--swui-heading-font-size);color:var(--lhds-color-ui-900);letter-spacing:0;margin:0;line-height:var(--swui-heading-line-height);font-family:var(--swui-font-primary);font-weight:var(--swui-font-weight-text)}._heading_1u7xw_1._h1_1u7xw_10{--swui-heading-font-size: 2.8rem;--swui-heading-line-height: 4rem}._heading_1u7xw_1._h2_1u7xw_15{--swui-heading-font-size: 2.4rem;--swui-heading-line-height: 3.2rem}._heading_1u7xw_1._h3_1u7xw_20{--swui-heading-font-size: 2rem;--swui-heading-line-height: 2.4rem}._heading_1u7xw_1._h4_1u7xw_25{--swui-heading-font-size: 1.6rem;--swui-heading-line-height: 2.4rem;font-weight:var(--swui-font-weight-text-bold)}._heading_1u7xw_1._h5_1u7xw_31{--swui-heading-font-size: 1.4rem;--swui-heading-line-height: 1.6rem;font-weight:var(--swui-font-weight-text-bold)}._heading_1u7xw_1._h6_1u7xw_37{--swui-heading-font-size: 1.2rem;--swui-heading-line-height: 1.6rem;font-weight:var(--swui-font-weight-text-bold)}")); document.head.appendChild(elementStyle);} catch(e) {console.error('vite-plugin-css-injected-by-js', e);} })();"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});require("@stenajs-webui/theme");var L=require("@emotion/styled"),s=require("react"),l=require("react/jsx-runtime"),F=require("@emotion/is-prop-valid"),i=require("styled-system"),z=require("classnames"),N=require("react-dom"),C=require("lodash");function $(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}function P(e){if(e&&e.__esModule)return e;var t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});return e&&Object.keys(e).forEach(function(r){if(r!=="default"){var n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:function(){return e[r]}})}}),t.default=e,Object.freeze(t)}var p=$(L),q=$(F),O=$(z),H=P(N);const A=p.default.hr`
|
|
2
|
+
display: flex;
|
|
3
|
+
border: 0;
|
|
4
|
+
margin: 0;
|
|
5
|
+
flex: none;
|
|
6
|
+
background-color: ${e=>e.color};
|
|
7
|
+
height: ${e=>e.vertical?e.size||"100%":e.width||"1px"};
|
|
8
|
+
width: ${e=>e.vertical?e.width||"1px":e.size||"100%"};
|
|
9
|
+
`,V=s.forwardRef(({color:e="var(--lhds-color-ui-300)",size:t="100%",width:r="1px",vertical:n=!1},o)=>l.jsx(A,{color:e,size:t,width:r,vertical:n,ref:o})),U=p.default.button`
|
|
10
|
+
display: inline-block;
|
|
11
|
+
user-select: none;
|
|
12
|
+
border: 0;
|
|
13
|
+
padding: 0;
|
|
14
|
+
background: ${({background:e})=>e};
|
|
15
|
+
${({pointer:e})=>e?"cursor: pointer;":""}
|
|
16
|
+
|
|
17
|
+
:hover {
|
|
18
|
+
${e=>e.opacityOnHover?"opacity: 0.7;":""};
|
|
19
|
+
${({hoverBackground:e})=>`background: ${e};`}
|
|
334
20
|
}
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
style.styleSheet.cssText = css;
|
|
338
|
-
} else {
|
|
339
|
-
style.appendChild(document.createTextNode(css));
|
|
21
|
+
:active {
|
|
22
|
+
${({disableOpacityOnClick:e})=>e?"":"opacity: 0.5;"}
|
|
340
23
|
}
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
};
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
};
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
};
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
}
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
var
|
|
399
|
-
var
|
|
400
|
-
if (comparator === void 0) { comparator = defaultComparator; }
|
|
401
|
-
var add = React.useCallback(function (item) {
|
|
402
|
-
if (!list.some(function (l) { return comparator(l, item); })) {
|
|
403
|
-
setList(__spreadArray(__spreadArray([], list, true), [item], false));
|
|
404
|
-
}
|
|
405
|
-
}, [list, setList, comparator]);
|
|
406
|
-
var addMultiple = React.useCallback(function (items) {
|
|
407
|
-
setList(items.reduce(function (list, item) {
|
|
408
|
-
if (!list.some(function (l) { return comparator(l, item); })) {
|
|
409
|
-
return __spreadArray(__spreadArray([], list, true), [item], false);
|
|
410
|
-
}
|
|
411
|
-
return list;
|
|
412
|
-
}, list));
|
|
413
|
-
}, [list, setList, comparator]);
|
|
414
|
-
var remove = React.useCallback(function (item) {
|
|
415
|
-
var index = list.findIndex(function (l) { return comparator(l, item); });
|
|
416
|
-
if (index >= 0) {
|
|
417
|
-
setList(list.filter(function (_, i) { return i !== index; }));
|
|
418
|
-
}
|
|
419
|
-
}, [list, setList, comparator]);
|
|
420
|
-
var removeMultiple = React.useCallback(function (items) {
|
|
421
|
-
setList(list.filter(function (item) { return !items.some(function (l) { return comparator(l, item); }); }));
|
|
422
|
-
}, [list, setList, comparator]);
|
|
423
|
-
var toggle = React.useCallback(function (item) {
|
|
424
|
-
var found = list.some(function (l) { return comparator(l, item); });
|
|
425
|
-
if (found) {
|
|
426
|
-
remove(item);
|
|
427
|
-
}
|
|
428
|
-
else {
|
|
429
|
-
add(item);
|
|
430
|
-
}
|
|
431
|
-
}, [list, add, remove, comparator]);
|
|
432
|
-
return {
|
|
433
|
-
add: add,
|
|
434
|
-
addMultiple: addMultiple,
|
|
435
|
-
remove: remove,
|
|
436
|
-
removeMultiple: removeMultiple,
|
|
437
|
-
toggle: toggle,
|
|
438
|
-
};
|
|
439
|
-
};
|
|
440
|
-
|
|
441
|
-
var useBoolean = function (initialValue) {
|
|
442
|
-
var _a = React.useState(initialValue), value = _a[0], setValue = _a[1];
|
|
443
|
-
var setTrue = React.useCallback(function () {
|
|
444
|
-
setValue(true);
|
|
445
|
-
}, [setValue]);
|
|
446
|
-
var setFalse = React.useCallback(function () {
|
|
447
|
-
setValue(false);
|
|
448
|
-
}, [setValue]);
|
|
449
|
-
var toggle = React.useCallback(function () {
|
|
450
|
-
setValue(function (v) { return !v; });
|
|
451
|
-
}, [setValue]);
|
|
452
|
-
return [value, setTrue, setFalse, toggle];
|
|
453
|
-
};
|
|
454
|
-
|
|
455
|
-
var useDebounce = function (value, delay) {
|
|
456
|
-
// State and setters for debounced value
|
|
457
|
-
var _a = React.useState(value), debouncedValue = _a[0], setDebouncedValue = _a[1];
|
|
458
|
-
React.useEffect(function () {
|
|
459
|
-
// Update debounced value after delay
|
|
460
|
-
var handler = setTimeout(function () {
|
|
461
|
-
setDebouncedValue(value);
|
|
462
|
-
}, delay);
|
|
463
|
-
// Cancel the timeout if value changes (also on delay change or unmount)
|
|
464
|
-
// This is how we prevent debounced value from updating if value is changed ...
|
|
465
|
-
// .. within the delay period. Timeout gets cleared and restarted.
|
|
466
|
-
return function () {
|
|
467
|
-
clearTimeout(handler);
|
|
468
|
-
};
|
|
469
|
-
}, [value, delay]); // Only re-call effect if value or delay changes
|
|
470
|
-
return debouncedValue;
|
|
471
|
-
};
|
|
472
|
-
|
|
473
|
-
var useDelayedFalse = function (value, delay) {
|
|
474
|
-
var _a = React.useState(value), debouncedValue = _a[0], setDebouncedValue = _a[1];
|
|
475
|
-
React.useEffect(function () {
|
|
476
|
-
if (value) {
|
|
477
|
-
setDebouncedValue(true);
|
|
478
|
-
}
|
|
479
|
-
var handler = setTimeout(function () {
|
|
480
|
-
if (!value) {
|
|
481
|
-
setDebouncedValue(value);
|
|
482
|
-
}
|
|
483
|
-
}, delay);
|
|
484
|
-
return function () {
|
|
485
|
-
clearTimeout(handler);
|
|
486
|
-
};
|
|
487
|
-
}, [value, delay]);
|
|
488
|
-
return debouncedValue;
|
|
489
|
-
};
|
|
490
|
-
|
|
491
|
-
var id = 0;
|
|
492
|
-
var genId = function (componentName) {
|
|
493
|
-
return "webui-".concat(componentName ? componentName + "-" : "").concat(++id);
|
|
494
|
-
};
|
|
495
|
-
var useDomId = function (componentName) {
|
|
496
|
-
var _a = React.useState(function () { return genId(componentName); }), id = _a[0], setId = _a[1];
|
|
497
|
-
React.useEffect(function () { return setId(genId(componentName)); }, [componentName]);
|
|
498
|
-
return id;
|
|
499
|
-
};
|
|
500
|
-
|
|
501
|
-
var useEventListener = function (ref, eventName, handler) {
|
|
502
|
-
// Create a ref that stores handler
|
|
503
|
-
var savedHandler = React.useRef();
|
|
504
|
-
// Update ref.current value if handler changes.
|
|
505
|
-
// This allows our effect below to always get latest handler ...
|
|
506
|
-
// ... without us needing to pass it in effect deps array ...
|
|
507
|
-
// ... and potentially cause effect to re-run every render.
|
|
508
|
-
React.useEffect(function () {
|
|
509
|
-
savedHandler.current = handler;
|
|
510
|
-
}, [handler]);
|
|
511
|
-
React.useEffect(function () {
|
|
512
|
-
// Make sure element supports addEventListener
|
|
513
|
-
var isSupported = ref.current && ref.current.addEventListener;
|
|
514
|
-
if (!isSupported)
|
|
515
|
-
return;
|
|
516
|
-
// Create event listener that calls handler function stored in ref
|
|
517
|
-
var eventListener = function (event) {
|
|
518
|
-
if (savedHandler.current) {
|
|
519
|
-
return savedHandler.current(event);
|
|
520
|
-
}
|
|
521
|
-
};
|
|
522
|
-
// Add event listener
|
|
523
|
-
if (!ref.current) {
|
|
524
|
-
return;
|
|
525
|
-
}
|
|
526
|
-
var element = ref.current;
|
|
527
|
-
element.addEventListener(eventName, eventListener);
|
|
528
|
-
// Remove event listener on cleanup
|
|
529
|
-
return function () {
|
|
530
|
-
if (element) {
|
|
531
|
-
element.removeEventListener(eventName, eventListener);
|
|
532
|
-
}
|
|
533
|
-
};
|
|
534
|
-
}, [eventName, ref]); // Re-run if eventName or element changes
|
|
535
|
-
};
|
|
536
|
-
|
|
537
|
-
var useElementFocus = function (ref) {
|
|
538
|
-
var _a = useBoolean(false), isInFocus = _a[0], setIsInFocus = _a[1], setIsNotInFocus = _a[2];
|
|
539
|
-
React.useEffect(function () {
|
|
540
|
-
if (document.activeElement === ReactDOM__namespace.findDOMNode(ref.current)) {
|
|
541
|
-
setIsInFocus();
|
|
542
|
-
}
|
|
543
|
-
else {
|
|
544
|
-
setIsNotInFocus();
|
|
545
|
-
}
|
|
546
|
-
}, [ref, setIsNotInFocus, setIsInFocus]);
|
|
547
|
-
useEventListener(ref, "focus", setIsInFocus);
|
|
548
|
-
useEventListener(ref, "blur", setIsNotInFocus);
|
|
549
|
-
var focus = React.useCallback(function () {
|
|
550
|
-
if (ref.current) {
|
|
551
|
-
ref.current.focus();
|
|
552
|
-
}
|
|
553
|
-
}, [ref]);
|
|
554
|
-
var blur = React.useCallback(function () {
|
|
555
|
-
if (ref.current) {
|
|
556
|
-
ref.current.blur();
|
|
557
|
-
}
|
|
558
|
-
}, [ref]);
|
|
559
|
-
return { isInFocus: isInFocus, focus: focus, blur: blur };
|
|
560
|
-
};
|
|
561
|
-
|
|
562
|
-
var useMouseIsOver = function (ref) {
|
|
563
|
-
var _a = useBoolean(false), mouseIsOver = _a[0], setMouseIsOver = _a[1], setMouseIsNotOver = _a[2];
|
|
564
|
-
useEventListener(ref, "mouseover", setMouseIsOver);
|
|
565
|
-
useEventListener(ref, "mouseout", setMouseIsNotOver);
|
|
566
|
-
return mouseIsOver;
|
|
567
|
-
};
|
|
568
|
-
|
|
569
|
-
var useMouseIsEntered = function (ref) {
|
|
570
|
-
var _a = useBoolean(false), mouseIsEntered = _a[0], setMouseIsEntered = _a[1], setMouseIsNotEntered = _a[2];
|
|
571
|
-
useEventListener(ref, "mouseenter", setMouseIsEntered);
|
|
572
|
-
useEventListener(ref, "mouseleave", setMouseIsNotEntered);
|
|
573
|
-
return mouseIsEntered;
|
|
574
|
-
};
|
|
575
|
-
|
|
576
|
-
var useMultiOnClickOutside = function (refs, handler) {
|
|
577
|
-
var eventHandler = React.useRef(function () {
|
|
578
|
-
return;
|
|
579
|
-
});
|
|
580
|
-
React.useEffect(function () {
|
|
581
|
-
eventHandler.current = handler;
|
|
582
|
-
}, [handler]);
|
|
583
|
-
React.useEffect(function () {
|
|
584
|
-
var listener = function (event) {
|
|
585
|
-
// Do nothing if clicking ref's element or descendent elements
|
|
586
|
-
var allNotContains = refs
|
|
587
|
-
.filter(function (ref) { return ref.current; })
|
|
588
|
-
.every(function (ref) {
|
|
589
|
-
return ref.current && !ref.current.contains(event.target);
|
|
590
|
-
});
|
|
591
|
-
if (!allNotContains) {
|
|
592
|
-
return;
|
|
593
|
-
}
|
|
594
|
-
eventHandler.current(event);
|
|
595
|
-
};
|
|
596
|
-
document.addEventListener("mousedown", listener);
|
|
597
|
-
document.addEventListener("touchstart", listener);
|
|
598
|
-
return function () {
|
|
599
|
-
document.removeEventListener("mousedown", listener);
|
|
600
|
-
document.removeEventListener("touchstart", listener);
|
|
601
|
-
};
|
|
602
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
603
|
-
}, __spreadArray([], refs, true));
|
|
604
|
-
};
|
|
605
|
-
|
|
606
|
-
var useOnClickOutside = function (ref, handler, options) {
|
|
607
|
-
var eventHandler = React.useRef(function () {
|
|
608
|
-
return;
|
|
609
|
-
});
|
|
610
|
-
React.useEffect(function () {
|
|
611
|
-
eventHandler.current = handler;
|
|
612
|
-
}, [handler]);
|
|
613
|
-
React.useEffect(function () {
|
|
614
|
-
var listener = function (event) {
|
|
615
|
-
// Do nothing if clicking ref's element or descendent elements
|
|
616
|
-
if (!ref.current || ref.current.contains(event.target)) {
|
|
617
|
-
return;
|
|
618
|
-
}
|
|
619
|
-
eventHandler.current(event);
|
|
620
|
-
};
|
|
621
|
-
document.addEventListener("mousedown", listener, options);
|
|
622
|
-
document.addEventListener("touchstart", listener, options);
|
|
623
|
-
return function () {
|
|
624
|
-
document.removeEventListener("mousedown", listener, options);
|
|
625
|
-
document.removeEventListener("touchstart", listener, options);
|
|
626
|
-
};
|
|
627
|
-
}, [ref, options]);
|
|
628
|
-
};
|
|
629
|
-
|
|
630
|
-
var events = ["mousemove", "mousedown", "keydown", "touchstart", "scroll"];
|
|
631
|
-
var useOnNoMouseMovement = function (callback, delay) {
|
|
632
|
-
var eventHandler = React.useRef(function () {
|
|
633
|
-
return;
|
|
634
|
-
});
|
|
635
|
-
React.useEffect(function () {
|
|
636
|
-
eventHandler.current = callback;
|
|
637
|
-
}, [callback]);
|
|
638
|
-
React.useEffect(function () {
|
|
639
|
-
var onIdleChange = lodash.debounce(eventHandler.current, delay);
|
|
640
|
-
events.forEach(function (event) { return window.addEventListener(event, onIdleChange); });
|
|
641
|
-
return function () {
|
|
642
|
-
events.forEach(function (event) {
|
|
643
|
-
return window.removeEventListener(event, onIdleChange);
|
|
644
|
-
});
|
|
645
|
-
};
|
|
646
|
-
}, [delay]);
|
|
647
|
-
};
|
|
648
|
-
|
|
649
|
-
var useOnScreen = function (ref, options) {
|
|
650
|
-
var _a = React.useState(false), isVisible = _a[0], setIsVisible = _a[1];
|
|
651
|
-
var _b = options || {}, rootMargin = _b.rootMargin, root = _b.root, threshold = _b.threshold;
|
|
652
|
-
var observer = React.useMemo(function () {
|
|
653
|
-
return new IntersectionObserver(function (_a) {
|
|
654
|
-
var entry = _a[0];
|
|
655
|
-
return setIsVisible(entry.isIntersecting);
|
|
656
|
-
}, {
|
|
657
|
-
rootMargin: rootMargin,
|
|
658
|
-
root: root,
|
|
659
|
-
threshold: threshold,
|
|
660
|
-
});
|
|
661
|
-
}, [setIsVisible, rootMargin, root, threshold]);
|
|
662
|
-
React.useEffect(function () {
|
|
663
|
-
if (ref.current) {
|
|
664
|
-
observer.observe(ref.current);
|
|
665
|
-
}
|
|
666
|
-
return function () {
|
|
667
|
-
observer.disconnect();
|
|
668
|
-
};
|
|
669
|
-
}, [observer, ref]);
|
|
670
|
-
return isVisible;
|
|
671
|
-
};
|
|
672
|
-
|
|
673
|
-
var useForwardedRef = function (ref) {
|
|
674
|
-
var innerRef = React.useRef(null);
|
|
675
|
-
React.useEffect(function () {
|
|
676
|
-
if (!ref)
|
|
677
|
-
return;
|
|
678
|
-
if (typeof ref === "function") {
|
|
679
|
-
ref(innerRef.current);
|
|
680
|
-
}
|
|
681
|
-
else {
|
|
682
|
-
ref.current = innerRef.current;
|
|
683
|
-
}
|
|
684
|
-
});
|
|
685
|
-
return innerRef;
|
|
686
|
-
};
|
|
687
|
-
|
|
688
|
-
var useTimeoutState = function (initialValue, defaultTimeout, clearTimeoutOnSetValue) {
|
|
689
|
-
if (clearTimeoutOnSetValue === void 0) { clearTimeoutOnSetValue = true; }
|
|
690
|
-
var _a = React.useState(initialValue), value = _a[0], setValue = _a[1];
|
|
691
|
-
var timeoutRef = React.useRef();
|
|
692
|
-
var wrappedSetter = React.useCallback(function (newValue, timeout) {
|
|
693
|
-
if (timeout === void 0) { timeout = defaultTimeout; }
|
|
694
|
-
setValue(newValue);
|
|
695
|
-
if (clearTimeoutOnSetValue) {
|
|
696
|
-
clearTimeout(timeoutRef.current);
|
|
697
|
-
}
|
|
698
|
-
timeoutRef.current = setTimeout(function () { return setValue(initialValue); }, timeout);
|
|
699
|
-
}, [defaultTimeout, clearTimeoutOnSetValue, initialValue]);
|
|
700
|
-
React.useEffect(function () {
|
|
701
|
-
return function () {
|
|
702
|
-
clearTimeout(timeoutRef.current);
|
|
703
|
-
};
|
|
704
|
-
}, []);
|
|
705
|
-
return [value, wrappedSetter];
|
|
706
|
-
};
|
|
707
|
-
|
|
708
|
-
var exhaustSwitchCaseElseThrow = function (arg) {
|
|
709
|
-
throw new Error("Switch unhandled case: ".concat(arg));
|
|
710
|
-
};
|
|
711
|
-
var exhaustSwitchCase = function (_arg, fallback) {
|
|
712
|
-
return fallback;
|
|
713
|
-
};
|
|
714
|
-
|
|
715
|
-
var truthyKeysAsList = function (r) {
|
|
716
|
-
return Object.keys(r).filter(function (key) { return r[key]; });
|
|
717
|
-
};
|
|
718
|
-
|
|
719
|
-
var getDataProps = function (props) { return lodash.pickBy(props, isDataPropMapper); };
|
|
720
|
-
var isDataPropMapper = function (_, key) { return isDataProp(key); };
|
|
721
|
-
var isDataProp = function (propName) {
|
|
722
|
-
return propName.startsWith("data-") || propName.startsWith("aria-");
|
|
723
|
-
};
|
|
724
|
-
|
|
725
|
-
var parseFloatElseUndefined = function (s) {
|
|
726
|
-
try {
|
|
727
|
-
var f = parseFloat(s);
|
|
728
|
-
if (isNaN(f)) {
|
|
729
|
-
return undefined;
|
|
730
|
-
}
|
|
731
|
-
if (f == null) {
|
|
732
|
-
return undefined;
|
|
733
|
-
}
|
|
734
|
-
return f;
|
|
735
|
-
}
|
|
736
|
-
catch (e) { }
|
|
737
|
-
return undefined;
|
|
738
|
-
};
|
|
739
|
-
var parseIntElseUndefined = function (s) {
|
|
740
|
-
try {
|
|
741
|
-
var f = parseInt(s, 10);
|
|
742
|
-
if (isNaN(f)) {
|
|
743
|
-
return undefined;
|
|
744
|
-
}
|
|
745
|
-
if (f == null) {
|
|
746
|
-
return undefined;
|
|
747
|
-
}
|
|
748
|
-
return f;
|
|
749
|
-
}
|
|
750
|
-
catch (e) { }
|
|
751
|
-
return undefined;
|
|
752
|
-
};
|
|
753
|
-
|
|
754
|
-
exports.Box = Box;
|
|
755
|
-
exports.Clickable = Clickable;
|
|
756
|
-
exports.Column = Column;
|
|
757
|
-
exports.HeaderText = HeaderText;
|
|
758
|
-
exports.Heading = Heading;
|
|
759
|
-
exports.Indent = Indent;
|
|
760
|
-
exports.LargeText = LargeText;
|
|
761
|
-
exports.Nest = Nest;
|
|
762
|
-
exports.ResizeAwareBox = ResizeAwareBox;
|
|
763
|
-
exports.Row = Row;
|
|
764
|
-
exports.SeparatorLine = SeparatorLine;
|
|
765
|
-
exports.SmallText = SmallText;
|
|
766
|
-
exports.SmallerText = SmallerText;
|
|
767
|
-
exports.Space = Space;
|
|
768
|
-
exports.Spacing = Spacing;
|
|
769
|
-
exports.StandardText = StandardText;
|
|
770
|
-
exports.Text = Text;
|
|
771
|
-
exports.Txt = Txt;
|
|
772
|
-
exports.booleanOrNumberToNumber = booleanOrNumberToNumber;
|
|
773
|
-
exports.exhaustSwitchCase = exhaustSwitchCase;
|
|
774
|
-
exports.exhaustSwitchCaseElseThrow = exhaustSwitchCaseElseThrow;
|
|
775
|
-
exports.getDataProps = getDataProps;
|
|
776
|
-
exports.getDimensionObject = getDimensionObject;
|
|
777
|
-
exports.parseFloatElseUndefined = parseFloatElseUndefined;
|
|
778
|
-
exports.parseIntElseUndefined = parseIntElseUndefined;
|
|
779
|
-
exports.truthyKeysAsList = truthyKeysAsList;
|
|
780
|
-
exports.useArraySet = useArraySet;
|
|
781
|
-
exports.useBoolean = useBoolean;
|
|
782
|
-
exports.useDebounce = useDebounce;
|
|
783
|
-
exports.useDelayedFalse = useDelayedFalse;
|
|
784
|
-
exports.useDomId = useDomId;
|
|
785
|
-
exports.useElementDimensions = useElementDimensions;
|
|
786
|
-
exports.useElementFocus = useElementFocus;
|
|
787
|
-
exports.useEventListener = useEventListener;
|
|
788
|
-
exports.useForwardedRef = useForwardedRef;
|
|
789
|
-
exports.useMouseIsEntered = useMouseIsEntered;
|
|
790
|
-
exports.useMouseIsOver = useMouseIsOver;
|
|
791
|
-
exports.useMultiOnClickOutside = useMultiOnClickOutside;
|
|
792
|
-
exports.useOnClickOutside = useOnClickOutside;
|
|
793
|
-
exports.useOnNoMouseMovement = useOnNoMouseMovement;
|
|
794
|
-
exports.useOnScreen = useOnScreen;
|
|
795
|
-
exports.useTimeoutState = useTimeoutState;
|
|
24
|
+
:focus {
|
|
25
|
+
outline: 0;
|
|
26
|
+
${({disableFocusHighlight:e})=>e?"":"box-shadow: 0 0 3pt 2pt rgba(0, 0, 100, 0.3);"}
|
|
27
|
+
${({focusBackground:e})=>`background: ${e};`}
|
|
28
|
+
}
|
|
29
|
+
${({width:e})=>e?`width: ${e};`:""}
|
|
30
|
+
${({height:e})=>e?`height: ${e};`:""}
|
|
31
|
+
${({borderRadius:e})=>e?`border-radius: ${e};`:""}
|
|
32
|
+
`,B=s.forwardRef(({disableFocusHighlight:e,onClick:t,onDblClick:r,tooltip:n,disableOpacityOnClick:o,disablePointer:u,opacityOnHover:c,disabled:d,children:a,background:f="transparent",hoverBackground:m,focusBackground:b,type:T="button",...D},M)=>{const k=!!(t||r);return l.jsx(U,{opacityOnHover:c,title:n,disabled:d,disableOpacityOnClick:o,onClick:t,onDoubleClick:r,disableFocusHighlight:e,pointer:k&&!u,ref:M,background:f,hoverBackground:m,focusBackground:b,type:T,...D,children:a})}),x=e=>e==null?0:typeof e=="boolean"?e?1:0:e,K={box:"var(--swui-shadow-box)",popover:"var(--swui-shadow-popover)",modal:"var(--swui-shadow-modal)"},W=["spacing","indent","gap","width","height","overflow","display"],G=e=>W.includes(e),J=i.system({row:{property:"flexDirection",transform:e=>e?"row":"column"},indent:{property:"--current-indent",transform:x},spacing:{property:"--current-spacing",transform:x},gap:{property:"--current-gap",transform:x},shadow:{property:"boxShadow",transform:e=>{var t;return(t=K[e])!=null?t:e}}}),w=p.default("div",{shouldForwardProp:e=>typeof e=="string"?G(e)?!1:q.default(e):!1})`
|
|
33
|
+
--current-spacing: 0;
|
|
34
|
+
--current-indent: 0;
|
|
35
|
+
--current-gap: 0;
|
|
36
|
+
box-sizing: border-box;
|
|
37
|
+
display: flex;
|
|
38
|
+
flex-direction: column;
|
|
39
|
+
${J};
|
|
40
|
+
${i.background};
|
|
41
|
+
${i.border};
|
|
42
|
+
${i.borderRight};
|
|
43
|
+
${i.borderLeft};
|
|
44
|
+
${i.borderTop};
|
|
45
|
+
${i.borderBottom};
|
|
46
|
+
${i.borderColor};
|
|
47
|
+
${i.borderRadius};
|
|
48
|
+
${i.borderStyle};
|
|
49
|
+
${i.borderWidth};
|
|
50
|
+
${i.boxShadow};
|
|
51
|
+
${i.flexbox};
|
|
52
|
+
${i.overflow};
|
|
53
|
+
${i.position};
|
|
54
|
+
${i.layout};
|
|
55
|
+
${i.zIndex};
|
|
56
|
+
${i.left};
|
|
57
|
+
${i.right};
|
|
58
|
+
${i.top};
|
|
59
|
+
${i.bottom};
|
|
60
|
+
|
|
61
|
+
gap: calc(var(--current-gap) * var(--swui-metrics-space));
|
|
62
|
+
|
|
63
|
+
padding: calc(var(--current-spacing) * var(--swui-metrics-spacing))
|
|
64
|
+
calc(var(--current-indent) * var(--swui-metrics-indent));
|
|
65
|
+
:hover {
|
|
66
|
+
${({hoverBackground:e})=>e?`background: ${e};`:""}
|
|
67
|
+
${({hoverBorder:e})=>e?`border: ${e};`:""}
|
|
68
|
+
}
|
|
69
|
+
:focus {
|
|
70
|
+
${({focusBackground:e})=>e?`background: ${e};`:""}
|
|
71
|
+
${({focusBorder:e})=>e?`border: ${e};`:""}
|
|
72
|
+
}
|
|
73
|
+
:focus-within {
|
|
74
|
+
${({focusWithinBackground:e})=>e?`background: ${e};`:""}
|
|
75
|
+
${({focusWithinBorder:e})=>e?`border: ${e};`:""}
|
|
76
|
+
}
|
|
77
|
+
`,Q=s.forwardRef(function(t,r){return l.jsx(w,{ref:r,...t})}),I=e=>{const{x:t,y:r,width:n,height:o,bottom:u,top:c,left:d,right:a}=e.getBoundingClientRect();return{width:n,height:o,top:c,left:d,x:t,y:r,right:a,bottom:u}},X=(e,t)=>e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height&&e.bottom===t.bottom&&e.top===t.top&&e.left===t.left&&e.right===t.right,R=(e,t)=>{const[r,n]=s.useState(),o=s.useCallback(()=>{window.requestAnimationFrame(()=>{if(e.current){const u=I(e.current);(!r||!X(r,u))&&t&&t(u),n(u)}})},[e,r,n,t]);return s.useLayoutEffect(()=>{o()},[o]),{dimensions:r}},Y=s.forwardRef(function({onResize:t,...r},n){const o=s.useRef(null),u=n!=null?n:o;return R(u,t),l.jsx(w,{...r,ref:n})}),Z=s.forwardRef(function(t,r){return l.jsx(w,{row:!0,ref:r,...t})}),ee=s.forwardRef(function({num:t=1,...r},n){return l.jsx(w,{indent:t,ref:n,...r})}),te=s.forwardRef(function({num:t=1,...r},n){return l.jsx(w,{spacing:t,ref:n,...r})}),re=p.default.div`
|
|
78
|
+
--current-size: 1;
|
|
79
|
+
flex: none;
|
|
80
|
+
width: calc(var(--current-size) * var(--swui-metrics-space));
|
|
81
|
+
height: calc(var(--current-size) * var(--swui-metrics-space));
|
|
82
|
+
`,ne=({half:e=!1,horizontal:t=!1,num:r=1,vertical:n=!1})=>{const o=r*(e?.5:1);return l.jsx(re,{style:{["--current-size"]:o,height:t?1:void 0,width:n?1:void 0}})},se=({children:e,nest:t,render:r})=>t?l.jsx(l.Fragment,{children:r(e)}):l.jsx(l.Fragment,{children:e}),oe="_text_1iisw_1",ue="_standard_1iisw_24",ce="_bold_1iisw_27",ae="_caption_1iisw_31",ie="_overline_1iisw_39",de="_large_1iisw_48",le="_medium_1iisw_53",fe="_small_1iisw_58",me="_smaller_1iisw_63";var _={text:oe,standard:ue,bold:ce,caption:ae,overline:ie,large:de,medium:le,small:fe,smaller:me};const v=s.forwardRef(({children:e,variant:t="standard",size:r="medium",className:n,color:o,userSelect:u,whiteSpace:c,wordBreak:d,style:a,...f},m)=>l.jsx("span",{className:O.default(_.text,_[t],_[r],n),ref:m,style:{color:o,userSelect:u,whiteSpace:c,wordBreak:d,...a},...f,children:e})),he=v,we=e=>l.jsx(v,{size:"small",...e}),ve=e=>l.jsx(v,{size:"smaller",...e}),be=e=>l.jsx(v,{size:"medium",...e}),xe=e=>l.jsx(v,{size:"large",...e}),pe="_heading_1u7xw_1",ge="_h1_1u7xw_10",_e="_h2_1u7xw_15",$e="_h3_1u7xw_20",Ee="_h4_1u7xw_25",ye="_h5_1u7xw_31",Se="_h6_1u7xw_37";var E={heading:pe,h1:ge,h2:_e,h3:$e,h4:Ee,h5:ye,h6:Se};const j=s.forwardRef(({variant:e="h3",className:t,color:r,whiteSpace:n,wordBreak:o,style:u,children:c,as:d,...a},f)=>{const m=d!=null?d:e;return l.jsx(m,{className:O.default(E.heading,E[e],t),style:{color:r,whiteSpace:n,wordBreak:o,...u},ref:f,...a,children:c})}),Ce=e=>l.jsx(j,{variant:"h2",...e}),Oe=(e,t)=>e===t,Ie=(e,t,r=Oe)=>{const n=s.useCallback(a=>{e.some(f=>r(f,a))||t([...e,a])},[e,t,r]),o=s.useCallback(a=>{t(a.reduce((f,m)=>f.some(b=>r(b,m))?f:[...f,m],e))},[e,t,r]),u=s.useCallback(a=>{const f=e.findIndex(m=>r(m,a));f>=0&&t(e.filter((m,b)=>b!==f))},[e,t,r]),c=s.useCallback(a=>{t(e.filter(f=>!a.some(m=>r(m,f))))},[e,t,r]),d=s.useCallback(a=>{e.some(m=>r(m,a))?u(a):n(a)},[e,n,u,r]);return{add:n,addMultiple:o,remove:u,removeMultiple:c,toggle:d}},g=e=>{const[t,r]=s.useState(e),n=s.useCallback(()=>{r(!0)},[r]),o=s.useCallback(()=>{r(!1)},[r]),u=s.useCallback(()=>{r(c=>!c)},[r]);return[t,n,o,u]},Re=(e,t)=>{const[r,n]=s.useState(e);return s.useEffect(()=>{const o=setTimeout(()=>{n(e)},t);return()=>{clearTimeout(o)}},[e,t]),r},je=(e,t)=>{const[r,n]=s.useState(e);return s.useEffect(()=>{e&&n(!0);const o=setTimeout(()=>{e||n(e)},t);return()=>{clearTimeout(o)}},[e,t]),r};let Te=0;const y=e=>`webui-${e?e+"-":""}${++Te}`,De=e=>{const[t,r]=s.useState(()=>y(e));return s.useEffect(()=>r(y(e)),[e]),t},h=(e,t,r)=>{const n=s.useRef();s.useEffect(()=>{n.current=r},[r]),s.useEffect(()=>{if(!(e.current&&e.current.addEventListener))return;const u=d=>{if(n.current)return n.current(d)};if(!e.current)return;const c=e.current;return c.addEventListener(t,u),()=>{c&&c.removeEventListener(t,u)}},[t,e])},Me=e=>{const[t,r,n]=g(!1);s.useEffect(()=>{document.activeElement===H.findDOMNode(e.current)?r():n()},[e,n,r]),h(e,"focus",r),h(e,"blur",n);const o=s.useCallback(()=>{e.current&&e.current.focus()},[e]),u=s.useCallback(()=>{e.current&&e.current.blur()},[e]);return{isInFocus:t,focus:o,blur:u}},ke=e=>{const[t,r,n]=g(!1);return h(e,"mouseover",r),h(e,"mouseout",n),t},Le=e=>{const[t,r,n]=g(!1);return h(e,"mouseenter",r),h(e,"mouseleave",n),t},Fe=(e,t)=>{const r=s.useRef(()=>{});s.useEffect(()=>{r.current=t},[t]),s.useEffect(()=>{const n=o=>{!e.filter(c=>c.current).every(c=>c.current&&!c.current.contains(o.target))||r.current(o)};return document.addEventListener("mousedown",n),document.addEventListener("touchstart",n),()=>{document.removeEventListener("mousedown",n),document.removeEventListener("touchstart",n)}},[...e])},ze=(e,t,r)=>{const n=s.useRef(()=>{});s.useEffect(()=>{n.current=t},[t]),s.useEffect(()=>{const o=u=>{!e.current||e.current.contains(u.target)||n.current(u)};return document.addEventListener("mousedown",o,r),document.addEventListener("touchstart",o,r),()=>{document.removeEventListener("mousedown",o,r),document.removeEventListener("touchstart",o,r)}},[e,r])},S=["mousemove","mousedown","keydown","touchstart","scroll"],Ne=(e,t)=>{const r=s.useRef(()=>{});s.useEffect(()=>{r.current=e},[e]),s.useEffect(()=>{const n=C.debounce(r.current,t);return S.forEach(o=>window.addEventListener(o,n)),()=>{S.forEach(o=>window.removeEventListener(o,n))}},[t])},Pe=(e,t)=>{const[r,n]=s.useState(!1),{rootMargin:o,root:u,threshold:c}=t||{},d=s.useMemo(()=>new IntersectionObserver(([a])=>n(a.isIntersecting),{rootMargin:o,root:u,threshold:c}),[n,o,u,c]);return s.useEffect(()=>(e.current&&d.observe(e.current),()=>{d.disconnect()}),[d,e]),r},qe=e=>{const t=s.useRef(null);return s.useEffect(()=>{!e||(typeof e=="function"?e(t.current):e.current=t.current)}),t},He=(e,t,r=!0)=>{const[n,o]=s.useState(e),u=s.useRef(),c=s.useCallback((d,a=t)=>{o(d),r&&clearTimeout(u.current),u.current=setTimeout(()=>o(e),a)},[t,r,e]);return s.useEffect(()=>()=>{clearTimeout(u.current)},[]),[n,c]},Ae=e=>{throw new Error(`Switch unhandled case: ${e}`)},Ve=(e,t)=>t,Ue=e=>Object.keys(e).filter(t=>e[t]),Be=e=>C.pickBy(e,Ke),Ke=(e,t)=>We(t),We=e=>e.startsWith("data-")||e.startsWith("aria-"),Ge=e=>{try{const t=parseFloat(e);return isNaN(t)||t==null?void 0:t}catch{}},Je=e=>{try{const t=parseInt(e,10);return isNaN(t)||t==null?void 0:t}catch{}};exports.Box=w;exports.Clickable=B;exports.Column=Q;exports.HeaderText=Ce;exports.Heading=j;exports.Indent=ee;exports.LargeText=xe;exports.Nest=se;exports.ResizeAwareBox=Y;exports.Row=Z;exports.SeparatorLine=V;exports.SmallText=we;exports.SmallerText=ve;exports.Space=ne;exports.Spacing=te;exports.StandardText=be;exports.Text=v;exports.Txt=he;exports.booleanOrNumberToNumber=x;exports.exhaustSwitchCase=Ve;exports.exhaustSwitchCaseElseThrow=Ae;exports.getDataProps=Be;exports.getDimensionObject=I;exports.parseFloatElseUndefined=Ge;exports.parseIntElseUndefined=Je;exports.truthyKeysAsList=Ue;exports.useArraySet=Ie;exports.useBoolean=g;exports.useDebounce=Re;exports.useDelayedFalse=je;exports.useDomId=De;exports.useElementDimensions=R;exports.useElementFocus=Me;exports.useEventListener=h;exports.useForwardedRef=qe;exports.useMouseIsEntered=Le;exports.useMouseIsOver=ke;exports.useMultiOnClickOutside=Fe;exports.useOnClickOutside=ze;exports.useOnNoMouseMovement=Ne;exports.useOnScreen=Pe;exports.useTimeoutState=He;
|
|
796
83
|
//# sourceMappingURL=index.js.map
|