@seeqdev/qomponents 0.0.15 → 0.0.16

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.
@@ -5,3 +5,4 @@ export default _default;
5
5
  export declare const AllButtonVariants: () => JSX.Element;
6
6
  export declare const ButtonWithTooltip: () => JSX.Element;
7
7
  export declare const ButtonWithIcon: () => JSX.Element;
8
+ export declare const DisabledButton: () => JSX.Element;
@@ -36,4 +36,6 @@ export interface ButtonProps {
36
36
  tooltip?: string;
37
37
  /** options for the tooltip */
38
38
  tooltipOptions?: Omit<TooltipProps, 'text'>;
39
+ /** if provided, determines whether to prevent the blur event from occurring onMouseDown*/
40
+ preventBlur?: boolean;
39
41
  }
@@ -11,7 +11,7 @@
11
11
  },
12
12
  "dependencies": {
13
13
  "@fortawesome/fontawesome-free": "^6.4.0",
14
- "@seeqdev/qomponents": "latest",
14
+ "@seeqdev/qomponents": "0.0.15",
15
15
  "react": "^18.2.0",
16
16
  "react-dom": "^18.2.0"
17
17
  },
package/dist/index.esm.js CHANGED
@@ -114,13 +114,13 @@ const Icon = ({ onClick, icon, type = 'theme', extraClassNames, id, large, small
114
114
  * - use "variant" to achieve the desired style
115
115
  * - include tooltips and/or icons
116
116
  */
117
- const Button = ({ onClick, label, variant = 'outline', type = 'button', size = 'sm', disabled, extraClassNames, id, testId, stopPropagation = true, tooltip, tooltipOptions, iconStyle = 'text', icon, iconColor, }) => {
117
+ const Button = ({ onClick, label, variant = 'outline', type = 'button', size = 'sm', disabled, extraClassNames, id, testId, stopPropagation = true, tooltip, tooltipOptions, iconStyle = 'text', icon, iconColor, preventBlur = false, }) => {
118
118
  const baseClasses = 'tw-py-1 tw-px-2.5 tw-rounded-sm focus:tw-ring-0 disabled:tw-pointer-events-none';
119
119
  const baseClassesByVariant = {
120
120
  'outline': 'tw-border-solid tw-border',
121
- 'theme': 'disabled:tw-bg-opacity-50',
122
- 'danger': 'tw-bg-sq-danger-color hover:tw-bg-sq-danger-color-hover disabled:tw-bg-opacity-50',
123
- 'theme-light': 'disabled:tw-bg-opacity-50',
121
+ 'theme': 'disabled:tw-opacity-50',
122
+ 'danger': 'tw-bg-sq-danger-color hover:tw-bg-sq-danger-color-hover disabled:tw-opacity-50',
123
+ 'theme-light': 'disabled:tw-opacity-50',
124
124
  'no-border': '',
125
125
  'warning': 'tw-bg-sq-warning-color',
126
126
  };
@@ -167,9 +167,12 @@ const Button = ({ onClick, label, variant = 'outline', type = 'button', size = '
167
167
  const button = (React__default.createElement("button", { id: id, disabled: disabled, "data-testid": testId, type: type === 'link' || (type === 'submit' && browserIsFirefox) ? 'button' : type, onClick: (e) => {
168
168
  stopPropagation && e.stopPropagation();
169
169
  onClick && onClick();
170
+ }, onMouseDown: (e) => {
171
+ if (preventBlur) {
172
+ e.preventDefault();
173
+ }
170
174
  }, className: appliedClasses },
171
- icon && (React__default.createElement(Icon, { icon: icon, type: iconStyle, color: iconColor, extraClassNames: label ?
172
- `tw-mr-1 ${textClassesByVariantLightTheme[variant]} ${textClassesByVariantDarkTheme[variant]}` : '', testId: `${id}_spinner` })),
175
+ icon && (React__default.createElement(Icon, { icon: icon, type: iconStyle, color: iconColor, extraClassNames: label ? `tw-mr-1 ${textClassesByVariantLightTheme[variant]} ${textClassesByVariantDarkTheme[variant]}` : '', testId: `${id}_spinner` })),
173
176
  label));
174
177
  return tooltip ? (React__default.createElement(Tooltip, { text: tooltip, ...tooltipOptions }, button)) : (button);
175
178
  };