@seedgrid/fe-components 2026.3.1 → 2026.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/digits/roller3d-digit/SgRoller3DDigit.d.ts +9 -7
- package/dist/digits/roller3d-digit/SgRoller3DDigit.d.ts.map +1 -1
- package/dist/digits/roller3d-digit/SgRoller3DDigit.js +6 -6
- package/dist/others/SgPlayground.d.ts.map +1 -1
- package/dist/others/SgPlayground.js +15 -8
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export type SgRoller3DDigitProps = {
|
|
2
|
-
/** Current value to display
|
|
2
|
+
/** Current value to display — must be present in `items` */
|
|
3
3
|
value: string;
|
|
4
4
|
/**
|
|
5
5
|
* Ordered list of all possible values this roller can show.
|
|
@@ -7,31 +7,33 @@ export type SgRoller3DDigitProps = {
|
|
|
7
7
|
* @default ["0","1","2","3","4","5","6","7","8","9"]
|
|
8
8
|
*/
|
|
9
9
|
items?: string[];
|
|
10
|
-
/** Font size in pixels
|
|
10
|
+
/** Font size in pixels — controls overall scale */
|
|
11
11
|
fontSize?: number;
|
|
12
|
+
/** Transition duration in milliseconds */
|
|
13
|
+
transitionMs?: number;
|
|
12
14
|
/** Additional CSS classes on the outer wrapper */
|
|
13
15
|
className?: string;
|
|
14
16
|
};
|
|
15
17
|
/**
|
|
16
|
-
* SgRoller3DDigit
|
|
18
|
+
* SgRoller3DDigit — a vertical drum/roller that animates between values.
|
|
17
19
|
*
|
|
18
20
|
* Renders a scrolling strip of items and smoothly transitions to the
|
|
19
21
|
* position of `value` in the `items` list using a CSS transform.
|
|
20
22
|
* Works with digits, letters, padded numbers or any custom strings.
|
|
21
23
|
*
|
|
22
24
|
* @example
|
|
23
|
-
* // Digit roller (default 0
|
|
25
|
+
* // Digit roller (default 0–9)
|
|
24
26
|
* <SgRoller3DDigit value="7" fontSize={32} />
|
|
25
27
|
*
|
|
26
28
|
* @example
|
|
27
|
-
* // Padded time roller (e.g. minutes 00
|
|
29
|
+
* // Padded time roller (e.g. minutes 00–59)
|
|
28
30
|
* const MINUTES = Array.from({ length: 60 }, (_, i) => String(i).padStart(2, "0"));
|
|
29
31
|
* <SgRoller3DDigit value="42" items={MINUTES} fontSize={22} />
|
|
30
32
|
*
|
|
31
33
|
* @example
|
|
32
|
-
* // Letter roller (A
|
|
34
|
+
* // Letter roller (A–Z) — animate names character by character
|
|
33
35
|
* const ALPHA = Array.from("ABCDEFGHIJKLMNOPQRSTUVWXYZ");
|
|
34
36
|
* <SgRoller3DDigit value="M" items={ALPHA} fontSize={32} />
|
|
35
37
|
*/
|
|
36
|
-
export declare function SgRoller3DDigit({ value, items, fontSize, className, }: SgRoller3DDigitProps): import("react/jsx-runtime").JSX.Element;
|
|
38
|
+
export declare function SgRoller3DDigit({ value, items, fontSize, transitionMs, className, }: SgRoller3DDigitProps): import("react/jsx-runtime").JSX.Element;
|
|
37
39
|
//# sourceMappingURL=SgRoller3DDigit.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SgRoller3DDigit.d.ts","sourceRoot":"","sources":["../../../src/digits/roller3d-digit/SgRoller3DDigit.tsx"],"names":[],"mappings":"AAMA,MAAM,MAAM,oBAAoB,GAAG;IACjC,
|
|
1
|
+
{"version":3,"file":"SgRoller3DDigit.d.ts","sourceRoot":"","sources":["../../../src/digits/roller3d-digit/SgRoller3DDigit.tsx"],"names":[],"mappings":"AAMA,MAAM,MAAM,oBAAoB,GAAG;IACjC,8DAA8D;IAC9D,KAAK,EAAE,MAAM,CAAC;IACd;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,qDAAqD;IACrD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,0CAA0C;IAC1C,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,kDAAkD;IAClD,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAIF;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,eAAe,CAAC,EAC9B,KAAK,EACL,KAAqB,EACrB,QAAa,EACb,YAAkB,EAClB,SAAS,GACV,EAAE,oBAAoB,2CAoDtB"}
|
|
@@ -4,27 +4,27 @@ function cn(...parts) {
|
|
|
4
4
|
}
|
|
5
5
|
const DEFAULT_ITEMS = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"];
|
|
6
6
|
/**
|
|
7
|
-
* SgRoller3DDigit
|
|
7
|
+
* SgRoller3DDigit — a vertical drum/roller that animates between values.
|
|
8
8
|
*
|
|
9
9
|
* Renders a scrolling strip of items and smoothly transitions to the
|
|
10
10
|
* position of `value` in the `items` list using a CSS transform.
|
|
11
11
|
* Works with digits, letters, padded numbers or any custom strings.
|
|
12
12
|
*
|
|
13
13
|
* @example
|
|
14
|
-
* // Digit roller (default 0
|
|
14
|
+
* // Digit roller (default 0–9)
|
|
15
15
|
* <SgRoller3DDigit value="7" fontSize={32} />
|
|
16
16
|
*
|
|
17
17
|
* @example
|
|
18
|
-
* // Padded time roller (e.g. minutes 00
|
|
18
|
+
* // Padded time roller (e.g. minutes 00–59)
|
|
19
19
|
* const MINUTES = Array.from({ length: 60 }, (_, i) => String(i).padStart(2, "0"));
|
|
20
20
|
* <SgRoller3DDigit value="42" items={MINUTES} fontSize={22} />
|
|
21
21
|
*
|
|
22
22
|
* @example
|
|
23
|
-
* // Letter roller (A
|
|
23
|
+
* // Letter roller (A–Z) — animate names character by character
|
|
24
24
|
* const ALPHA = Array.from("ABCDEFGHIJKLMNOPQRSTUVWXYZ");
|
|
25
25
|
* <SgRoller3DDigit value="M" items={ALPHA} fontSize={32} />
|
|
26
26
|
*/
|
|
27
|
-
export function SgRoller3DDigit({ value, items = DEFAULT_ITEMS, fontSize = 32, className, }) {
|
|
27
|
+
export function SgRoller3DDigit({ value, items = DEFAULT_ITEMS, fontSize = 32, transitionMs = 500, className, }) {
|
|
28
28
|
const idx = Math.max(0, items.indexOf(value));
|
|
29
29
|
// Dimensions are derived from fontSize so the component scales uniformly.
|
|
30
30
|
// The ratios match the original SgClock roller3d proportions exactly when
|
|
@@ -38,7 +38,7 @@ export function SgRoller3DDigit({ value, items = DEFAULT_ITEMS, fontSize = 32, c
|
|
|
38
38
|
// top fade
|
|
39
39
|
"before:absolute before:inset-0 before:z-10 before:bg-gradient-to-b before:from-black/[0.06] before:to-transparent before:content-['']",
|
|
40
40
|
// bottom fade
|
|
41
|
-
"after:absolute after:inset-0 after:z-10 after:bg-gradient-to-t after:from-black/[0.12] after:to-transparent after:content-['']", className), style: { width: w, height: h }, children: [_jsx("div", { className: "absolute left-0 right-0 top-1/2 z-20 h-px bg-red-500/70" }), _jsx("div", { className: "absolute left-0 top-0 w-full transition-transform
|
|
41
|
+
"after:absolute after:inset-0 after:z-10 after:bg-gradient-to-t after:from-black/[0.12] after:to-transparent after:content-['']", className), style: { width: w, height: h }, children: [_jsx("div", { className: "absolute left-0 right-0 top-1/2 z-20 h-px bg-red-500/70" }), _jsx("div", { className: "absolute left-0 top-0 w-full transition-transform [transition-timing-function:cubic-bezier(0.22,1,0.36,1)] [mask-image:linear-gradient(to_bottom,transparent,black_22%,black_78%,transparent)]", style: { transform: `translateY(${translateY}px)`, transitionDuration: `${transitionMs}ms` }, children: items.map((item, i) => (_jsx("div", { className: "flex select-none items-center justify-center font-medium tabular-nums", style: {
|
|
42
42
|
height: itemH,
|
|
43
43
|
fontSize,
|
|
44
44
|
lineHeight: 1,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SgPlayground.d.ts","sourceRoot":"","sources":["../../src/others/SgPlayground.tsx"],"names":[],"mappings":"AAiBA,MAAM,MAAM,iBAAiB,GAAG;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,YAAY,CAAC,EAAE,YAAY,GAAG,SAAS,CAAC;IACxC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CA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M,CAAC;IACjC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACtC,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,uBAAuB,CAAC,EAAE,MAAM,CAAC;IACjC,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AA4VF,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,KAAK,EAAE,QAAQ,CAAC,iBAAiB,CAAC,2CAgOtE"}
|
|
@@ -7,7 +7,7 @@ import { SgCard } from "../layout/SgCard";
|
|
|
7
7
|
function cn(...parts) {
|
|
8
8
|
return parts.filter(Boolean).join(" ");
|
|
9
9
|
}
|
|
10
|
-
const DEFAULT_SEEDGRID_DEPENDENCY = "
|
|
10
|
+
const DEFAULT_SEEDGRID_DEPENDENCY = "2026.3.1";
|
|
11
11
|
const DEFAULT_SEEDGRID_PEER_DEPENDENCIES = {
|
|
12
12
|
"@codesandbox/sandpack-react": "^2.20.0",
|
|
13
13
|
"react-hook-form": "^7.0.0",
|
|
@@ -301,15 +301,19 @@ function CopyButton() {
|
|
|
301
301
|
}, [copyState]);
|
|
302
302
|
return (_jsx(SgButton, { appearance: "outline", size: "sm", onClick: handleCopy, children: copyState === "success" ? "Copiado" : copyState === "error" ? "Erro" : "Copiar" }));
|
|
303
303
|
}
|
|
304
|
-
function RunButton() {
|
|
304
|
+
function RunButton({ onRun }) {
|
|
305
305
|
const { sandpack } = useSandpack();
|
|
306
|
-
return (_jsx(SgButton, { severity: "primary", size: "sm", onClick: () =>
|
|
306
|
+
return (_jsx(SgButton, { severity: "primary", size: "sm", onClick: () => {
|
|
307
|
+
sandpack.runSandpack();
|
|
308
|
+
onRun?.();
|
|
309
|
+
}, children: "Run" }));
|
|
307
310
|
}
|
|
308
311
|
export default function SgPlayground(props) {
|
|
309
312
|
const { code, interactive = false, codeContract = "renderBody", title, description, height = 360, expandedHeight = "70vh", expandable = true, resizable = true, resizeAxis = "vertical", previewPadding, className, dependencies, defaultImports, previewWrapperClassName = "h-[420px] rounded-xl border border-border bg-muted/30 p-3", seedgridDependency, withCard = true, collapsible = true, defaultOpen = true, cardId } = props;
|
|
310
313
|
const effectivePreviewPadding = normalizeCssSize(previewPadding ?? (codeContract === "appFile" ? 12 : 0));
|
|
311
|
-
const [sandpackStylesCss, setSandpackStylesCss] = React.useState(() => buildSandpackStylesCss(
|
|
314
|
+
const [sandpackStylesCss, setSandpackStylesCss] = React.useState(() => buildSandpackStylesCss({}, effectivePreviewPadding));
|
|
312
315
|
const [isExpanded, setIsExpanded] = React.useState(false);
|
|
316
|
+
const [activePanel, setActivePanel] = React.useState("code");
|
|
313
317
|
React.useEffect(() => {
|
|
314
318
|
if (typeof window === "undefined")
|
|
315
319
|
return;
|
|
@@ -376,13 +380,16 @@ export default function SgPlayground(props) {
|
|
|
376
380
|
: "resize";
|
|
377
381
|
const content = interactive ? (_jsx("div", { className: cn(withCard ? "" : "rounded-lg border border-border", withCard ? undefined : className), children: _jsxs(SandpackProvider, { template: "react-ts", files: files, customSetup: { dependencies: deps }, options: {
|
|
378
382
|
autorun: false,
|
|
383
|
+
initMode: "lazy",
|
|
384
|
+
bundlerTimeOut: 60000,
|
|
379
385
|
activeFile: "/App.tsx",
|
|
380
386
|
visibleFiles: ["/App.tsx"],
|
|
381
387
|
externalResources: SANDPACK_EXTERNAL_RESOURCES
|
|
382
|
-
}, children: [_jsxs("div", { className: "flex items-center justify-between border-b border-border px-3 py-2", children: [_jsxs("div", { className: "flex items-center gap-2", children: [withCard ? null : _jsx("span", { className: "text-sm font-medium", children: title ?? "Example" }), _jsx("span", { className: "text-xs text-muted-foreground", children: codeContract === "renderBody" ? "editable snippet" : "editable App.tsx" })] }), _jsxs("div", { className: "flex items-center gap-2", children: [expandable ? (_jsx(SgButton, { appearance: "outline", size: "sm", onClick: () => setIsExpanded((prev) => !prev), children: isExpanded ? "Reduzir" : "Expandir" })) : null, _jsx(RunButton, {})] })] }), _jsxs("div", { className: cn("
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
388
|
+
}, children: [_jsxs("div", { className: "flex items-center justify-between border-b border-border px-3 py-2", children: [_jsxs("div", { className: "flex items-center gap-2", children: [withCard ? null : _jsx("span", { className: "text-sm font-medium", children: title ?? "Example" }), _jsx("span", { className: "text-xs text-muted-foreground", children: codeContract === "renderBody" ? "editable snippet" : "editable App.tsx" })] }), _jsxs("div", { className: "flex items-center gap-2", children: [expandable ? (_jsx(SgButton, { appearance: "outline", size: "sm", onClick: () => setIsExpanded((prev) => !prev), children: isExpanded ? "Reduzir" : "Expandir" })) : null, _jsx(RunButton, { onRun: () => setActivePanel("preview") })] })] }), _jsxs("div", { className: "flex md:hidden border-b border-border", children: [_jsx("button", { type: "button", className: cn("flex-1 py-2 text-sm font-medium border-b-2 -mb-px transition-colors", activePanel === "code"
|
|
389
|
+
? "border-primary text-foreground"
|
|
390
|
+
: "border-transparent text-muted-foreground hover:text-foreground"), onClick: () => setActivePanel("code"), children: "C\u00F3digo" }), _jsx("button", { type: "button", className: cn("flex-1 py-2 text-sm font-medium border-b-2 -mb-px transition-colors", activePanel === "preview"
|
|
391
|
+
? "border-primary text-foreground"
|
|
392
|
+
: "border-transparent text-muted-foreground hover:text-foreground"), onClick: () => setActivePanel("preview"), children: "Preview" })] }), _jsxs("div", { className: cn("grid overflow-auto min-h-[260px]", "grid-cols-1 md:grid-cols-2", resizeClass), style: { height: currentHeight }, children: [_jsxs("div", { className: cn("min-w-0 md:border-r border-border", activePanel !== "code" ? "hidden md:block" : ""), children: [_jsx(SandpackCodeEditor, { showLineNumbers: true, wrapContent: true, showTabs: false, showRunButton: false, style: { height: "100%" } }), _jsx("div", { className: "flex justify-end border-t border-border px-3 py-2", children: _jsx(CopyButton, {}) })] }), _jsx("div", { className: cn("min-w-0", activePanel !== "preview" ? "hidden md:block" : ""), children: _jsx(SandpackPreview, { style: { height: "100%" }, showOpenInCodeSandbox: false, showRefreshButton: false, showRestartButton: false }) })] })] }) })) : (_jsxs("div", { className: cn(withCard ? undefined : "space-y-2", withCard ? undefined : className), children: [withCard ? null : title ? _jsx("div", { className: "text-sm font-medium", children: title }) : null, _jsx(ReadonlyBlock, { code: code })] }));
|
|
386
393
|
if (!withCard)
|
|
387
394
|
return content;
|
|
388
395
|
return (_jsx(SgCard, { id: cardId, title: title ?? "Codigo", description: description, collapsible: collapsible, defaultOpen: defaultOpen, className: cn("rounded-lg", className), bodyClassName: "p-0", children: content }));
|