@launchpad-ui/button
Advanced tools
Comparing version 0.8.13 to 0.8.14
@@ -7,5 +7,5 @@ import type { ComponentProps } from 'react'; | ||
}; | ||
declare const ButtonGroup: ({ spacing, className, children, "data-test-id": testId, ...rest }: ButtonGroupProps) => JSX.Element; | ||
declare const ButtonGroup: ({ spacing, className, children, "data-test-id": testId, ...rest }: ButtonGroupProps) => import("react/jsx-runtime").JSX.Element; | ||
export { ButtonGroup }; | ||
export type { ButtonGroupProps }; | ||
//# sourceMappingURL=ButtonGroup.d.ts.map |
import './style.css'; | ||
import { jsx, jsxs } from "react/jsx-runtime"; | ||
import { Slot } from "@radix-ui/react-slot"; | ||
import { cx } from "classix"; | ||
import { forwardRef, cloneElement, memo, isValidElement, useRef } from "react"; | ||
import { jsx, jsxs } from "react/jsx-runtime"; | ||
const Button$1 = ""; | ||
@@ -27,3 +27,10 @@ const ButtonComponent = forwardRef((props, ref) => { | ||
const Component = asChild ? Slot : "button"; | ||
const classes = cx("Button", `Button--${kind}`, disabled && "Button--disabled", size && `Button--${size}`, fit && "Button--fit", className); | ||
const classes = cx( | ||
"Button", | ||
`Button--${kind}`, | ||
disabled && "Button--disabled", | ||
size && `Button--${size}`, | ||
fit && "Button--fit", | ||
className | ||
); | ||
const getIconSize = () => { | ||
@@ -42,9 +49,9 @@ let iconSize = "small"; | ||
}); | ||
const getFinalChildren = (c) => [renderIconFirst && renderIcon, isLoading && /* @__PURE__ */ jsx("span", { | ||
children: loadingText || c | ||
}, "text"), !isLoading && c && /* @__PURE__ */ jsx("span", { | ||
children: c | ||
}, "text"), !renderIconFirst && renderIcon, isLoading && /* @__PURE__ */ jsx("span", { | ||
children: "\u2026" | ||
}, "spinner")]; | ||
const getFinalChildren = (c) => [ | ||
renderIconFirst && renderIcon, | ||
isLoading && /* @__PURE__ */ jsx("span", { children: loadingText || c }, "text"), | ||
!isLoading && c && /* @__PURE__ */ jsx("span", { children: c }, "text"), | ||
!renderIconFirst && renderIcon, | ||
isLoading && /* @__PURE__ */ jsx("span", { children: "…" }, "spinner") | ||
]; | ||
const renderChildren = () => { | ||
@@ -72,13 +79,16 @@ if (asChild && isValidElement(children)) { | ||
}; | ||
return /* @__PURE__ */ jsx(Component, { | ||
className: classes, | ||
ref, | ||
onClick: handleClick, | ||
onKeyDown: onKeyDown || handleKeyDown, | ||
disabled: isDisabled, | ||
type: asChild ? void 0 : type, | ||
"data-test-id": testId, | ||
...rest, | ||
children: renderChildren() | ||
}); | ||
return /* @__PURE__ */ jsx( | ||
Component, | ||
{ | ||
className: classes, | ||
ref, | ||
onClick: handleClick, | ||
onKeyDown: onKeyDown || handleKeyDown, | ||
disabled: isDisabled, | ||
type: asChild ? void 0 : type, | ||
"data-test-id": testId, | ||
...rest, | ||
children: renderChildren() | ||
} | ||
); | ||
}); | ||
@@ -96,8 +106,3 @@ ButtonComponent.displayName = "Button"; | ||
const classes = cx("ButtonGroup", `ButtonGroup--${spacing}`, className); | ||
return /* @__PURE__ */ jsx("div", { | ||
className: classes, | ||
"data-test-id": testId, | ||
...rest, | ||
children | ||
}); | ||
return /* @__PURE__ */ jsx("div", { className: classes, "data-test-id": testId, ...rest, children }); | ||
}; | ||
@@ -145,21 +150,20 @@ const UploadButton = ({ | ||
}; | ||
return /* @__PURE__ */ jsxs("span", { | ||
className: classes, | ||
"data-test-id": testId, | ||
children: [/* @__PURE__ */ jsx("input", { | ||
ref: inputRef, | ||
className: "UploadButton-input", | ||
id, | ||
style: { | ||
display: "none" | ||
}, | ||
type: "file", | ||
onChange: handleChange, | ||
disabled, | ||
accept, | ||
"data-test-id": "upload-button-input" | ||
}), /* @__PURE__ */ jsx("label", { | ||
htmlFor: id, | ||
className: "UploadButton-label", | ||
children: /* @__PURE__ */ jsx(Button, { | ||
return /* @__PURE__ */ jsxs("span", { className: classes, "data-test-id": testId, children: [ | ||
/* @__PURE__ */ jsx( | ||
"input", | ||
{ | ||
ref: inputRef, | ||
className: "UploadButton-input", | ||
id, | ||
style: { display: "none" }, | ||
type: "file", | ||
onChange: handleChange, | ||
disabled, | ||
accept, | ||
"data-test-id": "upload-button-input" | ||
} | ||
), | ||
/* @__PURE__ */ jsx("label", { htmlFor: id, className: "UploadButton-label", children: /* @__PURE__ */ jsx( | ||
Button, | ||
{ | ||
...rest, | ||
@@ -172,5 +176,5 @@ disabled, | ||
children | ||
}) | ||
})] | ||
}); | ||
} | ||
) }) | ||
] }); | ||
}; | ||
@@ -193,3 +197,11 @@ const IconButtonComponent = forwardRef((props, ref) => { | ||
const Component = asChild ? Slot : "button"; | ||
const classes = cx("IconButton", "Button", "Button--icon", `Button--${kind}`, disabled && "Button--disabled", size && `Button--${size}`, className); | ||
const classes = cx( | ||
"IconButton", | ||
"Button", | ||
"Button--icon", | ||
`Button--${kind}`, | ||
disabled && "Button--disabled", | ||
size && `Button--${size}`, | ||
className | ||
); | ||
const iconSize = () => { | ||
@@ -227,13 +239,16 @@ if (props.size === "small") | ||
}; | ||
return /* @__PURE__ */ jsx(Component, { | ||
className: classes, | ||
ref, | ||
onClick: handleClick, | ||
disabled, | ||
onKeyDown: onKeyDown || handleKeyDown, | ||
type, | ||
"data-test-id": testId, | ||
...rest, | ||
children: renderChildren() | ||
}); | ||
return /* @__PURE__ */ jsx( | ||
Component, | ||
{ | ||
className: classes, | ||
ref, | ||
onClick: handleClick, | ||
disabled, | ||
onKeyDown: onKeyDown || handleKeyDown, | ||
type, | ||
"data-test-id": testId, | ||
...rest, | ||
children: renderChildren() | ||
} | ||
); | ||
}); | ||
@@ -240,0 +255,0 @@ IconButtonComponent.displayName = "IconButton"; |
require('./style.css'); | ||
"use strict"; | ||
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } }); | ||
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" }); | ||
const jsxRuntime = require("react/jsx-runtime"); | ||
const reactSlot = require("@radix-ui/react-slot"); | ||
const classix = require("classix"); | ||
const react = require("react"); | ||
const jsxRuntime = require("react/jsx-runtime"); | ||
const Button$1 = ""; | ||
@@ -29,3 +29,10 @@ const ButtonComponent = react.forwardRef((props, ref) => { | ||
const Component = asChild ? reactSlot.Slot : "button"; | ||
const classes = classix.cx("Button", `Button--${kind}`, disabled && "Button--disabled", size && `Button--${size}`, fit && "Button--fit", className); | ||
const classes = classix.cx( | ||
"Button", | ||
`Button--${kind}`, | ||
disabled && "Button--disabled", | ||
size && `Button--${size}`, | ||
fit && "Button--fit", | ||
className | ||
); | ||
const getIconSize = () => { | ||
@@ -44,9 +51,9 @@ let iconSize = "small"; | ||
}); | ||
const getFinalChildren = (c) => [renderIconFirst && renderIcon, isLoading && /* @__PURE__ */ jsxRuntime.jsx("span", { | ||
children: loadingText || c | ||
}, "text"), !isLoading && c && /* @__PURE__ */ jsxRuntime.jsx("span", { | ||
children: c | ||
}, "text"), !renderIconFirst && renderIcon, isLoading && /* @__PURE__ */ jsxRuntime.jsx("span", { | ||
children: "\u2026" | ||
}, "spinner")]; | ||
const getFinalChildren = (c) => [ | ||
renderIconFirst && renderIcon, | ||
isLoading && /* @__PURE__ */ jsxRuntime.jsx("span", { children: loadingText || c }, "text"), | ||
!isLoading && c && /* @__PURE__ */ jsxRuntime.jsx("span", { children: c }, "text"), | ||
!renderIconFirst && renderIcon, | ||
isLoading && /* @__PURE__ */ jsxRuntime.jsx("span", { children: "…" }, "spinner") | ||
]; | ||
const renderChildren = () => { | ||
@@ -74,13 +81,16 @@ if (asChild && react.isValidElement(children)) { | ||
}; | ||
return /* @__PURE__ */ jsxRuntime.jsx(Component, { | ||
className: classes, | ||
ref, | ||
onClick: handleClick, | ||
onKeyDown: onKeyDown || handleKeyDown, | ||
disabled: isDisabled, | ||
type: asChild ? void 0 : type, | ||
"data-test-id": testId, | ||
...rest, | ||
children: renderChildren() | ||
}); | ||
return /* @__PURE__ */ jsxRuntime.jsx( | ||
Component, | ||
{ | ||
className: classes, | ||
ref, | ||
onClick: handleClick, | ||
onKeyDown: onKeyDown || handleKeyDown, | ||
disabled: isDisabled, | ||
type: asChild ? void 0 : type, | ||
"data-test-id": testId, | ||
...rest, | ||
children: renderChildren() | ||
} | ||
); | ||
}); | ||
@@ -98,8 +108,3 @@ ButtonComponent.displayName = "Button"; | ||
const classes = classix.cx("ButtonGroup", `ButtonGroup--${spacing}`, className); | ||
return /* @__PURE__ */ jsxRuntime.jsx("div", { | ||
className: classes, | ||
"data-test-id": testId, | ||
...rest, | ||
children | ||
}); | ||
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: classes, "data-test-id": testId, ...rest, children }); | ||
}; | ||
@@ -147,21 +152,20 @@ const UploadButton = ({ | ||
}; | ||
return /* @__PURE__ */ jsxRuntime.jsxs("span", { | ||
className: classes, | ||
"data-test-id": testId, | ||
children: [/* @__PURE__ */ jsxRuntime.jsx("input", { | ||
ref: inputRef, | ||
className: "UploadButton-input", | ||
id, | ||
style: { | ||
display: "none" | ||
}, | ||
type: "file", | ||
onChange: handleChange, | ||
disabled, | ||
accept, | ||
"data-test-id": "upload-button-input" | ||
}), /* @__PURE__ */ jsxRuntime.jsx("label", { | ||
htmlFor: id, | ||
className: "UploadButton-label", | ||
children: /* @__PURE__ */ jsxRuntime.jsx(Button, { | ||
return /* @__PURE__ */ jsxRuntime.jsxs("span", { className: classes, "data-test-id": testId, children: [ | ||
/* @__PURE__ */ jsxRuntime.jsx( | ||
"input", | ||
{ | ||
ref: inputRef, | ||
className: "UploadButton-input", | ||
id, | ||
style: { display: "none" }, | ||
type: "file", | ||
onChange: handleChange, | ||
disabled, | ||
accept, | ||
"data-test-id": "upload-button-input" | ||
} | ||
), | ||
/* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: id, className: "UploadButton-label", children: /* @__PURE__ */ jsxRuntime.jsx( | ||
Button, | ||
{ | ||
...rest, | ||
@@ -174,5 +178,5 @@ disabled, | ||
children | ||
}) | ||
})] | ||
}); | ||
} | ||
) }) | ||
] }); | ||
}; | ||
@@ -195,3 +199,11 @@ const IconButtonComponent = react.forwardRef((props, ref) => { | ||
const Component = asChild ? reactSlot.Slot : "button"; | ||
const classes = classix.cx("IconButton", "Button", "Button--icon", `Button--${kind}`, disabled && "Button--disabled", size && `Button--${size}`, className); | ||
const classes = classix.cx( | ||
"IconButton", | ||
"Button", | ||
"Button--icon", | ||
`Button--${kind}`, | ||
disabled && "Button--disabled", | ||
size && `Button--${size}`, | ||
className | ||
); | ||
const iconSize = () => { | ||
@@ -229,13 +241,16 @@ if (props.size === "small") | ||
}; | ||
return /* @__PURE__ */ jsxRuntime.jsx(Component, { | ||
className: classes, | ||
ref, | ||
onClick: handleClick, | ||
disabled, | ||
onKeyDown: onKeyDown || handleKeyDown, | ||
type, | ||
"data-test-id": testId, | ||
...rest, | ||
children: renderChildren() | ||
}); | ||
return /* @__PURE__ */ jsxRuntime.jsx( | ||
Component, | ||
{ | ||
className: classes, | ||
ref, | ||
onClick: handleClick, | ||
disabled, | ||
onKeyDown: onKeyDown || handleKeyDown, | ||
type, | ||
"data-test-id": testId, | ||
...rest, | ||
children: renderChildren() | ||
} | ||
); | ||
}); | ||
@@ -242,0 +257,0 @@ IconButtonComponent.displayName = "IconButton"; |
@@ -1,2 +0,1 @@ | ||
/// <reference types="react" /> | ||
import type { ButtonProps } from './Button'; | ||
@@ -9,5 +8,5 @@ type UploadButtonProps = Omit<ButtonProps, 'onSelect'> & { | ||
}; | ||
declare const UploadButton: ({ id, className, children, disabled, accept, maxSize, onSelect, "data-test-id": testId, ...rest }: UploadButtonProps) => JSX.Element; | ||
declare const UploadButton: ({ id, className, children, disabled, accept, maxSize, onSelect, "data-test-id": testId, ...rest }: UploadButtonProps) => import("react/jsx-runtime").JSX.Element; | ||
export { UploadButton }; | ||
export type { UploadButtonProps }; | ||
//# sourceMappingURL=UploadButton.d.ts.map |
{ | ||
"name": "@launchpad-ui/button", | ||
"version": "0.8.13", | ||
"version": "0.8.14", | ||
"status": "beta", | ||
@@ -31,4 +31,4 @@ "publishConfig": { | ||
"classix": "2.1.17", | ||
"@launchpad-ui/icons": "~0.8.6", | ||
"@launchpad-ui/tokens": "~0.5.6" | ||
"@launchpad-ui/icons": "~0.8.7", | ||
"@launchpad-ui/tokens": "~0.5.7" | ||
}, | ||
@@ -35,0 +35,0 @@ "peerDependencies": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1123
70951
Updated@launchpad-ui/icons@~0.8.7
Updated@launchpad-ui/tokens@~0.5.7