ssovee-os-web-ui 0.1.22 → 0.1.23
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 +11 -1
- package/dist/index.cjs +54 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -17
- package/dist/index.d.ts +2 -17
- package/dist/index.js +53 -1
- package/dist/index.js.map +1 -1
- package/dist/sdk.cjs +265 -0
- package/dist/sdk.cjs.map +1 -0
- package/dist/sdk.d.cts +24 -0
- package/dist/sdk.d.ts +24 -0
- package/dist/sdk.js +260 -0
- package/dist/sdk.js.map +1 -0
- package/package.json +6 -1
package/README.md
CHANGED
|
@@ -53,6 +53,14 @@ export function Example() {
|
|
|
53
53
|
}
|
|
54
54
|
```
|
|
55
55
|
|
|
56
|
+
## Hooks
|
|
57
|
+
|
|
58
|
+
Hooks are also available through the SDK-style entrypoint:
|
|
59
|
+
|
|
60
|
+
```tsx
|
|
61
|
+
import { useGridClasses, useDeviceSupport, useSound } from "ssovee-os-web-ui/sdk";
|
|
62
|
+
```
|
|
63
|
+
|
|
56
64
|
## Public exports
|
|
57
65
|
|
|
58
66
|
The package exports these components and types for external use:
|
|
@@ -87,8 +95,10 @@ The package exports these components and types for external use:
|
|
|
87
95
|
- `Table` and its subcomponents
|
|
88
96
|
- `useGridClasses`
|
|
89
97
|
- `useShortcutFormatter`
|
|
98
|
+
- `useDeviceSupport`
|
|
99
|
+
- `useSound`
|
|
90
100
|
|
|
91
|
-
The hooks are
|
|
101
|
+
The hooks are available from the package entrypoint and from the SDK subpath.
|
|
92
102
|
|
|
93
103
|
## License
|
|
94
104
|
|
package/dist/index.cjs
CHANGED
|
@@ -2133,6 +2133,58 @@ var useGridClasses = (windowSize, gridRules) => {
|
|
|
2133
2133
|
return { gridClasses, deviceType };
|
|
2134
2134
|
};
|
|
2135
2135
|
var useGridClasses_default = useGridClasses;
|
|
2136
|
+
var useDeviceSupport = () => {
|
|
2137
|
+
const [isSupported, setIsSupported] = React20.useState(true);
|
|
2138
|
+
React20.useEffect(() => {
|
|
2139
|
+
function checkSupport() {
|
|
2140
|
+
const ua = typeof window !== "undefined" ? window.navigator.userAgent : "";
|
|
2141
|
+
const width = typeof window !== "undefined" ? window.innerWidth : 1920;
|
|
2142
|
+
const height = typeof window !== "undefined" ? window.innerHeight : 1080;
|
|
2143
|
+
const isTouch = typeof window !== "undefined" ? "ontouchstart" in window : false;
|
|
2144
|
+
const isMobile = /Mobi|Android|iPhone|iPod/.test(ua) && width <= 767;
|
|
2145
|
+
const isTablet = /iPad|Tablet|Android/.test(ua) && !/Mobile/.test(ua) || isTouch && width >= 600 && width <= 1024;
|
|
2146
|
+
const isTabletPortrait = isTablet && width < height;
|
|
2147
|
+
const isTabletLandscape = isTablet && width > height && width >= 1024 && width <= 1366;
|
|
2148
|
+
const isLaptop = width >= 1024 && !isMobile && (!isTablet || isTabletLandscape);
|
|
2149
|
+
if (isMobile) {
|
|
2150
|
+
setIsSupported(false);
|
|
2151
|
+
} else if (isTabletPortrait) {
|
|
2152
|
+
setIsSupported(false);
|
|
2153
|
+
} else if (isTabletLandscape) {
|
|
2154
|
+
setIsSupported(true);
|
|
2155
|
+
} else if (isLaptop) {
|
|
2156
|
+
setIsSupported(true);
|
|
2157
|
+
} else {
|
|
2158
|
+
setIsSupported(true);
|
|
2159
|
+
}
|
|
2160
|
+
}
|
|
2161
|
+
checkSupport();
|
|
2162
|
+
window.addEventListener("resize", checkSupport);
|
|
2163
|
+
return () => window.removeEventListener("resize", checkSupport);
|
|
2164
|
+
}, []);
|
|
2165
|
+
return isSupported;
|
|
2166
|
+
};
|
|
2167
|
+
var soundMap = {
|
|
2168
|
+
click: "/sounds/click-tone.wav",
|
|
2169
|
+
alert: "/sounds/error-tone.wav",
|
|
2170
|
+
notification: "/sounds/notification-tone.wav",
|
|
2171
|
+
error: "/sounds/error-tone.wav",
|
|
2172
|
+
success: "/sounds/success-tone.wav",
|
|
2173
|
+
swipe: "/sounds/swipe-tone.wav"
|
|
2174
|
+
};
|
|
2175
|
+
var useSound = () => {
|
|
2176
|
+
const playSound = React20.useCallback((type) => {
|
|
2177
|
+
if (typeof window === "undefined" || typeof window.Audio === "undefined") {
|
|
2178
|
+
return;
|
|
2179
|
+
}
|
|
2180
|
+
const soundSrc = soundMap[type];
|
|
2181
|
+
const audio = new window.Audio(soundSrc);
|
|
2182
|
+
audio.play().catch((err) => {
|
|
2183
|
+
console.error("Sound playback failed:", err);
|
|
2184
|
+
});
|
|
2185
|
+
}, []);
|
|
2186
|
+
return { playSound };
|
|
2187
|
+
};
|
|
2136
2188
|
|
|
2137
2189
|
exports.Accordion = Accordion_default;
|
|
2138
2190
|
exports.Alert = Alert_default;
|
|
@@ -2167,7 +2219,9 @@ exports.Toast = Toast_default;
|
|
|
2167
2219
|
exports.Toggle = Toggle_default;
|
|
2168
2220
|
exports.Tooltip = Tooltip_default;
|
|
2169
2221
|
exports.Typography = Typography_default;
|
|
2222
|
+
exports.useDeviceSupport = useDeviceSupport;
|
|
2170
2223
|
exports.useGridClasses = useGridClasses_default;
|
|
2171
2224
|
exports.useShortcutFormatter = useShortcutFormatter_default;
|
|
2225
|
+
exports.useSound = useSound;
|
|
2172
2226
|
//# sourceMappingURL=index.cjs.map
|
|
2173
2227
|
//# sourceMappingURL=index.cjs.map
|