@spark-ui/button 2.1.5 → 2.1.7
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/CHANGELOG.md +8 -0
- package/dist/Button.d.ts +2 -2
- package/dist/index.mjs +8 -8
- package/dist/public/docgen.json +253 -0
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
@@ -3,6 +3,14 @@
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
5
5
|
|
6
|
+
## [2.1.7](https://github.com/adevinta/spark/compare/@spark-ui/button@2.1.6...@spark-ui/button@2.1.7) (2023-09-04)
|
7
|
+
|
8
|
+
**Note:** Version bump only for package @spark-ui/button
|
9
|
+
|
10
|
+
## [2.1.6](https://github.com/adevinta/spark/compare/@spark-ui/button@2.1.5...@spark-ui/button@2.1.6) (2023-09-01)
|
11
|
+
|
12
|
+
**Note:** Version bump only for package @spark-ui/button
|
13
|
+
|
6
14
|
## [2.1.5](https://github.com/adevinta/spark/compare/@spark-ui/button@2.1.4...@spark-ui/button@2.1.5) (2023-08-31)
|
7
15
|
|
8
16
|
**Note:** Version bump only for package @spark-ui/button
|
package/dist/Button.d.ts
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
import React, {
|
1
|
+
import React, { ComponentPropsWithoutRef } from 'react';
|
2
2
|
import { type ButtonStylesProps } from './Button.styles';
|
3
|
-
export interface ButtonProps extends
|
3
|
+
export interface ButtonProps extends Omit<ComponentPropsWithoutRef<'button'>, 'disabled'>, ButtonStylesProps {
|
4
4
|
/**
|
5
5
|
* Change the component to the HTML tag or custom component of the only child.
|
6
6
|
*/
|
package/dist/index.mjs
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
import { wrapPolymorphicSlot as M, Slot as N } from "@spark-ui/slot";
|
2
2
|
import { Spinner as g } from "@spark-ui/spinner";
|
3
3
|
import { cva as k, cx as S } from "class-variance-authority";
|
4
|
-
import
|
4
|
+
import s, { forwardRef as K, useMemo as L } from "react";
|
5
5
|
import { tw as e, makeVariants as a } from "@spark-ui/internal-utils";
|
6
|
-
const L = [{ intent: "main", design: "filled", class: e(["bg-main", "text-on-main", "hover:bg-main-hovered", "enabled:active:bg-main-pressed", "focus-visible:bg-main-focused"]) }, { intent: "support", design: "filled", class: e(["bg-support", "text-on-support", "hover:bg-support-hovered", "enabled:active:bg-support-pressed", "focus-visible:bg-support-focused"]) }, { intent: "accent", design: "filled", class: e(["bg-accent", "text-on-accent", "hover:bg-accent-hovered", "enabled:active:bg-accent-pressed", "focus-visible:bg-accent-focused"]) }, { intent: "basic", design: "filled", class: e(["bg-basic", "text-on-basic", "hover:bg-basic-hovered", "enabled:active:bg-basic-pressed", "focus-visible:bg-basic-focused"]) }, { intent: "success", design: "filled", class: e(["bg-success", "text-on-success", "hover:bg-success-hovered", "enabled:active:bg-success-pressed", "focus-visible:bg-success-focused"]) }, { intent: "alert", design: "filled", class: e(["bg-alert", "text-on-alert", "hover:bg-alert-hovered", "enabled:active:bg-alert-pressed", "focus-visible:bg-alert-focused"]) }, { intent: "danger", design: "filled", class: e(["text-on-error bg-error", "hover:bg-error-hovered enabled:active:bg-error-pressed", "focus-visible:bg-error-focused"]) }, { intent: "info", design: "filled", class: e(["text-on-error bg-info", "hover:bg-info-hovered enabled:active:bg-info-pressed", "focus-visible:bg-info-focused"]) }, { intent: "neutral", design: "filled", class: e(["bg-neutral", "text-on-neutral", "hover:bg-neutral-hovered", "enabled:active:bg-neutral-pressed", "focus-visible:bg-neutral-focused"]) }, { intent: "surface", design: "filled", class: e(["bg-surface", "text-on-surface", "hover:bg-surface-hovered", "enabled:active:bg-surface-pressed", "focus-visible:bg-surface-focused"]) }], P = [{ intent: "main", design: "ghost", class: e(["text-main", "hover:bg-main/dim-5", "enabled:active:bg-main/dim-5", "focus-visible:bg-main/dim-5"]) }, { intent: "support", design: "ghost", class: e(["text-support", "hover:bg-support/dim-5", "enabled:active:bg-support/dim-5", "focus-visible:bg-support/dim-5"]) }, { intent: "accent", design: "ghost", class: e(["text-accent", "hover:bg-accent/dim-5", "enabled:active:bg-accent/dim-5", "focus-visible:bg-accent/dim-5"]) }, { intent: "basic", design: "ghost", class: e(["text-basic", "hover:bg-basic/dim-5", "enabled:active:bg-basic/dim-5", "focus-visible:bg-basic/dim-5"]) }, { intent: "success", design: "ghost", class: e(["text-success", "hover:bg-success/dim-5", "enabled:active:bg-success/dim-5", "focus-visible:bg-success/dim-5"]) }, { intent: "alert", design: "ghost", class: e(["text-alert", "hover:bg-alert/dim-5", "enabled:active:bg-alert/dim-5", "focus-visible:bg-alert/dim-5"]) }, { intent: "danger", design: "ghost", class: e(["text-error", "hover:bg-error/dim-5", "enabled:active:bg-error/dim-5", "focus-visible:bg-error/dim-5"]) }, { intent: "info", design: "ghost", class: e(["text-info", "hover:bg-info/dim-5", "enabled:active:bg-info/dim-5", "focus-visible:bg-info/dim-5"]) }, { intent: "neutral", design: "ghost", class: e(["text-neutral", "hover:bg-neutral/dim-5", "enabled:active:bg-neutral/dim-5", "focus-visible:bg-neutral/dim-5"]) }, { intent: "surface", design: "ghost", class: e(["text-surface", "hover:bg-surface/dim-5", "enabled:active:bg-surface/dim-5", "focus-visible:bg-surface/dim-5"]) }], V = [{ intent: "main", design: "outlined", class: e(["hover:bg-main/dim-5", "enabled:active:bg-main/dim-5", "focus-visible:bg-main/dim-5", "text-main"]) }, { intent: "support", design: "outlined", class: e(["hover:bg-support/dim-5", "enabled:active:bg-support/dim-5", "focus-visible:bg-support/dim-5", "text-support"]) }, { intent: "accent", design: "outlined", class: e(["hover:bg-accent/dim-5", "enabled:active:bg-accent/dim-5", "focus-visible:bg-accent/dim-5", "text-accent"]) }, { intent: "basic", design: "outlined", class: e(["hover:bg-basic/dim-5", "enabled:active:bg-basic/dim-5", "focus-visible:bg-basic/dim-5", "text-basic"]) }, { intent: "success", design: "outlined", class: e(["hover:bg-success/dim-5", "enabled:active:bg-success/dim-5", "focus-visible:bg-success/dim-5", "text-success"]) }, { intent: "alert", design: "outlined", class: e(["hover:bg-alert/dim-5", "enabled:active:bg-alert/dim-5", "focus-visible:bg-alert/dim-5", "text-alert"]) }, { intent: "danger", design: "outlined", class: e(["hover:bg-error/dim-5", "enabled:active:bg-error/dim-5", "focus-visible:bg-error/dim-5", "text-error"]) }, { intent: "info", design: "outlined", class: e(["hover:bg-info/dim-5", "enabled:active:bg-info/dim-5", "focus-visible:bg-info/dim-5", "text-info"]) }, { intent: "neutral", design: "outlined", class: e(["hover:bg-neutral/dim-5", "enabled:active:bg-neutral/dim-5", "focus-visible:bg-neutral/dim-5", "text-neutral"]) }, { intent: "surface", design: "outlined", class: e(["hover:bg-surface/dim-5", "enabled:active:bg-surface/dim-5", "focus-visible:bg-surface/dim-5", "text-surface"]) }], B = [{ intent: "main", design: "tinted", class: e(["bg-main-container", "text-on-main-container", "hover:bg-main-container-hovered", "enabled:active:bg-main-container-pressed", "focus-visible:bg-main-container-focused"]) }, { intent: "support", design: "tinted", class: e(["bg-support-container", "text-on-support-container", "hover:bg-support-container-hovered", "enabled:active:bg-support-container-pressed", "focus-visible:bg-support-container-focused"]) }, { intent: "accent", design: "tinted", class: e(["bg-accent-container", "text-on-accent-container", "hover:bg-accent-container-hovered", "enabled:active:bg-accent-container-pressed", "focus-visible:bg-accent-container-focused"]) }, { intent: "basic", design: "tinted", class: e(["bg-basic-container", "text-on-basic-container", "hover:bg-basic-container-hovered", "enabled:active:bg-basic-container-pressed", "focus-visible:bg-basic-container-focused"]) }, { intent: "success", design: "tinted", class: e(["bg-success-container", "text-on-success-container", "hover:bg-success-container-hovered", "enabled:active:bg-success-container-pressed", "focus-visible:bg-success-container-focused"]) }, { intent: "alert", design: "tinted", class: e(["bg-alert-container", "text-on-alert-container", "hover:bg-alert-container-hovered", "enabled:active:bg-alert-container-pressed", "focus-visible:bg-alert-container-focused"]) }, { intent: "danger", design: "tinted", class: e(["bg-error-container", "text-on-error-container", "hover:bg-error-container-hovered", "enabled:active:bg-error-container-pressed", "focus-visible:bg-error-container-focused"]) }, { intent: "info", design: "tinted", class: e(["bg-info-container", "text-on-info-container", "hover:bg-info-container-hovered", "enabled:active:bg-info-container-pressed", "focus-visible:bg-info-container-focused"]) }, { intent: "neutral", design: "tinted", class: e(["bg-neutral-container", "text-on-neutral-container", "hover:bg-neutral-container-hovered", "enabled:active:bg-neutral-container-pressed", "focus-visible:bg-neutral-container-focused"]) }, { intent: "surface", design: "tinted", class: e(["bg-surface", "text-on-surface", "hover:bg-surface-hovered", "enabled:active:bg-surface-pressed", "focus-visible:bg-surface-focused"]) }], C = [{ intent: "main", design: "contrast", class: e(["text-main", "hover:bg-main-container-hovered", "enabled:active:bg-main-container-pressed", "focus-visible:bg-main-container-focused"]) }, { intent: "support", design: "contrast", class: e(["text-support", "hover:bg-support-container-hovered", "enabled:active:bg-support-container-pressed", "focus-visible:bg-support-container-focused"]) }, { intent: "accent", design: "contrast", class: e(["text-accent", "hover:bg-accent-container-hovered", "enabled:active:bg-accent-container-pressed", "focus-visible:bg-accent-container-focused"]) }, { intent: "basic", design: "contrast", class: e(["text-basic", "hover:bg-basic-container-hovered", "enabled:active:bg-basic-container-pressed", "focus-visible:bg-basic-container-focused"]) }, { intent: "success", design: "contrast", class: e(["text-success", "hover:bg-success-container-hovered", "enabled:active:bg-success-container-pressed", "focus-visible:bg-success-container-focused"]) }, { intent: "alert", design: "contrast", class: e(["text-alert", "hover:bg-alert-container-hovered", "enabled:active:bg-alert-container-pressed", "focus-visible:bg-alert-container-focused"]) }, { intent: "danger", design: "contrast", class: e(["text-error", "hover:bg-error-container-hovered", "enabled:active:bg-error-container-pressed", "focus-visible:bg-error-container-focused"]) }, { intent: "info", design: "contrast", class: e(["text-info", "hover:bg-info-container-hovered", "enabled:active:bg-info-container-pressed", "focus-visible:bg-info-container-focused"]) }, { intent: "neutral", design: "contrast", class: e(["text-neutral", "hover:bg-neutral-container-hovered", "enabled:active:bg-neutral-container-pressed", "focus-visible:bg-neutral-container-focused"]) }, { intent: "surface", design: "contrast", class: e(["text-on-surface", "hover:bg-surface-hovered", "enabled:active:bg-surface-pressed", "focus-visible:bg-surface-focused"]) }], D = k(["u-shadow-border-transition", "box-border inline-flex items-center justify-center gap-md whitespace-nowrap", "px-lg", "text-body-1 font-bold", "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-outline-high [&:not(:focus-visible)]:ring-inset"], { variants: { design: a({ filled: [], outlined: ["bg-transparent", "ring-1", "ring-current"], tinted: [], ghost: [], contrast: ["bg-surface"] }), intent: a({ main: [], support: [], accent: [], basic: [], success: [], alert: [], danger: [], info: [], neutral: [], surface: [] }), size: a({ sm: ["min-w-sz-32", "h-sz-32"], md: ["min-w-sz-44", "h-sz-44"], lg: ["min-w-sz-56", "h-sz-56"] }), shape: a({ rounded: ["rounded-lg"], square: ["rounded-none"], pill: ["rounded-full"] }), disabled: { true: ["cursor-not-allowed", "opacity-dim-3"] } }, compoundVariants: [...L, ...V, ...B, ...P, ...C], defaultVariants: { design: "filled", intent: "main", size: "md", shape: "rounded" } }), O = ["onClick", "onMouseDown", "onMouseUp", "onMouseEnter", "onMouseLeave", "onMouseOver", "onMouseOut", "onKeyDown", "onKeyPress", "onKeyUp", "onSubmit"], U = n.forwardRef(({ children: u, design: v = "filled", disabled: r = !1, intent: f = "main", isLoading: i = !1, loadingLabel: o, loadingText: t, shape: m = "rounded", size: p = "md", spinnerPlacement: d = "left", asChild: b, className: h, ...x }, w) => {
|
7
|
-
const
|
8
|
-
const
|
9
|
-
return c &&
|
6
|
+
const P = [{ intent: "main", design: "filled", class: e(["bg-main", "text-on-main", "hover:bg-main-hovered", "enabled:active:bg-main-pressed", "focus-visible:bg-main-focused"]) }, { intent: "support", design: "filled", class: e(["bg-support", "text-on-support", "hover:bg-support-hovered", "enabled:active:bg-support-pressed", "focus-visible:bg-support-focused"]) }, { intent: "accent", design: "filled", class: e(["bg-accent", "text-on-accent", "hover:bg-accent-hovered", "enabled:active:bg-accent-pressed", "focus-visible:bg-accent-focused"]) }, { intent: "basic", design: "filled", class: e(["bg-basic", "text-on-basic", "hover:bg-basic-hovered", "enabled:active:bg-basic-pressed", "focus-visible:bg-basic-focused"]) }, { intent: "success", design: "filled", class: e(["bg-success", "text-on-success", "hover:bg-success-hovered", "enabled:active:bg-success-pressed", "focus-visible:bg-success-focused"]) }, { intent: "alert", design: "filled", class: e(["bg-alert", "text-on-alert", "hover:bg-alert-hovered", "enabled:active:bg-alert-pressed", "focus-visible:bg-alert-focused"]) }, { intent: "danger", design: "filled", class: e(["text-on-error bg-error", "hover:bg-error-hovered enabled:active:bg-error-pressed", "focus-visible:bg-error-focused"]) }, { intent: "info", design: "filled", class: e(["text-on-error bg-info", "hover:bg-info-hovered enabled:active:bg-info-pressed", "focus-visible:bg-info-focused"]) }, { intent: "neutral", design: "filled", class: e(["bg-neutral", "text-on-neutral", "hover:bg-neutral-hovered", "enabled:active:bg-neutral-pressed", "focus-visible:bg-neutral-focused"]) }, { intent: "surface", design: "filled", class: e(["bg-surface", "text-on-surface", "hover:bg-surface-hovered", "enabled:active:bg-surface-pressed", "focus-visible:bg-surface-focused"]) }], V = [{ intent: "main", design: "ghost", class: e(["text-main", "hover:bg-main/dim-5", "enabled:active:bg-main/dim-5", "focus-visible:bg-main/dim-5"]) }, { intent: "support", design: "ghost", class: e(["text-support", "hover:bg-support/dim-5", "enabled:active:bg-support/dim-5", "focus-visible:bg-support/dim-5"]) }, { intent: "accent", design: "ghost", class: e(["text-accent", "hover:bg-accent/dim-5", "enabled:active:bg-accent/dim-5", "focus-visible:bg-accent/dim-5"]) }, { intent: "basic", design: "ghost", class: e(["text-basic", "hover:bg-basic/dim-5", "enabled:active:bg-basic/dim-5", "focus-visible:bg-basic/dim-5"]) }, { intent: "success", design: "ghost", class: e(["text-success", "hover:bg-success/dim-5", "enabled:active:bg-success/dim-5", "focus-visible:bg-success/dim-5"]) }, { intent: "alert", design: "ghost", class: e(["text-alert", "hover:bg-alert/dim-5", "enabled:active:bg-alert/dim-5", "focus-visible:bg-alert/dim-5"]) }, { intent: "danger", design: "ghost", class: e(["text-error", "hover:bg-error/dim-5", "enabled:active:bg-error/dim-5", "focus-visible:bg-error/dim-5"]) }, { intent: "info", design: "ghost", class: e(["text-info", "hover:bg-info/dim-5", "enabled:active:bg-info/dim-5", "focus-visible:bg-info/dim-5"]) }, { intent: "neutral", design: "ghost", class: e(["text-neutral", "hover:bg-neutral/dim-5", "enabled:active:bg-neutral/dim-5", "focus-visible:bg-neutral/dim-5"]) }, { intent: "surface", design: "ghost", class: e(["text-surface", "hover:bg-surface/dim-5", "enabled:active:bg-surface/dim-5", "focus-visible:bg-surface/dim-5"]) }], B = [{ intent: "main", design: "outlined", class: e(["hover:bg-main/dim-5", "enabled:active:bg-main/dim-5", "focus-visible:bg-main/dim-5", "text-main"]) }, { intent: "support", design: "outlined", class: e(["hover:bg-support/dim-5", "enabled:active:bg-support/dim-5", "focus-visible:bg-support/dim-5", "text-support"]) }, { intent: "accent", design: "outlined", class: e(["hover:bg-accent/dim-5", "enabled:active:bg-accent/dim-5", "focus-visible:bg-accent/dim-5", "text-accent"]) }, { intent: "basic", design: "outlined", class: e(["hover:bg-basic/dim-5", "enabled:active:bg-basic/dim-5", "focus-visible:bg-basic/dim-5", "text-basic"]) }, { intent: "success", design: "outlined", class: e(["hover:bg-success/dim-5", "enabled:active:bg-success/dim-5", "focus-visible:bg-success/dim-5", "text-success"]) }, { intent: "alert", design: "outlined", class: e(["hover:bg-alert/dim-5", "enabled:active:bg-alert/dim-5", "focus-visible:bg-alert/dim-5", "text-alert"]) }, { intent: "danger", design: "outlined", class: e(["hover:bg-error/dim-5", "enabled:active:bg-error/dim-5", "focus-visible:bg-error/dim-5", "text-error"]) }, { intent: "info", design: "outlined", class: e(["hover:bg-info/dim-5", "enabled:active:bg-info/dim-5", "focus-visible:bg-info/dim-5", "text-info"]) }, { intent: "neutral", design: "outlined", class: e(["hover:bg-neutral/dim-5", "enabled:active:bg-neutral/dim-5", "focus-visible:bg-neutral/dim-5", "text-neutral"]) }, { intent: "surface", design: "outlined", class: e(["hover:bg-surface/dim-5", "enabled:active:bg-surface/dim-5", "focus-visible:bg-surface/dim-5", "text-surface"]) }], C = [{ intent: "main", design: "tinted", class: e(["bg-main-container", "text-on-main-container", "hover:bg-main-container-hovered", "enabled:active:bg-main-container-pressed", "focus-visible:bg-main-container-focused"]) }, { intent: "support", design: "tinted", class: e(["bg-support-container", "text-on-support-container", "hover:bg-support-container-hovered", "enabled:active:bg-support-container-pressed", "focus-visible:bg-support-container-focused"]) }, { intent: "accent", design: "tinted", class: e(["bg-accent-container", "text-on-accent-container", "hover:bg-accent-container-hovered", "enabled:active:bg-accent-container-pressed", "focus-visible:bg-accent-container-focused"]) }, { intent: "basic", design: "tinted", class: e(["bg-basic-container", "text-on-basic-container", "hover:bg-basic-container-hovered", "enabled:active:bg-basic-container-pressed", "focus-visible:bg-basic-container-focused"]) }, { intent: "success", design: "tinted", class: e(["bg-success-container", "text-on-success-container", "hover:bg-success-container-hovered", "enabled:active:bg-success-container-pressed", "focus-visible:bg-success-container-focused"]) }, { intent: "alert", design: "tinted", class: e(["bg-alert-container", "text-on-alert-container", "hover:bg-alert-container-hovered", "enabled:active:bg-alert-container-pressed", "focus-visible:bg-alert-container-focused"]) }, { intent: "danger", design: "tinted", class: e(["bg-error-container", "text-on-error-container", "hover:bg-error-container-hovered", "enabled:active:bg-error-container-pressed", "focus-visible:bg-error-container-focused"]) }, { intent: "info", design: "tinted", class: e(["bg-info-container", "text-on-info-container", "hover:bg-info-container-hovered", "enabled:active:bg-info-container-pressed", "focus-visible:bg-info-container-focused"]) }, { intent: "neutral", design: "tinted", class: e(["bg-neutral-container", "text-on-neutral-container", "hover:bg-neutral-container-hovered", "enabled:active:bg-neutral-container-pressed", "focus-visible:bg-neutral-container-focused"]) }, { intent: "surface", design: "tinted", class: e(["bg-surface", "text-on-surface", "hover:bg-surface-hovered", "enabled:active:bg-surface-pressed", "focus-visible:bg-surface-focused"]) }], D = [{ intent: "main", design: "contrast", class: e(["text-main", "hover:bg-main-container-hovered", "enabled:active:bg-main-container-pressed", "focus-visible:bg-main-container-focused"]) }, { intent: "support", design: "contrast", class: e(["text-support", "hover:bg-support-container-hovered", "enabled:active:bg-support-container-pressed", "focus-visible:bg-support-container-focused"]) }, { intent: "accent", design: "contrast", class: e(["text-accent", "hover:bg-accent-container-hovered", "enabled:active:bg-accent-container-pressed", "focus-visible:bg-accent-container-focused"]) }, { intent: "basic", design: "contrast", class: e(["text-basic", "hover:bg-basic-container-hovered", "enabled:active:bg-basic-container-pressed", "focus-visible:bg-basic-container-focused"]) }, { intent: "success", design: "contrast", class: e(["text-success", "hover:bg-success-container-hovered", "enabled:active:bg-success-container-pressed", "focus-visible:bg-success-container-focused"]) }, { intent: "alert", design: "contrast", class: e(["text-alert", "hover:bg-alert-container-hovered", "enabled:active:bg-alert-container-pressed", "focus-visible:bg-alert-container-focused"]) }, { intent: "danger", design: "contrast", class: e(["text-error", "hover:bg-error-container-hovered", "enabled:active:bg-error-container-pressed", "focus-visible:bg-error-container-focused"]) }, { intent: "info", design: "contrast", class: e(["text-info", "hover:bg-info-container-hovered", "enabled:active:bg-info-container-pressed", "focus-visible:bg-info-container-focused"]) }, { intent: "neutral", design: "contrast", class: e(["text-neutral", "hover:bg-neutral-container-hovered", "enabled:active:bg-neutral-container-pressed", "focus-visible:bg-neutral-container-focused"]) }, { intent: "surface", design: "contrast", class: e(["text-on-surface", "hover:bg-surface-hovered", "enabled:active:bg-surface-pressed", "focus-visible:bg-surface-focused"]) }], O = k(["u-shadow-border-transition", "box-border inline-flex items-center justify-center gap-md whitespace-nowrap", "px-lg", "text-body-1 font-bold", "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-outline-high [&:not(:focus-visible)]:ring-inset"], { variants: { design: a({ filled: [], outlined: ["bg-transparent", "ring-1", "ring-current"], tinted: [], ghost: [], contrast: ["bg-surface"] }), intent: a({ main: [], support: [], accent: [], basic: [], success: [], alert: [], danger: [], info: [], neutral: [], surface: [] }), size: a({ sm: ["min-w-sz-32", "h-sz-32"], md: ["min-w-sz-44", "h-sz-44"], lg: ["min-w-sz-56", "h-sz-56"] }), shape: a({ rounded: ["rounded-lg"], square: ["rounded-none"], pill: ["rounded-full"] }), disabled: { true: ["cursor-not-allowed", "opacity-dim-3"] } }, compoundVariants: [...P, ...B, ...C, ...V, ...D], defaultVariants: { design: "filled", intent: "main", size: "md", shape: "rounded" } }), U = ["onClick", "onMouseDown", "onMouseUp", "onMouseEnter", "onMouseLeave", "onMouseOver", "onMouseOut", "onKeyDown", "onKeyPress", "onKeyUp", "onSubmit"], j = K(({ children: u, design: v = "filled", disabled: r = !1, intent: f = "main", isLoading: i = !1, loadingLabel: o, loadingText: t, shape: m = "rounded", size: p = "md", spinnerPlacement: d = "left", asChild: b, className: h, ...x }, w) => {
|
7
|
+
const z = b ? N : "button", c = !!r || i, y = L(() => {
|
8
|
+
const n = {};
|
9
|
+
return c && U.forEach((E) => n[E] = void 0), n;
|
10
10
|
}, [c]), l = { size: "current", className: t ? "inline-block" : "absolute", ...o && { "aria-label": o } };
|
11
|
-
return
|
11
|
+
return s.createElement(z, { "data-spark-component": "button", ref: w, className: O({ className: h, design: v, disabled: c, intent: f, shape: m, size: p }), disabled: !!r, "aria-busy": i, "aria-live": i ? "assertive" : "off", ...x, ...y }, M(b, u, (n) => i ? s.createElement(s.Fragment, null, d === "left" && s.createElement(g, { ...l }), t && t, d === "right" && s.createElement(g, { ...l }), s.createElement("div", { "aria-hidden": !0, className: S("inline-flex gap-md", t ? "hidden" : "opacity-0") }, n)) : n));
|
12
12
|
});
|
13
|
-
|
13
|
+
j.displayName = "Button";
|
14
14
|
export {
|
15
|
-
|
15
|
+
j as Button
|
16
16
|
};
|
@@ -0,0 +1,253 @@
|
|
1
|
+
{
|
2
|
+
"Button": {
|
3
|
+
"tags": {},
|
4
|
+
"description": "",
|
5
|
+
"displayName": "Button",
|
6
|
+
"methods": [],
|
7
|
+
"props": {
|
8
|
+
"asChild": {
|
9
|
+
"defaultValue": null,
|
10
|
+
"description": "Change the component to the HTML tag or custom component of the only child.",
|
11
|
+
"name": "asChild",
|
12
|
+
"parent": {
|
13
|
+
"fileName": "button/src/Button.tsx",
|
14
|
+
"name": "ButtonProps"
|
15
|
+
},
|
16
|
+
"declarations": [
|
17
|
+
{
|
18
|
+
"fileName": "button/src/Button.tsx",
|
19
|
+
"name": "ButtonProps"
|
20
|
+
}
|
21
|
+
],
|
22
|
+
"required": false,
|
23
|
+
"type": {
|
24
|
+
"name": "boolean"
|
25
|
+
}
|
26
|
+
},
|
27
|
+
"isLoading": {
|
28
|
+
"defaultValue": {
|
29
|
+
"value": "false"
|
30
|
+
},
|
31
|
+
"description": "Display a spinner to indicate to the user that the button is loading something after they interacted with it.",
|
32
|
+
"name": "isLoading",
|
33
|
+
"parent": {
|
34
|
+
"fileName": "button/src/Button.tsx",
|
35
|
+
"name": "ButtonProps"
|
36
|
+
},
|
37
|
+
"declarations": [
|
38
|
+
{
|
39
|
+
"fileName": "button/src/Button.tsx",
|
40
|
+
"name": "ButtonProps"
|
41
|
+
}
|
42
|
+
],
|
43
|
+
"required": false,
|
44
|
+
"type": {
|
45
|
+
"name": "boolean"
|
46
|
+
}
|
47
|
+
},
|
48
|
+
"loadingLabel": {
|
49
|
+
"defaultValue": null,
|
50
|
+
"description": "If your loading state should only display a spinner, it's better to specify a label for it (a11y).",
|
51
|
+
"name": "loadingLabel",
|
52
|
+
"parent": {
|
53
|
+
"fileName": "button/src/Button.tsx",
|
54
|
+
"name": "ButtonProps"
|
55
|
+
},
|
56
|
+
"declarations": [
|
57
|
+
{
|
58
|
+
"fileName": "button/src/Button.tsx",
|
59
|
+
"name": "ButtonProps"
|
60
|
+
}
|
61
|
+
],
|
62
|
+
"required": false,
|
63
|
+
"type": {
|
64
|
+
"name": "string"
|
65
|
+
}
|
66
|
+
},
|
67
|
+
"loadingText": {
|
68
|
+
"defaultValue": null,
|
69
|
+
"description": "If your loading state should also display a label, you can use this prop instead of `loadingLabel`.\n**Please note that using this can result in layout shifting when the Button goes from loading state to normal state.**",
|
70
|
+
"name": "loadingText",
|
71
|
+
"parent": {
|
72
|
+
"fileName": "button/src/Button.tsx",
|
73
|
+
"name": "ButtonProps"
|
74
|
+
},
|
75
|
+
"declarations": [
|
76
|
+
{
|
77
|
+
"fileName": "button/src/Button.tsx",
|
78
|
+
"name": "ButtonProps"
|
79
|
+
}
|
80
|
+
],
|
81
|
+
"required": false,
|
82
|
+
"type": {
|
83
|
+
"name": "string"
|
84
|
+
}
|
85
|
+
},
|
86
|
+
"spinnerPlacement": {
|
87
|
+
"defaultValue": {
|
88
|
+
"value": "left"
|
89
|
+
},
|
90
|
+
"description": "",
|
91
|
+
"name": "spinnerPlacement",
|
92
|
+
"parent": {
|
93
|
+
"fileName": "button/src/Button.tsx",
|
94
|
+
"name": "ButtonProps"
|
95
|
+
},
|
96
|
+
"declarations": [
|
97
|
+
{
|
98
|
+
"fileName": "button/src/Button.tsx",
|
99
|
+
"name": "ButtonProps"
|
100
|
+
}
|
101
|
+
],
|
102
|
+
"required": false,
|
103
|
+
"type": {
|
104
|
+
"name": "enum",
|
105
|
+
"raw": "\"left\" | \"right\"",
|
106
|
+
"value": [
|
107
|
+
{
|
108
|
+
"value": "\"left\""
|
109
|
+
},
|
110
|
+
{
|
111
|
+
"value": "\"right\""
|
112
|
+
}
|
113
|
+
]
|
114
|
+
}
|
115
|
+
},
|
116
|
+
"disabled": {
|
117
|
+
"defaultValue": {
|
118
|
+
"value": "false"
|
119
|
+
},
|
120
|
+
"description": "Disable the button, preventing user interaction and adding opacity.",
|
121
|
+
"name": "disabled",
|
122
|
+
"declarations": [],
|
123
|
+
"required": false,
|
124
|
+
"type": {
|
125
|
+
"name": "boolean"
|
126
|
+
}
|
127
|
+
},
|
128
|
+
"design": {
|
129
|
+
"defaultValue": {
|
130
|
+
"value": "filled"
|
131
|
+
},
|
132
|
+
"description": "Main style of the button.\n\n- `filled`: Button will be plain.\n\n- `outlined`: Button will be transparent with an outline.\n\n- `tinted`: Button will be filled but using a lighter color scheme.\n\n- `ghost`: Button will look like a link. No borders, plain text.\n\n- `contrast`: Button will be surface filled. No borders, plain text.",
|
133
|
+
"name": "design",
|
134
|
+
"declarations": [],
|
135
|
+
"required": false,
|
136
|
+
"type": {
|
137
|
+
"name": "enum",
|
138
|
+
"raw": "\"filled\" | \"outlined\" | \"tinted\" | \"ghost\" | \"contrast\"",
|
139
|
+
"value": [
|
140
|
+
{
|
141
|
+
"value": "\"filled\""
|
142
|
+
},
|
143
|
+
{
|
144
|
+
"value": "\"outlined\""
|
145
|
+
},
|
146
|
+
{
|
147
|
+
"value": "\"tinted\""
|
148
|
+
},
|
149
|
+
{
|
150
|
+
"value": "\"ghost\""
|
151
|
+
},
|
152
|
+
{
|
153
|
+
"value": "\"contrast\""
|
154
|
+
}
|
155
|
+
]
|
156
|
+
}
|
157
|
+
},
|
158
|
+
"intent": {
|
159
|
+
"defaultValue": {
|
160
|
+
"value": "main"
|
161
|
+
},
|
162
|
+
"description": "Color scheme of the button.",
|
163
|
+
"name": "intent",
|
164
|
+
"declarations": [],
|
165
|
+
"required": false,
|
166
|
+
"type": {
|
167
|
+
"name": "enum",
|
168
|
+
"raw": "\"main\" | \"support\" | \"accent\" | \"basic\" | \"success\" | \"alert\" | \"danger\" | \"info\" | \"neutral\" | \"surface\"",
|
169
|
+
"value": [
|
170
|
+
{
|
171
|
+
"value": "\"main\""
|
172
|
+
},
|
173
|
+
{
|
174
|
+
"value": "\"support\""
|
175
|
+
},
|
176
|
+
{
|
177
|
+
"value": "\"accent\""
|
178
|
+
},
|
179
|
+
{
|
180
|
+
"value": "\"basic\""
|
181
|
+
},
|
182
|
+
{
|
183
|
+
"value": "\"success\""
|
184
|
+
},
|
185
|
+
{
|
186
|
+
"value": "\"alert\""
|
187
|
+
},
|
188
|
+
{
|
189
|
+
"value": "\"danger\""
|
190
|
+
},
|
191
|
+
{
|
192
|
+
"value": "\"info\""
|
193
|
+
},
|
194
|
+
{
|
195
|
+
"value": "\"neutral\""
|
196
|
+
},
|
197
|
+
{
|
198
|
+
"value": "\"surface\""
|
199
|
+
}
|
200
|
+
]
|
201
|
+
}
|
202
|
+
},
|
203
|
+
"shape": {
|
204
|
+
"defaultValue": {
|
205
|
+
"value": "rounded"
|
206
|
+
},
|
207
|
+
"description": "",
|
208
|
+
"name": "shape",
|
209
|
+
"declarations": [],
|
210
|
+
"required": false,
|
211
|
+
"type": {
|
212
|
+
"name": "enum",
|
213
|
+
"raw": "\"rounded\" | \"square\" | \"pill\"",
|
214
|
+
"value": [
|
215
|
+
{
|
216
|
+
"value": "\"rounded\""
|
217
|
+
},
|
218
|
+
{
|
219
|
+
"value": "\"square\""
|
220
|
+
},
|
221
|
+
{
|
222
|
+
"value": "\"pill\""
|
223
|
+
}
|
224
|
+
]
|
225
|
+
}
|
226
|
+
},
|
227
|
+
"size": {
|
228
|
+
"defaultValue": {
|
229
|
+
"value": "md"
|
230
|
+
},
|
231
|
+
"description": "",
|
232
|
+
"name": "size",
|
233
|
+
"declarations": [],
|
234
|
+
"required": false,
|
235
|
+
"type": {
|
236
|
+
"name": "enum",
|
237
|
+
"raw": "\"sm\" | \"md\" | \"lg\"",
|
238
|
+
"value": [
|
239
|
+
{
|
240
|
+
"value": "\"sm\""
|
241
|
+
},
|
242
|
+
{
|
243
|
+
"value": "\"md\""
|
244
|
+
},
|
245
|
+
{
|
246
|
+
"value": "\"lg\""
|
247
|
+
}
|
248
|
+
]
|
249
|
+
}
|
250
|
+
}
|
251
|
+
}
|
252
|
+
}
|
253
|
+
}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@spark-ui/button",
|
3
|
-
"version": "2.1.
|
3
|
+
"version": "2.1.7",
|
4
4
|
"description": "Button component is used to trigger an action or event, such as submitting a form, opening a Dialog, canceling an action, or performing a delete operation.",
|
5
5
|
"publishConfig": {
|
6
6
|
"access": "public"
|
@@ -25,11 +25,11 @@
|
|
25
25
|
"dependencies": {
|
26
26
|
"@spark-ui/internal-utils": "^2.1.2",
|
27
27
|
"@spark-ui/slot": "^1.6.6",
|
28
|
-
"@spark-ui/spinner": "^2.1.
|
28
|
+
"@spark-ui/spinner": "^2.1.6",
|
29
29
|
"class-variance-authority": "0.7.0"
|
30
30
|
},
|
31
31
|
"peerDependencies": {
|
32
|
-
"@spark-ui/theme-utils": "^
|
32
|
+
"@spark-ui/theme-utils": "^4.0.0",
|
33
33
|
"react": "16.8 || ^17.0 || ^18.0",
|
34
34
|
"react-dom": "^16.8 || ^17.0 || ^18.0",
|
35
35
|
"tailwindcss": "^3.0.0"
|
@@ -44,5 +44,5 @@
|
|
44
44
|
},
|
45
45
|
"homepage": "https://sparkui.vercel.app",
|
46
46
|
"license": "MIT",
|
47
|
-
"gitHead": "
|
47
|
+
"gitHead": "e98a5abd16667218cead4b366bb0e69435d7f8ed"
|
48
48
|
}
|