@zukhruf/ui 0.0.0-stage → 0.3.31
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 +21 -0
- package/README.md +73 -2
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/dist/the-button.d.ts +106 -0
- package/dist/the-button.d.ts.map +1 -0
- package/dist/the-button.js +414 -0
- package/dist/the-button.js.map +1 -0
- package/package.json +55 -4
- package/styles.css +1 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 ezzabuzaid
|
|
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
CHANGED
|
@@ -1,3 +1,74 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @zukhruf/ui
|
|
2
2
|
|
|
3
|
-
This
|
|
3
|
+
React components that an app builds from the components of [`@zukhruf/shadcn`](../shadcn). This package is a UI extension: it does not ship its own copy of `@zukhruf/shadcn`. The app installs `@zukhruf/shadcn`, sets its theme, and imports its stylesheet. The components of this package then use the same copy and the same theme.
|
|
4
|
+
|
|
5
|
+
The words in these documents have one meaning each. See the glossary in [CONTEXT.md](./CONTEXT.md).
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
npm i @zukhruf/ui @zukhruf/shadcn
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
The peer dependencies are `@zukhruf/shadcn`, `react` 19, `react-dom` 19 and `tailwindcss` 4. Install `@zukhruf/shadcn` yourself. npm does not install it for you when `legacy-peer-deps` is set. The other dependencies, `cn` and `lucide-react`, install with the package.
|
|
14
|
+
|
|
15
|
+
## Use it
|
|
16
|
+
|
|
17
|
+
Import the stylesheets in the Tailwind CSS file of the app, after Tailwind. Import `@zukhruf/shadcn/styles.css` first, then `@zukhruf/ui/styles.css`:
|
|
18
|
+
|
|
19
|
+
```css
|
|
20
|
+
@import 'tailwindcss';
|
|
21
|
+
@import '@zukhruf/shadcn/styles.css';
|
|
22
|
+
@import '@zukhruf/ui/styles.css';
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Obey two rules:
|
|
26
|
+
|
|
27
|
+
- **Use a plain `@import`.** Do not add `layer(…)` to the import. The stylesheet holds an `@source` rule, and Tailwind CSS refuses an `@source` rule in a layer.
|
|
28
|
+
- **Do not add an `@source` for the package.** The stylesheet registers its own `dist` folder. Tailwind CSS then finds the classes of the components.
|
|
29
|
+
|
|
30
|
+
## TheButton
|
|
31
|
+
|
|
32
|
+
`TheButton` is a `Button` of `@zukhruf/shadcn` with a loading state, an icon and a tooltip. It takes each prop of `Button`, for example `variant`, `size` and `onClick`, and these props:
|
|
33
|
+
|
|
34
|
+
| Prop | Type | Default | What it does |
|
|
35
|
+
| --------- | ---------------------------- | ------- | -------------------------------------------------------------------------------------------------------------------------------------- |
|
|
36
|
+
| `loading` | `boolean` | | Disables the button. After `delay`, it shows a spinner in place of the icon. |
|
|
37
|
+
| `delay` | `number` | `300` | The time in milliseconds from the start of `loading` to the spinner. A short load ends before the spinner shows, so it does not flash. |
|
|
38
|
+
| `icon` | `ReactNode` or a Lucide icon | | The icon before the text. Give an element, for example `<Save />`, or a Lucide component, for example `Save`. |
|
|
39
|
+
| `tooltip` | `string` | | The text of a tooltip that shows when the user hovers over or focuses the button. |
|
|
40
|
+
|
|
41
|
+
```tsx
|
|
42
|
+
import { Settings, Trash } from 'lucide-react';
|
|
43
|
+
|
|
44
|
+
import { TheButton } from '@zukhruf/ui';
|
|
45
|
+
|
|
46
|
+
export function Toolbar({
|
|
47
|
+
deleting,
|
|
48
|
+
onDelete,
|
|
49
|
+
}: {
|
|
50
|
+
deleting: boolean;
|
|
51
|
+
onDelete(): void;
|
|
52
|
+
}) {
|
|
53
|
+
return (
|
|
54
|
+
<>
|
|
55
|
+
<TheButton
|
|
56
|
+
variant="destructive"
|
|
57
|
+
icon={Trash}
|
|
58
|
+
loading={deleting}
|
|
59
|
+
onClick={onDelete}
|
|
60
|
+
>
|
|
61
|
+
Delete
|
|
62
|
+
</TheButton>
|
|
63
|
+
<TheButton
|
|
64
|
+
size="icon"
|
|
65
|
+
variant="outline"
|
|
66
|
+
icon={Settings}
|
|
67
|
+
tooltip="Open settings"
|
|
68
|
+
/>
|
|
69
|
+
</>
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
With `size="icon"` (or another `icon-*` size), the button shows only the icon, and the spinner takes its place while loading. Give a `tooltip` to an icon button, so the user can know what it does.
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../src/index.ts"],"sourcesContent":["export * from './the-button.tsx';\n"],"mappings":"AAAA,cAAc,iBAAkB","ignoreList":[]}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { type LucideIcon } from 'lucide-react';
|
|
2
|
+
import { Button } from '@zukhruf/shadcn';
|
|
3
|
+
interface TheButtonProps extends React.ComponentProps<typeof Button> {
|
|
4
|
+
/**
|
|
5
|
+
* Shows a loading spinner after the delay period.
|
|
6
|
+
* Disables the button while loading.
|
|
7
|
+
*/
|
|
8
|
+
loading?: boolean;
|
|
9
|
+
/**
|
|
10
|
+
* Icon to display before the button text.
|
|
11
|
+
* Can be a React node or a Lucide icon component.
|
|
12
|
+
*/
|
|
13
|
+
icon?: React.ReactNode | LucideIcon;
|
|
14
|
+
/**
|
|
15
|
+
* Delay in milliseconds before showing the loading spinner.
|
|
16
|
+
* @default 300
|
|
17
|
+
*/
|
|
18
|
+
delay?: number;
|
|
19
|
+
/**
|
|
20
|
+
* Tooltip text shown on hover. When provided with `size="icon"`,
|
|
21
|
+
* creates an icon-only button with tooltip.
|
|
22
|
+
*/
|
|
23
|
+
tooltip?: string;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* A versatile button component with loading state and tooltip support.
|
|
27
|
+
*
|
|
28
|
+
* Supports all standard Button variants and sizes from shadcn/ui,
|
|
29
|
+
* plus additional features for loading states and icon-only buttons.
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* // Basic button
|
|
33
|
+
* <TheButton>Click me</TheButton>
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* // Primary button with loading state
|
|
37
|
+
* <TheButton loading={isSubmitting}>
|
|
38
|
+
* Submit
|
|
39
|
+
* </TheButton>
|
|
40
|
+
*
|
|
41
|
+
* @example
|
|
42
|
+
* // Button with icon
|
|
43
|
+
* <TheButton icon={<Save className="size-4" />}>
|
|
44
|
+
* Save Changes
|
|
45
|
+
* </TheButton>
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
* // Using Lucide icon directly
|
|
49
|
+
* <TheButton icon={Trash}>
|
|
50
|
+
* Delete
|
|
51
|
+
* </TheButton>
|
|
52
|
+
*
|
|
53
|
+
* @example
|
|
54
|
+
* // Icon-only button with tooltip
|
|
55
|
+
* <TheButton
|
|
56
|
+
* size="icon"
|
|
57
|
+
* variant="outline"
|
|
58
|
+
* icon={Settings}
|
|
59
|
+
* tooltip="Open settings"
|
|
60
|
+
* />
|
|
61
|
+
*
|
|
62
|
+
* @example
|
|
63
|
+
* // Destructive variant
|
|
64
|
+
* <TheButton variant="destructive" icon={Trash}>
|
|
65
|
+
* Delete Item
|
|
66
|
+
* </TheButton>
|
|
67
|
+
*
|
|
68
|
+
* @example
|
|
69
|
+
* // Ghost variant (for toolbars, menus)
|
|
70
|
+
* <TheButton variant="ghost" size="sm">
|
|
71
|
+
* Cancel
|
|
72
|
+
* </TheButton>
|
|
73
|
+
*
|
|
74
|
+
* @example
|
|
75
|
+
* // Secondary variant
|
|
76
|
+
* <TheButton variant="secondary">
|
|
77
|
+
* Secondary Action
|
|
78
|
+
* </TheButton>
|
|
79
|
+
*
|
|
80
|
+
* @example
|
|
81
|
+
* // Link variant
|
|
82
|
+
* <TheButton variant="link">
|
|
83
|
+
* Learn more
|
|
84
|
+
* </TheButton>
|
|
85
|
+
*
|
|
86
|
+
* @example
|
|
87
|
+
* // Outline variant with custom delay
|
|
88
|
+
* <TheButton variant="outline" loading={isPending} delay={500}>
|
|
89
|
+
* Processing...
|
|
90
|
+
* </TheButton>
|
|
91
|
+
*
|
|
92
|
+
* @example
|
|
93
|
+
* // Small size
|
|
94
|
+
* <TheButton size="sm" icon={Plus}>
|
|
95
|
+
* Add Item
|
|
96
|
+
* </TheButton>
|
|
97
|
+
*
|
|
98
|
+
* @example
|
|
99
|
+
* // Large size
|
|
100
|
+
* <TheButton size="lg">
|
|
101
|
+
* Get Started
|
|
102
|
+
* </TheButton>
|
|
103
|
+
*/
|
|
104
|
+
export declare function TheButton({ loading, disabled, children, delay, icon, tooltip, size, ...props }: TheButtonProps): import("react").JSX.Element;
|
|
105
|
+
export {};
|
|
106
|
+
//# sourceMappingURL=the-button.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"the-button.d.ts","sourceRoot":"","sources":["../src/the-button.tsx"],"names":[],"mappings":"AACA,OAAO,EAAW,KAAK,UAAU,EAAE,MAAM,cAAc,CAAC;AAGxD,OAAO,EACL,MAAM,EAIP,MAAM,iBAAiB,CAAC;AAEzB,UAAU,cAAe,SAAQ,KAAK,CAAC,cAAc,CAAC,OAAO,MAAM,CAAC;IAClE;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;OAGG;IACH,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,GAAG,UAAU,CAAC;IACpC;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAgJD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8EG;AACH,wBAAgB,SAAS,CAAC,EACxB,OAAO,EACP,QAAQ,EACR,QAAQ,EACR,KAAW,EACX,IAAI,EACJ,OAAO,EACP,IAAI,EACJ,GAAG,KAAK,EACT,EAAE,cAAc,+BAsBhB"}
|
|
@@ -0,0 +1,414 @@
|
|
|
1
|
+
import { c as _c } from "react/compiler-runtime";
|
|
2
|
+
import { cn } from 'cn';
|
|
3
|
+
import { Loader2 } from 'lucide-react';
|
|
4
|
+
import { useEffect, useState } from 'react';
|
|
5
|
+
import { Button, Tooltip, TooltipContent, TooltipTrigger } from '@zukhruf/shadcn';
|
|
6
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
7
|
+
// --- Internal Components ---
|
|
8
|
+
|
|
9
|
+
function useDelayedLoading(loading, delay) {
|
|
10
|
+
const $ = _c(4);
|
|
11
|
+
const isLoading = !!loading;
|
|
12
|
+
const [delayPassed, setDelayPassed] = useState(false);
|
|
13
|
+
let t0;
|
|
14
|
+
let t1;
|
|
15
|
+
if ($[0] !== delay || $[1] !== isLoading) {
|
|
16
|
+
t0 = () => {
|
|
17
|
+
if (!isLoading) {
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
const timerId = setTimeout(() => {
|
|
21
|
+
setDelayPassed(true);
|
|
22
|
+
}, delay);
|
|
23
|
+
return () => {
|
|
24
|
+
clearTimeout(timerId);
|
|
25
|
+
queueMicrotask(() => setDelayPassed(false));
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
t1 = [isLoading, delay];
|
|
29
|
+
$[0] = delay;
|
|
30
|
+
$[1] = isLoading;
|
|
31
|
+
$[2] = t0;
|
|
32
|
+
$[3] = t1;
|
|
33
|
+
} else {
|
|
34
|
+
t0 = $[2];
|
|
35
|
+
t1 = $[3];
|
|
36
|
+
}
|
|
37
|
+
useEffect(t0, t1);
|
|
38
|
+
return isLoading && delayPassed;
|
|
39
|
+
}
|
|
40
|
+
function isComponent(value) {
|
|
41
|
+
if (typeof value === 'function') return true;
|
|
42
|
+
return typeof value === 'object' && value !== null && '$$typeof' in value && 'render' in value && typeof value.render === 'function';
|
|
43
|
+
}
|
|
44
|
+
function IconRenderer(t0) {
|
|
45
|
+
const $ = _c(4);
|
|
46
|
+
const {
|
|
47
|
+
icon
|
|
48
|
+
} = t0;
|
|
49
|
+
if (isComponent(icon)) {
|
|
50
|
+
const Icon = icon;
|
|
51
|
+
let t1;
|
|
52
|
+
if ($[0] !== Icon) {
|
|
53
|
+
t1 = /*#__PURE__*/_jsx(Icon, {
|
|
54
|
+
className: "size-4"
|
|
55
|
+
});
|
|
56
|
+
$[0] = Icon;
|
|
57
|
+
$[1] = t1;
|
|
58
|
+
} else {
|
|
59
|
+
t1 = $[1];
|
|
60
|
+
}
|
|
61
|
+
return t1;
|
|
62
|
+
}
|
|
63
|
+
let t1;
|
|
64
|
+
if ($[2] !== icon) {
|
|
65
|
+
t1 = /*#__PURE__*/_jsx(_Fragment, {
|
|
66
|
+
children: icon
|
|
67
|
+
});
|
|
68
|
+
$[2] = icon;
|
|
69
|
+
$[3] = t1;
|
|
70
|
+
} else {
|
|
71
|
+
t1 = $[3];
|
|
72
|
+
}
|
|
73
|
+
return t1;
|
|
74
|
+
}
|
|
75
|
+
function LoadingSpinner() {
|
|
76
|
+
const $ = _c(1);
|
|
77
|
+
let t0;
|
|
78
|
+
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
79
|
+
t0 = /*#__PURE__*/_jsx(Loader2, {
|
|
80
|
+
className: "size-4 animate-spin"
|
|
81
|
+
});
|
|
82
|
+
$[0] = t0;
|
|
83
|
+
} else {
|
|
84
|
+
t0 = $[0];
|
|
85
|
+
}
|
|
86
|
+
return t0;
|
|
87
|
+
}
|
|
88
|
+
function IconButtonContent(t0) {
|
|
89
|
+
const $ = _c(11);
|
|
90
|
+
const {
|
|
91
|
+
icon,
|
|
92
|
+
showSpinner
|
|
93
|
+
} = t0;
|
|
94
|
+
let t1;
|
|
95
|
+
if ($[0] !== icon || $[1] !== showSpinner) {
|
|
96
|
+
t1 = icon && /*#__PURE__*/_jsx("div", {
|
|
97
|
+
className: cn("absolute inset-0 flex items-center justify-center transition-all duration-300 ease-in-out", showSpinner ? "-translate-x-full opacity-0" : "translate-x-0 opacity-100"),
|
|
98
|
+
children: /*#__PURE__*/_jsx(IconRenderer, {
|
|
99
|
+
icon: icon
|
|
100
|
+
})
|
|
101
|
+
});
|
|
102
|
+
$[0] = icon;
|
|
103
|
+
$[1] = showSpinner;
|
|
104
|
+
$[2] = t1;
|
|
105
|
+
} else {
|
|
106
|
+
t1 = $[2];
|
|
107
|
+
}
|
|
108
|
+
const t2 = showSpinner ? "translate-x-0 opacity-100" : "translate-x-full opacity-0";
|
|
109
|
+
let t3;
|
|
110
|
+
if ($[3] !== t2) {
|
|
111
|
+
t3 = cn("absolute inset-0 transition-all duration-300 ease-in-out", t2);
|
|
112
|
+
$[3] = t2;
|
|
113
|
+
$[4] = t3;
|
|
114
|
+
} else {
|
|
115
|
+
t3 = $[4];
|
|
116
|
+
}
|
|
117
|
+
let t4;
|
|
118
|
+
if ($[5] === Symbol.for("react.memo_cache_sentinel")) {
|
|
119
|
+
t4 = /*#__PURE__*/_jsx(LoadingSpinner, {});
|
|
120
|
+
$[5] = t4;
|
|
121
|
+
} else {
|
|
122
|
+
t4 = $[5];
|
|
123
|
+
}
|
|
124
|
+
let t5;
|
|
125
|
+
if ($[6] !== t3) {
|
|
126
|
+
t5 = /*#__PURE__*/_jsx("div", {
|
|
127
|
+
className: t3,
|
|
128
|
+
children: t4
|
|
129
|
+
});
|
|
130
|
+
$[6] = t3;
|
|
131
|
+
$[7] = t5;
|
|
132
|
+
} else {
|
|
133
|
+
t5 = $[7];
|
|
134
|
+
}
|
|
135
|
+
let t6;
|
|
136
|
+
if ($[8] !== t1 || $[9] !== t5) {
|
|
137
|
+
t6 = /*#__PURE__*/_jsxs("div", {
|
|
138
|
+
className: "relative size-4 overflow-hidden",
|
|
139
|
+
children: [t1, t5]
|
|
140
|
+
});
|
|
141
|
+
$[8] = t1;
|
|
142
|
+
$[9] = t5;
|
|
143
|
+
$[10] = t6;
|
|
144
|
+
} else {
|
|
145
|
+
t6 = $[10];
|
|
146
|
+
}
|
|
147
|
+
return t6;
|
|
148
|
+
}
|
|
149
|
+
function TextButtonContent(t0) {
|
|
150
|
+
const $ = _c(13);
|
|
151
|
+
const {
|
|
152
|
+
icon,
|
|
153
|
+
showSpinner,
|
|
154
|
+
children
|
|
155
|
+
} = t0;
|
|
156
|
+
let t1;
|
|
157
|
+
if ($[0] !== icon || $[1] !== showSpinner) {
|
|
158
|
+
t1 = icon && /*#__PURE__*/_jsx("div", {
|
|
159
|
+
className: cn("overflow-hidden transition-all duration-300 ease-in-out", showSpinner ? "w-0 opacity-0" : "w-4 opacity-100"),
|
|
160
|
+
children: /*#__PURE__*/_jsx(IconRenderer, {
|
|
161
|
+
icon: icon
|
|
162
|
+
})
|
|
163
|
+
});
|
|
164
|
+
$[0] = icon;
|
|
165
|
+
$[1] = showSpinner;
|
|
166
|
+
$[2] = t1;
|
|
167
|
+
} else {
|
|
168
|
+
t1 = $[2];
|
|
169
|
+
}
|
|
170
|
+
const t2 = showSpinner ? "w-4 opacity-100" : "-ms-2 w-0 opacity-0";
|
|
171
|
+
const t3 = icon ? "-ms-2" : "";
|
|
172
|
+
let t4;
|
|
173
|
+
if ($[3] !== t2 || $[4] !== t3) {
|
|
174
|
+
t4 = cn("overflow-hidden transition-all duration-300 ease-in-out", t2, t3);
|
|
175
|
+
$[3] = t2;
|
|
176
|
+
$[4] = t3;
|
|
177
|
+
$[5] = t4;
|
|
178
|
+
} else {
|
|
179
|
+
t4 = $[5];
|
|
180
|
+
}
|
|
181
|
+
let t5;
|
|
182
|
+
if ($[6] === Symbol.for("react.memo_cache_sentinel")) {
|
|
183
|
+
t5 = /*#__PURE__*/_jsx(LoadingSpinner, {});
|
|
184
|
+
$[6] = t5;
|
|
185
|
+
} else {
|
|
186
|
+
t5 = $[6];
|
|
187
|
+
}
|
|
188
|
+
let t6;
|
|
189
|
+
if ($[7] !== t4) {
|
|
190
|
+
t6 = /*#__PURE__*/_jsx("div", {
|
|
191
|
+
className: t4,
|
|
192
|
+
children: t5
|
|
193
|
+
});
|
|
194
|
+
$[7] = t4;
|
|
195
|
+
$[8] = t6;
|
|
196
|
+
} else {
|
|
197
|
+
t6 = $[8];
|
|
198
|
+
}
|
|
199
|
+
let t7;
|
|
200
|
+
if ($[9] !== children || $[10] !== t1 || $[11] !== t6) {
|
|
201
|
+
t7 = /*#__PURE__*/_jsxs(_Fragment, {
|
|
202
|
+
children: [t1, t6, children]
|
|
203
|
+
});
|
|
204
|
+
$[9] = children;
|
|
205
|
+
$[10] = t1;
|
|
206
|
+
$[11] = t6;
|
|
207
|
+
$[12] = t7;
|
|
208
|
+
} else {
|
|
209
|
+
t7 = $[12];
|
|
210
|
+
}
|
|
211
|
+
return t7;
|
|
212
|
+
}
|
|
213
|
+
function WithTooltip(t0) {
|
|
214
|
+
const $ = _c(7);
|
|
215
|
+
const {
|
|
216
|
+
tooltip,
|
|
217
|
+
children
|
|
218
|
+
} = t0;
|
|
219
|
+
if (!tooltip) {
|
|
220
|
+
return children;
|
|
221
|
+
}
|
|
222
|
+
let t1;
|
|
223
|
+
if ($[0] !== children) {
|
|
224
|
+
t1 = /*#__PURE__*/_jsx(TooltipTrigger, {
|
|
225
|
+
render: children
|
|
226
|
+
});
|
|
227
|
+
$[0] = children;
|
|
228
|
+
$[1] = t1;
|
|
229
|
+
} else {
|
|
230
|
+
t1 = $[1];
|
|
231
|
+
}
|
|
232
|
+
let t2;
|
|
233
|
+
if ($[2] !== tooltip) {
|
|
234
|
+
t2 = /*#__PURE__*/_jsx(TooltipContent, {
|
|
235
|
+
children: tooltip
|
|
236
|
+
});
|
|
237
|
+
$[2] = tooltip;
|
|
238
|
+
$[3] = t2;
|
|
239
|
+
} else {
|
|
240
|
+
t2 = $[3];
|
|
241
|
+
}
|
|
242
|
+
let t3;
|
|
243
|
+
if ($[4] !== t1 || $[5] !== t2) {
|
|
244
|
+
t3 = /*#__PURE__*/_jsxs(Tooltip, {
|
|
245
|
+
children: [t1, t2]
|
|
246
|
+
});
|
|
247
|
+
$[4] = t1;
|
|
248
|
+
$[5] = t2;
|
|
249
|
+
$[6] = t3;
|
|
250
|
+
} else {
|
|
251
|
+
t3 = $[6];
|
|
252
|
+
}
|
|
253
|
+
return t3;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
/**
|
|
257
|
+
* A versatile button component with loading state and tooltip support.
|
|
258
|
+
*
|
|
259
|
+
* Supports all standard Button variants and sizes from shadcn/ui,
|
|
260
|
+
* plus additional features for loading states and icon-only buttons.
|
|
261
|
+
*
|
|
262
|
+
* @example
|
|
263
|
+
* // Basic button
|
|
264
|
+
* <TheButton>Click me</TheButton>
|
|
265
|
+
*
|
|
266
|
+
* @example
|
|
267
|
+
* // Primary button with loading state
|
|
268
|
+
* <TheButton loading={isSubmitting}>
|
|
269
|
+
* Submit
|
|
270
|
+
* </TheButton>
|
|
271
|
+
*
|
|
272
|
+
* @example
|
|
273
|
+
* // Button with icon
|
|
274
|
+
* <TheButton icon={<Save className="size-4" />}>
|
|
275
|
+
* Save Changes
|
|
276
|
+
* </TheButton>
|
|
277
|
+
*
|
|
278
|
+
* @example
|
|
279
|
+
* // Using Lucide icon directly
|
|
280
|
+
* <TheButton icon={Trash}>
|
|
281
|
+
* Delete
|
|
282
|
+
* </TheButton>
|
|
283
|
+
*
|
|
284
|
+
* @example
|
|
285
|
+
* // Icon-only button with tooltip
|
|
286
|
+
* <TheButton
|
|
287
|
+
* size="icon"
|
|
288
|
+
* variant="outline"
|
|
289
|
+
* icon={Settings}
|
|
290
|
+
* tooltip="Open settings"
|
|
291
|
+
* />
|
|
292
|
+
*
|
|
293
|
+
* @example
|
|
294
|
+
* // Destructive variant
|
|
295
|
+
* <TheButton variant="destructive" icon={Trash}>
|
|
296
|
+
* Delete Item
|
|
297
|
+
* </TheButton>
|
|
298
|
+
*
|
|
299
|
+
* @example
|
|
300
|
+
* // Ghost variant (for toolbars, menus)
|
|
301
|
+
* <TheButton variant="ghost" size="sm">
|
|
302
|
+
* Cancel
|
|
303
|
+
* </TheButton>
|
|
304
|
+
*
|
|
305
|
+
* @example
|
|
306
|
+
* // Secondary variant
|
|
307
|
+
* <TheButton variant="secondary">
|
|
308
|
+
* Secondary Action
|
|
309
|
+
* </TheButton>
|
|
310
|
+
*
|
|
311
|
+
* @example
|
|
312
|
+
* // Link variant
|
|
313
|
+
* <TheButton variant="link">
|
|
314
|
+
* Learn more
|
|
315
|
+
* </TheButton>
|
|
316
|
+
*
|
|
317
|
+
* @example
|
|
318
|
+
* // Outline variant with custom delay
|
|
319
|
+
* <TheButton variant="outline" loading={isPending} delay={500}>
|
|
320
|
+
* Processing...
|
|
321
|
+
* </TheButton>
|
|
322
|
+
*
|
|
323
|
+
* @example
|
|
324
|
+
* // Small size
|
|
325
|
+
* <TheButton size="sm" icon={Plus}>
|
|
326
|
+
* Add Item
|
|
327
|
+
* </TheButton>
|
|
328
|
+
*
|
|
329
|
+
* @example
|
|
330
|
+
* // Large size
|
|
331
|
+
* <TheButton size="lg">
|
|
332
|
+
* Get Started
|
|
333
|
+
* </TheButton>
|
|
334
|
+
*/
|
|
335
|
+
export function TheButton(t0) {
|
|
336
|
+
const $ = _c(18);
|
|
337
|
+
const {
|
|
338
|
+
loading,
|
|
339
|
+
disabled,
|
|
340
|
+
children,
|
|
341
|
+
delay: t1,
|
|
342
|
+
icon,
|
|
343
|
+
tooltip,
|
|
344
|
+
size,
|
|
345
|
+
...props
|
|
346
|
+
} = t0;
|
|
347
|
+
const delay = t1 === undefined ? 300 : t1;
|
|
348
|
+
const showSpinner = useDelayedLoading(loading, delay);
|
|
349
|
+
let t2;
|
|
350
|
+
if ($[0] !== size) {
|
|
351
|
+
t2 = size?.startsWith("icon");
|
|
352
|
+
$[0] = size;
|
|
353
|
+
$[1] = t2;
|
|
354
|
+
} else {
|
|
355
|
+
t2 = $[1];
|
|
356
|
+
}
|
|
357
|
+
const isIconButton = t2;
|
|
358
|
+
const T0 = WithTooltip;
|
|
359
|
+
const T1 = Button;
|
|
360
|
+
const t3 = disabled || loading;
|
|
361
|
+
const t4 = cn("cursor-pointer gap-2", props.className);
|
|
362
|
+
let t5;
|
|
363
|
+
if ($[2] !== children || $[3] !== icon || $[4] !== isIconButton || $[5] !== showSpinner) {
|
|
364
|
+
t5 = isIconButton ? /*#__PURE__*/_jsx(IconButtonContent, {
|
|
365
|
+
icon: icon,
|
|
366
|
+
showSpinner: showSpinner
|
|
367
|
+
}) : /*#__PURE__*/_jsx(TextButtonContent, {
|
|
368
|
+
icon: icon,
|
|
369
|
+
showSpinner: showSpinner,
|
|
370
|
+
children: children
|
|
371
|
+
});
|
|
372
|
+
$[2] = children;
|
|
373
|
+
$[3] = icon;
|
|
374
|
+
$[4] = isIconButton;
|
|
375
|
+
$[5] = showSpinner;
|
|
376
|
+
$[6] = t5;
|
|
377
|
+
} else {
|
|
378
|
+
t5 = $[6];
|
|
379
|
+
}
|
|
380
|
+
let t6;
|
|
381
|
+
if ($[7] !== T1 || $[8] !== props || $[9] !== size || $[10] !== t3 || $[11] !== t4 || $[12] !== t5) {
|
|
382
|
+
t6 = /*#__PURE__*/_jsx(T1, {
|
|
383
|
+
disabled: t3,
|
|
384
|
+
size: size,
|
|
385
|
+
...props,
|
|
386
|
+
className: t4,
|
|
387
|
+
children: t5
|
|
388
|
+
});
|
|
389
|
+
$[7] = T1;
|
|
390
|
+
$[8] = props;
|
|
391
|
+
$[9] = size;
|
|
392
|
+
$[10] = t3;
|
|
393
|
+
$[11] = t4;
|
|
394
|
+
$[12] = t5;
|
|
395
|
+
$[13] = t6;
|
|
396
|
+
} else {
|
|
397
|
+
t6 = $[13];
|
|
398
|
+
}
|
|
399
|
+
let t7;
|
|
400
|
+
if ($[14] !== T0 || $[15] !== t6 || $[16] !== tooltip) {
|
|
401
|
+
t7 = /*#__PURE__*/_jsx(T0, {
|
|
402
|
+
tooltip: tooltip,
|
|
403
|
+
children: t6
|
|
404
|
+
});
|
|
405
|
+
$[14] = T0;
|
|
406
|
+
$[15] = t6;
|
|
407
|
+
$[16] = tooltip;
|
|
408
|
+
$[17] = t7;
|
|
409
|
+
} else {
|
|
410
|
+
t7 = $[17];
|
|
411
|
+
}
|
|
412
|
+
return t7;
|
|
413
|
+
}
|
|
414
|
+
//# sourceMappingURL=the-button.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"the-button.js","names":["cn","Loader2","useEffect","useState","Button","Tooltip","TooltipContent","TooltipTrigger","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","useDelayedLoading","loading","delay","$","_c","isLoading","delayPassed","setDelayPassed","t0","t1","timerId","setTimeout","clearTimeout","queueMicrotask","isComponent","value","render","IconRenderer","icon","Icon","className","children","LoadingSpinner","Symbol","for","IconButtonContent","showSpinner","t2","t3","t4","t5","t6","TextButtonContent","t7","WithTooltip","tooltip","TheButton","disabled","size","props","undefined","startsWith","isIconButton","T0","T1"],"sources":["../src/the-button.tsx"],"sourcesContent":["import { cn } from 'cn';\nimport { Loader2, type LucideIcon } from 'lucide-react';\nimport { useEffect, useState } from 'react';\n\nimport {\n Button,\n Tooltip,\n TooltipContent,\n TooltipTrigger,\n} from '@zukhruf/shadcn';\n\ninterface TheButtonProps extends React.ComponentProps<typeof Button> {\n /**\n * Shows a loading spinner after the delay period.\n * Disables the button while loading.\n */\n loading?: boolean;\n /**\n * Icon to display before the button text.\n * Can be a React node or a Lucide icon component.\n */\n icon?: React.ReactNode | LucideIcon;\n /**\n * Delay in milliseconds before showing the loading spinner.\n * @default 300\n */\n delay?: number;\n /**\n * Tooltip text shown on hover. When provided with `size=\"icon\"`,\n * creates an icon-only button with tooltip.\n */\n tooltip?: string;\n}\n\n// --- Internal Components ---\n\nfunction useDelayedLoading(loading: boolean | undefined, delay: number) {\n const isLoading = !!loading;\n const [delayPassed, setDelayPassed] = useState(false);\n\n useEffect(() => {\n if (!isLoading) {\n return;\n }\n\n const timerId = setTimeout(() => {\n setDelayPassed(true);\n }, delay);\n\n return () => {\n clearTimeout(timerId);\n queueMicrotask(() => setDelayPassed(false));\n };\n }, [isLoading, delay]);\n\n return isLoading && delayPassed;\n}\n\nfunction isComponent(\n value: unknown,\n): value is React.ComponentType<{ className?: string }> {\n if (typeof value === 'function') return true;\n return (\n typeof value === 'object' &&\n value !== null &&\n '$$typeof' in value &&\n 'render' in value &&\n typeof value.render === 'function'\n );\n}\n\nfunction IconRenderer({ icon }: { icon: React.ReactNode | LucideIcon }) {\n if (isComponent(icon)) {\n const Icon = icon;\n return <Icon className=\"size-4\" />;\n }\n // Not a useless fragment: `isComponent` takes `unknown` and narrows only its\n // positive branch, so `icon` is still `ReactNode | LucideIcon` here and\n // `LucideIcon` is not assignable to `ReactNode`. The fragment is what makes\n // this an Element. Returning `icon` bare fails with TS2786 at both call sites.\n return <>{icon}</>;\n}\n\nfunction LoadingSpinner() {\n return <Loader2 className=\"size-4 animate-spin\" />;\n}\n\nfunction IconButtonContent({\n icon,\n showSpinner,\n}: {\n icon?: React.ReactNode | LucideIcon;\n showSpinner: boolean;\n}) {\n return (\n <div className=\"relative size-4 overflow-hidden\">\n {icon && (\n <div\n className={cn(\n 'absolute inset-0 flex items-center justify-center transition-all duration-300 ease-in-out',\n showSpinner\n ? '-translate-x-full opacity-0'\n : 'translate-x-0 opacity-100',\n )}\n >\n <IconRenderer icon={icon} />\n </div>\n )}\n <div\n className={cn(\n 'absolute inset-0 transition-all duration-300 ease-in-out',\n showSpinner\n ? 'translate-x-0 opacity-100'\n : 'translate-x-full opacity-0',\n )}\n >\n <LoadingSpinner />\n </div>\n </div>\n );\n}\n\nfunction TextButtonContent({\n icon,\n showSpinner,\n children,\n}: {\n icon?: React.ReactNode | LucideIcon;\n showSpinner: boolean;\n children: React.ReactNode;\n}) {\n return (\n <>\n {icon && (\n <div\n className={cn(\n 'overflow-hidden transition-all duration-300 ease-in-out',\n showSpinner ? 'w-0 opacity-0' : 'w-4 opacity-100',\n )}\n >\n <IconRenderer icon={icon} />\n </div>\n )}\n <div\n className={cn(\n 'overflow-hidden transition-all duration-300 ease-in-out',\n showSpinner ? 'w-4 opacity-100' : '-ms-2 w-0 opacity-0',\n icon ? '-ms-2' : '',\n )}\n >\n <LoadingSpinner />\n </div>\n {children}\n </>\n );\n}\n\nfunction WithTooltip({\n tooltip,\n children,\n}: {\n tooltip: string | undefined;\n children: React.ReactElement;\n}) {\n if (!tooltip) {\n return children;\n }\n\n return (\n <Tooltip>\n <TooltipTrigger render={children} />\n <TooltipContent>{tooltip}</TooltipContent>\n </Tooltip>\n );\n}\n\n/**\n * A versatile button component with loading state and tooltip support.\n *\n * Supports all standard Button variants and sizes from shadcn/ui,\n * plus additional features for loading states and icon-only buttons.\n *\n * @example\n * // Basic button\n * <TheButton>Click me</TheButton>\n *\n * @example\n * // Primary button with loading state\n * <TheButton loading={isSubmitting}>\n * Submit\n * </TheButton>\n *\n * @example\n * // Button with icon\n * <TheButton icon={<Save className=\"size-4\" />}>\n * Save Changes\n * </TheButton>\n *\n * @example\n * // Using Lucide icon directly\n * <TheButton icon={Trash}>\n * Delete\n * </TheButton>\n *\n * @example\n * // Icon-only button with tooltip\n * <TheButton\n * size=\"icon\"\n * variant=\"outline\"\n * icon={Settings}\n * tooltip=\"Open settings\"\n * />\n *\n * @example\n * // Destructive variant\n * <TheButton variant=\"destructive\" icon={Trash}>\n * Delete Item\n * </TheButton>\n *\n * @example\n * // Ghost variant (for toolbars, menus)\n * <TheButton variant=\"ghost\" size=\"sm\">\n * Cancel\n * </TheButton>\n *\n * @example\n * // Secondary variant\n * <TheButton variant=\"secondary\">\n * Secondary Action\n * </TheButton>\n *\n * @example\n * // Link variant\n * <TheButton variant=\"link\">\n * Learn more\n * </TheButton>\n *\n * @example\n * // Outline variant with custom delay\n * <TheButton variant=\"outline\" loading={isPending} delay={500}>\n * Processing...\n * </TheButton>\n *\n * @example\n * // Small size\n * <TheButton size=\"sm\" icon={Plus}>\n * Add Item\n * </TheButton>\n *\n * @example\n * // Large size\n * <TheButton size=\"lg\">\n * Get Started\n * </TheButton>\n */\nexport function TheButton({\n loading,\n disabled,\n children,\n delay = 300,\n icon,\n tooltip,\n size,\n ...props\n}: TheButtonProps) {\n const showSpinner = useDelayedLoading(loading, delay);\n const isIconButton = size?.startsWith('icon');\n\n return (\n <WithTooltip tooltip={tooltip}>\n <Button\n disabled={disabled || loading}\n size={size}\n {...props}\n className={cn('cursor-pointer gap-2', props.className)}\n >\n {isIconButton ? (\n <IconButtonContent icon={icon} showSpinner={showSpinner} />\n ) : (\n <TextButtonContent icon={icon} showSpinner={showSpinner}>\n {children}\n </TextButtonContent>\n )}\n </Button>\n </WithTooltip>\n );\n}\n"],"mappings":";AAAA,SAASA,EAAE,QAAQ,IAAI;AACvB,SAASC,OAAO,QAAyB,cAAc;AACvD,SAASC,SAAS,EAAEC,QAAQ,QAAQ,OAAO;AAE3C,SACEC,MAAM,EACNC,OAAO,EACPC,cAAc,EACdC,cAAc,QACT,iBAAiB;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,QAAA,IAAAC,SAAA,EAAAC,IAAA,IAAAC,KAAA;AAyBzB;;AAEA,SAAAC,kBAAAC,OAAA,EAAAC,KAAA;EAAA,MAAAC,CAAA,GAAAC,EAAA;EACE,MAAAC,SAAA,GAAkB,CAAC,CAACJ,OAAO;EAC3B,OAAAK,WAAA,EAAAC,cAAA,IAAsClB,QAAQ,CAAC,KAAK,CAAC;EAAC,IAAAmB,EAAA;EAAA,IAAAC,EAAA;EAAA,IAAAN,CAAA,QAAAD,KAAA,IAAAC,CAAA,QAAAE,SAAA;IAE5CG,EAAA,GAAAA,CAAA;MACR,IAAI,CAACH,SAAS;QAAA;MAAA;MAId,MAAAK,OAAA,GAAgBC,UAAU,CAAC;QACzBJ,cAAc,CAAC,IAAI,CAAC;MAAA,CACrB,EAAEL,KAAK,CAAC;MAAC,OAEH;QACLU,YAAY,CAACF,OAAO,CAAC;QACrBG,cAAc,CAAC,MAAMN,cAAc,CAAC,KAAK,CAAC,CAAC;MAAA,CAC5C;IAAA,CACF;IAAEE,EAAA,IAACJ,SAAS,EAAEH,KAAK,CAAC;IAAAC,CAAA,MAAAD,KAAA;IAAAC,CAAA,MAAAE,SAAA;IAAAF,CAAA,MAAAK,EAAA;IAAAL,CAAA,MAAAM,EAAA;EAAA;IAAAD,EAAA,GAAAL,CAAA;IAAAM,EAA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
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.3.31",
|
|
4
|
+
"description": "React components built from the components of @zukhruf/shadcn, such as TheButton: a button with a delayed loading spinner, an icon and a tooltip.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "https://github.com/JanuaryLabs/zukhruf",
|
|
9
|
+
"directory": "packages/ui"
|
|
10
|
+
},
|
|
11
|
+
"bugs": {
|
|
12
|
+
"url": "https://github.com/JanuaryLabs/zukhruf/issues"
|
|
13
|
+
},
|
|
14
|
+
"homepage": "https://github.com/JanuaryLabs/zukhruf/tree/main/packages/ui#readme",
|
|
15
|
+
"keywords": [
|
|
16
|
+
"shadcn",
|
|
17
|
+
"shadcn-ui",
|
|
18
|
+
"button",
|
|
19
|
+
"react",
|
|
20
|
+
"components",
|
|
21
|
+
"tailwindcss",
|
|
22
|
+
"ui"
|
|
23
|
+
],
|
|
24
|
+
"type": "module",
|
|
25
|
+
"exports": {
|
|
26
|
+
"./package.json": "./package.json",
|
|
27
|
+
".": {
|
|
28
|
+
"@zukhruf/source": "./src/index.ts",
|
|
29
|
+
"types": "./dist/index.d.ts",
|
|
30
|
+
"default": "./dist/index.js"
|
|
31
|
+
},
|
|
32
|
+
"./styles.css": "./styles.css"
|
|
33
|
+
},
|
|
34
|
+
"sideEffects": [
|
|
35
|
+
"**/*.css"
|
|
36
|
+
],
|
|
37
|
+
"files": [
|
|
38
|
+
"dist",
|
|
39
|
+
"styles.css",
|
|
40
|
+
"!dist/spec/**",
|
|
41
|
+
"!**/*.tsbuildinfo",
|
|
42
|
+
"!**/*.test.*"
|
|
43
|
+
],
|
|
44
|
+
"publishConfig": {
|
|
45
|
+
"access": "public"
|
|
46
|
+
},
|
|
47
|
+
"dependencies": {
|
|
48
|
+
"cn": "^0.4.0",
|
|
49
|
+
"lucide-react": "^1.57.0"
|
|
50
|
+
},
|
|
51
|
+
"peerDependencies": {
|
|
52
|
+
"@zukhruf/shadcn": "^0.3.31",
|
|
53
|
+
"react": "^19.0.0",
|
|
54
|
+
"react-dom": "^19.0.0",
|
|
55
|
+
"tailwindcss": "^4.0.0"
|
|
56
|
+
}
|
|
57
|
+
}
|
package/styles.css
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@source "./dist";
|