@yamada-ui/button 0.0.0-dev-20230603042803

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) 2023 Hirotomo Yamada
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,28 @@
1
+ # @yamada-ui/button
2
+
3
+ ## Installation
4
+
5
+ ```sh
6
+ $ pnpm add @yamada-ui/button
7
+ ```
8
+
9
+ or
10
+
11
+ ```sh
12
+ $ yarn add @yamada-ui/button
13
+ ```
14
+
15
+ or
16
+
17
+ ```sh
18
+ $ npm install @yamada-ui/button
19
+ ```
20
+
21
+ ## Contribution
22
+
23
+ Wouldn't you like to contribute? That's amazing! We have prepared a [contribution guide](https://github.com/hirotomoyamada/yamada-ui/blob/main/CONTRIBUTING.md) to assist you.
24
+
25
+ ## Licence
26
+
27
+ This package is licensed under the terms of the
28
+ [MIT license](https://github.com/hirotomoyamada/yamada-ui/blob/main/LICENSE).
@@ -0,0 +1,17 @@
1
+ import * as _yamada_ui_core from '@yamada-ui/core';
2
+ import { HTMLUIProps, ThemeProps, CSSUIProps } from '@yamada-ui/core';
3
+
4
+ type ButtonGroupOptions = {
5
+ direction?: CSSUIProps['flexDirection'];
6
+ isAttached?: boolean;
7
+ isDisabled?: boolean;
8
+ };
9
+ type ButtonGroupProps = HTMLUIProps<'div'> & ThemeProps<'Button'> & ButtonGroupOptions;
10
+ type ButtonGroupContext = ThemeProps<'Button'> & {
11
+ isDisabled?: boolean;
12
+ };
13
+ declare const useButtonGroup: () => ButtonGroupContext;
14
+
15
+ declare const ButtonGroup: _yamada_ui_core.Component<"div", ButtonGroupProps>;
16
+
17
+ export { ButtonGroup, ButtonGroupProps, useButtonGroup };
@@ -0,0 +1,87 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/button-group.tsx
21
+ var button_group_exports = {};
22
+ __export(button_group_exports, {
23
+ ButtonGroup: () => ButtonGroup,
24
+ useButtonGroup: () => useButtonGroup
25
+ });
26
+ module.exports = __toCommonJS(button_group_exports);
27
+ var import_core = require("@yamada-ui/core");
28
+ var import_utils = require("@yamada-ui/utils");
29
+ var import_react = require("react");
30
+ var import_jsx_runtime = require("react/jsx-runtime");
31
+ var [ButtonGroupProvider, useButtonGroup] = (0, import_utils.createContext)({
32
+ strict: false,
33
+ name: "ButtonGroupContext"
34
+ });
35
+ var ButtonGroup = (0, import_core.forwardRef)(
36
+ ({
37
+ className,
38
+ size,
39
+ variant,
40
+ direction: flexDirection,
41
+ isAttached,
42
+ isDisabled,
43
+ gap,
44
+ columnGap,
45
+ rowGap,
46
+ ...rest
47
+ }, ref) => {
48
+ const isColumn = flexDirection === "column" || flexDirection === "column-reverse";
49
+ const css = {
50
+ display: "inline-flex",
51
+ flexDirection
52
+ };
53
+ const context = (0, import_react.useMemo)(
54
+ () => ({ size, variant, isDisabled }),
55
+ [size, variant, isDisabled]
56
+ );
57
+ if (isAttached) {
58
+ Object.assign(css, {
59
+ "> *:first-of-type:not(:last-of-type)": isColumn ? { borderBottomRadius: 0, marginBlockEnd: "-1px" } : { borderRightRadius: 0, marginInlineEnd: "-1px" },
60
+ "> *:not(:first-of-type):not(:last-of-type)": isColumn ? { borderRadius: 0, marginBlockStart: "-1px" } : { borderRadius: 0, marginInlineEnd: "-1px" },
61
+ "> *:not(:first-of-type):last-of-type": isColumn ? { borderTopRadius: 0, marginBlockStart: "-1px" } : { borderLeftRadius: 0 }
62
+ });
63
+ } else {
64
+ Object.assign(css, {
65
+ gap,
66
+ columnGap,
67
+ rowGap
68
+ });
69
+ }
70
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ButtonGroupProvider, { value: context, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
71
+ import_core.ui.div,
72
+ {
73
+ ref,
74
+ role: "group",
75
+ className: (0, import_utils.cx)("ui-button-group", className),
76
+ "data-attached": (0, import_utils.dataAttr)(isAttached),
77
+ __css: css,
78
+ ...rest
79
+ }
80
+ ) });
81
+ }
82
+ );
83
+ // Annotate the CommonJS export names for ESM import in node:
84
+ 0 && (module.exports = {
85
+ ButtonGroup,
86
+ useButtonGroup
87
+ });
@@ -0,0 +1,8 @@
1
+ import {
2
+ ButtonGroup,
3
+ useButtonGroup
4
+ } from "./chunk-ZJ6VNE3P.mjs";
5
+ export {
6
+ ButtonGroup,
7
+ useButtonGroup
8
+ };
@@ -0,0 +1,24 @@
1
+ import * as _yamada_ui_core from '@yamada-ui/core';
2
+ import { HTMLUIProps, ThemeProps } from '@yamada-ui/core';
3
+ import { LoadingProps } from '@yamada-ui/loading';
4
+ import { ElementType } from 'react';
5
+
6
+ type ButtonOptions = {
7
+ type?: 'button' | 'reset' | 'submit';
8
+ isLoading?: boolean;
9
+ isActive?: boolean;
10
+ isDisabled?: boolean;
11
+ leftIcon?: React.ReactElement;
12
+ rightIcon?: React.ReactElement;
13
+ loadingIcon?: React.ReactElement | LoadingProps['variant'];
14
+ loadingText?: string;
15
+ loadingPlacement?: 'start' | 'end';
16
+ };
17
+ type ButtonProps = HTMLUIProps<'button'> & ThemeProps<'Button'> & ButtonOptions;
18
+ declare const Button: _yamada_ui_core.Component<"button", ButtonProps>;
19
+ declare const useButtonType: (value?: ElementType) => {
20
+ readonly ref: (node: HTMLElement | null) => void;
21
+ readonly type: "button" | undefined;
22
+ };
23
+
24
+ export { Button, ButtonProps, useButtonType };
package/dist/button.js ADDED
@@ -0,0 +1,222 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/button.tsx
21
+ var button_exports = {};
22
+ __export(button_exports, {
23
+ Button: () => Button,
24
+ useButtonType: () => useButtonType
25
+ });
26
+ module.exports = __toCommonJS(button_exports);
27
+ var import_core2 = require("@yamada-ui/core");
28
+ var import_loading = require("@yamada-ui/loading");
29
+ var import_utils2 = require("@yamada-ui/utils");
30
+ var import_react2 = require("react");
31
+
32
+ // src/button-group.tsx
33
+ var import_core = require("@yamada-ui/core");
34
+ var import_utils = require("@yamada-ui/utils");
35
+ var import_react = require("react");
36
+ var import_jsx_runtime = require("react/jsx-runtime");
37
+ var [ButtonGroupProvider, useButtonGroup] = (0, import_utils.createContext)({
38
+ strict: false,
39
+ name: "ButtonGroupContext"
40
+ });
41
+ var ButtonGroup = (0, import_core.forwardRef)(
42
+ ({
43
+ className,
44
+ size,
45
+ variant,
46
+ direction: flexDirection,
47
+ isAttached,
48
+ isDisabled,
49
+ gap,
50
+ columnGap,
51
+ rowGap,
52
+ ...rest
53
+ }, ref) => {
54
+ const isColumn = flexDirection === "column" || flexDirection === "column-reverse";
55
+ const css = {
56
+ display: "inline-flex",
57
+ flexDirection
58
+ };
59
+ const context = (0, import_react.useMemo)(
60
+ () => ({ size, variant, isDisabled }),
61
+ [size, variant, isDisabled]
62
+ );
63
+ if (isAttached) {
64
+ Object.assign(css, {
65
+ "> *:first-of-type:not(:last-of-type)": isColumn ? { borderBottomRadius: 0, marginBlockEnd: "-1px" } : { borderRightRadius: 0, marginInlineEnd: "-1px" },
66
+ "> *:not(:first-of-type):not(:last-of-type)": isColumn ? { borderRadius: 0, marginBlockStart: "-1px" } : { borderRadius: 0, marginInlineEnd: "-1px" },
67
+ "> *:not(:first-of-type):last-of-type": isColumn ? { borderTopRadius: 0, marginBlockStart: "-1px" } : { borderLeftRadius: 0 }
68
+ });
69
+ } else {
70
+ Object.assign(css, {
71
+ gap,
72
+ columnGap,
73
+ rowGap
74
+ });
75
+ }
76
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ButtonGroupProvider, { value: context, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
77
+ import_core.ui.div,
78
+ {
79
+ ref,
80
+ role: "group",
81
+ className: (0, import_utils.cx)("ui-button-group", className),
82
+ "data-attached": (0, import_utils.dataAttr)(isAttached),
83
+ __css: css,
84
+ ...rest
85
+ }
86
+ ) });
87
+ }
88
+ );
89
+
90
+ // src/button.tsx
91
+ var import_jsx_runtime2 = require("react/jsx-runtime");
92
+ var Button = (0, import_core2.forwardRef)(({ children, ...props }, customRef) => {
93
+ const group = useButtonGroup();
94
+ const [styles, mergedProps] = (0, import_core2.useComponentStyle)("Button", { ...group, ...props });
95
+ const {
96
+ className,
97
+ as,
98
+ type,
99
+ isLoading,
100
+ isActive,
101
+ isDisabled = group == null ? void 0 : group.isDisabled,
102
+ leftIcon,
103
+ rightIcon,
104
+ loadingIcon,
105
+ loadingText,
106
+ loadingPlacement = "start",
107
+ __css,
108
+ ...rest
109
+ } = (0, import_core2.omitThemeProps)(mergedProps);
110
+ const { ref: buttonRef, type: defaultType } = useButtonType(as);
111
+ const ref = (0, import_utils2.useMergeRefs)(customRef, buttonRef);
112
+ const css = (0, import_react2.useMemo)(() => {
113
+ var _a;
114
+ const _focus = "_focus" in styles ? (0, import_utils2.merge)((_a = styles._focus) != null ? _a : {}, { zIndex: 1 }) : {};
115
+ return {
116
+ display: "inline-flex",
117
+ alignItems: "center",
118
+ justifyContent: "center",
119
+ gap: "2",
120
+ appearance: "none",
121
+ userSelect: "none",
122
+ position: "relative",
123
+ whiteSpace: "nowrap",
124
+ verticalAlign: "middle",
125
+ outline: "none",
126
+ ...styles,
127
+ ...__css,
128
+ ...!!group ? { _focus } : {}
129
+ };
130
+ }, [styles, __css, group]);
131
+ const contentProps = {
132
+ leftIcon,
133
+ rightIcon,
134
+ children
135
+ };
136
+ const loadingProps = {
137
+ loadingIcon,
138
+ loadingText
139
+ };
140
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
141
+ import_core2.ui.button,
142
+ {
143
+ ref,
144
+ as,
145
+ className: (0, import_utils2.cx)("ui-button", className),
146
+ type: type != null ? type : defaultType,
147
+ disabled: isDisabled || isLoading,
148
+ "data-active": (0, import_utils2.dataAttr)(isActive),
149
+ "data-loading": (0, import_utils2.dataAttr)(isLoading),
150
+ __css: css,
151
+ ...rest,
152
+ children: [
153
+ isLoading && loadingPlacement === "start" ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Loading, { className: "ui-button-loading--start", ...loadingProps }) : null,
154
+ isLoading ? loadingText || /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_core2.ui.span, { opacity: 0, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Content, { ...contentProps }) }) : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Content, { ...contentProps }),
155
+ isLoading && loadingPlacement === "end" ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Loading, { className: "ui-button-loading--end", ...loadingProps }) : null
156
+ ]
157
+ }
158
+ );
159
+ });
160
+ var Loading = ({
161
+ className,
162
+ loadingIcon,
163
+ loadingText
164
+ }) => {
165
+ const css = (0, import_react2.useMemo)(
166
+ () => ({
167
+ display: "flex",
168
+ alignItems: "center",
169
+ position: loadingText ? "relative" : "absolute",
170
+ fontSize: "1em",
171
+ lineHeight: "normal"
172
+ }),
173
+ [loadingText]
174
+ );
175
+ const element = (0, import_react2.useMemo)(() => {
176
+ if (typeof loadingIcon === "string") {
177
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_loading.Loading, { color: "current", variant: loadingIcon });
178
+ } else {
179
+ return loadingIcon || /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_loading.Loading, { color: "current" });
180
+ }
181
+ }, [loadingIcon]);
182
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_core2.ui.div, { className: (0, import_utils2.cx)("ui-button-loading", className), __css: css, children: element });
183
+ };
184
+ var Content = ({
185
+ leftIcon,
186
+ rightIcon,
187
+ children
188
+ }) => {
189
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
190
+ leftIcon ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Icon, { children: leftIcon }) : null,
191
+ children,
192
+ rightIcon ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Icon, { children: rightIcon }) : null
193
+ ] });
194
+ };
195
+ var Icon = ({ children, className, ...rest }) => {
196
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
197
+ import_core2.ui.span,
198
+ {
199
+ className: (0, import_utils2.cx)("ui-button-icon", className),
200
+ display: "inline-flex",
201
+ alignSelf: "center",
202
+ flexShrink: 0,
203
+ "aria-hidden": true,
204
+ ...rest,
205
+ children
206
+ }
207
+ );
208
+ };
209
+ var useButtonType = (value) => {
210
+ const [isButton, setIsButton] = (0, import_react2.useState)(!value);
211
+ const ref = (0, import_react2.useCallback)((node) => {
212
+ if (node)
213
+ setIsButton(node.tagName === "BUTTON");
214
+ }, []);
215
+ const type = isButton ? "button" : void 0;
216
+ return { ref, type };
217
+ };
218
+ // Annotate the CommonJS export names for ESM import in node:
219
+ 0 && (module.exports = {
220
+ Button,
221
+ useButtonType
222
+ });
@@ -0,0 +1,9 @@
1
+ import {
2
+ Button,
3
+ useButtonType
4
+ } from "./chunk-3D73QVPP.mjs";
5
+ import "./chunk-ZJ6VNE3P.mjs";
6
+ export {
7
+ Button,
8
+ useButtonType
9
+ };
@@ -0,0 +1,158 @@
1
+ import {
2
+ useButtonGroup
3
+ } from "./chunk-ZJ6VNE3P.mjs";
4
+
5
+ // src/icon-button.tsx
6
+ import { forwardRef as forwardRef2 } from "@yamada-ui/core";
7
+
8
+ // src/button.tsx
9
+ import {
10
+ ui,
11
+ forwardRef,
12
+ useComponentStyle,
13
+ omitThemeProps
14
+ } from "@yamada-ui/core";
15
+ import { Loading as LoadingIcon } from "@yamada-ui/loading";
16
+ import { cx, useMergeRefs, merge, dataAttr } from "@yamada-ui/utils";
17
+ import { useCallback, useMemo, useState } from "react";
18
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
19
+ var Button = forwardRef(({ children, ...props }, customRef) => {
20
+ const group = useButtonGroup();
21
+ const [styles, mergedProps] = useComponentStyle("Button", { ...group, ...props });
22
+ const {
23
+ className,
24
+ as,
25
+ type,
26
+ isLoading,
27
+ isActive,
28
+ isDisabled = group == null ? void 0 : group.isDisabled,
29
+ leftIcon,
30
+ rightIcon,
31
+ loadingIcon,
32
+ loadingText,
33
+ loadingPlacement = "start",
34
+ __css,
35
+ ...rest
36
+ } = omitThemeProps(mergedProps);
37
+ const { ref: buttonRef, type: defaultType } = useButtonType(as);
38
+ const ref = useMergeRefs(customRef, buttonRef);
39
+ const css = useMemo(() => {
40
+ var _a;
41
+ const _focus = "_focus" in styles ? merge((_a = styles._focus) != null ? _a : {}, { zIndex: 1 }) : {};
42
+ return {
43
+ display: "inline-flex",
44
+ alignItems: "center",
45
+ justifyContent: "center",
46
+ gap: "2",
47
+ appearance: "none",
48
+ userSelect: "none",
49
+ position: "relative",
50
+ whiteSpace: "nowrap",
51
+ verticalAlign: "middle",
52
+ outline: "none",
53
+ ...styles,
54
+ ...__css,
55
+ ...!!group ? { _focus } : {}
56
+ };
57
+ }, [styles, __css, group]);
58
+ const contentProps = {
59
+ leftIcon,
60
+ rightIcon,
61
+ children
62
+ };
63
+ const loadingProps = {
64
+ loadingIcon,
65
+ loadingText
66
+ };
67
+ return /* @__PURE__ */ jsxs(
68
+ ui.button,
69
+ {
70
+ ref,
71
+ as,
72
+ className: cx("ui-button", className),
73
+ type: type != null ? type : defaultType,
74
+ disabled: isDisabled || isLoading,
75
+ "data-active": dataAttr(isActive),
76
+ "data-loading": dataAttr(isLoading),
77
+ __css: css,
78
+ ...rest,
79
+ children: [
80
+ isLoading && loadingPlacement === "start" ? /* @__PURE__ */ jsx(Loading, { className: "ui-button-loading--start", ...loadingProps }) : null,
81
+ isLoading ? loadingText || /* @__PURE__ */ jsx(ui.span, { opacity: 0, children: /* @__PURE__ */ jsx(Content, { ...contentProps }) }) : /* @__PURE__ */ jsx(Content, { ...contentProps }),
82
+ isLoading && loadingPlacement === "end" ? /* @__PURE__ */ jsx(Loading, { className: "ui-button-loading--end", ...loadingProps }) : null
83
+ ]
84
+ }
85
+ );
86
+ });
87
+ var Loading = ({
88
+ className,
89
+ loadingIcon,
90
+ loadingText
91
+ }) => {
92
+ const css = useMemo(
93
+ () => ({
94
+ display: "flex",
95
+ alignItems: "center",
96
+ position: loadingText ? "relative" : "absolute",
97
+ fontSize: "1em",
98
+ lineHeight: "normal"
99
+ }),
100
+ [loadingText]
101
+ );
102
+ const element = useMemo(() => {
103
+ if (typeof loadingIcon === "string") {
104
+ return /* @__PURE__ */ jsx(LoadingIcon, { color: "current", variant: loadingIcon });
105
+ } else {
106
+ return loadingIcon || /* @__PURE__ */ jsx(LoadingIcon, { color: "current" });
107
+ }
108
+ }, [loadingIcon]);
109
+ return /* @__PURE__ */ jsx(ui.div, { className: cx("ui-button-loading", className), __css: css, children: element });
110
+ };
111
+ var Content = ({
112
+ leftIcon,
113
+ rightIcon,
114
+ children
115
+ }) => {
116
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
117
+ leftIcon ? /* @__PURE__ */ jsx(Icon, { children: leftIcon }) : null,
118
+ children,
119
+ rightIcon ? /* @__PURE__ */ jsx(Icon, { children: rightIcon }) : null
120
+ ] });
121
+ };
122
+ var Icon = ({ children, className, ...rest }) => {
123
+ return /* @__PURE__ */ jsx(
124
+ ui.span,
125
+ {
126
+ className: cx("ui-button-icon", className),
127
+ display: "inline-flex",
128
+ alignSelf: "center",
129
+ flexShrink: 0,
130
+ "aria-hidden": true,
131
+ ...rest,
132
+ children
133
+ }
134
+ );
135
+ };
136
+ var useButtonType = (value) => {
137
+ const [isButton, setIsButton] = useState(!value);
138
+ const ref = useCallback((node) => {
139
+ if (node)
140
+ setIsButton(node.tagName === "BUTTON");
141
+ }, []);
142
+ const type = isButton ? "button" : void 0;
143
+ return { ref, type };
144
+ };
145
+
146
+ // src/icon-button.tsx
147
+ import { jsx as jsx2 } from "react/jsx-runtime";
148
+ var IconButton = forwardRef2(
149
+ ({ icon, isRound, children, ...rest }, ref) => {
150
+ return /* @__PURE__ */ jsx2(Button, { ref, p: 0, ...isRound ? { rounded: "full" } : {}, ...rest, children: icon || children });
151
+ }
152
+ );
153
+
154
+ export {
155
+ IconButton,
156
+ Button,
157
+ useButtonType
158
+ };
@@ -0,0 +1,62 @@
1
+ // src/button-group.tsx
2
+ import { ui, forwardRef } from "@yamada-ui/core";
3
+ import { createContext, cx, dataAttr } from "@yamada-ui/utils";
4
+ import { useMemo } from "react";
5
+ import { jsx } from "react/jsx-runtime";
6
+ var [ButtonGroupProvider, useButtonGroup] = createContext({
7
+ strict: false,
8
+ name: "ButtonGroupContext"
9
+ });
10
+ var ButtonGroup = forwardRef(
11
+ ({
12
+ className,
13
+ size,
14
+ variant,
15
+ direction: flexDirection,
16
+ isAttached,
17
+ isDisabled,
18
+ gap,
19
+ columnGap,
20
+ rowGap,
21
+ ...rest
22
+ }, ref) => {
23
+ const isColumn = flexDirection === "column" || flexDirection === "column-reverse";
24
+ const css = {
25
+ display: "inline-flex",
26
+ flexDirection
27
+ };
28
+ const context = useMemo(
29
+ () => ({ size, variant, isDisabled }),
30
+ [size, variant, isDisabled]
31
+ );
32
+ if (isAttached) {
33
+ Object.assign(css, {
34
+ "> *:first-of-type:not(:last-of-type)": isColumn ? { borderBottomRadius: 0, marginBlockEnd: "-1px" } : { borderRightRadius: 0, marginInlineEnd: "-1px" },
35
+ "> *:not(:first-of-type):not(:last-of-type)": isColumn ? { borderRadius: 0, marginBlockStart: "-1px" } : { borderRadius: 0, marginInlineEnd: "-1px" },
36
+ "> *:not(:first-of-type):last-of-type": isColumn ? { borderTopRadius: 0, marginBlockStart: "-1px" } : { borderLeftRadius: 0 }
37
+ });
38
+ } else {
39
+ Object.assign(css, {
40
+ gap,
41
+ columnGap,
42
+ rowGap
43
+ });
44
+ }
45
+ return /* @__PURE__ */ jsx(ButtonGroupProvider, { value: context, children: /* @__PURE__ */ jsx(
46
+ ui.div,
47
+ {
48
+ ref,
49
+ role: "group",
50
+ className: cx("ui-button-group", className),
51
+ "data-attached": dataAttr(isAttached),
52
+ __css: css,
53
+ ...rest
54
+ }
55
+ ) });
56
+ }
57
+ );
58
+
59
+ export {
60
+ useButtonGroup,
61
+ ButtonGroup
62
+ };
@@ -0,0 +1,13 @@
1
+ import * as _yamada_ui_core from '@yamada-ui/core';
2
+ import { ReactElement } from 'react';
3
+ import { ButtonProps } from './button.js';
4
+ import '@yamada-ui/loading';
5
+
6
+ type IconButtonOptions = {
7
+ icon?: ReactElement;
8
+ isRound?: boolean;
9
+ };
10
+ type IconButtonProps = Omit<ButtonProps, 'leftIcon' | 'rightIcon' | 'loadingIcon' | 'loadingText' | 'loadingPlacement'> & IconButtonOptions;
11
+ declare const IconButton: _yamada_ui_core.Component<"button", IconButtonProps>;
12
+
13
+ export { IconButton, IconButtonProps };
@@ -0,0 +1,229 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/icon-button.tsx
21
+ var icon_button_exports = {};
22
+ __export(icon_button_exports, {
23
+ IconButton: () => IconButton
24
+ });
25
+ module.exports = __toCommonJS(icon_button_exports);
26
+ var import_core3 = require("@yamada-ui/core");
27
+
28
+ // src/button.tsx
29
+ var import_core = require("@yamada-ui/core");
30
+ var import_loading = require("@yamada-ui/loading");
31
+ var import_utils = require("@yamada-ui/utils");
32
+ var import_react = require("react");
33
+ var import_jsx_runtime = require("react/jsx-runtime");
34
+ var Button = (0, import_core.forwardRef)(({ children, ...props }, customRef) => {
35
+ const group = useButtonGroup();
36
+ const [styles, mergedProps] = (0, import_core.useComponentStyle)("Button", { ...group, ...props });
37
+ const {
38
+ className,
39
+ as,
40
+ type,
41
+ isLoading,
42
+ isActive,
43
+ isDisabled = group == null ? void 0 : group.isDisabled,
44
+ leftIcon,
45
+ rightIcon,
46
+ loadingIcon,
47
+ loadingText,
48
+ loadingPlacement = "start",
49
+ __css,
50
+ ...rest
51
+ } = (0, import_core.omitThemeProps)(mergedProps);
52
+ const { ref: buttonRef, type: defaultType } = useButtonType(as);
53
+ const ref = (0, import_utils.useMergeRefs)(customRef, buttonRef);
54
+ const css = (0, import_react.useMemo)(() => {
55
+ var _a;
56
+ const _focus = "_focus" in styles ? (0, import_utils.merge)((_a = styles._focus) != null ? _a : {}, { zIndex: 1 }) : {};
57
+ return {
58
+ display: "inline-flex",
59
+ alignItems: "center",
60
+ justifyContent: "center",
61
+ gap: "2",
62
+ appearance: "none",
63
+ userSelect: "none",
64
+ position: "relative",
65
+ whiteSpace: "nowrap",
66
+ verticalAlign: "middle",
67
+ outline: "none",
68
+ ...styles,
69
+ ...__css,
70
+ ...!!group ? { _focus } : {}
71
+ };
72
+ }, [styles, __css, group]);
73
+ const contentProps = {
74
+ leftIcon,
75
+ rightIcon,
76
+ children
77
+ };
78
+ const loadingProps = {
79
+ loadingIcon,
80
+ loadingText
81
+ };
82
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
83
+ import_core.ui.button,
84
+ {
85
+ ref,
86
+ as,
87
+ className: (0, import_utils.cx)("ui-button", className),
88
+ type: type != null ? type : defaultType,
89
+ disabled: isDisabled || isLoading,
90
+ "data-active": (0, import_utils.dataAttr)(isActive),
91
+ "data-loading": (0, import_utils.dataAttr)(isLoading),
92
+ __css: css,
93
+ ...rest,
94
+ children: [
95
+ isLoading && loadingPlacement === "start" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Loading, { className: "ui-button-loading--start", ...loadingProps }) : null,
96
+ isLoading ? loadingText || /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_core.ui.span, { opacity: 0, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Content, { ...contentProps }) }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Content, { ...contentProps }),
97
+ isLoading && loadingPlacement === "end" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Loading, { className: "ui-button-loading--end", ...loadingProps }) : null
98
+ ]
99
+ }
100
+ );
101
+ });
102
+ var Loading = ({
103
+ className,
104
+ loadingIcon,
105
+ loadingText
106
+ }) => {
107
+ const css = (0, import_react.useMemo)(
108
+ () => ({
109
+ display: "flex",
110
+ alignItems: "center",
111
+ position: loadingText ? "relative" : "absolute",
112
+ fontSize: "1em",
113
+ lineHeight: "normal"
114
+ }),
115
+ [loadingText]
116
+ );
117
+ const element = (0, import_react.useMemo)(() => {
118
+ if (typeof loadingIcon === "string") {
119
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_loading.Loading, { color: "current", variant: loadingIcon });
120
+ } else {
121
+ return loadingIcon || /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_loading.Loading, { color: "current" });
122
+ }
123
+ }, [loadingIcon]);
124
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_core.ui.div, { className: (0, import_utils.cx)("ui-button-loading", className), __css: css, children: element });
125
+ };
126
+ var Content = ({
127
+ leftIcon,
128
+ rightIcon,
129
+ children
130
+ }) => {
131
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
132
+ leftIcon ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Icon, { children: leftIcon }) : null,
133
+ children,
134
+ rightIcon ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Icon, { children: rightIcon }) : null
135
+ ] });
136
+ };
137
+ var Icon = ({ children, className, ...rest }) => {
138
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
139
+ import_core.ui.span,
140
+ {
141
+ className: (0, import_utils.cx)("ui-button-icon", className),
142
+ display: "inline-flex",
143
+ alignSelf: "center",
144
+ flexShrink: 0,
145
+ "aria-hidden": true,
146
+ ...rest,
147
+ children
148
+ }
149
+ );
150
+ };
151
+ var useButtonType = (value) => {
152
+ const [isButton, setIsButton] = (0, import_react.useState)(!value);
153
+ const ref = (0, import_react.useCallback)((node) => {
154
+ if (node)
155
+ setIsButton(node.tagName === "BUTTON");
156
+ }, []);
157
+ const type = isButton ? "button" : void 0;
158
+ return { ref, type };
159
+ };
160
+
161
+ // src/button-group.tsx
162
+ var import_core2 = require("@yamada-ui/core");
163
+ var import_utils2 = require("@yamada-ui/utils");
164
+ var import_react2 = require("react");
165
+ var import_jsx_runtime2 = require("react/jsx-runtime");
166
+ var [ButtonGroupProvider, useButtonGroup] = (0, import_utils2.createContext)({
167
+ strict: false,
168
+ name: "ButtonGroupContext"
169
+ });
170
+ var ButtonGroup = (0, import_core2.forwardRef)(
171
+ ({
172
+ className,
173
+ size,
174
+ variant,
175
+ direction: flexDirection,
176
+ isAttached,
177
+ isDisabled,
178
+ gap,
179
+ columnGap,
180
+ rowGap,
181
+ ...rest
182
+ }, ref) => {
183
+ const isColumn = flexDirection === "column" || flexDirection === "column-reverse";
184
+ const css = {
185
+ display: "inline-flex",
186
+ flexDirection
187
+ };
188
+ const context = (0, import_react2.useMemo)(
189
+ () => ({ size, variant, isDisabled }),
190
+ [size, variant, isDisabled]
191
+ );
192
+ if (isAttached) {
193
+ Object.assign(css, {
194
+ "> *:first-of-type:not(:last-of-type)": isColumn ? { borderBottomRadius: 0, marginBlockEnd: "-1px" } : { borderRightRadius: 0, marginInlineEnd: "-1px" },
195
+ "> *:not(:first-of-type):not(:last-of-type)": isColumn ? { borderRadius: 0, marginBlockStart: "-1px" } : { borderRadius: 0, marginInlineEnd: "-1px" },
196
+ "> *:not(:first-of-type):last-of-type": isColumn ? { borderTopRadius: 0, marginBlockStart: "-1px" } : { borderLeftRadius: 0 }
197
+ });
198
+ } else {
199
+ Object.assign(css, {
200
+ gap,
201
+ columnGap,
202
+ rowGap
203
+ });
204
+ }
205
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(ButtonGroupProvider, { value: context, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
206
+ import_core2.ui.div,
207
+ {
208
+ ref,
209
+ role: "group",
210
+ className: (0, import_utils2.cx)("ui-button-group", className),
211
+ "data-attached": (0, import_utils2.dataAttr)(isAttached),
212
+ __css: css,
213
+ ...rest
214
+ }
215
+ ) });
216
+ }
217
+ );
218
+
219
+ // src/icon-button.tsx
220
+ var import_jsx_runtime3 = require("react/jsx-runtime");
221
+ var IconButton = (0, import_core3.forwardRef)(
222
+ ({ icon, isRound, children, ...rest }, ref) => {
223
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Button, { ref, p: 0, ...isRound ? { rounded: "full" } : {}, ...rest, children: icon || children });
224
+ }
225
+ );
226
+ // Annotate the CommonJS export names for ESM import in node:
227
+ 0 && (module.exports = {
228
+ IconButton
229
+ });
@@ -0,0 +1,7 @@
1
+ import {
2
+ IconButton
3
+ } from "./chunk-3D73QVPP.mjs";
4
+ import "./chunk-ZJ6VNE3P.mjs";
5
+ export {
6
+ IconButton
7
+ };
@@ -0,0 +1,6 @@
1
+ export { Button, ButtonProps, useButtonType } from './button.js';
2
+ export { ButtonGroup, ButtonGroupProps, useButtonGroup } from './button-group.js';
3
+ export { IconButton, IconButtonProps } from './icon-button.js';
4
+ import '@yamada-ui/core';
5
+ import '@yamada-ui/loading';
6
+ import 'react';
package/dist/index.js ADDED
@@ -0,0 +1,237 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/index.ts
21
+ var src_exports = {};
22
+ __export(src_exports, {
23
+ Button: () => Button,
24
+ ButtonGroup: () => ButtonGroup,
25
+ IconButton: () => IconButton,
26
+ useButtonGroup: () => useButtonGroup,
27
+ useButtonType: () => useButtonType
28
+ });
29
+ module.exports = __toCommonJS(src_exports);
30
+
31
+ // src/button.tsx
32
+ var import_core = require("@yamada-ui/core");
33
+ var import_loading = require("@yamada-ui/loading");
34
+ var import_utils = require("@yamada-ui/utils");
35
+ var import_react = require("react");
36
+ var import_jsx_runtime = require("react/jsx-runtime");
37
+ var Button = (0, import_core.forwardRef)(({ children, ...props }, customRef) => {
38
+ const group = useButtonGroup();
39
+ const [styles, mergedProps] = (0, import_core.useComponentStyle)("Button", { ...group, ...props });
40
+ const {
41
+ className,
42
+ as,
43
+ type,
44
+ isLoading,
45
+ isActive,
46
+ isDisabled = group == null ? void 0 : group.isDisabled,
47
+ leftIcon,
48
+ rightIcon,
49
+ loadingIcon,
50
+ loadingText,
51
+ loadingPlacement = "start",
52
+ __css,
53
+ ...rest
54
+ } = (0, import_core.omitThemeProps)(mergedProps);
55
+ const { ref: buttonRef, type: defaultType } = useButtonType(as);
56
+ const ref = (0, import_utils.useMergeRefs)(customRef, buttonRef);
57
+ const css = (0, import_react.useMemo)(() => {
58
+ var _a;
59
+ const _focus = "_focus" in styles ? (0, import_utils.merge)((_a = styles._focus) != null ? _a : {}, { zIndex: 1 }) : {};
60
+ return {
61
+ display: "inline-flex",
62
+ alignItems: "center",
63
+ justifyContent: "center",
64
+ gap: "2",
65
+ appearance: "none",
66
+ userSelect: "none",
67
+ position: "relative",
68
+ whiteSpace: "nowrap",
69
+ verticalAlign: "middle",
70
+ outline: "none",
71
+ ...styles,
72
+ ...__css,
73
+ ...!!group ? { _focus } : {}
74
+ };
75
+ }, [styles, __css, group]);
76
+ const contentProps = {
77
+ leftIcon,
78
+ rightIcon,
79
+ children
80
+ };
81
+ const loadingProps = {
82
+ loadingIcon,
83
+ loadingText
84
+ };
85
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
86
+ import_core.ui.button,
87
+ {
88
+ ref,
89
+ as,
90
+ className: (0, import_utils.cx)("ui-button", className),
91
+ type: type != null ? type : defaultType,
92
+ disabled: isDisabled || isLoading,
93
+ "data-active": (0, import_utils.dataAttr)(isActive),
94
+ "data-loading": (0, import_utils.dataAttr)(isLoading),
95
+ __css: css,
96
+ ...rest,
97
+ children: [
98
+ isLoading && loadingPlacement === "start" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Loading, { className: "ui-button-loading--start", ...loadingProps }) : null,
99
+ isLoading ? loadingText || /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_core.ui.span, { opacity: 0, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Content, { ...contentProps }) }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Content, { ...contentProps }),
100
+ isLoading && loadingPlacement === "end" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Loading, { className: "ui-button-loading--end", ...loadingProps }) : null
101
+ ]
102
+ }
103
+ );
104
+ });
105
+ var Loading = ({
106
+ className,
107
+ loadingIcon,
108
+ loadingText
109
+ }) => {
110
+ const css = (0, import_react.useMemo)(
111
+ () => ({
112
+ display: "flex",
113
+ alignItems: "center",
114
+ position: loadingText ? "relative" : "absolute",
115
+ fontSize: "1em",
116
+ lineHeight: "normal"
117
+ }),
118
+ [loadingText]
119
+ );
120
+ const element = (0, import_react.useMemo)(() => {
121
+ if (typeof loadingIcon === "string") {
122
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_loading.Loading, { color: "current", variant: loadingIcon });
123
+ } else {
124
+ return loadingIcon || /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_loading.Loading, { color: "current" });
125
+ }
126
+ }, [loadingIcon]);
127
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_core.ui.div, { className: (0, import_utils.cx)("ui-button-loading", className), __css: css, children: element });
128
+ };
129
+ var Content = ({
130
+ leftIcon,
131
+ rightIcon,
132
+ children
133
+ }) => {
134
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
135
+ leftIcon ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Icon, { children: leftIcon }) : null,
136
+ children,
137
+ rightIcon ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Icon, { children: rightIcon }) : null
138
+ ] });
139
+ };
140
+ var Icon = ({ children, className, ...rest }) => {
141
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
142
+ import_core.ui.span,
143
+ {
144
+ className: (0, import_utils.cx)("ui-button-icon", className),
145
+ display: "inline-flex",
146
+ alignSelf: "center",
147
+ flexShrink: 0,
148
+ "aria-hidden": true,
149
+ ...rest,
150
+ children
151
+ }
152
+ );
153
+ };
154
+ var useButtonType = (value) => {
155
+ const [isButton, setIsButton] = (0, import_react.useState)(!value);
156
+ const ref = (0, import_react.useCallback)((node) => {
157
+ if (node)
158
+ setIsButton(node.tagName === "BUTTON");
159
+ }, []);
160
+ const type = isButton ? "button" : void 0;
161
+ return { ref, type };
162
+ };
163
+
164
+ // src/button-group.tsx
165
+ var import_core2 = require("@yamada-ui/core");
166
+ var import_utils2 = require("@yamada-ui/utils");
167
+ var import_react2 = require("react");
168
+ var import_jsx_runtime2 = require("react/jsx-runtime");
169
+ var [ButtonGroupProvider, useButtonGroup] = (0, import_utils2.createContext)({
170
+ strict: false,
171
+ name: "ButtonGroupContext"
172
+ });
173
+ var ButtonGroup = (0, import_core2.forwardRef)(
174
+ ({
175
+ className,
176
+ size,
177
+ variant,
178
+ direction: flexDirection,
179
+ isAttached,
180
+ isDisabled,
181
+ gap,
182
+ columnGap,
183
+ rowGap,
184
+ ...rest
185
+ }, ref) => {
186
+ const isColumn = flexDirection === "column" || flexDirection === "column-reverse";
187
+ const css = {
188
+ display: "inline-flex",
189
+ flexDirection
190
+ };
191
+ const context = (0, import_react2.useMemo)(
192
+ () => ({ size, variant, isDisabled }),
193
+ [size, variant, isDisabled]
194
+ );
195
+ if (isAttached) {
196
+ Object.assign(css, {
197
+ "> *:first-of-type:not(:last-of-type)": isColumn ? { borderBottomRadius: 0, marginBlockEnd: "-1px" } : { borderRightRadius: 0, marginInlineEnd: "-1px" },
198
+ "> *:not(:first-of-type):not(:last-of-type)": isColumn ? { borderRadius: 0, marginBlockStart: "-1px" } : { borderRadius: 0, marginInlineEnd: "-1px" },
199
+ "> *:not(:first-of-type):last-of-type": isColumn ? { borderTopRadius: 0, marginBlockStart: "-1px" } : { borderLeftRadius: 0 }
200
+ });
201
+ } else {
202
+ Object.assign(css, {
203
+ gap,
204
+ columnGap,
205
+ rowGap
206
+ });
207
+ }
208
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(ButtonGroupProvider, { value: context, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
209
+ import_core2.ui.div,
210
+ {
211
+ ref,
212
+ role: "group",
213
+ className: (0, import_utils2.cx)("ui-button-group", className),
214
+ "data-attached": (0, import_utils2.dataAttr)(isAttached),
215
+ __css: css,
216
+ ...rest
217
+ }
218
+ ) });
219
+ }
220
+ );
221
+
222
+ // src/icon-button.tsx
223
+ var import_core3 = require("@yamada-ui/core");
224
+ var import_jsx_runtime3 = require("react/jsx-runtime");
225
+ var IconButton = (0, import_core3.forwardRef)(
226
+ ({ icon, isRound, children, ...rest }, ref) => {
227
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Button, { ref, p: 0, ...isRound ? { rounded: "full" } : {}, ...rest, children: icon || children });
228
+ }
229
+ );
230
+ // Annotate the CommonJS export names for ESM import in node:
231
+ 0 && (module.exports = {
232
+ Button,
233
+ ButtonGroup,
234
+ IconButton,
235
+ useButtonGroup,
236
+ useButtonType
237
+ });
package/dist/index.mjs ADDED
@@ -0,0 +1,16 @@
1
+ import {
2
+ Button,
3
+ IconButton,
4
+ useButtonType
5
+ } from "./chunk-3D73QVPP.mjs";
6
+ import {
7
+ ButtonGroup,
8
+ useButtonGroup
9
+ } from "./chunk-ZJ6VNE3P.mjs";
10
+ export {
11
+ Button,
12
+ ButtonGroup,
13
+ IconButton,
14
+ useButtonGroup,
15
+ useButtonType
16
+ };
package/package.json ADDED
@@ -0,0 +1,78 @@
1
+ {
2
+ "name": "@yamada-ui/button",
3
+ "version": "0.0.0-dev-20230603042803",
4
+ "description": "Yamada UI button components",
5
+ "keywords": [
6
+ "yamada",
7
+ "yamada ui",
8
+ "react",
9
+ "emotion",
10
+ "component",
11
+ "button",
12
+ "icon-button",
13
+ "button-group",
14
+ "ui",
15
+ "uikit",
16
+ "styled",
17
+ "style-props",
18
+ "styled-component",
19
+ "css-in-js"
20
+ ],
21
+ "author": "Hirotomo Yamada <hirotomo.yamada@avap.co.jp>",
22
+ "license": "MIT",
23
+ "main": "dist/index.js",
24
+ "files": [
25
+ "dist"
26
+ ],
27
+ "sideEffects": false,
28
+ "publishConfig": {
29
+ "access": "public"
30
+ },
31
+ "repository": {
32
+ "type": "git",
33
+ "url": "git+https://github.com/hirotomoyamada/yamada-ui",
34
+ "directory": "packages/components/button"
35
+ },
36
+ "bugs": {
37
+ "url": "https://github.com/hirotomoyamada/yamada-ui/issues"
38
+ },
39
+ "dependencies": {
40
+ "@yamada-ui/core": "0.0.0-dev-20230603042803",
41
+ "@yamada-ui/utils": "0.1.0",
42
+ "@yamada-ui/loading": "0.0.0-dev-20230603042803"
43
+ },
44
+ "devDependencies": {
45
+ "react": "^18.0.0",
46
+ "clean-package": "2.2.0"
47
+ },
48
+ "peerDependencies": {
49
+ "react": ">=18"
50
+ },
51
+ "clean-package": "../../../clean-package.config.json",
52
+ "tsup": {
53
+ "clean": true,
54
+ "target": "es2019",
55
+ "format": [
56
+ "cjs",
57
+ "esm"
58
+ ]
59
+ },
60
+ "module": "dist/index.mjs",
61
+ "types": "dist/index.d.ts",
62
+ "exports": {
63
+ ".": {
64
+ "types": "./dist/index.d.ts",
65
+ "import": "./dist/index.mjs",
66
+ "require": "./dist/index.js"
67
+ },
68
+ "./package.json": "./package.json"
69
+ },
70
+ "scripts": {
71
+ "dev": "pnpm build:fast -- --watch",
72
+ "build": "tsup src --dts",
73
+ "build:fast": "tsup src",
74
+ "clean": "rimraf dist .turbo",
75
+ "typecheck": "tsc --noEmit",
76
+ "gen:docs": "tsx ../../../scripts/generate-docs"
77
+ }
78
+ }