@jamsrui/icon-button 0.0.12 → 0.0.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/icon-button-config.d.mts +3 -1
- package/dist/icon-button-config.mjs +1 -1
- package/dist/icon-button-context.d.mts +14 -0
- package/dist/icon-button-context.mjs +1 -0
- package/dist/icon-button-label.d.mts +5 -0
- package/dist/icon-button-label.mjs +1 -0
- package/dist/icon-button-loading.d.mts +10 -0
- package/dist/icon-button-loading.mjs +1 -0
- package/dist/icon-button-root.d.mts +11 -0
- package/dist/icon-button-root.mjs +1 -0
- package/dist/icon-button.d.mts +11 -1
- package/dist/icon-button.mjs +1 -1
- package/dist/index.d.mts +4 -2
- package/dist/index.mjs +1 -1
- package/dist/spinner.d.mts +8 -0
- package/dist/spinner.mjs +1 -0
- package/dist/styles.d.mts +0 -3
- package/dist/styles.mjs +1 -1
- package/dist/use-icon-button.d.mts +22 -4
- package/dist/use-icon-button.mjs +1 -1
- package/package.json +4 -4
- package/dist/chunk-5BXYNIKP.mjs +0 -1
- package/dist/chunk-67ROXZH3.mjs +0 -1
- package/dist/chunk-BK47RZ6L.mjs +0 -1
- package/dist/chunk-WOIOR7OF.mjs +0 -1
- package/dist/icon-button-CNSWjtbn.d.mts +0 -25
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { IconButton } from './icon-button.mjs';
|
|
2
2
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
3
3
|
import { GlobalConfigProps } from '@jamsrui/core';
|
|
4
|
+
import './use-icon-button.mjs';
|
|
4
5
|
import 'react';
|
|
5
6
|
import '@jamsrui/utils';
|
|
7
|
+
import './icon-button-root.mjs';
|
|
6
8
|
import './styles.mjs';
|
|
7
9
|
|
|
8
10
|
declare const useIconButtonConfig: () => Record<string, any>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
"use client";import{createConfigContext as o}from"@jamsrui/utils";const[n,e]=o({displayName:"IconButtonConfig"});export{n as IconButtonConfig,e as useIconButtonConfig};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { useIconButton } from './use-icon-button.mjs';
|
|
3
|
+
import '@jamsrui/utils';
|
|
4
|
+
import './icon-button-root.mjs';
|
|
5
|
+
import './styles.mjs';
|
|
6
|
+
|
|
7
|
+
declare const useIconButtonContext: () => IconButtonContext.Props;
|
|
8
|
+
declare const IconButtonContext: react.Context<IconButtonContext.Props | null>;
|
|
9
|
+
declare namespace IconButtonContext {
|
|
10
|
+
interface Props extends ReturnType<typeof useIconButton> {
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export { IconButtonContext, useIconButtonContext };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{createContext as o,use as n}from"react";const e=o(null),s=()=>{const t=n(e);if(!t)throw new Error("useIconButtonContext must be used within a IconButtonContext");return t};export{e as IconButtonContext,s as useIconButtonContext};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as e}from"react/jsx-runtime";import{useIconButtonContext as n}from"./icon-button-context.mjs";const s=()=>{const{getLabelProps:o,label:t}=n();return e("span",{...o({}),children:t})};export{s as IconButtonLabel};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
|
|
3
|
+
declare const IconButtonLoading: (props: IconButtonLoading.Props) => react_jsx_runtime.JSX.Element;
|
|
4
|
+
declare namespace IconButtonLoading {
|
|
5
|
+
interface Props {
|
|
6
|
+
children?: React.ReactNode;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export { IconButtonLoading };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{jsx as o}from"react/jsx-runtime";import{useIconButtonContext as c}from"./icon-button-context.mjs";import{LoadingSpinner as a}from"./spinner.mjs";const s=t=>{const{children:e=o(a,{})}=t,{isLoading:n}=c();return o("span",{className:n?"":"hidden",children:n?e:null})};export{s as IconButtonLoading};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { PropsWithChildren } from 'react';
|
|
3
|
+
import { UIProps } from '@jamsrui/utils';
|
|
4
|
+
|
|
5
|
+
declare const IconButtonRoot: (props: PropsWithChildren) => react.ReactElement<unknown, string | react.JSXElementConstructor<any>>;
|
|
6
|
+
declare namespace IconButtonRoot {
|
|
7
|
+
interface Props extends UIProps<"button"> {
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export { IconButtonRoot };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Fragment as c,jsx as o,jsxs as d}from"react/jsx-runtime";import{useRenderElement as p}from"@jamsrui/hooks";import{useIconButtonContext as i}from"./icon-button-context.mjs";import{IconButtonLabel as m}from"./icon-button-label.mjs";import{LoadingSpinner as s}from"./spinner.mjs";const x=t=>{const{getButtonProps:n,loadingIcon:r=o(s,{}),isLoading:e}=i();return p("button",{props:[n(),{children:d(c,{children:[o(m,{}),e?r:t.children]})}]})};export{x as IconButtonRoot};
|
package/dist/icon-button.d.mts
CHANGED
|
@@ -1,4 +1,14 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { useIconButton } from './use-icon-button.mjs';
|
|
1
3
|
import 'react';
|
|
2
|
-
export { I as IconButton } from './icon-button-CNSWjtbn.mjs';
|
|
3
4
|
import '@jamsrui/utils';
|
|
5
|
+
import './icon-button-root.mjs';
|
|
4
6
|
import './styles.mjs';
|
|
7
|
+
|
|
8
|
+
declare const IconButton: (props: IconButton.Props) => react_jsx_runtime.JSX.Element;
|
|
9
|
+
declare namespace IconButton {
|
|
10
|
+
interface Props extends useIconButton.Props {
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export { IconButton };
|
package/dist/icon-button.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
"use client";import{jsx as t}from"react/jsx-runtime";import{IconButtonContext as e}from"./icon-button-context.mjs";import{IconButtonRoot as r}from"./icon-button-root.mjs";import{useIconButton as u}from"./use-icon-button.mjs";const p=o=>{const{children:n}=o,c=u(o);return t(e,{value:c,children:t(r,{children:n})})};export{p as IconButton};
|
package/dist/index.d.mts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { IconButton } from './icon-button.mjs';
|
|
2
2
|
export { IconButtonConfig, useIconButtonConfig } from './icon-button-config.mjs';
|
|
3
|
+
import 'react/jsx-runtime';
|
|
4
|
+
import './use-icon-button.mjs';
|
|
3
5
|
import 'react';
|
|
4
6
|
import '@jamsrui/utils';
|
|
7
|
+
import './icon-button-root.mjs';
|
|
5
8
|
import './styles.mjs';
|
|
6
|
-
import 'react/jsx-runtime';
|
|
7
9
|
import '@jamsrui/core';
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import{IconButton as t}from"./icon-button.mjs";import{IconButtonConfig as r,useIconButtonConfig as u}from"./icon-button-config.mjs";export{t as IconButton,r as IconButtonConfig,u as useIconButtonConfig};
|
package/dist/spinner.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as t,jsxs as i}from"react/jsx-runtime";const o=e=>{const{size:r=20}=e;return t("svg",{fill:"currentColor",height:r,viewBox:"0 0 24 24",width:r,xmlns:"http://www.w3.org/2000/svg",children:i("g",{children:[t("rect",{height:5,opacity:".14",width:2,x:11,y:1}),t("rect",{height:5,opacity:".29",transform:"rotate(30 12 12)",width:2,x:11,y:1}),t("rect",{height:5,opacity:".43",transform:"rotate(60 12 12)",width:2,x:11,y:1}),t("rect",{height:5,opacity:".57",transform:"rotate(90 12 12)",width:2,x:11,y:1}),t("rect",{height:5,opacity:".71",transform:"rotate(120 12 12)",width:2,x:11,y:1}),t("rect",{height:5,opacity:".86",transform:"rotate(150 12 12)",width:2,x:11,y:1}),t("rect",{height:5,transform:"rotate(180 12 12)",width:2,x:11,y:1}),t("animateTransform",{attributeName:"transform",calcMode:"discrete",dur:"0.75s",repeatCount:"indefinite",type:"rotate",values:"0 12 12;30 12 12;60 12 12;90 12 12;120 12 12;150 12 12;180 12 12;210 12 12;240 12 12;270 12 12;300 12 12;330 12 12;360 12 12"})]})})};export{o as LoadingSpinner};
|
package/dist/styles.d.mts
CHANGED
|
@@ -18,7 +18,6 @@ declare const iconButtonVariants: _jamsrui_utils.TVReturnType<{
|
|
|
18
18
|
flat: string;
|
|
19
19
|
};
|
|
20
20
|
size: {
|
|
21
|
-
xs: string;
|
|
22
21
|
sm: string;
|
|
23
22
|
md: string;
|
|
24
23
|
lg: string;
|
|
@@ -54,7 +53,6 @@ declare const iconButtonVariants: _jamsrui_utils.TVReturnType<{
|
|
|
54
53
|
flat: string;
|
|
55
54
|
};
|
|
56
55
|
size: {
|
|
57
|
-
xs: string;
|
|
58
56
|
sm: string;
|
|
59
57
|
md: string;
|
|
60
58
|
lg: string;
|
|
@@ -90,7 +88,6 @@ declare const iconButtonVariants: _jamsrui_utils.TVReturnType<{
|
|
|
90
88
|
flat: string;
|
|
91
89
|
};
|
|
92
90
|
size: {
|
|
93
|
-
xs: string;
|
|
94
91
|
sm: string;
|
|
95
92
|
md: string;
|
|
96
93
|
lg: string;
|
package/dist/styles.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{allColors as r,allVariants as i,colorVariants as n,radiusBaseVariant as e,tv as o}from"@jamsrui/utils";const d=o({base:["icon-button","z-0","cursor-default","shrink-0","group","relative","inline-flex","items-center","justify-center","box-border","appearance-none","outline-none","select-none","whitespace-nowrap","min-w-max","font-medium","tap-highlight-transparent","transition-transform duration-300","focus-visible:ring-2 focus-visible:ring-primary","data-disabled:cursor-not-allowed data-disabled:opacity-60","text-transform-inherit"],variants:{color:{default:"",primary:"",secondary:"",success:"",warning:"",danger:""},variant:{solid:"",bordered:"border bg-transparent",light:"",text:"",flat:""},size:{sm:"size-6 rounded",md:"size-8 min-w-8 rounded-lg",lg:"size-10 min-w-10 rounded-xl"},disableAnimation:{true:"transition-none!",false:"data-pressed:scale-98"},radius:e},compoundVariants:[...i.flatMap(a=>r.map(t=>({variant:a,color:t,className:n[a][t]})))],defaultVariants:{variant:"solid",color:"default",size:"md",radius:"md",disableAnimation:!1}});export{d as iconButtonVariants};
|
|
@@ -1,4 +1,22 @@
|
|
|
1
|
-
import 'react';
|
|
2
|
-
import '@jamsrui/utils';
|
|
3
|
-
|
|
4
|
-
import './styles.mjs';
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { PropGetter } from '@jamsrui/utils';
|
|
3
|
+
import { IconButtonRoot } from './icon-button-root.mjs';
|
|
4
|
+
import { IconButtonVariantProps } from './styles.mjs';
|
|
5
|
+
|
|
6
|
+
declare const useIconButton: (props: useIconButton.Props) => {
|
|
7
|
+
getButtonProps: () => Partial<IconButtonRoot.Props>;
|
|
8
|
+
getLabelProps: PropGetter<react.DetailedHTMLProps<react.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>>;
|
|
9
|
+
isLoading: boolean;
|
|
10
|
+
isDisabled: boolean;
|
|
11
|
+
label: string;
|
|
12
|
+
loadingIcon: react.ReactElement<unknown, string | react.JSXElementConstructor<any>> | undefined;
|
|
13
|
+
};
|
|
14
|
+
declare namespace useIconButton {
|
|
15
|
+
interface Props extends IconButtonVariantProps, IconButtonRoot.Props {
|
|
16
|
+
label: string;
|
|
17
|
+
isLoading?: boolean;
|
|
18
|
+
loadingIcon?: React.ReactElement;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export { useIconButton };
|
package/dist/use-icon-button.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{useCallback as P,useId as V,useMemo as h}from"react";import{useHover as C,useMergeRefs as L,usePress as N}from"@jamsrui/hooks";import{cn as A,dataAttr as e,dataAttrDev as D,mapPropsVariants as G}from"@jamsrui/utils";import{iconButtonVariants as b}from"./styles.mjs";const $=I=>{const[g,B]=G(I,b.variantKeys),{type:r="button",label:a,isLoading:t=!1,disabled:y=!1,className:n,ref:R,loadingIcon:i,...p}=g,c=b(B),s=V(),o=t||y,{isHovered:d,ref:v}=C({isDisabled:o}),{isPressed:l,ref:x}=N({isDisabled:o}),m=L([R,v,x]),u=P(()=>({...p,ref:m,"data-component":D("icon-button"),className:A(c,n),"aria-labelledby":s,type:r,disabled:o,"data-disabled":e(o),"aria-disabled":e(o),"data-loading":e(t),"data-pressed":e(l),"data-hover":e(d)}),[n,s,o,d,t,l,m,p,c,r]),f=P(()=>({"aria-hidden":!0,id:s,className:"sr-only"}),[s]);return h(()=>({getButtonProps:u,getLabelProps:f,isLoading:t,isDisabled:o,label:a,loadingIcon:i}),[u,f,o,t,a,i])};export{$ as useIconButton};
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jamsrui/icon-button",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.14",
|
|
4
4
|
"peerDependencies": {
|
|
5
5
|
"react": ">=19"
|
|
6
6
|
},
|
|
7
7
|
"dependencies": {
|
|
8
|
-
"@jamsrui/
|
|
9
|
-
"@jamsrui/utils": "^0.0.
|
|
10
|
-
"@jamsrui/
|
|
8
|
+
"@jamsrui/hooks": "^0.0.14",
|
|
9
|
+
"@jamsrui/utils": "^0.0.14",
|
|
10
|
+
"@jamsrui/core": "^0.0.12"
|
|
11
11
|
},
|
|
12
12
|
"exports": {
|
|
13
13
|
".": {
|
package/dist/chunk-5BXYNIKP.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{allColors as i,allVariants as t,colorVariants as e,radiusBaseVariant as n,tv as s}from"@jamsrui/utils";var d=s({base:["z-0","cursor-default","shrink-0","group","relative","inline-flex","items-center","justify-center","box-border","appearance-none","outline-none","select-none","whitespace-nowrap","min-w-max","font-medium","tap-highlight-transparent","transition-transform duration-300","focus-visible:ring-2 focus-visible:ring-primary","data-disabled:cursor-not-allowed data-disabled:opacity-60","text-transform-inherit"],variants:{color:{default:"",primary:"",secondary:"",success:"",warning:"",danger:""},variant:{solid:"",bordered:"border bg-transparent",light:"",text:"",flat:""},size:{xs:"size-6 rounded",sm:"size-8 min-w-8 rounded-lg",md:"size-10 min-w-10 rounded-xl",lg:"size-12 min-w-12 rounded-2xl"},disableAnimation:{true:"transition-none!",false:"data-pressed:scale-98"},radius:n},compoundVariants:[...t.flatMap(a=>i.map(r=>({variant:a,color:r,className:e[a][r]})))],defaultVariants:{variant:"solid",color:"default",size:"md",radius:"md",disableAnimation:!1}});export{d as a};
|
package/dist/chunk-67ROXZH3.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as t}from"./chunk-BK47RZ6L.mjs";import{useRenderElement as p}from"@jamsrui/hooks";import{Fragment as d,jsx as u,jsxs as m}from"react/jsx-runtime";var I=o=>{let{children:n}=o,e=t(o),{getButtonProps:r,getLabelProps:s}=e,c=m(d,{children:[u("span",{...s({})}),n]});return p("button",{props:[r(),{children:c}]})};export{I as a};
|
package/dist/chunk-BK47RZ6L.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as r}from"./chunk-5BXYNIKP.mjs";import{useCallback as b,useId as x,useMemo as R}from"react";import{useHover as V,useMergeRefs as h,usePress as C}from"@jamsrui/hooks";import{cn as L,dataAttr as e,dataAttrDev as N,mapPropsVariants as A}from"@jamsrui/utils";var k=P=>{let[f,y]=A(P,r.variantKeys),{type:a="button",label:G,isDisabled:I=!1,isLoading:t=!1,disabled:B=!1,className:n,ref:g,...i}=f,p=r(y),s=x(),o=I||t||B,{isHovered:l,ref:v}=V({isDisabled:o}),{isPressed:d,ref:D}=C({isDisabled:o}),c=h([g,v,D]),m=b(()=>({...i,ref:c,"data-component":N("icon-button"),className:L(p,n),"aria-labelledby":s,type:a,disabled:o,"data-disabled":e(o),"aria-disabled":e(o),"data-loading":e(t),"data-pressed":e(d),"data-hover":e(l)}),[n,s,o,l,t,d,c,i,p,a]),u=b(()=>({"aria-hidden":!0,id:s,className:"sr-only"}),[s]);return R(()=>({getButtonProps:m,getLabelProps:u,isLoading:t,isDisabled:o}),[m,u,o,t])};export{k as a};
|
package/dist/chunk-WOIOR7OF.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{createConfigContext as o}from"@jamsrui/utils";var[n,r]=o({displayName:"IconButtonConfig"});export{n as a,r as b};
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import * as react from 'react';
|
|
2
|
-
import { PropGetter, UIProps } from '@jamsrui/utils';
|
|
3
|
-
import { IconButtonVariantProps } from './styles.mjs';
|
|
4
|
-
|
|
5
|
-
declare const useIconButton: (props: useIconButton.Props) => {
|
|
6
|
-
getButtonProps: () => Partial<IconButton.Props>;
|
|
7
|
-
getLabelProps: PropGetter<react.DetailedHTMLProps<react.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>>;
|
|
8
|
-
isLoading: boolean;
|
|
9
|
-
isDisabled: boolean;
|
|
10
|
-
};
|
|
11
|
-
declare namespace useIconButton {
|
|
12
|
-
interface Props extends IconButtonVariantProps, UIProps<"button"> {
|
|
13
|
-
label: string;
|
|
14
|
-
isDisabled?: boolean;
|
|
15
|
-
isLoading?: boolean;
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
declare const IconButton: (props: IconButton.Props) => react.ReactElement<unknown, string | react.JSXElementConstructor<any>>;
|
|
20
|
-
declare namespace IconButton {
|
|
21
|
-
interface Props extends useIconButton.Props {
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export { IconButton as I, useIconButton as u };
|