@sprocketui-react/button 1.0.0 → 1.0.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 +19 -0
- package/dist/index.cjs +1 -0
- package/dist/index.d.cts +93 -0
- package/dist/index.d.ts +71 -45
- package/dist/index.global.js +666 -0
- package/dist/index.js +1 -10
- package/package.json +39 -12
- package/__tests__/button.test.tsx +0 -45
- package/dist/index.es.js +0 -10
- package/dist/index.es.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/src/components/Button.tsx +0 -45
- package/src/hooks/useButton.ts +0 -195
- package/src/index.ts +0 -11
- package/src/types.ts +0 -14
- package/tsconfig.json +0 -8
package/README.md
CHANGED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
<a href="https://sprocketui.com">
|
|
3
|
+
<img alt="Necto Logo" src="https://avatars.githubusercontent.com/u/206497492?s=100&v=4">
|
|
4
|
+
<a>
|
|
5
|
+
|
|
6
|
+
<h2>Sprocket UI React - Button</h2>
|
|
7
|
+
|
|
8
|
+
<p>Sprocket's standalone button component for React based projects.</p>
|
|
9
|
+
|
|
10
|
+
<a aria-label="Corinvo" href="https://corinvo.github.io">
|
|
11
|
+
<img src="https://img.shields.io/badge/Made%20by-Corinvo-black.svg?style=for-the-badge&color=black">
|
|
12
|
+
</a>
|
|
13
|
+
<a href="https://www.npmjs.com/package/@sprocketui-react/button">
|
|
14
|
+
<img alt="NPM version" src="https://img.shields.io/npm/v/@sprocketui-react/button.svg?style=for-the-badge">
|
|
15
|
+
</a>
|
|
16
|
+
<a aria-label="License" href="https://github.com/sprocketui/NodeKit/blob/main/LICENSE">
|
|
17
|
+
<img src="https://img.shields.io/badge/License-MIT-97CA25.svg?style=for-the-badge">
|
|
18
|
+
</a>
|
|
19
|
+
</div>
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var L=Object.defineProperty;var K=Object.getOwnPropertyDescriptor;var Q=Object.getOwnPropertyNames;var Y=Object.prototype.hasOwnProperty;var Z=(t,e)=>{for(var s in e)L(t,s,{get:e[s],enumerable:!0})},tt=(t,e,s,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of Q(e))!Y.call(t,n)&&n!==s&&L(t,n,{get:()=>e[n],enumerable:!(i=K(e,n))||i.enumerable});return t};var et=t=>tt(L({},"__esModule",{value:!0}),t);var ot={};Z(ot,{Button:()=>C,ButtonContext:()=>a,SprocketButton:()=>C,SprocketButtonContext:()=>a,useButton:()=>B,useButtonContext:()=>g,useSprocketButton:()=>B,useSprocketButtonContext:()=>g});module.exports=et(ot);var p=require("@necto-react/hooks"),u=require("@necto/dom"),A=require("@necto/mergers"),M=require("@necto-react/helpers"),E=require("shared"),H=u.HTMLElements.Button;function B(t,e){let{rel:s,href:i,target:n,autoFocus:f,focusDisabled:d,preventFocusOnPress:k,isDisabled:o=!1,type:b="button",as:x=H,elementType:r=x||H,onClick:l,onPress:R,onPressStart:y,onPressEnd:T,onPressUp:c,onPressChange:j}=t,F;r===u.HTMLElements.Button?F={type:b,disabled:o}:F={role:"button",href:r===u.HTMLElements.A&&!o?i:void 0,target:r===u.HTMLElements.A?n:void 0,type:r===u.HTMLElements.Input?b:void 0,disabled:r===u.HTMLElements.Input?o:void 0,"aria-disabled":!o||r===u.HTMLElements.Input?void 0:o,rel:r===u.HTMLElements.A?s:void 0};let{hoverProps:V,isHovered:G}=(0,p.useHover)({...t,isDisabled:o}),{focusProps:W,isFocused:X,isFocusVisible:$}=(0,p.useFocusRing)({autoFocus:f}),{focusableProps:O}=(0,p.useFocusable)(t,e),{pressProps:q,isPressed:z}=(0,p.usePress)({ref:e,isDisabled:o,preventFocusOnPress:k,onPressStart:y,onPressEnd:T,onPressChange:j,onPress:R,onPressUp:c,onClick:l});d&&(O.tabIndex=o?-1:O.tabIndex);let J=(0,A.mergeProps)(O,q,V,W,(0,M.filterDOMProps)(t,{allowLabelableProps:!0,allowedLabelableProps:new Set([]),allowedLinkProps:new Set(E.ANCHOR_ELEMENT_PROPS),extraAllowedProps:new Set(E.ALLOWED_EXTERNAL_PROPS)}));return{isFocused:X,isPressed:z,isHovered:G,isDisabled:o,isFocusVisible:$,elementType:r,buttonProps:(0,A.mergeProps)(J,F)}}var S=require("react"),a=(0,S.createContext)(null);var U=require("react");function g(){return(0,U.useContext)(a)}var w=require("@necto/strings"),I=require("@necto/mergers"),P=require("react"),N=require("shared"),D=require("@necto-react/components");var m=require("@necto-react/hooks"),h=require("react/jsx-runtime"),_="Button";function v(t,e){[t,e]=(0,m.useContextProps)({props:t,ref:e,context:a});let{buttonProps:s,isHovered:i,isPressed:n,isFocused:f,isDisabled:d,elementType:k,isFocusVisible:o}=B(t,e),b=(0,m.useId)({defaultId:s.id}),x=(0,m.useRenderer)({...t,values:{isHovered:i,isPressed:n,isFocused:f,isFocusVisible:o,isDisabled:d},defaultClassName:(0,N.buildInternalIdentifier)({component:_}),style:l=>({...t.style instanceof Function?t.style(l):t.style})}),r=(0,P.useMemo)(()=>{let l={hover:i,focus:f,focusVisible:o,disabled:d,pressed:n},R={},y=[];for(let[T,c]of Object.entries(l))typeof c=="boolean"&&(R[`data-${(0,w.kebabCase)(T)}`]=c?String(!0):void 0,c&&y.push((0,w.kebabCase)(T)));return{...R,"data-sprocket-state":y.join(" ")}},[i,f,o,d,n]);return(0,h.jsxs)(D.Primitive,{ref:e,as:k,...x,...(0,I.mergeProps)(s,r),id:b,slot:t.slot||void 0,children:["''",x.children]})}var C=Object.assign((0,P.forwardRef)((t,e)=>v(t,e)),{Root:(0,P.forwardRef)((t,e)=>v(t,e))});C.displayName=_;0&&(module.exports={Button,ButtonContext,SprocketButton,SprocketButtonContext,useButton,useButtonContext,useSprocketButton,useSprocketButtonContext});
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { ElementType, HTMLAttributes, RefObject, Context, ForwardRefExoticComponent, RefAttributes } from 'react';
|
|
2
|
+
import { ButtonOptions } from '@sprocketui-types/button';
|
|
3
|
+
import { RenderProps } from '@necto-react/types';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Copyright (c) Corinvo, LLC. and affiliates.
|
|
7
|
+
*
|
|
8
|
+
* This source code is licensed under the MIT license found in the
|
|
9
|
+
* LICENSE file in the root directory of this source tree.
|
|
10
|
+
*
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
interface UseButtonProps<T extends ElementType> extends ButtonOptions<T> {
|
|
14
|
+
elementType?: string;
|
|
15
|
+
preventFocusOnPress?: boolean;
|
|
16
|
+
href?: string;
|
|
17
|
+
target?: string;
|
|
18
|
+
rel?: string;
|
|
19
|
+
isDisabled?: boolean;
|
|
20
|
+
onClick?: (e: any) => void;
|
|
21
|
+
onPress?: (e: any) => void;
|
|
22
|
+
onPressStart?: (e: any) => void;
|
|
23
|
+
onPressEnd?: (e: any) => void;
|
|
24
|
+
onPressUp?: (e: any) => void;
|
|
25
|
+
onPressChange?: (isPressed: boolean) => void;
|
|
26
|
+
}
|
|
27
|
+
type ButtonHookReturn<T extends ElementType> = Readonly<{
|
|
28
|
+
elementType: T;
|
|
29
|
+
buttonProps: HTMLAttributes<any>;
|
|
30
|
+
isPressed: boolean;
|
|
31
|
+
isHovered: boolean;
|
|
32
|
+
isFocused: boolean;
|
|
33
|
+
isDisabled: boolean;
|
|
34
|
+
isFocusVisible: boolean;
|
|
35
|
+
}>;
|
|
36
|
+
|
|
37
|
+
declare const DEFAULT_BUTTON_TAG: keyof HTMLElementTagNameMap;
|
|
38
|
+
/**
|
|
39
|
+
* React hook that provides all necessary props and state for a headless button component.
|
|
40
|
+
*
|
|
41
|
+
* @template T The element type to render as (e.g., 'button', 'a', 'input').
|
|
42
|
+
* @param {UseButtonProps<T>} props - The props for configuring the button's behavior and accessibility.
|
|
43
|
+
* @param {RefObject<any>} ref - The ref to the button element.
|
|
44
|
+
* @returns {ButtonHookReturn<T>} An object containing readonly state and props for the button element.
|
|
45
|
+
*/
|
|
46
|
+
declare function useButton<T extends ElementType = typeof DEFAULT_BUTTON_TAG>(props: UseButtonProps<T>, ref: RefObject<any>): ButtonHookReturn<T>;
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Copyright (c) Corinvo, LLC. and affiliates.
|
|
50
|
+
*
|
|
51
|
+
* This source code is licensed under the MIT license found in the
|
|
52
|
+
* LICENSE file in the root directory of this source tree.
|
|
53
|
+
*
|
|
54
|
+
*/
|
|
55
|
+
|
|
56
|
+
declare const ButtonContext: Context<any>;
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Copyright (c) Corinvo, LLC. and affiliates.
|
|
60
|
+
*
|
|
61
|
+
* This source code is licensed under the MIT license found in the
|
|
62
|
+
* LICENSE file in the root directory of this source tree.
|
|
63
|
+
*
|
|
64
|
+
*/
|
|
65
|
+
declare function useButtonContext(): any;
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Copyright (c) Corinvo, LLC. and affiliates.
|
|
69
|
+
*
|
|
70
|
+
* This source code is licensed under the MIT license found in the
|
|
71
|
+
* LICENSE file in the root directory of this source tree.
|
|
72
|
+
*
|
|
73
|
+
*/
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Props for the Button component.
|
|
77
|
+
*/
|
|
78
|
+
interface ButtonProps extends ButtonOptions<ElementType>, RenderProps<any>, UseButtonProps<ElementType> {
|
|
79
|
+
slot?: string | null;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* The public Button component for Sprocket UI.
|
|
84
|
+
*
|
|
85
|
+
* @param {ButtonProps} props - The props for the Button component.
|
|
86
|
+
* @param {ForwardedRef<HTMLButtonElement>} ref - The forwarded ref for the button element.
|
|
87
|
+
* @returns {ReactElement | null} The rendered button element or null.
|
|
88
|
+
*/
|
|
89
|
+
declare const Button: ForwardRefExoticComponent<Omit<ButtonProps, 'ref'> & RefAttributes<HTMLButtonElement>> & {
|
|
90
|
+
Root: ForwardRefExoticComponent<Omit<ButtonProps, 'ref'> & RefAttributes<HTMLButtonElement>>;
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
export { Button, ButtonContext, type ButtonProps, Button as SprocketButton, ButtonContext as SprocketButtonContext, type ButtonProps as SprocketButtonProps, type UseButtonProps, type UseButtonProps as UseSprocketButtonProps, useButton, useButtonContext, useButton as useSprocketButton, useButtonContext as useSprocketButtonContext };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,67 +1,93 @@
|
|
|
1
|
+
import { ElementType, HTMLAttributes, RefObject, Context, ForwardRefExoticComponent, RefAttributes } from 'react';
|
|
2
|
+
import { ButtonOptions } from '@sprocketui-types/button';
|
|
3
|
+
import { RenderProps } from '@necto-react/types';
|
|
4
|
+
|
|
1
5
|
/**
|
|
2
|
-
* Copyright (c) Corinvo, LLC. and affiliates.
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the MIT license found in the
|
|
6
|
+
* Copyright (c) Corinvo, LLC. and affiliates.
|
|
7
|
+
*
|
|
8
|
+
* This source code is licensed under the MIT license found in the
|
|
5
9
|
* LICENSE file in the root directory of this source tree.
|
|
6
|
-
*
|
|
10
|
+
*
|
|
7
11
|
*/
|
|
8
12
|
|
|
9
|
-
|
|
10
|
-
import { ElementType, ComponentPropsWithoutRef, RefObject, HTMLAttributes } from 'react';
|
|
11
|
-
|
|
12
|
-
declare enum ButtonTypeValues {
|
|
13
|
-
Button = "button",
|
|
14
|
-
Submit = "submit",
|
|
15
|
-
Reset = "reset"
|
|
16
|
-
}
|
|
17
|
-
type ButtonTypes = `${ButtonTypeValues}`;
|
|
18
|
-
|
|
19
|
-
declare const DEFAULT_BUTTON_TAG$1: "button";
|
|
20
|
-
type ButtonProps<TTag extends ElementType = typeof DEFAULT_BUTTON_TAG$1> = ComponentPropsWithoutRef<TTag> & {
|
|
21
|
-
as?: TTag;
|
|
22
|
-
type?: ButtonTypes;
|
|
23
|
-
disabled?: boolean;
|
|
24
|
-
autoFocus?: boolean;
|
|
25
|
-
slot?: Record<string, any>;
|
|
26
|
-
};
|
|
27
|
-
declare const Button: react.ForwardRefExoticComponent<Omit<ButtonProps<ElementType>, "ref"> & react.RefAttributes<"symbol" | "object" | "a" | "abbr" | "address" | "area" | "article" | "aside" | "audio" | "b" | "base" | "bdi" | "bdo" | "big" | "blockquote" | "body" | "br" | "button" | "canvas" | "caption" | "center" | "cite" | "code" | "col" | "colgroup" | "data" | "datalist" | "dd" | "del" | "details" | "dfn" | "dialog" | "div" | "dl" | "dt" | "em" | "embed" | "fieldset" | "figcaption" | "figure" | "footer" | "form" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "head" | "header" | "hgroup" | "hr" | "html" | "i" | "iframe" | "img" | "input" | "ins" | "kbd" | "keygen" | "label" | "legend" | "li" | "link" | "main" | "map" | "mark" | "menu" | "menuitem" | "meta" | "meter" | "nav" | "noindex" | "noscript" | "ol" | "optgroup" | "option" | "output" | "p" | "param" | "picture" | "pre" | "progress" | "q" | "rp" | "rt" | "ruby" | "s" | "samp" | "search" | "slot" | "script" | "section" | "select" | "small" | "source" | "span" | "strong" | "style" | "sub" | "summary" | "sup" | "table" | "template" | "tbody" | "td" | "textarea" | "tfoot" | "th" | "thead" | "time" | "title" | "tr" | "track" | "u" | "ul" | "var" | "video" | "wbr" | "webview" | "svg" | "animate" | "animateMotion" | "animateTransform" | "circle" | "clipPath" | "defs" | "desc" | "ellipse" | "feBlend" | "feColorMatrix" | "feComponentTransfer" | "feComposite" | "feConvolveMatrix" | "feDiffuseLighting" | "feDisplacementMap" | "feDistantLight" | "feDropShadow" | "feFlood" | "feFuncA" | "feFuncB" | "feFuncG" | "feFuncR" | "feGaussianBlur" | "feImage" | "feMerge" | "feMergeNode" | "feMorphology" | "feOffset" | "fePointLight" | "feSpecularLighting" | "feSpotLight" | "feTile" | "feTurbulence" | "filter" | "foreignObject" | "g" | "image" | "line" | "linearGradient" | "marker" | "mask" | "metadata" | "mpath" | "path" | "pattern" | "polygon" | "polyline" | "radialGradient" | "rect" | "set" | "stop" | "switch" | "text" | "textPath" | "tspan" | "use" | "view" | react.ComponentClass<any, any> | react.FunctionComponent<any>>> & {
|
|
28
|
-
Root: react.ForwardRefExoticComponent<Omit<ButtonProps<ElementType>, "ref"> & react.RefAttributes<"symbol" | "object" | "a" | "abbr" | "address" | "area" | "article" | "aside" | "audio" | "b" | "base" | "bdi" | "bdo" | "big" | "blockquote" | "body" | "br" | "button" | "canvas" | "caption" | "center" | "cite" | "code" | "col" | "colgroup" | "data" | "datalist" | "dd" | "del" | "details" | "dfn" | "dialog" | "div" | "dl" | "dt" | "em" | "embed" | "fieldset" | "figcaption" | "figure" | "footer" | "form" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "head" | "header" | "hgroup" | "hr" | "html" | "i" | "iframe" | "img" | "input" | "ins" | "kbd" | "keygen" | "label" | "legend" | "li" | "link" | "main" | "map" | "mark" | "menu" | "menuitem" | "meta" | "meter" | "nav" | "noindex" | "noscript" | "ol" | "optgroup" | "option" | "output" | "p" | "param" | "picture" | "pre" | "progress" | "q" | "rp" | "rt" | "ruby" | "s" | "samp" | "search" | "slot" | "script" | "section" | "select" | "small" | "source" | "span" | "strong" | "style" | "sub" | "summary" | "sup" | "table" | "template" | "tbody" | "td" | "textarea" | "tfoot" | "th" | "thead" | "time" | "title" | "tr" | "track" | "u" | "ul" | "var" | "video" | "wbr" | "webview" | "svg" | "animate" | "animateMotion" | "animateTransform" | "circle" | "clipPath" | "defs" | "desc" | "ellipse" | "feBlend" | "feColorMatrix" | "feComponentTransfer" | "feComposite" | "feConvolveMatrix" | "feDiffuseLighting" | "feDisplacementMap" | "feDistantLight" | "feDropShadow" | "feFlood" | "feFuncA" | "feFuncB" | "feFuncG" | "feFuncR" | "feGaussianBlur" | "feImage" | "feMerge" | "feMergeNode" | "feMorphology" | "feOffset" | "fePointLight" | "feSpecularLighting" | "feSpotLight" | "feTile" | "feTurbulence" | "filter" | "foreignObject" | "g" | "image" | "line" | "linearGradient" | "marker" | "mask" | "metadata" | "mpath" | "path" | "pattern" | "polygon" | "polyline" | "radialGradient" | "rect" | "set" | "stop" | "switch" | "text" | "textPath" | "tspan" | "use" | "view" | react.ComponentClass<any, any> | react.FunctionComponent<any>>>;
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
declare const DEFAULT_BUTTON_TAG: "button";
|
|
32
|
-
interface UseButtonProps<TTag extends ElementType = typeof DEFAULT_BUTTON_TAG> {
|
|
33
|
-
as?: TTag;
|
|
34
|
-
type?: ButtonTypes;
|
|
35
|
-
disabled?: boolean;
|
|
36
|
-
isDisabled?: boolean;
|
|
37
|
-
autoFocus?: boolean;
|
|
38
|
-
slot?: Record<string, any>;
|
|
13
|
+
interface UseButtonProps<T extends ElementType> extends ButtonOptions<T> {
|
|
39
14
|
elementType?: string;
|
|
40
15
|
preventFocusOnPress?: boolean;
|
|
41
|
-
allowFocusWhenDisabled?: boolean;
|
|
42
16
|
href?: string;
|
|
43
17
|
target?: string;
|
|
44
18
|
rel?: string;
|
|
19
|
+
isDisabled?: boolean;
|
|
45
20
|
onClick?: (e: any) => void;
|
|
46
21
|
onPress?: (e: any) => void;
|
|
47
22
|
onPressStart?: (e: any) => void;
|
|
48
23
|
onPressEnd?: (e: any) => void;
|
|
49
24
|
onPressUp?: (e: any) => void;
|
|
50
25
|
onPressChange?: (isPressed: boolean) => void;
|
|
51
|
-
[key: string]: any;
|
|
52
26
|
}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
combinedSlot: Record<string, any>;
|
|
27
|
+
type ButtonHookReturn<T extends ElementType> = Readonly<{
|
|
28
|
+
elementType: T;
|
|
29
|
+
buttonProps: HTMLAttributes<any>;
|
|
57
30
|
isPressed: boolean;
|
|
58
31
|
isHovered: boolean;
|
|
59
32
|
isFocused: boolean;
|
|
60
|
-
isFocusVisible: boolean;
|
|
61
33
|
isDisabled: boolean;
|
|
62
|
-
|
|
34
|
+
isFocusVisible: boolean;
|
|
35
|
+
}>;
|
|
36
|
+
|
|
37
|
+
declare const DEFAULT_BUTTON_TAG: keyof HTMLElementTagNameMap;
|
|
38
|
+
/**
|
|
39
|
+
* React hook that provides all necessary props and state for a headless button component.
|
|
40
|
+
*
|
|
41
|
+
* @template T The element type to render as (e.g., 'button', 'a', 'input').
|
|
42
|
+
* @param {UseButtonProps<T>} props - The props for configuring the button's behavior and accessibility.
|
|
43
|
+
* @param {RefObject<any>} ref - The ref to the button element.
|
|
44
|
+
* @returns {ButtonHookReturn<T>} An object containing readonly state and props for the button element.
|
|
45
|
+
*/
|
|
46
|
+
declare function useButton<T extends ElementType = typeof DEFAULT_BUTTON_TAG>(props: UseButtonProps<T>, ref: RefObject<any>): ButtonHookReturn<T>;
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Copyright (c) Corinvo, LLC. and affiliates.
|
|
50
|
+
*
|
|
51
|
+
* This source code is licensed under the MIT license found in the
|
|
52
|
+
* LICENSE file in the root directory of this source tree.
|
|
53
|
+
*
|
|
54
|
+
*/
|
|
55
|
+
|
|
56
|
+
declare const ButtonContext: Context<any>;
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Copyright (c) Corinvo, LLC. and affiliates.
|
|
60
|
+
*
|
|
61
|
+
* This source code is licensed under the MIT license found in the
|
|
62
|
+
* LICENSE file in the root directory of this source tree.
|
|
63
|
+
*
|
|
64
|
+
*/
|
|
65
|
+
declare function useButtonContext(): any;
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Copyright (c) Corinvo, LLC. and affiliates.
|
|
69
|
+
*
|
|
70
|
+
* This source code is licensed under the MIT license found in the
|
|
71
|
+
* LICENSE file in the root directory of this source tree.
|
|
72
|
+
*
|
|
73
|
+
*/
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Props for the Button component.
|
|
77
|
+
*/
|
|
78
|
+
interface ButtonProps extends ButtonOptions<ElementType>, RenderProps<any>, UseButtonProps<ElementType> {
|
|
79
|
+
slot?: string | null;
|
|
63
80
|
}
|
|
64
|
-
declare function useButton<TTag extends ElementType = typeof DEFAULT_BUTTON_TAG>(props: UseButtonProps<TTag>, ref: RefObject<HTMLElement> | undefined): UseButtonResult<TTag>;
|
|
65
81
|
|
|
66
|
-
|
|
67
|
-
|
|
82
|
+
/**
|
|
83
|
+
* The public Button component for Sprocket UI.
|
|
84
|
+
*
|
|
85
|
+
* @param {ButtonProps} props - The props for the Button component.
|
|
86
|
+
* @param {ForwardedRef<HTMLButtonElement>} ref - The forwarded ref for the button element.
|
|
87
|
+
* @returns {ReactElement | null} The rendered button element or null.
|
|
88
|
+
*/
|
|
89
|
+
declare const Button: ForwardRefExoticComponent<Omit<ButtonProps, 'ref'> & RefAttributes<HTMLButtonElement>> & {
|
|
90
|
+
Root: ForwardRefExoticComponent<Omit<ButtonProps, 'ref'> & RefAttributes<HTMLButtonElement>>;
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
export { Button, ButtonContext, type ButtonProps, Button as SprocketButton, ButtonContext as SprocketButtonContext, type ButtonProps as SprocketButtonProps, type UseButtonProps, type UseButtonProps as UseSprocketButtonProps, useButton, useButtonContext, useButton as useSprocketButton, useButtonContext as useSprocketButtonContext };
|