Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@launchpad-ui/button

Package Overview
Dependencies
Maintainers
1
Versions
145
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@launchpad-ui/button - npm Package Compare versions

Comparing version 0.3.1 to 0.3.2

dist/ButtonGroup.d.ts

4

dist/index.d.ts
export type { ButtonProps } from './Button';
export type { UploadButtonProps } from './UploadButton';
export type { ButtonGroupProps } from './ButtonGroup';
export { Button } from './Button';
export { ButtonGroup } from './ButtonGroup';
export { UploadButton } from './UploadButton';
export { ButtonGroupSpacing, ButtonKind, ButtonSize, ButtonType } from './types';
//# sourceMappingURL=index.d.ts.map

@@ -158,9 +158,94 @@ // ../../scripts/react-shim.js

var Button = memo(ButtonComponent);
// src/ButtonGroup.tsx
import cx2 from "clsx";
import "./styles/ButtonGroup.css";
var ButtonGroup = ({
spacing = "normal" /* NORMAL */,
className,
testId,
children,
...rest
}) => {
const classes = cx2("ButtonGroup", `ButtonGroup--${spacing}`, className);
return /* @__PURE__ */ React.createElement("div", {
className: classes,
"data-test-id": testId,
...rest
}, children);
};
// src/UploadButton.tsx
import cx3 from "clsx";
import { useRef } from "react";
var UploadButton = ({
id,
className,
children,
disabled,
accept,
maxSize,
onSelect,
...rest
}) => {
const inputRef = useRef(null);
const classes = cx3("UploadButton", className);
const handleClick = () => {
inputRef.current?.click();
};
const handleKeyDown = (event) => {
const actionKeys = ["Spacebar", " ", "Enter"];
if (actionKeys.includes(event.key)) {
event.preventDefault();
inputRef.current?.click();
}
};
const handleChange = (event) => {
let file;
if (event) {
const e = event;
file = e.target.files?.[0];
}
if (file && file.size > maxSize) {
return;
}
event?.persist();
onSelect(file);
if (inputRef.current) {
inputRef.current.value = "";
}
};
return /* @__PURE__ */ React.createElement("span", {
className: classes
}, /* @__PURE__ */ React.createElement("input", {
ref: inputRef,
className: "UploadButton-input",
id,
style: { display: "none" },
type: "file",
onChange: handleChange,
disabled,
accept,
"data-test-id": "upload-button-input"
}), /* @__PURE__ */ React.createElement("label", {
htmlFor: id,
className: "UploadButton-label"
}, /* @__PURE__ */ React.createElement(Button, {
...rest,
disabled,
tabIndex: disabled ? -1 : 0,
role: "button",
onKeyDown: handleKeyDown,
onClick: handleClick
}, children)));
};
export {
Button,
ButtonGroup,
ButtonGroupSpacing,
ButtonKind,
ButtonSize,
ButtonType
ButtonType,
UploadButton
};
//# sourceMappingURL=index.es.js.map

@@ -27,6 +27,8 @@ "use strict";

Button: () => Button,
ButtonGroup: () => ButtonGroup,
ButtonGroupSpacing: () => ButtonGroupSpacing,
ButtonKind: () => ButtonKind,
ButtonSize: () => ButtonSize,
ButtonType: () => ButtonType
ButtonType: () => ButtonType,
UploadButton: () => UploadButton
});

@@ -192,10 +194,95 @@ module.exports = __toCommonJS(src_exports);

var Button = (0, import_react.memo)(ButtonComponent);
// src/ButtonGroup.tsx
var import_clsx2 = __toESM(require("clsx"));
var import_ButtonGroup = require("./styles/ButtonGroup.css");
var ButtonGroup = ({
spacing = "normal" /* NORMAL */,
className,
testId,
children,
...rest
}) => {
const classes = (0, import_clsx2.default)("ButtonGroup", `ButtonGroup--${spacing}`, className);
return /* @__PURE__ */ React.createElement("div", {
className: classes,
"data-test-id": testId,
...rest
}, children);
};
// src/UploadButton.tsx
var import_clsx3 = __toESM(require("clsx"));
var import_react2 = require("react");
var UploadButton = ({
id,
className,
children,
disabled,
accept,
maxSize,
onSelect,
...rest
}) => {
const inputRef = (0, import_react2.useRef)(null);
const classes = (0, import_clsx3.default)("UploadButton", className);
const handleClick = () => {
inputRef.current?.click();
};
const handleKeyDown = (event) => {
const actionKeys = ["Spacebar", " ", "Enter"];
if (actionKeys.includes(event.key)) {
event.preventDefault();
inputRef.current?.click();
}
};
const handleChange = (event) => {
let file;
if (event) {
const e = event;
file = e.target.files?.[0];
}
if (file && file.size > maxSize) {
return;
}
event?.persist();
onSelect(file);
if (inputRef.current) {
inputRef.current.value = "";
}
};
return /* @__PURE__ */ React.createElement("span", {
className: classes
}, /* @__PURE__ */ React.createElement("input", {
ref: inputRef,
className: "UploadButton-input",
id,
style: { display: "none" },
type: "file",
onChange: handleChange,
disabled,
accept,
"data-test-id": "upload-button-input"
}), /* @__PURE__ */ React.createElement("label", {
htmlFor: id,
className: "UploadButton-label"
}, /* @__PURE__ */ React.createElement(Button, {
...rest,
disabled,
tabIndex: disabled ? -1 : 0,
role: "button",
onKeyDown: handleKeyDown,
onClick: handleClick
}, children)));
};
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
Button,
ButtonGroup,
ButtonGroupSpacing,
ButtonKind,
ButtonSize,
ButtonType
ButtonType,
UploadButton
});
//# sourceMappingURL=index.js.map

2

package.json
{
"name": "@launchpad-ui/button",
"version": "0.3.1",
"version": "0.3.2",
"status": "beta",

@@ -5,0 +5,0 @@ "publishConfig": {

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc