@seeqdev/qomponents 0.0.193 → 0.0.202
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/example/{.eslintrc.cjs → .eslintrc.js} +1 -1
- package/dist/index.esm.js +106 -55
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +106 -54
- package/dist/index.js.map +1 -1
- package/dist/src/Button/Button.d.ts +2 -1
- package/dist/src/Button/Button.types.d.ts +4 -4
- package/dist/src/ButtonWithDropdown/ButtonWithDropdown.d.ts +1 -0
- package/dist/src/ButtonWithDropdown/ButtonWithDropdown.types.d.ts +14 -21
- package/dist/src/Icon/Icon.types.d.ts +1 -1
- package/dist/src/SvgIcon/SvgIcon.types.d.ts +1 -1
- package/dist/src/ToolbarButton/ToolbarButton.types.d.ts +1 -1
- package/dist/src/Tooltip/Tooltip.types.d.ts +2 -2
- package/dist/src/TriggerWithDropdown/TriggerWithDropdown.d.ts +4 -0
- package/dist/src/TriggerWithDropdown/TriggerWithDropdown.types.d.ts +102 -0
- package/dist/src/TriggerWithDropdown/index.d.ts +1 -0
- package/dist/src/index.d.ts +2 -0
- package/dist/src/test-utils/is-browser-mode.d.ts +10 -0
- package/dist/src/types.d.ts +1 -0
- package/dist/styles.css +231 -12
- package/package.json +21 -12
- package/dist/src/Accordion/Accordion.stories.d.ts +0 -5
- package/dist/src/Accordion/Accordion.test.d.ts +0 -1
- package/dist/src/Alert/Alert.stories.d.ts +0 -14
- package/dist/src/Alert/Alert.test.d.ts +0 -1
- package/dist/src/Button/Button.stories.d.ts +0 -9
- package/dist/src/Button/Button.test.d.ts +0 -1
- package/dist/src/ButtonGroup/ButtonGroup.stories.d.ts +0 -5
- package/dist/src/ButtonGroup/ButtonGroup.test.d.ts +0 -1
- package/dist/src/ButtonWithDropdown/ButtonWithDropdown.stories.d.ts +0 -5
- package/dist/src/ButtonWithDropdown/ButtonWithDropdown.test.d.ts +0 -1
- package/dist/src/ButtonWithPopover/ButtonWithPopover.stories.d.ts +0 -5
- package/dist/src/ButtonWithPopover/ButtonWithPopover.test.d.ts +0 -1
- package/dist/src/Carousel/Carousel.stories.d.ts +0 -5
- package/dist/src/Carousel/Carousel.test.d.ts +0 -1
- package/dist/src/Checkbox/Checkbox.stories.d.ts +0 -5
- package/dist/src/Checkbox/Checkbox.test.d.ts +0 -1
- package/dist/src/Collapse/Collapse.stories.d.ts +0 -5
- package/dist/src/Collapse/Collapse.test.d.ts +0 -1
- package/dist/src/Icon/Icon.stories.d.ts +0 -5
- package/dist/src/Icon/Icon.test.d.ts +0 -1
- package/dist/src/InputGroup/InputGroup.stories.d.ts +0 -5
- package/dist/src/InputGroup/InputGroup.test.d.ts +0 -1
- package/dist/src/Modal/Modal.stories.d.ts +0 -10
- package/dist/src/Modal/Modal.test.d.ts +0 -1
- package/dist/src/ProgressBar/ProgressBar.stories.d.ts +0 -5
- package/dist/src/ProgressBar/ProgressBar.test.d.ts +0 -1
- package/dist/src/SeeqActionDropdown/SeeqActionDropdown.stories.d.ts +0 -5
- package/dist/src/SeeqActionDropdown/SeeqActionDropdown.test.d.ts +0 -1
- package/dist/src/Select/Select.stories.d.ts +0 -5
- package/dist/src/Select/Select.test.d.ts +0 -1
- package/dist/src/Slider/Slider.stories.d.ts +0 -5
- package/dist/src/Slider/Slider.test.d.ts +0 -1
- package/dist/src/SvgIcon/SvgIcon.stories.d.ts +0 -5
- package/dist/src/SvgIcon/SvgIcon.test.d.ts +0 -1
- package/dist/src/Tabs/Tabs.stories.d.ts +0 -5
- package/dist/src/Tabs/Tabs.test.d.ts +0 -1
- package/dist/src/TextArea/TextArea.stories.d.ts +0 -5
- package/dist/src/TextArea/TextArea.test.d.ts +0 -1
- package/dist/src/TextField/TextField.stories.d.ts +0 -5
- package/dist/src/TextField/TextField.test.d.ts +0 -1
- package/dist/src/ToolbarButton/ToolbarButton.stories.d.ts +0 -5
- package/dist/src/ToolbarButton/ToolbarButton.test.d.ts +0 -1
- package/dist/src/Tooltip/QTip.stories.d.ts +0 -6
- package/dist/src/Tooltip/QTipPerformance.stories.d.ts +0 -5
- package/dist/src/Tooltip/Tooltip.stories.d.ts +0 -5
- package/dist/src/Tooltip/TooltipPerformance.stories.d.ts +0 -5
- package/dist/src/setupTests.d.ts +0 -1
- package/dist/src/utils/validateStyleDimension.test.d.ts +0 -1
package/dist/index.js
CHANGED
|
@@ -52,7 +52,7 @@ const browserName = browserId && browserId.split(' ', 2)[0];
|
|
|
52
52
|
browserId && parseInt(browserId.split(' ', 2)[1], 10);
|
|
53
53
|
const browserIsFirefox = browserId && browserName === 'Firefox';
|
|
54
54
|
|
|
55
|
-
const DEFAULT_TOOL_TIP_DELAY = 500;
|
|
55
|
+
const DEFAULT_TOOL_TIP_DELAY = process.env.NODE_ENV === 'test' ? 10 : 500;
|
|
56
56
|
const tooltipPositions = ['top', 'left', 'right', 'bottom'];
|
|
57
57
|
|
|
58
58
|
const getQTipData = ({ tooltip, tooltipPlacement, isHtmlTooltip, tooltipTestId, tooltipDelay = DEFAULT_TOOL_TIP_DELAY, }) => tooltip
|
|
@@ -122,8 +122,8 @@ const Icon = ({ onClick, icon, iconPrefix = undefined, type = 'theme', extraClas
|
|
|
122
122
|
* - use "variant" to achieve the desired style
|
|
123
123
|
* - include tooltips and/or icons
|
|
124
124
|
*/
|
|
125
|
-
const Button = ({ onClick, label, variant = 'outline', type = 'button', size = 'sm', disabled, extraClassNames, id, testId, stopPropagation = true, tooltip, tooltipOptions, iconStyle = 'text', icon, iconColor, iconPosition = 'left', iconPrefix = undefined, preventBlur = false, isHtmlTooltip = false, tooltipTestId, }) => {
|
|
126
|
-
const baseClasses = 'tw:px-2.5 tw:rounded-md tw:focus:ring-0 tw:focus-visible:outline-none tw:aria-disabled:cursor-not-allowed tw:disabled:pointer-events-none';
|
|
125
|
+
const Button = ({ onClick, label, variant = 'outline', type = 'button', size = 'sm', disabled, extraClassNames, id, testId, stopPropagation = true, tooltip, tooltipOptions, iconStyle = 'text', icon, iconColor, iconPosition = 'left', iconPrefix = undefined, preventBlur = false, isHtmlTooltip = false, tooltipTestId, ref, ...rest }) => {
|
|
126
|
+
const baseClasses = 'tw:px-2.5 tw:rounded-md tw:focus:ring-0 tw:focus-visible:outline-none tw:hover:cursor-pointer tw:aria-disabled:cursor-not-allowed tw:disabled:pointer-events-none';
|
|
127
127
|
const baseClassesByVariant = {
|
|
128
128
|
'outline': 'tw:disabled:opacity-50 tw:aria-disabled:opacity-50 tw:border-solid tw:border',
|
|
129
129
|
'theme': 'tw:disabled:opacity-50 tw:aria-disabled:opacity-50 tw:border-solid tw:border',
|
|
@@ -154,7 +154,7 @@ const Button = ({ onClick, label, variant = 'outline', type = 'button', size = '
|
|
|
154
154
|
'outline': 'tw:bg-white tw:border-sq-disabled-gray',
|
|
155
155
|
'theme': 'tw:bg-sq-theme-dark tw:border-sq-theme-dark',
|
|
156
156
|
'danger': '',
|
|
157
|
-
'theme-light': 'tw:bg-sq-theme-icon',
|
|
157
|
+
'theme-light': 'tw:bg-sq-theme-icon tw:border-sq-theme-icon',
|
|
158
158
|
'no-border': '',
|
|
159
159
|
'warning': '',
|
|
160
160
|
};
|
|
@@ -169,20 +169,28 @@ const Button = ({ onClick, label, variant = 'outline', type = 'button', size = '
|
|
|
169
169
|
const activeClassesByVariantLightTheme = {
|
|
170
170
|
'outline': 'tw:hover:bg-sq-light-gray tw:focus:bg-sq-dark-gray tw:active:bg-sq-dark-gray tw:focus:border-sq-theme-dark' +
|
|
171
171
|
' tw:active:border-sq-theme-dark',
|
|
172
|
-
'theme': 'tw:hover:bg-sq-theme-highlight tw:hover:border-sq-theme-highlight'
|
|
173
|
-
|
|
174
|
-
'
|
|
175
|
-
|
|
176
|
-
'
|
|
172
|
+
'theme': 'tw:hover:bg-sq-theme-highlight tw:hover:border-sq-theme-highlight tw:focus:bg-sq-theme-darker ' +
|
|
173
|
+
'tw:focus:border-sq-theme-darker tw:active:bg-sq-theme-darker tw:active:border-sq-theme-darker',
|
|
174
|
+
'danger': 'tw:hover:bg-sq-danger-hover tw:hover:border-sq-danger-hover tw:focus:bg-sq-danger-hover ' +
|
|
175
|
+
'tw:focus:border-sq-danger-hover tw:active:bg-sq-danger tw:active:border-sq-danger',
|
|
176
|
+
'theme-light': 'tw:hover:bg-sq-theme-link tw:hover:border-sq-theme-link tw:focus:bg-sq-theme-darker tw:focus:border-sq-theme-darker ' +
|
|
177
|
+
'tw:active:bg-sq-theme-darker tw:active:border-sq-theme-darker',
|
|
178
|
+
'no-border': 'tw:hover:bg-sq-light-gray tw:focus:bg-sq-light-gray tw:active:bg-sq-light-gray',
|
|
179
|
+
'warning': 'tw:hover:bg-sq-warning-hover tw:hover:border-sq-warning-hover tw:focus:bg-sq-warning-hover ' +
|
|
180
|
+
'tw:focus:border-sq-warning-hover tw:active:bg-sq-warning tw:active:border-sq-warning',
|
|
177
181
|
};
|
|
178
182
|
const activeClassesByVariantDarkTheme = {
|
|
179
183
|
'outline': 'tw:dark:hover:bg-sq-highlight-color-dark tw:dark:focus:bg-sq-multi-gray-dark' +
|
|
180
184
|
' tw:dark:active:bg-sq-multi-gray-dark tw:dark:focus:border-sq-theme-dark tw:dark:active:border-sq-theme-dark',
|
|
181
|
-
'theme': 'tw:dark:hover:bg-sq-theme-highlight tw:dark:hover:border-sq-theme-highlight'
|
|
182
|
-
|
|
183
|
-
'
|
|
184
|
-
|
|
185
|
-
'
|
|
185
|
+
'theme': 'tw:dark:hover:bg-sq-theme-highlight tw:dark:hover:border-sq-theme-highlight tw:dark:focus:bg-sq-theme-darker ' +
|
|
186
|
+
'tw:dark:focus:border-sq-theme-darker tw:dark:active:bg-sq-theme-darker tw:dark:active:border-sq-theme-darker',
|
|
187
|
+
'danger': 'tw:dark:hover:bg-sq-danger-hover tw:dark:hover:border-sq-danger-hover tw:dark:focus:bg-sq-danger-hover ' +
|
|
188
|
+
'tw:dark:focus:border-sq-danger-hover tw:dark:active:bg-sq-danger tw:dark:active:border-sq-danger',
|
|
189
|
+
'theme-light': 'tw:dark:hover:bg-sq-theme-link tw:dark:hover:border-sq-theme-link tw:dark:focus:bg-sq-theme-darker ' +
|
|
190
|
+
'tw:dark:focus:border-sq-theme-darker tw:dark:active:bg-sq-theme-darker tw:dark:active:border-sq-theme-darker',
|
|
191
|
+
'no-border': 'tw:dark:hover:bg-sq-highlight-color-dark tw:dark:focus:bg-sq-highlight-color-dark tw:dark:active:bg-sq-highlight-color-dark',
|
|
192
|
+
'warning': 'tw:dark:hover:bg-sq-warning-hover tw:dark:hover:border-sq-warning-hover tw:dark:focus:bg-sq-warning-hover ' +
|
|
193
|
+
'tw:dark:focus:border-sq-warning-hover tw:dark:active:bg-sq-warning tw:dark:active:border-sq-warning',
|
|
186
194
|
};
|
|
187
195
|
const sizeClasses = {
|
|
188
196
|
xs: 'tw:text-xs tw:py-0.5',
|
|
@@ -207,7 +215,7 @@ const Button = ({ onClick, label, variant = 'outline', type = 'button', size = '
|
|
|
207
215
|
const iconElement = icon && (jsxRuntime.jsx(Icon, { icon: icon, iconPrefix: iconPrefix, type: iconStyle, color: iconColor, extraClassNames: label
|
|
208
216
|
? `${iconClass} ${textClassesByVariantLightTheme[variant]} ${textClassesByVariantDarkTheme[variant]}`
|
|
209
217
|
: '', testId: `${id}_spinner` }));
|
|
210
|
-
return (jsxRuntime.jsxs("button", { id: id, ...tooltipData, disabled: disabled && !tooltip, "aria-disabled": disabled, "data-testid": testId, tabIndex: disabled ? -1 : undefined, type: type === 'link' || (type === 'submit' && browserIsFirefox) ? 'button' : type, onClick: (e) => {
|
|
218
|
+
return (jsxRuntime.jsxs("button", { ...rest, ref: ref, id: id, ...tooltipData, disabled: disabled && !tooltip, "aria-disabled": disabled, "data-testid": testId, tabIndex: disabled ? -1 : undefined, type: type === 'link' || (type === 'submit' && browserIsFirefox) ? 'button' : type, onClick: (e) => {
|
|
211
219
|
stopPropagation && e.stopPropagation();
|
|
212
220
|
if (!disabled) {
|
|
213
221
|
onClick?.(e);
|
|
@@ -14177,8 +14185,7 @@ const Select = ({ options, value, placeholder = 'select', noOptionsMessage = 'no
|
|
|
14177
14185
|
},
|
|
14178
14186
|
placeholder: () => placeholderStyles,
|
|
14179
14187
|
container: ({ selectProps }) => {
|
|
14180
|
-
|
|
14181
|
-
return `${textStyles} ${extraClassNames} ${containerBorderStyles} tw:pointer-events-auto!`;
|
|
14188
|
+
return `${textStyles} ${extraClassNames} tw:pointer-events-auto!`;
|
|
14182
14189
|
},
|
|
14183
14190
|
input: () => textStyles + ' specSelectInput',
|
|
14184
14191
|
menuList: () => menuListStyles,
|
|
@@ -14635,7 +14642,7 @@ const Modal = ({ titleIcon, title = 'Modal title example', titleSuffixLabel, sub
|
|
|
14635
14642
|
titleIconElement = jsxRuntime.jsx("div", { className: "tw:mt-1.5", children: titleIcon });
|
|
14636
14643
|
}
|
|
14637
14644
|
}
|
|
14638
|
-
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [titleIcon && titleIconPosition === 'left' ? jsxRuntime.jsx("div", { className: "tw:flex tw:mr-2", children: titleIconElement }) : jsxRuntime.jsx(jsxRuntime.Fragment, {}), jsxRuntime.jsx(DialogTitle, { asChild: true, children: isTitleEditable ? (jsxRuntime.jsxs("div", { className: "tw:flex tw:w-full tw:items-center", children: [jsxRuntime.jsx(TextField, { extraClassNames: inputExtraClassNames, value: title, type: "text", testId: "modalTitle", onChange: onTitleChanged, placeholder: titlePlaceholder, required: titleRequired, showError: !!titleError }), titleError && jsxRuntime.jsx("p", { className: "tw:text-sq-danger tw:min-w-fit tw:pl-2 tw:mb-0", children: titleError })] })) : (customHeader ?? (jsxRuntime.jsxs("div", { "data-testid": "modalTitle", className: "modal-title", children: [jsxRuntime.jsxs("div", { className: "tw:flex tw:items-center", children: [jsxRuntime.jsx("h3", { children: title }), titleSuffixLabel && jsxRuntime.jsx("span", { className: "tw:text-xl tw:pl-0.5", children: titleSuffixLabel })] }), subtitle && (jsxRuntime.jsx("div", { className: "tw:italic tw:text-sm tw:text-left tw:mt-1", "data-testid": "modal-subtitle", children: subtitle }))] }))) }), titleIcon && titleIconPosition === 'right' ? jsxRuntime.jsx("div", { className: "tw:flex tw:ml-4", children: titleIconElement }) : jsxRuntime.jsx(jsxRuntime.Fragment, {})] }));
|
|
14645
|
+
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [titleIcon && titleIconPosition === 'left' ? jsxRuntime.jsx("div", { className: "tw:flex tw:mr-2", children: titleIconElement }) : jsxRuntime.jsx(jsxRuntime.Fragment, {}), jsxRuntime.jsx(DialogTitle, { asChild: true, children: isTitleEditable ? (jsxRuntime.jsxs("div", { className: "tw:flex tw:w-full tw:items-center", children: [jsxRuntime.jsx(TextField, { extraClassNames: inputExtraClassNames, value: title, type: "text", testId: "modalTitle", onChange: onTitleChanged, placeholder: titlePlaceholder, required: titleRequired, showError: !!titleError }), titleError && jsxRuntime.jsx("p", { className: "tw:text-sq-danger tw:min-w-fit tw:pl-2 tw:mb-0", children: titleError })] })) : ((customHeader ?? (jsxRuntime.jsxs("div", { "data-testid": "modalTitle", className: "modal-title", children: [jsxRuntime.jsxs("div", { className: "tw:flex tw:items-center", children: [jsxRuntime.jsx("h3", { children: title }), titleSuffixLabel && jsxRuntime.jsx("span", { className: "tw:text-xl tw:pl-0.5", children: titleSuffixLabel })] }), subtitle && (jsxRuntime.jsx("div", { className: "tw:italic tw:text-sm tw:text-left tw:mt-1", "data-testid": "modal-subtitle", children: subtitle }))] })))) }), titleIcon && titleIconPosition === 'right' ? jsxRuntime.jsx("div", { className: "tw:flex tw:ml-4", children: titleIconElement }) : jsxRuntime.jsx(jsxRuntime.Fragment, {})] }));
|
|
14639
14646
|
};
|
|
14640
14647
|
return open ? (jsxRuntime.jsx(Dialog, { open: true, onOpenChange: onClose, modal: keepFocusInsideModal, children: jsxRuntime.jsxs(DialogContent, { onPointerDownOutside: (e) => (onPointerDownOutside ? onPointerDownOutside(e) : e.preventDefault()), onInteractOutside: (e) => (onInteractOutside ? onInteractOutside(e) : e.preventDefault()), "data-testid": testId, "aria-describedby": ariaDescribedBy, className: classNames(`modalContent tw:w-full tw:border-none tw:shadow-none tw:dark:text-sq-dark-text tw:gap-0!`, {
|
|
14641
14648
|
'tw:max-w-xs': size === 'xs',
|
|
@@ -16668,18 +16675,23 @@ const borderStyles$1 = [
|
|
|
16668
16675
|
'tw:dark:border-gray-500',
|
|
16669
16676
|
].join(' ');
|
|
16670
16677
|
const bgStyles$1 = ['tw:bg-sq-white', 'tw:dark:bg-sq-dark-background'].join(' ');
|
|
16671
|
-
const
|
|
16672
|
-
const
|
|
16673
|
-
|
|
16674
|
-
|
|
16678
|
+
const ButtonWithDropdown = (props) => {
|
|
16679
|
+
const { label, variant = 'outline', size = 'sm', icon, iconStyle = 'text', iconColor, iconPosition = 'left', iconPrefix, extraClassNames = '', testId, id, disabled = false, ...tooltipProps } = props;
|
|
16680
|
+
return (jsxRuntime.jsx(Dropdown, { ...props, children: jsxRuntime.jsx(Trigger, { asChild: true, id: id, disabled: disabled, children: jsxRuntime.jsx(Button, { label: label, variant: variant, size: size, icon: icon, iconStyle: iconStyle, iconColor: iconColor, iconPosition: iconPosition, iconPrefix: iconPrefix, extraClassNames: extraClassNames, testId: testId, disabled: disabled, tooltip: tooltipProps.tooltip, tooltipOptions: {
|
|
16681
|
+
delay: tooltipProps.tooltipDelay,
|
|
16682
|
+
position: tooltipProps.tooltipPlacement,
|
|
16683
|
+
} }) }) }));
|
|
16684
|
+
};
|
|
16685
|
+
const Dropdown = ({ dropdownItems, id, children, contentExtraClassNames = '', containerTestId, align = 'end', placement = 'bottom', placementOffset = 5, alignOffset = -35, hasArrow = false, onOpenChange, isOpen, setFocusOnTriggerOnClose = true, keepFocusInsideDropdown = true, onContainerClick, }) => {
|
|
16686
|
+
return (jsxRuntime.jsxs(Root2, { defaultOpen: false, open: isOpen, onOpenChange: onOpenChange, modal: keepFocusInsideDropdown, children: [children, jsxRuntime.jsx(Portal2, { children: jsxRuntime.jsx(Content2, { onClick: onContainerClick, sideOffset: placementOffset, side: placement, align: align, alignOffset: alignOffset, asChild: true, onCloseAutoFocus: (e) => !setFocusOnTriggerOnClose && e.preventDefault(), className: "tw:focus-visible:outline-none tw:outline-none", children: jsxRuntime.jsxs("div", { "data-testid": containerTestId, className: `${bgStyles$1} tw:relative tw:z-[1200] tw:min-w-6 tw:py-2 tw:focus-visible:outline-none tw:outline-none tw:data-[state=open]:animate-in tw:data-[state=closed]:animate-out forceFont tw:data-[side=top]:animate-slideDownAndFade tw:data-[side=right]:animate-slideLeftAndFade tw:data-[side=bottom]:animate-slideUpAndFade tw:data-[side=left]:animate-slideRightAndFade ${borderStyles$1} ${contentExtraClassNames}`, children: [hasArrow && (jsxRuntime.jsx(Arrow2, { asChild: true, children: jsxRuntime.jsx("div", { className: "tw:fill-transparent tw:bg-sq-white tw:w-sq-15 tw:h-sq-15 tw:rotate-45 tw:dark:bg-sq-dark-background tw:border-b tw:border-r tw:border-sq-disabled-gray tw:dark:border-gray-500 tw:-mt-sq-7" }) })), dropdownItems.map((item, index) => {
|
|
16675
16687
|
const tooltipData = getQTipData(item);
|
|
16676
16688
|
if (item.isLabel) {
|
|
16677
16689
|
return (jsxRuntime.jsxs(Label2, { className: item.itemExtraClassNames, ...tooltipData, children: [item.icon && (jsxRuntime.jsx(Icon, { icon: item.icon, testId: item.iconTestId, type: "text", color: item.iconColor, extraClassNames: "tw:text-sq-text-color tw:dark:text-sq-white tw:w-4.5" })), jsxRuntime.jsx("div", { "data-testid": item.labelTestId, className: `tw:text-sq-13 tw:ml-1 ${item.disabled ? 'tw:text-sq-disabled-gray' : 'tw:text-sq-text-color tw:dark:text-sq-white'} tw:not-italic tw:font-normal ${item.labelClasses}`, children: item.label })] }, (item.id || '') + index));
|
|
16678
16690
|
}
|
|
16679
16691
|
if (Array.isArray(item.subMenuItems) && item.subMenuItems.length > 0) {
|
|
16680
|
-
return (jsxRuntime.jsxs(Sub2, { children: [jsxRuntime.jsxs(SubTrigger2, { id: id, className: `tw:cursor-pointer tw:flex tw:justify-between tw:dark:text-sq-white tw:hover:bg-sq-gray-highlight tw:dark:hover:bg-sq-gray-highlight-dark tw:leading-none tw:items-center tw:h-sq-27 tw:pl-sq-19 tw:relative tw:select-none tw:outline-none tw:data-disabled:pointer-events-none ${item.itemExtraClassNames || ''}`, "data-testid": item.testId, disabled: item.disabled, ...tooltipData, children: [jsxRuntime.jsxs("div", { className: "tw:flex", children: [item.icon && (jsxRuntime.jsx(Icon, { icon: item.icon, extraClassNames: `tw:w-4.5 ${item.disabled
|
|
16681
|
-
|
|
16682
|
-
|
|
16692
|
+
return (jsxRuntime.jsxs(Sub2, { children: [jsxRuntime.jsxs(SubTrigger2, { id: id, className: `tw:cursor-pointer tw:flex tw:justify-between tw:dark:text-sq-white tw:hover:bg-sq-gray-highlight tw:dark:hover:bg-sq-gray-highlight-dark tw:leading-none tw:items-center tw:h-sq-27 tw:pl-sq-19 tw:relative tw:select-none tw:outline-none tw:data-disabled:pointer-events-none ${item.itemExtraClassNames || ''}`, "data-testid": item.testId, disabled: item.disabled, ...tooltipData, children: [jsxRuntime.jsxs("div", { className: "tw:flex", children: [item.icon && (jsxRuntime.jsx("div", { className: "tw:min-w-5", children: jsxRuntime.jsx(Icon, { icon: item.icon, extraClassNames: `tw:w-4.5 ${item.disabled
|
|
16693
|
+
? 'tw:text-sq-disabled-gray!'
|
|
16694
|
+
: 'tw:text-sq-text-color tw:dark:text-sq-white'} ${item.iconExtraClassNames || ''}` }) })), jsxRuntime.jsx("div", { "data-testid": item.labelTestId, "data-customid": item.labelCustomId, className: `tw:text-sq-13 tw:ml-1 ${item.disabled && 'tw:opacity-30!'} tw:not-italic tw:font-semibold ${item.labelClasses}`, children: item.label })] }), jsxRuntime.jsx("div", { className: "tw:flex tw:justify-center tw:items-center", children: jsxRuntime.jsx(Icon, { size: "sm", icon: "fc-arrow-dropdown tw:rotate-270", extraClassNames: `${item.disabled ? 'tw:text-sq-disabled-gray' : 'tw:text-sq-text-color tw:dark:text-sq-white'} tw:ml-4 tw:mr-2 tw:text-2` }) })] }), jsxRuntime.jsx(Portal2, { children: jsxRuntime.jsx(SubContent2, { className: "tw:focus-visible:outline-none tw:outline-none", children: jsxRuntime.jsx("div", { "data-testid": containerTestId, className: `${bgStyles$1} tw:relative tw:z-[1000] tw:min-w-6 tw:py-2 tw:focus-visible:outline-none tw:outline-none tw:data-[state=open]:animate-in tw:data-[state=closed]:animate-out forceFont tw:data-[side=top]:animate-slideDownAndFade tw:data-[side=right]:animate-slideLeftAndFade tw:data-[side=bottom]:animate-slideUpAndFade tw:data-[side=left]:animate-slideRightAndFade ${borderStyles$1}`, children: item.subMenuItems.map((subItem, subIndex) => {
|
|
16683
16695
|
return (jsxRuntime.jsxs(Item2, { onSelect: subItem.onClick, "data-qtip-text": subItem.tooltip, className: "tw:cursor-pointer tw:flex tw:dark:text-sq-white tw:hover:bg-sq-gray-highlight tw:dark:hover:bg-sq-gray-highlight-dark tw:leading-none tw:items-center tw:h-sq-27 tw:px-sq-19 tw:relative tw:select-none tw:outline-none tw:data-disabled:pointer-events-none", disabled: subItem.disabled, children: [subItem.iconClass && (jsxRuntime.jsx(Icon, { icon: subItem.iconClass, type: "text", extraClassNames: `tw:w-4.5 ${item.disabled && 'tw:opacity-30!'}` })), jsxRuntime.jsx("div", { className: `tw:text-sq-13 tw:ml-1 ${subItem.disabled
|
|
16684
16696
|
? 'tw:text-sq-disabled-gray'
|
|
16685
16697
|
: 'tw:text-sq-text-color tw:dark:text-sq-white'} tw:not-italic tw:font-normal ${item.labelClasses}`, children: subItem.label })] }, subItem.label + subIndex));
|
|
@@ -16687,10 +16699,17 @@ const ButtonWithDropdown = ({ dropdownItems, triggerIcon, id, extraClassNames =
|
|
|
16687
16699
|
}
|
|
16688
16700
|
return (jsxRuntime.jsxs("div", { ...tooltipData, children: [jsxRuntime.jsxs(Item2, { "data-customid": item.itemCustomId, onSelect: (e) => {
|
|
16689
16701
|
item.onClick(e);
|
|
16690
|
-
}, className: `tw:cursor-pointer tw:flex tw:dark:text-sq-white tw:hover:bg-sq-gray-highlight tw:dark:hover:bg-sq-gray-highlight-dark tw:leading-none tw:items-center tw:min-h-sq-27 tw:px-sq-19 tw:relative tw:select-none tw:outline-none tw:data-disabled:pointer-events-none ${item.itemExtraClassNames || ''}`, "data-testid": item.testId, disabled: item.disabled, children: [item.icon && (jsxRuntime.jsx(Icon, { icon: item.icon, testId: item.iconTestId, type: (item.iconType || 'text'), color: item.iconColor, customId: item.iconCustomId, extraClassNames: `tw:w-sq-4.5 ${item.disabled && 'tw:opacity-30!'} ${item.iconExtraClassNames || ''}` })), jsxRuntime.jsx("div", { "data-testid": item.labelTestId, "data-customid": item.labelCustomId, className: `tw:text-sq-13 tw:ml-1 ${item.disabled ? 'tw:text-sq-disabled-gray' : 'tw:text-sq-text-color tw:dark:text-sq-white'} tw:not-italic tw:font-normal ${item.labelClasses || ''}`, children: item.label })] }, (item.id || item.icon || '') + index), item.hasDivider && (jsxRuntime.jsx(Separator2, { "data-testid": `dropdown-divider-${index}`, className: "tw:h-px tw:bg-sq-disabled-gray tw:dark:bg-gray-500 tw:my-2" }))] }, (item.id || '') + index));
|
|
16702
|
+
}, className: `tw:cursor-pointer tw:flex tw:dark:text-sq-white tw:hover:bg-sq-gray-highlight tw:dark:hover:bg-sq-gray-highlight-dark tw:leading-none tw:items-center tw:min-h-sq-27 tw:px-sq-19 tw:relative tw:select-none tw:outline-none tw:data-disabled:pointer-events-none ${item.itemExtraClassNames || ''}`, "data-testid": item.testId, disabled: item.disabled, children: [item.icon && (jsxRuntime.jsx("div", { className: "tw:min-w-5", children: jsxRuntime.jsx(Icon, { icon: item.icon, testId: item.iconTestId, type: (item.iconType || 'text'), color: item.iconColor, customId: item.iconCustomId, extraClassNames: `tw:w-sq-4.5 ${item.disabled && 'tw:opacity-30!'} ${item.iconExtraClassNames || ''}` }) })), jsxRuntime.jsx("div", { "data-testid": item.labelTestId, "data-customid": item.labelCustomId, className: `tw:text-sq-13 tw:ml-1 ${item.disabled ? 'tw:text-sq-disabled-gray' : 'tw:text-sq-text-color tw:dark:text-sq-white'} tw:not-italic tw:font-normal ${item.labelClasses || ''}`, children: item.label })] }, (item.id || item.icon || '') + index), item.hasDivider && (jsxRuntime.jsx(Separator2, { "data-testid": `dropdown-divider-${index}`, className: "tw:h-px tw:bg-sq-disabled-gray tw:dark:bg-gray-500 tw:my-2" }))] }, (item.id || '') + index));
|
|
16691
16703
|
})] }) }) })] }));
|
|
16692
16704
|
};
|
|
16693
16705
|
|
|
16706
|
+
const disabledClasses$1 = ['tw:opacity-50', 'tw:cursor-not-allowed'].join(' ');
|
|
16707
|
+
const TriggerWithDropdown = (props) => {
|
|
16708
|
+
const { triggerIcon, id, extraClassNames = '', disabled = false, ...tooltipProps } = props;
|
|
16709
|
+
const tooltipData = getQTipData(tooltipProps);
|
|
16710
|
+
return (jsxRuntime.jsx(Dropdown, { ...props, children: jsxRuntime.jsx(Trigger, { id: id, className: `tw:bg-transparent tw:border-none tw:focus-visible:outline-none tw:focus:outline-none tw:focus-within:outline-none`, disabled: disabled, children: jsxRuntime.jsx("div", { ...tooltipData, className: `tw:bg-transparent tw:flex tw:flex-col tw:items-center tw:focus-visible:outline-none tw:focus:outline-none tw:focus-within:outline-none ${disabled ? disabledClasses$1 : ''} ${extraClassNames}`, children: triggerIcon }) }) }));
|
|
16711
|
+
};
|
|
16712
|
+
|
|
16694
16713
|
const baseClasses$2 = 'tw:mx-auto tw:leading-normal tw:outline-none tw:py-2 tw:px-3 tw:rounded-[10px] tw:w-full tw:relative' +
|
|
16695
16714
|
' tw:border-solid tw:border tw:text-sm tw:flex tw:flex-col tw:justify-center tw:items-center';
|
|
16696
16715
|
const darkTheme$1 = 'tw:dark:bg-sq-theme-hover-dark tw:dark:text-sq-text-color-dark';
|
|
@@ -16807,20 +16826,30 @@ const borderColorClasses = [
|
|
|
16807
16826
|
'tw:focus:border-sq-theme-dark',
|
|
16808
16827
|
'tw:active:border-sq-theme-dark',
|
|
16809
16828
|
].join(' ');
|
|
16810
|
-
const
|
|
16811
|
-
const fieldClasses = 'tw:leading-normal tw:outline-none tw:py-1 tw:px-3' + 'tw:p-1 tw:border-solid tw:border';
|
|
16829
|
+
const fieldClasses = 'tw:leading-normal tw:outline-none tw:py-1 tw:px-3 tw:p-1 tw:border-solid tw:border';
|
|
16812
16830
|
const darkTheme = 'tw:dark:bg-sq-dark-background tw:dark:text-sq-dark-text tw:disabled:dark:text-sq-disabled-gray';
|
|
16813
16831
|
const lightTheme = 'tw:text-sq-text-color tw:disabled:text-sq-darkish-gray';
|
|
16814
16832
|
/**
|
|
16815
16833
|
* InputGroup.
|
|
16816
16834
|
*/
|
|
16817
16835
|
const InputGroup = React.forwardRef((props, ref) => {
|
|
16818
|
-
const { readonly = false, onChange, onKeyUp, onFocus, onBlur, onKeyDown, name, value, placeholder, append = [], extraClassNames = '', id, testId, showError, required, autoComplete, autoFocus, disabled, type, step, min, max, field, maxLength, minLength, ...tooltipProps } = props;
|
|
16836
|
+
const { readonly = false, onChange, onKeyUp, onFocus, onBlur, onKeyDown, name, value, placeholder, append = [], extraClassNames = '', id, testId, showError, required, autoComplete, autoFocus, disabled, type, step, min, max, field, maxLength, minLength, inputGroup, ...tooltipProps } = props;
|
|
16819
16837
|
const tooltipData = getQTipData(tooltipProps);
|
|
16820
16838
|
const appliedClasses = `${baseClasses$1} ${extraClassNames}`;
|
|
16821
|
-
const fieldAppliedClasses = `${fieldClasses} ${extraClassNames} ${lightTheme} ${darkTheme} ${fieldBorderRadius} ${showError ? errorClasses : borderColorClasses} `;
|
|
16822
16839
|
const elementsToAppend = append.filter(Boolean);
|
|
16823
|
-
|
|
16840
|
+
const effectiveInputGroup = inputGroup ?? (elementsToAppend.length > 0 ? 'left' : undefined);
|
|
16841
|
+
const fieldBorderRadius = effectiveInputGroup === 'left'
|
|
16842
|
+
? 'tw:rounded-l-md tw:rounded-r-none'
|
|
16843
|
+
: effectiveInputGroup === 'right'
|
|
16844
|
+
? 'tw:rounded-r-md tw:rounded-l-none'
|
|
16845
|
+
: 'tw:rounded-md';
|
|
16846
|
+
const fieldAppliedClasses = `${fieldClasses} ${extraClassNames} ${lightTheme} ${darkTheme} ${fieldBorderRadius} ${showError ? errorClasses : borderColorClasses} `;
|
|
16847
|
+
// Only pass inputGroup to React components (not DOM elements like div, span, etc.)
|
|
16848
|
+
const isReactComponent = React.isValidElement(field) && typeof field.type !== 'string';
|
|
16849
|
+
const fieldWithInputGroup = isReactComponent
|
|
16850
|
+
? React.cloneElement(field, { inputGroup: effectiveInputGroup })
|
|
16851
|
+
: field;
|
|
16852
|
+
return (jsxRuntime.jsxs("div", { id: `input-group-${id}`, className: appliedClasses, children: [field ? (jsxRuntime.jsx("div", { "data-testid": testId, className: `tw:flex tw:flex-1 tw:cursor-pointer tw:active:z-50 ${fieldAppliedClasses}`, children: fieldWithInputGroup })) : (jsxRuntime.jsx(TextField, { testId: testId, readonly: readonly, onChange: onChange, onKeyUp: onKeyUp, onFocus: onFocus, onBlur: onBlur, onKeyDown: onKeyDown, name: name, ref: ref, showError: showError, value: value, required: required, placeholder: placeholder, autoComplete: autoComplete, autoFocus: autoFocus, id: id, type: type, disabled: disabled, step: step, min: min, max: max, maxLength: maxLength, minLength: minLength, inputGroup: effectiveInputGroup, extraClassNames: `tw:flex tw:flex-1 tw:w-full tw:focus:z-30 ${extraClassNames}`, ...tooltipData })), elementsToAppend.map((item, index) => {
|
|
16824
16853
|
return item?.variant === 'button' ? (jsxRuntime.jsx(Button, { extraClassNames: `$
|
|
16825
16854
|
index ? 'tw:-ml-px' : 'tw:ml-0'
|
|
16826
16855
|
} tw:focus:z-40 tw:focus:border tw:rounded-none tw:last:rounded-r-md`, ...item.buttonProps }, index)) : (jsxRuntime.jsx("div", { className: `${borderColorClasses} ${index ? 'tw:-ml-px' : 'tw:ml-0'} tw:flex tw:items-center tw:justify-center tw:rounded-none tw:last:rounded-r-md tw:active:z-30 tw:active:border tw:border`, children: item?.element }, index));
|
|
@@ -29191,14 +29220,19 @@ var tinycolor$1 = {exports: {}};
|
|
|
29191
29220
|
var tinycolorExports = tinycolor$1.exports;
|
|
29192
29221
|
var tinycolor = /*@__PURE__*/getDefaultExportFromCjs(tinycolorExports);
|
|
29193
29222
|
|
|
29223
|
+
const PROGRESS_BAR_ANIMATION_CONFIG = {
|
|
29224
|
+
duration: 660,
|
|
29225
|
+
easing: 'ease-in-out',
|
|
29226
|
+
fill: 'forwards',
|
|
29227
|
+
};
|
|
29194
29228
|
const baseLabelClasses = 'tw:left-1 tw:text-xs tw:text-sq-text-color tw:dark:text-sq-dark-text tw:items-center tw:h-4.5';
|
|
29195
29229
|
const ProgressIndicator = (props) => {
|
|
29196
29230
|
const { value, color = undefined, testId, label, extraClasses = '', labelClasses = '', valuesLength, max, index, totalValue, ...tooltipProps } = props;
|
|
29197
29231
|
const tooltipData = getQTipData(tooltipProps);
|
|
29198
29232
|
const previousWidth = React.useRef(0);
|
|
29233
|
+
const animationRef = React.useRef(null);
|
|
29199
29234
|
const indicatorElementRef = React.useRef(null);
|
|
29200
29235
|
const [textColorClass, setTextColorClass] = React.useState('');
|
|
29201
|
-
const [animatedWidth, setAnimatedWidth] = React.useState(previousWidth.current);
|
|
29202
29236
|
// Determine which corners to round based on position and total value
|
|
29203
29237
|
let roundedCorners = '';
|
|
29204
29238
|
if (totalValue >= max) {
|
|
@@ -29219,16 +29253,35 @@ const ProgressIndicator = (props) => {
|
|
|
29219
29253
|
roundedCorners = 'tw:rounded-l-[0.9375rem]';
|
|
29220
29254
|
}
|
|
29221
29255
|
}
|
|
29222
|
-
React.useEffect(() => {
|
|
29223
|
-
const timeout = setTimeout(() => {
|
|
29224
|
-
const newWidth = (Number(value) / Number(max)) * 100;
|
|
29225
|
-
setAnimatedWidth(newWidth);
|
|
29226
|
-
previousWidth.current = newWidth;
|
|
29227
|
-
}, 100);
|
|
29228
|
-
return () => clearTimeout(timeout);
|
|
29229
|
-
}, [value]);
|
|
29230
29256
|
const bgColor = color || undefined;
|
|
29231
29257
|
const bgClass = color ? '' : 'tw:bg-sq-theme-dark';
|
|
29258
|
+
const indicatorTestId = testId ? `progress-bar-indicator-${testId}` : 'progress-bar-indicator';
|
|
29259
|
+
React.useEffect(() => {
|
|
29260
|
+
if (!indicatorElementRef.current) {
|
|
29261
|
+
return;
|
|
29262
|
+
}
|
|
29263
|
+
function cleanupAnimation() {
|
|
29264
|
+
if (animationRef.current) {
|
|
29265
|
+
animationRef.current.cancel();
|
|
29266
|
+
animationRef.current = null;
|
|
29267
|
+
}
|
|
29268
|
+
}
|
|
29269
|
+
const newWidth = (Number(value) / Number(max)) * 100;
|
|
29270
|
+
const oldWidth = previousWidth.current;
|
|
29271
|
+
cleanupAnimation();
|
|
29272
|
+
indicatorElementRef.current.style.width = `${newWidth}%`;
|
|
29273
|
+
const prefersReducedMotion = window.matchMedia('(prefers-reduced-motion: reduce)').matches;
|
|
29274
|
+
if (!prefersReducedMotion && newWidth !== oldWidth) {
|
|
29275
|
+
animationRef.current = indicatorElementRef.current.animate([{ width: `${oldWidth}%` }, { width: `${newWidth}%` }], PROGRESS_BAR_ANIMATION_CONFIG);
|
|
29276
|
+
}
|
|
29277
|
+
previousWidth.current = newWidth;
|
|
29278
|
+
return () => cleanupAnimation();
|
|
29279
|
+
}, [value, max]);
|
|
29280
|
+
React.useEffect(() => {
|
|
29281
|
+
if (indicatorElementRef.current) {
|
|
29282
|
+
computeTextClass(indicatorElementRef.current);
|
|
29283
|
+
}
|
|
29284
|
+
}, [color]);
|
|
29232
29285
|
const computeTextClass = (elem) => {
|
|
29233
29286
|
const computedStyle = getComputedStyle(elem);
|
|
29234
29287
|
const backgroundColor = computedStyle.backgroundColor;
|
|
@@ -29237,17 +29290,11 @@ const ProgressIndicator = (props) => {
|
|
|
29237
29290
|
: 'tw:text-sq-text-color tw:dark:text-sq-text-color';
|
|
29238
29291
|
setTextColorClass(textColorClass);
|
|
29239
29292
|
};
|
|
29240
|
-
|
|
29241
|
-
if (indicatorElementRef.current) {
|
|
29242
|
-
computeTextClass(indicatorElementRef.current);
|
|
29243
|
-
}
|
|
29244
|
-
}, [!!indicatorElementRef.current]);
|
|
29245
|
-
return (React.createElement(Indicator, { className: `tw:ease-[cubic-bezier(0.65, 0, 0.35, 1)] tw:w-full tw:h-4.5 tw:duration-[660ms] tw:flex tw:justify-center tw:items-center ${valuesLength === 1 ? '' : 'tw:overflow-hidden'} ${roundedCorners} ${bgClass} ${extraClasses}`, ...tooltipData, "data-qtip-text": tooltipProps.tooltip ? tooltipProps.tooltip : `${value}%`, "data-testid": `progress-bar-indicator-${testId ? testId : value}`, key: `${index}-${value}`, ref: indicatorElementRef, style: {
|
|
29293
|
+
return (jsxRuntime.jsx(Indicator, { className: `tw:w-full tw:h-4.5 tw:flex tw:justify-center tw:items-center ${valuesLength === 1 ? '' : 'tw:overflow-hidden'} ${roundedCorners} ${bgClass} ${extraClasses}`, ...tooltipData, "data-qtip-text": tooltipProps.tooltip ? tooltipProps.tooltip : `${value}%`, "data-segment-value": value, "data-testid": indicatorTestId, ref: indicatorElementRef, style: {
|
|
29246
29294
|
// Background color will default to the theme color if undefined
|
|
29247
29295
|
backgroundColor: bgColor,
|
|
29248
|
-
|
|
29249
|
-
|
|
29250
|
-
} }, label ? (jsxRuntime.jsx("span", { className: `${baseLabelClasses} ${labelClasses} ${textColorClass} ${valuesLength === 1 ? 'tw:absolute tw:z-50' : ''}`, children: label })) : undefined));
|
|
29296
|
+
width: `${previousWidth.current}%`,
|
|
29297
|
+
}, children: label ? (jsxRuntime.jsx("span", { className: `${baseLabelClasses} ${labelClasses} ${textColorClass} ${valuesLength === 1 ? 'tw:absolute tw:z-50' : ''}`, children: label })) : undefined }));
|
|
29251
29298
|
};
|
|
29252
29299
|
const ProgressBar = ({ values = [], max = 100, containerExtraClasses = '', zeroValueLabel = 'No progress yet', }) => {
|
|
29253
29300
|
const totalValue = values.reduce((acc, { value }) => acc + value, 0);
|
|
@@ -29280,11 +29327,15 @@ const ButtonGroup = (props) => {
|
|
|
29280
29327
|
const { id, extraClassNames = '', testId, onChange, buttons = [], ...tooltipProps } = props;
|
|
29281
29328
|
const tooltipData = getQTipData(tooltipProps);
|
|
29282
29329
|
const appliedClasses = `${baseClasses} ${extraClassNames}`;
|
|
29283
|
-
return (jsxRuntime.jsx("div", { id: id ? `button-group-${id}` : undefined, "data-testid": testId, className: appliedClasses, ...tooltipData, children: buttons
|
|
29284
|
-
|
|
29285
|
-
|
|
29286
|
-
|
|
29287
|
-
|
|
29330
|
+
return (jsxRuntime.jsx("div", { id: id ? `button-group-${id}` : undefined, "data-testid": testId, className: appliedClasses, ...tooltipData, children: buttons.filter(Boolean).map((item, index) => {
|
|
29331
|
+
if (item?.variant === 'button') {
|
|
29332
|
+
const { isActive, ...buttonPropsWithoutIsActive } = item.buttonProps;
|
|
29333
|
+
return (jsxRuntime.jsx(Button, { ...buttonPropsWithoutIsActive, extraClassNames: `tw:-ml-sq-1 tw:focus:z-40 tw:outline-none tw:focus:border tw:rounded-none tw:first:rounded-l-md tw:last:rounded-r-md ${isActive
|
|
29334
|
+
? `${activeClassesByVariantLightTheme[item.buttonProps.variant ?? 'outline']} ${activeClassesByVariantDarkTheme[item.buttonProps.variant ?? 'outline']} `
|
|
29335
|
+
: ''} ${item.buttonProps.extraClassNames}`, onClick: () => onChange && onChange(item.buttonProps.value) }, index));
|
|
29336
|
+
}
|
|
29337
|
+
return item?.element;
|
|
29338
|
+
}) }));
|
|
29288
29339
|
};
|
|
29289
29340
|
|
|
29290
29341
|
/**
|
|
@@ -29411,6 +29462,7 @@ exports.TextArea = TextArea;
|
|
|
29411
29462
|
exports.TextField = TextField;
|
|
29412
29463
|
exports.ToolbarButton = ToolbarButton;
|
|
29413
29464
|
exports.Tooltip = Tooltip;
|
|
29465
|
+
exports.TriggerWithDropdown = TriggerWithDropdown;
|
|
29414
29466
|
exports.buttonSizes = buttonSizes;
|
|
29415
29467
|
exports.buttonTypes = buttonTypes;
|
|
29416
29468
|
exports.buttonVariants = buttonVariants;
|