@eqtylab/equality 4.11.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/CHANGELOG.md +53 -0
- package/dist/index.cjs +102 -35
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +7 -5
- package/dist/index.d.ts +7 -5
- package/dist/index.js +102 -35
- package/dist/index.js.map +1 -1
- package/dist/segmented-controls.module.module.css.module.css +52 -41
- package/dist/tabs-components.module.module.css.module.css +17 -1
- package/dist/tabs.module.module.css.module.css +132 -5
- package/dist/theme-utilities.css +39 -0
- package/dist/theme.module.module.css.module.css +7 -0
- package/package.json +1 -1
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" | "
|
|
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" | "
|
|
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" | "
|
|
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'>;
|
|
@@ -937,7 +937,8 @@ declare const TabsTrigger: React$1.ForwardRefExoticComponent<Omit<TabsPrimitive.
|
|
|
937
937
|
declare const TabsContent: React$1.ForwardRefExoticComponent<Omit<TabsPrimitive.TabsContentProps & React$1.RefAttributes<HTMLDivElement>, "ref"> & React$1.RefAttributes<HTMLDivElement>>;
|
|
938
938
|
|
|
939
939
|
interface TabsProps {
|
|
940
|
-
|
|
940
|
+
/** @deprecated No longer used. The active indicator is positioned without it. */
|
|
941
|
+
id?: string;
|
|
941
942
|
items: {
|
|
942
943
|
label: string;
|
|
943
944
|
value: string;
|
|
@@ -950,11 +951,12 @@ interface TabsProps {
|
|
|
950
951
|
}[];
|
|
951
952
|
className?: string;
|
|
952
953
|
tabsListBackground?: 'transparent' | 'filled';
|
|
954
|
+
value?: string;
|
|
953
955
|
defaultValue?: string;
|
|
954
956
|
onValueChange?: (value: string) => void;
|
|
955
957
|
staticRender?: boolean;
|
|
956
958
|
}
|
|
957
|
-
declare const Tabs: ({
|
|
959
|
+
declare const Tabs: ({ items, className, tabsListBackground, value, defaultValue, onValueChange, staticRender, }: TabsProps) => react_jsx_runtime.JSX.Element;
|
|
958
960
|
|
|
959
961
|
declare const Textarea: React$1.ForwardRefExoticComponent<Omit<React$1.DetailedHTMLProps<React$1.TextareaHTMLAttributes<HTMLTextAreaElement>, HTMLTextAreaElement>, "ref"> & React$1.RefAttributes<HTMLTextAreaElement>>;
|
|
960
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" | "
|
|
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" | "
|
|
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" | "
|
|
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'>;
|
|
@@ -937,7 +937,8 @@ declare const TabsTrigger: React$1.ForwardRefExoticComponent<Omit<TabsPrimitive.
|
|
|
937
937
|
declare const TabsContent: React$1.ForwardRefExoticComponent<Omit<TabsPrimitive.TabsContentProps & React$1.RefAttributes<HTMLDivElement>, "ref"> & React$1.RefAttributes<HTMLDivElement>>;
|
|
938
938
|
|
|
939
939
|
interface TabsProps {
|
|
940
|
-
|
|
940
|
+
/** @deprecated No longer used. The active indicator is positioned without it. */
|
|
941
|
+
id?: string;
|
|
941
942
|
items: {
|
|
942
943
|
label: string;
|
|
943
944
|
value: string;
|
|
@@ -950,11 +951,12 @@ interface TabsProps {
|
|
|
950
951
|
}[];
|
|
951
952
|
className?: string;
|
|
952
953
|
tabsListBackground?: 'transparent' | 'filled';
|
|
954
|
+
value?: string;
|
|
953
955
|
defaultValue?: string;
|
|
954
956
|
onValueChange?: (value: string) => void;
|
|
955
957
|
staticRender?: boolean;
|
|
956
958
|
}
|
|
957
|
-
declare const Tabs: ({
|
|
959
|
+
declare const Tabs: ({ items, className, tabsListBackground, value, defaultValue, onValueChange, staticRender, }: TabsProps) => react_jsx_runtime.JSX.Element;
|
|
958
960
|
|
|
959
961
|
declare const Textarea: React$1.ForwardRefExoticComponent<Omit<React$1.DetailedHTMLProps<React$1.TextareaHTMLAttributes<HTMLTextAreaElement>, HTMLTextAreaElement>, "ref"> & React$1.RefAttributes<HTMLTextAreaElement>>;
|
|
960
962
|
|
package/dist/index.js
CHANGED
|
@@ -3829,6 +3829,7 @@ var SectionHeading = ({
|
|
|
3829
3829
|
hasRightContent && renderRightContent()
|
|
3830
3830
|
] });
|
|
3831
3831
|
};
|
|
3832
|
+
var useIsomorphicLayoutEffect = typeof window === "undefined" ? useEffect : useLayoutEffect;
|
|
3832
3833
|
var SegmentedControls = ({
|
|
3833
3834
|
options,
|
|
3834
3835
|
value,
|
|
@@ -3856,14 +3857,14 @@ var SegmentedControls = ({
|
|
|
3856
3857
|
setIndicator({ left: activeSegment.offsetLeft, width: activeSegment.offsetWidth });
|
|
3857
3858
|
}
|
|
3858
3859
|
}, [value]);
|
|
3859
|
-
|
|
3860
|
+
useIsomorphicLayoutEffect(() => {
|
|
3860
3861
|
updateIndicator();
|
|
3861
3862
|
}, [updateIndicator, options, effectiveDisplay, size]);
|
|
3862
3863
|
useEffect(() => {
|
|
3863
3864
|
const frame = requestAnimationFrame(() => setAnimateIndicator(true));
|
|
3864
3865
|
return () => cancelAnimationFrame(frame);
|
|
3865
3866
|
}, []);
|
|
3866
|
-
|
|
3867
|
+
useIsomorphicLayoutEffect(() => {
|
|
3867
3868
|
const container = containerRef.current;
|
|
3868
3869
|
if (!container) return;
|
|
3869
3870
|
const observer = new ResizeObserver(updateIndicator);
|
|
@@ -4190,18 +4191,62 @@ TabsTrigger.displayName = TabsPrimitive.Trigger.displayName;
|
|
|
4190
4191
|
var TabsContent = React15.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(TabsPrimitive.Content, { ref, className: cn(styles57["tabs-content"], className), ...props }));
|
|
4191
4192
|
TabsContent.displayName = TabsPrimitive.Content.displayName;
|
|
4192
4193
|
var Tabs = ({
|
|
4193
|
-
id,
|
|
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 [
|
|
4202
|
+
const [uncontrolledTab, setUncontrolledTab] = useState(defaultValue ?? items[0].value);
|
|
4203
|
+
const activeTab = value ?? uncontrolledTab;
|
|
4202
4204
|
const isFilled = tabsListBackground === "filled";
|
|
4205
|
+
const listRef = useRef(null);
|
|
4206
|
+
const triggerRefs = useRef({});
|
|
4207
|
+
const [indicator, setIndicator] = useState(null);
|
|
4208
|
+
const [animateIndicator, setAnimateIndicator] = useState(false);
|
|
4209
|
+
const itemValues = items.map((item) => item.value).join("\0");
|
|
4210
|
+
const updateIndicator = useCallback(() => {
|
|
4211
|
+
const activeTrigger = triggerRefs.current[activeTab];
|
|
4212
|
+
const width = activeTrigger?.offsetWidth ?? 0;
|
|
4213
|
+
if (!activeTrigger || width === 0) {
|
|
4214
|
+
setIndicator(null);
|
|
4215
|
+
return;
|
|
4216
|
+
}
|
|
4217
|
+
const left = activeTrigger.offsetLeft;
|
|
4218
|
+
setIndicator((previous) => {
|
|
4219
|
+
if (previous?.left === left && previous.width === width) return previous;
|
|
4220
|
+
const hops = previous ? Math.abs(left + width / 2 - (previous.left + previous.width / 2)) / ((width + previous.width) / 2) : 0;
|
|
4221
|
+
const duration = Math.min(400, Math.max(250, 250 + (hops - 1) * 100));
|
|
4222
|
+
return { left, width, duration };
|
|
4223
|
+
});
|
|
4224
|
+
}, [activeTab]);
|
|
4225
|
+
useIsomorphicLayoutEffect(() => {
|
|
4226
|
+
if (!staticRender) updateIndicator();
|
|
4227
|
+
}, [updateIndicator, itemValues, staticRender]);
|
|
4228
|
+
useEffect(() => {
|
|
4229
|
+
const frame = requestAnimationFrame(() => setAnimateIndicator(true));
|
|
4230
|
+
return () => cancelAnimationFrame(frame);
|
|
4231
|
+
}, []);
|
|
4232
|
+
useIsomorphicLayoutEffect(() => {
|
|
4233
|
+
const list = listRef.current;
|
|
4234
|
+
if (!list || staticRender) return;
|
|
4235
|
+
const observer = new ResizeObserver(updateIndicator);
|
|
4236
|
+
observer.observe(list);
|
|
4237
|
+
for (const trigger of Object.values(triggerRefs.current)) {
|
|
4238
|
+
if (trigger) observer.observe(trigger);
|
|
4239
|
+
}
|
|
4240
|
+
return () => observer.disconnect();
|
|
4241
|
+
}, [updateIndicator, itemValues, staticRender]);
|
|
4242
|
+
const requestedTab = useRef(null);
|
|
4203
4243
|
const handleValueChange = (newTab) => {
|
|
4204
|
-
|
|
4244
|
+
if (newTab === requestedTab.current) return;
|
|
4245
|
+
requestedTab.current = newTab;
|
|
4246
|
+
setTimeout(() => {
|
|
4247
|
+
requestedTab.current = null;
|
|
4248
|
+
});
|
|
4249
|
+
if (value === void 0) setUncontrolledTab(newTab);
|
|
4205
4250
|
onValueChange?.(newTab);
|
|
4206
4251
|
};
|
|
4207
4252
|
const renderIcon = (icon) => {
|
|
@@ -4214,20 +4259,20 @@ var Tabs = ({
|
|
|
4214
4259
|
styles58["active-tab-indicator"],
|
|
4215
4260
|
isFilled ? styles58["active-tab-indicator--filled"] : styles58["active-tab-indicator--transparent"]
|
|
4216
4261
|
);
|
|
4217
|
-
const
|
|
4262
|
+
const renderTriggerIndicator = (value2) => {
|
|
4218
4263
|
if (staticRender) {
|
|
4219
|
-
return /* @__PURE__ */ jsx("span", { className: cn(indicatorClass, styles58["active-tab-indicator--static"]) });
|
|
4220
|
-
}
|
|
4221
|
-
if (isActive) {
|
|
4222
4264
|
return /* @__PURE__ */ jsx(
|
|
4223
|
-
|
|
4265
|
+
"span",
|
|
4224
4266
|
{
|
|
4225
|
-
|
|
4226
|
-
|
|
4227
|
-
|
|
4267
|
+
"aria-hidden": true,
|
|
4268
|
+
"data-slot": "tabs-indicator",
|
|
4269
|
+
className: cn(indicatorClass, styles58["active-tab-indicator--static"])
|
|
4228
4270
|
}
|
|
4229
4271
|
);
|
|
4230
4272
|
}
|
|
4273
|
+
if (!indicator && value2 === activeTab) {
|
|
4274
|
+
return /* @__PURE__ */ jsx("span", { "aria-hidden": true, "data-slot": "tabs-indicator", className: indicatorClass });
|
|
4275
|
+
}
|
|
4231
4276
|
return null;
|
|
4232
4277
|
};
|
|
4233
4278
|
return /* @__PURE__ */ jsxs(
|
|
@@ -4237,44 +4282,66 @@ var Tabs = ({
|
|
|
4237
4282
|
onValueChange: handleValueChange,
|
|
4238
4283
|
className: cn(styles58["tabs"], className),
|
|
4239
4284
|
children: [
|
|
4240
|
-
/* @__PURE__ */
|
|
4285
|
+
/* @__PURE__ */ jsxs(
|
|
4241
4286
|
TabsList,
|
|
4242
4287
|
{
|
|
4288
|
+
ref: listRef,
|
|
4243
4289
|
className: cn(
|
|
4244
4290
|
styles58["tabs-list"],
|
|
4245
4291
|
isFilled ? styles58["tabs-list--filled"] : styles58["tabs-list--transparent"]
|
|
4246
4292
|
),
|
|
4247
|
-
children:
|
|
4248
|
-
|
|
4249
|
-
|
|
4250
|
-
|
|
4293
|
+
children: [
|
|
4294
|
+
items.map(({ label, value: value2, icon, suffix, triggerProps }) => {
|
|
4295
|
+
return /* @__PURE__ */ createElement(
|
|
4296
|
+
TabsTrigger,
|
|
4297
|
+
{
|
|
4298
|
+
...triggerProps,
|
|
4299
|
+
key: value2,
|
|
4300
|
+
ref: (el) => {
|
|
4301
|
+
triggerRefs.current[value2] = el;
|
|
4302
|
+
},
|
|
4303
|
+
value: value2,
|
|
4304
|
+
className: cn(
|
|
4305
|
+
styles58["tabs-trigger"],
|
|
4306
|
+
isFilled ? styles58["tabs-trigger--filled"] : styles58["tabs-trigger--transparent"],
|
|
4307
|
+
triggerProps?.className
|
|
4308
|
+
)
|
|
4309
|
+
},
|
|
4310
|
+
renderIcon(icon),
|
|
4311
|
+
label,
|
|
4312
|
+
suffix,
|
|
4313
|
+
renderTriggerIndicator(value2)
|
|
4314
|
+
);
|
|
4315
|
+
}),
|
|
4316
|
+
!staticRender && indicator && /* @__PURE__ */ jsx(
|
|
4317
|
+
"span",
|
|
4251
4318
|
{
|
|
4252
|
-
|
|
4253
|
-
|
|
4254
|
-
value,
|
|
4319
|
+
"aria-hidden": true,
|
|
4320
|
+
"data-slot": "tabs-indicator",
|
|
4255
4321
|
className: cn(
|
|
4256
|
-
|
|
4257
|
-
|
|
4258
|
-
|
|
4259
|
-
)
|
|
4260
|
-
|
|
4261
|
-
|
|
4262
|
-
|
|
4263
|
-
|
|
4264
|
-
|
|
4265
|
-
|
|
4266
|
-
|
|
4322
|
+
indicatorClass,
|
|
4323
|
+
styles58["active-tab-indicator--shared"],
|
|
4324
|
+
animateIndicator && styles58["active-tab-indicator--animated"]
|
|
4325
|
+
),
|
|
4326
|
+
style: {
|
|
4327
|
+
transform: `translateX(${indicator.left}px)`,
|
|
4328
|
+
"--indicator-width": `${indicator.width}px`,
|
|
4329
|
+
"--indicator-duration": `${indicator.duration}ms`
|
|
4330
|
+
}
|
|
4331
|
+
}
|
|
4332
|
+
)
|
|
4333
|
+
]
|
|
4267
4334
|
}
|
|
4268
4335
|
),
|
|
4269
|
-
items.map(({ value, content }) => /* @__PURE__ */ jsx(
|
|
4336
|
+
items.map(({ value: value2, content }) => /* @__PURE__ */ jsx(
|
|
4270
4337
|
TabsContent,
|
|
4271
4338
|
{
|
|
4272
|
-
value,
|
|
4339
|
+
value: value2,
|
|
4273
4340
|
className: styles58["content"],
|
|
4274
4341
|
forceMount: staticRender || void 0,
|
|
4275
4342
|
children: content
|
|
4276
4343
|
},
|
|
4277
|
-
|
|
4344
|
+
value2
|
|
4278
4345
|
))
|
|
4279
4346
|
]
|
|
4280
4347
|
}
|