@seeqdev/qomponents 0.0.82 → 0.0.84
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/TextField/TextField.types.d.ts +6 -1
- package/dist/ToolbarButton/ToolbarButton.types.d.ts +10 -0
- package/dist/index.esm.js +28 -5
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +28 -5
- package/dist/index.js.map +1 -1
- package/dist/styles.css +3 -3
- package/dist/utils/svg.d.ts +15 -0
- package/dist/utils/svg.js +20 -0
- package/dist/utils/svg.js.map +1 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -4581,6 +4581,26 @@ const $cb5cc270b50c6fcd$export$602eac185826482c = $cb5cc270b50c6fcd$export$dd679
|
|
|
4581
4581
|
const $cb5cc270b50c6fcd$export$7c6e2c02157bb7d2 = $cb5cc270b50c6fcd$export$d7e1f420b25549ff;
|
|
4582
4582
|
const $cb5cc270b50c6fcd$export$21b07c8f274aebd5 = $cb5cc270b50c6fcd$export$3152841115e061b2;
|
|
4583
4583
|
|
|
4584
|
+
const SVG_PATH = 'svgpath:';
|
|
4585
|
+
/**
|
|
4586
|
+
* Determines if an icon is SVG
|
|
4587
|
+
*
|
|
4588
|
+
* @param icon - an icon string that will either be an icon class or an SVG path definition (e.g. "fa fa-wrench" or
|
|
4589
|
+
* "svgpath:M 17.0181 0 ...")
|
|
4590
|
+
*/
|
|
4591
|
+
function isSvgIcon(icon) {
|
|
4592
|
+
return icon.startsWith(SVG_PATH);
|
|
4593
|
+
}
|
|
4594
|
+
/**
|
|
4595
|
+
* Retrieves the SVG path from an SVG icon
|
|
4596
|
+
*
|
|
4597
|
+
* @param icon - an SVG icon string including path definition (e.g. "svgpath:M 17.0181 0 ...")
|
|
4598
|
+
* @returns the SVG icon path or an empty string if the supplied icon is not SVG
|
|
4599
|
+
*/
|
|
4600
|
+
function getSvgIconPath(icon) {
|
|
4601
|
+
return isSvgIcon(icon) ? icon.substring(SVG_PATH.length) : '';
|
|
4602
|
+
}
|
|
4603
|
+
|
|
4584
4604
|
const borderStyles$4 = [
|
|
4585
4605
|
'tw-border-solid',
|
|
4586
4606
|
'tw-border',
|
|
@@ -4614,7 +4634,7 @@ const activeBorderStyles = [
|
|
|
4614
4634
|
const bgStyles$3 = ['tw-bg-sq-white', 'dark:tw-bg-sq-dark-background'].join(' ');
|
|
4615
4635
|
const disabledClasses$4 = ['tw-opacity-50', 'tw-cursor-not-allowed'].join(' ');
|
|
4616
4636
|
const PopoverContent = React__namespace.forwardRef(({ className, align = 'center', sideOffset = 4, ...props }, ref) => (React__namespace.createElement($cb5cc270b50c6fcd$export$7c6e2c02157bb7d2, { ref: ref, align: align, sideOffset: sideOffset, ...props, asChild: true })));
|
|
4617
|
-
const ToolbarButton = ({ isSmall = false, label, icon, secondIcon, forceSmallIcon = false, tooltipText, id, popoverContent, extraClassNames, testId, tooltipTestId, tooltipOptions, isActive = false, isHtmlTooltip = false, hasArrow = false, disabled = false, onClick, onHide, }) => {
|
|
4637
|
+
const ToolbarButton = ({ isSmall = false, label, icon, secondIcon, forceSmallIcon = false, tooltipText, id, popoverContent, extraClassNames, testId, tooltipTestId, tooltipOptions, isActive = false, isHtmlTooltip = false, hasArrow = false, disabled = false, isPrimaryAnSvg = false, primaryIconExtraClassNames = false, iconHeight = 24, iconWidth = 24, primaryIconViewbox = '0 0 24 24', onClick, onHide, }) => {
|
|
4618
4638
|
let tooltipData = undefined;
|
|
4619
4639
|
if (tooltipText) {
|
|
4620
4640
|
tooltipData = {
|
|
@@ -4634,9 +4654,10 @@ const ToolbarButton = ({ isSmall = false, label, icon, secondIcon, forceSmallIco
|
|
|
4634
4654
|
React__namespace.createElement($cb5cc270b50c6fcd$export$41fb9f06171c75f4, { id: id, className: `tw-border-none ${isActive ? 'active' : ''}`, disabled: disabled, "data-testid": testId, onClick: (e) => {
|
|
4635
4655
|
onClick && onClick(e);
|
|
4636
4656
|
} },
|
|
4637
|
-
React__namespace.createElement("div", { ...tooltipData, className: `tw-bg-transparent tw-p-0 tw-flex tw-flex-col tw-items-center ${isSmall ? 'tw-py-[1px] tw-px-[5px]' : 'tw-px-2 tw-py-[
|
|
4657
|
+
React__namespace.createElement("div", { ...tooltipData, className: `tw-bg-transparent tw-p-0 tw-flex tw-flex-col tw-items-center ${isSmall ? 'tw-py-[1px] tw-px-[5px]' : 'tw-px-2 tw-py-[5px]'} ${disabled ? disabledClasses$4 : isActive ? activeBorderStyles : triggerBorderStyles} ${extraClassNames || ''}` },
|
|
4638
4658
|
React__namespace.createElement("span", { className: "tw-nowrap" },
|
|
4639
|
-
React__namespace.createElement(
|
|
4659
|
+
isPrimaryAnSvg ? (React__namespace.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", className: `tw-text-sq-text-color dark:tw-text-sq-dark-text ${primaryIconExtraClassNames || ''}`, viewBox: primaryIconViewbox, height: `${iconHeight}px`, width: `${iconWidth}px`, fill: "currentColor", "data-testid": testId },
|
|
4660
|
+
React__namespace.createElement("path", { d: getSvgIconPath(icon) }))) : (React__namespace.createElement(Icon, { icon: icon, testId: "firstIcon", type: "text", large: !isSmall && !label && !secondIcon && !forceSmallIcon, extraClassNames: `tw-text-sq-text-color dark:tw-text-sq-dark-text` })),
|
|
4640
4661
|
secondIcon && React__namespace.createElement(Icon, { icon: secondIcon, type: "text", testId: "secondIcon" }),
|
|
4641
4662
|
popoverContent ? (React__namespace.createElement(Icon, { icon: "fc-arrow-dropdown", extraClassNames: "tw-text-sq-text-color dark:tw-text-sq-dark-text tw-ml-[3px] tw-text-[8px]", type: "text" })) : undefined),
|
|
4642
4663
|
!isSmall && (React__namespace.createElement("small", { className: "tw-text-sq-text-color dark:tw-text-sq-dark-text tw-text-[10px]" }, label)))),
|
|
@@ -4673,7 +4694,7 @@ const sizeClasses = {
|
|
|
4673
4694
|
* Textfield.
|
|
4674
4695
|
*/
|
|
4675
4696
|
const TextField = React.forwardRef((props, ref) => {
|
|
4676
|
-
const { readonly = false, onChange, onKeyUp, id, name, size = 'sm', value, placeholder, extraClassNames, testId, type = 'text', inputGroup, step, showError, required = false, } = props;
|
|
4697
|
+
const { readonly = false, onChange, onKeyUp, onFocus, onBlur, onKeyDown, id, name, size = 'sm', value, placeholder, extraClassNames, testId, type = 'text', inputGroup, step, showError, errorText, required = false, autoComplete = 'off' } = props;
|
|
4677
4698
|
const internalRef = React.useRef(null);
|
|
4678
4699
|
const [cursor, setCursor] = React.useState(null);
|
|
4679
4700
|
const setAllRefs = (receivedRef) => {
|
|
@@ -4709,7 +4730,9 @@ const TextField = React.forwardRef((props, ref) => {
|
|
|
4709
4730
|
borderRadius = 'tw-rounded-r-sm tw-border-l-0 focus:tw-border-l active:tw-border-l';
|
|
4710
4731
|
}
|
|
4711
4732
|
const appliedClasses = `${baseClasses$3} ${sizeClasses[size]} ${extraClassNames} ${lightTheme$1} ${darkTheme$1} ${borderRadius} ${showError ? errorClasses$2 : borderColorClasses$2} `;
|
|
4712
|
-
return (React.createElement("
|
|
4733
|
+
return (React.createElement("div", { className: "tw-w-full" },
|
|
4734
|
+
React.createElement("input", { ref: setAllRefs, "data-testid": testId, name: name, id: id, type: type, value: value, className: appliedClasses, placeholder: placeholder, disabled: readonly, autoComplete: autoComplete, onChange: handleChange, onFocus: onFocus, onBlur: onBlur, onKeyDown: onKeyDown, onKeyUp: onKeyUp, step: step, required: required }),
|
|
4735
|
+
errorText && showError && React.createElement("div", { className: "tw-text-sq-danger-color tw-text-xs tw-mt-1" }, errorText)));
|
|
4713
4736
|
});
|
|
4714
4737
|
|
|
4715
4738
|
const alignment = 'tw-flex';
|