@eqtylab/equality 4.12.0 → 4.13.0

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.d.cts CHANGED
@@ -45,14 +45,14 @@ declare const AlertDialogFooter: {
45
45
  declare const AlertDialogTitle: React$1.ForwardRefExoticComponent<Omit<AlertDialogPrimitive.AlertDialogTitleProps & React$1.RefAttributes<HTMLHeadingElement>, "ref"> & React$1.RefAttributes<HTMLHeadingElement>>;
46
46
  declare const AlertDialogDescription: React$1.ForwardRefExoticComponent<Omit<AlertDialogPrimitive.AlertDialogDescriptionProps & React$1.RefAttributes<HTMLParagraphElement>, "ref"> & React$1.RefAttributes<HTMLParagraphElement>>;
47
47
  declare const AlertDialogAction: React$1.ForwardRefExoticComponent<Omit<Omit<AlertDialogPrimitive.AlertDialogActionProps & React$1.RefAttributes<HTMLButtonElement>, "ref">, "prefix"> & VariantProps<(props?: ({
48
- variant?: "primary" | "danger" | "warning" | "secondary" | "tertiary" | "link" | "navigation" | null | undefined;
48
+ variant?: "link" | "primary" | "danger" | "warning" | "secondary" | "tertiary" | "navigation" | null | undefined;
49
49
  size?: "sm" | "md" | "lg" | null | undefined;
50
50
  } & class_variance_authority_types.ClassProp) | undefined) => string> & {
51
51
  prefix?: React$1.ReactNode;
52
52
  suffix?: React$1.ReactNode;
53
53
  } & React$1.RefAttributes<HTMLButtonElement>>;
54
54
  declare const AlertDialogCancel: React$1.ForwardRefExoticComponent<Omit<Omit<AlertDialogPrimitive.AlertDialogCancelProps & React$1.RefAttributes<HTMLButtonElement>, "ref">, "prefix"> & VariantProps<(props?: ({
55
- variant?: "primary" | "danger" | "warning" | "secondary" | "tertiary" | "link" | "navigation" | null | undefined;
55
+ variant?: "link" | "primary" | "danger" | "warning" | "secondary" | "tertiary" | "navigation" | null | undefined;
56
56
  size?: "sm" | "md" | "lg" | null | undefined;
57
57
  } & class_variance_authority_types.ClassProp) | undefined) => string> & {
58
58
  prefix?: React$1.ReactNode;
@@ -225,7 +225,7 @@ declare const BgGradient: ({ theme, placement, }: {
225
225
  }) => react_jsx_runtime.JSX.Element;
226
226
 
227
227
  declare const buttonVariants: (props?: ({
228
- variant?: "primary" | "danger" | "warning" | "secondary" | "tertiary" | "link" | "navigation" | null | undefined;
228
+ variant?: "link" | "primary" | "danger" | "warning" | "secondary" | "tertiary" | "navigation" | null | undefined;
229
229
  size?: "sm" | "md" | "lg" | null | undefined;
230
230
  } & class_variance_authority_types.ClassProp) | undefined) => string;
231
231
  type ButtonBaseProps = Omit<React$1.ButtonHTMLAttributes<HTMLButtonElement>, 'prefix'>;
@@ -951,11 +951,12 @@ interface TabsProps {
951
951
  }[];
952
952
  className?: string;
953
953
  tabsListBackground?: 'transparent' | 'filled';
954
+ value?: string;
954
955
  defaultValue?: string;
955
956
  onValueChange?: (value: string) => void;
956
957
  staticRender?: boolean;
957
958
  }
958
- declare const Tabs: ({ items, className, tabsListBackground, defaultValue, onValueChange, staticRender, }: TabsProps) => react_jsx_runtime.JSX.Element;
959
+ declare const Tabs: ({ items, className, tabsListBackground, value, defaultValue, onValueChange, staticRender, }: TabsProps) => react_jsx_runtime.JSX.Element;
959
960
 
960
961
  declare const Textarea: React$1.ForwardRefExoticComponent<Omit<React$1.DetailedHTMLProps<React$1.TextareaHTMLAttributes<HTMLTextAreaElement>, HTMLTextAreaElement>, "ref"> & React$1.RefAttributes<HTMLTextAreaElement>>;
961
962
 
package/dist/index.d.ts CHANGED
@@ -45,14 +45,14 @@ declare const AlertDialogFooter: {
45
45
  declare const AlertDialogTitle: React$1.ForwardRefExoticComponent<Omit<AlertDialogPrimitive.AlertDialogTitleProps & React$1.RefAttributes<HTMLHeadingElement>, "ref"> & React$1.RefAttributes<HTMLHeadingElement>>;
46
46
  declare const AlertDialogDescription: React$1.ForwardRefExoticComponent<Omit<AlertDialogPrimitive.AlertDialogDescriptionProps & React$1.RefAttributes<HTMLParagraphElement>, "ref"> & React$1.RefAttributes<HTMLParagraphElement>>;
47
47
  declare const AlertDialogAction: React$1.ForwardRefExoticComponent<Omit<Omit<AlertDialogPrimitive.AlertDialogActionProps & React$1.RefAttributes<HTMLButtonElement>, "ref">, "prefix"> & VariantProps<(props?: ({
48
- variant?: "primary" | "danger" | "warning" | "secondary" | "tertiary" | "link" | "navigation" | null | undefined;
48
+ variant?: "link" | "primary" | "danger" | "warning" | "secondary" | "tertiary" | "navigation" | null | undefined;
49
49
  size?: "sm" | "md" | "lg" | null | undefined;
50
50
  } & class_variance_authority_types.ClassProp) | undefined) => string> & {
51
51
  prefix?: React$1.ReactNode;
52
52
  suffix?: React$1.ReactNode;
53
53
  } & React$1.RefAttributes<HTMLButtonElement>>;
54
54
  declare const AlertDialogCancel: React$1.ForwardRefExoticComponent<Omit<Omit<AlertDialogPrimitive.AlertDialogCancelProps & React$1.RefAttributes<HTMLButtonElement>, "ref">, "prefix"> & VariantProps<(props?: ({
55
- variant?: "primary" | "danger" | "warning" | "secondary" | "tertiary" | "link" | "navigation" | null | undefined;
55
+ variant?: "link" | "primary" | "danger" | "warning" | "secondary" | "tertiary" | "navigation" | null | undefined;
56
56
  size?: "sm" | "md" | "lg" | null | undefined;
57
57
  } & class_variance_authority_types.ClassProp) | undefined) => string> & {
58
58
  prefix?: React$1.ReactNode;
@@ -225,7 +225,7 @@ declare const BgGradient: ({ theme, placement, }: {
225
225
  }) => react_jsx_runtime.JSX.Element;
226
226
 
227
227
  declare const buttonVariants: (props?: ({
228
- variant?: "primary" | "danger" | "warning" | "secondary" | "tertiary" | "link" | "navigation" | null | undefined;
228
+ variant?: "link" | "primary" | "danger" | "warning" | "secondary" | "tertiary" | "navigation" | null | undefined;
229
229
  size?: "sm" | "md" | "lg" | null | undefined;
230
230
  } & class_variance_authority_types.ClassProp) | undefined) => string;
231
231
  type ButtonBaseProps = Omit<React$1.ButtonHTMLAttributes<HTMLButtonElement>, 'prefix'>;
@@ -951,11 +951,12 @@ interface TabsProps {
951
951
  }[];
952
952
  className?: string;
953
953
  tabsListBackground?: 'transparent' | 'filled';
954
+ value?: string;
954
955
  defaultValue?: string;
955
956
  onValueChange?: (value: string) => void;
956
957
  staticRender?: boolean;
957
958
  }
958
- declare const Tabs: ({ items, className, tabsListBackground, defaultValue, onValueChange, staticRender, }: TabsProps) => react_jsx_runtime.JSX.Element;
959
+ declare const Tabs: ({ items, className, tabsListBackground, value, defaultValue, onValueChange, staticRender, }: TabsProps) => react_jsx_runtime.JSX.Element;
959
960
 
960
961
  declare const Textarea: React$1.ForwardRefExoticComponent<Omit<React$1.DetailedHTMLProps<React$1.TextareaHTMLAttributes<HTMLTextAreaElement>, HTMLTextAreaElement>, "ref"> & React$1.RefAttributes<HTMLTextAreaElement>>;
961
962
 
package/dist/index.js CHANGED
@@ -4194,11 +4194,13 @@ var Tabs = ({
4194
4194
  items,
4195
4195
  className,
4196
4196
  tabsListBackground = "transparent",
4197
+ value,
4197
4198
  defaultValue,
4198
4199
  onValueChange,
4199
4200
  staticRender = false
4200
4201
  }) => {
4201
- const [activeTab, setActiveTab] = useState(defaultValue ?? items[0].value);
4202
+ const [uncontrolledTab, setUncontrolledTab] = useState(defaultValue ?? items[0].value);
4203
+ const activeTab = value ?? uncontrolledTab;
4202
4204
  const isFilled = tabsListBackground === "filled";
4203
4205
  const listRef = useRef(null);
4204
4206
  const triggerRefs = useRef({});
@@ -4237,8 +4239,14 @@ var Tabs = ({
4237
4239
  }
4238
4240
  return () => observer.disconnect();
4239
4241
  }, [updateIndicator, itemValues, staticRender]);
4242
+ const requestedTab = useRef(null);
4240
4243
  const handleValueChange = (newTab) => {
4241
- setActiveTab(newTab);
4244
+ if (newTab === requestedTab.current) return;
4245
+ requestedTab.current = newTab;
4246
+ setTimeout(() => {
4247
+ requestedTab.current = null;
4248
+ });
4249
+ if (value === void 0) setUncontrolledTab(newTab);
4242
4250
  onValueChange?.(newTab);
4243
4251
  };
4244
4252
  const renderIcon = (icon) => {
@@ -4251,7 +4259,7 @@ var Tabs = ({
4251
4259
  styles58["active-tab-indicator"],
4252
4260
  isFilled ? styles58["active-tab-indicator--filled"] : styles58["active-tab-indicator--transparent"]
4253
4261
  );
4254
- const renderTriggerIndicator = (value) => {
4262
+ const renderTriggerIndicator = (value2) => {
4255
4263
  if (staticRender) {
4256
4264
  return /* @__PURE__ */ jsx(
4257
4265
  "span",
@@ -4262,7 +4270,7 @@ var Tabs = ({
4262
4270
  }
4263
4271
  );
4264
4272
  }
4265
- if (!indicator && value === activeTab) {
4273
+ if (!indicator && value2 === activeTab) {
4266
4274
  return /* @__PURE__ */ jsx("span", { "aria-hidden": true, "data-slot": "tabs-indicator", className: indicatorClass });
4267
4275
  }
4268
4276
  return null;
@@ -4283,16 +4291,16 @@ var Tabs = ({
4283
4291
  isFilled ? styles58["tabs-list--filled"] : styles58["tabs-list--transparent"]
4284
4292
  ),
4285
4293
  children: [
4286
- items.map(({ label, value, icon, suffix, triggerProps }) => {
4294
+ items.map(({ label, value: value2, icon, suffix, triggerProps }) => {
4287
4295
  return /* @__PURE__ */ createElement(
4288
4296
  TabsTrigger,
4289
4297
  {
4290
4298
  ...triggerProps,
4291
- key: value,
4299
+ key: value2,
4292
4300
  ref: (el) => {
4293
- triggerRefs.current[value] = el;
4301
+ triggerRefs.current[value2] = el;
4294
4302
  },
4295
- value,
4303
+ value: value2,
4296
4304
  className: cn(
4297
4305
  styles58["tabs-trigger"],
4298
4306
  isFilled ? styles58["tabs-trigger--filled"] : styles58["tabs-trigger--transparent"],
@@ -4302,7 +4310,7 @@ var Tabs = ({
4302
4310
  renderIcon(icon),
4303
4311
  label,
4304
4312
  suffix,
4305
- renderTriggerIndicator(value)
4313
+ renderTriggerIndicator(value2)
4306
4314
  );
4307
4315
  }),
4308
4316
  !staticRender && indicator && /* @__PURE__ */ jsx(
@@ -4325,15 +4333,15 @@ var Tabs = ({
4325
4333
  ]
4326
4334
  }
4327
4335
  ),
4328
- items.map(({ value, content }) => /* @__PURE__ */ jsx(
4336
+ items.map(({ value: value2, content }) => /* @__PURE__ */ jsx(
4329
4337
  TabsContent,
4330
4338
  {
4331
- value,
4339
+ value: value2,
4332
4340
  className: styles58["content"],
4333
4341
  forceMount: staticRender || void 0,
4334
4342
  children: content
4335
4343
  },
4336
- value
4344
+ value2
4337
4345
  ))
4338
4346
  ]
4339
4347
  }