@launchpad-ui/button
Advanced tools
Comparing version 0.11.9 to 0.11.10
@@ -50,3 +50,9 @@ import './style.css'; | ||
const Component = asChild ? Slot : "button"; | ||
const classes = cx(styles.Button, styles[`Button--${kind}`], size && styles[`Button--${size}`], fit && styles["Button--fit"], className); | ||
const classes = cx( | ||
styles.Button, | ||
styles[`Button--${kind}`], | ||
size && styles[`Button--${size}`], | ||
fit && styles["Button--fit"], | ||
className | ||
); | ||
const getIconSize = () => { | ||
@@ -65,9 +71,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: "…" | ||
}, "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 = () => { | ||
@@ -95,13 +101,16 @@ if (asChild && /* @__PURE__ */ 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() | ||
} | ||
); | ||
}); | ||
@@ -118,8 +127,3 @@ ButtonComponent.displayName = "Button"; | ||
const classes = cx(styles.ButtonGroup, styles[`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 }); | ||
}; | ||
@@ -166,19 +170,19 @@ const UploadButton = ({ | ||
}; | ||
return /* @__PURE__ */ jsxs("span", { | ||
className, | ||
"data-test-id": testId, | ||
children: [/* @__PURE__ */ jsx("input", { | ||
ref: inputRef, | ||
id, | ||
style: { | ||
display: "none" | ||
}, | ||
type: "file", | ||
onChange: handleChange, | ||
disabled, | ||
accept, | ||
"data-test-id": "upload-button-input" | ||
}), /* @__PURE__ */ jsx("label", { | ||
htmlFor: id, | ||
children: /* @__PURE__ */ jsx(Button, { | ||
return /* @__PURE__ */ jsxs("span", { className, "data-test-id": testId, children: [ | ||
/* @__PURE__ */ jsx( | ||
"input", | ||
{ | ||
ref: inputRef, | ||
id, | ||
style: { display: "none" }, | ||
type: "file", | ||
onChange: handleChange, | ||
disabled, | ||
accept, | ||
"data-test-id": "upload-button-input" | ||
} | ||
), | ||
/* @__PURE__ */ jsx("label", { htmlFor: id, children: /* @__PURE__ */ jsx( | ||
Button, | ||
{ | ||
...rest, | ||
@@ -191,5 +195,5 @@ disabled, | ||
children | ||
}) | ||
})] | ||
}); | ||
} | ||
) }) | ||
] }); | ||
}; | ||
@@ -212,3 +216,10 @@ const IconButtonComponent = /* @__PURE__ */ forwardRef((props, ref) => { | ||
const Component = asChild ? Slot : "button"; | ||
const classes = cx(styles.IconButton, styles.Button, styles["Button--icon"], styles[`Button--${kind}`], size && styles[`Button--${size}`], className); | ||
const classes = cx( | ||
styles.IconButton, | ||
styles.Button, | ||
styles["Button--icon"], | ||
styles[`Button--${kind}`], | ||
size && styles[`Button--${size}`], | ||
className | ||
); | ||
const iconSize = () => { | ||
@@ -246,13 +257,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() | ||
} | ||
); | ||
}); | ||
@@ -259,0 +273,0 @@ IconButtonComponent.displayName = "IconButton"; |
@@ -52,3 +52,9 @@ require('./style.css'); | ||
const Component = asChild ? reactSlot.Slot : "button"; | ||
const classes = classix.cx(styles.Button, styles[`Button--${kind}`], size && styles[`Button--${size}`], fit && styles["Button--fit"], className); | ||
const classes = classix.cx( | ||
styles.Button, | ||
styles[`Button--${kind}`], | ||
size && styles[`Button--${size}`], | ||
fit && styles["Button--fit"], | ||
className | ||
); | ||
const getIconSize = () => { | ||
@@ -67,9 +73,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: "…" | ||
}, "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 = () => { | ||
@@ -97,13 +103,16 @@ if (asChild && /* @__PURE__ */ 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() | ||
} | ||
); | ||
}); | ||
@@ -120,8 +129,3 @@ ButtonComponent.displayName = "Button"; | ||
const classes = classix.cx(styles.ButtonGroup, styles[`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 }); | ||
}; | ||
@@ -168,19 +172,19 @@ const UploadButton = ({ | ||
}; | ||
return /* @__PURE__ */ jsxRuntime.jsxs("span", { | ||
className, | ||
"data-test-id": testId, | ||
children: [/* @__PURE__ */ jsxRuntime.jsx("input", { | ||
ref: inputRef, | ||
id, | ||
style: { | ||
display: "none" | ||
}, | ||
type: "file", | ||
onChange: handleChange, | ||
disabled, | ||
accept, | ||
"data-test-id": "upload-button-input" | ||
}), /* @__PURE__ */ jsxRuntime.jsx("label", { | ||
htmlFor: id, | ||
children: /* @__PURE__ */ jsxRuntime.jsx(Button, { | ||
return /* @__PURE__ */ jsxRuntime.jsxs("span", { className, "data-test-id": testId, children: [ | ||
/* @__PURE__ */ jsxRuntime.jsx( | ||
"input", | ||
{ | ||
ref: inputRef, | ||
id, | ||
style: { display: "none" }, | ||
type: "file", | ||
onChange: handleChange, | ||
disabled, | ||
accept, | ||
"data-test-id": "upload-button-input" | ||
} | ||
), | ||
/* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: id, children: /* @__PURE__ */ jsxRuntime.jsx( | ||
Button, | ||
{ | ||
...rest, | ||
@@ -193,5 +197,5 @@ disabled, | ||
children | ||
}) | ||
})] | ||
}); | ||
} | ||
) }) | ||
] }); | ||
}; | ||
@@ -214,3 +218,10 @@ const IconButtonComponent = /* @__PURE__ */ react.forwardRef((props, ref) => { | ||
const Component = asChild ? reactSlot.Slot : "button"; | ||
const classes = classix.cx(styles.IconButton, styles.Button, styles["Button--icon"], styles[`Button--${kind}`], size && styles[`Button--${size}`], className); | ||
const classes = classix.cx( | ||
styles.IconButton, | ||
styles.Button, | ||
styles["Button--icon"], | ||
styles[`Button--${kind}`], | ||
size && styles[`Button--${size}`], | ||
className | ||
); | ||
const iconSize = () => { | ||
@@ -248,13 +259,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() | ||
} | ||
); | ||
}); | ||
@@ -261,0 +275,0 @@ IconButtonComponent.displayName = "IconButton"; |
{ | ||
"name": "@launchpad-ui/button", | ||
"version": "0.11.9", | ||
"version": "0.11.10", | ||
"status": "beta", | ||
@@ -31,4 +31,4 @@ "publishConfig": { | ||
"classix": "2.1.17", | ||
"@launchpad-ui/icons": "~0.14.9", | ||
"@launchpad-ui/tokens": "~0.9.2" | ||
"@launchpad-ui/icons": "~0.14.10", | ||
"@launchpad-ui/tokens": "~0.9.3" | ||
}, | ||
@@ -44,3 +44,3 @@ "peerDependencies": { | ||
"scripts": { | ||
"build": "vite build -c ../../vite.config.ts && tsc --project tsconfig.build.json", | ||
"build": "vite build -c ../../vite.config.mts && tsc --project tsconfig.build.json", | ||
"clean": "rm -rf dist", | ||
@@ -47,0 +47,0 @@ "lint": "eslint '**/*.{ts,tsx,js}' && stylelint '**/*.css' --ignore-path ../../.stylelintignore", |
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
82582
1331
Updated@launchpad-ui/icons@~0.14.10
Updated@launchpad-ui/tokens@~0.9.3