myoperator-ui 0.0.171 → 0.0.172-beta.1

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.
Files changed (2) hide show
  1. package/dist/index.js +26 -8
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -946,7 +946,11 @@ const Input = React.forwardRef<HTMLInputElement, InputProps>(
946
946
  return (
947
947
  <input
948
948
  type={type}
949
- className={cn(inputVariants({ state, className }))}
949
+ className={cn(
950
+ inputVariants({ state, className }),
951
+ type === "number" &&
952
+ "[appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none"
953
+ )}
950
954
  ref={ref}
951
955
  {...props}
952
956
  />
@@ -1690,6 +1694,7 @@ const TextField = React.forwardRef<HTMLInputElement, TextFieldProps>(
1690
1694
  onChange,
1691
1695
  disabled,
1692
1696
  id,
1697
+ type,
1693
1698
  ...props
1694
1699
  },
1695
1700
  ref
@@ -1730,14 +1735,21 @@ const TextField = React.forwardRef<HTMLInputElement, TextFieldProps>(
1730
1735
  const ariaDescribedBy = error ? errorId : helperText ? helperId : undefined;
1731
1736
 
1732
1737
  // Render the input element
1738
+ const numberSpinnerClasses =
1739
+ type === "number"
1740
+ ? "[appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none"
1741
+ : undefined;
1742
+
1733
1743
  const inputElement = (
1734
1744
  <input
1735
1745
  ref={ref}
1736
1746
  id={inputId}
1747
+ type={type}
1737
1748
  className={cn(
1738
1749
  hasAddons
1739
1750
  ? "flex-1 bg-transparent border-0 outline-none focus:ring-0 px-0 h-full text-sm text-semantic-text-primary placeholder:text-semantic-text-placeholder disabled:cursor-not-allowed"
1740
- : textFieldInputVariants({ state: derivedState, className })
1751
+ : textFieldInputVariants({ state: derivedState, className }),
1752
+ numberSpinnerClasses
1741
1753
  )}
1742
1754
  disabled={disabled || loading}
1743
1755
  maxLength={maxLength}
@@ -4653,13 +4665,18 @@ export {
4653
4665
  // ============================================================================
4654
4666
 
4655
4667
  const TOAST_LIMIT = 5;
4656
- const TOAST_REMOVE_DELAY = 5000;
4668
+ const TOAST_REMOVE_DELAY = 2000;
4657
4669
 
4658
4670
  type ToasterToast = ToastProps & {
4659
4671
  id: string;
4660
4672
  title?: React.ReactNode;
4661
4673
  description?: React.ReactNode;
4662
4674
  action?: ToastActionElement;
4675
+ /**
4676
+ * Duration in milliseconds before the toast is removed after dismissal.
4677
+ * Defaults to 2000ms (2 seconds).
4678
+ */
4679
+ duration?: number;
4663
4680
  };
4664
4681
 
4665
4682
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
@@ -4703,7 +4720,7 @@ interface State {
4703
4720
 
4704
4721
  const toastTimeouts = new Map<string, ReturnType<typeof setTimeout>>();
4705
4722
 
4706
- const addToRemoveQueue = (toastId: string) => {
4723
+ const addToRemoveQueue = (toastId: string, duration?: number) => {
4707
4724
  if (toastTimeouts.has(toastId)) {
4708
4725
  return;
4709
4726
  }
@@ -4714,7 +4731,7 @@ const addToRemoveQueue = (toastId: string) => {
4714
4731
  type: "REMOVE_TOAST",
4715
4732
  toastId: toastId,
4716
4733
  });
4717
- }, TOAST_REMOVE_DELAY);
4734
+ }, duration ?? TOAST_REMOVE_DELAY);
4718
4735
 
4719
4736
  toastTimeouts.set(toastId, timeout);
4720
4737
  };
@@ -4739,10 +4756,11 @@ export const reducer = (state: State, action: Action): State => {
4739
4756
  const { toastId } = action;
4740
4757
 
4741
4758
  if (toastId) {
4742
- addToRemoveQueue(toastId);
4759
+ const toastItem = state.toasts.find((t) => t.id === toastId);
4760
+ addToRemoveQueue(toastId, toastItem?.duration);
4743
4761
  } else {
4744
- state.toasts.forEach((toast) => {
4745
- addToRemoveQueue(toast.id);
4762
+ state.toasts.forEach((toastItem) => {
4763
+ addToRemoveQueue(toastItem.id, toastItem.duration);
4746
4764
  });
4747
4765
  }
4748
4766
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "myoperator-ui",
3
- "version": "0.0.171",
3
+ "version": "0.0.172-beta.1",
4
4
  "description": "CLI for adding myOperator UI components to your project",
5
5
  "type": "module",
6
6
  "exports": "./dist/index.js",