ssovee-os-web-ui 0.1.31 → 0.1.33
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/README.md +18 -4
- package/dist/index.cjs +158 -11
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +95 -2
- package/dist/index.d.cts +9 -1
- package/dist/index.d.ts +9 -1
- package/dist/index.js +159 -13
- package/dist/index.js.map +1 -1
- package/dist/sdk.cjs +20 -5
- package/dist/sdk.cjs.map +1 -1
- package/dist/sdk.d.cts +5 -1
- package/dist/sdk.d.ts +5 -1
- package/dist/sdk.js +20 -5
- package/dist/sdk.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -59,7 +59,6 @@ export function Example() {
|
|
|
59
59
|
|
|
60
60
|
### Simple window
|
|
61
61
|
|
|
62
|
-
{% raw %}
|
|
63
62
|
```tsx
|
|
64
63
|
import { WindowWithoutSideMenu, Typography } from "ssovee-os-web-ui";
|
|
65
64
|
|
|
@@ -82,11 +81,9 @@ export function NotesWindow() {
|
|
|
82
81
|
);
|
|
83
82
|
}
|
|
84
83
|
```
|
|
85
|
-
{% endraw %}
|
|
86
84
|
|
|
87
85
|
### Window with sidebar menu
|
|
88
86
|
|
|
89
|
-
{% raw %}
|
|
90
87
|
```tsx
|
|
91
88
|
import { WindowWithSideMenu, Typography, Button } from "ssovee-os-web-ui";
|
|
92
89
|
|
|
@@ -121,7 +118,23 @@ export function SettingsWindow() {
|
|
|
121
118
|
);
|
|
122
119
|
}
|
|
123
120
|
```
|
|
124
|
-
|
|
121
|
+
|
|
122
|
+
## Skeleton loader
|
|
123
|
+
|
|
124
|
+
```tsx
|
|
125
|
+
import { Skeleton } from "ssovee-os-web-ui";
|
|
126
|
+
|
|
127
|
+
export function LoadingState() {
|
|
128
|
+
return (
|
|
129
|
+
<div style={{ display: "grid", gap: 12 }}>
|
|
130
|
+
<Skeleton variant="text" lines={3} />
|
|
131
|
+
<Skeleton variant="avatar" className="h-12 w-12" />
|
|
132
|
+
<Skeleton variant="image" className="h-40" />
|
|
133
|
+
<Skeleton variant="card" lines={4} />
|
|
134
|
+
</div>
|
|
135
|
+
);
|
|
136
|
+
}
|
|
137
|
+
```
|
|
125
138
|
|
|
126
139
|
## Plugin playground
|
|
127
140
|
|
|
@@ -173,6 +186,7 @@ The package exports these components and types for external use:
|
|
|
173
186
|
- `Dropdown`
|
|
174
187
|
- `DropdownOption`
|
|
175
188
|
- `Loading`
|
|
189
|
+
- `Skeleton`
|
|
176
190
|
- `Toast`
|
|
177
191
|
- `Alert`
|
|
178
192
|
- `Modal`
|
package/dist/index.cjs
CHANGED
|
@@ -783,6 +783,105 @@ var Loading = ({
|
|
|
783
783
|
return content;
|
|
784
784
|
};
|
|
785
785
|
var Loading_default = Loading;
|
|
786
|
+
var basePulseClasses = "bg-surface-1/35 dark:bg-surface-3/20 rounded-md overflow-hidden";
|
|
787
|
+
var lineWidths = ["w-full", "w-11/12", "w-4/5", "w-3/5"];
|
|
788
|
+
var Skeleton = ({
|
|
789
|
+
variant = "text",
|
|
790
|
+
lines = 3,
|
|
791
|
+
lineClassName,
|
|
792
|
+
className,
|
|
793
|
+
animate = true,
|
|
794
|
+
...props
|
|
795
|
+
}) => {
|
|
796
|
+
const pulseClasses = animate ? "animate-pulse" : "";
|
|
797
|
+
if (variant === "avatar") {
|
|
798
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
799
|
+
"div",
|
|
800
|
+
{
|
|
801
|
+
className: cn(basePulseClasses, pulseClasses, "rounded-full h-10 w-10", className),
|
|
802
|
+
"aria-hidden": "true",
|
|
803
|
+
...props
|
|
804
|
+
}
|
|
805
|
+
);
|
|
806
|
+
}
|
|
807
|
+
if (variant === "image") {
|
|
808
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
809
|
+
"div",
|
|
810
|
+
{
|
|
811
|
+
className: cn(basePulseClasses, pulseClasses, "h-40 w-full", className),
|
|
812
|
+
"aria-hidden": "true",
|
|
813
|
+
...props
|
|
814
|
+
}
|
|
815
|
+
);
|
|
816
|
+
}
|
|
817
|
+
if (variant === "rect") {
|
|
818
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
819
|
+
"div",
|
|
820
|
+
{
|
|
821
|
+
className: cn(basePulseClasses, pulseClasses, "h-12 w-full", className),
|
|
822
|
+
"aria-hidden": "true",
|
|
823
|
+
...props
|
|
824
|
+
}
|
|
825
|
+
);
|
|
826
|
+
}
|
|
827
|
+
if (variant === "card") {
|
|
828
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
829
|
+
"div",
|
|
830
|
+
{
|
|
831
|
+
className: cn(
|
|
832
|
+
"w-full rounded-xl border border-surface-1/40 bg-secondary/60 p-4",
|
|
833
|
+
className
|
|
834
|
+
),
|
|
835
|
+
"aria-hidden": "true",
|
|
836
|
+
...props,
|
|
837
|
+
children: [
|
|
838
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-3", children: [
|
|
839
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: cn(basePulseClasses, pulseClasses, "h-10 w-10 rounded-full") }),
|
|
840
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex-1 space-y-2", children: [
|
|
841
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: cn(basePulseClasses, pulseClasses, "h-3 w-1/3 rounded") }),
|
|
842
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: cn(basePulseClasses, pulseClasses, "h-3 w-1/4 rounded") })
|
|
843
|
+
] })
|
|
844
|
+
] }),
|
|
845
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-4 space-y-2", children: Array.from({ length: Math.max(lines, 2) }).map((_, index) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
846
|
+
"div",
|
|
847
|
+
{
|
|
848
|
+
className: cn(
|
|
849
|
+
basePulseClasses,
|
|
850
|
+
pulseClasses,
|
|
851
|
+
"h-3 rounded",
|
|
852
|
+
lineWidths[index % lineWidths.length],
|
|
853
|
+
lineClassName
|
|
854
|
+
)
|
|
855
|
+
},
|
|
856
|
+
`card-line-${index}`
|
|
857
|
+
)) })
|
|
858
|
+
]
|
|
859
|
+
}
|
|
860
|
+
);
|
|
861
|
+
}
|
|
862
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
863
|
+
"div",
|
|
864
|
+
{
|
|
865
|
+
className: cn("w-full space-y-2", className),
|
|
866
|
+
"aria-hidden": "true",
|
|
867
|
+
...props,
|
|
868
|
+
children: Array.from({ length: Math.max(lines, 1) }).map((_, index) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
869
|
+
"div",
|
|
870
|
+
{
|
|
871
|
+
className: cn(
|
|
872
|
+
basePulseClasses,
|
|
873
|
+
pulseClasses,
|
|
874
|
+
"h-3 rounded",
|
|
875
|
+
lineWidths[index % lineWidths.length],
|
|
876
|
+
lineClassName
|
|
877
|
+
)
|
|
878
|
+
},
|
|
879
|
+
`text-line-${index}`
|
|
880
|
+
))
|
|
881
|
+
}
|
|
882
|
+
);
|
|
883
|
+
};
|
|
884
|
+
var Skeleton_default = Skeleton;
|
|
786
885
|
var Toast = ({
|
|
787
886
|
heading,
|
|
788
887
|
message,
|
|
@@ -1513,6 +1612,9 @@ var SearchInput = React22__namespace.default.forwardRef(
|
|
|
1513
1612
|
const inputRef = React22.useRef(null);
|
|
1514
1613
|
React22.useImperativeHandle(ref, () => inputRef.current);
|
|
1515
1614
|
const { addShortcutListener, removeShortcutListener, formatKeys, getShortcutByCommand } = useShortcutFormatter_default();
|
|
1615
|
+
React22.useEffect(() => {
|
|
1616
|
+
setSearchValue(value ?? "");
|
|
1617
|
+
}, [value]);
|
|
1516
1618
|
const handleChange = (e) => {
|
|
1517
1619
|
const newValue = e.target.value;
|
|
1518
1620
|
setSearchValue(newValue);
|
|
@@ -1553,17 +1655,43 @@ var SearchInput = React22__namespace.default.forwardRef(
|
|
|
1553
1655
|
outline: "bg-transparent border border-surface-1 focus:border-brand-color focus:ring-1 focus:ring-brand-color/50"
|
|
1554
1656
|
};
|
|
1555
1657
|
const sizeClasses = {
|
|
1556
|
-
sm: "h-8 px-2 pl-
|
|
1557
|
-
md: "h-10 px-3 pl-
|
|
1558
|
-
lg: "h-12 px-4 pl-12 text-lg"
|
|
1658
|
+
sm: "h-8 px-2 pl-9 text-sm leading-tight",
|
|
1659
|
+
md: "h-10 px-3 pl-11 text-base leading-tight",
|
|
1660
|
+
lg: "h-12 px-4 pl-12 text-lg leading-tight"
|
|
1559
1661
|
};
|
|
1560
1662
|
const iconSizeClasses = {
|
|
1561
1663
|
sm: "w-4 h-4",
|
|
1562
1664
|
md: "w-5 h-5",
|
|
1563
1665
|
lg: "w-6 h-6"
|
|
1564
1666
|
};
|
|
1565
|
-
|
|
1566
|
-
|
|
1667
|
+
const iconPixelSizes = {
|
|
1668
|
+
sm: 16,
|
|
1669
|
+
md: 18,
|
|
1670
|
+
lg: 20
|
|
1671
|
+
};
|
|
1672
|
+
const iconPositionClasses = {
|
|
1673
|
+
sm: "left-2.5",
|
|
1674
|
+
md: "left-3",
|
|
1675
|
+
lg: "left-3.5"
|
|
1676
|
+
};
|
|
1677
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative w-full min-w-0", children: [
|
|
1678
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1679
|
+
"div",
|
|
1680
|
+
{
|
|
1681
|
+
className: cn(
|
|
1682
|
+
"pointer-events-none absolute top-1/2 z-10 -translate-y-1/2 text-neutral-400",
|
|
1683
|
+
iconPositionClasses[size]
|
|
1684
|
+
),
|
|
1685
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1686
|
+
react.MagnifyingGlassIcon,
|
|
1687
|
+
{
|
|
1688
|
+
size: iconPixelSizes[size],
|
|
1689
|
+
className: cn("block shrink-0", iconSizeClasses[size]),
|
|
1690
|
+
weight: "regular"
|
|
1691
|
+
}
|
|
1692
|
+
)
|
|
1693
|
+
}
|
|
1694
|
+
),
|
|
1567
1695
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1568
1696
|
"input",
|
|
1569
1697
|
{
|
|
@@ -1575,6 +1703,7 @@ var SearchInput = React22__namespace.default.forwardRef(
|
|
|
1575
1703
|
className: cn(
|
|
1576
1704
|
baseClasses,
|
|
1577
1705
|
variantClasses[variant],
|
|
1706
|
+
"w-full min-w-0",
|
|
1578
1707
|
sizeClasses[size],
|
|
1579
1708
|
showClearButton && searchValue ? "pr-10" : "",
|
|
1580
1709
|
className
|
|
@@ -1586,7 +1715,9 @@ var SearchInput = React22__namespace.default.forwardRef(
|
|
|
1586
1715
|
"button",
|
|
1587
1716
|
{
|
|
1588
1717
|
onClick: handleClear,
|
|
1589
|
-
className: "absolute right-3 top-1/2
|
|
1718
|
+
className: "absolute right-3 top-1/2 -translate-y-1/2 text-neutral-400 hover:text-neutral-600 transition-colors",
|
|
1719
|
+
"aria-label": "Clear search",
|
|
1720
|
+
type: "button",
|
|
1590
1721
|
children: /* @__PURE__ */ jsxRuntime.jsx("svg", { className: iconSizeClasses[size], fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsxRuntime.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M6 18L18 6M6 6l12 12" }) })
|
|
1591
1722
|
}
|
|
1592
1723
|
)
|
|
@@ -3111,16 +3242,31 @@ var soundMap = {
|
|
|
3111
3242
|
success: success_tone_default,
|
|
3112
3243
|
swipe: swipe_tone_default
|
|
3113
3244
|
};
|
|
3245
|
+
var audioCache = /* @__PURE__ */ new Map();
|
|
3246
|
+
var clampVolume = (value) => Math.min(1, Math.max(0, value));
|
|
3114
3247
|
var useSound = () => {
|
|
3115
|
-
const playSound = React22.useCallback((type) => {
|
|
3248
|
+
const playSound = React22.useCallback(async (type, options) => {
|
|
3116
3249
|
if (typeof window === "undefined" || typeof window.Audio === "undefined") {
|
|
3117
|
-
return;
|
|
3250
|
+
return false;
|
|
3118
3251
|
}
|
|
3119
3252
|
const soundSrc = soundMap[type];
|
|
3120
|
-
|
|
3121
|
-
audio
|
|
3253
|
+
let audio = audioCache.get(type);
|
|
3254
|
+
if (!audio) {
|
|
3255
|
+
audio = new window.Audio(soundSrc);
|
|
3256
|
+
audio.preload = "auto";
|
|
3257
|
+
audioCache.set(type, audio);
|
|
3258
|
+
}
|
|
3259
|
+
audio.volume = clampVolume(options?.volume ?? 1);
|
|
3260
|
+
if (options?.restart !== false) {
|
|
3261
|
+
audio.currentTime = 0;
|
|
3262
|
+
}
|
|
3263
|
+
try {
|
|
3264
|
+
await audio.play();
|
|
3265
|
+
return true;
|
|
3266
|
+
} catch (err) {
|
|
3122
3267
|
console.error("Sound playback failed:", err);
|
|
3123
|
-
|
|
3268
|
+
return false;
|
|
3269
|
+
}
|
|
3124
3270
|
}, []);
|
|
3125
3271
|
return { playSound };
|
|
3126
3272
|
};
|
|
@@ -3145,6 +3291,7 @@ exports.Progress = Progress_default;
|
|
|
3145
3291
|
exports.Radio = Radio_default;
|
|
3146
3292
|
exports.SearchInput = SearchInput_default;
|
|
3147
3293
|
exports.Select = Select_default;
|
|
3294
|
+
exports.Skeleton = Skeleton_default;
|
|
3148
3295
|
exports.Table = Table;
|
|
3149
3296
|
exports.TableBody = TableBody;
|
|
3150
3297
|
exports.TableCaption = TableCaption;
|