@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.
package/dist/index.js CHANGED
@@ -134,13 +134,13 @@ const Icon = ({ onClick, icon, type = 'theme', extraClassNames, id, large, small
134
134
  * - use "variant" to achieve the desired style
135
135
  * - include tooltips and/or icons
136
136
  */
137
- const Button = ({ onClick, label, variant = 'outline', type = 'button', size = 'sm', disabled, extraClassNames, id, testId, stopPropagation = true, tooltip, tooltipOptions, iconStyle = 'text', icon, iconColor, }) => {
137
+ const Button = ({ onClick, label, variant = 'outline', type = 'button', size = 'sm', disabled, extraClassNames, id, testId, stopPropagation = true, tooltip, tooltipOptions, iconStyle = 'text', icon, iconColor, preventBlur = false, }) => {
138
138
  const baseClasses = 'tw-py-1 tw-px-2.5 tw-rounded-sm focus:tw-ring-0 disabled:tw-pointer-events-none';
139
139
  const baseClassesByVariant = {
140
140
  'outline': 'tw-border-solid tw-border',
141
- 'theme': 'disabled:tw-bg-opacity-50',
142
- 'danger': 'tw-bg-sq-danger-color hover:tw-bg-sq-danger-color-hover disabled:tw-bg-opacity-50',
143
- 'theme-light': 'disabled:tw-bg-opacity-50',
141
+ 'theme': 'disabled:tw-opacity-50',
142
+ 'danger': 'tw-bg-sq-danger-color hover:tw-bg-sq-danger-color-hover disabled:tw-opacity-50',
143
+ 'theme-light': 'disabled:tw-opacity-50',
144
144
  'no-border': '',
145
145
  'warning': 'tw-bg-sq-warning-color',
146
146
  };
@@ -187,9 +187,12 @@ const Button = ({ onClick, label, variant = 'outline', type = 'button', size = '
187
187
  const button = (React.createElement("button", { id: id, disabled: disabled, "data-testid": testId, type: type === 'link' || (type === 'submit' && browserIsFirefox) ? 'button' : type, onClick: (e) => {
188
188
  stopPropagation && e.stopPropagation();
189
189
  onClick && onClick();
190
+ }, onMouseDown: (e) => {
191
+ if (preventBlur) {
192
+ e.preventDefault();
193
+ }
190
194
  }, className: appliedClasses },
191
- icon && (React.createElement(Icon, { icon: icon, type: iconStyle, color: iconColor, extraClassNames: label ?
192
- `tw-mr-1 ${textClassesByVariantLightTheme[variant]} ${textClassesByVariantDarkTheme[variant]}` : '', testId: `${id}_spinner` })),
195
+ icon && (React.createElement(Icon, { icon: icon, type: iconStyle, color: iconColor, extraClassNames: label ? `tw-mr-1 ${textClassesByVariantLightTheme[variant]} ${textClassesByVariantDarkTheme[variant]}` : '', testId: `${id}_spinner` })),
193
196
  label));
194
197
  return tooltip ? (React.createElement(Tooltip, { text: tooltip, ...tooltipOptions }, button)) : (button);
195
198
  };