@octaviaflow/core 3.0.8 → 3.0.9
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.
|
@@ -7,6 +7,19 @@ export interface ButtonProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement
|
|
|
7
7
|
rightIcon?: ReactNode;
|
|
8
8
|
fullWidth?: boolean;
|
|
9
9
|
children?: ReactNode;
|
|
10
|
+
/**
|
|
11
|
+
* Override the cursor shown on hover. When omitted, the cursor auto-resolves:
|
|
12
|
+
* - `not-allowed` when disabled (CSS handles this — see Button.module.scss)
|
|
13
|
+
* - `progress` when loading (request in flight)
|
|
14
|
+
* - `pointer` when the button has an action (onClick, type="submit",
|
|
15
|
+
* or type="reset"). Anchors (href) get pointer too.
|
|
16
|
+
* - `default` otherwise (decorative / placeholder buttons)
|
|
17
|
+
* Pass an explicit value (e.g. `"text"`, `"grab"`) to override the
|
|
18
|
+
* auto-resolve for the specific story / use case.
|
|
19
|
+
*/
|
|
20
|
+
cursor?: ButtonHTMLAttributes<HTMLButtonElement>["style"] extends infer S ? S extends {
|
|
21
|
+
cursor?: infer C;
|
|
22
|
+
} ? C : string : string;
|
|
10
23
|
}
|
|
11
|
-
export declare function Button({ variant, size, loading, disabled, leftIcon, rightIcon, fullWidth, className, children, type, ...props }: ButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
24
|
+
export declare function Button({ variant, size, loading, disabled, leftIcon, rightIcon, fullWidth, className, children, type, cursor, style, ...props }: ButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
12
25
|
//# sourceMappingURL=Button.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../../src/components/Button/Button.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,oBAAoB,EAAE,KAAK,SAAS,EAAU,MAAM,OAAO,CAAC;AAK1E,MAAM,WAAW,WACf,SAAQ,IAAI,CACV,oBAAoB,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AM,CAAC;CACZ;AAED,wBAAgB,MAAM,CAAC,EACrB,OAAmB,EACnB,IAAW,EACX,OAAe,EACf,QAAgB,EAChB,QAAQ,EACR,SAAS,EACT,SAAiB,EACjB,SAAS,EACT,QAAQ,EACR,IAAI,EACJ,MAAM,EACN,KAAK,EACL,GAAG,KAAK,EACT,EAAE,WAAW,2CAwIb"}
|
package/dist/index.cjs
CHANGED
|
@@ -815,10 +815,14 @@ function Button({
|
|
|
815
815
|
className,
|
|
816
816
|
children,
|
|
817
817
|
type,
|
|
818
|
+
cursor,
|
|
819
|
+
style,
|
|
818
820
|
...props
|
|
819
821
|
}) {
|
|
820
822
|
const ref = (0, import_react4.useRef)(null);
|
|
821
823
|
const isDisabled = disabled || loading;
|
|
824
|
+
const hasAction = Boolean(props.onClick) || type === "submit" || type === "reset" || Boolean(props.href);
|
|
825
|
+
const resolvedCursor = cursor ?? (disabled ? "not-allowed" : loading ? "progress" : hasAction ? "pointer" : "default");
|
|
822
826
|
const resolvedType = type ?? "button";
|
|
823
827
|
const hasVisibleText = typeof children === "string" ? children.trim().length > 0 : Boolean(children);
|
|
824
828
|
const needsAriaName = !hasVisibleText;
|
|
@@ -863,6 +867,7 @@ function Button({
|
|
|
863
867
|
fullWidth && "ods-btn--full",
|
|
864
868
|
className
|
|
865
869
|
),
|
|
870
|
+
style: { cursor: resolvedCursor, ...style },
|
|
866
871
|
"data-loading": loading || void 0,
|
|
867
872
|
whileTap: isDisabled ? void 0 : { scale: 0.97 },
|
|
868
873
|
transition: { duration: 0.1 },
|