@stella-source/stellasource-dsl 0.1.3 → 0.1.5
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/dist/cjs/index.js +8 -6
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/components/StellaButton/StellaButton.d.ts +1 -1
- package/dist/cjs/types/components/StellaButton/StellaButton.stories.d.ts +1 -1
- package/dist/cjs/types/components/StellaButton/types.d.ts +3 -1
- package/dist/esm/index.esm.js +8 -6
- package/dist/esm/index.esm.js.map +1 -1
- package/dist/esm/types/components/StellaButton/StellaButton.d.ts +1 -1
- package/dist/esm/types/components/StellaButton/StellaButton.stories.d.ts +1 -1
- package/dist/esm/types/components/StellaButton/types.d.ts +3 -1
- package/dist/index.d.ts +14 -12
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { StellaButtonProps } from "./types";
|
|
3
|
-
declare const StellaButton: ({ disabled, variant, label, startIcon, endIcon, isLoading, className, id, htmlProps, onClick, }: StellaButtonProps) => React.JSX.Element;
|
|
3
|
+
declare const StellaButton: ({ disabled, variant, label, startIcon, endIcon, isLoading, className, id, htmlProps, onClick, preventDefault, type, }: StellaButtonProps) => React.JSX.Element;
|
|
4
4
|
export default StellaButton;
|
|
@@ -2,7 +2,7 @@ import { StellaButtonVariant } from "./types";
|
|
|
2
2
|
import { StellaButtonIcons, StellaButtonProps } from "./types";
|
|
3
3
|
declare const _default: {
|
|
4
4
|
title: string;
|
|
5
|
-
component: ({ disabled, variant, label, startIcon, endIcon, isLoading, className, id, htmlProps, onClick, }: StellaButtonProps) => import("react").JSX.Element;
|
|
5
|
+
component: ({ disabled, variant, label, startIcon, endIcon, isLoading, className, id, htmlProps, onClick, preventDefault, type, }: StellaButtonProps) => import("react").JSX.Element;
|
|
6
6
|
tags: string[];
|
|
7
7
|
parameters: {};
|
|
8
8
|
argTypes: {
|
|
@@ -10,13 +10,15 @@ export declare enum StellaButtonVariant {
|
|
|
10
10
|
}
|
|
11
11
|
export interface StellaButtonProps {
|
|
12
12
|
label: string;
|
|
13
|
-
onClick: () => void;
|
|
13
|
+
onClick: (e?: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;
|
|
14
14
|
id?: string;
|
|
15
|
+
type?: "button" | "submit" | "reset";
|
|
15
16
|
className?: string;
|
|
16
17
|
isLoading?: boolean;
|
|
17
18
|
startIcon?: `${StellaButtonIcons}`;
|
|
18
19
|
endIcon?: `${StellaButtonIcons}`;
|
|
19
20
|
disabled?: boolean;
|
|
21
|
+
preventDefault?: boolean;
|
|
20
22
|
variant?: `${StellaButtonVariant}`;
|
|
21
23
|
htmlProps?: HTMLAttributes<HTMLButtonElement>;
|
|
22
24
|
}
|
package/dist/esm/index.esm.js
CHANGED
|
@@ -17731,13 +17731,15 @@ const Loader = ({ size = 14, dataTestId, color, className, id, }) => {
|
|
|
17731
17731
|
return (a__default.createElement(CustomLoader, { "data-testid": dataTestId, size: size, weight: "bold", color: color ?? "var(--primary)", className: className, id: id }));
|
|
17732
17732
|
};
|
|
17733
17733
|
|
|
17734
|
-
const StellaButton = ({ disabled, variant = "primary", label, startIcon, endIcon, isLoading = false, className, id, htmlProps, onClick, }) => {
|
|
17734
|
+
const StellaButton = ({ disabled, variant = "primary", label, startIcon, endIcon, isLoading = false, className, id, htmlProps, onClick, preventDefault = true, type = "button", }) => {
|
|
17735
17735
|
const getIcon = (iconType, dataTestId) => {
|
|
17736
17736
|
return a__default.createElement(StellaIcon, { iconName: iconType, dataTestId: dataTestId, size: 14 });
|
|
17737
17737
|
};
|
|
17738
|
-
|
|
17739
|
-
|
|
17740
|
-
|
|
17738
|
+
const handleClick = (e) => {
|
|
17739
|
+
preventDefault && e.preventDefault();
|
|
17740
|
+
onClick?.(e);
|
|
17741
|
+
};
|
|
17742
|
+
return (a__default.createElement(ButtonComponent, { "$variant": variant, "$isLoading": isLoading, type: type, disabled: disabled, className: className, id: id, onClick: handleClick, ...htmlProps },
|
|
17741
17743
|
startIcon && getIcon(startIcon, "start-icon"),
|
|
17742
17744
|
label.toUpperCase(),
|
|
17743
17745
|
isLoading && a__default.createElement(Loader, { dataTestId: "loader", size: 14 }),
|
|
@@ -17861,9 +17863,9 @@ const IconContainer = dt.div `
|
|
|
17861
17863
|
`;
|
|
17862
17864
|
|
|
17863
17865
|
const TextFieldContainer = ({ id, label, children, tooltipText, endIcon, className, rightCategory, leftCategory, helperText, dataTestId, helperTextAffectLayout = true, disabled = false, hideLabel = false, isLoading = false, hasError = false, isRequired = false, }) => {
|
|
17864
|
-
return (a__default.createElement(Wrapper, { "data-testId": dataTestId },
|
|
17866
|
+
return (a__default.createElement(Wrapper, { "data-testId": dataTestId, className: className },
|
|
17865
17867
|
a__default.createElement(Label, { tooltipText: tooltipText, required: isRequired, labelValue: label, hideLabel: hideLabel, id: `${id}-label`, htmlFor: `${id}-text-field` }),
|
|
17866
|
-
a__default.createElement(TextFieldWrapper, { id: id,
|
|
17868
|
+
a__default.createElement(TextFieldWrapper, { id: id, "$hasError": hasError, "$isDisabled": disabled, "$isLoading": isLoading, "data-testid": "text-input-wrapper" },
|
|
17867
17869
|
leftCategory && a__default.createElement(Category, null, leftCategory),
|
|
17868
17870
|
children,
|
|
17869
17871
|
isLoading && (a__default.createElement(IconContainer, null,
|