@jamsrui/button 0.0.11 → 0.0.13
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/button-BmD5-D8o.d.mts +34 -0
- package/dist/button-config.d.mts +2 -3
- package/dist/button-config.mjs +1 -1
- package/dist/button-context.d.mts +14 -0
- package/dist/button-context.mjs +1 -0
- package/dist/button-loading.d.mts +10 -0
- package/dist/button-loading.mjs +1 -0
- package/dist/button.d.mts +2 -2
- package/dist/button.mjs +1 -1
- package/dist/chunk-3STIKIU2.mjs +1 -0
- package/dist/chunk-4TJWEI2G.mjs +1 -0
- package/dist/chunk-JWKZTEGE.mjs +1 -0
- package/dist/chunk-L6DTYPN7.mjs +1 -0
- package/dist/chunk-QZBNCXZE.mjs +1 -0
- package/dist/chunk-S2ZGLMUU.mjs +1 -0
- package/dist/index.d.mts +15 -4
- package/dist/index.mjs +1 -1
- package/dist/styles.mjs +1 -1
- package/dist/use-button.d.mts +2 -2
- package/dist/use-button.mjs +1 -1
- package/package.json +4 -4
- package/dist/button-BuELWSi8.d.mts +0 -68
- package/dist/chunk-NM57UYEL.mjs +0 -1
- package/dist/chunk-SXZ2G2OH.mjs +0 -1
- package/dist/chunk-XDNNE4JZ.mjs +0 -1
- package/dist/chunk-YO2JOETJ.mjs +0 -1
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { PropGetter, UIProps } from '@jamsrui/utils';
|
|
3
|
+
import { ButtonVariantProps } from './styles.mjs';
|
|
4
|
+
|
|
5
|
+
declare const useButton: (props: useButton.Props) => {
|
|
6
|
+
getButtonProps: PropGetter<ButtonRoot.Props>;
|
|
7
|
+
isLoading: boolean;
|
|
8
|
+
};
|
|
9
|
+
declare namespace useButton {
|
|
10
|
+
interface VariantProps extends ButtonRoot.VariantProps {
|
|
11
|
+
}
|
|
12
|
+
interface Props extends VariantProps, UIProps<"button"> {
|
|
13
|
+
/**
|
|
14
|
+
* If `true`, the button will show a spinner and be non-interactive.
|
|
15
|
+
* Useful for indicating a loading state during async operations.
|
|
16
|
+
*/
|
|
17
|
+
isLoading?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* If `true`, disables all animations on the button.
|
|
20
|
+
* Useful for performance-sensitive environments or reduced motion settings.
|
|
21
|
+
*/
|
|
22
|
+
disableAnimation?: boolean;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
declare const ButtonRoot: (props: ButtonRoot.Props) => react_jsx_runtime.JSX.Element;
|
|
27
|
+
declare namespace ButtonRoot {
|
|
28
|
+
interface VariantProps extends ButtonVariantProps {
|
|
29
|
+
}
|
|
30
|
+
interface Props extends useButton.Props {
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export { ButtonRoot as B, useButton as u };
|
package/dist/button-config.d.mts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { B as Button } from './button-BuELWSi8.mjs';
|
|
2
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
3
2
|
import { GlobalConfigProps } from '@jamsrui/core';
|
|
4
|
-
import '
|
|
3
|
+
import { B as ButtonRoot } from './button-BmD5-D8o.mjs';
|
|
5
4
|
import '@jamsrui/utils';
|
|
6
5
|
import './styles.mjs';
|
|
7
6
|
|
|
@@ -11,7 +10,7 @@ declare const ButtonConfig: (props: Omit<Partial<ButtonConfig.Props>, "children"
|
|
|
11
10
|
children: React.ReactNode;
|
|
12
11
|
}) => react_jsx_runtime.JSX.Element;
|
|
13
12
|
declare namespace ButtonConfig {
|
|
14
|
-
interface Props extends
|
|
13
|
+
interface Props extends ButtonRoot.Props, GlobalConfigProps<ButtonRoot.Props> {
|
|
15
14
|
}
|
|
16
15
|
}
|
|
17
16
|
|
package/dist/button-config.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a,b}from"./chunk-
|
|
1
|
+
"use client";import{a,b}from"./chunk-QZBNCXZE.mjs";export{a as ButtonConfig,b as useButtonConfig};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { u as useButton } from './button-BmD5-D8o.mjs';
|
|
3
|
+
import 'react/jsx-runtime';
|
|
4
|
+
import '@jamsrui/utils';
|
|
5
|
+
import './styles.mjs';
|
|
6
|
+
|
|
7
|
+
declare const useButtonContext: () => ButtonContext.Props;
|
|
8
|
+
declare const ButtonContext: react.Context<ButtonContext.Props | null>;
|
|
9
|
+
declare namespace ButtonContext {
|
|
10
|
+
interface Props extends ReturnType<typeof useButton> {
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export { ButtonContext, useButtonContext };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{a,b}from"./chunk-4TJWEI2G.mjs";export{a as ButtonContext,b as useButtonContext};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
|
|
3
|
+
declare const ButtonLoading: (props: ButtonLoading.Props) => react_jsx_runtime.JSX.Element;
|
|
4
|
+
declare namespace ButtonLoading {
|
|
5
|
+
interface Props {
|
|
6
|
+
children?: React.ReactNode;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export { ButtonLoading };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{a}from"./chunk-L6DTYPN7.mjs";import"./chunk-4TJWEI2G.mjs";import"./chunk-642ZKQLN.mjs";export{a as ButtonLoading};
|
package/dist/button.d.mts
CHANGED
package/dist/button.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"./chunk-
|
|
1
|
+
"use client";import{a}from"./chunk-S2ZGLMUU.mjs";import"./chunk-QZBNCXZE.mjs";import"./chunk-4TJWEI2G.mjs";import"./chunk-3STIKIU2.mjs";import"./chunk-JWKZTEGE.mjs";export{a as ButtonRoot};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as o}from"./chunk-JWKZTEGE.mjs";import{useCallback as R,useMemo as g}from"react";import{useHover as v,useMergeRefs as x,usePress as y}from"@jamsrui/hooks";import{cn as V,dataAttr as s,mapPropsVariants as h}from"@jamsrui/utils";var K=d=>{let[f,c]=h(d,o.variantKeys),{disabled:l=!1,isLoading:t=!1,className:r,ref:P,...a}=f,e=l||t,n=o(c),{isHovered:i,ref:b}=v({isDisabled:e}),{isPressed:p,ref:B}=y({isDisabled:e}),m=x([P,b,B]),u=R(()=>({...a,ref:m,disabled:e,className:V(n,r),"data-loading":s(t),"data-pressed":s(p),"data-hover":s(i)}),[r,e,i,t,p,m,a,n]);return g(()=>({getButtonProps:u,isLoading:t}),[u,t])};export{K as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{createContext as e,use as o}from"react";var n=e(null),r=()=>{let t=o(n);if(!t)throw new Error("useButtonContext must be used within a ButtonContext");return t};export{n as a,r as b};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{allColors as i,allVariants as s,colorVariants as e,radiusBaseVariant as n,tv as o}from"@jamsrui/utils";var l=o({base:["button relative inline-flex py-2 px-4 rounded-full justify-center items-center gap-2 shrink-0","data-loading:cursor-progress","disabled:cursor-not-allowed disabled:opacity-70","focus-visible:outline-2 focus-visible:outline-primary focus-visible:outline-offset-2"],variants:{color:{default:"button--default",primary:"button--primary",secondary:"button--secondary",success:"button--success",warning:"button--warning",danger:"button--danger"},variant:{solid:"button--solid ring-1 ring-inset",bordered:"button--bordered border",light:"button--light",text:"button--text",flat:"button--flat"},isFullWidth:{true:"w-full"},size:{xs:"button--xs px-2 py-1 text-xs",sm:"button--sm min-w-16 gap-1 px-3 py-1.5 text-xs",md:"button--md min-w-20 gap-2 px-4 py-1.5 text-sm",lg:"button--lg min-w-30 gap-2 px-5 py-1.5 text-base"},radius:n,disableAnimation:{true:"",false:"transition-[scale] duration-300 data-pressed:scale-98"}},compoundVariants:[...s.flatMap(t=>i.map(a=>({variant:t,color:a,className:e[t][a]})))],defaultVariants:{variant:"solid",color:"default",size:"md",radius:"md",disableAnimation:!1,isFullWidth:!1}});export{l as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{b as o}from"./chunk-4TJWEI2G.mjs";import{a as t}from"./chunk-642ZKQLN.mjs";import{jsx as e}from"react/jsx-runtime";var p=a=>{let{children:i=e(t,{})}=a,{isLoading:n}=o();return e("span",{className:n?"":"hidden",children:n?i:null})};export{p as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{createConfigContext as o}from"@jamsrui/utils";var[n,e]=o({displayName:"ButtonConfigContext"});export{n as a,e as b};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{b as n}from"./chunk-QZBNCXZE.mjs";import{a as r}from"./chunk-4TJWEI2G.mjs";import{a as s}from"./chunk-3STIKIU2.mjs";import{a as e}from"./chunk-JWKZTEGE.mjs";import{useRenderElement as a}from"@jamsrui/hooks";import{mergeConfigProps as c}from"@jamsrui/utils";import{jsx as f}from"react/jsx-runtime";var V=t=>{let p=n(),u=c(e.defaultVariants,p,t),o=s(u),{getButtonProps:i}=o,m=a("button",{props:[i({}),{children:t.children}]});return f(r,{value:o,children:m})};export{V as a};
|
package/dist/index.d.mts
CHANGED
|
@@ -1,7 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import '
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { B as ButtonRoot } from './button-BmD5-D8o.mjs';
|
|
3
|
+
import { ButtonConfig } from './button-config.mjs';
|
|
4
|
+
export { useButtonConfig } from './button-config.mjs';
|
|
5
|
+
import { ButtonLoading } from './button-loading.mjs';
|
|
4
6
|
import '@jamsrui/utils';
|
|
5
7
|
import './styles.mjs';
|
|
6
|
-
import 'react/jsx-runtime';
|
|
7
8
|
import '@jamsrui/core';
|
|
9
|
+
|
|
10
|
+
declare const Button: ((props: ButtonRoot.Props) => react_jsx_runtime.JSX.Element) & {
|
|
11
|
+
Config: (props: Omit<Partial<ButtonConfig.Props>, "children"> & {
|
|
12
|
+
merge?: boolean;
|
|
13
|
+
children: React.ReactNode;
|
|
14
|
+
}) => react_jsx_runtime.JSX.Element;
|
|
15
|
+
Loading: (props: ButtonLoading.Props) => react_jsx_runtime.JSX.Element;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export { Button, ButtonConfig };
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import{a as t}from"./chunk-L6DTYPN7.mjs";import{a as n}from"./chunk-S2ZGLMUU.mjs";import{a as o,b as i}from"./chunk-QZBNCXZE.mjs";import"./chunk-4TJWEI2G.mjs";import"./chunk-642ZKQLN.mjs";import"./chunk-3STIKIU2.mjs";import"./chunk-JWKZTEGE.mjs";var m=Object.assign(n,{Config:o,Loading:t});export{m as Button,o as ButtonConfig,i as useButtonConfig};
|
package/dist/styles.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"./chunk-
|
|
1
|
+
import{a}from"./chunk-JWKZTEGE.mjs";export{a as buttonVariant};
|
package/dist/use-button.d.mts
CHANGED
package/dist/use-button.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"./chunk-
|
|
1
|
+
import{a}from"./chunk-3STIKIU2.mjs";import"./chunk-JWKZTEGE.mjs";export{a as useButton};
|
package/package.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jamsrui/button",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.13",
|
|
4
4
|
"peerDependencies": {
|
|
5
5
|
"react": ">=19",
|
|
6
6
|
"react-dom": ">=19"
|
|
7
7
|
},
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"@jamsrui/utils": "^0.0.
|
|
10
|
-
"@jamsrui/hooks": "^0.0.
|
|
11
|
-
"@jamsrui/core": "^0.0.
|
|
9
|
+
"@jamsrui/utils": "^0.0.13",
|
|
10
|
+
"@jamsrui/hooks": "^0.0.13",
|
|
11
|
+
"@jamsrui/core": "^0.0.11"
|
|
12
12
|
},
|
|
13
13
|
"exports": {
|
|
14
14
|
".": {
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import * as react from 'react';
|
|
2
|
-
import { PropGetter, UIProps } from '@jamsrui/utils';
|
|
3
|
-
import { ButtonVariantProps } from './styles.mjs';
|
|
4
|
-
|
|
5
|
-
declare const useButton: (props: useButton.Props) => {
|
|
6
|
-
getButtonProps: PropGetter<Button.Props>;
|
|
7
|
-
startContent: react.ReactNode;
|
|
8
|
-
endContent: react.ReactNode;
|
|
9
|
-
isLoading: boolean;
|
|
10
|
-
spinner: react.ReactNode;
|
|
11
|
-
spinnerPlacement: "end" | "start";
|
|
12
|
-
disableRipple: boolean | undefined;
|
|
13
|
-
};
|
|
14
|
-
declare namespace useButton {
|
|
15
|
-
interface VariantProps extends Button.VariantProps {
|
|
16
|
-
}
|
|
17
|
-
interface Props extends VariantProps, UIProps<"button"> {
|
|
18
|
-
/**
|
|
19
|
-
* If `true`, the button will show a spinner and be non-interactive.
|
|
20
|
-
* Useful for indicating a loading state during async operations.
|
|
21
|
-
*/
|
|
22
|
-
isLoading?: boolean;
|
|
23
|
-
/**
|
|
24
|
-
* If `true`, the button will be disabled.
|
|
25
|
-
* Takes precedence over `isLoading`.
|
|
26
|
-
*/
|
|
27
|
-
isDisabled?: boolean;
|
|
28
|
-
/**
|
|
29
|
-
* Element to be rendered at the **start** of the button content.
|
|
30
|
-
* Commonly used for icons or prepended text.
|
|
31
|
-
*/
|
|
32
|
-
startContent?: React.ReactNode;
|
|
33
|
-
/**
|
|
34
|
-
* Element to be rendered at the **end** of the button content.
|
|
35
|
-
* Commonly used for icons or appended text.
|
|
36
|
-
*/
|
|
37
|
-
endContent?: React.ReactNode;
|
|
38
|
-
/**
|
|
39
|
-
* Determines where the spinner appears when `isLoading` is true.
|
|
40
|
-
* Can be `"start"` or `"end"`. Defaults to `"start"`.
|
|
41
|
-
*/
|
|
42
|
-
spinnerPlacement?: "start" | "end";
|
|
43
|
-
/**
|
|
44
|
-
* If `true`, disables the ripple effect on click.
|
|
45
|
-
* Recommended for a more minimal or static UI feel.
|
|
46
|
-
*/
|
|
47
|
-
disableRipple?: boolean;
|
|
48
|
-
/**
|
|
49
|
-
* If `true`, disables all animations on the button.
|
|
50
|
-
* Useful for performance-sensitive environments or reduced motion settings.
|
|
51
|
-
*/
|
|
52
|
-
disableAnimation?: boolean;
|
|
53
|
-
/**
|
|
54
|
-
* A custom spinner element to replace the default loading indicator.
|
|
55
|
-
*/
|
|
56
|
-
spinner?: React.ReactNode;
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
declare const Button: (props: Button.Props) => react.ReactElement<unknown, string | react.JSXElementConstructor<any>>;
|
|
61
|
-
declare namespace Button {
|
|
62
|
-
interface VariantProps extends ButtonVariantProps {
|
|
63
|
-
}
|
|
64
|
-
interface Props extends useButton.Props {
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
export { Button as B, useButton as u };
|
package/dist/chunk-NM57UYEL.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{b as s}from"./chunk-YO2JOETJ.mjs";import{a as i}from"./chunk-642ZKQLN.mjs";import{a}from"./chunk-XDNNE4JZ.mjs";import{a as p}from"./chunk-SXZ2G2OH.mjs";import{useRenderElement as l}from"@jamsrui/hooks";import{mergeConfigProps as B}from"@jamsrui/utils";import{Fragment as x,jsx as g,jsxs as b}from"react/jsx-runtime";var S=t=>{let m=s(),o=B(p.defaultVariants,m,t),{size:u}=o,{getButtonProps:c,startContent:d,endContent:f,isLoading:n,spinner:e=g(i,{size:u==="xs"?14:20}),disableRipple:C,spinnerPlacement:r}=a(o),P=b(x,{children:[n&&r==="start"?e:d,t.children,n&&r==="end"?e:f]});return l("button",{props:[c({}),{children:P}]})};export{S as a};
|
package/dist/chunk-SXZ2G2OH.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{allColors as s,allVariants as t,colorVariants as r,radiusBaseVariant as e,tv as o}from"@jamsrui/utils";var n=o({base:["relative inline-flex py-2 px-4 rounded-full justify-center items-center gap-2 shrink-0","data-loading:cursor-progress","disabled:cursor-not-allowed disabled:opacity-70","focus-visible:outline-2 focus-visible:outline-primary focus-visible:outline-offset-2"],variants:{color:{default:"shadow-default",primary:"shadow-primary",secondary:"shadow-primary",success:"shadow-primary",warning:"shadow-primary",danger:"shadow-primary"},variant:{solid:"",bordered:"border",light:"",text:"",flat:""},isFullWidth:{true:"w-full"},size:{xs:"px-2 py-1 text-xs",sm:"min-w-16 gap-1 px-3 py-1.5 text-xs",md:"min-w-20 gap-2 px-4 py-1.5 text-sm",lg:"min-w-30 gap-2 px-5 py-1.5 text-base"},radius:e,disableAnimation:{true:"",false:"transition-[scale] duration-300 data-pressed:scale-98"}},compoundVariants:[...t.flatMap(a=>s.map(i=>({variant:a,color:i,className:r[a][i]})))],defaultVariants:{variant:"solid",color:"default",size:"md",radius:"md",disableAnimation:!1,isFullWidth:!1}});export{n as a};
|
package/dist/chunk-XDNNE4JZ.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as s}from"./chunk-SXZ2G2OH.mjs";import{useCallback as N,useMemo as V}from"react";import{useHover as D,useMergeRefs as h,usePress as A}from"@jamsrui/hooks";import{cn as G,dataAttr as o,mapPropsVariants as H}from"@jamsrui/utils";var U=b=>{let[R,B]=H(b,s.variantKeys),{isDisabled:g=!1,disableRipple:r,endContent:a,spinner:n,spinnerPlacement:i="start",startContent:p,disabled:v=!1,isLoading:e=!1,className:d,ref:x,...l}=R,t=v||g||e,c=s(B),{isHovered:m,ref:y}=D({isDisabled:t}),{isPressed:u,ref:C}=A({isDisabled:t}),f=h([x,y,C]),P=N(()=>({...l,ref:f,disabled:t,className:G(c,d),"data-loading":o(e),"data-pressed":o(u),"data-hover":o(m)}),[d,t,m,e,u,f,l,c]);return V(()=>({getButtonProps:P,startContent:p,endContent:a,isLoading:e,spinner:n,spinnerPlacement:i,disableRipple:r}),[P,p,a,e,n,i,r])};export{U as a};
|
package/dist/chunk-YO2JOETJ.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{createConfigContext as o}from"@jamsrui/utils";var[n,r]=o({displayName:"ButtonConfigContext"});export{n as a,r as b};
|