@seeqdev/qomponents 0.0.203 → 0.0.205

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.esm.js CHANGED
@@ -4935,15 +4935,17 @@ const errorClasses$4 = 'tw:border-sq-danger';
4935
4935
  const borderColorClasses$4 = [
4936
4936
  'tw:border-sq-disabled-gray',
4937
4937
  'tw:dark:border-sq-dark-disabled-gray',
4938
+ 'tw:hover:border-sq-theme-dark',
4939
+ 'tw:dark:hover:border-sq-theme-dark-dark',
4938
4940
  'tw:dark:focus:border-sq-theme-dark-dark',
4939
4941
  'tw:dark:active:border-sq-theme-darker',
4940
4942
  'tw:focus:border-sq-theme-dark',
4941
4943
  'tw:active:border-sq-theme-dark',
4942
4944
  ].join(' ');
4943
4945
  const baseClasses$6 = 'tw:h-8.5 tw:leading-normal tw:outline-none tw:py-1 tw:px-3' +
4944
- ' tw:disabled:pointer-events-none tw:disabled:bg-sq-light-gray tw:disabled:dark:bg-sq-dark-disabled-gray' +
4945
- ' tw:disabled:cursor-not-allowed tw:p-1 tw:border-solid tw:border tw:placeholder-gray-400' +
4946
- ' tw:dark:placeholder-sq-dark-text/30 specTextField';
4946
+ ' tw:disabled:pointer-events-none tw:disabled:bg-sq-light-gray tw:disabled:dark:bg-sq-dark-disabled-gray' +
4947
+ ' tw:disabled:cursor-not-allowed tw:p-1 tw:border-solid tw:border tw:placeholder-gray-400!' +
4948
+ ' tw:dark:placeholder-sq-dark-text/30! specTextField';
4947
4949
  const darkTheme$3 = 'tw:dark:bg-sq-dark-background tw:dark:text-sq-dark-text tw:disabled:dark:text-sq-dark-text/30';
4948
4950
  const lightTheme$3 = 'tw:text-sq-text-color tw:disabled:text-sq-darkish-gray';
4949
4951
  const sizeClasses = {
@@ -5010,8 +5012,8 @@ const TextField = React__default.forwardRef((props, ref) => {
5010
5012
  const alignment = 'tw:flex';
5011
5013
  const labelClasses = 'tw:ml-1.5 tw:text-sm tw:-mt-0.5';
5012
5014
  const baseClasses$5 = 'tw:appearance-none tw:border tw:h-3.5 tw:w-3.5 tw:focus:ring-0 tw:focus:ring-offset-0 tw:outline-none tw:focus:outline-none' +
5013
- ' tw:dark:bg-sq-dark-background tw:dark:border-sq-dark-text tw:dark:hover:bg-sq-dark-background' +
5014
- ' tw:checked:text-white tw:checked:border-sq-text-color tw:checked:hover:border-sq-theme-dark' +
5015
+ ' tw:dark:bg-sq-dark-background tw:dark:border-sq-dark-text tw:dark:enabled:hover:bg-sq-dark-background' +
5016
+ ' tw:checked:text-white tw:checked:border-sq-text-color tw:checked:enabled:hover:border-sq-theme-dark' +
5015
5017
  ' tw:checked:active:border-sq-theme-darker tw:checked:focus:border-sq-theme-dark tw:disabled:border-sq-disabled-gray' +
5016
5018
  ' tw:dark:disabled:border-sq-fairly-dark-gray tw:dark:checked:focus:bg-sq-dark-background';
5017
5019
  const checkboxClasses = `tw:rounded ${baseClasses$5}`;
@@ -5020,7 +5022,7 @@ const radioClasses = `tw:rounded-full ${baseClasses$5}`;
5020
5022
  * Checkbox and Radio Box Component.
5021
5023
  */
5022
5024
  const Checkbox = (props) => {
5023
- const { type = 'checkbox', value, disabled = false, label, onChange, onClick, onKeyDown, checked, defaultChecked, id, name, extraClassNames, extraLabelClassNames, testId, ...tooltipProps } = props;
5025
+ const { type = 'checkbox', value, disabled = false, label, onChange, onClick, onKeyDown, checked, defaultChecked, id, name, extraClassNames = '', extraLabelClassNames, testId, ...tooltipProps } = props;
5024
5026
  const assignedId = id ?? 'checkbox_' + Math.random();
5025
5027
  const tooltipData = getQTipData(tooltipProps);
5026
5028
  return (jsxs("span", { className: `${alignment} ${extraClassNames}`, children: [jsx$1("input", { value: value, type: type, "data-testid": testId, name: name, id: assignedId, readOnly: !onChange, checked: checked, defaultChecked: defaultChecked, className: `${type === 'checkbox' ? checkboxClasses : radioClasses} ${disabled ? 'tw:cursor-not-allowed' : 'tw:cursor-pointer'}`, disabled: disabled, onClick: onClick, onChange: onChange, onKeyDown: onKeyDown, ...tooltipData }), label && (jsx$1("label", { htmlFor: assignedId, className: `${labelClasses} ${extraLabelClassNames} ${disabled
@@ -5029,15 +5031,17 @@ const Checkbox = (props) => {
5029
5031
  };
5030
5032
 
5031
5033
  const baseClasses$4 = 'tw:leading-normal tw:outline-none tw:py-1 tw:px-3 tw:rounded-md tw:w-full' +
5032
- ' tw:disabled:pointer-events-none tw:disabled:bg-sq-light-gray tw:disabled:dark:bg-sq-dark-disabled-gray' +
5034
+ ' tw:disabled:pointer-events-none tw:disabled:bg-sq-light-gray tw:disabled:dark:bg-sq-dark-disabled-gray' +
5033
5035
  ' tw:disabled:cursor-not-allowed tw:p-1 tw:border-solid tw:border tw:text-sm';
5034
5036
  const darkTheme$2 = 'tw:dark:bg-sq-dark-background tw:dark:text-sq-dark-text ' +
5035
- 'tw:dark:placeholder-sq-dark-text/30 tw:disabled:dark:text-sq-dark-text/30';
5036
- const lightTheme$2 = 'tw:text-sq-text-color tw:placeholder-gray-400 tw:disabled:text-sq-darkish-gray';
5037
+ 'tw:dark:placeholder-sq-dark-text/30! tw:disabled:dark:text-sq-dark-text/30';
5038
+ const lightTheme$2 = 'tw:text-sq-text-color tw:placeholder-gray-400! tw:disabled:text-sq-darkish-gray';
5037
5039
  const errorClasses$3 = 'tw:border-sq-danger';
5038
5040
  const borderColorClasses$3 = [
5039
5041
  'tw:border-sq-disabled-gray',
5040
5042
  'tw:dark:border-sq-dark-disabled-gray',
5043
+ 'tw:hover:border-sq-theme-dark',
5044
+ 'tw:dark:hover:border-sq-theme-dark-dark',
5041
5045
  'tw:dark:focus:border-sq-theme-darker',
5042
5046
  'tw:dark:active:border-sq-theme-darker',
5043
5047
  'tw:focus:border-sq-theme-dark',
@@ -14119,13 +14123,18 @@ const Select = ({ options, value, placeholder = 'select', noOptionsMessage = 'no
14119
14123
  }
14120
14124
  onChange(newValue);
14121
14125
  };
14126
+ // react-select defaults blurInputOnSelect to true on touch-capable devices; that can close the menu even when
14127
+ // closeMenuOnSelect is false. Only make `blurInputOnSelect=false` when `closeMenuOnSelect=false` (e.g., multi-select
14128
+ // where the menu should stay open after each pick), otherwise set to `undefined` to default to the built-in
14129
+ // react-select behaviour.
14130
+ const blurInputOnSelect = closeMenuOnSelect ? undefined : false;
14122
14131
  const props = {
14123
14132
  id,
14124
14133
  value,
14125
14134
  inputId,
14126
14135
  placeholder,
14127
14136
  closeMenuOnSelect,
14128
- blurInputOnSelect: closeMenuOnSelect,
14137
+ blurInputOnSelect,
14129
14138
  isSearchable: creatable ? true : isSearchable,
14130
14139
  isMulti,
14131
14140
  isClearable,
@@ -14164,7 +14173,7 @@ const Select = ({ options, value, placeholder = 'select', noOptionsMessage = 'no
14164
14173
  return `${appliedClasses} ${baseClasses$3} ${containerStyles} specSelectControl ${isDisabled ? disabledClasses$3 : ''} ${small ? 'tw:pl-2 tw:pr-1' : 'tw:pl-2.5 tw:pr-1.5'}`;
14165
14174
  },
14166
14175
  placeholder: () => placeholderStyles,
14167
- container: ({ selectProps }) => {
14176
+ container: () => {
14168
14177
  return `${textStyles} ${extraClassNames} tw:pointer-events-auto!`;
14169
14178
  },
14170
14179
  input: () => textStyles + ' specSelectInput',
@@ -14172,12 +14181,15 @@ const Select = ({ options, value, placeholder = 'select', noOptionsMessage = 'no
14172
14181
  menu: () => menuStyles,
14173
14182
  menuPortal: () => 'tw:z-[9000]!',
14174
14183
  dropdownIndicator: () => dropDownIndicatorStyles,
14175
- option: ({ isSelected, isDisabled }) => {
14184
+ option: ({ isSelected, isDisabled, isFocused }) => {
14176
14185
  let classes = optionStyles;
14177
14186
  if (isDisabled) {
14178
14187
  classes += ' specDisabledOption ';
14179
14188
  }
14180
- return isSelected ? classes + ' tw:bg-sq-colored-hover tw:dark:bg-sq-colored-hover-dark' : classes;
14189
+ if (isSelected) {
14190
+ return classes + ' tw:bg-sq-colored-hover tw:dark:bg-sq-colored-hover-dark';
14191
+ }
14192
+ return isFocused ? classes + ' tw:bg-sq-gray-highlight tw:dark:bg-sq-gray-highlight-dark' : classes;
14181
14193
  },
14182
14194
  singleValue: () => 'specOpenSelect',
14183
14195
  multiValue: () => multiValueStyles,
@@ -14584,7 +14596,7 @@ const DialogFooter = (props) => jsx$1("div", { ...props });
14584
14596
  DialogFooter.displayName = 'DialogFooter';
14585
14597
  const DialogTitle = React__default.forwardRef((props, ref) => jsx$1(Title, { ref: ref, ...props }));
14586
14598
  DialogTitle.displayName = Title.displayName;
14587
- const DialogDescription = React__default.forwardRef((props, ref) => jsx$1(Description, { ref: ref, ...props }));
14599
+ const DialogDescription = React__default.forwardRef((props, ref) => (jsx$1(Description, { asChild: true, children: jsx$1("div", { ref: ref, ...props }) })));
14588
14600
  DialogDescription.displayName = Description.displayName;
14589
14601
  const Modal = ({ titleIcon, title = 'Modal title example', titleSuffixLabel, subtitle, children, open = false, onClose, customButton = false, customButtonLabel = 'Back', onClickCustomButton, submitButtonLabel = 'Submit', cancelButtonLabel = 'Cancel', disableSubmitButton = false, stopPropagationSubmitButton = false, onSubmit, isTitleEditable = false, onTitleChanged, inputExtraClassNames, hideCloseIcon = false, size = 'xl', titleIconPosition = 'left', hideFooterButtons = false, hideSubmitButton = false, hideCancelButton = false, testId = 'modal', modalFooter, dialogClassName, titlePlaceholder, titleRequired, titleError, submitButtonTooltip, cancelButtonTooltip, disableCustomButton, customHeader, middleFooterSection = jsx$1(Fragment, {}), customButtonVariant = 'outline', submitButtonVariant = 'theme', keepFocusInsideModal = true, onPointerDownOutside, onInteractOutside, ariaDescribedBy, }) => {
14590
14602
  const [isLoading, setIsLoading] = useState(false);
@@ -14635,7 +14647,7 @@ const Modal = ({ titleIcon, title = 'Modal title example', titleSuffixLabel, sub
14635
14647
  'tw:max-w-4xl': size === '4xl',
14636
14648
  'tw:max-w-5xl': size === '5xl',
14637
14649
  'tw:max-w-6xl': size === '6xl',
14638
- }, dialogClassName), children: [jsxs(DialogHeader, { className: "modal-header tw:flex tw:w-full tw:justify-between tw:border-sq-disabled-gray\n tw:dark:border-sq-dark-disabled-gray tw:border-0 tw:border-b tw:px-6 tw:py-4", children: [jsx$1("div", { className: "tw:flex tw:w-full", children: renderTitle() }), !hideCloseIcon && (jsx$1(DialogClose, { autoFocus: false, className: "tw:[&:has(:focus-visible)]:none tw:opacity-70 tw:bg-transparent tw:hover:opacity-100 close tw:text-base tw:cursor-pointer tw:ml-4", "data-testid": "closeButton", children: jsx$1("span", { className: "tw:cursor-pointer", children: "\u00D7" }) }))] }), jsx$1(DialogDescription, { className: "modal-body tw:px-6 tw:py-4 tw:overflow-y-auto", asChild: true, children: children }), !hideFooterButtons && (jsx$1(DialogFooter, { className: "modal-footer tw:px-6 tw:py-4", children: modalFooter ?? (jsxs("div", { className: "tw:flex tw:w-full tw:justify-between", "data-testid": "modalFooter", children: [jsx$1("div", { className: "tw:flex tw:justify-start", children: customButton && (jsx$1(Button, { label: customButtonLabel, onClick: onClickCustomButton, disabled: disableCustomButton, extraClassNames: "tw:justify-start tw:min-w-25", testId: "customButton", variant: customButtonVariant })) }), jsxs("div", { className: "tw:flex tw:justify-end", children: [jsx$1("div", { className: "tw:flex tw:items-center", children: middleFooterSection }), !hideCancelButton && (jsx$1(DialogClose, { asChild: true, children: jsx$1(Button, { label: cancelButtonLabel, extraClassNames: "tw:mr-5 tw:min-w-25", tooltip: cancelButtonTooltip, variant: "outline", stopPropagation: false, testId: "cancelButton" }) })), !hideSubmitButton && (jsx$1(Button, { label: submitButtonLabel, onClick: handleSubmit, disabled: disableSubmitButton || isLoading, variant: submitButtonVariant, stopPropagation: stopPropagationSubmitButton, tooltip: submitButtonTooltip, icon: isLoading ? 'fc-loading-notch tw:animate-spin' : undefined, iconPosition: "left", testId: "submitButton", extraClassNames: "tw:min-w-25" }))] })] })) }))] }) })) : (jsx$1(Fragment, {}));
14650
+ }, dialogClassName), children: [jsxs(DialogHeader, { className: "modal-header tw:flex tw:w-full tw:justify-between tw:border-sq-disabled-gray\n tw:dark:border-sq-dark-disabled-gray tw:border-0 tw:border-b tw:px-6 tw:py-4", children: [jsx$1("div", { className: "tw:flex tw:w-full", children: renderTitle() }), !hideCloseIcon && (jsx$1(DialogClose, { autoFocus: false, className: "tw:[&:has(:focus-visible)]:none tw:opacity-70 tw:bg-transparent tw:hover:opacity-100 close tw:text-base tw:cursor-pointer tw:ml-4", "data-testid": "closeButton", children: jsx$1("span", { className: "tw:cursor-pointer", children: "\u00D7" }) }))] }), jsx$1(DialogDescription, { className: "modal-body tw:px-6 tw:py-4 tw:overflow-y-auto", children: children }), !hideFooterButtons && (jsx$1(DialogFooter, { className: "modal-footer tw:px-6 tw:py-4", children: modalFooter ?? (jsxs("div", { className: "tw:flex tw:w-full tw:justify-between", "data-testid": "modalFooter", children: [jsx$1("div", { className: "tw:flex tw:justify-start", children: customButton && (jsx$1(Button, { label: customButtonLabel, onClick: onClickCustomButton, disabled: disableCustomButton, extraClassNames: "tw:justify-start tw:min-w-25", testId: "customButton", variant: customButtonVariant })) }), jsxs("div", { className: "tw:flex tw:justify-end", children: [jsx$1("div", { className: "tw:flex tw:items-center", children: middleFooterSection }), !hideCancelButton && (jsx$1(DialogClose, { asChild: true, children: jsx$1(Button, { label: cancelButtonLabel, extraClassNames: "tw:mr-5 tw:min-w-25", tooltip: cancelButtonTooltip, variant: "outline", stopPropagation: false, testId: "cancelButton" }) })), !hideSubmitButton && (jsx$1(Button, { label: submitButtonLabel, onClick: handleSubmit, disabled: disableSubmitButton || isLoading, variant: submitButtonVariant, stopPropagation: stopPropagationSubmitButton, tooltip: submitButtonTooltip, icon: isLoading ? 'fc-loading-notch tw:animate-spin' : undefined, iconPosition: "left", testId: "submitButton", extraClassNames: "tw:min-w-25" }))] })] })) }))] }) })) : (jsx$1(Fragment, {}));
14639
14651
  };
14640
14652
 
14641
14653
  function createCollection(name) {