@cruxkit/button 0.0.1

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Maysara Elshewehy (https://github.com/maysara-elshewehy)
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,212 @@
1
+ <!-- ╔══════════════════════════════ BEG ══════════════════════════════╗ -->
2
+
3
+ <br>
4
+ <div align="center">
5
+ <p>
6
+ <img src="./assets/img/logo.png" alt="logo" style="" height="60" />
7
+ </p>
8
+ </div>
9
+
10
+ <div align="center">
11
+ <img src="https://img.shields.io/badge/v-0.0.1-black"/>
12
+ <a href="https://github.com/cruxkit-org"><img src="https://img.shields.io/badge/🔥-@cruxkit-black"/></a>
13
+ <br>
14
+ <img src="https://img.shields.io/badge/coverage-99%25-brightgreen" alt="Test Coverage" />
15
+ <img src="https://img.shields.io/github/issues/cruxkit-orgz/button?style=flat" alt="Github Repo Issues" />
16
+ <img src="https://img.shields.io/github/stars/cruxkit-orgz/button?style=social" alt="GitHub Repo stars" />
17
+ </div>
18
+ <br>
19
+
20
+ <!-- ╚═════════════════════════════════════════════════════════════════╝ -->
21
+
22
+
23
+
24
+ <!-- ╔══════════════════════════════ DOC ══════════════════════════════╗ -->
25
+
26
+ - ## Overview 👀
27
+ - #### Why ?
28
+ > A small, focused Button primitive for the **Cruxkit** ecosystem. It exposes a
29
+ > single, strongly‑typed API that works across apps, sites, and design systems
30
+ > built on `@minejs/jsx`, so you don’t reimplement button variants, sizes, and
31
+ > states in every project.
32
+
33
+ - #### When ?
34
+ > Use it whenever you need a consistent, theme‑aware button: primary actions,
35
+ > subtle ghost or outline actions, link‑styled buttons, or full‑width CTAs. It
36
+ > fits best in projects already using `@cruxkit/container`, `@cruxkit/text`, and
37
+ > `@cruxkit/icon`.
38
+
39
+ <br>
40
+ <br>
41
+
42
+ - ## Quick Start 🔥
43
+
44
+ > install [`hmm`](https://github.com/minejs-org/hmm) first.
45
+
46
+ ```bash
47
+ # in your terminal
48
+ hmm i @cruxkit/button
49
+ ```
50
+
51
+ ```ts
52
+ // in your ts files
53
+ import { Button } from `@cruxkit/button`;
54
+ ```
55
+
56
+ <div align="center"> <img src="./assets/img/line.png" alt="line" style="display: block; margin-top:20px;margin-bottom:20px;width:500px;"/> </div>
57
+ <br>
58
+
59
+
60
+ - ### Basic usage
61
+
62
+ ```tsx
63
+ <Button>
64
+ Click me
65
+ </Button>
66
+ ```
67
+
68
+ - ### With options
69
+
70
+ ```tsx
71
+ <Button variant="solid" color="brand" size="md">
72
+ Save
73
+ </Button>
74
+
75
+ <Button
76
+ variant="outline"
77
+ color="success"
78
+ size="sm"
79
+ fullWidth
80
+ leftIcon="check"
81
+ rightIcon={{ name: 'arrow-right' }}
82
+ >
83
+ Continue
84
+ </Button>
85
+
86
+ <Button
87
+ as="a"
88
+ href="https://example.com"
89
+ variant="link"
90
+ color="brand"
91
+ >
92
+ Learn more
93
+ </Button>
94
+ ```
95
+
96
+ <br>
97
+ <br>
98
+
99
+ - ## Documentation 📑
100
+
101
+
102
+ - ### API ⛓️
103
+
104
+ - #### Functions
105
+
106
+ ```tsx
107
+ /**
108
+ * A polymorphic button component that supports multiple variants, colors, sizes, and states.
109
+ *
110
+ * @param props - The properties for the Button component.
111
+ * @param props.variant - Visual style variant: `'solid' | 'outline' | 'ghost' | 'link'`.
112
+ * @param props.color - Color theme: `'brand' | 'success' | 'warning' | 'error' | 'neutral'`.
113
+ * @param props.size - Size scale: `'sm' | 'md' | 'lg'`.
114
+ * @param props.fullWidth - Whether the button spans the full width of its container.
115
+ * @param props.disabled - Whether the button is disabled.
116
+ * @param props.loading - Whether the button is in a loading state (disables interaction).
117
+ * @param props.leftIcon - Optional icon placed to the left of the label (string name or IconProps).
118
+ * @param props.rightIcon - Optional icon placed to the right of the label (string name or IconProps).
119
+ * @param props.as - Element type to render: `'button' | 'a' | any polymorphic component`.
120
+ * @param props.children - Button label content.
121
+ * @param props.className - Additional CSS classes appended to the built-in styles.
122
+ * @param props.type - HTML button type attribute (only applied when `as="button"`).
123
+ * @param props.restProps - Any other props are forwarded to the underlying element.
124
+ *
125
+ * @returns A JSX element representing the styled button.
126
+ */
127
+ export function Button(props: ButtonProps): JSXElement
128
+ ```
129
+
130
+ - #### Types
131
+
132
+ ```tsx
133
+ export type IconSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'xxl' | number;
134
+
135
+ export type IconData = Record<string, unknown>;
136
+ export { iconCatalog };
137
+ export type IconName = CatalogIconName;
138
+
139
+ interface IconConfigBase {
140
+ size? : IconSize
141
+ color? : string
142
+ spin? : boolean
143
+ pulse? : boolean
144
+ rotate? : 0 | 90 | 180 | 270
145
+ flip? : 'horizontal' | 'vertical' | 'both'
146
+ [key: string] : unknown
147
+ }
148
+
149
+ export interface NamedIconConfig extends IconConfigBase {
150
+ name : IconName
151
+ svg? : never
152
+ viewBox? : never
153
+ }
154
+
155
+ export interface CustomIconConfig extends IconConfigBase {
156
+ name? : string
157
+ svg : string
158
+ viewBox? : string
159
+ }
160
+
161
+ export type IconConfig = NamedIconConfig | CustomIconConfig;
162
+
163
+ export type IconProps = IconConfig | IconName;
164
+ ```
165
+
166
+ - #### Constants
167
+
168
+ ```tsx
169
+ export const sizeMap: Record<string, string> = {
170
+ xs : '0.75rem',
171
+ sm : '1rem',
172
+ md : '1.25rem',
173
+ lg : '1.5rem',
174
+ xl : '2rem',
175
+ xxl : '2.5rem'
176
+ };
177
+ ```
178
+
179
+ <div align="center"> <img src="./assets/img/line.png" alt="line" style="display: block; margin-top:20px;margin-bottom:20px;width:500px;"/> </div>
180
+ <br>
181
+
182
+ - ### Related 🔗
183
+
184
+ - ##### [@minejs/jsx](https://github.com/minejs-org/jsx)
185
+
186
+ - ##### [@mineui/utils](https://github.com/mineui-org/utils)
187
+
188
+ - ##### [@cruxkit/text](https://github.com/cruxkit-org/text)
189
+
190
+ - ##### [@cruxkit/icon](https://github.com/cruxkit-org/icon)
191
+
192
+ - ##### [@cruxkit/container](https://github.com/cruxkit-org/container)
193
+
194
+ - ##### [@cruxkit/..](https://github.com/cruxkit-org)
195
+
196
+
197
+ <!-- ╚═════════════════════════════════════════════════════════════════╝ -->
198
+
199
+
200
+
201
+ <!-- ╔══════════════════════════════ END ══════════════════════════════╗ -->
202
+
203
+ <br>
204
+ <br>
205
+
206
+ ---
207
+
208
+ <div align="center">
209
+ <a href="https://github.com/maysara-elshewehy"><img src="https://img.shields.io/badge/by-Maysara-black"/></a>
210
+ </div>
211
+
212
+ <!-- ╚═════════════════════════════════════════════════════════════════╝ -->
package/dist/index.cjs ADDED
@@ -0,0 +1,2 @@
1
+ 'use strict';var container=require('@cruxkit/container'),text=require('@cruxkit/text'),icon=require('@cruxkit/icon'),jsxRuntime=require('@minejs/jsx/jsx-runtime');var T={sm:{px:3,py:1},md:{px:4,py:2},lg:{px:6,py:3}},E={sm:1,md:2,lg:2},J={sm:"sm",md:"md",lg:"lg"},M={sm:"sm",md:"md",lg:"lg"},X={solid:{brand:["bg-brand","text-inverse","border","border-transparent","hover:bg-brand-hover","active:bg-brand-active","active:scale-95","shadow-sm","hover:shadow-md"],success:["bg-success","text-inverse","border","border-transparent","hover:bg-success-hover","active:bg-success-active","active:scale-95","shadow-sm","hover:shadow-md"],warning:["bg-warning","text-inverse","border","border-transparent","hover:bg-warning-hover","active:bg-warning-active","active:scale-95","shadow-sm","hover:shadow-md"],error:["bg-error","text-inverse","border","border-transparent","hover:bg-error-hover","active:bg-error-active","active:scale-95","shadow-sm","hover:shadow-md"],neutral:["bg-surface","text-1","border","border-1","hover:bg-raised","active:bg-tertiary","active:scale-95","shadow-sm","hover:shadow-md"]},outline:{brand:["bg-transparent","text-brand","border","border-brand","hover:bg-brand-subtle","active:bg-brand-subtle","active:scale-95"],success:["bg-transparent","text-success","border","border-success","hover:bg-success-subtle","active:bg-success-subtle","active:scale-95"],warning:["bg-transparent","text-warning","border","border-warning","hover:bg-warning-subtle","active:bg-warning-subtle","active:scale-95"],error:["bg-transparent","text-error","border","border-error","hover:bg-error-subtle","active:bg-error-subtle","active:scale-95"],neutral:["bg-transparent","text-1","border","border-1","hover:bg-raised","active:bg-tertiary","active:scale-95"]},ghost:{brand:["bg-transparent","text-brand","border","border-transparent","hover:bg-brand-subtle","active:bg-brand-subtle","active:scale-95"],success:["bg-transparent","text-success","border","border-transparent","hover:bg-success-subtle","active:bg-success-subtle","active:scale-95"],warning:["bg-transparent","text-warning","border","border-transparent","hover:bg-warning-subtle","active:bg-warning-subtle","active:scale-95"],error:["bg-transparent","text-error","border","border-transparent","hover:bg-error-subtle","active:bg-error-subtle","active:scale-95"],neutral:["bg-transparent","text-1","border","border-transparent","hover:bg-raised","active:bg-tertiary","active:scale-95"]},link:{brand:["bg-transparent","text-brand","border","border-transparent","hover:underline","underline-offset-4","decoration-2","px-1"],success:["bg-transparent","text-success","border","border-transparent","hover:underline","underline-offset-4","decoration-2","px-1"],warning:["bg-transparent","text-warning","border","border-transparent","hover:underline","underline-offset-4","decoration-2","px-1"],error:["bg-transparent","text-error","border","border-transparent","hover:underline","underline-offset-4","decoration-2","px-1"],neutral:["bg-transparent","text-1","border","border-transparent","hover:underline","underline-offset-4","decoration-2","px-1"]}};function u(e,o){if(!e)return null;let n=M[o];if(typeof e=="string")return jsxRuntime.jsx("span",{className:"inline-flex shrink-0",children:jsxRuntime.jsx(icon.Icon,{name:e,size:n})});let r=e.size??n;return jsxRuntime.jsx("span",{className:"inline-flex shrink-0",children:jsxRuntime.jsx(icon.Icon,{...e,size:r})})}function W(e){let{variant:o="solid",color:n="brand",size:r="md",fullWidth:g=false,disabled:v=false,loading:m=false,leftIcon:f,rightIcon:h,as:c="button",children:s,className:x,type:w="button",...y}=e,z=["inline-flex","items-center","justify-center","font-medium","transition-all","duration-150","select-none","focus:outline-none","focus-visible:ring","focus-visible:ring-offset-2"],i=[];(m||v)&&i.push("opacity-50","cursor-not-allowed","pointer-events-none"),g&&i.push("w-full");let S=X[o][n],B=[...z,...i,...S,x].filter(Boolean).join(" "),b=T[r],I=E[r],C=J[r],a=[],d=u(f,r),l=u(h,r);d&&a.push(d),s!=null&&s!==""&&a.push(jsxRuntime.jsx(text.Text,{as:"span",size:C,children:s})),l&&a.push(l);let P=c==="button"?{type:w}:{};return jsxRuntime.jsx(container.Container,{as:c,display:"inline-flex",align:"center",justify:"center",gap:I,px:b.px,py:b.py,radius:"md",className:B,...P,...y,children:a})}exports.Button=W;//# sourceMappingURL=index.cjs.map
2
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/kit/button.tsx"],"names":["sizePaddingMap","sizeGapMap","labelSizeMap","iconSizeMap","variantClasses","renderIcon","icon","size","iconSize","jsx","Icon","resolvedSize","Button","props","variant","color","fullWidth","disabled","loading","leftIcon","rightIcon","as","children","className","type","restProps","baseClasses","stateClasses","paletteClasses","classes","padding","gap","labelSize","content","left","right","Text","elementTypeProps","Container"],"mappings":"mKAoBI,IAAMA,CAAAA,CAAuE,CACzE,EAAA,CAAI,CAAE,EAAA,CAAI,CAAA,CAAG,EAAA,CAAI,CAAE,CAAA,CACnB,EAAA,CAAI,CAAE,EAAA,CAAI,CAAA,CAAG,GAAI,CAAE,CAAA,CACnB,EAAA,CAAI,CAAE,EAAA,CAAI,CAAA,CAAG,EAAA,CAAI,CAAE,CACvB,CAAA,CAEMC,CAAAA,CAAwC,CAC1C,EAAA,CAAI,CAAA,CACJ,EAAA,CAAI,CAAA,CACJ,GAAI,CACR,CAAA,CAEMC,CAAAA,CAAuD,CACzD,EAAA,CAAI,IAAA,CACJ,EAAA,CAAI,IAAA,CACJ,EAAA,CAAI,IACR,CAAA,CAEMC,CAAAA,CAAsD,CACxD,EAAA,CAAI,IAAA,CACJ,EAAA,CAAI,KACJ,EAAA,CAAI,IACR,CAAA,CAEMC,CAAAA,CAAuE,CACzE,KAAA,CAAO,CACH,KAAA,CAAO,CACH,UAAA,CACA,cAAA,CACA,QAAA,CACA,oBAAA,CACA,sBAAA,CACA,wBAAA,CACA,iBAAA,CACA,YACA,iBACJ,CAAA,CACA,OAAA,CAAS,CACL,YAAA,CACA,cAAA,CACA,QAAA,CACA,oBAAA,CACA,wBAAA,CACA,0BAAA,CACA,iBAAA,CACA,WAAA,CACA,iBACJ,CAAA,CACA,OAAA,CAAS,CACL,aACA,cAAA,CACA,QAAA,CACA,oBAAA,CACA,wBAAA,CACA,0BAAA,CACA,iBAAA,CACA,WAAA,CACA,iBACJ,CAAA,CACA,KAAA,CAAO,CACH,UAAA,CACA,cAAA,CACA,QAAA,CACA,oBAAA,CACA,sBAAA,CACA,yBACA,iBAAA,CACA,WAAA,CACA,iBACJ,CAAA,CACA,OAAA,CAAS,CACL,YAAA,CACA,QAAA,CACA,QAAA,CACA,UAAA,CACA,iBAAA,CACA,oBAAA,CACA,iBAAA,CACA,WAAA,CACA,iBACJ,CAC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AAAA,EAAa,IAAA,EAAQA,CAAAA,GAAa,EAAA,EAC5DW,CAAAA,CAAQ,IAAA,CACJxB,cAAAA,CAAC2B,SAAAA,CAAA,CAAK,EAAA,CAAG,OAAO,IAAA,CAAMJ,CAAAA,CACjB,QAAA,CAAAV,CAAAA,CACL,CACJ,CAAA,CAGAa,CAAAA,EACAF,CAAAA,CAAQ,IAAA,CAAKE,CAAK,CAAA,CAKtB,IAAME,CAAAA,CAFchB,CAAAA,GAGA,QAAA,CACV,CAAE,KAAAG,CAAK,CAAA,CACP,EAAC,CAEX,OACIf,cAAAA,CAAC6B,mBAAAA,CAAA,CACG,EAAA,CAAIjB,CAAAA,CACJ,OAAA,CAAkB,aAAA,CAClB,KAAA,CAAkB,QAAA,CAClB,OAAA,CAAkB,QAAA,CAClB,IAAmBU,CAAAA,CACnB,EAAA,CAAmBD,CAAAA,CAAQ,EAAA,CAC3B,EAAA,CAAmBA,CAAAA,CAAQ,EAAA,CAC3B,MAAA,CAAkB,IAAA,CAClB,SAAA,CAAmBD,CAAAA,CAClB,GAAGQ,CAAAA,CACH,GAAGZ,CAAAA,CAEH,QAAA,CAAAQ,EACL,CAER","file":"index.cjs","sourcesContent":["// src/kit/button.tsx\r\n//\r\n// Made with ❤️ by Maysara.\r\n\r\n\r\n\r\n// ╔════════════════════════════════════════ PACK ════════════════════════════════════════╗\r\n\r\n import type { JSXElement } from '@minejs/jsx';\r\n import { Container } from '@cruxkit/container';\r\n import { Text } from '@cruxkit/text';\r\n import { Icon, type IconProps, type IconName, type IconConfig } from '@cruxkit/icon';\r\n import type { ButtonProps, ButtonSize, ButtonColor, ButtonVariant } from '../types';\r\n\r\n// ╚══════════════════════════════════════════════════════════════════════════════════════╝\r\n\r\n\r\n\r\n// ╔════════════════════════════════════════ INIT ════════════════════════════════════════╗\r\n\r\n const sizePaddingMap: Record<ButtonSize, { px: 3 | 4 | 6; py: 1 | 2 | 3 }> = {\r\n sm: { px: 3, py: 1 },\r\n md: { px: 4, py: 2 },\r\n lg: { px: 6, py: 3 }\r\n };\r\n\r\n const sizeGapMap: Record<ButtonSize, 1 | 2> = {\r\n sm: 1,\r\n md: 2,\r\n lg: 2\r\n };\r\n\r\n const labelSizeMap: Record<ButtonSize, 'sm' | 'md' | 'lg'> = {\r\n sm: 'sm',\r\n md: 'md',\r\n lg: 'lg'\r\n };\r\n\r\n const iconSizeMap: Record<ButtonSize, 'sm' | 'md' | 'lg'> = {\r\n sm: 'sm',\r\n md: 'md',\r\n lg: 'lg'\r\n };\r\n\r\n const variantClasses: Record<ButtonVariant, Record<ButtonColor, string[]>> = {\r\n solid: {\r\n brand: [\r\n 'bg-brand',\r\n 'text-inverse',\r\n 'border',\r\n 'border-transparent',\r\n 'hover:bg-brand-hover',\r\n 'active:bg-brand-active',\r\n 'active:scale-95',\r\n 'shadow-sm',\r\n 'hover:shadow-md'\r\n ],\r\n success: [\r\n 'bg-success',\r\n 'text-inverse',\r\n 'border',\r\n 'border-transparent',\r\n 'hover:bg-success-hover',\r\n 'active:bg-success-active',\r\n 'active:scale-95',\r\n 'shadow-sm',\r\n 'hover:shadow-md'\r\n ],\r\n warning: [\r\n 'bg-warning',\r\n 'text-inverse',\r\n 'border',\r\n 'border-transparent',\r\n 'hover:bg-warning-hover',\r\n 'active:bg-warning-active',\r\n 'active:scale-95',\r\n 'shadow-sm',\r\n 'hover:shadow-md'\r\n ],\r\n error: [\r\n 'bg-error',\r\n 'text-inverse',\r\n 'border',\r\n 'border-transparent',\r\n 'hover:bg-error-hover',\r\n 'active:bg-error-active',\r\n 'active:scale-95',\r\n 'shadow-sm',\r\n 'hover:shadow-md'\r\n ],\r\n neutral: [\r\n 'bg-surface',\r\n 'text-1',\r\n 'border',\r\n 'border-1',\r\n 'hover:bg-raised',\r\n 'active:bg-tertiary',\r\n 'active:scale-95',\r\n 'shadow-sm',\r\n 'hover:shadow-md'\r\n ]\r\n },\r\n outline: {\r\n brand: [\r\n 'bg-transparent',\r\n 'text-brand',\r\n 'border',\r\n 'border-brand',\r\n 'hover:bg-brand-subtle',\r\n 'active:bg-brand-subtle',\r\n 'active:scale-95'\r\n ],\r\n success: [\r\n 'bg-transparent',\r\n 'text-success',\r\n 'border',\r\n 'border-success',\r\n 'hover:bg-success-subtle',\r\n 'active:bg-success-subtle',\r\n 'active:scale-95'\r\n ],\r\n warning: [\r\n 'bg-transparent',\r\n 'text-warning',\r\n 'border',\r\n 'border-warning',\r\n 'hover:bg-warning-subtle',\r\n 'active:bg-warning-subtle',\r\n 'active:scale-95'\r\n ],\r\n error: [\r\n 'bg-transparent',\r\n 'text-error',\r\n 'border',\r\n 'border-error',\r\n 'hover:bg-error-subtle',\r\n 'active:bg-error-subtle',\r\n 'active:scale-95'\r\n ],\r\n neutral: [\r\n 'bg-transparent',\r\n 'text-1',\r\n 'border',\r\n 'border-1',\r\n 'hover:bg-raised',\r\n 'active:bg-tertiary',\r\n 'active:scale-95'\r\n ]\r\n },\r\n ghost: {\r\n brand: [\r\n 'bg-transparent',\r\n 'text-brand',\r\n 'border',\r\n 'border-transparent',\r\n 'hover:bg-brand-subtle',\r\n 'active:bg-brand-subtle',\r\n 'active:scale-95'\r\n ],\r\n success: [\r\n 'bg-transparent',\r\n 'text-success',\r\n 'border',\r\n 'border-transparent',\r\n 'hover:bg-success-subtle',\r\n 'active:bg-success-subtle',\r\n 'active:scale-95'\r\n ],\r\n warning: [\r\n 'bg-transparent',\r\n 'text-warning',\r\n 'border',\r\n 'border-transparent',\r\n 'hover:bg-warning-subtle',\r\n 'active:bg-warning-subtle',\r\n 'active:scale-95'\r\n ],\r\n error: [\r\n 'bg-transparent',\r\n 'text-error',\r\n 'border',\r\n 'border-transparent',\r\n 'hover:bg-error-subtle',\r\n 'active:bg-error-subtle',\r\n 'active:scale-95'\r\n ],\r\n neutral: [\r\n 'bg-transparent',\r\n 'text-1',\r\n 'border',\r\n 'border-transparent',\r\n 'hover:bg-raised',\r\n 'active:bg-tertiary',\r\n 'active:scale-95'\r\n ]\r\n },\r\n link: {\r\n brand: [\r\n 'bg-transparent',\r\n 'text-brand',\r\n 'border',\r\n 'border-transparent',\r\n 'hover:underline',\r\n 'underline-offset-4',\r\n 'decoration-2',\r\n 'px-1'\r\n ],\r\n success: [\r\n 'bg-transparent',\r\n 'text-success',\r\n 'border',\r\n 'border-transparent',\r\n 'hover:underline',\r\n 'underline-offset-4',\r\n 'decoration-2',\r\n 'px-1'\r\n ],\r\n warning: [\r\n 'bg-transparent',\r\n 'text-warning',\r\n 'border',\r\n 'border-transparent',\r\n 'hover:underline',\r\n 'underline-offset-4',\r\n 'decoration-2',\r\n 'px-1'\r\n ],\r\n error: [\r\n 'bg-transparent',\r\n 'text-error',\r\n 'border',\r\n 'border-transparent',\r\n 'hover:underline',\r\n 'underline-offset-4',\r\n 'decoration-2',\r\n 'px-1'\r\n ],\r\n neutral: [\r\n 'bg-transparent',\r\n 'text-1',\r\n 'border',\r\n 'border-transparent',\r\n 'hover:underline',\r\n 'underline-offset-4',\r\n 'decoration-2',\r\n 'px-1'\r\n ]\r\n }\r\n };\r\n\r\n// ╚══════════════════════════════════════════════════════════════════════════════════════╝\r\n\r\n\r\n\r\n// ╔════════════════════════════════════════ CORE ════════════════════════════════════════╗\r\n\r\n function renderIcon(icon: IconProps | IconName | undefined, size: ButtonSize): JSXElement | null {\r\n if (!icon) return null;\r\n\r\n const iconSize = iconSizeMap[size];\r\n\r\n if (typeof icon === 'string') {\r\n return (\r\n <span className=\"inline-flex shrink-0\">\r\n <Icon name={icon as IconName} size={iconSize} />\r\n </span>\r\n );\r\n }\r\n\r\n const resolvedSize = ((icon as IconProps) as IconConfig).size ?? iconSize;\r\n\r\n return (\r\n <span className=\"inline-flex shrink-0\">\r\n <Icon {...icon} size={resolvedSize} />\r\n </span>\r\n );\r\n }\r\n\r\n /**\r\n * A polymorphic button component that supports multiple variants, colors, sizes, and states.\r\n *\r\n * @param props - The properties for the Button component.\r\n * @param props.variant - Visual style variant: `'solid' | 'outline' | 'ghost' | 'link'`.\r\n * @param props.color - Color theme: `'brand' | 'success' | 'warning' | 'error' | 'neutral'`.\r\n * @param props.size - Size scale: `'sm' | 'md' | 'lg'`.\r\n * @param props.fullWidth - Whether the button spans the full width of its container.\r\n * @param props.disabled - Whether the button is disabled.\r\n * @param props.loading - Whether the button is in a loading state (disables interaction).\r\n * @param props.leftIcon - Optional icon placed to the left of the label (string name or IconProps).\r\n * @param props.rightIcon - Optional icon placed to the right of the label (string name or IconProps).\r\n * @param props.as - Element type to render: `'button' | 'a' | any polymorphic component`.\r\n * @param props.children - Button label content.\r\n * @param props.className - Additional CSS classes appended to the built-in styles.\r\n * @param props.type - HTML button type attribute (only applied when `as=\"button\"`).\r\n * @param props.restProps - Any other props are forwarded to the underlying element.\r\n *\r\n * @returns A JSX element representing the styled button.\r\n *\r\n * @example\r\n * ```tsx\r\n * <Button variant=\"solid\" color=\"brand\" size=\"md\" onClick={handleClick}>\r\n * Save\r\n * </Button>\r\n * ```\r\n */\r\n export function Button(props: ButtonProps): JSXElement {\r\n const {\r\n variant = 'solid',\r\n color = 'brand',\r\n size = 'md',\r\n fullWidth = false,\r\n disabled = false,\r\n loading = false,\r\n leftIcon,\r\n rightIcon,\r\n as = 'button',\r\n children,\r\n className,\r\n type = 'button',\r\n ...restProps\r\n } = props;\r\n\r\n const baseClasses = [\r\n 'inline-flex',\r\n 'items-center',\r\n 'justify-center',\r\n 'font-medium',\r\n 'transition-all',\r\n 'duration-150',\r\n 'select-none',\r\n 'focus:outline-none',\r\n 'focus-visible:ring',\r\n 'focus-visible:ring-offset-2'\r\n ];\r\n\r\n const stateClasses = [];\r\n\r\n if (loading || disabled) {\r\n stateClasses.push('opacity-50', 'cursor-not-allowed', 'pointer-events-none');\r\n }\r\n\r\n if (fullWidth) {\r\n stateClasses.push('w-full');\r\n }\r\n\r\n const paletteClasses = variantClasses[variant][color];\r\n\r\n const classes = [\r\n ...baseClasses,\r\n ...stateClasses,\r\n ...paletteClasses,\r\n className\r\n ]\r\n .filter(Boolean)\r\n .join(' ');\r\n\r\n const padding = sizePaddingMap[size];\r\n const gap = sizeGapMap[size];\r\n const labelSize = labelSizeMap[size];\r\n\r\n const content: JSXElement[] = [];\r\n\r\n const left = renderIcon(leftIcon, size);\r\n const right = renderIcon(rightIcon, size);\r\n\r\n if (left) {\r\n content.push(left);\r\n }\r\n\r\n if (children !== undefined && children !== null && children !== '') {\r\n content.push(\r\n <Text as=\"span\" size={labelSize}>\r\n {children}\r\n </Text>\r\n );\r\n }\r\n\r\n if (right) {\r\n content.push(right);\r\n }\r\n\r\n const elementType = as;\r\n\r\n const elementTypeProps =\r\n elementType === 'button'\r\n ? { type }\r\n : {};\r\n\r\n return (\r\n <Container\r\n as={as}\r\n display = \"inline-flex\"\r\n align = \"center\"\r\n justify = \"center\"\r\n gap = {gap}\r\n px = {padding.px}\r\n py = {padding.py}\r\n radius = \"md\"\r\n className = {classes}\r\n {...elementTypeProps}\r\n {...restProps}\r\n >\r\n {content}\r\n </Container>\r\n );\r\n }\r\n\r\n// ╚══════════════════════════════════════════════════════════════════════════════════════╝\r\n"]}
@@ -0,0 +1,61 @@
1
+ import { JSXElement } from '@minejs/jsx';
2
+ import { ContainerAs } from '@cruxkit/container';
3
+ import { IconProps, IconName } from '@cruxkit/icon';
4
+
5
+ type ButtonVariant = 'solid' | 'outline' | 'ghost' | 'link';
6
+ type ButtonColor = 'brand' | 'success' | 'warning' | 'error' | 'neutral';
7
+ type ButtonSize = 'sm' | 'md' | 'lg';
8
+ interface ButtonProps {
9
+ variant?: ButtonVariant;
10
+ color?: ButtonColor;
11
+ size?: ButtonSize;
12
+ fullWidth?: boolean;
13
+ disabled?: boolean;
14
+ loading?: boolean;
15
+ leftIcon?: IconProps | IconName;
16
+ rightIcon?: IconProps | IconName;
17
+ as?: ContainerAs;
18
+ children?: JSXElement | string | number;
19
+ className?: string;
20
+ id?: string;
21
+ type?: 'button' | 'submit' | 'reset';
22
+ href?: string;
23
+ target?: string;
24
+ rel?: string;
25
+ 'aria-label'?: string;
26
+ role?: string;
27
+ onClick?: (e: MouseEvent) => void;
28
+ onMouseEnter?: (e: MouseEvent) => void;
29
+ onMouseLeave?: (e: MouseEvent) => void;
30
+ }
31
+
32
+ /**
33
+ * A polymorphic button component that supports multiple variants, colors, sizes, and states.
34
+ *
35
+ * @param props - The properties for the Button component.
36
+ * @param props.variant - Visual style variant: `'solid' | 'outline' | 'ghost' | 'link'`.
37
+ * @param props.color - Color theme: `'brand' | 'success' | 'warning' | 'error' | 'neutral'`.
38
+ * @param props.size - Size scale: `'sm' | 'md' | 'lg'`.
39
+ * @param props.fullWidth - Whether the button spans the full width of its container.
40
+ * @param props.disabled - Whether the button is disabled.
41
+ * @param props.loading - Whether the button is in a loading state (disables interaction).
42
+ * @param props.leftIcon - Optional icon placed to the left of the label (string name or IconProps).
43
+ * @param props.rightIcon - Optional icon placed to the right of the label (string name or IconProps).
44
+ * @param props.as - Element type to render: `'button' | 'a' | any polymorphic component`.
45
+ * @param props.children - Button label content.
46
+ * @param props.className - Additional CSS classes appended to the built-in styles.
47
+ * @param props.type - HTML button type attribute (only applied when `as="button"`).
48
+ * @param props.restProps - Any other props are forwarded to the underlying element.
49
+ *
50
+ * @returns A JSX element representing the styled button.
51
+ *
52
+ * @example
53
+ * ```tsx
54
+ * <Button variant="solid" color="brand" size="md" onClick={handleClick}>
55
+ * Save
56
+ * </Button>
57
+ * ```
58
+ */
59
+ declare function Button(props: ButtonProps): JSXElement;
60
+
61
+ export { Button, type ButtonColor, type ButtonProps, type ButtonSize, type ButtonVariant };
@@ -0,0 +1,61 @@
1
+ import { JSXElement } from '@minejs/jsx';
2
+ import { ContainerAs } from '@cruxkit/container';
3
+ import { IconProps, IconName } from '@cruxkit/icon';
4
+
5
+ type ButtonVariant = 'solid' | 'outline' | 'ghost' | 'link';
6
+ type ButtonColor = 'brand' | 'success' | 'warning' | 'error' | 'neutral';
7
+ type ButtonSize = 'sm' | 'md' | 'lg';
8
+ interface ButtonProps {
9
+ variant?: ButtonVariant;
10
+ color?: ButtonColor;
11
+ size?: ButtonSize;
12
+ fullWidth?: boolean;
13
+ disabled?: boolean;
14
+ loading?: boolean;
15
+ leftIcon?: IconProps | IconName;
16
+ rightIcon?: IconProps | IconName;
17
+ as?: ContainerAs;
18
+ children?: JSXElement | string | number;
19
+ className?: string;
20
+ id?: string;
21
+ type?: 'button' | 'submit' | 'reset';
22
+ href?: string;
23
+ target?: string;
24
+ rel?: string;
25
+ 'aria-label'?: string;
26
+ role?: string;
27
+ onClick?: (e: MouseEvent) => void;
28
+ onMouseEnter?: (e: MouseEvent) => void;
29
+ onMouseLeave?: (e: MouseEvent) => void;
30
+ }
31
+
32
+ /**
33
+ * A polymorphic button component that supports multiple variants, colors, sizes, and states.
34
+ *
35
+ * @param props - The properties for the Button component.
36
+ * @param props.variant - Visual style variant: `'solid' | 'outline' | 'ghost' | 'link'`.
37
+ * @param props.color - Color theme: `'brand' | 'success' | 'warning' | 'error' | 'neutral'`.
38
+ * @param props.size - Size scale: `'sm' | 'md' | 'lg'`.
39
+ * @param props.fullWidth - Whether the button spans the full width of its container.
40
+ * @param props.disabled - Whether the button is disabled.
41
+ * @param props.loading - Whether the button is in a loading state (disables interaction).
42
+ * @param props.leftIcon - Optional icon placed to the left of the label (string name or IconProps).
43
+ * @param props.rightIcon - Optional icon placed to the right of the label (string name or IconProps).
44
+ * @param props.as - Element type to render: `'button' | 'a' | any polymorphic component`.
45
+ * @param props.children - Button label content.
46
+ * @param props.className - Additional CSS classes appended to the built-in styles.
47
+ * @param props.type - HTML button type attribute (only applied when `as="button"`).
48
+ * @param props.restProps - Any other props are forwarded to the underlying element.
49
+ *
50
+ * @returns A JSX element representing the styled button.
51
+ *
52
+ * @example
53
+ * ```tsx
54
+ * <Button variant="solid" color="brand" size="md" onClick={handleClick}>
55
+ * Save
56
+ * </Button>
57
+ * ```
58
+ */
59
+ declare function Button(props: ButtonProps): JSXElement;
60
+
61
+ export { Button, type ButtonColor, type ButtonProps, type ButtonSize, type ButtonVariant };
package/dist/index.js ADDED
@@ -0,0 +1,2 @@
1
+ import {Container}from'@cruxkit/container';import {Text}from'@cruxkit/text';import {Icon}from'@cruxkit/icon';import {jsx}from'@minejs/jsx/jsx-runtime';var T={sm:{px:3,py:1},md:{px:4,py:2},lg:{px:6,py:3}},E={sm:1,md:2,lg:2},J={sm:"sm",md:"md",lg:"lg"},M={sm:"sm",md:"md",lg:"lg"},X={solid:{brand:["bg-brand","text-inverse","border","border-transparent","hover:bg-brand-hover","active:bg-brand-active","active:scale-95","shadow-sm","hover:shadow-md"],success:["bg-success","text-inverse","border","border-transparent","hover:bg-success-hover","active:bg-success-active","active:scale-95","shadow-sm","hover:shadow-md"],warning:["bg-warning","text-inverse","border","border-transparent","hover:bg-warning-hover","active:bg-warning-active","active:scale-95","shadow-sm","hover:shadow-md"],error:["bg-error","text-inverse","border","border-transparent","hover:bg-error-hover","active:bg-error-active","active:scale-95","shadow-sm","hover:shadow-md"],neutral:["bg-surface","text-1","border","border-1","hover:bg-raised","active:bg-tertiary","active:scale-95","shadow-sm","hover:shadow-md"]},outline:{brand:["bg-transparent","text-brand","border","border-brand","hover:bg-brand-subtle","active:bg-brand-subtle","active:scale-95"],success:["bg-transparent","text-success","border","border-success","hover:bg-success-subtle","active:bg-success-subtle","active:scale-95"],warning:["bg-transparent","text-warning","border","border-warning","hover:bg-warning-subtle","active:bg-warning-subtle","active:scale-95"],error:["bg-transparent","text-error","border","border-error","hover:bg-error-subtle","active:bg-error-subtle","active:scale-95"],neutral:["bg-transparent","text-1","border","border-1","hover:bg-raised","active:bg-tertiary","active:scale-95"]},ghost:{brand:["bg-transparent","text-brand","border","border-transparent","hover:bg-brand-subtle","active:bg-brand-subtle","active:scale-95"],success:["bg-transparent","text-success","border","border-transparent","hover:bg-success-subtle","active:bg-success-subtle","active:scale-95"],warning:["bg-transparent","text-warning","border","border-transparent","hover:bg-warning-subtle","active:bg-warning-subtle","active:scale-95"],error:["bg-transparent","text-error","border","border-transparent","hover:bg-error-subtle","active:bg-error-subtle","active:scale-95"],neutral:["bg-transparent","text-1","border","border-transparent","hover:bg-raised","active:bg-tertiary","active:scale-95"]},link:{brand:["bg-transparent","text-brand","border","border-transparent","hover:underline","underline-offset-4","decoration-2","px-1"],success:["bg-transparent","text-success","border","border-transparent","hover:underline","underline-offset-4","decoration-2","px-1"],warning:["bg-transparent","text-warning","border","border-transparent","hover:underline","underline-offset-4","decoration-2","px-1"],error:["bg-transparent","text-error","border","border-transparent","hover:underline","underline-offset-4","decoration-2","px-1"],neutral:["bg-transparent","text-1","border","border-transparent","hover:underline","underline-offset-4","decoration-2","px-1"]}};function u(e,o){if(!e)return null;let n=M[o];if(typeof e=="string")return jsx("span",{className:"inline-flex shrink-0",children:jsx(Icon,{name:e,size:n})});let r=e.size??n;return jsx("span",{className:"inline-flex shrink-0",children:jsx(Icon,{...e,size:r})})}function W(e){let{variant:o="solid",color:n="brand",size:r="md",fullWidth:g=false,disabled:v=false,loading:m=false,leftIcon:f,rightIcon:h,as:c="button",children:s,className:x,type:w="button",...y}=e,z=["inline-flex","items-center","justify-center","font-medium","transition-all","duration-150","select-none","focus:outline-none","focus-visible:ring","focus-visible:ring-offset-2"],i=[];(m||v)&&i.push("opacity-50","cursor-not-allowed","pointer-events-none"),g&&i.push("w-full");let S=X[o][n],B=[...z,...i,...S,x].filter(Boolean).join(" "),b=T[r],I=E[r],C=J[r],a=[],d=u(f,r),l=u(h,r);d&&a.push(d),s!=null&&s!==""&&a.push(jsx(Text,{as:"span",size:C,children:s})),l&&a.push(l);let P=c==="button"?{type:w}:{};return jsx(Container,{as:c,display:"inline-flex",align:"center",justify:"center",gap:I,px:b.px,py:b.py,radius:"md",className:B,...P,...y,children:a})}export{W as Button};//# sourceMappingURL=index.js.map
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/kit/button.tsx"],"names":["sizePaddingMap","sizeGapMap","labelSizeMap","iconSizeMap","variantClasses","renderIcon","icon","size","iconSize","jsx","Icon","resolvedSize","Button","props","variant","color","fullWidth","disabled","loading","leftIcon","rightIcon","as","children","className","type","restProps","baseClasses","stateClasses","paletteClasses","classes","padding","gap","labelSize","content","left","right","Text","elementTypeProps","Container"],"mappings":"uJAoBI,IAAMA,CAAAA,CAAuE,CACzE,EAAA,CAAI,CAAE,EAAA,CAAI,CAAA,CAAG,EAAA,CAAI,CAAE,CAAA,CACnB,EAAA,CAAI,CAAE,EAAA,CAAI,CAAA,CAAG,GAAI,CAAE,CAAA,CACnB,EAAA,CAAI,CAAE,EAAA,CAAI,CAAA,CAAG,EAAA,CAAI,CAAE,CACvB,CAAA,CAEMC,CAAAA,CAAwC,CAC1C,EAAA,CAAI,CAAA,CACJ,EAAA,CAAI,CAAA,CACJ,GAAI,CACR,CAAA,CAEMC,CAAAA,CAAuD,CACzD,EAAA,CAAI,IAAA,CACJ,EAAA,CAAI,IAAA,CACJ,EAAA,CAAI,IACR,CAAA,CAEMC,CAAAA,CAAsD,CACxD,EAAA,CAAI,IAAA,CACJ,EAAA,CAAI,KACJ,EAAA,CAAI,IACR,CAAA,CAEMC,CAAAA,CAAuE,CACzE,KAAA,CAAO,CACH,KAAA,CAAO,CACH,UAAA,CACA,cAAA,CACA,QAAA,CACA,oBAAA,CACA,sBAAA,CACA,wBAAA,CACA,iBAAA,CACA,YACA,iBACJ,CAAA,CACA,OAAA,CAAS,CACL,YAAA,CACA,cAAA,CACA,QAAA,CACA,oBAAA,CACA,wBAAA,CACA,0BAAA,CACA,iBAAA,CACA,WAAA,CACA,iBACJ,CAAA,CACA,OAAA,CAAS,CACL,aACA,cAAA,CACA,QAAA,CACA,oBAAA,CACA,wBAAA,CACA,0BAAA,CACA,iBAAA,CACA,WAAA,CACA,iBACJ,CAAA,CACA,KAAA,CAAO,CACH,UAAA,CACA,cAAA,CACA,QAAA,CACA,oBAAA,CACA,sBAAA,CACA,yBACA,iBAAA,CACA,WAAA,CACA,iBACJ,CAAA,CACA,OAAA,CAAS,CACL,YAA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AAA,CAAWb,CAAI,CAAA,CAEpC2B,CAAAA,EACAD,CAAAA,CAAQ,IAAA,CAAKC,CAAI,CAAA,CAGSZ,CAAAA,EAAa,IAAA,EAAQA,CAAAA,GAAa,EAAA,EAC5DW,CAAAA,CAAQ,IAAA,CACJxB,GAAAA,CAAC2B,IAAAA,CAAA,CAAK,EAAA,CAAG,OAAO,IAAA,CAAMJ,CAAAA,CACjB,QAAA,CAAAV,CAAAA,CACL,CACJ,CAAA,CAGAa,CAAAA,EACAF,CAAAA,CAAQ,IAAA,CAAKE,CAAK,CAAA,CAKtB,IAAME,CAAAA,CAFchB,CAAAA,GAGA,QAAA,CACV,CAAE,KAAAG,CAAK,CAAA,CACP,EAAC,CAEX,OACIf,GAAAA,CAAC6B,SAAAA,CAAA,CACG,EAAA,CAAIjB,CAAAA,CACJ,OAAA,CAAkB,aAAA,CAClB,KAAA,CAAkB,QAAA,CAClB,OAAA,CAAkB,QAAA,CAClB,IAAmBU,CAAAA,CACnB,EAAA,CAAmBD,CAAAA,CAAQ,EAAA,CAC3B,EAAA,CAAmBA,CAAAA,CAAQ,EAAA,CAC3B,MAAA,CAAkB,IAAA,CAClB,SAAA,CAAmBD,CAAAA,CAClB,GAAGQ,CAAAA,CACH,GAAGZ,CAAAA,CAEH,QAAA,CAAAQ,EACL,CAER","file":"index.js","sourcesContent":["// src/kit/button.tsx\r\n//\r\n// Made with ❤️ by Maysara.\r\n\r\n\r\n\r\n// ╔════════════════════════════════════════ PACK ════════════════════════════════════════╗\r\n\r\n import type { JSXElement } from '@minejs/jsx';\r\n import { Container } from '@cruxkit/container';\r\n import { Text } from '@cruxkit/text';\r\n import { Icon, type IconProps, type IconName, type IconConfig } from '@cruxkit/icon';\r\n import type { ButtonProps, ButtonSize, ButtonColor, ButtonVariant } from '../types';\r\n\r\n// ╚══════════════════════════════════════════════════════════════════════════════════════╝\r\n\r\n\r\n\r\n// ╔════════════════════════════════════════ INIT ════════════════════════════════════════╗\r\n\r\n const sizePaddingMap: Record<ButtonSize, { px: 3 | 4 | 6; py: 1 | 2 | 3 }> = {\r\n sm: { px: 3, py: 1 },\r\n md: { px: 4, py: 2 },\r\n lg: { px: 6, py: 3 }\r\n };\r\n\r\n const sizeGapMap: Record<ButtonSize, 1 | 2> = {\r\n sm: 1,\r\n md: 2,\r\n lg: 2\r\n };\r\n\r\n const labelSizeMap: Record<ButtonSize, 'sm' | 'md' | 'lg'> = {\r\n sm: 'sm',\r\n md: 'md',\r\n lg: 'lg'\r\n };\r\n\r\n const iconSizeMap: Record<ButtonSize, 'sm' | 'md' | 'lg'> = {\r\n sm: 'sm',\r\n md: 'md',\r\n lg: 'lg'\r\n };\r\n\r\n const variantClasses: Record<ButtonVariant, Record<ButtonColor, string[]>> = {\r\n solid: {\r\n brand: [\r\n 'bg-brand',\r\n 'text-inverse',\r\n 'border',\r\n 'border-transparent',\r\n 'hover:bg-brand-hover',\r\n 'active:bg-brand-active',\r\n 'active:scale-95',\r\n 'shadow-sm',\r\n 'hover:shadow-md'\r\n ],\r\n success: [\r\n 'bg-success',\r\n 'text-inverse',\r\n 'border',\r\n 'border-transparent',\r\n 'hover:bg-success-hover',\r\n 'active:bg-success-active',\r\n 'active:scale-95',\r\n 'shadow-sm',\r\n 'hover:shadow-md'\r\n ],\r\n warning: [\r\n 'bg-warning',\r\n 'text-inverse',\r\n 'border',\r\n 'border-transparent',\r\n 'hover:bg-warning-hover',\r\n 'active:bg-warning-active',\r\n 'active:scale-95',\r\n 'shadow-sm',\r\n 'hover:shadow-md'\r\n ],\r\n error: [\r\n 'bg-error',\r\n 'text-inverse',\r\n 'border',\r\n 'border-transparent',\r\n 'hover:bg-error-hover',\r\n 'active:bg-error-active',\r\n 'active:scale-95',\r\n 'shadow-sm',\r\n 'hover:shadow-md'\r\n ],\r\n neutral: [\r\n 'bg-surface',\r\n 'text-1',\r\n 'border',\r\n 'border-1',\r\n 'hover:bg-raised',\r\n 'active:bg-tertiary',\r\n 'active:scale-95',\r\n 'shadow-sm',\r\n 'hover:shadow-md'\r\n ]\r\n },\r\n outline: {\r\n brand: [\r\n 'bg-transparent',\r\n 'text-brand',\r\n 'border',\r\n 'border-brand',\r\n 'hover:bg-brand-subtle',\r\n 'active:bg-brand-subtle',\r\n 'active:scale-95'\r\n ],\r\n success: [\r\n 'bg-transparent',\r\n 'text-success',\r\n 'border',\r\n 'border-success',\r\n 'hover:bg-success-subtle',\r\n 'active:bg-success-subtle',\r\n 'active:scale-95'\r\n ],\r\n warning: [\r\n 'bg-transparent',\r\n 'text-warning',\r\n 'border',\r\n 'border-warning',\r\n 'hover:bg-warning-subtle',\r\n 'active:bg-warning-subtle',\r\n 'active:scale-95'\r\n ],\r\n error: [\r\n 'bg-transparent',\r\n 'text-error',\r\n 'border',\r\n 'border-error',\r\n 'hover:bg-error-subtle',\r\n 'active:bg-error-subtle',\r\n 'active:scale-95'\r\n ],\r\n neutral: [\r\n 'bg-transparent',\r\n 'text-1',\r\n 'border',\r\n 'border-1',\r\n 'hover:bg-raised',\r\n 'active:bg-tertiary',\r\n 'active:scale-95'\r\n ]\r\n },\r\n ghost: {\r\n brand: [\r\n 'bg-transparent',\r\n 'text-brand',\r\n 'border',\r\n 'border-transparent',\r\n 'hover:bg-brand-subtle',\r\n 'active:bg-brand-subtle',\r\n 'active:scale-95'\r\n ],\r\n success: [\r\n 'bg-transparent',\r\n 'text-success',\r\n 'border',\r\n 'border-transparent',\r\n 'hover:bg-success-subtle',\r\n 'active:bg-success-subtle',\r\n 'active:scale-95'\r\n ],\r\n warning: [\r\n 'bg-transparent',\r\n 'text-warning',\r\n 'border',\r\n 'border-transparent',\r\n 'hover:bg-warning-subtle',\r\n 'active:bg-warning-subtle',\r\n 'active:scale-95'\r\n ],\r\n error: [\r\n 'bg-transparent',\r\n 'text-error',\r\n 'border',\r\n 'border-transparent',\r\n 'hover:bg-error-subtle',\r\n 'active:bg-error-subtle',\r\n 'active:scale-95'\r\n ],\r\n neutral: [\r\n 'bg-transparent',\r\n 'text-1',\r\n 'border',\r\n 'border-transparent',\r\n 'hover:bg-raised',\r\n 'active:bg-tertiary',\r\n 'active:scale-95'\r\n ]\r\n },\r\n link: {\r\n brand: [\r\n 'bg-transparent',\r\n 'text-brand',\r\n 'border',\r\n 'border-transparent',\r\n 'hover:underline',\r\n 'underline-offset-4',\r\n 'decoration-2',\r\n 'px-1'\r\n ],\r\n success: [\r\n 'bg-transparent',\r\n 'text-success',\r\n 'border',\r\n 'border-transparent',\r\n 'hover:underline',\r\n 'underline-offset-4',\r\n 'decoration-2',\r\n 'px-1'\r\n ],\r\n warning: [\r\n 'bg-transparent',\r\n 'text-warning',\r\n 'border',\r\n 'border-transparent',\r\n 'hover:underline',\r\n 'underline-offset-4',\r\n 'decoration-2',\r\n 'px-1'\r\n ],\r\n error: [\r\n 'bg-transparent',\r\n 'text-error',\r\n 'border',\r\n 'border-transparent',\r\n 'hover:underline',\r\n 'underline-offset-4',\r\n 'decoration-2',\r\n 'px-1'\r\n ],\r\n neutral: [\r\n 'bg-transparent',\r\n 'text-1',\r\n 'border',\r\n 'border-transparent',\r\n 'hover:underline',\r\n 'underline-offset-4',\r\n 'decoration-2',\r\n 'px-1'\r\n ]\r\n }\r\n };\r\n\r\n// ╚══════════════════════════════════════════════════════════════════════════════════════╝\r\n\r\n\r\n\r\n// ╔════════════════════════════════════════ CORE ════════════════════════════════════════╗\r\n\r\n function renderIcon(icon: IconProps | IconName | undefined, size: ButtonSize): JSXElement | null {\r\n if (!icon) return null;\r\n\r\n const iconSize = iconSizeMap[size];\r\n\r\n if (typeof icon === 'string') {\r\n return (\r\n <span className=\"inline-flex shrink-0\">\r\n <Icon name={icon as IconName} size={iconSize} />\r\n </span>\r\n );\r\n }\r\n\r\n const resolvedSize = ((icon as IconProps) as IconConfig).size ?? iconSize;\r\n\r\n return (\r\n <span className=\"inline-flex shrink-0\">\r\n <Icon {...icon} size={resolvedSize} />\r\n </span>\r\n );\r\n }\r\n\r\n /**\r\n * A polymorphic button component that supports multiple variants, colors, sizes, and states.\r\n *\r\n * @param props - The properties for the Button component.\r\n * @param props.variant - Visual style variant: `'solid' | 'outline' | 'ghost' | 'link'`.\r\n * @param props.color - Color theme: `'brand' | 'success' | 'warning' | 'error' | 'neutral'`.\r\n * @param props.size - Size scale: `'sm' | 'md' | 'lg'`.\r\n * @param props.fullWidth - Whether the button spans the full width of its container.\r\n * @param props.disabled - Whether the button is disabled.\r\n * @param props.loading - Whether the button is in a loading state (disables interaction).\r\n * @param props.leftIcon - Optional icon placed to the left of the label (string name or IconProps).\r\n * @param props.rightIcon - Optional icon placed to the right of the label (string name or IconProps).\r\n * @param props.as - Element type to render: `'button' | 'a' | any polymorphic component`.\r\n * @param props.children - Button label content.\r\n * @param props.className - Additional CSS classes appended to the built-in styles.\r\n * @param props.type - HTML button type attribute (only applied when `as=\"button\"`).\r\n * @param props.restProps - Any other props are forwarded to the underlying element.\r\n *\r\n * @returns A JSX element representing the styled button.\r\n *\r\n * @example\r\n * ```tsx\r\n * <Button variant=\"solid\" color=\"brand\" size=\"md\" onClick={handleClick}>\r\n * Save\r\n * </Button>\r\n * ```\r\n */\r\n export function Button(props: ButtonProps): JSXElement {\r\n const {\r\n variant = 'solid',\r\n color = 'brand',\r\n size = 'md',\r\n fullWidth = false,\r\n disabled = false,\r\n loading = false,\r\n leftIcon,\r\n rightIcon,\r\n as = 'button',\r\n children,\r\n className,\r\n type = 'button',\r\n ...restProps\r\n } = props;\r\n\r\n const baseClasses = [\r\n 'inline-flex',\r\n 'items-center',\r\n 'justify-center',\r\n 'font-medium',\r\n 'transition-all',\r\n 'duration-150',\r\n 'select-none',\r\n 'focus:outline-none',\r\n 'focus-visible:ring',\r\n 'focus-visible:ring-offset-2'\r\n ];\r\n\r\n const stateClasses = [];\r\n\r\n if (loading || disabled) {\r\n stateClasses.push('opacity-50', 'cursor-not-allowed', 'pointer-events-none');\r\n }\r\n\r\n if (fullWidth) {\r\n stateClasses.push('w-full');\r\n }\r\n\r\n const paletteClasses = variantClasses[variant][color];\r\n\r\n const classes = [\r\n ...baseClasses,\r\n ...stateClasses,\r\n ...paletteClasses,\r\n className\r\n ]\r\n .filter(Boolean)\r\n .join(' ');\r\n\r\n const padding = sizePaddingMap[size];\r\n const gap = sizeGapMap[size];\r\n const labelSize = labelSizeMap[size];\r\n\r\n const content: JSXElement[] = [];\r\n\r\n const left = renderIcon(leftIcon, size);\r\n const right = renderIcon(rightIcon, size);\r\n\r\n if (left) {\r\n content.push(left);\r\n }\r\n\r\n if (children !== undefined && children !== null && children !== '') {\r\n content.push(\r\n <Text as=\"span\" size={labelSize}>\r\n {children}\r\n </Text>\r\n );\r\n }\r\n\r\n if (right) {\r\n content.push(right);\r\n }\r\n\r\n const elementType = as;\r\n\r\n const elementTypeProps =\r\n elementType === 'button'\r\n ? { type }\r\n : {};\r\n\r\n return (\r\n <Container\r\n as={as}\r\n display = \"inline-flex\"\r\n align = \"center\"\r\n justify = \"center\"\r\n gap = {gap}\r\n px = {padding.px}\r\n py = {padding.py}\r\n radius = \"md\"\r\n className = {classes}\r\n {...elementTypeProps}\r\n {...restProps}\r\n >\r\n {content}\r\n </Container>\r\n );\r\n }\r\n\r\n// ╚══════════════════════════════════════════════════════════════════════════════════════╝\r\n"]}
package/package.json ADDED
@@ -0,0 +1,63 @@
1
+ {
2
+ "name": "@cruxkit/button",
3
+ "version": "0.0.1",
4
+ "description": "Polymorphic, theme-aware button component for the Cruxkit ecosystem, built on @minejs/jsx.",
5
+ "keywords": ["crux", "kit", "button"],
6
+ "license": "MIT",
7
+ "homepage": "https://github.com/cruxkit-org/button#readme",
8
+ "bugs": {
9
+ "url": "https://github.com/cruxkit-org/button/issues"
10
+ },
11
+ "author": {
12
+ "name": "Maysara",
13
+ "email": "maysara.elshewehy@gmail.com",
14
+ "url": "https://github.com/maysara-elshewehy"
15
+ },
16
+ "repository": {
17
+ "type": "git",
18
+ "url": "git+https://github.com/cruxkit-org/button.git"
19
+ },
20
+ "type": "module",
21
+ "main": "./dist/index.js",
22
+ "types": "./dist/index.d.ts",
23
+ "files": ["dist"],
24
+ "exports": {
25
+ ".": {
26
+ "types": "./dist/index.d.ts",
27
+ "import": "./dist/index.js",
28
+ "require": "./dist/index.js"
29
+ }
30
+ },
31
+ "scripts": {
32
+ "build": "tsup",
33
+ "lint": "eslint src --ext .ts",
34
+ "test": "bun test"
35
+ },
36
+ "engines": {
37
+ "bun": ">=1.3.3"
38
+ },
39
+ "peerDependencies": {
40
+ "bun": "^1.3.3"
41
+ },
42
+ "dependencies": {
43
+ "@cruxkit/container": "^0.0.2",
44
+ "@cruxkit/icon": "^0.0.3",
45
+ "@cruxkit/text": "^0.0.2",
46
+ "@minejs/jsx": "^0.1.3"
47
+ },
48
+ "devDependencies": {
49
+ "@eslint/js": "^9.39.2",
50
+ "@stylistic/eslint-plugin": "^5.6.1",
51
+ "@types/bun": "^1.3.5",
52
+ "@types/jsdom": "^27.0.0",
53
+ "@types/node": "^20.19.27",
54
+ "@types/react": "^19.2.8",
55
+ "bun-plugin-dts": "^0.3.0",
56
+ "bun-types": "^1.3.5",
57
+ "jsdom": "^27.4.0",
58
+ "ts-node": "^10.9.2",
59
+ "tsup": "^8.5.1",
60
+ "typescript": "^5.9.3",
61
+ "typescript-eslint": "^8.51.0"
62
+ }
63
+ }