@umami/react-zen 0.11.0 → 0.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.css +11 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.js +38 -15
- package/dist/index.mjs +38 -15
- package/package.json +1 -1
package/dist/index.css
CHANGED
|
@@ -620,6 +620,15 @@
|
|
|
620
620
|
.Text_wider {
|
|
621
621
|
letter-spacing: 0.05em;
|
|
622
622
|
}
|
|
623
|
+
.Text_left {
|
|
624
|
+
text-align: left;
|
|
625
|
+
}
|
|
626
|
+
.Text_center {
|
|
627
|
+
text-align: center;
|
|
628
|
+
}
|
|
629
|
+
.Text_right {
|
|
630
|
+
text-align: right;
|
|
631
|
+
}
|
|
623
632
|
|
|
624
633
|
/* src/components/form/FormField.module.css */
|
|
625
634
|
.FormField_field {
|
|
@@ -1360,6 +1369,8 @@
|
|
|
1360
1369
|
|
|
1361
1370
|
/* src/components/HoverTrigger.module.css */
|
|
1362
1371
|
.HoverTrigger_wrapper {
|
|
1372
|
+
transform: translateY(-10px);
|
|
1373
|
+
border-top: 10px solid transparent;
|
|
1363
1374
|
}
|
|
1364
1375
|
|
|
1365
1376
|
/* src/components/InlineEditField.module.css */
|
package/dist/index.d.ts
CHANGED
|
@@ -704,11 +704,12 @@ declare module '@umami/react-zen/Text' {
|
|
|
704
704
|
spacing?: 'tighter' | 'tight' | 'wide' | 'wider';
|
|
705
705
|
type?: 'muted' | 'faded';
|
|
706
706
|
weight?: 'lighter' | 'light' | 'bold' | 'bolder';
|
|
707
|
+
align?: 'left' | 'center' | 'right';
|
|
707
708
|
asChild?: boolean;
|
|
708
709
|
className?: string;
|
|
709
710
|
children?: ReactNode;
|
|
710
711
|
}
|
|
711
|
-
function Text({ children, type, size, spacing, weight, asChild, className, ...props }: TextProps): import("react").JSX.Element;
|
|
712
|
+
function Text({ children, type, size, spacing, weight, align, asChild, className, ...props }: TextProps): import("react").JSX.Element;
|
|
712
713
|
export { Text };
|
|
713
714
|
export type { TextProps };
|
|
714
715
|
}
|
package/dist/index.js
CHANGED
|
@@ -25152,12 +25152,25 @@ var Text_default = {
|
|
|
25152
25152
|
tighter: "Text_tighter",
|
|
25153
25153
|
tight: "Text_tight",
|
|
25154
25154
|
wide: "Text_wide",
|
|
25155
|
-
wider: "Text_wider"
|
|
25155
|
+
wider: "Text_wider",
|
|
25156
|
+
left: "Text_left",
|
|
25157
|
+
center: "Text_center",
|
|
25158
|
+
right: "Text_right"
|
|
25156
25159
|
};
|
|
25157
25160
|
|
|
25158
25161
|
// src/components/Text.tsx
|
|
25159
25162
|
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
25160
|
-
function Text({
|
|
25163
|
+
function Text({
|
|
25164
|
+
children,
|
|
25165
|
+
type,
|
|
25166
|
+
size,
|
|
25167
|
+
spacing,
|
|
25168
|
+
weight,
|
|
25169
|
+
align,
|
|
25170
|
+
asChild,
|
|
25171
|
+
className,
|
|
25172
|
+
...props
|
|
25173
|
+
}) {
|
|
25161
25174
|
const Component = asChild ? $5e63c961fc1ce211$export$8c6ed5c666ac1360 : "span";
|
|
25162
25175
|
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
25163
25176
|
Component,
|
|
@@ -25169,7 +25182,8 @@ function Text({ children, type, size, spacing, weight, asChild, className, ...pr
|
|
|
25169
25182
|
size && Text_default[size],
|
|
25170
25183
|
spacing && Text_default[spacing],
|
|
25171
25184
|
type && Text_default[type],
|
|
25172
|
-
weight && Text_default[weight]
|
|
25185
|
+
weight && Text_default[weight],
|
|
25186
|
+
align && Text_default[align]
|
|
25173
25187
|
),
|
|
25174
25188
|
children
|
|
25175
25189
|
}
|
|
@@ -26940,7 +26954,7 @@ var Heading_default = {
|
|
|
26940
26954
|
// src/components/Heading.tsx
|
|
26941
26955
|
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
26942
26956
|
function Heading({ size = 5, className, children, asChild, ...props }) {
|
|
26943
|
-
const Component = asChild ? $5e63c961fc1ce211$export$8c6ed5c666ac1360 : "
|
|
26957
|
+
const Component = asChild ? $5e63c961fc1ce211$export$8c6ed5c666ac1360 : "div";
|
|
26944
26958
|
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
26945
26959
|
Component,
|
|
26946
26960
|
{
|
|
@@ -26965,25 +26979,34 @@ var CLOSE_DELAY = 500;
|
|
|
26965
26979
|
function HoverTrigger({ closeDelay = CLOSE_DELAY, children }) {
|
|
26966
26980
|
const [triggerElement, popupElement] = children;
|
|
26967
26981
|
const [show, setShow] = (0, import_react164.useState)(false);
|
|
26968
|
-
const
|
|
26982
|
+
const isOverMenu = (0, import_react164.useRef)(false);
|
|
26983
|
+
const isOverButton = (0, import_react164.useRef)(false);
|
|
26984
|
+
const timeout = (0, import_react164.useRef)();
|
|
26969
26985
|
const handleHoverStart = () => {
|
|
26970
|
-
|
|
26986
|
+
isOverMenu.current = false;
|
|
26987
|
+
isOverButton.current = true;
|
|
26971
26988
|
setShow(true);
|
|
26972
26989
|
};
|
|
26973
26990
|
const handleHoverEnd = () => {
|
|
26974
|
-
|
|
26975
|
-
|
|
26976
|
-
setShow(false);
|
|
26977
|
-
overMenu.current = false;
|
|
26978
|
-
}
|
|
26979
|
-
}, closeDelay);
|
|
26991
|
+
isOverButton.current = false;
|
|
26992
|
+
checkHoverState();
|
|
26980
26993
|
};
|
|
26981
26994
|
const handleMenuEnter = () => {
|
|
26982
|
-
|
|
26995
|
+
isOverMenu.current = true;
|
|
26983
26996
|
};
|
|
26984
26997
|
const handleMenuLeave = () => {
|
|
26985
|
-
|
|
26986
|
-
|
|
26998
|
+
isOverMenu.current = false;
|
|
26999
|
+
checkHoverState();
|
|
27000
|
+
};
|
|
27001
|
+
const checkHoverState = () => {
|
|
27002
|
+
clearTimeout(timeout.current);
|
|
27003
|
+
timeout.current = setTimeout(() => {
|
|
27004
|
+
if (!isOverMenu.current && !isOverButton.current) {
|
|
27005
|
+
setShow(false);
|
|
27006
|
+
isOverMenu.current = false;
|
|
27007
|
+
isOverButton.current = false;
|
|
27008
|
+
}
|
|
27009
|
+
}, closeDelay);
|
|
26987
27010
|
};
|
|
26988
27011
|
return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)($de32f1b87079253c$export$2e1e1122cf0cba88, { children: [
|
|
26989
27012
|
(0, import_react164.cloneElement)(triggerElement, { onHoverStart: handleHoverStart, onHoverEnd: handleHoverEnd }),
|
package/dist/index.mjs
CHANGED
|
@@ -25162,12 +25162,25 @@ var Text_default = {
|
|
|
25162
25162
|
tighter: "Text_tighter",
|
|
25163
25163
|
tight: "Text_tight",
|
|
25164
25164
|
wide: "Text_wide",
|
|
25165
|
-
wider: "Text_wider"
|
|
25165
|
+
wider: "Text_wider",
|
|
25166
|
+
left: "Text_left",
|
|
25167
|
+
center: "Text_center",
|
|
25168
|
+
right: "Text_right"
|
|
25166
25169
|
};
|
|
25167
25170
|
|
|
25168
25171
|
// src/components/Text.tsx
|
|
25169
25172
|
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
25170
|
-
function Text({
|
|
25173
|
+
function Text({
|
|
25174
|
+
children,
|
|
25175
|
+
type,
|
|
25176
|
+
size,
|
|
25177
|
+
spacing,
|
|
25178
|
+
weight,
|
|
25179
|
+
align,
|
|
25180
|
+
asChild,
|
|
25181
|
+
className,
|
|
25182
|
+
...props
|
|
25183
|
+
}) {
|
|
25171
25184
|
const Component = asChild ? $5e63c961fc1ce211$export$8c6ed5c666ac1360 : "span";
|
|
25172
25185
|
return /* @__PURE__ */ jsx6(
|
|
25173
25186
|
Component,
|
|
@@ -25179,7 +25192,8 @@ function Text({ children, type, size, spacing, weight, asChild, className, ...pr
|
|
|
25179
25192
|
size && Text_default[size],
|
|
25180
25193
|
spacing && Text_default[spacing],
|
|
25181
25194
|
type && Text_default[type],
|
|
25182
|
-
weight && Text_default[weight]
|
|
25195
|
+
weight && Text_default[weight],
|
|
25196
|
+
align && Text_default[align]
|
|
25183
25197
|
),
|
|
25184
25198
|
children
|
|
25185
25199
|
}
|
|
@@ -26953,7 +26967,7 @@ var Heading_default = {
|
|
|
26953
26967
|
// src/components/Heading.tsx
|
|
26954
26968
|
import { jsx as jsx32 } from "react/jsx-runtime";
|
|
26955
26969
|
function Heading({ size = 5, className, children, asChild, ...props }) {
|
|
26956
|
-
const Component = asChild ? $5e63c961fc1ce211$export$8c6ed5c666ac1360 : "
|
|
26970
|
+
const Component = asChild ? $5e63c961fc1ce211$export$8c6ed5c666ac1360 : "div";
|
|
26957
26971
|
return /* @__PURE__ */ jsx32(
|
|
26958
26972
|
Component,
|
|
26959
26973
|
{
|
|
@@ -26978,25 +26992,34 @@ var CLOSE_DELAY = 500;
|
|
|
26978
26992
|
function HoverTrigger({ closeDelay = CLOSE_DELAY, children }) {
|
|
26979
26993
|
const [triggerElement, popupElement] = children;
|
|
26980
26994
|
const [show, setShow] = useState6(false);
|
|
26981
|
-
const
|
|
26995
|
+
const isOverMenu = useRef2(false);
|
|
26996
|
+
const isOverButton = useRef2(false);
|
|
26997
|
+
const timeout = useRef2();
|
|
26982
26998
|
const handleHoverStart = () => {
|
|
26983
|
-
|
|
26999
|
+
isOverMenu.current = false;
|
|
27000
|
+
isOverButton.current = true;
|
|
26984
27001
|
setShow(true);
|
|
26985
27002
|
};
|
|
26986
27003
|
const handleHoverEnd = () => {
|
|
26987
|
-
|
|
26988
|
-
|
|
26989
|
-
setShow(false);
|
|
26990
|
-
overMenu.current = false;
|
|
26991
|
-
}
|
|
26992
|
-
}, closeDelay);
|
|
27004
|
+
isOverButton.current = false;
|
|
27005
|
+
checkHoverState();
|
|
26993
27006
|
};
|
|
26994
27007
|
const handleMenuEnter = () => {
|
|
26995
|
-
|
|
27008
|
+
isOverMenu.current = true;
|
|
26996
27009
|
};
|
|
26997
27010
|
const handleMenuLeave = () => {
|
|
26998
|
-
|
|
26999
|
-
|
|
27011
|
+
isOverMenu.current = false;
|
|
27012
|
+
checkHoverState();
|
|
27013
|
+
};
|
|
27014
|
+
const checkHoverState = () => {
|
|
27015
|
+
clearTimeout(timeout.current);
|
|
27016
|
+
timeout.current = setTimeout(() => {
|
|
27017
|
+
if (!isOverMenu.current && !isOverButton.current) {
|
|
27018
|
+
setShow(false);
|
|
27019
|
+
isOverMenu.current = false;
|
|
27020
|
+
isOverButton.current = false;
|
|
27021
|
+
}
|
|
27022
|
+
}, closeDelay);
|
|
27000
27023
|
};
|
|
27001
27024
|
return /* @__PURE__ */ jsxs18($de32f1b87079253c$export$2e1e1122cf0cba88, { children: [
|
|
27002
27025
|
cloneElement3(triggerElement, { onHoverStart: handleHoverStart, onHoverEnd: handleHoverEnd }),
|