@sofya-ds/react 1.3.0 → 1.3.2
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.cjs +103 -22
- package/dist/index.d.cts +7 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +109 -27
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -332,6 +332,7 @@ var tablerIconRegistry = {
|
|
|
332
332
|
IconPlus: import_icons_react.IconPlus,
|
|
333
333
|
IconSchool: import_icons_react.IconSchool,
|
|
334
334
|
IconSearch: import_icons_react.IconSearch,
|
|
335
|
+
IconSquareToggle: import_icons_react.IconSquareToggle,
|
|
335
336
|
IconSparkles: import_icons_react.IconSparkles,
|
|
336
337
|
IconUser: import_icons_react.IconUser,
|
|
337
338
|
IconUserFilled: import_icons_react.IconUserFilled,
|
|
@@ -397,6 +398,8 @@ var legacyIconToTablerNameMap = {
|
|
|
397
398
|
"trash-filled": "IconTrashFilled",
|
|
398
399
|
"trash-off": "IconTrashOff",
|
|
399
400
|
"trash-x": "IconTrashX",
|
|
401
|
+
"square-toggle": "IconSquareToggle",
|
|
402
|
+
iconSquareToggle: "IconSquareToggle",
|
|
400
403
|
"delete": "IconTrash",
|
|
401
404
|
"remove": "IconTrashX",
|
|
402
405
|
"lixeira": "IconTrash",
|
|
@@ -4545,29 +4548,107 @@ var switchThumbSizeClasses = {
|
|
|
4545
4548
|
default: "h-5 w-5 data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0",
|
|
4546
4549
|
sm: "h-4 w-4 data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0"
|
|
4547
4550
|
};
|
|
4548
|
-
var Switch = React31.forwardRef(
|
|
4549
|
-
|
|
4550
|
-
|
|
4551
|
-
|
|
4552
|
-
|
|
4553
|
-
|
|
4554
|
-
|
|
4555
|
-
|
|
4556
|
-
|
|
4557
|
-
|
|
4558
|
-
|
|
4559
|
-
|
|
4560
|
-
|
|
4561
|
-
|
|
4562
|
-
|
|
4563
|
-
|
|
4564
|
-
|
|
4565
|
-
|
|
4566
|
-
|
|
4567
|
-
|
|
4551
|
+
var Switch = React31.forwardRef(
|
|
4552
|
+
({
|
|
4553
|
+
"aria-describedby": ariaDescribedBy,
|
|
4554
|
+
"aria-labelledby": ariaLabelledBy,
|
|
4555
|
+
className,
|
|
4556
|
+
containerClassName,
|
|
4557
|
+
description,
|
|
4558
|
+
descriptionClassName,
|
|
4559
|
+
disabled,
|
|
4560
|
+
id,
|
|
4561
|
+
label,
|
|
4562
|
+
labelClassName,
|
|
4563
|
+
size,
|
|
4564
|
+
...props
|
|
4565
|
+
}, ref) => {
|
|
4566
|
+
const generatedId = React31.useId();
|
|
4567
|
+
const resolvedId = id ?? generatedId;
|
|
4568
|
+
const labelId = label ? `${resolvedId}-label` : void 0;
|
|
4569
|
+
const descriptionId = description ? `${resolvedId}-description` : void 0;
|
|
4570
|
+
const hasTextContent = label !== void 0 || description !== void 0;
|
|
4571
|
+
const resolvedSize = size ?? (hasTextContent ? "sm" : "default");
|
|
4572
|
+
const alignClassName = description ? "items-start" : "items-center";
|
|
4573
|
+
const resolvedAriaDescribedBy = [ariaDescribedBy, descriptionId].filter(Boolean).join(" ") || void 0;
|
|
4574
|
+
const resolvedAriaLabelledBy = ariaLabelledBy ?? labelId;
|
|
4575
|
+
const switchControl = /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
4576
|
+
SwitchPrimitives.Root,
|
|
4577
|
+
{
|
|
4578
|
+
id: resolvedId,
|
|
4579
|
+
className: cn(
|
|
4580
|
+
"peer inline-flex shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors duration-sofya ease-sofya focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-muted",
|
|
4581
|
+
switchRootSizeClasses[resolvedSize],
|
|
4582
|
+
className
|
|
4583
|
+
),
|
|
4584
|
+
disabled,
|
|
4585
|
+
"aria-describedby": resolvedAriaDescribedBy,
|
|
4586
|
+
"aria-labelledby": resolvedAriaLabelledBy,
|
|
4587
|
+
"data-size": resolvedSize,
|
|
4588
|
+
...props,
|
|
4589
|
+
ref,
|
|
4590
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
4591
|
+
SwitchPrimitives.Thumb,
|
|
4592
|
+
{
|
|
4593
|
+
className: cn(
|
|
4594
|
+
"pointer-events-none block rounded-full bg-background shadow-sm ring-0 transition-transform duration-sofya ease-sofya",
|
|
4595
|
+
switchThumbSizeClasses[resolvedSize]
|
|
4596
|
+
)
|
|
4597
|
+
}
|
|
4598
|
+
)
|
|
4599
|
+
}
|
|
4600
|
+
);
|
|
4601
|
+
if (!hasTextContent) {
|
|
4602
|
+
return switchControl;
|
|
4568
4603
|
}
|
|
4569
|
-
|
|
4570
|
-
|
|
4604
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
|
|
4605
|
+
"div",
|
|
4606
|
+
{
|
|
4607
|
+
"data-slot": "switch-container",
|
|
4608
|
+
className: selectionControlContainerClasses({
|
|
4609
|
+
alignClassName,
|
|
4610
|
+
className: containerClassName,
|
|
4611
|
+
disabled
|
|
4612
|
+
}),
|
|
4613
|
+
children: [
|
|
4614
|
+
switchControl,
|
|
4615
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("span", { className: selectionControlContentBaseClasses, children: [
|
|
4616
|
+
label ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("label", { htmlFor: resolvedId, className: selectionControlLabelTextBaseClasses, children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
4617
|
+
"span",
|
|
4618
|
+
{
|
|
4619
|
+
id: labelId,
|
|
4620
|
+
className: cn(
|
|
4621
|
+
selectionControlLabelTextBaseClasses,
|
|
4622
|
+
labelClassName
|
|
4623
|
+
),
|
|
4624
|
+
children: renderTextContent(label, {
|
|
4625
|
+
as: "span",
|
|
4626
|
+
className: "text-[color:var(--sofya-text-default)]",
|
|
4627
|
+
size: "body"
|
|
4628
|
+
})
|
|
4629
|
+
}
|
|
4630
|
+
) }) : null,
|
|
4631
|
+
description ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
4632
|
+
"span",
|
|
4633
|
+
{
|
|
4634
|
+
id: descriptionId,
|
|
4635
|
+
className: cn(
|
|
4636
|
+
selectionControlDescriptionTextBaseClasses,
|
|
4637
|
+
descriptionClassName
|
|
4638
|
+
),
|
|
4639
|
+
children: renderTextContent(description, {
|
|
4640
|
+
as: "span",
|
|
4641
|
+
className: "text-muted-foreground",
|
|
4642
|
+
size: "body"
|
|
4643
|
+
})
|
|
4644
|
+
}
|
|
4645
|
+
) : null
|
|
4646
|
+
] })
|
|
4647
|
+
]
|
|
4648
|
+
}
|
|
4649
|
+
);
|
|
4650
|
+
}
|
|
4651
|
+
);
|
|
4571
4652
|
Switch.displayName = SwitchPrimitives.Root.displayName;
|
|
4572
4653
|
|
|
4573
4654
|
// src/components/table.tsx
|
package/dist/index.d.cts
CHANGED
|
@@ -264,6 +264,8 @@ declare const legacyIconToTablerNameMap: {
|
|
|
264
264
|
readonly "trash-filled": "IconTrashFilled";
|
|
265
265
|
readonly "trash-off": "IconTrashOff";
|
|
266
266
|
readonly "trash-x": "IconTrashX";
|
|
267
|
+
readonly "square-toggle": "IconSquareToggle";
|
|
268
|
+
readonly iconSquareToggle: "IconSquareToggle";
|
|
267
269
|
readonly delete: "IconTrash";
|
|
268
270
|
readonly remove: "IconTrashX";
|
|
269
271
|
readonly lixeira: "IconTrash";
|
|
@@ -544,6 +546,11 @@ declare const Spinner: React.ForwardRefExoticComponent<SpinnerProps & React.RefA
|
|
|
544
546
|
declare const switchSizeOptions: readonly ["default", "sm"];
|
|
545
547
|
type SwitchSize = (typeof switchSizeOptions)[number];
|
|
546
548
|
interface SwitchProps extends React.ComponentPropsWithoutRef<typeof SwitchPrimitives.Root> {
|
|
549
|
+
containerClassName?: string;
|
|
550
|
+
description?: React.ReactNode;
|
|
551
|
+
descriptionClassName?: string;
|
|
552
|
+
label?: React.ReactNode;
|
|
553
|
+
labelClassName?: string;
|
|
547
554
|
size?: SwitchSize;
|
|
548
555
|
}
|
|
549
556
|
declare const Switch: React.ForwardRefExoticComponent<SwitchProps & React.RefAttributes<HTMLButtonElement>>;
|
package/dist/index.d.ts
CHANGED
|
@@ -264,6 +264,8 @@ declare const legacyIconToTablerNameMap: {
|
|
|
264
264
|
readonly "trash-filled": "IconTrashFilled";
|
|
265
265
|
readonly "trash-off": "IconTrashOff";
|
|
266
266
|
readonly "trash-x": "IconTrashX";
|
|
267
|
+
readonly "square-toggle": "IconSquareToggle";
|
|
268
|
+
readonly iconSquareToggle: "IconSquareToggle";
|
|
267
269
|
readonly delete: "IconTrash";
|
|
268
270
|
readonly remove: "IconTrashX";
|
|
269
271
|
readonly lixeira: "IconTrash";
|
|
@@ -544,6 +546,11 @@ declare const Spinner: React.ForwardRefExoticComponent<SpinnerProps & React.RefA
|
|
|
544
546
|
declare const switchSizeOptions: readonly ["default", "sm"];
|
|
545
547
|
type SwitchSize = (typeof switchSizeOptions)[number];
|
|
546
548
|
interface SwitchProps extends React.ComponentPropsWithoutRef<typeof SwitchPrimitives.Root> {
|
|
549
|
+
containerClassName?: string;
|
|
550
|
+
description?: React.ReactNode;
|
|
551
|
+
descriptionClassName?: string;
|
|
552
|
+
label?: React.ReactNode;
|
|
553
|
+
labelClassName?: string;
|
|
547
554
|
size?: SwitchSize;
|
|
548
555
|
}
|
|
549
556
|
declare const Switch: React.ForwardRefExoticComponent<SwitchProps & React.RefAttributes<HTMLButtonElement>>;
|
package/dist/index.js
CHANGED
|
@@ -130,6 +130,7 @@ import {
|
|
|
130
130
|
IconPlus,
|
|
131
131
|
IconSchool,
|
|
132
132
|
IconSearch,
|
|
133
|
+
IconSquareToggle,
|
|
133
134
|
IconSparkles,
|
|
134
135
|
IconUser,
|
|
135
136
|
IconUserFilled,
|
|
@@ -171,6 +172,7 @@ var tablerIconRegistry = {
|
|
|
171
172
|
IconPlus,
|
|
172
173
|
IconSchool,
|
|
173
174
|
IconSearch,
|
|
175
|
+
IconSquareToggle,
|
|
174
176
|
IconSparkles,
|
|
175
177
|
IconUser,
|
|
176
178
|
IconUserFilled,
|
|
@@ -236,6 +238,8 @@ var legacyIconToTablerNameMap = {
|
|
|
236
238
|
"trash-filled": "IconTrashFilled",
|
|
237
239
|
"trash-off": "IconTrashOff",
|
|
238
240
|
"trash-x": "IconTrashX",
|
|
241
|
+
"square-toggle": "IconSquareToggle",
|
|
242
|
+
iconSquareToggle: "IconSquareToggle",
|
|
239
243
|
"delete": "IconTrash",
|
|
240
244
|
"remove": "IconTrashX",
|
|
241
245
|
"lixeira": "IconTrash",
|
|
@@ -4386,7 +4390,7 @@ Spinner.displayName = "Spinner";
|
|
|
4386
4390
|
// src/components/switch.tsx
|
|
4387
4391
|
import * as React31 from "react";
|
|
4388
4392
|
import * as SwitchPrimitives from "@radix-ui/react-switch";
|
|
4389
|
-
import { jsx as jsx33 } from "react/jsx-runtime";
|
|
4393
|
+
import { jsx as jsx33, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
4390
4394
|
var switchSizeOptions = ["default", "sm"];
|
|
4391
4395
|
var switchRootSizeClasses = {
|
|
4392
4396
|
default: "h-6 w-11",
|
|
@@ -4396,29 +4400,107 @@ var switchThumbSizeClasses = {
|
|
|
4396
4400
|
default: "h-5 w-5 data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0",
|
|
4397
4401
|
sm: "h-4 w-4 data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0"
|
|
4398
4402
|
};
|
|
4399
|
-
var Switch = React31.forwardRef(
|
|
4400
|
-
|
|
4401
|
-
|
|
4402
|
-
|
|
4403
|
-
|
|
4404
|
-
|
|
4405
|
-
|
|
4406
|
-
|
|
4407
|
-
|
|
4408
|
-
|
|
4409
|
-
|
|
4410
|
-
|
|
4411
|
-
|
|
4412
|
-
|
|
4413
|
-
|
|
4414
|
-
|
|
4415
|
-
|
|
4416
|
-
|
|
4417
|
-
|
|
4418
|
-
|
|
4403
|
+
var Switch = React31.forwardRef(
|
|
4404
|
+
({
|
|
4405
|
+
"aria-describedby": ariaDescribedBy,
|
|
4406
|
+
"aria-labelledby": ariaLabelledBy,
|
|
4407
|
+
className,
|
|
4408
|
+
containerClassName,
|
|
4409
|
+
description,
|
|
4410
|
+
descriptionClassName,
|
|
4411
|
+
disabled,
|
|
4412
|
+
id,
|
|
4413
|
+
label,
|
|
4414
|
+
labelClassName,
|
|
4415
|
+
size,
|
|
4416
|
+
...props
|
|
4417
|
+
}, ref) => {
|
|
4418
|
+
const generatedId = React31.useId();
|
|
4419
|
+
const resolvedId = id ?? generatedId;
|
|
4420
|
+
const labelId = label ? `${resolvedId}-label` : void 0;
|
|
4421
|
+
const descriptionId = description ? `${resolvedId}-description` : void 0;
|
|
4422
|
+
const hasTextContent = label !== void 0 || description !== void 0;
|
|
4423
|
+
const resolvedSize = size ?? (hasTextContent ? "sm" : "default");
|
|
4424
|
+
const alignClassName = description ? "items-start" : "items-center";
|
|
4425
|
+
const resolvedAriaDescribedBy = [ariaDescribedBy, descriptionId].filter(Boolean).join(" ") || void 0;
|
|
4426
|
+
const resolvedAriaLabelledBy = ariaLabelledBy ?? labelId;
|
|
4427
|
+
const switchControl = /* @__PURE__ */ jsx33(
|
|
4428
|
+
SwitchPrimitives.Root,
|
|
4429
|
+
{
|
|
4430
|
+
id: resolvedId,
|
|
4431
|
+
className: cn(
|
|
4432
|
+
"peer inline-flex shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors duration-sofya ease-sofya focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-muted",
|
|
4433
|
+
switchRootSizeClasses[resolvedSize],
|
|
4434
|
+
className
|
|
4435
|
+
),
|
|
4436
|
+
disabled,
|
|
4437
|
+
"aria-describedby": resolvedAriaDescribedBy,
|
|
4438
|
+
"aria-labelledby": resolvedAriaLabelledBy,
|
|
4439
|
+
"data-size": resolvedSize,
|
|
4440
|
+
...props,
|
|
4441
|
+
ref,
|
|
4442
|
+
children: /* @__PURE__ */ jsx33(
|
|
4443
|
+
SwitchPrimitives.Thumb,
|
|
4444
|
+
{
|
|
4445
|
+
className: cn(
|
|
4446
|
+
"pointer-events-none block rounded-full bg-background shadow-sm ring-0 transition-transform duration-sofya ease-sofya",
|
|
4447
|
+
switchThumbSizeClasses[resolvedSize]
|
|
4448
|
+
)
|
|
4449
|
+
}
|
|
4450
|
+
)
|
|
4451
|
+
}
|
|
4452
|
+
);
|
|
4453
|
+
if (!hasTextContent) {
|
|
4454
|
+
return switchControl;
|
|
4419
4455
|
}
|
|
4420
|
-
|
|
4421
|
-
|
|
4456
|
+
return /* @__PURE__ */ jsxs17(
|
|
4457
|
+
"div",
|
|
4458
|
+
{
|
|
4459
|
+
"data-slot": "switch-container",
|
|
4460
|
+
className: selectionControlContainerClasses({
|
|
4461
|
+
alignClassName,
|
|
4462
|
+
className: containerClassName,
|
|
4463
|
+
disabled
|
|
4464
|
+
}),
|
|
4465
|
+
children: [
|
|
4466
|
+
switchControl,
|
|
4467
|
+
/* @__PURE__ */ jsxs17("span", { className: selectionControlContentBaseClasses, children: [
|
|
4468
|
+
label ? /* @__PURE__ */ jsx33("label", { htmlFor: resolvedId, className: selectionControlLabelTextBaseClasses, children: /* @__PURE__ */ jsx33(
|
|
4469
|
+
"span",
|
|
4470
|
+
{
|
|
4471
|
+
id: labelId,
|
|
4472
|
+
className: cn(
|
|
4473
|
+
selectionControlLabelTextBaseClasses,
|
|
4474
|
+
labelClassName
|
|
4475
|
+
),
|
|
4476
|
+
children: renderTextContent(label, {
|
|
4477
|
+
as: "span",
|
|
4478
|
+
className: "text-[color:var(--sofya-text-default)]",
|
|
4479
|
+
size: "body"
|
|
4480
|
+
})
|
|
4481
|
+
}
|
|
4482
|
+
) }) : null,
|
|
4483
|
+
description ? /* @__PURE__ */ jsx33(
|
|
4484
|
+
"span",
|
|
4485
|
+
{
|
|
4486
|
+
id: descriptionId,
|
|
4487
|
+
className: cn(
|
|
4488
|
+
selectionControlDescriptionTextBaseClasses,
|
|
4489
|
+
descriptionClassName
|
|
4490
|
+
),
|
|
4491
|
+
children: renderTextContent(description, {
|
|
4492
|
+
as: "span",
|
|
4493
|
+
className: "text-muted-foreground",
|
|
4494
|
+
size: "body"
|
|
4495
|
+
})
|
|
4496
|
+
}
|
|
4497
|
+
) : null
|
|
4498
|
+
] })
|
|
4499
|
+
]
|
|
4500
|
+
}
|
|
4501
|
+
);
|
|
4502
|
+
}
|
|
4503
|
+
);
|
|
4422
4504
|
Switch.displayName = SwitchPrimitives.Root.displayName;
|
|
4423
4505
|
|
|
4424
4506
|
// src/components/table.tsx
|
|
@@ -4672,7 +4754,7 @@ TableActions.displayName = "TableActions";
|
|
|
4672
4754
|
import * as React33 from "react";
|
|
4673
4755
|
import * as TabsPrimitive from "@radix-ui/react-tabs";
|
|
4674
4756
|
import { motion as motion3 } from "motion/react";
|
|
4675
|
-
import { jsx as jsx35, jsxs as
|
|
4757
|
+
import { jsx as jsx35, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
4676
4758
|
function resolveDefaultValue(items, defaultValue) {
|
|
4677
4759
|
if (defaultValue) {
|
|
4678
4760
|
return defaultValue;
|
|
@@ -4702,7 +4784,7 @@ function Tabs({
|
|
|
4702
4784
|
setUncontrolledCurrentValue(resolvedDefaultValue);
|
|
4703
4785
|
}
|
|
4704
4786
|
}, [resolvedDefaultValue, setUncontrolledCurrentValue, value]);
|
|
4705
|
-
return /* @__PURE__ */
|
|
4787
|
+
return /* @__PURE__ */ jsxs18(
|
|
4706
4788
|
TabsPrimitive.Root,
|
|
4707
4789
|
{
|
|
4708
4790
|
className: cn("w-full", className),
|
|
@@ -4721,7 +4803,7 @@ function Tabs({
|
|
|
4721
4803
|
children: items.map((item) => {
|
|
4722
4804
|
const isUnavailable = item.disabled || item.loading;
|
|
4723
4805
|
const isActive = item.value === currentValue;
|
|
4724
|
-
return /* @__PURE__ */
|
|
4806
|
+
return /* @__PURE__ */ jsxs18(
|
|
4725
4807
|
TabsPrimitive.Trigger,
|
|
4726
4808
|
{
|
|
4727
4809
|
value: item.value,
|
|
@@ -4743,7 +4825,7 @@ function Tabs({
|
|
|
4743
4825
|
transition: { duration: 0.25, ease: "easeInOut" }
|
|
4744
4826
|
}
|
|
4745
4827
|
) : null,
|
|
4746
|
-
/* @__PURE__ */
|
|
4828
|
+
/* @__PURE__ */ jsxs18("span", { className: "relative z-10 inline-flex items-center gap-2", children: [
|
|
4747
4829
|
item.loading ? /* @__PURE__ */ jsx35(
|
|
4748
4830
|
"span",
|
|
4749
4831
|
{
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sofya-ds/react",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.2",
|
|
4
4
|
"description": "Sofya React design system with official brand tokens, provider and UI components.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"motion": "^12.38.0",
|
|
60
60
|
"sonner": "^2.0.7",
|
|
61
61
|
"tailwind-merge": "^3.5.0",
|
|
62
|
-
"@sofya-ds/tokens": "1.3.
|
|
62
|
+
"@sofya-ds/tokens": "1.3.2"
|
|
63
63
|
},
|
|
64
64
|
"devDependencies": {
|
|
65
65
|
"@testing-library/jest-dom": "^6.9.1",
|