ssovee-os-web-ui 0.1.41 → 0.1.43

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.
Binary file
package/dist/index.cjs CHANGED
@@ -59,7 +59,7 @@ var Button = React22__namespace.default.forwardRef(
59
59
  };
60
60
  const filledToneClasses = {
61
61
  primary: "bg-brand-color text-white hover:bg-brand-color/90 active:bg-brand-color/80 focus-visible:ring-brand-color/50 shadow-sm hover:shadow-md active:shadow-none disabled:bg-brand-color/50 disabled:text-white/80",
62
- neutral: "bg-surface-3 text-neutral-100 hover:bg-surface-4 active:bg-surface-4 focus-visible:ring-surface-3/50 shadow-sm hover:shadow-md active:shadow-none disabled:bg-surface-3/50",
62
+ neutral: "bg-surface-3 text-neutral-500 hover:bg-surface-4 active:bg-surface-4 focus-visible:ring-surface-3/50 shadow-sm hover:shadow-md active:shadow-none disabled:bg-surface-3/50",
63
63
  success: "bg-green-500 text-white hover:bg-green-600 active:bg-green-600 focus-visible:ring-green-500/50 shadow-sm hover:shadow-md active:shadow-none disabled:bg-green-500/50",
64
64
  danger: "bg-red-500 text-white hover:bg-red-600 active:bg-red-600 focus-visible:ring-red-500/50 shadow-sm hover:shadow-md active:shadow-none disabled:bg-red-500/50"
65
65
  };
@@ -185,9 +185,9 @@ var Input = React22__namespace.default.forwardRef(
185
185
  }, ref) => {
186
186
  const baseClasses = "transition-all duration-200 focus:outline-none placeholder:text-neutral-300 rounded-[6px]";
187
187
  const variantClasses = {
188
- default: "bg-primary border border-surface-1 focus:border-brand-color focus:ring-1 focus:ring-brand-color/50",
189
- filled: "bg-surface-4 border border-surface-4 focus:border-brand-color focus:ring-1 focus:ring-brand-color/50",
190
- outline: "bg-transparent border border-surface-1 focus:border-brand-color focus:ring-1 focus:ring-brand-color/50"
188
+ default: "bg-primary text-neutral-500 border border-surface-1 focus:border-brand-color focus:ring-1 focus:ring-brand-color/50",
189
+ filled: "bg-surface-4 text-neutral-500 border border-surface-4 focus:border-brand-color focus:ring-1 focus:ring-brand-color/50",
190
+ outline: "bg-transparent text-neutral-500 border border-surface-1 focus:border-brand-color focus:ring-1 focus:ring-brand-color/50"
191
191
  };
192
192
  const sizeClasses = {
193
193
  sm: "h-8 px-2 text-sm",
@@ -259,9 +259,9 @@ var TextArea = React22__namespace.default.forwardRef(
259
259
  }, ref) => {
260
260
  const baseClasses = "transition-all duration-200 focus:outline-none placeholder:text-neutral-300 rounded-[6px]";
261
261
  const variantClasses = {
262
- default: "bg-primary border border-surface-1 focus:border-brand-color focus:ring-1 focus:ring-brand-color/50",
263
- filled: "bg-surface-4 border border-surface-4 focus:border-brand-color focus:ring-1 focus:ring-brand-color/50",
264
- outline: "bg-transparent border border-surface-1 focus:border-brand-color focus:ring-1 focus:ring-brand-color/50"
262
+ default: "bg-primary text-neutral-500 border border-surface-1 focus:border-brand-color focus:ring-1 focus:ring-brand-color/50",
263
+ filled: "bg-surface-4 text-neutral-500 border border-surface-4 focus:border-brand-color focus:ring-1 focus:ring-brand-color/50",
264
+ outline: "bg-transparent text-neutral-500 border border-surface-1 focus:border-brand-color focus:ring-1 focus:ring-brand-color/50"
265
265
  };
266
266
  const sizeClasses = {
267
267
  sm: "px-2 py-1 text-sm",
@@ -718,6 +718,9 @@ var ImageWithPlaceholder = ({
718
718
  );
719
719
  };
720
720
  var ImageWithPlaceholder_default = ImageWithPlaceholder;
721
+
722
+ // src/assets/Loader.gif
723
+ var Loader_default = "./Loader-UY5TMG7M.gif";
721
724
  var Loading = ({
722
725
  variant = "image",
723
726
  size = "md",
@@ -753,7 +756,7 @@ var Loading = ({
753
756
  const renderImage = () => /* @__PURE__ */ jsxRuntime.jsx(
754
757
  ImageWithPlaceholder_default,
755
758
  {
756
- src: "/app-assets/Loader.gif",
759
+ src: Loader_default,
757
760
  alt: "Loader",
758
761
  width: imageSizes[size],
759
762
  height: imageSizes[size],
@@ -1651,9 +1654,9 @@ var SearchInput = React22__namespace.default.forwardRef(
1651
1654
  const displayPlaceholder = enableKeyboardShortcuts ? `${placeholder} (${formatKeys(getShortcutByCommand("focus_search"))})` : placeholder;
1652
1655
  const baseClasses = "transition-all duration-200 focus:outline-none placeholder:text-neutral-300 rounded-[6px]";
1653
1656
  const variantClasses = {
1654
- default: "bg-primary border border-surface-1 focus:border-brand-color focus:ring-1 focus:ring-brand-color/50",
1655
- filled: "bg-surface-4 border border-surface-4 focus:border-brand-color focus:ring-1 focus:ring-brand-color/50",
1656
- outline: "bg-transparent border border-surface-1 focus:border-brand-color focus:ring-1 focus:ring-brand-color/50"
1657
+ default: "bg-primary text-neutral-500 border border-surface-1 focus:border-brand-color focus:ring-1 focus:ring-brand-color/50",
1658
+ filled: "bg-surface-4 text-neutral-500 border border-surface-4 focus:border-brand-color focus:ring-1 focus:ring-brand-color/50",
1659
+ outline: "bg-transparent text-neutral-500 border border-surface-1 focus:border-brand-color focus:ring-1 focus:ring-brand-color/50"
1657
1660
  };
1658
1661
  const sizeClasses = {
1659
1662
  sm: "h-8 text-sm leading-tight",
@@ -3265,11 +3268,77 @@ var soundMap = {
3265
3268
  swipe: swipe_tone_default
3266
3269
  };
3267
3270
  var DEFAULT_SOUND_TYPE = "click";
3271
+ var audioBufferCache = /* @__PURE__ */ new Map();
3272
+ var sharedAudioContext = null;
3268
3273
  var isSoundType = (type) => {
3269
3274
  return type in soundMap;
3270
3275
  };
3271
3276
  var useSound = () => {
3272
- const audioCache = React22.useRef({});
3277
+ const getAudioContext = () => {
3278
+ if (typeof window === "undefined") {
3279
+ return null;
3280
+ }
3281
+ const AudioContextCtor = window.AudioContext ?? window.webkitAudioContext;
3282
+ if (!AudioContextCtor) {
3283
+ return null;
3284
+ }
3285
+ if (!sharedAudioContext || sharedAudioContext.state === "closed") {
3286
+ sharedAudioContext = new AudioContextCtor();
3287
+ }
3288
+ return sharedAudioContext;
3289
+ };
3290
+ const loadAudioBuffer = async (source) => {
3291
+ const cached = audioBufferCache.get(source);
3292
+ if (cached) {
3293
+ return cached;
3294
+ }
3295
+ const promise = (async () => {
3296
+ if (typeof fetch !== "function") {
3297
+ throw new Error("Fetch is not available");
3298
+ }
3299
+ const response = await fetch(source);
3300
+ if (!response.ok) {
3301
+ throw new Error(`Failed to load sound source: ${response.status} ${response.statusText}`);
3302
+ }
3303
+ const context = getAudioContext();
3304
+ if (!context) {
3305
+ throw new Error("Web Audio API is not available");
3306
+ }
3307
+ const arrayBuffer = await response.arrayBuffer();
3308
+ return await context.decodeAudioData(arrayBuffer.slice(0));
3309
+ })().catch((error) => {
3310
+ audioBufferCache.delete(source);
3311
+ throw error;
3312
+ });
3313
+ audioBufferCache.set(source, promise);
3314
+ return promise;
3315
+ };
3316
+ const playWithAudioBuffer = async (buffer) => {
3317
+ const context = getAudioContext();
3318
+ if (!context) {
3319
+ throw new Error("Web Audio API is not available");
3320
+ }
3321
+ if (context.state === "suspended") {
3322
+ await context.resume();
3323
+ }
3324
+ await new Promise((resolve, reject) => {
3325
+ const sourceNode = context.createBufferSource();
3326
+ sourceNode.buffer = buffer;
3327
+ sourceNode.connect(context.destination);
3328
+ sourceNode.onended = () => resolve();
3329
+ try {
3330
+ sourceNode.start(0);
3331
+ } catch (error) {
3332
+ reject(error);
3333
+ }
3334
+ });
3335
+ };
3336
+ const playWithAudioElement = async (source) => {
3337
+ const audio = new Audio(source);
3338
+ audio.preload = "auto";
3339
+ audio.currentTime = 0;
3340
+ await audio.play();
3341
+ };
3273
3342
  const playSound = React22.useCallback((type) => {
3274
3343
  if (typeof window === "undefined") {
3275
3344
  return;
@@ -3277,35 +3346,28 @@ var useSound = () => {
3277
3346
  const requestedType = isSoundType(type) ? type : DEFAULT_SOUND_TYPE;
3278
3347
  const src = soundMap[requestedType];
3279
3348
  if (!src) {
3280
- console.error(
3281
- `Sound playback failed: no source found for "${requestedType}"`
3282
- );
3349
+ console.error(`Sound playback failed: no source found for "${requestedType}"`);
3283
3350
  return;
3284
3351
  }
3285
- try {
3286
- let audio = audioCache.current[requestedType];
3287
- if (!audio) {
3288
- audio = new Audio(src);
3289
- audio.preload = "auto";
3290
- audioCache.current[requestedType] = audio;
3352
+ void (async () => {
3353
+ let lastError;
3354
+ if (getAudioContext()) {
3355
+ try {
3356
+ const buffer = await loadAudioBuffer(src);
3357
+ await playWithAudioBuffer(buffer);
3358
+ return;
3359
+ } catch (error) {
3360
+ lastError = error;
3361
+ }
3291
3362
  }
3292
- audio.pause();
3293
- audio.currentTime = 0;
3294
- const playPromise = audio.play();
3295
- if (playPromise !== void 0) {
3296
- playPromise.catch((error) => {
3297
- console.error(
3298
- `Sound playback failed for "${requestedType}":`,
3299
- error
3300
- );
3301
- });
3363
+ try {
3364
+ await playWithAudioElement(src);
3365
+ return;
3366
+ } catch (error) {
3367
+ lastError = error;
3302
3368
  }
3303
- } catch (error) {
3304
- console.error(
3305
- `Sound playback failed for "${requestedType}":`,
3306
- error
3307
- );
3308
- }
3369
+ console.error(`Sound playback failed for "${requestedType}":`, lastError);
3370
+ })();
3309
3371
  }, []);
3310
3372
  return {
3311
3373
  playSound