@almadar/ui 5.32.1 → 5.32.2

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.
@@ -7253,6 +7253,13 @@ var init_Textarea = __esm({
7253
7253
  Textarea.displayName = "Textarea";
7254
7254
  }
7255
7255
  });
7256
+ function dispatchValueChange(onValueChange, eventBus, value) {
7257
+ if (typeof onValueChange === "string") {
7258
+ eventBus.emit(`UI:${onValueChange}`, { value });
7259
+ } else {
7260
+ onValueChange?.(value);
7261
+ }
7262
+ }
7256
7263
  function flatOptions(opts, groups) {
7257
7264
  const flat = opts ?? [];
7258
7265
  const grp = (groups ?? []).flatMap((g) => g.options);
@@ -7276,7 +7283,7 @@ function NativeSelect({
7276
7283
  } else {
7277
7284
  onChange?.(e);
7278
7285
  }
7279
- onValueChange?.(e.target.value);
7286
+ dispatchValueChange(onValueChange, eventBus, e.target.value);
7280
7287
  };
7281
7288
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative", children: [
7282
7289
  /* @__PURE__ */ jsxRuntime.jsxs(
@@ -7336,7 +7343,7 @@ function RichSelect({
7336
7343
  if (typeof onChange === "string") {
7337
7344
  eventBus.emit(`UI:${onChange}`, { value: next });
7338
7345
  }
7339
- onValueChange?.(next);
7346
+ dispatchValueChange(onValueChange, eventBus, next);
7340
7347
  };
7341
7348
  const clear = (e) => {
7342
7349
  e.stopPropagation();
@@ -7344,7 +7351,7 @@ function RichSelect({
7344
7351
  if (typeof onChange === "string") {
7345
7352
  eventBus.emit(`UI:${onChange}`, { value: next });
7346
7353
  }
7347
- onValueChange?.(next);
7354
+ dispatchValueChange(onValueChange, eventBus, next);
7348
7355
  };
7349
7356
  React88.useEffect(() => {
7350
7357
  const handler = (e) => {
package/dist/avl/index.js CHANGED
@@ -7204,6 +7204,13 @@ var init_Textarea = __esm({
7204
7204
  Textarea.displayName = "Textarea";
7205
7205
  }
7206
7206
  });
7207
+ function dispatchValueChange(onValueChange, eventBus, value) {
7208
+ if (typeof onValueChange === "string") {
7209
+ eventBus.emit(`UI:${onValueChange}`, { value });
7210
+ } else {
7211
+ onValueChange?.(value);
7212
+ }
7213
+ }
7207
7214
  function flatOptions(opts, groups) {
7208
7215
  const flat = opts ?? [];
7209
7216
  const grp = (groups ?? []).flatMap((g) => g.options);
@@ -7227,7 +7234,7 @@ function NativeSelect({
7227
7234
  } else {
7228
7235
  onChange?.(e);
7229
7236
  }
7230
- onValueChange?.(e.target.value);
7237
+ dispatchValueChange(onValueChange, eventBus, e.target.value);
7231
7238
  };
7232
7239
  return /* @__PURE__ */ jsxs("div", { className: "relative", children: [
7233
7240
  /* @__PURE__ */ jsxs(
@@ -7287,7 +7294,7 @@ function RichSelect({
7287
7294
  if (typeof onChange === "string") {
7288
7295
  eventBus.emit(`UI:${onChange}`, { value: next });
7289
7296
  }
7290
- onValueChange?.(next);
7297
+ dispatchValueChange(onValueChange, eventBus, next);
7291
7298
  };
7292
7299
  const clear = (e) => {
7293
7300
  e.stopPropagation();
@@ -7295,7 +7302,7 @@ function RichSelect({
7295
7302
  if (typeof onChange === "string") {
7296
7303
  eventBus.emit(`UI:${onChange}`, { value: next });
7297
7304
  }
7298
- onValueChange?.(next);
7305
+ dispatchValueChange(onValueChange, eventBus, next);
7299
7306
  };
7300
7307
  useEffect(() => {
7301
7308
  const handler = (e) => {
@@ -1,5 +1,5 @@
1
1
  import React from "react";
2
- import type { EventKey } from "@almadar/core";
2
+ import type { EventKey, EventEmit } from "@almadar/core";
3
3
  export interface SelectOption {
4
4
  value: string;
5
5
  label: string;
@@ -38,7 +38,12 @@ export interface SelectProps extends Omit<React.SelectHTMLAttributes<HTMLSelectE
38
38
  clearable?: boolean;
39
39
  /** onChange handler (native ChangeEvent) or declarative event key for trait dispatch */
40
40
  onChange?: React.ChangeEventHandler<HTMLSelectElement> | EventKey;
41
- /** Value-based callback receives the selected string (or string[] for multiple). */
42
- onValueChange?: (value: string | string[]) => void;
41
+ /** Value-based change: a React callback (internal use) OR a declarative event
42
+ * key that emits `{ value }` on the bus (render-ui / lolo authoring). Mirrors
43
+ * the `onChange` handler|event convention so it's an event-emitting prop, not a
44
+ * bare callback. */
45
+ onValueChange?: ((value: string | string[]) => void) | EventEmit<{
46
+ value: string | string[];
47
+ }>;
43
48
  }
44
49
  export declare const Select: React.ForwardRefExoticComponent<SelectProps & React.RefAttributes<HTMLSelectElement>>;
@@ -2402,6 +2402,13 @@ var init_Textarea = __esm({
2402
2402
  exports.Textarea.displayName = "Textarea";
2403
2403
  }
2404
2404
  });
2405
+ function dispatchValueChange(onValueChange, eventBus, value) {
2406
+ if (typeof onValueChange === "string") {
2407
+ eventBus.emit(`UI:${onValueChange}`, { value });
2408
+ } else {
2409
+ onValueChange?.(value);
2410
+ }
2411
+ }
2405
2412
  function flatOptions(opts, groups) {
2406
2413
  const flat = opts ?? [];
2407
2414
  const grp = (groups ?? []).flatMap((g) => g.options);
@@ -2425,7 +2432,7 @@ function NativeSelect({
2425
2432
  } else {
2426
2433
  onChange?.(e);
2427
2434
  }
2428
- onValueChange?.(e.target.value);
2435
+ dispatchValueChange(onValueChange, eventBus, e.target.value);
2429
2436
  };
2430
2437
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative", children: [
2431
2438
  /* @__PURE__ */ jsxRuntime.jsxs(
@@ -2485,7 +2492,7 @@ function RichSelect({
2485
2492
  if (typeof onChange === "string") {
2486
2493
  eventBus.emit(`UI:${onChange}`, { value: next });
2487
2494
  }
2488
- onValueChange?.(next);
2495
+ dispatchValueChange(onValueChange, eventBus, next);
2489
2496
  };
2490
2497
  const clear = (e) => {
2491
2498
  e.stopPropagation();
@@ -2493,7 +2500,7 @@ function RichSelect({
2493
2500
  if (typeof onChange === "string") {
2494
2501
  eventBus.emit(`UI:${onChange}`, { value: next });
2495
2502
  }
2496
- onValueChange?.(next);
2503
+ dispatchValueChange(onValueChange, eventBus, next);
2497
2504
  };
2498
2505
  React74.useEffect(() => {
2499
2506
  const handler = (e) => {
@@ -2354,6 +2354,13 @@ var init_Textarea = __esm({
2354
2354
  Textarea.displayName = "Textarea";
2355
2355
  }
2356
2356
  });
2357
+ function dispatchValueChange(onValueChange, eventBus, value) {
2358
+ if (typeof onValueChange === "string") {
2359
+ eventBus.emit(`UI:${onValueChange}`, { value });
2360
+ } else {
2361
+ onValueChange?.(value);
2362
+ }
2363
+ }
2357
2364
  function flatOptions(opts, groups) {
2358
2365
  const flat = opts ?? [];
2359
2366
  const grp = (groups ?? []).flatMap((g) => g.options);
@@ -2377,7 +2384,7 @@ function NativeSelect({
2377
2384
  } else {
2378
2385
  onChange?.(e);
2379
2386
  }
2380
- onValueChange?.(e.target.value);
2387
+ dispatchValueChange(onValueChange, eventBus, e.target.value);
2381
2388
  };
2382
2389
  return /* @__PURE__ */ jsxs("div", { className: "relative", children: [
2383
2390
  /* @__PURE__ */ jsxs(
@@ -2437,7 +2444,7 @@ function RichSelect({
2437
2444
  if (typeof onChange === "string") {
2438
2445
  eventBus.emit(`UI:${onChange}`, { value: next });
2439
2446
  }
2440
- onValueChange?.(next);
2447
+ dispatchValueChange(onValueChange, eventBus, next);
2441
2448
  };
2442
2449
  const clear = (e) => {
2443
2450
  e.stopPropagation();
@@ -2445,7 +2452,7 @@ function RichSelect({
2445
2452
  if (typeof onChange === "string") {
2446
2453
  eventBus.emit(`UI:${onChange}`, { value: next });
2447
2454
  }
2448
- onValueChange?.(next);
2455
+ dispatchValueChange(onValueChange, eventBus, next);
2449
2456
  };
2450
2457
  useEffect(() => {
2451
2458
  const handler = (e) => {
@@ -3692,6 +3692,13 @@ var init_Textarea = __esm({
3692
3692
  Textarea.displayName = "Textarea";
3693
3693
  }
3694
3694
  });
3695
+ function dispatchValueChange(onValueChange, eventBus, value) {
3696
+ if (typeof onValueChange === "string") {
3697
+ eventBus.emit(`UI:${onValueChange}`, { value });
3698
+ } else {
3699
+ onValueChange?.(value);
3700
+ }
3701
+ }
3695
3702
  function flatOptions(opts, groups) {
3696
3703
  const flat = opts ?? [];
3697
3704
  const grp = (groups ?? []).flatMap((g) => g.options);
@@ -3715,7 +3722,7 @@ function NativeSelect({
3715
3722
  } else {
3716
3723
  onChange?.(e);
3717
3724
  }
3718
- onValueChange?.(e.target.value);
3725
+ dispatchValueChange(onValueChange, eventBus, e.target.value);
3719
3726
  };
3720
3727
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative", children: [
3721
3728
  /* @__PURE__ */ jsxRuntime.jsxs(
@@ -3775,7 +3782,7 @@ function RichSelect({
3775
3782
  if (typeof onChange === "string") {
3776
3783
  eventBus.emit(`UI:${onChange}`, { value: next });
3777
3784
  }
3778
- onValueChange?.(next);
3785
+ dispatchValueChange(onValueChange, eventBus, next);
3779
3786
  };
3780
3787
  const clear = (e) => {
3781
3788
  e.stopPropagation();
@@ -3783,7 +3790,7 @@ function RichSelect({
3783
3790
  if (typeof onChange === "string") {
3784
3791
  eventBus.emit(`UI:${onChange}`, { value: next });
3785
3792
  }
3786
- onValueChange?.(next);
3793
+ dispatchValueChange(onValueChange, eventBus, next);
3787
3794
  };
3788
3795
  React80.useEffect(() => {
3789
3796
  const handler = (e) => {
@@ -3643,6 +3643,13 @@ var init_Textarea = __esm({
3643
3643
  Textarea.displayName = "Textarea";
3644
3644
  }
3645
3645
  });
3646
+ function dispatchValueChange(onValueChange, eventBus, value) {
3647
+ if (typeof onValueChange === "string") {
3648
+ eventBus.emit(`UI:${onValueChange}`, { value });
3649
+ } else {
3650
+ onValueChange?.(value);
3651
+ }
3652
+ }
3646
3653
  function flatOptions(opts, groups) {
3647
3654
  const flat = opts ?? [];
3648
3655
  const grp = (groups ?? []).flatMap((g) => g.options);
@@ -3666,7 +3673,7 @@ function NativeSelect({
3666
3673
  } else {
3667
3674
  onChange?.(e);
3668
3675
  }
3669
- onValueChange?.(e.target.value);
3676
+ dispatchValueChange(onValueChange, eventBus, e.target.value);
3670
3677
  };
3671
3678
  return /* @__PURE__ */ jsxs("div", { className: "relative", children: [
3672
3679
  /* @__PURE__ */ jsxs(
@@ -3726,7 +3733,7 @@ function RichSelect({
3726
3733
  if (typeof onChange === "string") {
3727
3734
  eventBus.emit(`UI:${onChange}`, { value: next });
3728
3735
  }
3729
- onValueChange?.(next);
3736
+ dispatchValueChange(onValueChange, eventBus, next);
3730
3737
  };
3731
3738
  const clear = (e) => {
3732
3739
  e.stopPropagation();
@@ -3734,7 +3741,7 @@ function RichSelect({
3734
3741
  if (typeof onChange === "string") {
3735
3742
  eventBus.emit(`UI:${onChange}`, { value: next });
3736
3743
  }
3737
- onValueChange?.(next);
3744
+ dispatchValueChange(onValueChange, eventBus, next);
3738
3745
  };
3739
3746
  useEffect(() => {
3740
3747
  const handler = (e) => {
@@ -3428,6 +3428,13 @@ var init_Textarea = __esm({
3428
3428
  Textarea.displayName = "Textarea";
3429
3429
  }
3430
3430
  });
3431
+ function dispatchValueChange(onValueChange, eventBus, value) {
3432
+ if (typeof onValueChange === "string") {
3433
+ eventBus.emit(`UI:${onValueChange}`, { value });
3434
+ } else {
3435
+ onValueChange?.(value);
3436
+ }
3437
+ }
3431
3438
  function flatOptions(opts, groups) {
3432
3439
  const flat = opts ?? [];
3433
3440
  const grp = (groups ?? []).flatMap((g) => g.options);
@@ -3451,7 +3458,7 @@ function NativeSelect({
3451
3458
  } else {
3452
3459
  onChange?.(e);
3453
3460
  }
3454
- onValueChange?.(e.target.value);
3461
+ dispatchValueChange(onValueChange, eventBus, e.target.value);
3455
3462
  };
3456
3463
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative", children: [
3457
3464
  /* @__PURE__ */ jsxRuntime.jsxs(
@@ -3511,7 +3518,7 @@ function RichSelect({
3511
3518
  if (typeof onChange === "string") {
3512
3519
  eventBus.emit(`UI:${onChange}`, { value: next });
3513
3520
  }
3514
- onValueChange?.(next);
3521
+ dispatchValueChange(onValueChange, eventBus, next);
3515
3522
  };
3516
3523
  const clear = (e) => {
3517
3524
  e.stopPropagation();
@@ -3519,7 +3526,7 @@ function RichSelect({
3519
3526
  if (typeof onChange === "string") {
3520
3527
  eventBus.emit(`UI:${onChange}`, { value: next });
3521
3528
  }
3522
- onValueChange?.(next);
3529
+ dispatchValueChange(onValueChange, eventBus, next);
3523
3530
  };
3524
3531
  React79.useEffect(() => {
3525
3532
  const handler = (e) => {
@@ -3379,6 +3379,13 @@ var init_Textarea = __esm({
3379
3379
  Textarea.displayName = "Textarea";
3380
3380
  }
3381
3381
  });
3382
+ function dispatchValueChange(onValueChange, eventBus, value) {
3383
+ if (typeof onValueChange === "string") {
3384
+ eventBus.emit(`UI:${onValueChange}`, { value });
3385
+ } else {
3386
+ onValueChange?.(value);
3387
+ }
3388
+ }
3382
3389
  function flatOptions(opts, groups) {
3383
3390
  const flat = opts ?? [];
3384
3391
  const grp = (groups ?? []).flatMap((g) => g.options);
@@ -3402,7 +3409,7 @@ function NativeSelect({
3402
3409
  } else {
3403
3410
  onChange?.(e);
3404
3411
  }
3405
- onValueChange?.(e.target.value);
3412
+ dispatchValueChange(onValueChange, eventBus, e.target.value);
3406
3413
  };
3407
3414
  return /* @__PURE__ */ jsxs("div", { className: "relative", children: [
3408
3415
  /* @__PURE__ */ jsxs(
@@ -3462,7 +3469,7 @@ function RichSelect({
3462
3469
  if (typeof onChange === "string") {
3463
3470
  eventBus.emit(`UI:${onChange}`, { value: next });
3464
3471
  }
3465
- onValueChange?.(next);
3472
+ dispatchValueChange(onValueChange, eventBus, next);
3466
3473
  };
3467
3474
  const clear = (e) => {
3468
3475
  e.stopPropagation();
@@ -3470,7 +3477,7 @@ function RichSelect({
3470
3477
  if (typeof onChange === "string") {
3471
3478
  eventBus.emit(`UI:${onChange}`, { value: next });
3472
3479
  }
3473
- onValueChange?.(next);
3480
+ dispatchValueChange(onValueChange, eventBus, next);
3474
3481
  };
3475
3482
  useEffect(() => {
3476
3483
  const handler = (e) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@almadar/ui",
3
- "version": "5.32.1",
3
+ "version": "5.32.2",
4
4
  "description": "React UI components, hooks, and providers for Almadar",
5
5
  "type": "module",
6
6
  "sideEffects": [