@seeqdev/qomponents 0.0.203 → 0.0.204

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
@@ -4955,15 +4955,17 @@ const errorClasses$4 = 'tw:border-sq-danger';
4955
4955
  const borderColorClasses$4 = [
4956
4956
  'tw:border-sq-disabled-gray',
4957
4957
  'tw:dark:border-sq-dark-disabled-gray',
4958
+ 'tw:hover:border-sq-theme-dark',
4959
+ 'tw:dark:hover:border-sq-theme-dark-dark',
4958
4960
  'tw:dark:focus:border-sq-theme-dark-dark',
4959
4961
  'tw:dark:active:border-sq-theme-darker',
4960
4962
  'tw:focus:border-sq-theme-dark',
4961
4963
  'tw:active:border-sq-theme-dark',
4962
4964
  ].join(' ');
4963
4965
  const baseClasses$6 = 'tw:h-8.5 tw:leading-normal tw:outline-none tw:py-1 tw:px-3' +
4964
- ' tw:disabled:pointer-events-none tw:disabled:bg-sq-light-gray tw:disabled:dark:bg-sq-dark-disabled-gray' +
4965
- ' tw:disabled:cursor-not-allowed tw:p-1 tw:border-solid tw:border tw:placeholder-gray-400' +
4966
- ' tw:dark:placeholder-sq-dark-text/30 specTextField';
4966
+ ' tw:disabled:pointer-events-none tw:disabled:bg-sq-light-gray tw:disabled:dark:bg-sq-dark-disabled-gray' +
4967
+ ' tw:disabled:cursor-not-allowed tw:p-1 tw:border-solid tw:border tw:placeholder-gray-400!' +
4968
+ ' tw:dark:placeholder-sq-dark-text/30! specTextField';
4967
4969
  const darkTheme$3 = 'tw:dark:bg-sq-dark-background tw:dark:text-sq-dark-text tw:disabled:dark:text-sq-dark-text/30';
4968
4970
  const lightTheme$3 = 'tw:text-sq-text-color tw:disabled:text-sq-darkish-gray';
4969
4971
  const sizeClasses = {
@@ -5030,8 +5032,8 @@ const TextField = React.forwardRef((props, ref) => {
5030
5032
  const alignment = 'tw:flex';
5031
5033
  const labelClasses = 'tw:ml-1.5 tw:text-sm tw:-mt-0.5';
5032
5034
  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' +
5033
- ' tw:dark:bg-sq-dark-background tw:dark:border-sq-dark-text tw:dark:hover:bg-sq-dark-background' +
5034
- ' tw:checked:text-white tw:checked:border-sq-text-color tw:checked:hover:border-sq-theme-dark' +
5035
+ ' tw:dark:bg-sq-dark-background tw:dark:border-sq-dark-text tw:dark:enabled:hover:bg-sq-dark-background' +
5036
+ ' tw:checked:text-white tw:checked:border-sq-text-color tw:checked:enabled:hover:border-sq-theme-dark' +
5035
5037
  ' tw:checked:active:border-sq-theme-darker tw:checked:focus:border-sq-theme-dark tw:disabled:border-sq-disabled-gray' +
5036
5038
  ' tw:dark:disabled:border-sq-fairly-dark-gray tw:dark:checked:focus:bg-sq-dark-background';
5037
5039
  const checkboxClasses = `tw:rounded ${baseClasses$5}`;
@@ -5040,7 +5042,7 @@ const radioClasses = `tw:rounded-full ${baseClasses$5}`;
5040
5042
  * Checkbox and Radio Box Component.
5041
5043
  */
5042
5044
  const Checkbox = (props) => {
5043
- const { type = 'checkbox', value, disabled = false, label, onChange, onClick, onKeyDown, checked, defaultChecked, id, name, extraClassNames, extraLabelClassNames, testId, ...tooltipProps } = props;
5045
+ const { type = 'checkbox', value, disabled = false, label, onChange, onClick, onKeyDown, checked, defaultChecked, id, name, extraClassNames = '', extraLabelClassNames, testId, ...tooltipProps } = props;
5044
5046
  const assignedId = id ?? 'checkbox_' + Math.random();
5045
5047
  const tooltipData = getQTipData(tooltipProps);
5046
5048
  return (jsxRuntime.jsxs("span", { className: `${alignment} ${extraClassNames}`, children: [jsxRuntime.jsx("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 && (jsxRuntime.jsx("label", { htmlFor: assignedId, className: `${labelClasses} ${extraLabelClassNames} ${disabled
@@ -5049,15 +5051,17 @@ const Checkbox = (props) => {
5049
5051
  };
5050
5052
 
5051
5053
  const baseClasses$4 = 'tw:leading-normal tw:outline-none tw:py-1 tw:px-3 tw:rounded-md tw:w-full' +
5052
- ' tw:disabled:pointer-events-none tw:disabled:bg-sq-light-gray tw:disabled:dark:bg-sq-dark-disabled-gray' +
5054
+ ' tw:disabled:pointer-events-none tw:disabled:bg-sq-light-gray tw:disabled:dark:bg-sq-dark-disabled-gray' +
5053
5055
  ' tw:disabled:cursor-not-allowed tw:p-1 tw:border-solid tw:border tw:text-sm';
5054
5056
  const darkTheme$2 = 'tw:dark:bg-sq-dark-background tw:dark:text-sq-dark-text ' +
5055
- 'tw:dark:placeholder-sq-dark-text/30 tw:disabled:dark:text-sq-dark-text/30';
5056
- const lightTheme$2 = 'tw:text-sq-text-color tw:placeholder-gray-400 tw:disabled:text-sq-darkish-gray';
5057
+ 'tw:dark:placeholder-sq-dark-text/30! tw:disabled:dark:text-sq-dark-text/30';
5058
+ const lightTheme$2 = 'tw:text-sq-text-color tw:placeholder-gray-400! tw:disabled:text-sq-darkish-gray';
5057
5059
  const errorClasses$3 = 'tw:border-sq-danger';
5058
5060
  const borderColorClasses$3 = [
5059
5061
  'tw:border-sq-disabled-gray',
5060
5062
  'tw:dark:border-sq-dark-disabled-gray',
5063
+ 'tw:hover:border-sq-theme-dark',
5064
+ 'tw:dark:hover:border-sq-theme-dark-dark',
5061
5065
  'tw:dark:focus:border-sq-theme-darker',
5062
5066
  'tw:dark:active:border-sq-theme-darker',
5063
5067
  'tw:focus:border-sq-theme-dark',
@@ -14139,13 +14143,18 @@ const Select = ({ options, value, placeholder = 'select', noOptionsMessage = 'no
14139
14143
  }
14140
14144
  onChange(newValue);
14141
14145
  };
14146
+ // react-select defaults blurInputOnSelect to true on touch-capable devices; that can close the menu even when
14147
+ // closeMenuOnSelect is false. Only make `blurInputOnSelect=false` when `closeMenuOnSelect=false` (e.g., multi-select
14148
+ // where the menu should stay open after each pick), otherwise set to `undefined` to default to the built-in
14149
+ // react-select behaviour.
14150
+ const blurInputOnSelect = closeMenuOnSelect ? undefined : false;
14142
14151
  const props = {
14143
14152
  id,
14144
14153
  value,
14145
14154
  inputId,
14146
14155
  placeholder,
14147
14156
  closeMenuOnSelect,
14148
- blurInputOnSelect: closeMenuOnSelect,
14157
+ blurInputOnSelect,
14149
14158
  isSearchable: creatable ? true : isSearchable,
14150
14159
  isMulti,
14151
14160
  isClearable,
@@ -14184,7 +14193,7 @@ const Select = ({ options, value, placeholder = 'select', noOptionsMessage = 'no
14184
14193
  return `${appliedClasses} ${baseClasses$3} ${containerStyles} specSelectControl ${isDisabled ? disabledClasses$3 : ''} ${small ? 'tw:pl-2 tw:pr-1' : 'tw:pl-2.5 tw:pr-1.5'}`;
14185
14194
  },
14186
14195
  placeholder: () => placeholderStyles,
14187
- container: ({ selectProps }) => {
14196
+ container: () => {
14188
14197
  return `${textStyles} ${extraClassNames} tw:pointer-events-auto!`;
14189
14198
  },
14190
14199
  input: () => textStyles + ' specSelectInput',
@@ -14192,12 +14201,15 @@ const Select = ({ options, value, placeholder = 'select', noOptionsMessage = 'no
14192
14201
  menu: () => menuStyles,
14193
14202
  menuPortal: () => 'tw:z-[9000]!',
14194
14203
  dropdownIndicator: () => dropDownIndicatorStyles,
14195
- option: ({ isSelected, isDisabled }) => {
14204
+ option: ({ isSelected, isDisabled, isFocused }) => {
14196
14205
  let classes = optionStyles;
14197
14206
  if (isDisabled) {
14198
14207
  classes += ' specDisabledOption ';
14199
14208
  }
14200
- return isSelected ? classes + ' tw:bg-sq-colored-hover tw:dark:bg-sq-colored-hover-dark' : classes;
14209
+ if (isSelected) {
14210
+ return classes + ' tw:bg-sq-colored-hover tw:dark:bg-sq-colored-hover-dark';
14211
+ }
14212
+ return isFocused ? classes + ' tw:bg-sq-gray-highlight tw:dark:bg-sq-gray-highlight-dark' : classes;
14201
14213
  },
14202
14214
  singleValue: () => 'specOpenSelect',
14203
14215
  multiValue: () => multiValueStyles,
@@ -14604,7 +14616,7 @@ const DialogFooter = (props) => jsxRuntime.jsx("div", { ...props });
14604
14616
  DialogFooter.displayName = 'DialogFooter';
14605
14617
  const DialogTitle = React.forwardRef((props, ref) => jsxRuntime.jsx(Title, { ref: ref, ...props }));
14606
14618
  DialogTitle.displayName = Title.displayName;
14607
- const DialogDescription = React.forwardRef((props, ref) => jsxRuntime.jsx(Description, { ref: ref, ...props }));
14619
+ const DialogDescription = React.forwardRef((props, ref) => (jsxRuntime.jsx(Description, { asChild: true, children: jsxRuntime.jsx("div", { ref: ref, ...props }) })));
14608
14620
  DialogDescription.displayName = Description.displayName;
14609
14621
  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 = jsxRuntime.jsx(jsxRuntime.Fragment, {}), customButtonVariant = 'outline', submitButtonVariant = 'theme', keepFocusInsideModal = true, onPointerDownOutside, onInteractOutside, ariaDescribedBy, }) => {
14610
14622
  const [isLoading, setIsLoading] = React.useState(false);
@@ -14655,7 +14667,7 @@ const Modal = ({ titleIcon, title = 'Modal title example', titleSuffixLabel, sub
14655
14667
  'tw:max-w-4xl': size === '4xl',
14656
14668
  'tw:max-w-5xl': size === '5xl',
14657
14669
  'tw:max-w-6xl': size === '6xl',
14658
- }, dialogClassName), children: [jsxRuntime.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: [jsxRuntime.jsx("div", { className: "tw:flex tw:w-full", children: renderTitle() }), !hideCloseIcon && (jsxRuntime.jsx(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: jsxRuntime.jsx("span", { className: "tw:cursor-pointer", children: "\u00D7" }) }))] }), jsxRuntime.jsx(DialogDescription, { className: "modal-body tw:px-6 tw:py-4 tw:overflow-y-auto", asChild: true, children: children }), !hideFooterButtons && (jsxRuntime.jsx(DialogFooter, { className: "modal-footer tw:px-6 tw:py-4", children: modalFooter ?? (jsxRuntime.jsxs("div", { className: "tw:flex tw:w-full tw:justify-between", "data-testid": "modalFooter", children: [jsxRuntime.jsx("div", { className: "tw:flex tw:justify-start", children: customButton && (jsxRuntime.jsx(Button, { label: customButtonLabel, onClick: onClickCustomButton, disabled: disableCustomButton, extraClassNames: "tw:justify-start tw:min-w-25", testId: "customButton", variant: customButtonVariant })) }), jsxRuntime.jsxs("div", { className: "tw:flex tw:justify-end", children: [jsxRuntime.jsx("div", { className: "tw:flex tw:items-center", children: middleFooterSection }), !hideCancelButton && (jsxRuntime.jsx(DialogClose, { asChild: true, children: jsxRuntime.jsx(Button, { label: cancelButtonLabel, extraClassNames: "tw:mr-5 tw:min-w-25", tooltip: cancelButtonTooltip, variant: "outline", stopPropagation: false, testId: "cancelButton" }) })), !hideSubmitButton && (jsxRuntime.jsx(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" }))] })] })) }))] }) })) : (jsxRuntime.jsx(jsxRuntime.Fragment, {}));
14670
+ }, dialogClassName), children: [jsxRuntime.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: [jsxRuntime.jsx("div", { className: "tw:flex tw:w-full", children: renderTitle() }), !hideCloseIcon && (jsxRuntime.jsx(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: jsxRuntime.jsx("span", { className: "tw:cursor-pointer", children: "\u00D7" }) }))] }), jsxRuntime.jsx(DialogDescription, { className: "modal-body tw:px-6 tw:py-4 tw:overflow-y-auto", children: children }), !hideFooterButtons && (jsxRuntime.jsx(DialogFooter, { className: "modal-footer tw:px-6 tw:py-4", children: modalFooter ?? (jsxRuntime.jsxs("div", { className: "tw:flex tw:w-full tw:justify-between", "data-testid": "modalFooter", children: [jsxRuntime.jsx("div", { className: "tw:flex tw:justify-start", children: customButton && (jsxRuntime.jsx(Button, { label: customButtonLabel, onClick: onClickCustomButton, disabled: disableCustomButton, extraClassNames: "tw:justify-start tw:min-w-25", testId: "customButton", variant: customButtonVariant })) }), jsxRuntime.jsxs("div", { className: "tw:flex tw:justify-end", children: [jsxRuntime.jsx("div", { className: "tw:flex tw:items-center", children: middleFooterSection }), !hideCancelButton && (jsxRuntime.jsx(DialogClose, { asChild: true, children: jsxRuntime.jsx(Button, { label: cancelButtonLabel, extraClassNames: "tw:mr-5 tw:min-w-25", tooltip: cancelButtonTooltip, variant: "outline", stopPropagation: false, testId: "cancelButton" }) })), !hideSubmitButton && (jsxRuntime.jsx(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" }))] })] })) }))] }) })) : (jsxRuntime.jsx(jsxRuntime.Fragment, {}));
14659
14671
  };
14660
14672
 
14661
14673
  function createCollection(name) {