@adamjanicki/ui 1.8.3 → 1.8.5
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/components/Accordion/Accordion.js +1 -56
- package/components/Accordion/index.d.ts +1 -2
- package/components/Accordion/index.js +1 -2
- package/components/Alert/Alert.js +1 -31
- package/components/Alert/index.d.ts +1 -2
- package/components/Alert/index.js +1 -2
- package/components/Animated/Animated.js +1 -94
- package/components/Animated/index.d.ts +1 -2
- package/components/Animated/index.js +1 -2
- package/components/Avatar/Avatar.js +1 -57
- package/components/Avatar/index.d.ts +1 -2
- package/components/Avatar/index.js +1 -2
- package/components/Badge/Badge.js +1 -31
- package/components/Badge/index.d.ts +1 -2
- package/components/Badge/index.js +1 -2
- package/components/Banner/Banner.js +1 -31
- package/components/Banner/index.d.ts +1 -2
- package/components/Banner/index.js +1 -2
- package/components/Box/Box.js +1 -3
- package/components/Box/index.d.ts +1 -2
- package/components/Box/index.js +1 -2
- package/components/Button/Button.d.ts +0 -21
- package/components/Button/Button.js +1 -52
- package/components/Button/IconButton.d.ts +25 -0
- package/components/Button/IconButton.js +1 -0
- package/components/Button/index.d.ts +3 -3
- package/components/Button/index.js +1 -3
- package/components/Carousel/Carousel.js +1 -106
- package/components/Carousel/index.d.ts +1 -2
- package/components/Carousel/index.js +1 -2
- package/components/ClickOutside/ClickOutside.js +1 -55
- package/components/ClickOutside/index.d.ts +1 -2
- package/components/ClickOutside/index.js +1 -2
- package/components/ErrorBoundary/ErrorBoundary.js +1 -61
- package/components/ErrorBoundary/index.d.ts +1 -2
- package/components/ErrorBoundary/index.js +1 -2
- package/components/Hamburger/DoubleCross.js +1 -39
- package/components/Hamburger/DoubleFlip.js +1 -39
- package/components/Hamburger/DoubleSpin.js +1 -40
- package/components/Hamburger/Hamburger.js +1 -66
- package/components/Hamburger/TripleFade.js +1 -40
- package/components/Hamburger/TripleFlip.js +1 -40
- package/components/Hamburger/TriplePrestige.js +1 -40
- package/components/Hamburger/TripleSpin.js +1 -41
- package/components/Hamburger/index.d.ts +2 -3
- package/components/Hamburger/index.js +1 -9
- package/components/Icon/Icon.js +1 -32
- package/components/Icon/icons.js +1 -179
- package/components/Icon/index.d.ts +1 -2
- package/components/Icon/index.js +1 -2
- package/components/Input/IconInput.js +1 -33
- package/components/Input/Input.js +1 -31
- package/components/Input/TextArea.js +1 -31
- package/components/Input/index.d.ts +3 -5
- package/components/Input/index.js +1 -5
- package/components/Layer/Layer.js +1 -63
- package/components/Layer/index.d.ts +1 -2
- package/components/Layer/index.js +1 -2
- package/components/Modal/Modal.js +1 -48
- package/components/Modal/index.d.ts +1 -2
- package/components/Modal/index.js +1 -2
- package/components/Select/Select.js +1 -34
- package/components/Select/index.d.ts +1 -2
- package/components/Select/index.js +1 -2
- package/components/Spinner/Spinner.js +1 -31
- package/components/Spinner/index.d.ts +1 -2
- package/components/Spinner/index.js +1 -2
- package/components/ui.js +1 -44
- package/functions/assertDefined.js +1 -13
- package/functions/classNames.js +1 -16
- package/functions/getDeviceType.js +1 -17
- package/functions/index.d.ts +4 -5
- package/functions/index.js +1 -5
- package/functions/scrollToId.js +1 -17
- package/hooks/index.js +1 -7
- package/hooks/useFocusTrap.js +1 -48
- package/hooks/useMediaQuery.js +1 -28
- package/hooks/useMergeRefs.js +1 -24
- package/hooks/useScroll.js +1 -23
- package/hooks/useScrollLock.js +1 -45
- package/hooks/useScrollToHash.js +1 -21
- package/hooks/useWindowResize.js +1 -13
- package/index.d.ts +1 -3
- package/index.js +1 -31
- package/{components/Link → navigation}/Link.d.ts +4 -4
- package/navigation/Link.js +1 -0
- package/navigation/PathParamsContext.js +1 -0
- package/navigation/Route.js +1 -0
- package/navigation/Router.js +1 -0
- package/navigation/RouterContext.js +1 -0
- package/{router → navigation}/Routes.d.ts +1 -1
- package/navigation/Routes.js +1 -0
- package/navigation/history.js +1 -0
- package/navigation/hooks/useLocation.js +1 -0
- package/navigation/hooks/useNavigate.js +1 -0
- package/navigation/hooks/usePathParams.js +1 -0
- package/navigation/hooks/useRouterContext.js +1 -0
- package/navigation/hooks/useSearchParams.js +1 -0
- package/navigation/href.js +1 -0
- package/{router → navigation}/index.d.ts +1 -0
- package/navigation/index.js +1 -0
- package/navigation/path.js +1 -0
- package/navigation/slash.js +1 -0
- package/package.json +7 -6
- package/utils/transformVfx.js +1 -212
- package/components/Link/Link.js +0 -75
- package/components/Link/index.d.ts +0 -3
- package/components/Link/index.js +0 -3
- package/router/PathParamsContext.js +0 -3
- package/router/Route.js +0 -6
- package/router/Router.js +0 -36
- package/router/RouterContext.js +0 -3
- package/router/Routes.js +0 -31
- package/router/history.js +0 -46
- package/router/hooks/useLocation.js +0 -10
- package/router/hooks/useNavigate.js +0 -10
- package/router/hooks/usePathParams.js +0 -15
- package/router/hooks/useRouterContext.js +0 -9
- package/router/hooks/useSearchParams.js +0 -47
- package/router/href.js +0 -43
- package/router/index.js +0 -7
- package/router/path.js +0 -38
- package/router/string.js +0 -6
- package/router/types.d.ts +0 -33
- package/router/types.js +0 -1
- package/utils/types.d.ts +0 -108
- package/utils/types.js +0 -1
- /package/{router → navigation}/PathParamsContext.d.ts +0 -0
- /package/{router → navigation}/Route.d.ts +0 -0
- /package/{router → navigation}/Router.d.ts +0 -0
- /package/{router → navigation}/RouterContext.d.ts +0 -0
- /package/{router → navigation}/history.d.ts +0 -0
- /package/{router → navigation}/hooks/useLocation.d.ts +0 -0
- /package/{router → navigation}/hooks/useNavigate.d.ts +0 -0
- /package/{router → navigation}/hooks/usePathParams.d.ts +0 -0
- /package/{router → navigation}/hooks/useRouterContext.d.ts +0 -0
- /package/{router → navigation}/hooks/useSearchParams.d.ts +0 -0
- /package/{router → navigation}/href.d.ts +0 -0
- /package/{router → navigation}/path.d.ts +0 -0
- /package/{router/string.d.ts → navigation/slash.d.ts} +0 -0
|
@@ -1,56 +1 @@
|
|
|
1
|
-
var
|
|
2
|
-
__assign = Object.assign || function(t) {
|
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
-
s = arguments[i];
|
|
5
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
-
t[p] = s[p];
|
|
7
|
-
}
|
|
8
|
-
return t;
|
|
9
|
-
};
|
|
10
|
-
return __assign.apply(this, arguments);
|
|
11
|
-
};
|
|
12
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
13
|
-
var t = {};
|
|
14
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
15
|
-
t[p] = s[p];
|
|
16
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
17
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
18
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
19
|
-
t[p[i]] = s[p[i]];
|
|
20
|
-
}
|
|
21
|
-
return t;
|
|
22
|
-
};
|
|
23
|
-
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
24
|
-
import React, { useRef, useState, useEffect } from "react";
|
|
25
|
-
import Box from "../Box/Box";
|
|
26
|
-
import Icon from "../Icon";
|
|
27
|
-
import { UnstyledButton } from "../Button";
|
|
28
|
-
import Animated from "../Animated";
|
|
29
|
-
var Accordion = React.forwardRef(function (_a, ref) {
|
|
30
|
-
var drawers = _a.drawers, duration = _a.duration, hideDividers = _a.hideDividers, vfx = _a.vfx, rest = __rest(_a, ["drawers", "duration", "hideDividers", "vfx"]);
|
|
31
|
-
return (_jsx(Box, __assign({ vfx: __assign({ axis: "y", radius: "rounded", color: "default", backgroundColor: "default", shadow: "subtle", border: true }, vfx) }, rest, { ref: ref, children: drawers.map(function (item, i) { return (_jsx(Drawer, { item: item, duration: duration, showDivider: !hideDividers && i < drawers.length - 1 }, i)); }) })));
|
|
32
|
-
});
|
|
33
|
-
var Drawer = function (_a) {
|
|
34
|
-
var item = _a.item, duration = _a.duration, showDivider = _a.showDivider;
|
|
35
|
-
var boxRef = useRef(null);
|
|
36
|
-
var _b = useState(), height = _b[0], setHeight = _b[1];
|
|
37
|
-
var children = item.content, open = item.open, onOpenChange = item.onOpenChange;
|
|
38
|
-
useEffect(function () {
|
|
39
|
-
if (open && children && boxRef.current) {
|
|
40
|
-
setHeight(boxRef.current.offsetHeight);
|
|
41
|
-
}
|
|
42
|
-
}, [open, children]);
|
|
43
|
-
// TODO: change this to use calc-size when supported
|
|
44
|
-
// https://developer.mozilla.org/en-US/docs/Web/CSS/calc-size#browser_compatibility
|
|
45
|
-
return (_jsx(_Fragment, { children: _jsxs(Box, { vfx: { axis: "y", borderBottom: showDivider }, children: [_jsx(UnstyledButton, { onClick: function () { return onOpenChange(!open); }, children: _jsxs(Box, { vfx: { axis: "x", align: "center", gap: "s", padding: "m" }, children: [_jsx(Icon, { vfx: { color: "muted" }, size: "xs", icon: open ? "chevron-down" : "chevron-right" }), _jsx(Box, { vfx: { fontWeight: 6 }, children: item.label })] }) }), _jsx(Animated, { vfx: { overflow: "hidden" }, keepMounted: true, duration: duration, visible: open, animateFrom: {
|
|
46
|
-
style: {
|
|
47
|
-
visibility: "hidden",
|
|
48
|
-
height: 0,
|
|
49
|
-
transform: "translateY(-4px)",
|
|
50
|
-
opacity: 0.9,
|
|
51
|
-
},
|
|
52
|
-
}, animateTo: {
|
|
53
|
-
style: { height: height, transform: "translateY(0)", opacity: 1 },
|
|
54
|
-
}, children: _jsx(Box, { ref: boxRef, children: children }) })] }) }));
|
|
55
|
-
};
|
|
56
|
-
export default Accordion;
|
|
1
|
+
import{jsx as i,jsxs as h,Fragment as p}from"react/jsx-runtime";import g,{useRef as x,useState as y,useEffect as b}from"react";import d from"../Box/Box";import w from"../Icon";import{UnstyledButton as O}from"../Button";import j from"../Animated";var u=function(){return u=Object.assign||function(r){for(var n,o=1,e=arguments.length;o<e;o++){n=arguments[o];for(var t in n)Object.prototype.hasOwnProperty.call(n,t)&&(r[t]=n[t])}return r},u.apply(this,arguments)},m=function(r,n){var o={};for(var e in r)Object.prototype.hasOwnProperty.call(r,e)&&n.indexOf(e)<0&&(o[e]=r[e]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var t=0,e=Object.getOwnPropertySymbols(r);t<e.length;t++)n.indexOf(e[t])<0&&Object.prototype.propertyIsEnumerable.call(r,e[t])&&(o[e[t]]=r[e[t]]);return o},D=g.forwardRef(function(r,n){var o=r.drawers,e=r.duration,t=r.hideDividers,f=r.vfx,c=m(r,["drawers","duration","hideDividers","vfx"]);return i(d,u({vfx:u({axis:"y",radius:"rounded",color:"default",backgroundColor:"default",shadow:"subtle",border:!0},f)},c,{ref:n,children:o.map(function(l,a){return i(_,{item:l,duration:e,showDivider:!t&&a<o.length-1},a)})}))}),_=function(r){var n=r.item,o=r.duration,e=r.showDivider,t=x(null),f=y(),c=f[0],l=f[1],a=n.content,s=n.open,v=n.onOpenChange;return b(function(){s&&a&&t.current&&l(t.current.offsetHeight)},[s,a]),i(p,{children:h(d,{vfx:{axis:"y",borderBottom:e},children:[i(O,{onClick:function(){return v(!s)},children:h(d,{vfx:{axis:"x",align:"center",gap:"s",padding:"m"},children:[i(w,{vfx:{color:"muted"},size:"xs",icon:s?"chevron-down":"chevron-right"}),i(d,{vfx:{fontWeight:6},children:n.label})]})}),i(j,{vfx:{overflow:"hidden"},keepMounted:!0,duration:o,visible:s,animateFrom:{style:{visibility:"hidden",height:0,transform:"translateY(-4px)",opacity:.9}},animateTo:{style:{height:c,transform:"translateY(0)",opacity:1}},children:i(d,{ref:t,children:a})})]})})},S=D;export{S as default};
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export default Accordion;
|
|
1
|
+
export { default } from "./Accordion";
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
export default Accordion;
|
|
1
|
+
import{default as o}from"./Accordion";export{o as default};
|
|
@@ -1,31 +1 @@
|
|
|
1
|
-
var
|
|
2
|
-
__assign = Object.assign || function(t) {
|
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
-
s = arguments[i];
|
|
5
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
-
t[p] = s[p];
|
|
7
|
-
}
|
|
8
|
-
return t;
|
|
9
|
-
};
|
|
10
|
-
return __assign.apply(this, arguments);
|
|
11
|
-
};
|
|
12
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
13
|
-
var t = {};
|
|
14
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
15
|
-
t[p] = s[p];
|
|
16
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
17
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
18
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
19
|
-
t[p[i]] = s[p[i]];
|
|
20
|
-
}
|
|
21
|
-
return t;
|
|
22
|
-
};
|
|
23
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
24
|
-
import React from "react";
|
|
25
|
-
import classNames from "../../functions/classNames";
|
|
26
|
-
import Box from "../Box/Box";
|
|
27
|
-
var Alert = React.forwardRef(function (_a, ref) {
|
|
28
|
-
var type = _a.type, vfx = _a.vfx, className = _a.className, rest = __rest(_a, ["type", "vfx", "className"]);
|
|
29
|
-
return (_jsx(Box, __assign({}, rest, { vfx: __assign({ radius: "rounded", fontWeight: 4, padding: "m" }, vfx), className: classNames("aui-alert aui-content-".concat(type), className), ref: ref })));
|
|
30
|
-
});
|
|
31
|
-
export default Alert;
|
|
1
|
+
import{jsx as c}from"react/jsx-runtime";import i from"react";import l from"../../functions/classNames";import m from"../Box/Box";var o=function(){return o=Object.assign||function(t){for(var a,n=1,r=arguments.length;n<r;n++){a=arguments[n];for(var e in a)Object.prototype.hasOwnProperty.call(a,e)&&(t[e]=a[e])}return t},o.apply(this,arguments)},s=function(t,a){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&a.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var e=0,r=Object.getOwnPropertySymbols(t);e<r.length;e++)a.indexOf(r[e])<0&&Object.prototype.propertyIsEnumerable.call(t,r[e])&&(n[r[e]]=t[r[e]]);return n},p=i.forwardRef(function(t,a){var n=t.type,r=t.vfx,e=t.className,f=s(t,["type","vfx","className"]);return c(m,o({},f,{vfx:o({radius:"rounded",fontWeight:4,padding:"m"},r),className:l("aui-alert aui-content-".concat(n),e),ref:a}))}),O=p;export{O as default};
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export default Alert;
|
|
1
|
+
export { default } from "./Alert";
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
export default Alert;
|
|
1
|
+
import{default as o}from"./Alert";export{o as default};
|
|
@@ -1,94 +1 @@
|
|
|
1
|
-
var
|
|
2
|
-
__assign = Object.assign || function(t) {
|
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
-
s = arguments[i];
|
|
5
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
-
t[p] = s[p];
|
|
7
|
-
}
|
|
8
|
-
return t;
|
|
9
|
-
};
|
|
10
|
-
return __assign.apply(this, arguments);
|
|
11
|
-
};
|
|
12
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
13
|
-
var t = {};
|
|
14
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
15
|
-
t[p] = s[p];
|
|
16
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
17
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
18
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
19
|
-
t[p[i]] = s[p[i]];
|
|
20
|
-
}
|
|
21
|
-
return t;
|
|
22
|
-
};
|
|
23
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
24
|
-
import React, { useState, useEffect, useRef } from "react";
|
|
25
|
-
import classNames from "../../functions/classNames";
|
|
26
|
-
import Box from "../Box/Box";
|
|
27
|
-
var Animated = React.forwardRef(function (props, ref) {
|
|
28
|
-
var visible = props.visible, _a = props.duration, duration = _a === void 0 ? 0.25 : _a, _b = props.keepMounted, keepMounted = _b === void 0 ? false : _b, _c = props.transitionProperties, transitionProperties = _c === void 0 ? ["all"] : _c, animateTo = props.animateTo, animateFrom = props.animateFrom, className = props.className, vfx = props.vfx, style = props.style, rest = __rest(props, ["visible", "duration", "keepMounted", "transitionProperties", "animateTo", "animateFrom", "className", "vfx", "style"]);
|
|
29
|
-
var forwardDuration = typeof duration === "number" ? duration : duration.forward;
|
|
30
|
-
var reverseDuration = typeof duration === "number" ? duration : duration.reverse;
|
|
31
|
-
var instantForward = forwardDuration <= 0;
|
|
32
|
-
var instantReverse = reverseDuration <= 0;
|
|
33
|
-
var _d = useState("from"), phase = _d[0], setPhase = _d[1];
|
|
34
|
-
var timeoutRef = useRef(null);
|
|
35
|
-
var animationFrameRef = useRef(null);
|
|
36
|
-
var clearRefs = function () {
|
|
37
|
-
if (timeoutRef.current) {
|
|
38
|
-
clearTimeout(timeoutRef.current);
|
|
39
|
-
timeoutRef.current = null;
|
|
40
|
-
}
|
|
41
|
-
if (animationFrameRef.current) {
|
|
42
|
-
cancelAnimationFrame(animationFrameRef.current);
|
|
43
|
-
animationFrameRef.current = null;
|
|
44
|
-
}
|
|
45
|
-
};
|
|
46
|
-
useEffect(function () {
|
|
47
|
-
clearRefs();
|
|
48
|
-
if (visible) {
|
|
49
|
-
if (phase !== "forward") {
|
|
50
|
-
if (instantForward) {
|
|
51
|
-
setPhase("forward");
|
|
52
|
-
}
|
|
53
|
-
else {
|
|
54
|
-
animationFrameRef.current = requestAnimationFrame(function () {
|
|
55
|
-
return setPhase("forward");
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
else if (phase !== "from") {
|
|
61
|
-
if (instantReverse) {
|
|
62
|
-
setPhase("from");
|
|
63
|
-
}
|
|
64
|
-
else if (phase !== "reverse") {
|
|
65
|
-
setPhase("reverse");
|
|
66
|
-
}
|
|
67
|
-
else if (phase === "reverse") {
|
|
68
|
-
timeoutRef.current = window.setTimeout(function () { return setPhase("from"); }, reverseDuration * 1000);
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
return clearRefs;
|
|
72
|
-
}, [visible, phase, instantForward, instantReverse, reverseDuration]);
|
|
73
|
-
if (phase === "from" && !keepMounted && !visible)
|
|
74
|
-
return null;
|
|
75
|
-
var currentAnimation = phase === "forward" || (visible && instantForward)
|
|
76
|
-
? animateTo
|
|
77
|
-
: animateFrom;
|
|
78
|
-
var transition = undefined;
|
|
79
|
-
if (phase === "forward" && !instantForward) {
|
|
80
|
-
transition = makeTransition(transitionProperties, forwardDuration);
|
|
81
|
-
}
|
|
82
|
-
else if (phase === "reverse" && !instantReverse) {
|
|
83
|
-
transition = makeTransition(transitionProperties, reverseDuration);
|
|
84
|
-
}
|
|
85
|
-
return (_jsx(Box, __assign({ className: classNames(className, currentAnimation === null || currentAnimation === void 0 ? void 0 : currentAnimation.className), style: __assign(__assign({ transition: transition }, style), currentAnimation === null || currentAnimation === void 0 ? void 0 : currentAnimation.style), vfx: __assign(__assign({}, vfx), currentAnimation === null || currentAnimation === void 0 ? void 0 : currentAnimation.vfx) }, rest, { ref: ref })));
|
|
86
|
-
});
|
|
87
|
-
var makeTransition = function (transitionProperties, duration) {
|
|
88
|
-
return transitionProperties.length > 0
|
|
89
|
-
? transitionProperties
|
|
90
|
-
.map(function (prop) { return "".concat(prop, " ").concat(duration, "s ease-in-out"); })
|
|
91
|
-
.join(", ")
|
|
92
|
-
: undefined;
|
|
93
|
-
};
|
|
94
|
-
export default Animated;
|
|
1
|
+
import{jsx as A}from"react/jsx-runtime";import M,{useState as S,useEffect as D,useRef as g}from"react";import E from"../../functions/classNames";import q from"../Box/Box";var f=function(){return f=Object.assign||function(e){for(var a,n=1,t=arguments.length;n<t;n++){a=arguments[n];for(var r in a)Object.prototype.hasOwnProperty.call(a,r)&&(e[r]=a[r])}return e},f.apply(this,arguments)},k=function(e,a){var n={};for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&a.indexOf(t)<0&&(n[t]=e[t]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,t=Object.getOwnPropertySymbols(e);r<t.length;r++)a.indexOf(t[r])<0&&Object.prototype.propertyIsEnumerable.call(e,t[r])&&(n[t[r]]=e[t[r]]);return n},B=M.forwardRef(function(e,a){var n=e.visible,t=e.duration,r=t===void 0?.25:t,y=e.keepMounted,j=y===void 0?!1:y,b=e.transitionProperties,w=b===void 0?["all"]:b,p=e.animateTo,F=e.animateFrom,P=e.className,R=e.vfx,N=e.style,T=k(e,["visible","duration","keepMounted","transitionProperties","animateTo","animateFrom","className","vfx","style"]),_=typeof r=="number"?r:r.forward,s=typeof r=="number"?r:r.reverse,l=_<=0,v=s<=0,h=S("from"),i=h[0],u=h[1],m=g(null),c=g(null),O=function(){m.current&&(clearTimeout(m.current),m.current=null),c.current&&(cancelAnimationFrame(c.current),c.current=null)};if(D(function(){return O(),n?i!=="forward"&&(l?u("forward"):c.current=requestAnimationFrame(function(){return u("forward")})):i!=="from"&&(v?u("from"):i!=="reverse"?u("reverse"):i==="reverse"&&(m.current=window.setTimeout(function(){return u("from")},s*1e3))),O},[n,i,l,v,s]),i==="from"&&!j&&!n)return null;var o=i==="forward"||n&&l?p:F,d=void 0;return i==="forward"&&!l?d=x(w,_):i==="reverse"&&!v&&(d=x(w,s)),A(q,f({className:E(P,o==null?void 0:o.className),style:f(f({transition:d},N),o==null?void 0:o.style),vfx:f(f({},R),o==null?void 0:o.vfx)},T,{ref:a}))}),x=function(e,a){return e.length>0?e.map(function(n){return"".concat(n," ").concat(a,"s ease-in-out")}).join(", "):void 0},H=B;export{H as default};
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export default Animated;
|
|
1
|
+
export { default } from "./Animated";
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
export default Animated;
|
|
1
|
+
import{default as o}from"./Animated";export{o as default};
|
|
@@ -1,57 +1 @@
|
|
|
1
|
-
var
|
|
2
|
-
__assign = Object.assign || function(t) {
|
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
-
s = arguments[i];
|
|
5
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
-
t[p] = s[p];
|
|
7
|
-
}
|
|
8
|
-
return t;
|
|
9
|
-
};
|
|
10
|
-
return __assign.apply(this, arguments);
|
|
11
|
-
};
|
|
12
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
13
|
-
var t = {};
|
|
14
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
15
|
-
t[p] = s[p];
|
|
16
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
17
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
18
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
19
|
-
t[p[i]] = s[p[i]];
|
|
20
|
-
}
|
|
21
|
-
return t;
|
|
22
|
-
};
|
|
23
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
24
|
-
import React, { useState } from "react";
|
|
25
|
-
import ui from "../ui";
|
|
26
|
-
import Box from "../Box/Box";
|
|
27
|
-
import { classNames } from "../../functions";
|
|
28
|
-
var Avatar = React.forwardRef(function (_a, ref) {
|
|
29
|
-
var _b = _a.size, size = _b === void 0 ? "s" : _b, backgroundImage = _a.backgroundImage, className = _a.className, style = _a.style, username = _a.username, vfx = _a.vfx, rest = __rest(_a, ["size", "backgroundImage", "className", "style", "username", "vfx"]);
|
|
30
|
-
var _c = useState(false), imageError = _c[0], setImageError = _c[1];
|
|
31
|
-
var useFallback = imageError || !backgroundImage;
|
|
32
|
-
var color = chooseColor(username);
|
|
33
|
-
var avatarClassName = undefined;
|
|
34
|
-
if (useFallback) {
|
|
35
|
-
avatarClassName = classNames(avatarClassName, "aui-avatar-".concat(color));
|
|
36
|
-
}
|
|
37
|
-
var imageClassName = undefined;
|
|
38
|
-
var avatarStyle = {};
|
|
39
|
-
var imageStyle = undefined;
|
|
40
|
-
if (typeof size === "number") {
|
|
41
|
-
avatarStyle = { width: size, height: size, fontSize: 0.8 * size };
|
|
42
|
-
imageStyle = { width: size, height: size };
|
|
43
|
-
}
|
|
44
|
-
else {
|
|
45
|
-
avatarClassName = classNames(avatarClassName, "aui-avatar-".concat(size));
|
|
46
|
-
imageClassName = "aui-avatar-".concat(size);
|
|
47
|
-
}
|
|
48
|
-
var fallbackCharacter = username[0];
|
|
49
|
-
return (_jsx(Box, __assign({ className: classNames(avatarClassName, className), style: __assign(__assign({}, avatarStyle), style), vfx: __assign({ radius: "rounded", overflow: "hidden", fontWeight: 6, textAlign: "center" }, vfx) }, rest, { ref: ref, children: !useFallback ? (_jsx(ui.img, { src: backgroundImage, alt: "", className: imageClassName, onError: function () { return setImageError(true); }, style: imageStyle })) : (fallbackCharacter) })));
|
|
50
|
-
});
|
|
51
|
-
var colorOptions = ["red", "yellow", "green", "blue", "purple"];
|
|
52
|
-
// simple deterministic "hash" to get a background color
|
|
53
|
-
function chooseColor(username) {
|
|
54
|
-
return colorOptions[username.split("").reduce(function (sum, char) { return sum + char.charCodeAt(0); }, 0) %
|
|
55
|
-
colorOptions.length];
|
|
56
|
-
}
|
|
57
|
-
export default Avatar;
|
|
1
|
+
import{jsx as g}from"react/jsx-runtime";import S,{useState as k}from"react";import C from"../ui";import I from"../Box/Box";import{classNames as i}from"../../functions";var o=function(){return o=Object.assign||function(r){for(var n,a=1,e=arguments.length;a<e;a++){n=arguments[a];for(var t in n)Object.prototype.hasOwnProperty.call(n,t)&&(r[t]=n[t])}return r},o.apply(this,arguments)},N=function(r,n){var a={};for(var e in r)Object.prototype.hasOwnProperty.call(r,e)&&n.indexOf(e)<0&&(a[e]=r[e]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var t=0,e=Object.getOwnPropertySymbols(r);t<e.length;t++)n.indexOf(e[t])<0&&Object.prototype.propertyIsEnumerable.call(r,e[t])&&(a[e[t]]=r[e[t]]);return a},_=S.forwardRef(function(r,n){var a=r.size,e=a===void 0?"s":a,t=r.backgroundImage,h=r.className,p=r.style,l=r.username,y=r.vfx,b=N(r,["size","backgroundImage","className","style","username","vfx"]),c=k(!1),O=c[0],x=c[1],f=O||!t,w=z(l),s=void 0;f&&(s=i(s,"aui-avatar-".concat(w)));var u=void 0,m={},v=void 0;typeof e=="number"?(m={width:e,height:e,fontSize:.8*e},v={width:e,height:e}):(s=i(s,"aui-avatar-".concat(e)),u="aui-avatar-".concat(e));var j=l[0];return g(I,o({className:i(s,h),style:o(o({},m),p),vfx:o({radius:"rounded",overflow:"hidden",fontWeight:6,textAlign:"center"},y)},b,{ref:n,children:f?j:g(C.img,{src:t,alt:"",className:u,onError:function(){return x(!0)},style:v})}))}),d=["red","yellow","green","blue","purple"];function z(r){return d[r.split("").reduce(function(n,a){return n+a.charCodeAt(0)},0)%d.length]}var F=_;export{F as default};
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export default Avatar;
|
|
1
|
+
export { default } from "./Avatar";
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
export default Avatar;
|
|
1
|
+
import{default as o}from"./Avatar";export{o as default};
|
|
@@ -1,31 +1 @@
|
|
|
1
|
-
var
|
|
2
|
-
__assign = Object.assign || function(t) {
|
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
-
s = arguments[i];
|
|
5
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
-
t[p] = s[p];
|
|
7
|
-
}
|
|
8
|
-
return t;
|
|
9
|
-
};
|
|
10
|
-
return __assign.apply(this, arguments);
|
|
11
|
-
};
|
|
12
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
13
|
-
var t = {};
|
|
14
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
15
|
-
t[p] = s[p];
|
|
16
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
17
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
18
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
19
|
-
t[p[i]] = s[p[i]];
|
|
20
|
-
}
|
|
21
|
-
return t;
|
|
22
|
-
};
|
|
23
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
24
|
-
import React from "react";
|
|
25
|
-
import classNames from "../../functions/classNames";
|
|
26
|
-
import Box from "../Box/Box";
|
|
27
|
-
var Badge = React.forwardRef(function (_a, ref) {
|
|
28
|
-
var type = _a.type, className = _a.className, vfx = _a.vfx, rest = __rest(_a, ["type", "className", "vfx"]);
|
|
29
|
-
return (_jsx(Box, __assign({}, rest, { vfx: __assign({ radius: "rounded", paddingY: "xxs", paddingX: "xs", fontWeight: 5, fontSize: "s", width: "fit" }, vfx), className: classNames("aui-badge aui-content-".concat(type), className), ref: ref })));
|
|
30
|
-
});
|
|
31
|
-
export default Badge;
|
|
1
|
+
import{jsx as i}from"react/jsx-runtime";import c from"react";import p from"../../functions/classNames";import l from"../Box/Box";var o=function(){return o=Object.assign||function(t){for(var a,n=1,r=arguments.length;n<r;n++){a=arguments[n];for(var e in a)Object.prototype.hasOwnProperty.call(a,e)&&(t[e]=a[e])}return t},o.apply(this,arguments)},s=function(t,a){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&a.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var e=0,r=Object.getOwnPropertySymbols(t);e<r.length;e++)a.indexOf(r[e])<0&&Object.prototype.propertyIsEnumerable.call(t,r[e])&&(n[r[e]]=t[r[e]]);return n},m=c.forwardRef(function(t,a){var n=t.type,r=t.className,e=t.vfx,f=s(t,["type","className","vfx"]);return i(l,o({},f,{vfx:o({radius:"rounded",paddingY:"xxs",paddingX:"xs",fontWeight:5,fontSize:"s",width:"fit"},e),className:p("aui-badge aui-content-".concat(n),r),ref:a}))}),v=m;export{v as default};
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export default Badge;
|
|
1
|
+
export { default } from "./Badge";
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
export default Badge;
|
|
1
|
+
import{default as o}from"./Badge";export{o as default};
|
|
@@ -1,31 +1 @@
|
|
|
1
|
-
var
|
|
2
|
-
__assign = Object.assign || function(t) {
|
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
-
s = arguments[i];
|
|
5
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
-
t[p] = s[p];
|
|
7
|
-
}
|
|
8
|
-
return t;
|
|
9
|
-
};
|
|
10
|
-
return __assign.apply(this, arguments);
|
|
11
|
-
};
|
|
12
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
13
|
-
var t = {};
|
|
14
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
15
|
-
t[p] = s[p];
|
|
16
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
17
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
18
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
19
|
-
t[p[i]] = s[p[i]];
|
|
20
|
-
}
|
|
21
|
-
return t;
|
|
22
|
-
};
|
|
23
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
24
|
-
import React from "react";
|
|
25
|
-
import classNames from "../../functions/classNames";
|
|
26
|
-
import Box from "../Box/Box";
|
|
27
|
-
var Banner = React.forwardRef(function (_a, ref) {
|
|
28
|
-
var type = _a.type, className = _a.className, vfx = _a.vfx, rest = __rest(_a, ["type", "className", "vfx"]);
|
|
29
|
-
return (_jsx(Box, __assign({}, rest, { vfx: __assign({ fontWeight: 4, paddingY: "l", paddingX: "xl", width: "full" }, vfx), className: classNames("aui-content-".concat(type), className), ref: ref })));
|
|
30
|
-
});
|
|
31
|
-
export default Banner;
|
|
1
|
+
import{jsx as l}from"react/jsx-runtime";import c from"react";import i from"../../functions/classNames";import p from"../Box/Box";var o=function(){return o=Object.assign||function(t){for(var n,a=1,r=arguments.length;a<r;a++){n=arguments[a];for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])}return t},o.apply(this,arguments)},s=function(t,n){var a={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&n.indexOf(r)<0&&(a[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var e=0,r=Object.getOwnPropertySymbols(t);e<r.length;e++)n.indexOf(r[e])<0&&Object.prototype.propertyIsEnumerable.call(t,r[e])&&(a[r[e]]=t[r[e]]);return a},m=c.forwardRef(function(t,n){var a=t.type,r=t.className,e=t.vfx,f=s(t,["type","className","vfx"]);return l(p,o({},f,{vfx:o({fontWeight:4,paddingY:"l",paddingX:"xl",width:"full"},e),className:i("aui-content-".concat(a),r),ref:n}))}),O=m;export{O as default};
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export default Banner;
|
|
1
|
+
export { default } from "./Banner";
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
export default Banner;
|
|
1
|
+
import{default as o}from"./Banner";export{o as default};
|
package/components/Box/Box.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export default Box;
|
|
1
|
+
export { default } from "./Box";
|
package/components/Box/index.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
export default Box;
|
|
1
|
+
import{default as o}from"./Box";export{o as default};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { Props as IconProps } from "../Icon/Icon";
|
|
3
2
|
import ui from "../ui";
|
|
4
3
|
type DefaultButtonProps = React.ComponentProps<typeof ui.button>;
|
|
5
4
|
export type VisualButtonProps = {
|
|
@@ -18,26 +17,6 @@ type ButtonProps = DefaultButtonProps & VisualButtonProps;
|
|
|
18
17
|
export declare const UnstyledButton: React.ForwardRefExoticComponent<Omit<Omit<React.ClassAttributes<HTMLButtonElement> & React.ButtonHTMLAttributes<HTMLButtonElement> & {
|
|
19
18
|
vfx?: import("../../utils/types").Vfx;
|
|
20
19
|
}, "ref"> & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
21
|
-
type IconButtonProps = Omit<DefaultButtonProps, "children"> & {
|
|
22
|
-
/**
|
|
23
|
-
* The hover effect to play when the user hovers over the button
|
|
24
|
-
* @default "dim"
|
|
25
|
-
*/
|
|
26
|
-
variant?: "dim" | "undim";
|
|
27
|
-
/**
|
|
28
|
-
* Which icon to render in the button
|
|
29
|
-
*/
|
|
30
|
-
icon: IconProps["icon"];
|
|
31
|
-
/**
|
|
32
|
-
* The size of the icon
|
|
33
|
-
*/
|
|
34
|
-
size?: IconProps["size"];
|
|
35
|
-
/**
|
|
36
|
-
* Other props to pass to the icon element
|
|
37
|
-
*/
|
|
38
|
-
iconProps?: Omit<IconProps, "icon" | "size">;
|
|
39
|
-
};
|
|
40
|
-
export declare const IconButton: React.ForwardRefExoticComponent<Omit<IconButtonProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
41
20
|
declare const Button: React.ForwardRefExoticComponent<Omit<ButtonProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
42
21
|
export declare const getButtonProps: ({ variant, size, }: VisualButtonProps) => {
|
|
43
22
|
readonly className: "aui-button-primary" | "aui-button-secondary";
|
|
@@ -1,52 +1 @@
|
|
|
1
|
-
var
|
|
2
|
-
__assign = Object.assign || function(t) {
|
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
-
s = arguments[i];
|
|
5
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
-
t[p] = s[p];
|
|
7
|
-
}
|
|
8
|
-
return t;
|
|
9
|
-
};
|
|
10
|
-
return __assign.apply(this, arguments);
|
|
11
|
-
};
|
|
12
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
13
|
-
var t = {};
|
|
14
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
15
|
-
t[p] = s[p];
|
|
16
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
17
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
18
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
19
|
-
t[p[i]] = s[p[i]];
|
|
20
|
-
}
|
|
21
|
-
return t;
|
|
22
|
-
};
|
|
23
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
24
|
-
import React from "react";
|
|
25
|
-
import classNames from "../../functions/classNames";
|
|
26
|
-
import Icon from "../Icon/Icon";
|
|
27
|
-
import ui from "../ui";
|
|
28
|
-
export var UnstyledButton = React.forwardRef(function (_a, ref) {
|
|
29
|
-
var className = _a.className, props = __rest(_a, ["className"]);
|
|
30
|
-
return (_jsx(ui.button, __assign({}, props, { className: classNames("aui-action aui-button", className), ref: ref })));
|
|
31
|
-
});
|
|
32
|
-
export var IconButton = React.forwardRef(function (_a, ref) {
|
|
33
|
-
var icon = _a.icon, size = _a.size, vfx = _a.vfx, iconProps = _a.iconProps, _b = _a.variant, variant = _b === void 0 ? "dim" : _b, className = _a.className, rest = __rest(_a, ["icon", "size", "vfx", "iconProps", "variant", "className"]);
|
|
34
|
-
return (_jsx(UnstyledButton, __assign({}, rest, { vfx: __assign({ axis: "x", align: "center", justify: "center" }, vfx), className: classNames("aui-".concat(variant), className), ref: ref, children: _jsx(Icon, __assign({ icon: icon, size: size }, iconProps)) })));
|
|
35
|
-
});
|
|
36
|
-
var vfxBySize = {
|
|
37
|
-
small: { fontSize: "xs", padding: "xs" },
|
|
38
|
-
regular: { padding: "s" },
|
|
39
|
-
};
|
|
40
|
-
var Button = React.forwardRef(function (_a, ref) {
|
|
41
|
-
var variant = _a.variant, className = _a.className, vfx = _a.vfx, size = _a.size, rest = __rest(_a, ["variant", "className", "vfx", "size"]);
|
|
42
|
-
var _b = getButtonProps({ variant: variant, size: size }), additionalVfx = _b.vfx, additionalClassName = _b.className;
|
|
43
|
-
return (_jsx(UnstyledButton, __assign({}, rest, { vfx: __assign(__assign({}, additionalVfx), vfx), className: classNames(additionalClassName, className), ref: ref })));
|
|
44
|
-
});
|
|
45
|
-
export var getButtonProps = function (_a) {
|
|
46
|
-
var _b = _a.variant, variant = _b === void 0 ? "primary" : _b, _c = _a.size, size = _c === void 0 ? "regular" : _c;
|
|
47
|
-
return ({
|
|
48
|
-
className: "aui-button-".concat(variant),
|
|
49
|
-
vfx: __assign(__assign({}, vfxBySize[size]), { radius: "rounded", fontWeight: 6 }),
|
|
50
|
-
});
|
|
51
|
-
};
|
|
52
|
-
export default Button;
|
|
1
|
+
import{jsx as f}from"react/jsx-runtime";import l from"react";import u from"../../functions/classNames";import d from"../ui";var o=function(){return o=Object.assign||function(r){for(var a,n=1,t=arguments.length;n<t;n++){a=arguments[n];for(var e in a)Object.prototype.hasOwnProperty.call(a,e)&&(r[e]=a[e])}return r},o.apply(this,arguments)},i=function(r,a){var n={};for(var t in r)Object.prototype.hasOwnProperty.call(r,t)&&a.indexOf(t)<0&&(n[t]=r[t]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var e=0,t=Object.getOwnPropertySymbols(r);e<t.length;e++)a.indexOf(t[e])<0&&Object.prototype.propertyIsEnumerable.call(r,t[e])&&(n[t[e]]=r[t[e]]);return n},x=l.forwardRef(function(r,a){var n=r.className,t=i(r,["className"]);return f(d.button,o({},t,{className:u("aui-action aui-button",n),ref:a}))}),g={small:{fontSize:"xs",padding:"xs"},regular:{padding:"s"}},y=l.forwardRef(function(r,a){var n=r.variant,t=r.className,e=r.vfx,c=r.size,v=i(r,["variant","className","vfx","size"]),s=b({variant:n,size:c}),m=s.vfx,p=s.className;return f(x,o({},v,{vfx:o(o({},m),e),className:u(p,t),ref:a}))}),b=function(r){var a=r.variant,n=a===void 0?"primary":a,t=r.size,e=t===void 0?"regular":t;return{className:"aui-button-".concat(n),vfx:o(o({},g[e]),{radius:"rounded",fontWeight:6})}},z=y;export{x as UnstyledButton,z as default,b as getButtonProps};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { type Props as IconProps } from "../Icon/Icon";
|
|
3
|
+
import { UnstyledButton } from "./Button";
|
|
4
|
+
type DefaultButtonProps = React.ComponentProps<typeof UnstyledButton>;
|
|
5
|
+
type IconButtonProps = Omit<DefaultButtonProps, "children"> & {
|
|
6
|
+
/**
|
|
7
|
+
* The hover effect to play when the user hovers over the button
|
|
8
|
+
* @default "dim"
|
|
9
|
+
*/
|
|
10
|
+
variant?: "dim" | "undim";
|
|
11
|
+
/**
|
|
12
|
+
* Which icon to render in the button
|
|
13
|
+
*/
|
|
14
|
+
icon: IconProps["icon"];
|
|
15
|
+
/**
|
|
16
|
+
* The size of the icon
|
|
17
|
+
*/
|
|
18
|
+
size?: IconProps["size"];
|
|
19
|
+
/**
|
|
20
|
+
* Other props to pass to the icon element
|
|
21
|
+
*/
|
|
22
|
+
iconProps?: Omit<IconProps, "icon" | "size">;
|
|
23
|
+
};
|
|
24
|
+
export declare const IconButton: React.ForwardRefExoticComponent<Omit<IconButtonProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
25
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as s}from"react/jsx-runtime";import u from"react";import v from"../../functions/classNames";import y from"../Icon/Icon";import{UnstyledButton as O}from"./Button";var i=function(){return i=Object.assign||function(r){for(var e,o=1,t=arguments.length;o<t;o++){e=arguments[o];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(r[n]=e[n])}return r},i.apply(this,arguments)},p=function(r,e){var o={};for(var t in r)Object.prototype.hasOwnProperty.call(r,t)&&e.indexOf(t)<0&&(o[t]=r[t]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var n=0,t=Object.getOwnPropertySymbols(r);n<t.length;n++)e.indexOf(t[n])<0&&Object.prototype.propertyIsEnumerable.call(r,t[n])&&(o[t[n]]=r[t[n]]);return o},d=u.forwardRef(function(r,e){var o=r.icon,t=r.size,n=r.vfx,c=r.iconProps,a=r.variant,f=a===void 0?"dim":a,l=r.className,m=p(r,["icon","size","vfx","iconProps","variant","className"]);return s(O,i({},m,{vfx:i({axis:"x",align:"center",justify:"center"},n),className:v("aui-".concat(f),l),ref:e,children:s(y,i({icon:o,size:t},c))}))});export{d as IconButton};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
export { UnstyledButton
|
|
3
|
-
export
|
|
1
|
+
export { default } from "./Button";
|
|
2
|
+
export { UnstyledButton } from "./Button";
|
|
3
|
+
export { IconButton } from "./IconButton";
|
|
@@ -1,3 +1 @@
|
|
|
1
|
-
import Button
|
|
2
|
-
export { UnstyledButton, IconButton };
|
|
3
|
-
export default Button;
|
|
1
|
+
import{default as r}from"./Button";import{UnstyledButton as f}from"./Button";import{IconButton as m}from"./IconButton";export{m as IconButton,f as UnstyledButton,r as default};
|