ssovee-os-web-ui 0.1.33 → 0.1.35

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/index.cjs CHANGED
@@ -5,6 +5,7 @@ var jsxRuntime = require('react/jsx-runtime');
5
5
  var react = require('@phosphor-icons/react');
6
6
  var uaParserJs = require('ua-parser-js');
7
7
 
8
+ var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
8
9
  function _interopNamespace(e) {
9
10
  if (e && e.__esModule) return e;
10
11
  var n = Object.create(null);
@@ -1604,6 +1605,7 @@ var SearchInput = React22__namespace.default.forwardRef(
1604
1605
  className,
1605
1606
  value,
1606
1607
  onChange,
1608
+ style,
1607
1609
  enableKeyboardShortcuts = false,
1608
1610
  isActive = true,
1609
1611
  ...props
@@ -1655,9 +1657,9 @@ var SearchInput = React22__namespace.default.forwardRef(
1655
1657
  outline: "bg-transparent border border-surface-1 focus:border-brand-color focus:ring-1 focus:ring-brand-color/50"
1656
1658
  };
1657
1659
  const sizeClasses = {
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"
1660
+ sm: "h-8 text-sm leading-tight",
1661
+ md: "h-10 text-base leading-tight",
1662
+ lg: "h-12 text-lg leading-tight"
1661
1663
  };
1662
1664
  const iconSizeClasses = {
1663
1665
  sm: "w-4 h-4",
@@ -1674,6 +1676,11 @@ var SearchInput = React22__namespace.default.forwardRef(
1674
1676
  md: "left-3",
1675
1677
  lg: "left-3.5"
1676
1678
  };
1679
+ const inputPaddings = {
1680
+ sm: { left: "2.25rem", right: "0.5rem" },
1681
+ md: { left: "2.75rem", right: "0.75rem" },
1682
+ lg: { left: "3rem", right: "1rem" }
1683
+ };
1677
1684
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative w-full min-w-0", children: [
1678
1685
  /* @__PURE__ */ jsxRuntime.jsx(
1679
1686
  "div",
@@ -1682,12 +1689,24 @@ var SearchInput = React22__namespace.default.forwardRef(
1682
1689
  "pointer-events-none absolute top-1/2 z-10 -translate-y-1/2 text-neutral-400",
1683
1690
  iconPositionClasses[size]
1684
1691
  ),
1685
- children: /* @__PURE__ */ jsxRuntime.jsx(
1686
- react.MagnifyingGlassIcon,
1692
+ children: /* @__PURE__ */ jsxRuntime.jsxs(
1693
+ "svg",
1687
1694
  {
1688
- size: iconPixelSizes[size],
1689
1695
  className: cn("block shrink-0", iconSizeClasses[size]),
1690
- weight: "regular"
1696
+ width: iconPixelSizes[size],
1697
+ height: iconPixelSizes[size],
1698
+ viewBox: "0 0 24 24",
1699
+ fill: "none",
1700
+ stroke: "currentColor",
1701
+ strokeWidth: "1.8",
1702
+ strokeLinecap: "round",
1703
+ strokeLinejoin: "round",
1704
+ "aria-hidden": "true",
1705
+ focusable: "false",
1706
+ children: [
1707
+ /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "11", cy: "11", r: "7" }),
1708
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M20 20L16.65 16.65" })
1709
+ ]
1691
1710
  }
1692
1711
  )
1693
1712
  }
@@ -1705,9 +1724,13 @@ var SearchInput = React22__namespace.default.forwardRef(
1705
1724
  variantClasses[variant],
1706
1725
  "w-full min-w-0",
1707
1726
  sizeClasses[size],
1708
- showClearButton && searchValue ? "pr-10" : "",
1709
1727
  className
1710
1728
  ),
1729
+ style: {
1730
+ paddingLeft: inputPaddings[size].left,
1731
+ paddingRight: showClearButton && searchValue ? "2.5rem" : inputPaddings[size].right,
1732
+ ...style
1733
+ },
1711
1734
  ...props
1712
1735
  }
1713
1736
  ),
@@ -3217,56 +3240,80 @@ var useDeviceSupport = () => {
3217
3240
  }, []);
3218
3241
  return isSupported;
3219
3242
  };
3220
-
3221
- // src/assets/sounds/click-tone.wav
3222
- var click_tone_default = "./click-tone-GOELVSMY.wav";
3223
-
3224
- // src/assets/sounds/error-tone.wav
3225
- var error_tone_default = "./error-tone-YKNRLRXF.wav";
3226
-
3227
- // src/assets/sounds/notification-tone.wav
3228
- var notification_tone_default = "./notification-tone-7O3KFZG5.wav";
3229
-
3230
- // src/assets/sounds/success-tone.wav
3231
- var success_tone_default = "./success-tone-YKPPMCXK.wav";
3232
-
3233
- // src/assets/sounds/swipe-tone.wav
3234
- var swipe_tone_default = "./swipe-tone-UCF4T5MF.wav";
3235
-
3236
- // src/hooks/useSound.tsx
3237
3243
  var soundMap = {
3238
- click: click_tone_default,
3239
- alert: error_tone_default,
3240
- notification: notification_tone_default,
3241
- error: error_tone_default,
3242
- success: success_tone_default,
3243
- swipe: swipe_tone_default
3244
+ click: new URL("../assets/sounds/click-tone.wav", (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.cjs', document.baseURI).href))).href,
3245
+ alert: new URL("../assets/sounds/error-tone.wav", (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.cjs', document.baseURI).href))).href,
3246
+ notification: new URL("../assets/sounds/notification-tone.wav", (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.cjs', document.baseURI).href))).href,
3247
+ error: new URL("../assets/sounds/error-tone.wav", (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.cjs', document.baseURI).href))).href,
3248
+ success: new URL("../assets/sounds/success-tone.wav", (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.cjs', document.baseURI).href))).href,
3249
+ swipe: new URL("../assets/sounds/swipe-tone.wav", (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.cjs', document.baseURI).href))).href
3244
3250
  };
3245
- var audioCache = /* @__PURE__ */ new Map();
3251
+ var pendingPlaybackQueue = [];
3252
+ var interactionListenersBound = false;
3246
3253
  var clampVolume = (value) => Math.min(1, Math.max(0, value));
3247
- var useSound = () => {
3248
- const playSound = React22.useCallback(async (type, options) => {
3249
- if (typeof window === "undefined" || typeof window.Audio === "undefined") {
3250
- return false;
3251
- }
3252
- const soundSrc = soundMap[type];
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) {
3254
+ var resolveSoundSrc = (soundSrc) => {
3255
+ if (!soundSrc) return soundSrc;
3256
+ if (soundSrc.startsWith("http://") || soundSrc.startsWith("https://") || soundSrc.startsWith("data:") || soundSrc.startsWith("blob:")) {
3257
+ return soundSrc;
3258
+ }
3259
+ try {
3260
+ return new URL(soundSrc, (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.cjs', document.baseURI).href))).href;
3261
+ } catch {
3262
+ return soundSrc;
3263
+ }
3264
+ };
3265
+ var isAutoplayRestrictionError = (error) => {
3266
+ if (!error || typeof error !== "object") return false;
3267
+ const maybeError = error;
3268
+ const message = maybeError.message?.toLowerCase() ?? "";
3269
+ return maybeError.name === "NotAllowedError" || message.includes("gesture") || message.includes("user");
3270
+ };
3271
+ var playNativeAudio = async (type, options) => {
3272
+ if (typeof window === "undefined" || typeof window.Audio === "undefined") {
3273
+ return false;
3274
+ }
3275
+ const soundSrc = soundMap[type];
3276
+ const audio = new window.Audio(resolveSoundSrc(soundSrc));
3277
+ audio.preload = "auto";
3278
+ audio.volume = clampVolume(options?.volume ?? 1);
3279
+ if (options?.restart !== false) {
3280
+ audio.currentTime = 0;
3281
+ }
3282
+ try {
3283
+ await audio.play();
3284
+ return true;
3285
+ } catch (err) {
3286
+ if (!isAutoplayRestrictionError(err)) {
3267
3287
  console.error("Sound playback failed:", err);
3268
- return false;
3269
3288
  }
3289
+ return false;
3290
+ }
3291
+ };
3292
+ var flushPendingQueue = () => {
3293
+ if (pendingPlaybackQueue.length === 0) return;
3294
+ const items = pendingPlaybackQueue;
3295
+ pendingPlaybackQueue = [];
3296
+ items.forEach(({ type, options }) => {
3297
+ void playNativeAudio(type, options);
3298
+ });
3299
+ };
3300
+ var bindInteractionListeners = () => {
3301
+ if (interactionListenersBound || typeof window === "undefined") return;
3302
+ interactionListenersBound = true;
3303
+ const unlockAndFlush = () => {
3304
+ flushPendingQueue();
3305
+ };
3306
+ window.addEventListener("pointerdown", unlockAndFlush, { passive: true });
3307
+ window.addEventListener("keydown", unlockAndFlush, { passive: true });
3308
+ };
3309
+ var useSound = () => {
3310
+ const playSound = React22.useCallback((type, options) => {
3311
+ bindInteractionListeners();
3312
+ void playNativeAudio(type, options).then((played) => {
3313
+ if (!played) {
3314
+ pendingPlaybackQueue.push({ type, options });
3315
+ }
3316
+ });
3270
3317
  }, []);
3271
3318
  return { playSound };
3272
3319
  };