@adamjanicki/ui 1.8.3 → 1.8.4
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/build/components/Accordion/Accordion.js +1 -0
- package/build/components/Accordion/index.d.ts +1 -0
- package/build/components/Accordion/index.js +1 -0
- package/build/components/Alert/Alert.js +1 -0
- package/build/components/Alert/index.d.ts +1 -0
- package/build/components/Alert/index.js +1 -0
- package/build/components/Animated/Animated.js +1 -0
- package/build/components/Animated/index.d.ts +1 -0
- package/build/components/Animated/index.js +1 -0
- package/build/components/Avatar/Avatar.js +1 -0
- package/build/components/Avatar/index.d.ts +1 -0
- package/build/components/Avatar/index.js +1 -0
- package/build/components/Badge/Badge.js +1 -0
- package/build/components/Badge/index.d.ts +1 -0
- package/build/components/Badge/index.js +1 -0
- package/build/components/Banner/Banner.js +1 -0
- package/build/components/Banner/index.d.ts +1 -0
- package/build/components/Banner/index.js +1 -0
- package/build/components/Box/Box.js +1 -0
- package/build/components/Box/index.d.ts +1 -0
- package/build/components/Box/index.js +1 -0
- package/{components → build/components}/Button/Button.d.ts +0 -21
- package/build/components/Button/Button.js +1 -0
- package/build/components/Button/IconButton.d.ts +25 -0
- package/build/components/Button/IconButton.js +1 -0
- package/build/components/Button/index.d.ts +3 -0
- package/build/components/Button/index.js +1 -0
- package/build/components/Carousel/Carousel.js +1 -0
- package/build/components/Carousel/index.d.ts +1 -0
- package/build/components/Carousel/index.js +1 -0
- package/build/components/ClickOutside/ClickOutside.js +1 -0
- package/build/components/ClickOutside/index.d.ts +1 -0
- package/build/components/ClickOutside/index.js +1 -0
- package/build/components/ErrorBoundary/ErrorBoundary.js +1 -0
- package/build/components/ErrorBoundary/index.d.ts +1 -0
- package/build/components/ErrorBoundary/index.js +1 -0
- package/build/components/Hamburger/DoubleCross.js +1 -0
- package/build/components/Hamburger/DoubleFlip.js +1 -0
- package/build/components/Hamburger/DoubleSpin.js +1 -0
- package/build/components/Hamburger/Hamburger.js +1 -0
- package/build/components/Hamburger/TripleFade.js +1 -0
- package/build/components/Hamburger/TripleFlip.js +1 -0
- package/build/components/Hamburger/TriplePrestige.js +1 -0
- package/build/components/Hamburger/TripleSpin.js +1 -0
- package/{components → build/components}/Hamburger/index.d.ts +2 -3
- package/build/components/Hamburger/index.js +1 -0
- package/build/components/Icon/Icon.js +1 -0
- package/build/components/Icon/icons.js +1 -0
- package/build/components/Icon/index.d.ts +1 -0
- package/build/components/Icon/index.js +1 -0
- package/build/components/Input/IconInput.js +1 -0
- package/build/components/Input/Input.js +1 -0
- package/build/components/Input/TextArea.js +1 -0
- package/build/components/Input/index.d.ts +3 -0
- package/build/components/Input/index.js +1 -0
- package/build/components/Layer/Layer.js +1 -0
- package/build/components/Layer/index.d.ts +1 -0
- package/build/components/Layer/index.js +1 -0
- package/build/components/Modal/Modal.js +1 -0
- package/build/components/Modal/index.d.ts +1 -0
- package/build/components/Modal/index.js +1 -0
- package/build/components/Select/Select.js +1 -0
- package/build/components/Select/index.d.ts +1 -0
- package/build/components/Select/index.js +1 -0
- package/build/components/Spinner/Spinner.js +1 -0
- package/build/components/Spinner/index.d.ts +1 -0
- package/build/components/Spinner/index.js +1 -0
- package/build/components/ui.js +1 -0
- package/build/functions/assertDefined.js +1 -0
- package/build/functions/classNames.js +1 -0
- package/build/functions/getDeviceType.js +1 -0
- package/build/functions/index.d.ts +4 -0
- package/build/functions/index.js +1 -0
- package/build/functions/scrollToId.js +1 -0
- package/build/hooks/index.js +1 -0
- package/build/hooks/useFocusTrap.js +1 -0
- package/build/hooks/useMediaQuery.js +1 -0
- package/build/hooks/useMergeRefs.js +1 -0
- package/build/hooks/useScroll.js +1 -0
- package/build/hooks/useScrollLock.js +1 -0
- package/build/hooks/useScrollToHash.js +1 -0
- package/build/hooks/useWindowResize.js +1 -0
- package/{index.d.ts → build/index.d.ts} +1 -3
- package/build/index.js +1 -0
- package/{components/Link → build/navigation}/Link.d.ts +4 -4
- package/build/navigation/Link.js +1 -0
- package/build/navigation/PathParamsContext.js +1 -0
- package/build/navigation/Route.js +1 -0
- package/build/navigation/Router.js +1 -0
- package/build/navigation/RouterContext.js +1 -0
- package/{router → build/navigation}/Routes.d.ts +1 -1
- package/build/navigation/Routes.js +1 -0
- package/build/navigation/history.js +1 -0
- package/build/navigation/hooks/useLocation.js +1 -0
- package/build/navigation/hooks/useNavigate.js +1 -0
- package/build/navigation/hooks/usePathParams.js +1 -0
- package/build/navigation/hooks/useRouterContext.js +1 -0
- package/build/navigation/hooks/useSearchParams.js +1 -0
- package/build/navigation/href.js +1 -0
- package/{router → build/navigation}/index.d.ts +1 -0
- package/build/navigation/index.js +1 -0
- package/build/navigation/path.js +1 -0
- package/build/navigation/string.js +1 -0
- package/build/navigation/types.js +0 -0
- package/build/utils/transformVfx.js +1 -0
- package/{utils → build/utils}/types.d.ts +1 -1
- package/build/utils/types.js +0 -0
- package/package.json +19 -8
- package/components/Accordion/Accordion.js +0 -56
- package/components/Accordion/index.d.ts +0 -2
- package/components/Accordion/index.js +0 -2
- package/components/Alert/Alert.js +0 -31
- package/components/Alert/index.d.ts +0 -2
- package/components/Alert/index.js +0 -2
- package/components/Animated/Animated.js +0 -94
- package/components/Animated/index.d.ts +0 -2
- package/components/Animated/index.js +0 -2
- package/components/Avatar/Avatar.js +0 -57
- package/components/Avatar/index.d.ts +0 -2
- package/components/Avatar/index.js +0 -2
- package/components/Badge/Badge.js +0 -31
- package/components/Badge/index.d.ts +0 -2
- package/components/Badge/index.js +0 -2
- package/components/Banner/Banner.js +0 -31
- package/components/Banner/index.d.ts +0 -2
- package/components/Banner/index.js +0 -2
- package/components/Box/Box.js +0 -3
- package/components/Box/index.d.ts +0 -2
- package/components/Box/index.js +0 -2
- package/components/Button/Button.js +0 -52
- package/components/Button/index.d.ts +0 -3
- package/components/Button/index.js +0 -3
- package/components/Carousel/Carousel.js +0 -106
- package/components/Carousel/index.d.ts +0 -2
- package/components/Carousel/index.js +0 -2
- package/components/ClickOutside/ClickOutside.js +0 -55
- package/components/ClickOutside/index.d.ts +0 -2
- package/components/ClickOutside/index.js +0 -2
- package/components/ErrorBoundary/ErrorBoundary.js +0 -61
- package/components/ErrorBoundary/index.d.ts +0 -2
- package/components/ErrorBoundary/index.js +0 -2
- package/components/Hamburger/DoubleCross.js +0 -39
- package/components/Hamburger/DoubleFlip.js +0 -39
- package/components/Hamburger/DoubleSpin.js +0 -40
- package/components/Hamburger/Hamburger.js +0 -66
- package/components/Hamburger/TripleFade.js +0 -40
- package/components/Hamburger/TripleFlip.js +0 -40
- package/components/Hamburger/TriplePrestige.js +0 -40
- package/components/Hamburger/TripleSpin.js +0 -41
- package/components/Hamburger/index.js +0 -9
- package/components/Icon/Icon.js +0 -32
- package/components/Icon/icons.js +0 -179
- package/components/Icon/index.d.ts +0 -2
- package/components/Icon/index.js +0 -2
- package/components/Input/IconInput.js +0 -33
- package/components/Input/Input.js +0 -31
- package/components/Input/TextArea.js +0 -31
- package/components/Input/index.d.ts +0 -5
- package/components/Input/index.js +0 -5
- package/components/Layer/Layer.js +0 -63
- package/components/Layer/index.d.ts +0 -2
- package/components/Layer/index.js +0 -2
- package/components/Link/Link.js +0 -75
- package/components/Link/index.d.ts +0 -3
- package/components/Link/index.js +0 -3
- package/components/Modal/Modal.js +0 -48
- package/components/Modal/index.d.ts +0 -2
- package/components/Modal/index.js +0 -2
- package/components/Select/Select.js +0 -34
- package/components/Select/index.d.ts +0 -2
- package/components/Select/index.js +0 -2
- package/components/Spinner/Spinner.js +0 -31
- package/components/Spinner/index.d.ts +0 -2
- package/components/Spinner/index.js +0 -2
- package/components/ui.js +0 -44
- package/functions/assertDefined.js +0 -13
- package/functions/classNames.js +0 -16
- package/functions/getDeviceType.js +0 -17
- package/functions/index.d.ts +0 -5
- package/functions/index.js +0 -5
- package/functions/scrollToId.js +0 -17
- package/hooks/index.js +0 -7
- package/hooks/useFocusTrap.js +0 -48
- package/hooks/useMediaQuery.js +0 -28
- package/hooks/useMergeRefs.js +0 -24
- package/hooks/useScroll.js +0 -23
- package/hooks/useScrollLock.js +0 -45
- package/hooks/useScrollToHash.js +0 -21
- package/hooks/useWindowResize.js +0 -13
- package/index.js +0 -31
- 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.js +0 -1
- package/utils/transformVfx.js +0 -212
- package/utils/types.js +0 -1
- /package/{components → build/components}/Accordion/Accordion.d.ts +0 -0
- /package/{components → build/components}/Alert/Alert.d.ts +0 -0
- /package/{components → build/components}/Animated/Animated.d.ts +0 -0
- /package/{components → build/components}/Avatar/Avatar.d.ts +0 -0
- /package/{components → build/components}/Badge/Badge.d.ts +0 -0
- /package/{components → build/components}/Banner/Banner.d.ts +0 -0
- /package/{components → build/components}/Box/Box.d.ts +0 -0
- /package/{components → build/components}/Carousel/Carousel.d.ts +0 -0
- /package/{components → build/components}/ClickOutside/ClickOutside.d.ts +0 -0
- /package/{components → build/components}/ErrorBoundary/ErrorBoundary.d.ts +0 -0
- /package/{components → build/components}/Hamburger/DoubleCross.d.ts +0 -0
- /package/{components → build/components}/Hamburger/DoubleFlip.d.ts +0 -0
- /package/{components → build/components}/Hamburger/DoubleSpin.d.ts +0 -0
- /package/{components → build/components}/Hamburger/Hamburger.d.ts +0 -0
- /package/{components → build/components}/Hamburger/TripleFade.d.ts +0 -0
- /package/{components → build/components}/Hamburger/TripleFlip.d.ts +0 -0
- /package/{components → build/components}/Hamburger/TriplePrestige.d.ts +0 -0
- /package/{components → build/components}/Hamburger/TripleSpin.d.ts +0 -0
- /package/{components → build/components}/Icon/Icon.d.ts +0 -0
- /package/{components → build/components}/Icon/icons.d.ts +0 -0
- /package/{components → build/components}/Input/IconInput.d.ts +0 -0
- /package/{components → build/components}/Input/Input.d.ts +0 -0
- /package/{components → build/components}/Input/TextArea.d.ts +0 -0
- /package/{components → build/components}/Layer/Layer.d.ts +0 -0
- /package/{components → build/components}/Modal/Modal.d.ts +0 -0
- /package/{components → build/components}/Select/Select.d.ts +0 -0
- /package/{components → build/components}/Spinner/Spinner.d.ts +0 -0
- /package/{components → build/components}/ui.d.ts +0 -0
- /package/{functions → build/functions}/assertDefined.d.ts +0 -0
- /package/{functions → build/functions}/classNames.d.ts +0 -0
- /package/{functions → build/functions}/getDeviceType.d.ts +0 -0
- /package/{functions → build/functions}/scrollToId.d.ts +0 -0
- /package/{hooks → build/hooks}/index.d.ts +0 -0
- /package/{hooks → build/hooks}/useFocusTrap.d.ts +0 -0
- /package/{hooks → build/hooks}/useMediaQuery.d.ts +0 -0
- /package/{hooks → build/hooks}/useMergeRefs.d.ts +0 -0
- /package/{hooks → build/hooks}/useScroll.d.ts +0 -0
- /package/{hooks → build/hooks}/useScrollLock.d.ts +0 -0
- /package/{hooks → build/hooks}/useScrollToHash.d.ts +0 -0
- /package/{hooks → build/hooks}/useWindowResize.d.ts +0 -0
- /package/{router → build/navigation}/PathParamsContext.d.ts +0 -0
- /package/{router → build/navigation}/Route.d.ts +0 -0
- /package/{router → build/navigation}/Router.d.ts +0 -0
- /package/{router → build/navigation}/RouterContext.d.ts +0 -0
- /package/{router → build/navigation}/history.d.ts +0 -0
- /package/{router → build/navigation}/hooks/useLocation.d.ts +0 -0
- /package/{router → build/navigation}/hooks/useNavigate.d.ts +0 -0
- /package/{router → build/navigation}/hooks/usePathParams.d.ts +0 -0
- /package/{router → build/navigation}/hooks/useRouterContext.d.ts +0 -0
- /package/{router → build/navigation}/hooks/useSearchParams.d.ts +0 -0
- /package/{router → build/navigation}/href.d.ts +0 -0
- /package/{router → build/navigation}/path.d.ts +0 -0
- /package/{router → build/navigation}/string.d.ts +0 -0
- /package/{router → build/navigation}/types.d.ts +0 -0
- /package/{style.css → build/style.css} +0 -0
- /package/{utils → build/utils}/transformVfx.d.ts +0 -0
package/build/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{default as e}from"./components/Accordion";import{default as a}from"./components/Alert";import{default as m}from"./components/Animated";import{default as u}from"./components/Avatar";import{default as d}from"./components/Badge";import{default as s}from"./components/Banner";import{default as i}from"./components/Box";import{default as B}from"./components/Button";export*from"./components/Button";import{default as y}from"./components/Carousel";import{default as I}from"./components/ClickOutside";import{default as b}from"./components/ErrorBoundary";import{default as v}from"./components/Hamburger";export*from"./components/Hamburger";import{default as L}from"./components/Icon";import{default as O}from"./components/Input";export*from"./components/Input";import{default as q}from"./components/Layer";import{default as z}from"./components/Modal";import{default as F}from"./components/Select";import{default as J}from"./components/Spinner";import{default as N}from"./components/ui";export*from"./hooks";export*from"./functions";export*from"./navigation";export{e as Accordion,a as Alert,m as Animated,u as Avatar,d as Badge,s as Banner,i as Box,B as Button,y as Carousel,I as ClickOutside,b as ErrorBoundary,v as Hamburger,L as Icon,O as Input,q as Layer,z as Modal,F as Select,J as Spinner,N as ui};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import ui from "../ui";
|
|
3
|
-
import { type VisualButtonProps } from "../Button/Button";
|
|
4
|
-
import { Vfx } from "
|
|
5
|
-
|
|
2
|
+
import ui from "../components/ui";
|
|
3
|
+
import { type VisualButtonProps } from "../components/Button/Button";
|
|
4
|
+
import type { Vfx } from "../utils/types";
|
|
5
|
+
type LinkProps = Omit<React.ComponentProps<typeof ui.a>, "href"> & {
|
|
6
6
|
/**
|
|
7
7
|
* URL to navigate to
|
|
8
8
|
*/
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as y}from"react/jsx-runtime";import c from"react";import d from"../components/ui";import{getButtonProps as h}from"../components/Button/Button";import x from"../functions/classNames";import N from"./RouterContext";import{getHref as O}from"./href";var o=function(){return o=Object.assign||function(r){for(var n,a=1,t=arguments.length;a<t;a++){n=arguments[a];for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(r[e]=n[e])}return r},o.apply(this,arguments)},v=function(r,n){var a={};for(var t in r)Object.prototype.hasOwnProperty.call(r,t)&&n.indexOf(t)<0&&(a[t]=r[t]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var e=0,t=Object.getOwnPropertySymbols(r);e<t.length;e++)n.indexOf(t[e])<0&&Object.prototype.propertyIsEnumerable.call(r,t[e])&&(a[t[e]]=r[t[e]]);return a};function k(r){return r.button===0&&!r.defaultPrevented&&!r.metaKey&&!r.altKey&&!r.ctrlKey&&!r.shiftKey}var g=c.forwardRef(function(r,n){var a=r.to,t=r.className,e=r.newTab,s=r.onClick,l=r.target,f=r.rel,u=v(r,["to","className","newTab","onClick","target","rel"]),i=c.useContext(N),m=i?O(a,i.location.pathname,i.basename):{type:"unknown",url:a};e&&(l="_blank",f="noreferrer noopener");var b=function(p){s==null||s(p),!(!i||e||m.type==="external"||m.type==="octo"||!k(p))&&(p.preventDefault(),i.navigate(a))};return y(d.a,o({},u,{href:m.url,target:l,rel:f,className:x("aui-action",t),onClick:b,ref:n}))}),T=c.forwardRef(function(r,n){var a=r.className,t=r.variant,e=r.vfx,s=r.size,l=v(r,["className","variant","vfx","size"]),f=h({variant:t,size:s}),u=f.vfx,i=f.className;return y(g,o({},l,{className:x(i,a),vfx:o(o({},u),e),ref:n}))}),w=c.forwardRef(function(r,n){var a=r.className,t=r.vfx,e=v(r,["className","vfx"]);return y(g,o({},e,{vfx:o({fontWeight:6},t),className:x("aui-link",a),ref:n}))}),B=w;export{T as ButtonLink,g as UnstyledLink,B as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import t from"react";var a=t.createContext(null),r=a;export{r as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function t(u){return null}export{t as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as d}from"react/jsx-runtime";import r from"react";import h from"./RouterContext";import{createHistory as R,getCurrentLocation as b}from"./history";import{getHref as g,normalizeBasename as x}from"./href";function y(i){var l=i.children,c=i.basename,e=c===void 0?"":c;e=x(e);var a=r.useRef(null);a.current||(a.current=R());var t=a.current,f=r.useState(b),o=f[0],v=f[1],s=r.useRef(o);r.useLayoutEffect(function(){var u=t.addListener(function(n){s.current=n,v(n)});return function(){u(),t.cleanup()}},[t]);var m=r.useCallback(function(u){var n=s.current.pathname;t.push(g(u,n,e).url)},[t,e]),p=r.useMemo(function(){return{location:o,navigate:m,basename:e}},[o,m,e]);return d(h.Provider,{value:p,children:l})}export{y as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import t from"react";var e=t.createContext(null),r=e;export{r as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as d}from"react/jsx-runtime";import R from"react";import{matchPath as x}from"./path";import b from"./PathParamsContext";import y from"./Route";import C from"./hooks/useRouterContext";import{stripBasename as P}from"./href";function j(t){return t.filter(function(r){return R.isValidElement(r)&&r.type===y})}function k(t){for(var r=t.children,i=t.fallback,a=C("<Routes>"),f=a.location,l=a.basename,u=P(f.pathname,l),p=Array.isArray(r)?r:[r],s=j(p),e=0,o=s;e<o.length;e++){var v=o[e],n=v.props,c=n.path,h=n.element,m=x(c,u);if(m)return d(b.Provider,{value:m,children:h})}return i}export{k as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function s(){return{pathname:window.location.pathname,search:window.location.search,hash:window.location.hash}}function u(){var t=new Set,i=function(){var n=s();t.forEach(function(a){return a(n)})},e=!1,r=function(){e||(window.addEventListener("popstate",i),e=!0)},o=function(){e&&(window.removeEventListener("popstate",i),e=!1)};return{push:function(n){window.history.pushState(null,"",n),i()},addListener:function(n){return r(),t.add(n),function(){t.delete(n),t.size===0&&o()}},cleanup:function(){o(),t.clear()}}}export{u as createHistory,s as getCurrentLocation};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import t from"./useRouterContext";function e(){var o=t("useLocation()").location;return o}export{e as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import t from"./useRouterContext";function a(){var e=t("useNavigate()").navigate;return e}export{a as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import r from"react";import a from"../PathParamsContext";function e(){var t=r.useContext(a);if(!t)throw new Error("usePathParams() must be used inside of a <Router> component");return t}export{e as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import e from"react";import r from"../RouterContext";function n(o){var t=e.useContext(r);if(!t)throw new Error("".concat(o," must be used inside of a <Router> component"));return t}export{n as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import o from"react";import m from"./useRouterContext";function v(i){var e=new URLSearchParams(i),a={};return e.forEach(function(n,t){var r=a[t];r===void 0?a[t]=n:Array.isArray(r)?r.push(n):a[t]=[r,n]}),a}function l(i){var e=new URLSearchParams;Object.entries(i).forEach(function(n){var t=n[0],r=n[1];r!==void 0&&(Array.isArray(r)?r.forEach(function(s){return e.append(t,s)}):e.set(t,r))});var a=e.toString();return a?"?".concat(a):""}function p(){var i=m("useSearchParams()"),e=i.location,a=i.navigate,n=e.pathname,t=e.hash,r=e.search,s=o.useMemo(function(){return v(r)},[r]),u=o.useCallback(function(c){var f=typeof c=="function"?c(s):c,h=n+l(f)+t;a(h)},[a,n,t,s]);return[s,u]}export{p as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{popSlash as e,prependSlash as f}from"./string";function s(r,t,i){if(l(r))return{type:"external",url:r};if(r.startsWith("#"))return{type:"octo",url:r};var u="internal";return r.startsWith("/")?{type:u,url:i+r}:(t=n(f(t),i),!r||r.startsWith("#")?{type:u,url:i+t+r}:{type:u,url:i+e(t)+f(r)})}function c(r){return!r||r==="/"?"":f(e(r))}function l(r){return/^(https?:\/\/|mailto:|tel:)/i.test(r)}function n(r,t){return t?r===t?"/":r.startsWith(t+"/")?r.slice(t.length):r:r}export{s as getHref,l as isExternal,c as normalizeBasename,n as stripBasename};
|
|
@@ -5,3 +5,4 @@ export { default as useSearchParams } from "./hooks/useSearchParams";
|
|
|
5
5
|
export { default as Router } from "./Router";
|
|
6
6
|
export { default as Route } from "./Route";
|
|
7
7
|
export { default as Routes } from "./Routes";
|
|
8
|
+
export { default as Link, UnstyledLink, ButtonLink } from "./Link";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{default as t}from"./hooks/useLocation";import{default as r}from"./hooks/useNavigate";import{default as s}from"./hooks/usePathParams";import{default as m}from"./hooks/useSearchParams";import{default as l}from"./Router";import{default as x}from"./Route";import{default as i}from"./Routes";import{default as k,UnstyledLink as P,ButtonLink as R}from"./Link";export{R as ButtonLink,k as Link,x as Route,l as Router,i as Routes,P as UnstyledLink,t as useLocation,r as useNavigate,s as usePathParams,m as useSearchParams};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{popSlash as h,prependSlash as m}from"./string";function u(r){return r=m(r),r.length>1&&(r=h(r)),r}function d(r,v){var l=u(r),t=u(v);if(!l.includes(":"))return l===t?{}:!1;var n=l.split("/").filter(Boolean),i=t.split("/").filter(Boolean);if(n.length!==i.length)return!1;for(var f={},e=0;e<n.length;e++){var a=n[e],s=i[e];if(a.startsWith(":")){var o=a.slice(1).trim();if(!o)return!1;f[o]=s}else if(a!==s)return!1}return f}export{d as matchPath};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function n(e){return e.startsWith("/")?e:"/".concat(e)}function t(e){return e.replace(/\/$/,"")}export{t as popSlash,n as prependSlash};
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var c={pos:function(n){var r=n.pos;return"aui-pos-".concat(r)},axis:function(n){var r=n.axis;return"aui-flex-".concat(r)},gap:function(n){var r=n.gap;return"aui-gap-".concat(r)},align:function(n){var r=n.align;return"aui-align-".concat(r)},justify:function(n){var r=n.justify;return"aui-justify-".concat(r)},stretch:function(n){var r=n.stretch;return"aui-stretch-".concat(r)},wrap:function(){return"aui-flex-wrap"},overflow:function(n){var r=n.overflow;return"aui-ov-".concat(r)},overflowX:function(n){var r=n.overflowX;return"aui-ov-x-".concat(r)},overflowY:function(n){var r=n.overflowY;return"aui-ov-y-".concat(r)},z:function(n){var r=n.z;return"aui-z-".concat(r)},padding:function(n){var r=n.padding;return"aui-pa-".concat(r)},paddingX:function(n){var r=n.paddingX,a=n.paddingLeft,i=n.paddingRight,t=[];return a||t.push("aui-pl-".concat(r)),i||t.push("aui-pr-".concat(r)),t.join(" ")},paddingY:function(n){var r=n.paddingY,a=n.paddingTop,i=n.paddingBottom,t=[];return a||t.push("aui-pt-".concat(r)),i||t.push("aui-pb-".concat(r)),t.join(" ")},paddingTop:function(n){var r=n.paddingTop;return"aui-pt-".concat(r)},paddingBottom:function(n){var r=n.paddingBottom;return"aui-pb-".concat(r)},paddingLeft:function(n){var r=n.paddingLeft;return"aui-pl-".concat(r)},paddingRight:function(n){var r=n.paddingRight;return"aui-pr-".concat(r)},margin:function(n){var r=n.margin;return"aui-ma-".concat(r)},marginX:function(n){var r=n.marginX,a=n.marginLeft,i=n.marginRight,t=[];return a||t.push("aui-ml-".concat(r)),i||t.push("aui-mr-".concat(r)),t.join(" ")},marginY:function(n){var r=n.marginY,a=n.marginTop,i=n.marginBottom,t=[];return a||t.push("aui-mt-".concat(r)),i||t.push("aui-mb-".concat(r)),t.join(" ")},marginTop:function(n){var r=n.marginTop;return"aui-mt-".concat(r)},marginBottom:function(n){var r=n.marginBottom;return"aui-mb-".concat(r)},marginLeft:function(n){var r=n.marginLeft;return"aui-ml-".concat(r)},marginRight:function(n){var r=n.marginRight;return"aui-mr-".concat(r)},width:function(n){var r=n.width;return"aui-w-".concat(r)},maxWidth:function(n){var r=n.maxWidth;return"aui-mw-".concat(r)},height:function(n){var r=n.height;return"aui-h-".concat(r)},maxHeight:function(n){var r=n.maxHeight;return"aui-mh-".concat(r)},radius:function(n){var r=n.radius;return"aui-radius-".concat(r)},border:function(){return"aui-ba"},borderTop:function(){return"aui-bt"},borderBottom:function(){return"aui-bb"},borderLeft:function(){return"aui-bl"},borderRight:function(){return"aui-br"},borderWidth:function(n){var r=n.borderWidth;return"aui-bw-".concat(r)},borderStyle:function(n){var r=n.borderStyle;return"aui-bs-".concat(r)},borderColor:function(n){var r=n.borderColor;return"aui-bc-".concat(r)},shadow:function(n){var r=n.shadow;return"aui-shadow-".concat(r)},opacity:function(n){var r=n.opacity;return"aui-op-".concat(r)},fontSize:function(n){var r=n.fontSize;return"aui-f-".concat(r)},fontWeight:function(n){var r=n.fontWeight;return"aui-fw-".concat(r)},textAlign:function(n){var r=n.textAlign;return"aui-ta-".concat(r)},italics:function(){return"aui-it"},color:function(n){var r=n.color;return"aui-c-".concat(r)},backgroundColor:function(n){var r=n.backgroundColor;return"aui-bg-".concat(r)},cursor:function(n){var r=n.cursor;return"aui-cursor-".concat(r)}};function e(n){if(!n)return null;var r=[];return Object.entries(n).forEach(function(a){var i=a[0],t=a[1],u=c[i],o=u(n);t&&o&&r.push(o)}),r.join(" ")||null}export{e as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from "react";
|
|
1
|
+
import type * as React from "react";
|
|
2
2
|
export type ReadonlyableArray<T> = readonly T[] | T[];
|
|
3
3
|
export type Children = React.ReactNode | ReadonlyableArray<React.ReactNode>;
|
|
4
4
|
export type ContentType = "success" | "warning" | "error" | "info" | "static";
|
|
File without changes
|
package/package.json
CHANGED
|
@@ -1,24 +1,34 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adamjanicki/ui",
|
|
3
|
-
"version": "1.8.
|
|
3
|
+
"version": "1.8.4",
|
|
4
4
|
"description": "Basic UI components and hooks for React in TypeScript",
|
|
5
5
|
"type": "module",
|
|
6
|
-
"main": "./index.js",
|
|
7
|
-
"
|
|
6
|
+
"main": "./build/index.js",
|
|
7
|
+
"module": "./build/index.js",
|
|
8
|
+
"types": "./build/index.d.ts",
|
|
9
|
+
"sideEffects": false,
|
|
10
|
+
"files": [
|
|
11
|
+
"build"
|
|
12
|
+
],
|
|
8
13
|
"author": "Adam Janicki",
|
|
9
14
|
"license": "MIT",
|
|
10
15
|
"repository": {
|
|
11
16
|
"type": "git",
|
|
12
17
|
"url": "git+https://github.com/adamjanicki2/ui.git"
|
|
13
18
|
},
|
|
19
|
+
"exports": {
|
|
20
|
+
".": {
|
|
21
|
+
"types": "./build/index.d.ts",
|
|
22
|
+
"import": "./build/index.js"
|
|
23
|
+
},
|
|
24
|
+
"./style.css": "./build/style.css"
|
|
25
|
+
},
|
|
14
26
|
"scripts": {
|
|
15
27
|
"clean": "python clean.py",
|
|
16
28
|
"lint": "eslint src test --max-warnings=0",
|
|
17
|
-
"test": "jest",
|
|
18
|
-
"
|
|
19
|
-
"
|
|
20
|
-
"prepare": "npm run build",
|
|
21
|
-
"dryrun": "npm publish --dry-run"
|
|
29
|
+
"test": "jest --silent",
|
|
30
|
+
"build": "npm test && npm run lint && python build.py",
|
|
31
|
+
"prepare": "npm run build"
|
|
22
32
|
},
|
|
23
33
|
"peerDependencies": {
|
|
24
34
|
"react": ">=18",
|
|
@@ -31,6 +41,7 @@
|
|
|
31
41
|
"@types/jest": "^30.0.0",
|
|
32
42
|
"@types/react": "^19.2.7",
|
|
33
43
|
"@types/react-dom": "^19.2.3",
|
|
44
|
+
"esbuild": "^0.27.2",
|
|
34
45
|
"jest": "^30.0.5",
|
|
35
46
|
"jest-environment-jsdom": "^30.0.5",
|
|
36
47
|
"sass": "^1.90.0",
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
var __assign = (this && this.__assign) || function () {
|
|
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,31 +0,0 @@
|
|
|
1
|
-
var __assign = (this && this.__assign) || function () {
|
|
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,94 +0,0 @@
|
|
|
1
|
-
var __assign = (this && this.__assign) || function () {
|
|
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,57 +0,0 @@
|
|
|
1
|
-
var __assign = (this && this.__assign) || function () {
|
|
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,31 +0,0 @@
|
|
|
1
|
-
var __assign = (this && this.__assign) || function () {
|
|
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,31 +0,0 @@
|
|
|
1
|
-
var __assign = (this && this.__assign) || function () {
|
|
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;
|
package/components/Box/Box.js
DELETED
package/components/Box/index.js
DELETED
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
var __assign = (this && this.__assign) || function () {
|
|
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;
|