@eqtylab/equality 4.10.2 → 4.12.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 +70 -0
- package/dist/badge.module.module.css.module.css +8 -3
- package/dist/button.module.module.css.module.css +155 -91
- package/dist/date-range-picker.module.module.css.module.css +32 -5
- package/dist/index.cjs +93 -34
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -2
- package/dist/index.d.ts +3 -2
- package/dist/index.js +93 -34
- package/dist/index.js.map +1 -1
- package/dist/segmented-controls.module.module.css.module.css +85 -59
- package/dist/tabs-components.module.module.css.module.css +17 -1
- package/dist/tabs.module.module.css.module.css +132 -5
- package/dist/theme-base.css +35 -0
- package/dist/theme-utilities.css +39 -0
- package/dist/theme.module.module.css.module.css +16 -0
- package/dist/toast-components.module.module.css.module.css +6 -7
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -214,10 +214,10 @@ function cn(...inputs) {
|
|
|
214
214
|
var buttonVariants = classVarianceAuthority.cva(styles__default.default["button"], {
|
|
215
215
|
variants: {
|
|
216
216
|
variant: {
|
|
217
|
-
primary: styles__default.default["button--primary"],
|
|
218
|
-
danger: styles__default.default["button--danger"],
|
|
219
|
-
warning: styles__default.default["button--warning"],
|
|
220
|
-
secondary: styles__default.default["button--secondary"],
|
|
217
|
+
primary: [styles__default.default["button--filled"], styles__default.default["button--primary"]],
|
|
218
|
+
danger: [styles__default.default["button--filled"], styles__default.default["button--danger"]],
|
|
219
|
+
warning: [styles__default.default["button--filled"], styles__default.default["button--warning"]],
|
|
220
|
+
secondary: [styles__default.default["button--filled"], styles__default.default["button--secondary"]],
|
|
221
221
|
tertiary: styles__default.default["button--tertiary"],
|
|
222
222
|
link: styles__default.default["button--link"],
|
|
223
223
|
navigation: styles__default.default["button--navigation"]
|
|
@@ -3932,6 +3932,7 @@ var SectionHeading = ({
|
|
|
3932
3932
|
hasRightContent && renderRightContent()
|
|
3933
3933
|
] });
|
|
3934
3934
|
};
|
|
3935
|
+
var useIsomorphicLayoutEffect = typeof window === "undefined" ? React15.useEffect : React15.useLayoutEffect;
|
|
3935
3936
|
var SegmentedControls = ({
|
|
3936
3937
|
options,
|
|
3937
3938
|
value,
|
|
@@ -3959,14 +3960,14 @@ var SegmentedControls = ({
|
|
|
3959
3960
|
setIndicator({ left: activeSegment.offsetLeft, width: activeSegment.offsetWidth });
|
|
3960
3961
|
}
|
|
3961
3962
|
}, [value]);
|
|
3962
|
-
|
|
3963
|
+
useIsomorphicLayoutEffect(() => {
|
|
3963
3964
|
updateIndicator();
|
|
3964
3965
|
}, [updateIndicator, options, effectiveDisplay, size]);
|
|
3965
3966
|
React15.useEffect(() => {
|
|
3966
3967
|
const frame = requestAnimationFrame(() => setAnimateIndicator(true));
|
|
3967
3968
|
return () => cancelAnimationFrame(frame);
|
|
3968
3969
|
}, []);
|
|
3969
|
-
|
|
3970
|
+
useIsomorphicLayoutEffect(() => {
|
|
3970
3971
|
const container = containerRef.current;
|
|
3971
3972
|
if (!container) return;
|
|
3972
3973
|
const observer = new ResizeObserver(updateIndicator);
|
|
@@ -4293,7 +4294,6 @@ TabsTrigger.displayName = TabsPrimitive__namespace.Trigger.displayName;
|
|
|
4293
4294
|
var TabsContent = React15__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(TabsPrimitive__namespace.Content, { ref, className: cn(styles57__default.default["tabs-content"], className), ...props }));
|
|
4294
4295
|
TabsContent.displayName = TabsPrimitive__namespace.Content.displayName;
|
|
4295
4296
|
var Tabs = ({
|
|
4296
|
-
id,
|
|
4297
4297
|
items,
|
|
4298
4298
|
className,
|
|
4299
4299
|
tabsListBackground = "transparent",
|
|
@@ -4303,6 +4303,43 @@ var Tabs = ({
|
|
|
4303
4303
|
}) => {
|
|
4304
4304
|
const [activeTab, setActiveTab] = React15.useState(defaultValue ?? items[0].value);
|
|
4305
4305
|
const isFilled = tabsListBackground === "filled";
|
|
4306
|
+
const listRef = React15.useRef(null);
|
|
4307
|
+
const triggerRefs = React15.useRef({});
|
|
4308
|
+
const [indicator, setIndicator] = React15.useState(null);
|
|
4309
|
+
const [animateIndicator, setAnimateIndicator] = React15.useState(false);
|
|
4310
|
+
const itemValues = items.map((item) => item.value).join("\0");
|
|
4311
|
+
const updateIndicator = React15.useCallback(() => {
|
|
4312
|
+
const activeTrigger = triggerRefs.current[activeTab];
|
|
4313
|
+
const width = activeTrigger?.offsetWidth ?? 0;
|
|
4314
|
+
if (!activeTrigger || width === 0) {
|
|
4315
|
+
setIndicator(null);
|
|
4316
|
+
return;
|
|
4317
|
+
}
|
|
4318
|
+
const left = activeTrigger.offsetLeft;
|
|
4319
|
+
setIndicator((previous) => {
|
|
4320
|
+
if (previous?.left === left && previous.width === width) return previous;
|
|
4321
|
+
const hops = previous ? Math.abs(left + width / 2 - (previous.left + previous.width / 2)) / ((width + previous.width) / 2) : 0;
|
|
4322
|
+
const duration = Math.min(400, Math.max(250, 250 + (hops - 1) * 100));
|
|
4323
|
+
return { left, width, duration };
|
|
4324
|
+
});
|
|
4325
|
+
}, [activeTab]);
|
|
4326
|
+
useIsomorphicLayoutEffect(() => {
|
|
4327
|
+
if (!staticRender) updateIndicator();
|
|
4328
|
+
}, [updateIndicator, itemValues, staticRender]);
|
|
4329
|
+
React15.useEffect(() => {
|
|
4330
|
+
const frame = requestAnimationFrame(() => setAnimateIndicator(true));
|
|
4331
|
+
return () => cancelAnimationFrame(frame);
|
|
4332
|
+
}, []);
|
|
4333
|
+
useIsomorphicLayoutEffect(() => {
|
|
4334
|
+
const list = listRef.current;
|
|
4335
|
+
if (!list || staticRender) return;
|
|
4336
|
+
const observer = new ResizeObserver(updateIndicator);
|
|
4337
|
+
observer.observe(list);
|
|
4338
|
+
for (const trigger of Object.values(triggerRefs.current)) {
|
|
4339
|
+
if (trigger) observer.observe(trigger);
|
|
4340
|
+
}
|
|
4341
|
+
return () => observer.disconnect();
|
|
4342
|
+
}, [updateIndicator, itemValues, staticRender]);
|
|
4306
4343
|
const handleValueChange = (newTab) => {
|
|
4307
4344
|
setActiveTab(newTab);
|
|
4308
4345
|
onValueChange?.(newTab);
|
|
@@ -4317,20 +4354,20 @@ var Tabs = ({
|
|
|
4317
4354
|
styles58__default.default["active-tab-indicator"],
|
|
4318
4355
|
isFilled ? styles58__default.default["active-tab-indicator--filled"] : styles58__default.default["active-tab-indicator--transparent"]
|
|
4319
4356
|
);
|
|
4320
|
-
const
|
|
4357
|
+
const renderTriggerIndicator = (value) => {
|
|
4321
4358
|
if (staticRender) {
|
|
4322
|
-
return /* @__PURE__ */ jsxRuntime.jsx("span", { className: cn(indicatorClass, styles58__default.default["active-tab-indicator--static"]) });
|
|
4323
|
-
}
|
|
4324
|
-
if (isActive) {
|
|
4325
4359
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
4326
|
-
|
|
4360
|
+
"span",
|
|
4327
4361
|
{
|
|
4328
|
-
|
|
4329
|
-
|
|
4330
|
-
|
|
4362
|
+
"aria-hidden": true,
|
|
4363
|
+
"data-slot": "tabs-indicator",
|
|
4364
|
+
className: cn(indicatorClass, styles58__default.default["active-tab-indicator--static"])
|
|
4331
4365
|
}
|
|
4332
4366
|
);
|
|
4333
4367
|
}
|
|
4368
|
+
if (!indicator && value === activeTab) {
|
|
4369
|
+
return /* @__PURE__ */ jsxRuntime.jsx("span", { "aria-hidden": true, "data-slot": "tabs-indicator", className: indicatorClass });
|
|
4370
|
+
}
|
|
4334
4371
|
return null;
|
|
4335
4372
|
};
|
|
4336
4373
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
@@ -4340,33 +4377,55 @@ var Tabs = ({
|
|
|
4340
4377
|
onValueChange: handleValueChange,
|
|
4341
4378
|
className: cn(styles58__default.default["tabs"], className),
|
|
4342
4379
|
children: [
|
|
4343
|
-
/* @__PURE__ */ jsxRuntime.
|
|
4380
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
4344
4381
|
TabsList,
|
|
4345
4382
|
{
|
|
4383
|
+
ref: listRef,
|
|
4346
4384
|
className: cn(
|
|
4347
4385
|
styles58__default.default["tabs-list"],
|
|
4348
4386
|
isFilled ? styles58__default.default["tabs-list--filled"] : styles58__default.default["tabs-list--transparent"]
|
|
4349
4387
|
),
|
|
4350
|
-
children:
|
|
4351
|
-
|
|
4352
|
-
|
|
4353
|
-
|
|
4388
|
+
children: [
|
|
4389
|
+
items.map(({ label, value, icon, suffix, triggerProps }) => {
|
|
4390
|
+
return /* @__PURE__ */ React15.createElement(
|
|
4391
|
+
TabsTrigger,
|
|
4392
|
+
{
|
|
4393
|
+
...triggerProps,
|
|
4394
|
+
key: value,
|
|
4395
|
+
ref: (el) => {
|
|
4396
|
+
triggerRefs.current[value] = el;
|
|
4397
|
+
},
|
|
4398
|
+
value,
|
|
4399
|
+
className: cn(
|
|
4400
|
+
styles58__default.default["tabs-trigger"],
|
|
4401
|
+
isFilled ? styles58__default.default["tabs-trigger--filled"] : styles58__default.default["tabs-trigger--transparent"],
|
|
4402
|
+
triggerProps?.className
|
|
4403
|
+
)
|
|
4404
|
+
},
|
|
4405
|
+
renderIcon(icon),
|
|
4406
|
+
label,
|
|
4407
|
+
suffix,
|
|
4408
|
+
renderTriggerIndicator(value)
|
|
4409
|
+
);
|
|
4410
|
+
}),
|
|
4411
|
+
!staticRender && indicator && /* @__PURE__ */ jsxRuntime.jsx(
|
|
4412
|
+
"span",
|
|
4354
4413
|
{
|
|
4355
|
-
|
|
4356
|
-
|
|
4357
|
-
value,
|
|
4414
|
+
"aria-hidden": true,
|
|
4415
|
+
"data-slot": "tabs-indicator",
|
|
4358
4416
|
className: cn(
|
|
4359
|
-
|
|
4360
|
-
|
|
4361
|
-
|
|
4362
|
-
)
|
|
4363
|
-
|
|
4364
|
-
|
|
4365
|
-
|
|
4366
|
-
|
|
4367
|
-
|
|
4368
|
-
|
|
4369
|
-
|
|
4417
|
+
indicatorClass,
|
|
4418
|
+
styles58__default.default["active-tab-indicator--shared"],
|
|
4419
|
+
animateIndicator && styles58__default.default["active-tab-indicator--animated"]
|
|
4420
|
+
),
|
|
4421
|
+
style: {
|
|
4422
|
+
transform: `translateX(${indicator.left}px)`,
|
|
4423
|
+
"--indicator-width": `${indicator.width}px`,
|
|
4424
|
+
"--indicator-duration": `${indicator.duration}ms`
|
|
4425
|
+
}
|
|
4426
|
+
}
|
|
4427
|
+
)
|
|
4428
|
+
]
|
|
4370
4429
|
}
|
|
4371
4430
|
),
|
|
4372
4431
|
items.map(({ value, content }) => /* @__PURE__ */ jsxRuntime.jsx(
|