@sarunyu/system-one 4.2.2 → 4.3.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/AGENTS.md +1 -0
- package/dist/index.cjs +123 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +124 -3
- package/dist/index.js.map +1 -1
- package/dist/src/components/card.d.ts +5 -2
- package/dist/src/components/card.d.ts.map +1 -1
- package/dist/src/components/modal.d.ts +2 -2
- package/dist/src/components/modal.d.ts.map +1 -1
- package/dist/src/components/toggle.d.ts +26 -0
- package/dist/src/components/toggle.d.ts.map +1 -0
- package/dist/src/index.d.ts +2 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/style.css +1 -1
- package/llms.txt +25 -3
- package/package.json +1 -1
package/AGENTS.md
CHANGED
|
@@ -15,6 +15,7 @@ in this package.** This file is the short version: the rules you must follow.
|
|
|
15
15
|
- Custom status pills, category labels → use `<Tag>` / `<StatusTag>` / `<Chip>`.
|
|
16
16
|
- Custom tabs → use `<TabGroup>`.
|
|
17
17
|
- Custom checkbox/radio → use `<Checkbox>` / `<Radio>`.
|
|
18
|
+
- Custom toggle / switch → use `<Toggle>`.
|
|
18
19
|
- Custom date/time pickers → use `<DateInput>` / `<TimeInput>`.
|
|
19
20
|
- Custom tables → use `<Table>` + `<TableRow>` + `<TableHeaderCell>` + `<TableCell>`.
|
|
20
21
|
- Custom modals/dialogs/alerts → use `<Modal>` (wrap it in your own `fixed inset-0` backdrop).
|
package/dist/index.cjs
CHANGED
|
@@ -247,7 +247,6 @@ const Button = React.forwardRef(function Button2({
|
|
|
247
247
|
);
|
|
248
248
|
});
|
|
249
249
|
Button.displayName = "Button";
|
|
250
|
-
const imgBanner = "";
|
|
251
250
|
function DurationBadge({
|
|
252
251
|
duration,
|
|
253
252
|
size
|
|
@@ -343,6 +342,7 @@ const tagConfig = {
|
|
|
343
342
|
const Card = React.forwardRef(function Card2({
|
|
344
343
|
variant = "event",
|
|
345
344
|
size = "desktop",
|
|
345
|
+
children,
|
|
346
346
|
title,
|
|
347
347
|
locked = true,
|
|
348
348
|
image,
|
|
@@ -365,7 +365,24 @@ const Card = React.forwardRef(function Card2({
|
|
|
365
365
|
// live
|
|
366
366
|
duration
|
|
367
367
|
}, ref) {
|
|
368
|
-
const bannerSrc = image ??
|
|
368
|
+
const bannerSrc = image ?? "";
|
|
369
|
+
if (variant === "default") {
|
|
370
|
+
const shellPadding = size === "desktop" ? "p-4" : size === "tablet" ? "p-3" : "p-2.5";
|
|
371
|
+
const shellRadius = size === "mobile" ? "rounded-[6px]" : "rounded-[8px]";
|
|
372
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
373
|
+
"div",
|
|
374
|
+
{
|
|
375
|
+
ref,
|
|
376
|
+
className: cn(
|
|
377
|
+
"flex min-h-0 min-w-0 flex-col bg-card text-foreground shadow-card",
|
|
378
|
+
shellRadius,
|
|
379
|
+
shellPadding,
|
|
380
|
+
className
|
|
381
|
+
),
|
|
382
|
+
children
|
|
383
|
+
}
|
|
384
|
+
);
|
|
385
|
+
}
|
|
369
386
|
if (variant === "social") {
|
|
370
387
|
const isDesktop = size === "desktop";
|
|
371
388
|
const cardWidth = isDesktop ? "w-[587px]" : "w-[343px]";
|
|
@@ -1002,6 +1019,109 @@ const Checkbox = React.forwardRef(function Checkbox2({
|
|
|
1002
1019
|
);
|
|
1003
1020
|
});
|
|
1004
1021
|
Checkbox.displayName = "Checkbox";
|
|
1022
|
+
const trackClass = {
|
|
1023
|
+
sm: "w-8 h-5",
|
|
1024
|
+
md: "w-10 h-6"
|
|
1025
|
+
};
|
|
1026
|
+
const thumbClass = {
|
|
1027
|
+
sm: "top-0.5 left-0.5 size-4",
|
|
1028
|
+
md: "top-0.5 left-0.5 size-5"
|
|
1029
|
+
};
|
|
1030
|
+
const thumbTranslate = {
|
|
1031
|
+
sm: "translate-x-3",
|
|
1032
|
+
md: "translate-x-4"
|
|
1033
|
+
};
|
|
1034
|
+
const Toggle = React.forwardRef(function Toggle2({
|
|
1035
|
+
checked = false,
|
|
1036
|
+
disabled = false,
|
|
1037
|
+
onChange,
|
|
1038
|
+
label,
|
|
1039
|
+
description,
|
|
1040
|
+
size: sizeProp,
|
|
1041
|
+
id: idProp,
|
|
1042
|
+
ariaLabel,
|
|
1043
|
+
className
|
|
1044
|
+
}, ref) {
|
|
1045
|
+
const generatedId = React.useId();
|
|
1046
|
+
const switchId = idProp ?? generatedId;
|
|
1047
|
+
const hasText = label !== void 0 || description !== void 0;
|
|
1048
|
+
const hasDescription = description !== void 0;
|
|
1049
|
+
const size = sizeProp ?? (hasText ? "sm" : "md");
|
|
1050
|
+
const trackBg = disabled ? checked ? "bg-switch-on-disabled" : "bg-switch-background" : checked ? "bg-primary-action" : "bg-switch-background";
|
|
1051
|
+
const thumbBg = disabled && !checked ? "bg-switch-background" : "bg-[var(--fill-white-1000)]";
|
|
1052
|
+
const switchEl = /* @__PURE__ */ jsxRuntime.jsx(
|
|
1053
|
+
"button",
|
|
1054
|
+
{
|
|
1055
|
+
ref,
|
|
1056
|
+
id: switchId,
|
|
1057
|
+
type: "button",
|
|
1058
|
+
role: "switch",
|
|
1059
|
+
"aria-checked": checked,
|
|
1060
|
+
"aria-label": hasText ? void 0 : ariaLabel,
|
|
1061
|
+
disabled,
|
|
1062
|
+
onClick: () => onChange == null ? void 0 : onChange(!checked),
|
|
1063
|
+
className: cn(
|
|
1064
|
+
"relative shrink-0 rounded-full p-0 transition-colors duration-200 ease-out",
|
|
1065
|
+
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background",
|
|
1066
|
+
disabled ? "cursor-not-allowed" : "cursor-pointer",
|
|
1067
|
+
trackClass[size],
|
|
1068
|
+
trackBg
|
|
1069
|
+
),
|
|
1070
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1071
|
+
"span",
|
|
1072
|
+
{
|
|
1073
|
+
"aria-hidden": "true",
|
|
1074
|
+
className: cn(
|
|
1075
|
+
"pointer-events-none absolute rounded-full transition-transform duration-200 ease-out",
|
|
1076
|
+
"shadow-[var(--toggle-knob-shadow)]",
|
|
1077
|
+
thumbClass[size],
|
|
1078
|
+
thumbBg,
|
|
1079
|
+
checked && thumbTranslate[size]
|
|
1080
|
+
)
|
|
1081
|
+
}
|
|
1082
|
+
)
|
|
1083
|
+
}
|
|
1084
|
+
);
|
|
1085
|
+
if (!hasText) {
|
|
1086
|
+
return /* @__PURE__ */ jsxRuntime.jsx("span", { className: cn("inline-flex", className), children: switchEl });
|
|
1087
|
+
}
|
|
1088
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1089
|
+
"label",
|
|
1090
|
+
{
|
|
1091
|
+
className: cn(
|
|
1092
|
+
"flex w-full min-w-0 gap-4 select-none",
|
|
1093
|
+
hasDescription ? "items-start" : "items-center",
|
|
1094
|
+
disabled ? "cursor-not-allowed" : "cursor-pointer",
|
|
1095
|
+
className
|
|
1096
|
+
),
|
|
1097
|
+
children: [
|
|
1098
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex min-w-0 flex-1 flex-col gap-0 text-sm font-normal leading-5", children: [
|
|
1099
|
+
label !== void 0 && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1100
|
+
"span",
|
|
1101
|
+
{
|
|
1102
|
+
className: cn(
|
|
1103
|
+
disabled ? "text-disabled" : "text-foreground"
|
|
1104
|
+
),
|
|
1105
|
+
children: label
|
|
1106
|
+
}
|
|
1107
|
+
),
|
|
1108
|
+
hasDescription && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1109
|
+
"span",
|
|
1110
|
+
{
|
|
1111
|
+
className: cn(
|
|
1112
|
+
"whitespace-pre-wrap font-normal",
|
|
1113
|
+
disabled ? "text-disabled" : "text-[color:var(--text-default-secondary)]"
|
|
1114
|
+
),
|
|
1115
|
+
children: description
|
|
1116
|
+
}
|
|
1117
|
+
)
|
|
1118
|
+
] }),
|
|
1119
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "shrink-0", children: switchEl })
|
|
1120
|
+
]
|
|
1121
|
+
}
|
|
1122
|
+
);
|
|
1123
|
+
});
|
|
1124
|
+
Toggle.displayName = "Toggle";
|
|
1005
1125
|
function RadioVisual({ checked, disabled }) {
|
|
1006
1126
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1007
1127
|
"span",
|
|
@@ -5291,6 +5411,7 @@ exports.TableRow = TableRow;
|
|
|
5291
5411
|
exports.Tag = Tag;
|
|
5292
5412
|
exports.TextArea = TextArea;
|
|
5293
5413
|
exports.TimeInput = TimeInput;
|
|
5414
|
+
exports.Toggle = Toggle;
|
|
5294
5415
|
exports.cn = cn;
|
|
5295
5416
|
exports.useIsMobile = useIsMobile;
|
|
5296
5417
|
//# sourceMappingURL=index.cjs.map
|