@adamjanicki/ui 1.9.0 → 1.9.2
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/README.md +11 -10
- package/components/Accordion/Accordion.d.ts +6 -6
- package/components/Accordion/Accordion.js +1 -1
- package/components/Animated/Animated.d.ts +10 -9
- package/components/Animated/Animated.js +1 -1
- package/components/Autocomplete/Autocomplete.d.ts +35 -35
- package/components/Autocomplete/Autocomplete.js +1 -1
- package/components/Avatar/Avatar.js +1 -1
- package/components/Button/Button.d.ts +5 -5
- package/components/Carousel/Carousel.d.ts +7 -7
- package/components/Carousel/Carousel.js +1 -1
- package/components/ClickOutside/ClickOutside.d.ts +1 -1
- package/components/ClickOutside/useClickOutside.d.ts +9 -9
- package/components/ErrorBoundary/ErrorBoundary.d.ts +4 -4
- package/components/Floating/Floating.d.ts +14 -17
- package/components/Floating/Floating.js +1 -1
- package/components/Hamburger/Hamburger.js +1 -1
- package/components/Hamburger/index.d.ts +2 -2
- package/components/Hamburger/index.js +1 -1
- package/components/Icon/Icon.d.ts +1 -1
- package/components/Input/IconInput.d.ts +1 -1
- package/components/Input/IconInput.js +1 -1
- package/components/Input/index.d.ts +1 -1
- package/components/Input/index.js +1 -1
- package/components/Layer/Layer.js +1 -1
- package/components/Modal/Modal.js +1 -1
- package/components/Popover/Popover.d.ts +2 -2
- package/components/Popover/Popover.js +1 -1
- package/components/Select/Select.d.ts +6 -6
- package/components/Select/Select.js +1 -1
- package/components/Table/Table.d.ts +27 -15
- package/components/Table/Table.js +1 -1
- package/components/Tooltip/Tooltip.d.ts +3 -8
- package/components/Tooltip/Tooltip.js +1 -1
- package/components/index.d.ts +24 -0
- package/components/index.js +1 -0
- package/functions/getDeviceType.d.ts +1 -1
- package/functions/index.d.ts +2 -2
- package/functions/index.js +1 -1
- package/hooks/index.d.ts +3 -3
- package/hooks/index.js +1 -1
- package/hooks/useFocusTrap.d.ts +2 -2
- package/hooks/useFocusTrap.js +1 -1
- package/hooks/useScrollLock.js +1 -1
- package/index.d.ts +1 -26
- package/index.js +1 -1
- package/navigation/Link.d.ts +1 -1
- package/navigation/Link.js +1 -1
- package/navigation/Route.d.ts +2 -2
- package/navigation/Router.d.ts +2 -2
- package/navigation/Router.js +1 -1
- package/navigation/RouterContext.d.ts +2 -2
- package/navigation/Routes.js +1 -1
- package/navigation/history.d.ts +1 -1
- package/navigation/href.d.ts +1 -1
- package/navigation/index.d.ts +2 -2
- package/navigation/index.js +1 -1
- package/navigation/useRouterContext.d.ts +1 -1
- package/package.json +4 -4
- package/style.css +1 -1
- package/types/common.d.ts +83 -83
- package/types/navigation.d.ts +5 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import{jsx as O}from"react/jsx-runtime";import v,{useEffect as h}from"react";import w from"../../functions/classNames";import{useFocusTrap as x,useScrollLock as E}from"../../hooks";import j from"../../hooks/useMergeRefs";import k from"../Box/Box";var c=function(){return c=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++){t=arguments[n];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}return e},c.apply(this,arguments)},g=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]]);return n},L=v.forwardRef(function(e,t){var n=e.returnFocusOnEscape,r=e.disableScrollLock,o=e.onClose,i=e.children,d=e.className,u=e.onMouseDown,m=e.vfx,p=g(e,["returnFocusOnEscape","disableScrollLock","onClose","children","className","onMouseDown","vfx"]),y=x(!0);E(!r),h(function(){var l=function(s){var a,f;s.key==="Escape"&&(n||(f=(a=document.activeElement)===null||a===void 0?void 0:a.blur)===null||f===void 0||f.call(a),o==null||o())};return document.addEventListener("keydown",l),function(){return document.removeEventListener("keydown",l)}},[o,n]);var b=j(y,i.props.ref);return O(k,c({vfx:c({axis:"y",align:"center",justify:"center",z:"max"},m)},p,{className:w("aui-layer-backdrop",d),onMouseDown:function(l){u==null||u(l),l.target===l.currentTarget&&(o==null||o())},ref:t,children:v.cloneElement(i,{ref:b,onMouseDown:function(l){var s,a;l.stopPropagation(),(a=(s=i.props)===null||s===void 0?void 0:s.onMouseDown)===null||a===void 0||a.call(s,l)}})}))}),R=L;export{R as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as a,jsxs as u}from"react/jsx-runtime";import w from"react";import
|
|
1
|
+
import{jsx as a,jsxs as u}from"react/jsx-runtime";import w from"react";import{x as P}from"../../icons";import j from"../Animated";import c from"../Box/Box";import m,{IconButton as C}from"../Button";import L from"../Layer";var i=function(){return i=Object.assign||function(r){for(var e,t=1,o=arguments.length;t<o;t++){e=arguments[t];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 t={};for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&e.indexOf(o)<0&&(t[o]=r[o]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var n=0,o=Object.getOwnPropertySymbols(r);n<o.length;n++)e.indexOf(o[n])<0&&Object.prototype.propertyIsEnumerable.call(r,o[n])&&(t[o[n]]=r[o[n]]);return t},k=w.forwardRef(function(r,e){var t=r.open,o=r.onClose,n=r.onConfirm,d=r.confirmButtonProps,x=r.cancelButtonProps,l=r.confirmLabel,h=l===void 0?"Ok":l,f=r.cancelLabel,v=f===void 0?"Cancel":f,b=r.returnFocusOnEscape,y=r.wrapperBoxProps,g=p(r,["open","onClose","onConfirm","confirmButtonProps","cancelButtonProps","confirmLabel","cancelLabel","returnFocusOnEscape","wrapperBoxProps"]),s=y||{},O=s.vfx,B=p(s,["vfx"]);return a(j,{vfx:{pos:"fixed",z:"max"},visible:t,to:{opacity:1},from:{opacity:0},children:a(L,{onClose:o,returnFocusOnEscape:b,children:u(c,i({role:"dialog","aria-modal":"true"},B,{vfx:i({axis:"y",padding:"m",gap:"m",radius:"rounded",maxWidth:"full",shadow:"floating",border:!0,color:"default",backgroundColor:"default"},O),children:[a(c,{vfx:{axis:"x",align:"center",justify:"end",width:"full"},children:a(C,{icon:P,onClick:o})}),a(c,i({},g,{ref:e})),u(c,{vfx:{axis:"x",align:"center",justify:"end",width:"full",gap:"m"},children:[a(m,i({variant:"secondary"},x,{onClick:o,children:v})),a(m,i({},d,{onClick:function(){n(),o()},children:h}))]})]}))})})}),A=k;export{A as default};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import Floating from "../Floating";
|
|
3
2
|
import type { Children } from "../../types/common";
|
|
3
|
+
import Floating from "../Floating";
|
|
4
4
|
type FloatingProps = React.ComponentProps<typeof Floating>;
|
|
5
|
-
export type PopoverProps = Omit<FloatingProps, "
|
|
5
|
+
export type PopoverProps = Omit<FloatingProps, "floating" | "visible"> & {
|
|
6
6
|
/** Whether the popover is open */
|
|
7
7
|
open: boolean;
|
|
8
8
|
/** Fired when the popover should close */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as b}from"react/jsx-runtime";import w,{useEffect as x,useRef as f}from"react";import
|
|
1
|
+
import{jsx as b}from"react/jsx-runtime";import w,{useEffect as x,useRef as f}from"react";import R from"../../hooks/useMergeRefs";import{DEFAULT_ANIMATION_DURATION_S as j}from"../Animated/Animated";import C from"../ClickOutside/useClickOutside";import E from"../Floating";var i=function(){return i=Object.assign||function(r){for(var t,o=1,e=arguments.length;o<e;o++){t=arguments[o];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(r[n]=t[n])}return r},i.apply(this,arguments)},O=function(r,t){var o={};for(var e in r)Object.prototype.hasOwnProperty.call(r,e)&&t.indexOf(e)<0&&(o[e]=r[e]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var n=0,e=Object.getOwnPropertySymbols(r);n<e.length;n++)t.indexOf(e[n])<0&&Object.prototype.propertyIsEnumerable.call(r,e[n])&&(o[e[n]]=r[e[n]]);return o},k=function(r){var t=r.anchor,o=r.open,e=r.onClose,n=r.children,m=r.vfx,a=r.duration,l=r.from,u=r.to,g=O(r,["anchor","open","onClose","children","vfx","duration","from","to"]),c=f(null),s=f(null),d=f(e),p=f(o);d.current=e,p.current=o;var h=R(c,t.props.ref);return C({targets:[s,c],eventType:"mousedown",enabled:o,onClickOutside:e}),x(function(){var v=function(y){y.key==="Escape"&&p.current&&d.current()};return document.addEventListener("keydown",v),function(){return document.removeEventListener("keydown",v)}},[]),b(E,i({},g,{vfx:i({padding:"s",backgroundColor:"default",border:!0,shadow:"floating",radius:"rounded",z:"floating"},m),ref:s,anchor:w.cloneElement(t,{ref:h}),visible:o,floating:n,from:l!=null?l:{opacity:0},to:u!=null?u:{opacity:1},duration:a!=null?a:{forward:0,reverse:j}}))},L=k;export{L as default};
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
+
import type { ReadonlyableArray } from "../../types/common";
|
|
2
3
|
import { type BoxProps } from "../Box/Box";
|
|
3
4
|
import ui from "../ui";
|
|
4
|
-
import type { ReadonlyableArray } from "../../types/common";
|
|
5
5
|
type SelectProps = React.ComponentProps<typeof ui.select>;
|
|
6
6
|
type Props = Omit<BoxProps, "children" | "onChange"> & {
|
|
7
|
-
/** Array of options to display in the select */
|
|
8
|
-
options: ReadonlyableArray<string>;
|
|
9
7
|
/**
|
|
10
8
|
* Mapper function to get the label of the option.
|
|
11
9
|
*
|
|
@@ -13,12 +11,14 @@ type Props = Omit<BoxProps, "children" | "onChange"> & {
|
|
|
13
11
|
* @returns The label of the option.
|
|
14
12
|
*/
|
|
15
13
|
getOptionLabel?: (option: string) => string;
|
|
16
|
-
/** Current value of the select */
|
|
17
|
-
value?: SelectProps["value"];
|
|
18
14
|
/** Change handler for the select */
|
|
19
15
|
onChange?: SelectProps["onChange"];
|
|
16
|
+
/** Array of options to display in the select */
|
|
17
|
+
options: ReadonlyableArray<string>;
|
|
20
18
|
/** Props to pass to the underlying select element */
|
|
21
|
-
selectProps?: Omit<SelectProps, "
|
|
19
|
+
selectProps?: Omit<SelectProps, "onChange" | "value">;
|
|
20
|
+
/** Current value of the select */
|
|
21
|
+
value?: SelectProps["value"];
|
|
22
22
|
};
|
|
23
23
|
/** A styled `select` component */
|
|
24
24
|
declare const Select: React.ForwardRefExoticComponent<Omit<Props, "ref"> & React.RefAttributes<HTMLSelectElement>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as c,jsxs as h}from"react/jsx-runtime";import b from"react";import f from"../../functions/classNames";import x
|
|
1
|
+
import{jsx as c,jsxs as h}from"react/jsx-runtime";import b from"react";import f from"../../functions/classNames";import{select as x}from"../../icons";import O from"../Box/Box";import y from"../Icon";import j from"../ui";var s=function(){return s=Object.assign||function(e){for(var o,n=1,t=arguments.length;n<t;n++){o=arguments[n];for(var r in o)Object.prototype.hasOwnProperty.call(o,r)&&(e[r]=o[r])}return e},s.apply(this,arguments)},g=function(e,o){var n={};for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&o.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++)o.indexOf(t[r])<0&&Object.prototype.propertyIsEnumerable.call(e,t[r])&&(n[t[r]]=e[t[r]]);return n},N=b.forwardRef(function(e,o){var n=e.className,t=e.options,r=e.vfx,l=e.getOptionLabel,a=e.selectProps,u=e.value,p=e.onChange,m=g(e,["className","options","vfx","getOptionLabel","selectProps","value","onChange"]),d=(a||{}).className;return h(O,s({vfx:s({pos:"relative",width:"fit",axis:"x",align:"center",radius:"rounded",backgroundColor:"default",color:"default",padding:"none"},r),className:f("aui-select-container",a!=null&&a.disabled?"aui-select-disabled":void 0,n)},m,{children:[c(j.select,s({},a,{value:u,onChange:p,className:f("aui-select",d),ref:o,children:t.map(function(i,v){return c("option",{value:i,children:(l==null?void 0:l(i))||i},v)})})),c(y,{icon:x,vfx:{color:"muted",pos:"absolute"},style:{top:"50%",right:10,transform:"translateY(-50%)",pointerEvents:"none"},size:"xs","aria-hidden":!0})]}))}),I=N;export{I as default};
|
|
@@ -1,20 +1,34 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { UnstyledLink } from "../../navigation/Link";
|
|
2
3
|
import type { ReadonlyableArray } from "../../types/common";
|
|
3
4
|
import type { BoxProps } from "../Box/Box";
|
|
4
|
-
import { UnstyledLink } from "../../navigation/Link";
|
|
5
5
|
type LinkProps = React.ComponentProps<typeof UnstyledLink>;
|
|
6
|
-
type RouteLinkProps = Pick<LinkProps, "
|
|
6
|
+
type RouteLinkProps = Pick<LinkProps, "newTab" | "to">;
|
|
7
|
+
type BaseRowAction = {
|
|
8
|
+
/** Content to render in the action node */
|
|
9
|
+
label: React.ReactNode;
|
|
10
|
+
};
|
|
11
|
+
type RowLinkAction = BaseRowAction & RouteLinkProps;
|
|
12
|
+
type RowButtonAction = BaseRowAction & {
|
|
13
|
+
/** Callback to fire on action click */
|
|
14
|
+
onClick: () => void;
|
|
15
|
+
/** Whether the action is disabled */
|
|
16
|
+
disabled?: boolean;
|
|
17
|
+
};
|
|
18
|
+
type RowAction = RowButtonAction | RowLinkAction;
|
|
7
19
|
type MinimalItem = {
|
|
8
20
|
id: string;
|
|
9
21
|
};
|
|
10
22
|
type ContainerProps = Omit<BoxProps, "children">;
|
|
11
23
|
/** Options for data sort direction, used by `Table` */
|
|
12
|
-
export type SortDirection = "
|
|
24
|
+
export type SortDirection = "asc" | "desc" | "none";
|
|
13
25
|
type ColumnConfig<Item extends MinimalItem, Key extends keyof Item = keyof Item> = {
|
|
14
|
-
/**
|
|
15
|
-
|
|
26
|
+
/** Additional props for the body cell container */
|
|
27
|
+
cellProps?: ContainerProps;
|
|
16
28
|
/** What to render as the header */
|
|
17
29
|
header: React.ReactNode;
|
|
30
|
+
/** The key in the item struct for this column */
|
|
31
|
+
key: Key;
|
|
18
32
|
/** Custom render function for the inner cell content */
|
|
19
33
|
render?: (item: Item) => React.ReactNode;
|
|
20
34
|
/**
|
|
@@ -22,19 +36,21 @@ type ColumnConfig<Item extends MinimalItem, Key extends keyof Item = keyof Item>
|
|
|
22
36
|
* @default false
|
|
23
37
|
*/
|
|
24
38
|
sortable?: boolean;
|
|
25
|
-
/** Additional props for the body cell container */
|
|
26
|
-
cellProps?: ContainerProps;
|
|
27
39
|
};
|
|
28
40
|
type Props<Item extends MinimalItem> = ContainerProps & {
|
|
29
|
-
/** Items to render in the rows of the table */
|
|
30
|
-
items: ReadonlyableArray<Item>;
|
|
31
41
|
/** Columns to render for each data item */
|
|
32
42
|
columns: ReadonlyableArray<ColumnConfig<Item>>;
|
|
43
|
+
/** Whether to render a small separator between columns */
|
|
44
|
+
gutters?: boolean;
|
|
33
45
|
/**
|
|
34
46
|
* Additional props for each header cell container.
|
|
35
47
|
* @default {}
|
|
36
48
|
*/
|
|
37
49
|
headerCellProps?: ContainerProps;
|
|
50
|
+
/** Items to render in the rows of the table */
|
|
51
|
+
items: ReadonlyableArray<Item>;
|
|
52
|
+
/** A single link, or list of actions or links to store in an overflow menu at the end of the row */
|
|
53
|
+
rowActions?: (item: Item) => RouteLinkProps | ReadonlyableArray<RowAction>;
|
|
38
54
|
/** Options for controlled sorting of rows */
|
|
39
55
|
sort?: {
|
|
40
56
|
/** The key of the sorted column, or undefined if none */
|
|
@@ -44,11 +60,7 @@ type Props<Item extends MinimalItem> = ContainerProps & {
|
|
|
44
60
|
/** Callback to fire when the sort column/direction change */
|
|
45
61
|
onSort: (key: keyof Item, direction: SortDirection) => void;
|
|
46
62
|
};
|
|
47
|
-
/** A row can either be a link to somewhere */
|
|
48
|
-
routeTo?: (item: Item) => RouteLinkProps;
|
|
49
|
-
/** Whether to render a small separator between columns */
|
|
50
|
-
gutters?: boolean;
|
|
51
63
|
};
|
|
52
64
|
/** A sortable table to render data */
|
|
53
|
-
declare const Table: <Item extends MinimalItem>({ items, columns, headerCellProps, sort,
|
|
65
|
+
declare const Table: <Item extends MinimalItem>({ items, columns, headerCellProps, sort, rowActions, vfx, gutters, ...boxProps }: Props<Item>) => import("react/jsx-runtime").JSX.Element;
|
|
54
66
|
export default Table;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import{jsx as s,jsxs as O,Fragment as T}from"react/jsx-runtime";import{createElement as y}from"react";import{useState as X}from"react";import z from"../../functions/classNames";import{arrowDown as E,arrowUp as L,overflow as U,select as W}from"../../icons";import{UnstyledLink as S}from"../../navigation/Link";import x from"../Box/Box";import{IconButton as D,UnstyledButton as B}from"../Button";import F from"../Icon";import M from"../Popover";var a=function(){return a=Object.assign||function(r){for(var n,t=1,o=arguments.length;t<o;t++){n=arguments[t];for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(r[e]=n[e])}return r},a.apply(this,arguments)},b=function(r,n){var t={};for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&n.indexOf(o)<0&&(t[o]=r[o]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var e=0,o=Object.getOwnPropertySymbols(r);e<o.length;e++)n.indexOf(o[e])<0&&Object.prototype.propertyIsEnumerable.call(r,o[e])&&(t[o[e]]=r[o[e]]);return t},H={none:"asc",asc:"desc",desc:"none"},V={asc:L,desc:E,none:W},P=function(r){return Array.isArray(r)},Y=function(r){var n=r.items,t=r.columns,o=r.headerCellProps,e=o===void 0?{}:o,i=r.sort,c=r.rowActions,d=r.vfx,u=r.gutters,f=b(r,["items","columns","headerCellProps","sort","rowActions","vfx","gutters"]),m=!!c&&n.some(function(l){return P(c(l))});return s(x,a({},f,{vfx:a({axis:"y",backgroundColor:"default",border:!0,radius:"rounded",shadow:"subtle",overflowX:"auto"},d),children:O(x,{className:"aui-table",role:"table",vfx:{width:"full"},children:[O(x,{className:"aui-table-row",role:"row",children:[t.map(function(l,g){var v=l.key,p=l.header,h=l.sortable,w=h===void 0?!1:h,A=w&&i&&i.key===v,C=A?i.direction:"none",j=w?V[C]:null,R=e.vfx,I=b(e,["vfx"]);return y(k,a({},I,{key:String(v),vfx:a({borderRight:u&&g<t.length-1,borderBottom:!0,fontSize:"s",fontWeight:7},R)}),i&&j?O(B,{onClick:function(){return i.onSort(v,H[C])},vfx:{fontWeight:7,axis:"x",align:"center",gap:"s"},children:[p,s(F,{icon:j,vfx:{color:"muted"},size:"xs","aria-hidden":!0})]}):p)}),m?s(k,{vfx:{borderBottom:!0,paddingX:"s"}}):null]}),n.map(function(l){return s(q,{item:l,columns:t,gutters:u,rowActions:c},l.id)})]})}))},q=function(r){var n=r.item,t=r.columns,o=r.gutters,e=r.rowActions,i=e==null?void 0:e(n),c=P(i)?i:null,d=i&&!P(i)?i:void 0,u=t.map(function(m,l){var g=m.key,v=m.cellProps,p=v===void 0?{}:v,h=m.render,w=p.vfx,A=b(p,["vfx"]);return y(k,a({},A,{key:String(g),vfx:a({borderRight:o&&l<t.length-1},w)}),h?h(n):s(T,{children:n[g]}))});c&&u.push(s(k,{vfx:{paddingX:"s"},children:s(G,{rowActions:c})},"row-actions"));var f={role:"row",children:u};return d?s(S,a({},f,d,{className:"aui-table-row aui-subtle-hover"})):s(x,a({},f,{className:"aui-table-row"}))},k=function(r){var n=r.vfx,t=r.children,o=r.className,e=b(r,["vfx","children","className"]);return s(x,a({},e,{className:z("aui-table-cell",o),vfx:a({paddingX:"m",paddingY:"s"},n),children:t}))},N=4,G=function(r){var n=r.rowActions,t=X(!1),o=t[0],e=t[1];return s(M,{flip:!1,open:o,onClose:function(){return e(!1)},placement:"bottom-end",offset:N,vfx:{axis:"y",padding:"xs"},anchor:s(D,{icon:U,onClick:function(){return e(function(i){return!i})}}),to:{opacity:1,top:0},from:{opacity:0,top:-N},children:n.map(function(i,c){var d=i.label,u=b(i,["label"]),f={children:d,vfx:{axis:"x",align:"center",padding:"s",fontSize:"s",fontWeight:6,radius:"rounded"},className:"aui-subtle-hover"};return"to"in u?y(S,a({},u,f,{onClick:function(){return e(!1)},key:c})):y(B,a({onClick:function(){u.onClick(),e(!1)}},f,{key:c}))})})},nr=Y;export{nr as default};
|
|
@@ -2,19 +2,14 @@ import React from "react";
|
|
|
2
2
|
import type { Children } from "../../types/common";
|
|
3
3
|
import Floating from "../Floating/Floating";
|
|
4
4
|
type FloatingProps = React.ComponentProps<typeof Floating>;
|
|
5
|
-
export type TooltipProps = Omit<FloatingProps, "
|
|
5
|
+
export type TooltipProps = Omit<FloatingProps, "floating" | "onPointerEnter" | "onPointerLeave" | "visible"> & {
|
|
6
6
|
/** Children to render inside the tooltip container */
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* The element to attach the tooltip to.
|
|
10
|
-
* IMPORTANT: This must be able to hold a ref.
|
|
11
|
-
*/
|
|
12
|
-
children: React.ReactElement<any>;
|
|
7
|
+
children: Children;
|
|
13
8
|
/**
|
|
14
9
|
* Whether the tooltip is disabled. If true, will not show the tooltip.
|
|
15
10
|
* @default false
|
|
16
11
|
*/
|
|
17
12
|
disabled?: boolean;
|
|
18
13
|
};
|
|
19
|
-
declare const Tooltip: ({
|
|
14
|
+
declare const Tooltip: ({ anchor, children, disabled, vfx, from, to, flip, ...floatingProps }: TooltipProps) => string | number | bigint | boolean | Iterable<React.ReactNode> | Promise<string | number | bigint | boolean | React.ReactPortal | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | null | undefined> | import("react/jsx-runtime").JSX.Element | null | undefined;
|
|
20
15
|
export default Tooltip;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import{jsx as U}from"react/jsx-runtime";import Z,{useCallback as X,useEffect as Y,useRef as _,useState as q}from"react";import G from"../../hooks/useMergeRefs";import{DEFAULT_ANIMATION_DURATION_S as H}from"../Animated/Animated";import J from"../Floating/Floating";var g=function(){return g=Object.assign||function(r){for(var o,t=1,e=arguments.length;t<e;t++){o=arguments[t];for(var n in o)Object.prototype.hasOwnProperty.call(o,n)&&(r[n]=o[n])}return r},g.apply(this,arguments)},F=function(r,o){var t={};for(var e in r)Object.prototype.hasOwnProperty.call(r,e)&&o.indexOf(e)<0&&(t[e]=r[e]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var n=0,e=Object.getOwnPropertySymbols(r);n<e.length;n++)o.indexOf(e[n])<0&&Object.prototype.propertyIsEnumerable.call(r,e[n])&&(t[e[n]]=r[e[n]]);return t},A=function(r,o){return r.x>=o.left&&r.x<=o.right&&r.y>=o.top&&r.y<=o.bottom},K=function(r,o){for(var t=r.x,e=r.y,n=!1,c=0,v=o.length-1;c<o.length;v=c++){var s=o[c],y=s.x,h=s.y,p=o[v],m=p.x,b=p.y,u=h>e!=b>e&&t<(m-y)*(e-h)/(b-h)+y;u&&(n=!n)}return n},Q=function(r,o){return o.top>=r.bottom?"bottom":o.bottom<=r.top?"top":o.left>=r.right?"right":"left"},V={bottom:function(r,o,t){return[{x:r.left-t,y:r.bottom-t},{x:r.right+t,y:r.bottom-t},{x:o.right+t,y:o.top+t},{x:o.left-t,y:o.top+t}]},top:function(r,o,t){return[{x:r.left-t,y:r.top+t},{x:r.right+t,y:r.top+t},{x:o.right+t,y:o.bottom-t},{x:o.left-t,y:o.bottom-t}]},right:function(r,o,t){return[{x:r.right-t,y:r.top-t},{x:r.right-t,y:r.bottom+t},{x:o.left+t,y:o.bottom+t},{x:o.left+t,y:o.top-t}]},left:function(r,o,t){return[{x:r.left+t,y:r.top-t},{x:r.left+t,y:r.bottom+t},{x:o.right-t,y:o.bottom+t},{x:o.right-t,y:o.top-t}]}},W=function(r,o,t,e){return e===void 0&&(e=4),V[r](o,t,e)},$=function(r){var o=r.anchor,t=r.children,e=r.disabled,n=e===void 0?!1:e,c=r.vfx,v=r.from,s=r.to,y=r.flip,h=y===void 0?!0:y,p=F(r,["anchor","children","disabled","vfx","from","to","flip"]),m=q(!1),b=m[0],u=m[1],O=_(null),E=_(null),x=_(null),a=X(function(){var i;(i=x.current)===null||i===void 0||i.call(x),x.current=null},[]);Y(function(){return n&&(a(),u(!1)),a},[n,a]);var w=function(){a();var i=O.current,l=E.current;if(!i||!l){u(!1);return}var f=i.getBoundingClientRect(),j=l.getBoundingClientRect(),B=Q(f,j),I=W(B,f,j),k=function(T){var M=T.pointerType;if(M==="mouse"){var P={x:T.clientX,y:T.clientY},C=O.current,L=E.current;if(!(!C||!L)){var N=C.getBoundingClientRect(),D=L.getBoundingClientRect();A(P,N)||A(P,D)||K(P,I)||(u(!1),a())}}};window.addEventListener("pointermove",k),x.current=function(){window.removeEventListener("pointermove",k)}},S=G(O,o.props.ref);return n?t:U(J,g({},p,{flip:h,ref:E,role:"tooltip",anchor:Z.cloneElement(o,{onPointerEnter:function(i){var l,f;(f=(l=o.props)===null||l===void 0?void 0:l.onPointerEnter)===null||f===void 0||f.call(l,i),i.pointerType==="mouse"&&(a(),u(!0))},onPointerLeave:function(i){var l,f;(f=(l=o.props)===null||l===void 0?void 0:l.onPointerLeave)===null||f===void 0||f.call(l,i),i.pointerType==="mouse"&&w()},ref:S}),visible:b,duration:H,from:v!=null?v:{opacity:0},to:s!=null?s:{opacity:1},onPointerEnter:function(i){i.pointerType==="mouse"&&(a(),u(!0))},onPointerLeave:function(i){i.pointerType==="mouse"&&w()},vfx:g({padding:"s",backgroundColor:"default",border:!0,shadow:"floating",radius:"rounded",z:"floating"},c),floating:t}))},or=$;export{or as default};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export { default as Accordion } from "./Accordion";
|
|
2
|
+
export { default as Alert } from "./Alert";
|
|
3
|
+
export { default as Animated } from "./Animated";
|
|
4
|
+
export { default as Autocomplete } from "./Autocomplete";
|
|
5
|
+
export { default as Avatar } from "./Avatar";
|
|
6
|
+
export { default as Badge } from "./Badge";
|
|
7
|
+
export { default as Banner } from "./Banner";
|
|
8
|
+
export { default as Box } from "./Box";
|
|
9
|
+
export { default as Button, IconButton, UnstyledButton } from "./Button";
|
|
10
|
+
export { default as Carousel } from "./Carousel";
|
|
11
|
+
export { default as ClickOutside } from "./ClickOutside";
|
|
12
|
+
export { default as ErrorBoundary } from "./ErrorBoundary";
|
|
13
|
+
export * from "./Hamburger";
|
|
14
|
+
export { default as Hamburger } from "./Hamburger";
|
|
15
|
+
export { default as Icon } from "./Icon";
|
|
16
|
+
export { IconInput, default as Input, TextArea } from "./Input";
|
|
17
|
+
export { default as Layer } from "./Layer";
|
|
18
|
+
export { default as Modal } from "./Modal";
|
|
19
|
+
export { default as Popover } from "./Popover";
|
|
20
|
+
export { default as Select } from "./Select";
|
|
21
|
+
export { default as Spinner } from "./Spinner";
|
|
22
|
+
export { default as Table } from "./Table";
|
|
23
|
+
export { default as Tooltip } from "./Tooltip";
|
|
24
|
+
export { default as ui } from "./ui";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{default as t}from"./Accordion";import{default as a}from"./Alert";import{default as u}from"./Animated";import{default as d}from"./Autocomplete";import{default as m}from"./Avatar";import{default as x}from"./Badge";import{default as c}from"./Banner";import{default as B}from"./Box";import{default as I,IconButton as y,UnstyledButton as T}from"./Button";import{default as g}from"./Carousel";import{default as C}from"./ClickOutside";import{default as k}from"./ErrorBoundary";export*from"./Hamburger";import{default as L}from"./Hamburger";import{default as O}from"./Icon";import{IconInput as U,default as h,TextArea as j}from"./Input";import{default as w}from"./Layer";import{default as D}from"./Modal";import{default as G}from"./Popover";import{default as K}from"./Select";import{default as Q}from"./Spinner";import{default as V}from"./Table";import{default as X}from"./Tooltip";import{default as Z}from"./ui";export{t as Accordion,a as Alert,u as Animated,d as Autocomplete,m as Avatar,x as Badge,c as Banner,B as Box,I as Button,g as Carousel,C as ClickOutside,k as ErrorBoundary,L as Hamburger,O as Icon,y as IconButton,U as IconInput,h as Input,w as Layer,D as Modal,G as Popover,K as Select,Q as Spinner,V as Table,j as TextArea,X as Tooltip,T as UnstyledButton,Z as ui};
|
package/functions/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { default as classNames } from "./classNames";
|
|
2
|
-
export { default as scrollToId } from "./scrollToId";
|
|
3
1
|
export { default as assertDefined } from "./assertDefined";
|
|
2
|
+
export { default as classNames } from "./classNames";
|
|
4
3
|
export { default as getDeviceType } from "./getDeviceType";
|
|
4
|
+
export { default as scrollToId } from "./scrollToId";
|
package/functions/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{default as o}from"./
|
|
1
|
+
import{default as o}from"./assertDefined";import{default as s}from"./classNames";import{default as f}from"./getDeviceType";import{default as d}from"./scrollToId";export{o as assertDefined,s as classNames,f as getDeviceType,d as scrollToId};
|
package/hooks/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export { default as
|
|
1
|
+
export { default as useFocusTrap } from "./useFocusTrap";
|
|
2
2
|
export { default as useMediaQuery } from "./useMediaQuery";
|
|
3
|
+
export { default as useMergeRefs } from "./useMergeRefs";
|
|
3
4
|
export { default as useScroll } from "./useScroll";
|
|
4
|
-
export { default as
|
|
5
|
+
export { default as useScrollLock } from "./useScrollLock";
|
|
5
6
|
export { default as useScrollToHash } from "./useScrollToHash";
|
|
6
7
|
export { default as useWindowResize } from "./useWindowResize";
|
|
7
|
-
export { default as useMergeRefs } from "./useMergeRefs";
|
package/hooks/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{default as r}from"./
|
|
1
|
+
import{default as r}from"./useFocusTrap";import{default as a}from"./useMediaQuery";import{default as f}from"./useMergeRefs";import{default as l}from"./useScroll";import{default as p}from"./useScrollLock";import{default as x}from"./useScrollToHash";import{default as i}from"./useWindowResize";export{r as useFocusTrap,a as useMediaQuery,f as useMergeRefs,l as useScroll,p as useScrollLock,x as useScrollToHash,i as useWindowResize};
|
package/hooks/useFocusTrap.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* A hook for trapping focus within an element.
|
|
3
3
|
*
|
|
4
|
-
* @param
|
|
4
|
+
* @param active Whether the trap is active, defaults to `true`.
|
|
5
5
|
* @returns Ref object that must be passed to the element that should be trapped.
|
|
6
6
|
*/
|
|
7
|
-
declare const useFocusTrap: <T extends HTMLElement>(
|
|
7
|
+
declare const useFocusTrap: <T extends HTMLElement>(active?: boolean) => import("react").RefObject<T | null>;
|
|
8
8
|
export default useFocusTrap;
|
package/hooks/useFocusTrap.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useEffect as
|
|
1
|
+
import{useEffect as s,useRef as d}from"react";var c='a[href], area[href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), button:not([disabled]), iframe, object, embed, [contenteditable], [tabindex]:not([tabindex="-1"])',n=[];function p(t){if(!t||n.length===1)return n[n.length-1];var a=n.filter(function(e){return e.contains(t)});return a.length<=0?n[n.length-1]:a.reduce(function(e,u){return e.contains(u)?u:e})}var b=function(t){t===void 0&&(t=!0);var a=d(null);return s(function(){var e=a.current;if(!(!t||!e)){n.push(e);var u=function(r){var i=document.activeElement;if(!(r.key!=="Tab"||p(i)!==e)){var f=e.querySelectorAll(c);if(f.length<=0){r.preventDefault();return}var o=f[0],l=f[f.length-1];r.shiftKey?(i===o||!t||!e.contains(i))&&(l.focus(),r.preventDefault()):(i===l||!t||!e.contains(i))&&(o.focus(),r.preventDefault())}};return e.addEventListener("keydown",u,!0),function(){e.removeEventListener("keydown",u,!0);var r=n.lastIndexOf(e);r>=0&&n.splice(r,1)}}},[t]),a},v=b;export{v as default};
|
package/hooks/useScrollLock.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useEffect as
|
|
1
|
+
import{useEffect as d}from"react";var i=0,t=null;function l(){var o=document.body.style,n=window.innerWidth-document.documentElement.clientWidth;t={scrollY:window.scrollY,overflow:o.overflow,position:o.position,top:o.top,width:o.width,paddingRight:o.paddingRight},n>0&&(o.paddingRight="calc(".concat(getComputedStyle(document.body).paddingRight||"0px"," + ").concat(n,"px)")),o.overflow="hidden",o.position="fixed",o.top="-".concat(t.scrollY,"px"),o.width="100%"}function r(){if(t){var o=document.body.style;o.overflow=t.overflow,o.position=t.position,o.top=t.top,o.width=t.width,o.paddingRight=t.paddingRight,window.scrollTo({top:t.scrollY,left:0,behavior:"instant"}),t=null}}var c=function(){return i+=1,i===1&&l(),function(){i-=1,i===0&&r()}},e=function(o){o===void 0&&(o=!0),d(function(){if(o)return c()},[o])},p=e;export{p as default};
|
package/index.d.ts
CHANGED
|
@@ -1,29 +1,4 @@
|
|
|
1
|
-
export
|
|
2
|
-
export { default as Alert } from "./components/Alert";
|
|
3
|
-
export { default as Animated } from "./components/Animated";
|
|
4
|
-
export { default as Avatar } from "./components/Avatar";
|
|
5
|
-
export { default as Badge } from "./components/Badge";
|
|
6
|
-
export { default as Banner } from "./components/Banner";
|
|
7
|
-
export { default as Box } from "./components/Box";
|
|
8
|
-
export { default as Button } from "./components/Button";
|
|
9
|
-
export * from "./components/Button";
|
|
10
|
-
export { default as Carousel } from "./components/Carousel";
|
|
11
|
-
export { default as ClickOutside } from "./components/ClickOutside";
|
|
12
|
-
export { default as ErrorBoundary } from "./components/ErrorBoundary";
|
|
13
|
-
export { default as Hamburger } from "./components/Hamburger";
|
|
14
|
-
export * from "./components/Hamburger";
|
|
15
|
-
export { default as Icon } from "./components/Icon";
|
|
16
|
-
export { default as Input } from "./components/Input";
|
|
17
|
-
export * from "./components/Input";
|
|
18
|
-
export { default as Layer } from "./components/Layer";
|
|
19
|
-
export { default as Modal } from "./components/Modal";
|
|
20
|
-
export { default as Select } from "./components/Select";
|
|
21
|
-
export { default as Spinner } from "./components/Spinner";
|
|
22
|
-
export { default as Table } from "./components/Table";
|
|
23
|
-
export { default as ui } from "./components/ui";
|
|
1
|
+
export * from "./components";
|
|
24
2
|
export * from "./hooks";
|
|
25
3
|
export * from "./functions";
|
|
26
4
|
export * from "./navigation";
|
|
27
|
-
export { default as Autocomplete } from "./components/Autocomplete";
|
|
28
|
-
export { default as Popover } from "./components/Popover";
|
|
29
|
-
export { default as Tooltip } from "./components/Tooltip";
|
package/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
export*from"./components";export*from"./hooks";export*from"./functions";export*from"./navigation";
|
package/navigation/Link.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import ui from "../components/ui";
|
|
3
2
|
import { type VisualButtonProps } from "../components/Button/Button";
|
|
3
|
+
import ui from "../components/ui";
|
|
4
4
|
import type { Vfx } from "../types/common";
|
|
5
5
|
type LinkProps = Omit<React.ComponentProps<typeof ui.a>, "href"> & {
|
|
6
6
|
/** URL to navigate to */
|
package/navigation/Link.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as y}from"react/jsx-runtime";import c from"react";import d
|
|
1
|
+
import{jsx as y}from"react/jsx-runtime";import c from"react";import{getButtonProps as d}from"../components/Button/Button";import h from"../components/ui";import x from"../functions/classNames";import{getHref as N}from"./href";import O from"./RouterContext";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(O),m=i?N(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(h.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=d({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};
|
package/navigation/Route.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type * as React from "react";
|
|
2
2
|
export type Props = {
|
|
3
|
+
/** Element to render when the path matches */
|
|
4
|
+
element: React.ReactElement;
|
|
3
5
|
/**
|
|
4
6
|
* Path pattern to match against window.location.pathname.
|
|
5
7
|
* Currently, only 2 types are supported.
|
|
@@ -9,8 +11,6 @@ export type Props = {
|
|
|
9
11
|
* @example "/movie/:id"
|
|
10
12
|
*/
|
|
11
13
|
path: string;
|
|
12
|
-
/** Element to render when the path matches */
|
|
13
|
-
element: React.ReactElement;
|
|
14
14
|
};
|
|
15
15
|
/** A simple wrapper to be used by <Routes> */
|
|
16
16
|
export default function Route({}: Props): null;
|
package/navigation/Router.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
export type Props = {
|
|
3
|
-
/** Children to render inside the router provider */
|
|
4
|
-
children: React.ReactNode;
|
|
5
3
|
/**
|
|
6
4
|
* Optional basename prefix for all internal navigation.
|
|
7
5
|
* @example "/app"
|
|
8
6
|
*/
|
|
9
7
|
basename?: string;
|
|
8
|
+
/** Children to render inside the router provider */
|
|
9
|
+
children: React.ReactNode;
|
|
10
10
|
/**
|
|
11
11
|
* Whether to reset the page scroll position to the top on navigation.
|
|
12
12
|
* This applies when navigating to a different pathname (query/hash changes do not reset scroll).
|
package/navigation/Router.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as w}from"react/jsx-runtime";import r from"react";import
|
|
1
|
+
import{jsx as w}from"react/jsx-runtime";import r from"react";import{createRouterHistory as g,getCurrentLocation as x}from"./history";import{getHref as L,normalizeBasename as S}from"./href";import C from"./RouterContext";function P(i){var p=i.children,n=i.basename,s=i.resetScroll,f=s===void 0?!0:s;n=S(n!=null?n:"");var l=r.useRef(null);l.current||(l.current=g());var o=l.current,v=r.useState(x),a=v[0],R=v[1],m=r.useRef(a),d=r.useRef(a.pathname),u=r.useRef(null),c=r.useCallback(function(){var e=u.current;e!==null&&(window.history.scrollRestoration=e,u.current=null)},[]);r.useLayoutEffect(function(){var e=o.addListener(function(t){m.current=t,R(t)});return function(){e(),o.cleanup()}},[o]),r.useLayoutEffect(function(){var e=d.current,t=a.pathname;if(d.current=t,!f){c();return}return u.current===null&&(u.current=window.history.scrollRestoration),window.history.scrollRestoration="manual",e!==t&&window.scrollTo({top:0,left:0,behavior:"instant"}),c},[a.pathname,f,c]);var h=r.useCallback(function(e,t){if(typeof e=="number")o.go(e);else{var b=L(e,m.current.pathname,n).url;o.update(b,t==null?void 0:t.historyMode)}},[o,n]),y=r.useMemo(function(){return{location:a,navigate:h,basename:n}},[a,h,n]);return w(C.Provider,{value:y,children:p})}export{P as default};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import type { Location, Navigate } from "../types/navigation";
|
|
3
3
|
type RouterContextValue = {
|
|
4
|
+
/** Optional basename prefix for all internal navigation */
|
|
5
|
+
basename: string;
|
|
4
6
|
/** Current location */
|
|
5
7
|
location: Location;
|
|
6
8
|
/** Push-style navigation */
|
|
7
9
|
navigate: Navigate;
|
|
8
|
-
/** Optional basename prefix for all internal navigation */
|
|
9
|
-
basename: string;
|
|
10
10
|
};
|
|
11
11
|
declare const RouterContext: React.Context<RouterContextValue | null>;
|
|
12
12
|
export default RouterContext;
|
package/navigation/Routes.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as R}from"react/jsx-runtime";import f from"react";import{
|
|
1
|
+
import{jsx as R}from"react/jsx-runtime";import f from"react";import{stripBasename as x}from"./href";import{matchPath as E}from"./path";import b from"./PathParamsContext";import C from"./Route";import P from"./useRouterContext";function l(t){var r=[];return f.Children.forEach(t,function(e){if(f.isValidElement(e))if(e.type===C)r.push(e);else{var o=e.props;r=r.concat(l(o.children))}}),r}function j(t){for(var r=t.children,e=t.fallback,o=P("<Routes>"),p=o.location,s=o.basename,u=x(p.pathname,s),c=l(r),a=0,n=c;a<n.length;a++){var v=n[a],m=v.props,h=m.path,d=m.element,i=E(h,u);if(i)return R(b.Provider,{value:i,children:d})}return e}export{j as default};
|
package/navigation/history.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { HistoryMode, Location } from "../types/navigation";
|
|
2
2
|
export declare function getCurrentLocation(): Location;
|
|
3
3
|
type LocationListener = (location: Location) => void;
|
|
4
4
|
export declare function createRouterHistory(): {
|
package/navigation/href.d.ts
CHANGED
package/navigation/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ export { default as useLocation } from "./useLocation";
|
|
|
2
2
|
export { default as useNavigate } from "./useNavigate";
|
|
3
3
|
export { default as usePathParams } from "./usePathParams";
|
|
4
4
|
export { default as useSearchParams } from "./useSearchParams";
|
|
5
|
-
export { default as
|
|
5
|
+
export { ButtonLink, default as Link, UnstyledLink } from "./Link";
|
|
6
6
|
export { default as Route } from "./Route";
|
|
7
|
+
export { default as Router } from "./Router";
|
|
7
8
|
export { default as Routes } from "./Routes";
|
|
8
|
-
export { default as Link, UnstyledLink, ButtonLink } from "./Link";
|
package/navigation/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{default as t}from"./useLocation";import{default as r}from"./useNavigate";import{default as s}from"./usePathParams";import{default as m}from"./useSearchParams";import{default as
|
|
1
|
+
import{default as t}from"./useLocation";import{default as r}from"./useNavigate";import{default as s}from"./usePathParams";import{default as m}from"./useSearchParams";import{ButtonLink as l,default as p,UnstyledLink as x}from"./Link";import{default as i}from"./Route";import{default as k}from"./Router";import{default as R}from"./Routes";export{l as ButtonLink,p as Link,i as Route,k as Router,R as Routes,x as UnstyledLink,t as useLocation,r as useNavigate,s as usePathParams,m as useSearchParams};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adamjanicki/ui",
|
|
3
|
-
"version": "1.9.
|
|
3
|
+
"version": "1.9.2",
|
|
4
4
|
"description": "Basic UI components and hooks for React in TypeScript",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./index.js",
|
|
@@ -14,10 +14,10 @@
|
|
|
14
14
|
"url": "git+https://github.com/adamjanicki2/ui.git"
|
|
15
15
|
},
|
|
16
16
|
"scripts": {
|
|
17
|
-
"clean": "
|
|
18
|
-
"lint": "eslint src test --
|
|
17
|
+
"clean": "python3 clean.py",
|
|
18
|
+
"lint": "eslint src test --fix && prettier --write \"src/**/*.{ts,tsx,json,css,scss,md}\" \"test/**/*.{ts,tsx}\"",
|
|
19
19
|
"test": "jest --silent",
|
|
20
|
-
"build": "npm test &&
|
|
20
|
+
"build": "npm test && eslint src test --max-warnings=0 && python3 build.py",
|
|
21
21
|
"prepare": "npm run build"
|
|
22
22
|
},
|
|
23
23
|
"peerDependencies": {
|