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