@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/Button/Button.stories.d.ts +1 -0
- package/dist/Button/Button.types.d.ts +2 -0
- package/dist/example/package.json +1 -1
- package/dist/index.esm.js +9 -6
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +9 -6
- package/dist/index.js.map +1 -1
- package/dist/styles.css +8 -4
- package/package.json +1 -1
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-
|
|
122
|
-
'danger': 'tw-bg-sq-danger-color hover:tw-bg-sq-danger-color-hover disabled:tw-
|
|
123
|
-
'theme-light': 'disabled:tw-
|
|
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
|
};
|