@seedgrid/fe-components 2026.3.5 → 2026.3.9
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/buttons/SgFloatActionButton.d.ts +2 -3
- package/dist/buttons/SgFloatActionButton.d.ts.map +1 -1
- package/dist/buttons/SgFloatActionButton.js +3 -3
- package/dist/buttons/SgSplitButton.d.ts +1 -0
- package/dist/buttons/SgSplitButton.d.ts.map +1 -1
- package/dist/buttons/SgSplitButton.js +2 -2
- package/dist/commons/SgBadge.d.ts +2 -1
- package/dist/commons/SgBadge.d.ts.map +1 -1
- package/dist/commons/SgBadge.js +8 -7
- package/dist/commons/SgBadgeOverlay.d.ts +1 -0
- package/dist/commons/SgBadgeOverlay.d.ts.map +1 -1
- package/dist/commons/SgBadgeOverlay.js +2 -2
- package/dist/commons/SgToastHost.d.ts +17 -0
- package/dist/commons/SgToastHost.d.ts.map +1 -0
- package/dist/commons/SgToastHost.js +45 -0
- package/dist/commons/SgToaster.d.ts +3 -1
- package/dist/commons/SgToaster.d.ts.map +1 -1
- package/dist/commons/SgToaster.js +13 -0
- package/dist/commons/sgToastHostRegistry.d.ts +7 -0
- package/dist/commons/sgToastHostRegistry.d.ts.map +1 -0
- package/dist/commons/sgToastHostRegistry.js +41 -0
- package/dist/gadgets/clock/SgClock.d.ts +2 -1
- package/dist/gadgets/clock/SgClock.d.ts.map +1 -1
- package/dist/gadgets/clock/SgClock.js +15 -15
- package/dist/gadgets/string-animator/SgStringAnimator.d.ts +1 -1
- package/dist/gadgets/string-animator/SgStringAnimator.d.ts.map +1 -1
- package/dist/gadgets/string-animator/SgStringAnimator.js +1 -1
- package/dist/i18n/en-US.d.ts.map +1 -1
- package/dist/i18n/en-US.js +16 -1
- package/dist/i18n/es.d.ts.map +1 -1
- package/dist/i18n/es.js +16 -1
- package/dist/i18n/pt-BR.d.ts.map +1 -1
- package/dist/i18n/pt-BR.js +16 -1
- package/dist/i18n/pt-PT.d.ts.map +1 -1
- package/dist/i18n/pt-PT.js +16 -1
- package/dist/index.d.ts +11 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -1
- package/dist/inputs/SgCheckboxGroup.d.ts +46 -0
- package/dist/inputs/SgCheckboxGroup.d.ts.map +1 -0
- package/dist/inputs/SgCheckboxGroup.js +158 -0
- package/dist/inputs/{SgCurrencyEdit.d.ts → SgInputCurrency.d.ts} +5 -3
- package/dist/inputs/SgInputCurrency.d.ts.map +1 -0
- package/dist/inputs/{SgCurrencyEdit.js → SgInputCurrency.js} +7 -5
- package/dist/inputs/SgOrderList.d.ts +52 -0
- package/dist/inputs/SgOrderList.d.ts.map +1 -0
- package/dist/inputs/SgOrderList.js +316 -0
- package/dist/inputs/SgPickList.d.ts +71 -0
- package/dist/inputs/SgPickList.d.ts.map +1 -0
- package/dist/inputs/SgPickList.js +362 -0
- package/dist/inputs/SgRadioGroup.d.ts +1 -2
- package/dist/inputs/SgRadioGroup.d.ts.map +1 -1
- package/dist/inputs/SgRadioGroup.js +5 -49
- package/dist/inputs/SgRating.d.ts +2 -0
- package/dist/inputs/SgRating.d.ts.map +1 -1
- package/dist/inputs/SgRating.js +2 -2
- package/dist/inputs/SgTextEditor.d.ts +2 -0
- package/dist/inputs/SgTextEditor.d.ts.map +1 -1
- package/dist/inputs/SgTextEditor.js +2 -2
- package/dist/layout/SgCard.d.ts +1 -1
- package/dist/layout/SgCard.d.ts.map +1 -1
- package/dist/layout/SgCard.js +4 -4
- package/dist/layout/SgCarousel.d.ts +2 -0
- package/dist/layout/SgCarousel.d.ts.map +1 -1
- package/dist/layout/SgCarousel.js +2 -2
- package/dist/layout/SgDockLayout.d.ts +1 -0
- package/dist/layout/SgDockLayout.d.ts.map +1 -1
- package/dist/layout/SgDockLayout.js +2 -2
- package/dist/layout/SgDockZone.d.ts +1 -0
- package/dist/layout/SgDockZone.d.ts.map +1 -1
- package/dist/layout/SgDockZone.js +2 -2
- package/dist/layout/SgGroupBox.d.ts +1 -0
- package/dist/layout/SgGroupBox.d.ts.map +1 -1
- package/dist/layout/SgGroupBox.js +3 -2
- package/dist/layout/SgMenu.d.ts +2 -2
- package/dist/layout/SgMenu.d.ts.map +1 -1
- package/dist/layout/SgMenu.js +22 -22
- package/dist/layout/SgPageControl.d.ts +2 -1
- package/dist/layout/SgPageControl.d.ts.map +1 -1
- package/dist/layout/SgPageControl.js +4 -4
- package/dist/layout/SgToolBar.d.ts +2 -0
- package/dist/layout/SgToolBar.d.ts.map +1 -1
- package/dist/layout/SgToolBar.js +4 -3
- package/dist/layout/SgTreeView.d.ts +1 -0
- package/dist/layout/SgTreeView.d.ts.map +1 -1
- package/dist/layout/SgTreeView.js +2 -2
- package/dist/others/SgPlayground.d.ts +2 -0
- package/dist/others/SgPlayground.d.ts.map +1 -1
- package/dist/others/SgPlayground.js +4 -4
- package/dist/overlay/SgDialog.d.ts +1 -0
- package/dist/overlay/SgDialog.d.ts.map +1 -1
- package/dist/overlay/SgDialog.js +2 -2
- package/dist/sandbox.cjs +96 -78
- package/dist/wizard/SgWizard.d.ts +2 -0
- package/dist/wizard/SgWizard.d.ts.map +1 -1
- package/dist/wizard/SgWizard.js +2 -2
- package/package.json +1 -1
- package/dist/inputs/SgCurrencyEdit.d.ts.map +0 -1
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
export type FABPosition = "left-top" | "left-center" | "left-bottom" | "center-top" | "center-bottom" | "right-top" | "right-center" | "right-bottom";
|
|
3
3
|
export type FABSeverity = "primary" | "secondary" | "success" | "info" | "warning" | "help" | "danger" | "plain";
|
|
4
|
-
export type FABVariant = FABSeverity;
|
|
5
4
|
export type FABSize = "sm" | "md" | "lg";
|
|
6
5
|
export type FABShape = "circle" | "rounded" | "square";
|
|
7
6
|
export type FABElevation = "none" | "sm" | "md" | "lg";
|
|
@@ -13,7 +12,7 @@ export type SgFABAction = {
|
|
|
13
12
|
label?: string;
|
|
14
13
|
onClick?: () => void;
|
|
15
14
|
severity?: FABSeverity;
|
|
16
|
-
|
|
15
|
+
floatActionButtonStyle?: FABSeverity;
|
|
17
16
|
disabled?: boolean;
|
|
18
17
|
};
|
|
19
18
|
export type SgFloatActionButtonProps = {
|
|
@@ -30,7 +29,7 @@ export type SgFloatActionButtonProps = {
|
|
|
30
29
|
enableDragDrop?: boolean;
|
|
31
30
|
dragId?: string;
|
|
32
31
|
severity?: FABSeverity;
|
|
33
|
-
|
|
32
|
+
floatActionButtonStyle?: FABSeverity;
|
|
34
33
|
color?: string;
|
|
35
34
|
size?: FABSize;
|
|
36
35
|
shape?: FABShape;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SgFloatActionButton.d.ts","sourceRoot":"","sources":["../../src/buttons/SgFloatActionButton.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAuC/B,MAAM,MAAM,WAAW,GACnB,UAAU,GAAG,aAAa,GAAG,aAAa,GAC1C,YAAY,GAAG,eAAe,GAC9B,WAAW,GAAG,cAAc,GAAG,cAAc,CAAC;AAElD,MAAM,MAAM,WAAW,GACnB,SAAS,GACT,WAAW,GACX,SAAS,GACT,MAAM,GACN,SAAS,GACT,MAAM,GACN,QAAQ,GACR,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"SgFloatActionButton.d.ts","sourceRoot":"","sources":["../../src/buttons/SgFloatActionButton.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAuC/B,MAAM,MAAM,WAAW,GACnB,UAAU,GAAG,aAAa,GAAG,aAAa,GAC1C,YAAY,GAAG,eAAe,GAC9B,WAAW,GAAG,cAAc,GAAG,cAAc,CAAC;AAElD,MAAM,MAAM,WAAW,GACnB,SAAS,GACT,WAAW,GACX,SAAS,GACT,MAAM,GACN,SAAS,GACT,MAAM,GACN,QAAQ,GACR,OAAO,CAAC;AACZ,MAAM,MAAM,OAAO,GAAG,IAAI,GAAG,IAAI,GAAG,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sB,CAAC,EAAE,WAAW,CAAC;IACrC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,KAAK,CAAC,EAAE,QAAQ,CAAC;IACjB,SAAS,CAAC,EAAE,YAAY,CAAC;IACzB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,SAAS,CAAC,EAAE,YAAY,CAAC;IACzB,WAAW,CAAC,EAAE,mBAAmB,CAAC;IAClC,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,SAAS,CAAC,EAAE,IAAI,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;IAC7C,IAAI,CAAC,EAAE,aAAa,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,OAAO,CAAC,EAAE,WAAW,EAAE,CAAC;IACxB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IAC5B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AA6NF,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,QAAQ,CAAC,wBAAwB,CAAC,2CAyhB5E;yBAzhBe,mBAAmB"}
|
|
@@ -214,7 +214,7 @@ export function SgFloatActionButton(props) {
|
|
|
214
214
|
const i18n = useComponentsI18n();
|
|
215
215
|
const hasEnvironmentProvider = useHasSgEnvironmentProvider();
|
|
216
216
|
const { load: loadPersistedState, save: savePersistedState, clear: clearPersistedState } = useSgPersistence();
|
|
217
|
-
const { hint, hintDelay = 300, icon, activeIcon, position = "right-bottom", offset, enableDragDrop = false, dragId, severity = "primary",
|
|
217
|
+
const { hint, hintDelay = 300, icon, activeIcon, position = "right-bottom", offset, enableDragDrop = false, dragId, severity = "primary", floatActionButtonStyle, color, size = "md", shape = "circle", elevation = "md", disabled = false, loading = false, autoHideOnScroll = false, hideDirection = "down", animation = "scale", animationOn = "mount", animationDuration = 200, type = "linear", radius, transitionDelay = 30, actions, onClick, className, style, zIndex = 50, absolute = false, } = props;
|
|
218
218
|
const hintPos = props.hintPosition ?? DEFAULT_HINT[position];
|
|
219
219
|
const dir = props.direction ?? DEFAULT_DIR[position];
|
|
220
220
|
const [mounted, setMounted] = React.useState(false);
|
|
@@ -512,7 +512,7 @@ export function SgFloatActionButton(props) {
|
|
|
512
512
|
dragMoved.current = false;
|
|
513
513
|
}, [clearStoredPosition, dragId]);
|
|
514
514
|
/* colors */
|
|
515
|
-
const resolvedSeverity = severity ??
|
|
515
|
+
const resolvedSeverity = severity ?? floatActionButtonStyle ?? "primary";
|
|
516
516
|
const c = COLORS[resolvedSeverity];
|
|
517
517
|
const bg = color ?? c.bg;
|
|
518
518
|
const fg = color ? "white" : c.fg;
|
|
@@ -629,7 +629,7 @@ export function SgFloatActionButton(props) {
|
|
|
629
629
|
handleContextMenu(event);
|
|
630
630
|
}, children: [animation === "pulse" && (_jsx("style", { children: `@keyframes sg-fab-pulse{0%,100%{transform:scale(1)}50%{transform:scale(1.08)}}` })), actions?.map((a, i) => {
|
|
631
631
|
const p = actPos[i] ?? { x: 0, y: 0 };
|
|
632
|
-
const actionSeverity = a.severity ?? a.
|
|
632
|
+
const actionSeverity = a.severity ?? a.floatActionButtonStyle ?? "plain";
|
|
633
633
|
const ac = COLORS[actionSeverity];
|
|
634
634
|
return (_jsx("div", { className: "absolute", style: {
|
|
635
635
|
transform: open ? `translate(${p.x}px, ${p.y}px) scale(1)` : "translate(0,0) scale(0)",
|
|
@@ -26,6 +26,7 @@ export type SgSplitButtonProps = {
|
|
|
26
26
|
items: SgSplitButtonItem[];
|
|
27
27
|
customColors?: SgButtonCustomColors;
|
|
28
28
|
className?: string;
|
|
29
|
+
style?: React.CSSProperties;
|
|
29
30
|
};
|
|
30
31
|
export declare const SgSplitButton: React.ForwardRefExoticComponent<SgSplitButtonProps & React.RefAttributes<HTMLDivElement>>;
|
|
31
32
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SgSplitButton.d.ts","sourceRoot":"","sources":["../../src/buttons/SgSplitButton.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAEvD,KAAK,QAAQ,GACT,SAAS,GACT,WAAW,GACX,SAAS,GACT,MAAM,GACN,SAAS,GACT,MAAM,GACN,QAAQ,CAAC;AAEb,KAAK,UAAU,GAAG,OAAO,GAAG,SAAS,GAAG,OAAO,CAAC;AAEhD,KAAK,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAE/B,KAAK,KAAK,GAAG,SAAS,GAAG,SAAS,GAAG,QAAQ,CAAC;AAE9C,KAAK,SAAS,GAAG,MAAM,GAAG,IAAI,GAAG,IAAI,CAAC;AAEtC,MAAM,MAAM,iBAAiB,GAAG;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACvB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ,KAAK,CA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,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,KAAK,EAAE,iBAAiB,EAAE,CAAC;IAC3B,YAAY,CAAC,EAAE,oBAAoB,CAAC;IACpC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;CAC7B,CAAC;AAmBF,eAAO,MAAM,aAAa,2FAkIzB,CAAC"}
|
|
@@ -5,7 +5,7 @@ import { SgButton } from "./SgButton";
|
|
|
5
5
|
function ChevronDown({ className }) {
|
|
6
6
|
return (_jsx("svg", { className: className, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: _jsx("path", { d: "m6 9 6 6 6-6" }) }));
|
|
7
7
|
}
|
|
8
|
-
export const SgSplitButton = React.forwardRef(({ label, leftIcon, severity = "primary", appearance = "solid", size = "md", shape = "default", elevation = "none", disabled = false, loading = false, onClick, items, customColors, className }, ref) => {
|
|
8
|
+
export const SgSplitButton = React.forwardRef(({ label, leftIcon, severity = "primary", appearance = "solid", size = "md", shape = "default", elevation = "none", disabled = false, loading = false, onClick, items, customColors, className, style }, ref) => {
|
|
9
9
|
const [open, setOpen] = React.useState(false);
|
|
10
10
|
const containerRef = React.useRef(null);
|
|
11
11
|
const menuRef = React.useRef(null);
|
|
@@ -50,6 +50,6 @@ export const SgSplitButton = React.forwardRef(({ label, leftIcon, severity = "pr
|
|
|
50
50
|
lg: { menu: "min-w-[180px]", item: "px-5 py-2.5", text: "text-base", iconSize: "size-5" }
|
|
51
51
|
};
|
|
52
52
|
const s = sizeClasses[size];
|
|
53
|
-
return (_jsxs("div", { ref: containerRef, className: `relative inline-flex ${className ?? ""}`, children: [_jsx(SgButton, { severity: severity, appearance: appearance, size: size, shape: shape, elevation: elevation, disabled: disabled, loading: loading, leftIcon: leftIcon, onClick: onClick, customColors: customColors, className: "rounded-r-none", children: label }), _jsx(SgButton, { severity: severity, appearance: appearance, size: size, shape: shape, elevation: elevation, disabled: disabled || loading, leftIcon: _jsx(ChevronDown, { className: "size-4" }), onClick: toggle, customColors: customColors, className: `rounded-l-none ${dividerBorderClass}`, "aria-haspopup": "true", "aria-expanded": open }), open && (_jsx("div", { ref: menuRef, role: "menu", className: `absolute left-0 top-full z-50 mt-1 ${s.menu} overflow-hidden rounded-lg shadow-lg bg-background text-foreground border border-border`, children: items.map((item, i) => (_jsxs(React.Fragment, { children: [item.separator && i > 0 ? (_jsx("div", { className: "my-0.5 border-t border-border" })) : null, _jsxs("button", { role: "menuitem", type: "button", disabled: item.disabled, className: `flex w-full items-center gap-2 ${s.item} ${s.text} transition-colors hover:bg-muted/60 disabled:opacity-50 disabled:cursor-not-allowed`, onClick: () => handleItemClick(item), children: [item.icon ? _jsx("span", { className: `shrink-0 ${s.iconSize}`, children: item.icon }) : null, _jsx("span", { children: item.label })] })] }, i))) }))] }));
|
|
53
|
+
return (_jsxs("div", { ref: containerRef, className: `relative inline-flex ${className ?? ""}`, style: style, children: [_jsx(SgButton, { severity: severity, appearance: appearance, size: size, shape: shape, elevation: elevation, disabled: disabled, loading: loading, leftIcon: leftIcon, onClick: onClick, customColors: customColors, className: "rounded-r-none", children: label }), _jsx(SgButton, { severity: severity, appearance: appearance, size: size, shape: shape, elevation: elevation, disabled: disabled || loading, leftIcon: _jsx(ChevronDown, { className: "size-4" }), onClick: toggle, customColors: customColors, className: `rounded-l-none ${dividerBorderClass}`, "aria-haspopup": "true", "aria-expanded": open }), open && (_jsx("div", { ref: menuRef, role: "menu", className: `absolute left-0 top-full z-50 mt-1 ${s.menu} overflow-hidden rounded-lg shadow-lg bg-background text-foreground border border-border`, children: items.map((item, i) => (_jsxs(React.Fragment, { children: [item.separator && i > 0 ? (_jsx("div", { className: "my-0.5 border-t border-border" })) : null, _jsxs("button", { role: "menuitem", type: "button", disabled: item.disabled, className: `flex w-full items-center gap-2 ${s.item} ${s.text} transition-colors hover:bg-muted/60 disabled:opacity-50 disabled:cursor-not-allowed`, onClick: () => handleItemClick(item), children: [item.icon ? _jsx("span", { className: `shrink-0 ${s.iconSize}`, children: item.icon }) : null, _jsx("span", { children: item.label })] })] }, i))) }))] }));
|
|
54
54
|
});
|
|
55
55
|
SgSplitButton.displayName = "SgSplitButton";
|
|
@@ -22,7 +22,7 @@ export type SgBadgePartsClassName = {
|
|
|
22
22
|
export type SgBadgeProps = {
|
|
23
23
|
value?: React.ReactNode;
|
|
24
24
|
severity?: SgBadgeSeverity;
|
|
25
|
-
|
|
25
|
+
badgeStyle?: SgBadgeVariant;
|
|
26
26
|
size?: SgBadgeSize;
|
|
27
27
|
rounded?: boolean;
|
|
28
28
|
dot?: boolean;
|
|
@@ -41,6 +41,7 @@ export type SgBadgeProps = {
|
|
|
41
41
|
hint?: string;
|
|
42
42
|
customColors?: SgBadgeCustomColors;
|
|
43
43
|
className?: string;
|
|
44
|
+
style?: React.CSSProperties;
|
|
44
45
|
partsClassName?: SgBadgePartsClassName;
|
|
45
46
|
"aria-label"?: string;
|
|
46
47
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SgBadge.d.ts","sourceRoot":"","sources":["../../src/commons/SgBadge.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,MAAM,MAAM,eAAe,GACvB,SAAS,GACT,WAAW,GACX,SAAS,GACT,SAAS,GACT,QAAQ,GACR,MAAM,GACN,SAAS,GACT,QAAQ,CAAC;AAEb,MAAM,MAAM,cAAc,GAAG,OAAO,GAAG,MAAM,GAAG,SAAS,GAAG,OAAO,CAAC;AACpE,MAAM,MA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AE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,YAAY,CAAC,EAAE,mBAAmB,CAAC;IACnC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IAC5B,cAAc,CAAC,EAAE,qBAAqB,CAAC;IACvC,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC;AA0HF,wBAAgB,OAAO,CAAC,KAAK,EAAE,QAAQ,CAAC,YAAY,CAAC,kDAmHpD;yBAnHe,OAAO"}
|
package/dist/commons/SgBadge.js
CHANGED
|
@@ -108,11 +108,12 @@ function getDisplayValue(value, max, showZero) {
|
|
|
108
108
|
return value ?? null;
|
|
109
109
|
}
|
|
110
110
|
export function SgBadge(props) {
|
|
111
|
-
const { value, severity = "primary",
|
|
111
|
+
const { value, severity = "primary", badgeStyle = "solid", size = "md", rounded = true, dot = false, pulse = false, max, showZero = true, leftIcon, rightIcon, removable = false, onRemove, removeAriaLabel = "Remover", autoRemove = false, onClick, disabled, title, hint, customColors, className, style, partsClassName, ...aria } = props;
|
|
112
112
|
const displayValue = getDisplayValue(value, max, showZero);
|
|
113
113
|
const [autoRemoved, setAutoRemoved] = React.useState(false);
|
|
114
|
+
const cssVars = buildVars(severity, customColors);
|
|
114
115
|
if (dot) {
|
|
115
|
-
return (_jsxs("span", { title: hint ?? title, className: cn("relative inline-flex items-center justify-center", partsClassName?.dot, className), style:
|
|
116
|
+
return (_jsxs("span", { title: hint ?? title, className: cn("relative inline-flex items-center justify-center", partsClassName?.dot, className), style: { ...cssVars, ...style }, ...aria, children: [pulse ? (_jsx("span", { className: "absolute inline-flex size-3 rounded-full bg-[var(--sg-badge-bg)] opacity-75 animate-ping" })) : null, _jsx("span", { className: "inline-flex size-2.5 rounded-full bg-[var(--sg-badge-bg)]" })] }));
|
|
116
117
|
}
|
|
117
118
|
if (autoRemoved)
|
|
118
119
|
return null;
|
|
@@ -120,18 +121,18 @@ export function SgBadge(props) {
|
|
|
120
121
|
return null;
|
|
121
122
|
const isButton = typeof onClick === "function";
|
|
122
123
|
const Tag = isButton ? "button" : "span";
|
|
123
|
-
const base = cn("inline-flex items-center gap-1.5 whitespace-nowrap font-medium", "transition-[color,background-color,border-color] duration-150", SIZE[size], rounded ? "rounded-full" : "rounded-md",
|
|
124
|
+
const base = cn("inline-flex items-center gap-1.5 whitespace-nowrap font-medium", "transition-[color,background-color,border-color] duration-150", SIZE[size], rounded ? "rounded-full" : "rounded-md", badgeStyle === "solid"
|
|
124
125
|
? "bg-[var(--sg-badge-bg)] text-[var(--sg-badge-fg)] border border-[var(--sg-badge-border)]"
|
|
125
|
-
:
|
|
126
|
+
: badgeStyle === "soft"
|
|
126
127
|
? "bg-[var(--sg-badge-soft-bg)] text-[var(--sg-badge-soft-fg)] border border-transparent"
|
|
127
|
-
:
|
|
128
|
+
: badgeStyle === "outline"
|
|
128
129
|
? "bg-transparent text-[var(--sg-badge-bg)] border border-[var(--sg-badge-border)]"
|
|
129
|
-
: "bg-transparent text-[var(--sg-badge-bg)] border border-transparent",
|
|
130
|
+
: "bg-transparent text-[var(--sg-badge-bg)] border border-transparent", badgeStyle === "ghost" || badgeStyle === "outline"
|
|
130
131
|
? "hover:bg-[var(--sg-badge-hover-bg)] hover:text-[var(--sg-badge-hover-fg)] hover:border-[var(--sg-badge-hover-border)]"
|
|
131
132
|
: "", isButton
|
|
132
133
|
? cn("cursor-pointer select-none", "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--sg-badge-ring)] focus-visible:ring-offset-2 focus-visible:ring-offset-background", disabled ? "pointer-events-none opacity-50" : "")
|
|
133
134
|
: "", className, partsClassName?.container);
|
|
134
|
-
return (_jsxs(Tag, { type: isButton ? "button" : undefined, title: hint ?? title, onClick: disabled ? undefined : onClick, disabled: isButton ? disabled : undefined, style:
|
|
135
|
+
return (_jsxs(Tag, { type: isButton ? "button" : undefined, title: hint ?? title, onClick: disabled ? undefined : onClick, disabled: isButton ? disabled : undefined, style: { ...cssVars, ...style }, className: base, role: isButton ? undefined : "status", ...aria, children: [leftIcon ? _jsx("span", { className: cn("inline-flex", ICON_SIZE[size]), children: leftIcon }) : null, displayValue !== null ? _jsx("span", { className: cn("inline-flex items-center", partsClassName?.label), children: displayValue }) : null, rightIcon ? _jsx("span", { className: cn("inline-flex", ICON_SIZE[size]), children: rightIcon }) : null, removable ? (_jsx("button", { type: "button", onClick: (e) => {
|
|
135
136
|
e.stopPropagation();
|
|
136
137
|
if (autoRemove)
|
|
137
138
|
setAutoRemoved(true);
|
|
@@ -5,6 +5,7 @@ export type SgBadgeOverlayProps = {
|
|
|
5
5
|
badge: React.ReactNode;
|
|
6
6
|
placement?: SgBadgeOverlayPlacement;
|
|
7
7
|
className?: string;
|
|
8
|
+
style?: React.CSSProperties;
|
|
8
9
|
};
|
|
9
10
|
export declare function SgBadgeOverlay(props: Readonly<SgBadgeOverlayProps>): import("react/jsx-runtime").JSX.Element;
|
|
10
11
|
export declare namespace SgBadgeOverlay {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SgBadgeOverlay.d.ts","sourceRoot":"","sources":["../../src/commons/SgBadgeOverlay.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAM/B,MAAM,MAAM,uBAAuB,GAC/B,UAAU,GACV,WAAW,GACX,aAAa,GACb,cAAc,GACd,OAAO,GACP,MAAM,GACN,KAAK,GACL,QAAQ,CAAC;AAEb,MAAM,MAAM,mBAAmB,GAAG;IAChC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,KAAK,EAAE,KAAK,CAAC,SAAS,CAAC;IACvB,SAAS,CAAC,EAAE,uBAAuB,CAAC;IACpC,SAAS,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"SgBadgeOverlay.d.ts","sourceRoot":"","sources":["../../src/commons/SgBadgeOverlay.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAM/B,MAAM,MAAM,uBAAuB,GAC/B,UAAU,GACV,WAAW,GACX,aAAa,GACb,cAAc,GACd,OAAO,GACP,MAAM,GACN,KAAK,GACL,QAAQ,CAAC;AAEb,MAAM,MAAM,mBAAmB,GAAG;IAChC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,KAAK,EAAE,KAAK,CAAC,SAAS,CAAC;IACvB,SAAS,CAAC,EAAE,uBAAuB,CAAC;IACpC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;CAC7B,CAAC;AAEF,wBAAgB,cAAc,CAAC,KAAK,EAAE,QAAQ,CAAC,mBAAmB,CAAC,2CAmBlE;yBAnBe,cAAc"}
|
|
@@ -4,7 +4,7 @@ function cn(...parts) {
|
|
|
4
4
|
return parts.filter(Boolean).join(" ");
|
|
5
5
|
}
|
|
6
6
|
export function SgBadgeOverlay(props) {
|
|
7
|
-
const { children, badge, placement = "top-right", className } = props;
|
|
7
|
+
const { children, badge, placement = "top-right", className, style } = props;
|
|
8
8
|
const pos = {
|
|
9
9
|
"top-left": "left-0 top-0 -translate-x-1/3 -translate-y-1/3",
|
|
10
10
|
"top-right": "right-0 top-0 translate-x-1/3 -translate-y-1/3",
|
|
@@ -15,6 +15,6 @@ export function SgBadgeOverlay(props) {
|
|
|
15
15
|
top: "top-0 left-1/2 -translate-x-1/2 -translate-y-1/2",
|
|
16
16
|
bottom: "bottom-0 left-1/2 -translate-x-1/2 translate-y-1/2"
|
|
17
17
|
};
|
|
18
|
-
return (_jsxs("span", { className: cn("relative inline-flex", className), children: [children, _jsx("span", { className: cn("absolute", pos[placement]), children: badge })] }));
|
|
18
|
+
return (_jsxs("span", { className: cn("relative inline-flex", className), style: style, children: [children, _jsx("span", { className: cn("absolute", pos[placement]), children: badge })] }));
|
|
19
19
|
}
|
|
20
20
|
SgBadgeOverlay.displayName = "SgBadgeOverlay";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type SgToasterProps } from "./SgToaster";
|
|
2
|
+
export type SgToastHostProps = SgToasterProps;
|
|
3
|
+
/**
|
|
4
|
+
* SgToastHost — marks the location where toasts will appear.
|
|
5
|
+
*
|
|
6
|
+
* Drop it anywhere in your tree. If multiple hosts exist simultaneously
|
|
7
|
+
* (e.g. one in a layout and one inside the page), the one deeper in the
|
|
8
|
+
* React tree (last to mount) takes priority. When that host unmounts the
|
|
9
|
+
* next most-recently-mounted host becomes active automatically.
|
|
10
|
+
*
|
|
11
|
+
* When any SgToastHost is present, SgToaster automatically defers to it
|
|
12
|
+
* and stops rendering, so both components can coexist without duplication.
|
|
13
|
+
*
|
|
14
|
+
* Accepts the same props as SgToaster (position, duration, richColors, etc.).
|
|
15
|
+
*/
|
|
16
|
+
export declare function SgToastHost(props: SgToastHostProps): import("react/jsx-runtime").JSX.Element | null;
|
|
17
|
+
//# sourceMappingURL=SgToastHost.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SgToastHost.d.ts","sourceRoot":"","sources":["../../src/commons/SgToastHost.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAmC,KAAK,cAAc,EAAE,MAAM,aAAa,CAAC;AAanF,MAAM,MAAM,gBAAgB,GAAG,cAAc,CAAC;AAE9C;;;;;;;;;;;;GAYG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,gBAAgB,kDAiClD"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import React from "react";
|
|
4
|
+
import { SgToaster, SgToasterHostContext } from "./SgToaster";
|
|
5
|
+
import { registerHost, unregisterHost, getActiveHostId, subscribeHostRegistry, nextHostId } from "./sgToastHostRegistry";
|
|
6
|
+
/**
|
|
7
|
+
* SgToastHost — marks the location where toasts will appear.
|
|
8
|
+
*
|
|
9
|
+
* Drop it anywhere in your tree. If multiple hosts exist simultaneously
|
|
10
|
+
* (e.g. one in a layout and one inside the page), the one deeper in the
|
|
11
|
+
* React tree (last to mount) takes priority. When that host unmounts the
|
|
12
|
+
* next most-recently-mounted host becomes active automatically.
|
|
13
|
+
*
|
|
14
|
+
* When any SgToastHost is present, SgToaster automatically defers to it
|
|
15
|
+
* and stops rendering, so both components can coexist without duplication.
|
|
16
|
+
*
|
|
17
|
+
* Accepts the same props as SgToaster (position, duration, richColors, etc.).
|
|
18
|
+
*/
|
|
19
|
+
export function SgToastHost(props) {
|
|
20
|
+
// Stable ID across re-renders, generated once per component instance.
|
|
21
|
+
const idRef = React.useRef(null);
|
|
22
|
+
if (idRef.current === null) {
|
|
23
|
+
idRef.current = nextHostId();
|
|
24
|
+
}
|
|
25
|
+
const id = idRef.current;
|
|
26
|
+
// Start as inactive to avoid SSR hydration mismatches.
|
|
27
|
+
const [isActive, setIsActive] = React.useState(false);
|
|
28
|
+
// Register on mount, unregister on unmount.
|
|
29
|
+
React.useEffect(() => {
|
|
30
|
+
registerHost(id);
|
|
31
|
+
setIsActive(getActiveHostId() === id);
|
|
32
|
+
return () => {
|
|
33
|
+
unregisterHost(id);
|
|
34
|
+
};
|
|
35
|
+
}, [id]);
|
|
36
|
+
// React to other hosts registering / unregistering.
|
|
37
|
+
React.useEffect(() => {
|
|
38
|
+
return subscribeHostRegistry(() => {
|
|
39
|
+
setIsActive(getActiveHostId() === id);
|
|
40
|
+
});
|
|
41
|
+
}, [id]);
|
|
42
|
+
if (!isActive)
|
|
43
|
+
return null;
|
|
44
|
+
return (_jsx(SgToasterHostContext.Provider, { value: true, children: _jsx(SgToaster, { ...props }) }));
|
|
45
|
+
}
|
|
@@ -16,5 +16,7 @@ export type SgToasterProps = Omit<React.HTMLAttributes<HTMLDivElement>, "childre
|
|
|
16
16
|
transparency?: number;
|
|
17
17
|
customColors?: SgToasterCustomColors;
|
|
18
18
|
};
|
|
19
|
-
|
|
19
|
+
/** @internal — used by SgToastHost to skip the host-presence check */
|
|
20
|
+
export declare const SgToasterHostContext: React.Context<boolean>;
|
|
21
|
+
export declare function SgToaster(props: SgToasterProps): import("react/jsx-runtime").JSX.Element | null;
|
|
20
22
|
//# sourceMappingURL=SgToaster.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SgToaster.d.ts","sourceRoot":"","sources":["../../src/commons/SgToaster.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAqC,KAAK,aAAa,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"SgToaster.d.ts","sourceRoot":"","sources":["../../src/commons/SgToaster.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAqC,KAAK,aAAa,EAAE,MAAM,WAAW,CAAC;AAOlF,MAAM,MAAM,iBAAiB,GACzB,WAAW,GACX,UAAU,GACV,YAAY,GACZ,cAAc,GACd,aAAa,GACb,eAAe,CAAC;AAEpB,MAAM,MAAM,mBAAmB,GAAG;IAChC,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG,OAAO,CACzC,MAAM,CAAC,aAAa,CAAC,MAAM,CAAC,EAAE,mBAAmB,CAAC,CACnD,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,UAAU,CAAC,GAAG;IACpF,QAAQ,CAAC,EAAE,iBAAiB,CAAC;IAC7B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,qBAAqB,CAAC;CACtC,CAAC;AAgGF,sEAAsE;AACtE,eAAO,MAAM,oBAAoB,wBAA6B,CAAC;AAE/D,wBAAgB,SAAS,CAAC,KAAK,EAAE,cAAc,kDA6I9C"}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import React from "react";
|
|
4
4
|
import { dismissSgToast, subscribeSgToasts } from "./SgToast";
|
|
5
|
+
import { hasAnyHost, subscribeHostRegistry } from "./sgToastHostRegistry";
|
|
5
6
|
function cn(...parts) {
|
|
6
7
|
return parts.filter(Boolean).join(" ");
|
|
7
8
|
}
|
|
@@ -91,11 +92,21 @@ function resolveToastColors(type, richColors, customColors) {
|
|
|
91
92
|
fg: custom?.fg ?? base.fg
|
|
92
93
|
};
|
|
93
94
|
}
|
|
95
|
+
/** @internal — used by SgToastHost to skip the host-presence check */
|
|
96
|
+
export const SgToasterHostContext = React.createContext(false);
|
|
94
97
|
export function SgToaster(props) {
|
|
98
|
+
const renderedByHost = React.useContext(SgToasterHostContext);
|
|
95
99
|
const { position = "top-right", duration = 4000, visibleToasts = 6, closeButton = true, richColors = true, transparency = 0, customColors, className, style, ...rest } = props;
|
|
96
100
|
const [toasts, setToasts] = React.useState([]);
|
|
97
101
|
const timersRef = React.useRef({});
|
|
102
|
+
const [hostPresent, setHostPresent] = React.useState(() => !renderedByHost && hasAnyHost());
|
|
98
103
|
React.useEffect(() => subscribeSgToasts(setToasts), []);
|
|
104
|
+
React.useEffect(() => {
|
|
105
|
+
if (renderedByHost)
|
|
106
|
+
return;
|
|
107
|
+
setHostPresent(hasAnyHost());
|
|
108
|
+
return subscribeHostRegistry(() => setHostPresent(hasAnyHost()));
|
|
109
|
+
}, [renderedByHost]);
|
|
99
110
|
const visible = React.useMemo(() => {
|
|
100
111
|
if (visibleToasts <= 0) {
|
|
101
112
|
return [];
|
|
@@ -137,6 +148,8 @@ export function SgToaster(props) {
|
|
|
137
148
|
};
|
|
138
149
|
}, []);
|
|
139
150
|
const toastOpacity = 1 - clampTransparency(transparency) / 100;
|
|
151
|
+
if (hostPresent)
|
|
152
|
+
return null;
|
|
140
153
|
return (_jsx("div", { className: cn("pointer-events-none fixed z-[1100] flex max-h-screen w-full flex-col gap-2 p-4 sm:w-auto", POSITION_CLASS[position], className), style: style, ...rest, children: visible.map((toast) => {
|
|
141
154
|
const typeColors = resolveToastColors(toast.type, richColors, customColors);
|
|
142
155
|
const canClose = toast.closeButton ?? closeButton;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare function registerHost(id: string): void;
|
|
2
|
+
export declare function unregisterHost(id: string): void;
|
|
3
|
+
export declare function getActiveHostId(): string | null;
|
|
4
|
+
export declare function hasAnyHost(): boolean;
|
|
5
|
+
export declare function subscribeHostRegistry(fn: () => void): () => void;
|
|
6
|
+
export declare function nextHostId(): string;
|
|
7
|
+
//# sourceMappingURL=sgToastHostRegistry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sgToastHostRegistry.d.ts","sourceRoot":"","sources":["../../src/commons/sgToastHostRegistry.ts"],"names":[],"mappings":"AAeA,wBAAgB,YAAY,CAAC,EAAE,EAAE,MAAM,QAKtC;AAED,wBAAgB,cAAc,CAAC,EAAE,EAAE,MAAM,QAMxC;AAED,wBAAgB,eAAe,IAAI,MAAM,GAAG,IAAI,CAE/C;AAED,wBAAgB,UAAU,IAAI,OAAO,CAEpC;AAED,wBAAgB,qBAAqB,CAAC,EAAE,EAAE,MAAM,IAAI,GAAG,MAAM,IAAI,CAKhE;AAED,wBAAgB,UAAU,IAAI,MAAM,CAGnC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
// ---------------------------------------------------------------------------
|
|
2
|
+
// Shared host registry — used by both SgToastHost and SgToaster.
|
|
3
|
+
//
|
|
4
|
+
// SgToastHost instances push/pop themselves onto this stack.
|
|
5
|
+
// SgToaster subscribes: if the stack is non-empty it yields to the active host.
|
|
6
|
+
// ---------------------------------------------------------------------------
|
|
7
|
+
let _counter = 0;
|
|
8
|
+
const _stack = [];
|
|
9
|
+
const _listeners = new Set();
|
|
10
|
+
function _notify() {
|
|
11
|
+
_listeners.forEach((fn) => fn());
|
|
12
|
+
}
|
|
13
|
+
export function registerHost(id) {
|
|
14
|
+
if (!_stack.includes(id)) {
|
|
15
|
+
_stack.push(id);
|
|
16
|
+
_notify();
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
export function unregisterHost(id) {
|
|
20
|
+
const i = _stack.indexOf(id);
|
|
21
|
+
if (i >= 0) {
|
|
22
|
+
_stack.splice(i, 1);
|
|
23
|
+
_notify();
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
export function getActiveHostId() {
|
|
27
|
+
return _stack[_stack.length - 1] ?? null;
|
|
28
|
+
}
|
|
29
|
+
export function hasAnyHost() {
|
|
30
|
+
return _stack.length > 0;
|
|
31
|
+
}
|
|
32
|
+
export function subscribeHostRegistry(fn) {
|
|
33
|
+
_listeners.add(fn);
|
|
34
|
+
return () => {
|
|
35
|
+
_listeners.delete(fn);
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
export function nextHostId() {
|
|
39
|
+
_counter += 1;
|
|
40
|
+
return `sg-toast-host-${_counter}`;
|
|
41
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import type { SgClockTheme } from "./themes/types";
|
|
3
3
|
export type SgClockProps = {
|
|
4
|
-
|
|
4
|
+
clockStyle?: "digital" | "analog";
|
|
5
5
|
size?: "sm" | "md" | "lg" | number;
|
|
6
6
|
initialServerTime?: string;
|
|
7
7
|
timezone?: string;
|
|
@@ -13,6 +13,7 @@ export type SgClockProps = {
|
|
|
13
13
|
themeId?: string;
|
|
14
14
|
theme?: SgClockTheme;
|
|
15
15
|
className?: string;
|
|
16
|
+
style?: React.CSSProperties;
|
|
16
17
|
centerOverlay?: React.ReactNode;
|
|
17
18
|
};
|
|
18
19
|
export type SgClockDigitalStyle = "default" | "segment" | "roller3d" | "flip" | "fade" | "matrix" | "neon" | "discard";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SgClock.d.ts","sourceRoot":"","sources":["../../../src/gadgets/clock/SgClock.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAK/B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAiDnD,MAAM,MAAM,YAAY,GAAG;IACzB,
|
|
1
|
+
{"version":3,"file":"SgClock.d.ts","sourceRoot":"","sources":["../../../src/gadgets/clock/SgClock.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAK/B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAiDnD,MAAM,MAAM,YAAY,GAAG;IACzB,UAAU,CAAC,EAAE,SAAS,GAAG,QAAQ,CAAC;IAClC,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,MAAM,CAAC;IACnC,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,KAAK,GAAG,KAAK,CAAC;IACvB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,YAAY,CAAC,EAAE,mBAAmB,CAAC;IACnC,cAAc,CAAC,EAAE,MAAM,GAAG,QAAQ,CAAC;IACnC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,YAAY,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IAC5B,aAAa,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CACjC,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAC3B,SAAS,GACT,SAAS,GACT,UAAU,GACV,MAAM,GACN,MAAM,GACN,QAAQ,GACR,MAAM,GACN,SAAS,CAAC;AA8iBd,wBAAgB,OAAO,CAAC,KAAK,EAAE,YAAY,2CAkD1C"}
|
|
@@ -196,7 +196,7 @@ function renderSegmentText(text, sizePx) {
|
|
|
196
196
|
});
|
|
197
197
|
return { width, height, nodes };
|
|
198
198
|
}
|
|
199
|
-
function AnalogClock({ size = 280, initialServerTime, timezone, locale = "pt-BR", showSeconds = true, secondHandMode = "step", themeId = "classic", theme, className, centerOverlay }) {
|
|
199
|
+
function AnalogClock({ size = 280, initialServerTime, timezone, locale = "pt-BR", showSeconds = true, secondHandMode = "step", themeId = "classic", theme, className, style, centerOverlay }) {
|
|
200
200
|
const { nowMs, hasProvider, providerTick } = useClockNowMs(initialServerTime);
|
|
201
201
|
void providerTick;
|
|
202
202
|
useSecondTick(!hasProvider);
|
|
@@ -211,9 +211,9 @@ function AnalogClock({ size = 280, initialServerTime, timezone, locale = "pt-BR"
|
|
|
211
211
|
const hourDeg = (((h % 12) + m / 60 + sec / 3600) / 12) * 360;
|
|
212
212
|
const themeObj = theme ??
|
|
213
213
|
(resolver ? resolveTheme(resolver, themeId, "classic") : getTheme(themeId) ?? getTheme("classic"));
|
|
214
|
-
return (_jsx("div", { className: className, children: _jsxs("svg", { width: size, height: size, viewBox: "0 0 100 100", className: "block", "aria-label": "Analog clock", children: [_jsx("g", { id: "theme", children: themeObj ? _jsx(ThemeLayer, { theme: themeObj, args: { size, dark } }) : null }), _jsxs("g", { id: "hands", children: [_jsx("g", { transform: `rotate(${hourDeg} 50 50)`, children: _jsx("line", { x1: "50", y1: "50", x2: "50", y2: "28", className: "stroke-neutral-800 dark:stroke-neutral-200", strokeWidth: "2.6", strokeLinecap: "round" }) }), _jsx("g", { transform: `rotate(${minDeg} 50 50)`, children: _jsx("line", { x1: "50", y1: "50", x2: "50", y2: "18", className: "stroke-neutral-800 dark:stroke-neutral-200", strokeWidth: "1.7", strokeLinecap: "round" }) }), showSeconds && (_jsx("g", { transform: `rotate(${secDeg} 50 50)`, children: _jsx("line", { x1: "50", y1: "54", x2: "50", y2: "14", className: "stroke-rose-500", strokeWidth: "0.9", strokeLinecap: "round" }) }))] }), _jsx("circle", { cx: "50", cy: "50", r: "2.2", className: "fill-neutral-800 dark:fill-neutral-200" }), showSeconds ? _jsx("circle", { cx: "50", cy: "50", r: "1.1", className: "fill-rose-500" }) : null, centerOverlay ? (_jsx("foreignObject", { x: "35", y: "35", width: "30", height: "30", children: _jsx("div", { className: "flex h-full w-full items-center justify-center", children: centerOverlay }) })) : null] }) }));
|
|
214
|
+
return (_jsx("div", { className: className, style: style, children: _jsxs("svg", { width: size, height: size, viewBox: "0 0 100 100", className: "block", "aria-label": "Analog clock", children: [_jsx("g", { id: "theme", children: themeObj ? _jsx(ThemeLayer, { theme: themeObj, args: { size, dark } }) : null }), _jsxs("g", { id: "hands", children: [_jsx("g", { transform: `rotate(${hourDeg} 50 50)`, children: _jsx("line", { x1: "50", y1: "50", x2: "50", y2: "28", className: "stroke-neutral-800 dark:stroke-neutral-200", strokeWidth: "2.6", strokeLinecap: "round" }) }), _jsx("g", { transform: `rotate(${minDeg} 50 50)`, children: _jsx("line", { x1: "50", y1: "50", x2: "50", y2: "18", className: "stroke-neutral-800 dark:stroke-neutral-200", strokeWidth: "1.7", strokeLinecap: "round" }) }), showSeconds && (_jsx("g", { transform: `rotate(${secDeg} 50 50)`, children: _jsx("line", { x1: "50", y1: "54", x2: "50", y2: "14", className: "stroke-rose-500", strokeWidth: "0.9", strokeLinecap: "round" }) }))] }), _jsx("circle", { cx: "50", cy: "50", r: "2.2", className: "fill-neutral-800 dark:fill-neutral-200" }), showSeconds ? _jsx("circle", { cx: "50", cy: "50", r: "1.1", className: "fill-rose-500" }) : null, centerOverlay ? (_jsx("foreignObject", { x: "35", y: "35", width: "30", height: "30", children: _jsx("div", { className: "flex h-full w-full items-center justify-center", children: centerOverlay }) })) : null] }) }));
|
|
215
215
|
}
|
|
216
|
-
function DigitalClock({ initialServerTime, timezone, locale = "pt-BR", format = "24h", showSeconds = true, size = "md", digitalStyle = "default", className }) {
|
|
216
|
+
function DigitalClock({ initialServerTime, timezone, locale = "pt-BR", format = "24h", showSeconds = true, size = "md", digitalStyle = "default", className, style }) {
|
|
217
217
|
const { nowMs, hasProvider, providerTick } = useClockNowMs(initialServerTime);
|
|
218
218
|
void providerTick;
|
|
219
219
|
useSecondTick(!hasProvider);
|
|
@@ -257,7 +257,7 @@ function DigitalClock({ initialServerTime, timezone, locale = "pt-BR", format =
|
|
|
257
257
|
padding: `0 ${Math.round(sizePx * 0.4)}px`,
|
|
258
258
|
boxShadow: "0 .125em .3125em rgba(0,0,0,.25)",
|
|
259
259
|
}, children: _jsx("span", { style: { fontSize: Math.round(sizePx * 0.9), color: "#edebeb", fontWeight: 700, lineHeight: 1 }, children: value }) }));
|
|
260
|
-
return (_jsxs("div", { className: cn("flex items-center gap-2", className), "aria-label": "Digital clock", children: [_jsx(SgFlipDigit, { value: hh.charAt(0), fontSize: digitFont }), _jsx(SgFlipDigit, { value: hh.charAt(1), fontSize: digitFont }), _jsx(Colon, {}), _jsx(SgFlipDigit, { value: mm.charAt(0), fontSize: digitFont }), _jsx(SgFlipDigit, { value: mm.charAt(1), fontSize: digitFont }), showSeconds ? (_jsxs(_Fragment, { children: [_jsx(Colon, {}), _jsx(SgFlipDigit, { value: ss.charAt(0), fontSize: digitFont }), _jsx(SgFlipDigit, { value: ss.charAt(1), fontSize: digitFont })] })) : null, format === "12h" && dayPeriod ? _jsx(PeriodCell, { value: dayPeriod.toUpperCase() }) : null] }));
|
|
260
|
+
return (_jsxs("div", { className: cn("flex items-center gap-2", className), style: style, "aria-label": "Digital clock", children: [_jsx(SgFlipDigit, { value: hh.charAt(0), fontSize: digitFont }), _jsx(SgFlipDigit, { value: hh.charAt(1), fontSize: digitFont }), _jsx(Colon, {}), _jsx(SgFlipDigit, { value: mm.charAt(0), fontSize: digitFont }), _jsx(SgFlipDigit, { value: mm.charAt(1), fontSize: digitFont }), showSeconds ? (_jsxs(_Fragment, { children: [_jsx(Colon, {}), _jsx(SgFlipDigit, { value: ss.charAt(0), fontSize: digitFont }), _jsx(SgFlipDigit, { value: ss.charAt(1), fontSize: digitFont })] })) : null, format === "12h" && dayPeriod ? _jsx(PeriodCell, { value: dayPeriod.toUpperCase() }) : null] }));
|
|
261
261
|
}
|
|
262
262
|
if (digitalStyle === "roller3d") {
|
|
263
263
|
const hNum = Number.parseInt(hour, 10) || 0;
|
|
@@ -274,7 +274,7 @@ function DigitalClock({ initialServerTime, timezone, locale = "pt-BR", format =
|
|
|
274
274
|
const hh = String(safeHour).padStart(2, "0");
|
|
275
275
|
const mm = String(mNum).padStart(2, "0");
|
|
276
276
|
const ss = String(sNum).padStart(2, "0");
|
|
277
|
-
return (_jsxs("div", { className: cn("flex items-center gap-4", className), style: fontSize, "aria-label": "Digital clock", children: [_jsx(SgRoller3DDigit, { value: hh, items: hourItems, fontSize: digitFont }), _jsx(SgRoller3DDigit, { value: mm, items: minuteItems, fontSize: digitFont }), showSeconds ? _jsx(SgRoller3DDigit, { value: ss, items: secondItems, fontSize: digitFont }) : null, format === "12h" && dayPeriod ? (_jsx(SgRoller3DDigit, { value: dayPeriod.toUpperCase(), items: periodItems, fontSize: digitFont })) : null] }));
|
|
277
|
+
return (_jsxs("div", { className: cn("flex items-center gap-4", className), style: { ...fontSize, ...style }, "aria-label": "Digital clock", children: [_jsx(SgRoller3DDigit, { value: hh, items: hourItems, fontSize: digitFont }), _jsx(SgRoller3DDigit, { value: mm, items: minuteItems, fontSize: digitFont }), showSeconds ? _jsx(SgRoller3DDigit, { value: ss, items: secondItems, fontSize: digitFont }) : null, format === "12h" && dayPeriod ? (_jsx(SgRoller3DDigit, { value: dayPeriod.toUpperCase(), items: periodItems, fontSize: digitFont })) : null] }));
|
|
278
278
|
}
|
|
279
279
|
if (digitalStyle === "fade") {
|
|
280
280
|
const hNum = Number.parseInt(hour, 10) || 0;
|
|
@@ -287,7 +287,7 @@ function DigitalClock({ initialServerTime, timezone, locale = "pt-BR", format =
|
|
|
287
287
|
const digitFont = Math.round(sizePx * 1.35);
|
|
288
288
|
const cardH = Math.round(digitFont * 1.4);
|
|
289
289
|
const Colon = () => (_jsxs("div", { className: "flex flex-col items-center justify-center gap-2", style: { height: cardH }, children: [_jsx("div", { className: "h-2 w-2 rounded-full bg-neutral-500/70" }), _jsx("div", { className: "h-2 w-2 rounded-full bg-neutral-500/70" })] }));
|
|
290
|
-
return (_jsxs("div", { className: cn("flex items-center gap-2", className), "aria-label": "Digital clock", children: [_jsx(SgFadeDigit, { value: hh.charAt(0), fontSize: digitFont }), _jsx(SgFadeDigit, { value: hh.charAt(1), fontSize: digitFont }), _jsx(Colon, {}), _jsx(SgFadeDigit, { value: mm.charAt(0), fontSize: digitFont }), _jsx(SgFadeDigit, { value: mm.charAt(1), fontSize: digitFont }), showSeconds ? (_jsxs(_Fragment, { children: [_jsx(Colon, {}), _jsx(SgFadeDigit, { value: ss.charAt(0), fontSize: digitFont }), _jsx(SgFadeDigit, { value: ss.charAt(1), fontSize: digitFont })] })) : null, format === "12h" && dayPeriod ? (_jsx("span", { className: "text-xs font-semibold text-muted-foreground", children: dayPeriod.toUpperCase() })) : null] }));
|
|
290
|
+
return (_jsxs("div", { className: cn("flex items-center gap-2", className), style: style, "aria-label": "Digital clock", children: [_jsx(SgFadeDigit, { value: hh.charAt(0), fontSize: digitFont }), _jsx(SgFadeDigit, { value: hh.charAt(1), fontSize: digitFont }), _jsx(Colon, {}), _jsx(SgFadeDigit, { value: mm.charAt(0), fontSize: digitFont }), _jsx(SgFadeDigit, { value: mm.charAt(1), fontSize: digitFont }), showSeconds ? (_jsxs(_Fragment, { children: [_jsx(Colon, {}), _jsx(SgFadeDigit, { value: ss.charAt(0), fontSize: digitFont }), _jsx(SgFadeDigit, { value: ss.charAt(1), fontSize: digitFont })] })) : null, format === "12h" && dayPeriod ? (_jsx("span", { className: "text-xs font-semibold text-muted-foreground", children: dayPeriod.toUpperCase() })) : null] }));
|
|
291
291
|
}
|
|
292
292
|
if (digitalStyle === "discard") {
|
|
293
293
|
const hNum = Number.parseInt(hour, 10) || 0;
|
|
@@ -312,27 +312,27 @@ function DigitalClock({ initialServerTime, timezone, locale = "pt-BR", format =
|
|
|
312
312
|
};
|
|
313
313
|
const Colon = () => (_jsx(SgDiscardDigit, { value: ":", fontSize: Math.max(26, Math.round(digitFont * 0.72)), totalNumberPages: 1, transitionMs: 560, animateOnChange: false }));
|
|
314
314
|
const PeriodCell = ({ value }) => (_jsx(SgDiscardDigit, { value: value, fontSize: Math.max(20, Math.round(digitFont * 0.52)), totalNumberPages: 1, transitionMs: 560, animateOnChange: false }));
|
|
315
|
-
return (_jsxs("div", { className: cn("flex items-end gap-2", className), "aria-label": "Digital clock", children: [_jsx(SgDiscardDigit, { value: hh.charAt(0), fontSize: digitFont, totalNumberPages: pagesForDigit(hh.charAt(0)), transitionMs: 560, changeAnimationMode: "incoming" }), _jsx(SgDiscardDigit, { value: hh.charAt(1), fontSize: digitFont, totalNumberPages: pagesForDigit(hh.charAt(1)), transitionMs: 560, changeAnimationMode: "incoming" }), _jsx(Colon, {}), _jsx(SgDiscardDigit, { value: mm.charAt(0), fontSize: digitFont, totalNumberPages: pagesForDigit(mm.charAt(0)), transitionMs: 560, changeAnimationMode: "incoming" }), _jsx(SgDiscardDigit, { value: mm.charAt(1), fontSize: digitFont, totalNumberPages: pagesForDigit(mm.charAt(1)), transitionMs: 560, changeAnimationMode: "incoming" }), showSeconds ? (_jsxs(_Fragment, { children: [_jsx(Colon, {}), _jsx(SgDiscardDigit, { value: ss.charAt(0), fontSize: digitFont, totalNumberPages: pagesForDigit(ss.charAt(0)), transitionMs: 560, changeAnimationMode: "incoming" }), _jsx(SgDiscardDigit, { value: ss.charAt(1), fontSize: digitFont, totalNumberPages: pagesForDigit(ss.charAt(1)), transitionMs: 560, changeAnimationMode: "incoming" })] })) : null, format === "12h" && dayPeriod ? _jsx(PeriodCell, { value: dayPeriod.toUpperCase() }) : null] }));
|
|
315
|
+
return (_jsxs("div", { className: cn("flex items-end gap-2", className), style: style, "aria-label": "Digital clock", children: [_jsx(SgDiscardDigit, { value: hh.charAt(0), fontSize: digitFont, totalNumberPages: pagesForDigit(hh.charAt(0)), transitionMs: 560, changeAnimationMode: "incoming" }), _jsx(SgDiscardDigit, { value: hh.charAt(1), fontSize: digitFont, totalNumberPages: pagesForDigit(hh.charAt(1)), transitionMs: 560, changeAnimationMode: "incoming" }), _jsx(Colon, {}), _jsx(SgDiscardDigit, { value: mm.charAt(0), fontSize: digitFont, totalNumberPages: pagesForDigit(mm.charAt(0)), transitionMs: 560, changeAnimationMode: "incoming" }), _jsx(SgDiscardDigit, { value: mm.charAt(1), fontSize: digitFont, totalNumberPages: pagesForDigit(mm.charAt(1)), transitionMs: 560, changeAnimationMode: "incoming" }), showSeconds ? (_jsxs(_Fragment, { children: [_jsx(Colon, {}), _jsx(SgDiscardDigit, { value: ss.charAt(0), fontSize: digitFont, totalNumberPages: pagesForDigit(ss.charAt(0)), transitionMs: 560, changeAnimationMode: "incoming" }), _jsx(SgDiscardDigit, { value: ss.charAt(1), fontSize: digitFont, totalNumberPages: pagesForDigit(ss.charAt(1)), transitionMs: 560, changeAnimationMode: "incoming" })] })) : null, format === "12h" && dayPeriod ? _jsx(PeriodCell, { value: dayPeriod.toUpperCase() }) : null] }));
|
|
316
316
|
}
|
|
317
317
|
if (digitalStyle === "matrix") {
|
|
318
318
|
const dotSize = Math.max(3, Math.round(sizePx * 0.32));
|
|
319
|
-
return (_jsx("div", { className: cn("flex items-center", className), "aria-label": "Digital clock", children: _jsx(SgMatrixDigit, { value: withPeriod, dotSize: dotSize, gap: Math.max(1, Math.round(dotSize * 0.35)), charGap: Math.max(3, Math.round(dotSize * 0.9)), padding: Math.max(6, Math.round(dotSize * 1.3)), rounded: Math.max(8, Math.round(dotSize * 1.1)) }) }));
|
|
319
|
+
return (_jsx("div", { className: cn("flex items-center", className), style: style, "aria-label": "Digital clock", children: _jsx(SgMatrixDigit, { value: withPeriod, dotSize: dotSize, gap: Math.max(1, Math.round(dotSize * 0.35)), charGap: Math.max(3, Math.round(dotSize * 0.9)), padding: Math.max(6, Math.round(dotSize * 1.3)), rounded: Math.max(8, Math.round(dotSize * 1.1)) }) }));
|
|
320
320
|
}
|
|
321
321
|
if (digitalStyle === "neon") {
|
|
322
322
|
const neonFont = Math.max(18, Math.round(sizePx * 1.35));
|
|
323
|
-
return (_jsx("div", { className: cn("flex items-center", className), "aria-label": "Digital clock", children: _jsx(SgNeonDigit, { value: withPeriod, fontSize: neonFont, padding: Math.max(8, Math.round(sizePx * 0.6)), rounded: Math.max(10, Math.round(sizePx * 0.45)) }) }));
|
|
323
|
+
return (_jsx("div", { className: cn("flex items-center", className), style: style, "aria-label": "Digital clock", children: _jsx(SgNeonDigit, { value: withPeriod, fontSize: neonFont, padding: Math.max(8, Math.round(sizePx * 0.6)), rounded: Math.max(10, Math.round(sizePx * 0.45)) }) }));
|
|
324
324
|
}
|
|
325
325
|
if (digitalStyle === "segment") {
|
|
326
326
|
const seg = renderSegmentText(text, sizePx);
|
|
327
|
-
return (_jsxs("div", { className: cn("flex items-end gap-2", className), "aria-label": "Digital clock", children: [_jsx("svg", { width: seg.width, height: seg.height, viewBox: `0 0 ${seg.width} ${seg.height}`, className: "block", children: seg.nodes }), format === "12h" && dayPeriod ? (_jsx("span", { className: "text-xs font-semibold text-muted-foreground", children: dayPeriod })) : null] }));
|
|
327
|
+
return (_jsxs("div", { className: cn("flex items-end gap-2", className), style: style, "aria-label": "Digital clock", children: [_jsx("svg", { width: seg.width, height: seg.height, viewBox: `0 0 ${seg.width} ${seg.height}`, className: "block", children: seg.nodes }), format === "12h" && dayPeriod ? (_jsx("span", { className: "text-xs font-semibold text-muted-foreground", children: dayPeriod })) : null] }));
|
|
328
328
|
}
|
|
329
|
-
return (_jsxs("div", { className: cn("font-mono tabular-nums", classSize, className), style: fontSize, children: [text, format === "12h" && dayPeriod ? (_jsx("span", { className: "ml-2 align-top text-xs font-semibold text-muted-foreground", children: dayPeriod })) : null] }));
|
|
329
|
+
return (_jsxs("div", { className: cn("font-mono tabular-nums", classSize, className), style: { ...fontSize, ...style }, children: [text, format === "12h" && dayPeriod ? (_jsx("span", { className: "ml-2 align-top text-xs font-semibold text-muted-foreground", children: dayPeriod })) : null] }));
|
|
330
330
|
}
|
|
331
331
|
export function SgClock(props) {
|
|
332
|
-
const {
|
|
333
|
-
if (
|
|
332
|
+
const { clockStyle = "digital", size = "md", initialServerTime, timezone, locale = "pt-BR", format = "24h", showSeconds = true, digitalStyle = "default", secondHandMode = "step", themeId = "classic", theme, className, style, centerOverlay } = props;
|
|
333
|
+
if (clockStyle === "analog") {
|
|
334
334
|
const analogSize = typeof size === "number" ? size : size === "sm" ? 140 : size === "lg" ? 320 : 240;
|
|
335
|
-
return (_jsx(AnalogClock, { size: analogSize, initialServerTime: initialServerTime, themeId: themeId, theme: theme, timezone: timezone, locale: locale, showSeconds: showSeconds, secondHandMode: secondHandMode, className: className, centerOverlay: centerOverlay }));
|
|
335
|
+
return (_jsx(AnalogClock, { size: analogSize, initialServerTime: initialServerTime, themeId: themeId, theme: theme, timezone: timezone, locale: locale, showSeconds: showSeconds, secondHandMode: secondHandMode, className: className, style: style, centerOverlay: centerOverlay }));
|
|
336
336
|
}
|
|
337
|
-
return (_jsx(DigitalClock, { timezone: timezone, initialServerTime: initialServerTime, locale: locale, format: format, showSeconds: showSeconds, size: size, digitalStyle: digitalStyle, className: className }));
|
|
337
|
+
return (_jsx(DigitalClock, { timezone: timezone, initialServerTime: initialServerTime, locale: locale, format: format, showSeconds: showSeconds, size: size, digitalStyle: digitalStyle, className: className, style: style }));
|
|
338
338
|
}
|
|
@@ -21,7 +21,7 @@ export type SgStringAnimatorProps = {
|
|
|
21
21
|
* - "matrix": pontos em matriz LED (SgMatrixDigit)
|
|
22
22
|
* @default "roller3d"
|
|
23
23
|
*/
|
|
24
|
-
|
|
24
|
+
stringAnimatorStyle?: SgStringAnimatorStyle;
|
|
25
25
|
/**
|
|
26
26
|
* Velocidade de 1 (muito lento) a 100 (muito rapido).
|
|
27
27
|
* Controla o intervalo de tempo entre a troca de cada caractere.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SgStringAnimator.d.ts","sourceRoot":"","sources":["../../../src/gadgets/string-animator/SgStringAnimator.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAc/B,eAAO,MAAM,kCAAkC,EAAE,MAAM,EAQtD,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAC7B,UAAU,GACV,MAAM,GACN,MAAM,GACN,MAAM,GACN,SAAS,GACT,QAAQ,CAAC;AAEb,MAAM,MAAM,qBAAqB,GAAG,MAAM,GAAG,OAAO,CAAC;AAErD,MAAM,MAAM,mBAAmB,GAAG;IAChC,yDAAyD;IACzD,cAAc,EAAE,MAAM,IAAI,CAAC;CAC5B,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG;IAClC,uCAAuC;IACvC,YAAY,EAAE,MAAM,CAAC;IACrB,qDAAqD;IACrD,YAAY,EAAE,MAAM,CAAC;IACrB;;;;;;;;;OASG;IACH,
|
|
1
|
+
{"version":3,"file":"SgStringAnimator.d.ts","sourceRoot":"","sources":["../../../src/gadgets/string-animator/SgStringAnimator.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAc/B,eAAO,MAAM,kCAAkC,EAAE,MAAM,EAQtD,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAC7B,UAAU,GACV,MAAM,GACN,MAAM,GACN,MAAM,GACN,SAAS,GACT,QAAQ,CAAC;AAEb,MAAM,MAAM,qBAAqB,GAAG,MAAM,GAAG,OAAO,CAAC;AAErD,MAAM,MAAM,mBAAmB,GAAG;IAChC,yDAAyD;IACzD,cAAc,EAAE,MAAM,IAAI,CAAC;CAC5B,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG;IAClC,uCAAuC;IACvC,YAAY,EAAE,MAAM,CAAC;IACrB,qDAAqD;IACrD,YAAY,EAAE,MAAM,CAAC;IACrB;;;;;;;;;OASG;IACH,mBAAmB,CAAC,EAAE,qBAAqB,CAAC;IAC5C;;;;OAIG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;;OAKG;IACH,OAAO,CAAC,EAAE,qBAAqB,CAAC;IAChC;;;;OAIG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,iFAAiF;IACjF,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;;;OAKG;IACH,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,kDAAkD;IAClD,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAWF;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,gBAAgB,mGA2L5B,CAAC"}
|
|
@@ -48,7 +48,7 @@ const GAP_BY_STYLE = {
|
|
|
48
48
|
* <SgStringAnimator sourceString="LUCIANO" targetString={target} style="fade" autoStart />
|
|
49
49
|
* <button onClick={() => setTarget("MARTA")}>Trocar</button>
|
|
50
50
|
*/
|
|
51
|
-
export const SgStringAnimator = React.forwardRef(function SgStringAnimator({ sourceString, targetString, style = "roller3d", velocity = 50, emptyChar = " ", alignTo = "left", autoStart = false, fontSize = 32, charset = SG_STRING_ANIMATOR_DEFAULT_CHARSET, color, backgroundColor, className, }, ref) {
|
|
51
|
+
export const SgStringAnimator = React.forwardRef(function SgStringAnimator({ sourceString, targetString, stringAnimatorStyle: style = "roller3d", velocity = 50, emptyChar = " ", alignTo = "left", autoStart = false, fontSize = 32, charset = SG_STRING_ANIMATOR_DEFAULT_CHARSET, color, backgroundColor, className, }, ref) {
|
|
52
52
|
// Normalize emptyChar to a single character
|
|
53
53
|
const safeEmpty = emptyChar.charAt(0) || " ";
|
|
54
54
|
// Clamp velocity 1-100 and compute step delay:
|
package/dist/i18n/en-US.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"en-US.d.ts","sourceRoot":"","sources":["../../src/i18n/en-US.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"en-US.d.ts","sourceRoot":"","sources":["../../src/i18n/en-US.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAkGhC,CAAC;AAEF,eAAe,IAAI,CAAC"}
|
package/dist/i18n/en-US.js
CHANGED
|
@@ -80,6 +80,21 @@ const enUS = {
|
|
|
80
80
|
"components.actions.confirm": "Confirm",
|
|
81
81
|
"components.rating.required": "Please provide a rating",
|
|
82
82
|
"components.rating.cancel": "Cancel rating",
|
|
83
|
-
"components.radiogroup.cancel": "No option"
|
|
83
|
+
"components.radiogroup.cancel": "No option",
|
|
84
|
+
"components.checkboxgroup.checkAll": "Select all",
|
|
85
|
+
"components.orderlist.moveTop": "Move to top",
|
|
86
|
+
"components.orderlist.moveUp": "Move up",
|
|
87
|
+
"components.orderlist.moveDown": "Move down",
|
|
88
|
+
"components.orderlist.moveBottom": "Move to bottom",
|
|
89
|
+
"components.orderlist.empty": "No items available.",
|
|
90
|
+
"components.picklist.moveToTarget": "Move selected to target",
|
|
91
|
+
"components.picklist.moveAllToTarget": "Move all to target",
|
|
92
|
+
"components.picklist.moveToSource": "Move selected to source",
|
|
93
|
+
"components.picklist.moveAllToSource": "Move all to source",
|
|
94
|
+
"components.picklist.sourceHeader": "Source",
|
|
95
|
+
"components.picklist.targetHeader": "Target",
|
|
96
|
+
"components.picklist.sourceFilterPlaceholder": "Search source",
|
|
97
|
+
"components.picklist.targetFilterPlaceholder": "Search target",
|
|
98
|
+
"components.picklist.empty": "No items available."
|
|
84
99
|
};
|
|
85
100
|
export default enUS;
|
package/dist/i18n/es.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"es.d.ts","sourceRoot":"","sources":["../../src/i18n/es.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,EAAE,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"es.d.ts","sourceRoot":"","sources":["../../src/i18n/es.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,EAAE,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAkG9B,CAAC;AAEF,eAAe,EAAE,CAAC"}
|