@almadar/ui 5.31.0 → 5.32.0

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.
@@ -3440,6 +3440,7 @@ function NativeSelect({
3440
3440
  placeholder,
3441
3441
  error,
3442
3442
  onChange,
3443
+ onValueChange,
3443
3444
  value,
3444
3445
  ...props
3445
3446
  }) {
@@ -3448,8 +3449,9 @@ function NativeSelect({
3448
3449
  if (typeof onChange === "string") {
3449
3450
  eventBus.emit(`UI:${onChange}`, { value: e.target.value });
3450
3451
  } else {
3451
- onChange?.(e.target.value);
3452
+ onChange?.(e);
3452
3453
  }
3454
+ onValueChange?.(e.target.value);
3453
3455
  };
3454
3456
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative", children: [
3455
3457
  /* @__PURE__ */ jsxRuntime.jsxs(
@@ -3484,6 +3486,7 @@ function RichSelect({
3484
3486
  placeholder,
3485
3487
  error,
3486
3488
  onChange,
3489
+ onValueChange,
3487
3490
  value,
3488
3491
  multiple,
3489
3492
  searchable,
@@ -3507,18 +3510,16 @@ function RichSelect({
3507
3510
  }
3508
3511
  if (typeof onChange === "string") {
3509
3512
  eventBus.emit(`UI:${onChange}`, { value: next });
3510
- } else {
3511
- onChange?.(next);
3512
3513
  }
3514
+ onValueChange?.(next);
3513
3515
  };
3514
3516
  const clear = (e) => {
3515
3517
  e.stopPropagation();
3516
3518
  const next = multiple ? [] : "";
3517
3519
  if (typeof onChange === "string") {
3518
3520
  eventBus.emit(`UI:${onChange}`, { value: next });
3519
- } else {
3520
- onChange?.(next);
3521
3521
  }
3522
+ onValueChange?.(next);
3522
3523
  };
3523
3524
  React79.useEffect(() => {
3524
3525
  const handler = (e) => {
@@ -3536,6 +3537,7 @@ function RichSelect({
3536
3537
  "button",
3537
3538
  {
3538
3539
  type: "button",
3540
+ dir: opt.dir,
3539
3541
  disabled: opt.disabled,
3540
3542
  onClick: () => !opt.disabled && toggle(opt.value),
3541
3543
  className: cn(
@@ -3545,8 +3547,14 @@ function RichSelect({
3545
3547
  selected.includes(opt.value) && "text-primary font-medium"
3546
3548
  ),
3547
3549
  children: [
3548
- /* @__PURE__ */ jsxRuntime.jsx("span", { children: opt.label }),
3549
- selected.includes(opt.value) && /* @__PURE__ */ jsxRuntime.jsx(Icon, { name: "check", className: "h-icon-default w-icon-default" })
3550
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex items-center gap-2 min-w-0", children: [
3551
+ opt.icon != null && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "shrink-0 flex items-center", children: opt.icon }),
3552
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex flex-col min-w-0", children: [
3553
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: opt.label }),
3554
+ opt.secondaryLabel != null && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs text-muted-foreground font-normal", children: opt.secondaryLabel })
3555
+ ] })
3556
+ ] }),
3557
+ selected.includes(opt.value) && /* @__PURE__ */ jsxRuntime.jsx(Icon, { name: "check", className: "h-icon-default w-icon-default shrink-0" })
3550
3558
  ]
3551
3559
  },
3552
3560
  opt.value
@@ -16310,7 +16318,7 @@ var init_BranchingLogicBuilder = __esm({
16310
16318
  options: sourceOptions,
16311
16319
  value: rule.sourceQuestionId,
16312
16320
  placeholder: t("branchingLogic.selectQuestion"),
16313
- onChange: handleSource,
16321
+ onValueChange: handleSource,
16314
16322
  disabled: readOnly,
16315
16323
  error: broken ? t("branchingLogic.brokenReference") : void 0
16316
16324
  }
@@ -16320,7 +16328,7 @@ var init_BranchingLogicBuilder = __esm({
16320
16328
  {
16321
16329
  options: operatorOptions,
16322
16330
  value: rule.operator,
16323
- onChange: handleOperator,
16331
+ onValueChange: handleOperator,
16324
16332
  disabled: readOnly
16325
16333
  }
16326
16334
  ) }),
@@ -16342,7 +16350,7 @@ var init_BranchingLogicBuilder = __esm({
16342
16350
  options: valueOptions.filter((o) => !chips.includes(o.value)),
16343
16351
  value: "",
16344
16352
  placeholder: t("branchingLogic.addValue"),
16345
- onChange: handleAddChip,
16353
+ onValueChange: handleAddChip,
16346
16354
  disabled: readOnly
16347
16355
  }
16348
16356
  ) }) : /* @__PURE__ */ jsxRuntime.jsx(
@@ -16368,7 +16376,7 @@ var init_BranchingLogicBuilder = __esm({
16368
16376
  options: valueOptions,
16369
16377
  value: scalarValue,
16370
16378
  placeholder: t("branchingLogic.selectValue"),
16371
- onChange: (v) => onChange({ ...rule, value: v }),
16379
+ onValueChange: (v) => onChange({ ...rule, value: v }),
16372
16380
  disabled: readOnly
16373
16381
  }
16374
16382
  ) : /* @__PURE__ */ jsxRuntime.jsx(
@@ -16391,7 +16399,7 @@ var init_BranchingLogicBuilder = __esm({
16391
16399
  options: targetOptions,
16392
16400
  value: rule.targetQuestionId,
16393
16401
  placeholder: t("branchingLogic.selectTarget"),
16394
- onChange: handleTarget,
16402
+ onValueChange: handleTarget,
16395
16403
  disabled: readOnly,
16396
16404
  error: broken && rule.targetQuestionId !== END_OF_SURVEY ? t("branchingLogic.brokenReference") : void 0
16397
16405
  }
@@ -18800,7 +18808,7 @@ var init_Pagination = __esm({
18800
18808
  Select,
18801
18809
  {
18802
18810
  value: String(pageSize),
18803
- onChange: (v) => handlePageSizeChange(Number(v)),
18811
+ onValueChange: (v) => handlePageSizeChange(Number(v)),
18804
18812
  options: pageSizeOptions.map((size) => ({
18805
18813
  value: String(size),
18806
18814
  label: String(size)
@@ -23730,7 +23738,7 @@ var init_FilterGroup = __esm({
23730
23738
  Select,
23731
23739
  {
23732
23740
  value: selectedValues[filter.field] || "all",
23733
- onChange: (v) => handleFilterSelect(filter.field, v),
23741
+ onValueChange: (v) => handleFilterSelect(filter.field, v),
23734
23742
  options: [
23735
23743
  { value: "all", label: t("filterGroup.all") },
23736
23744
  ...filter.options?.map((opt) => ({
@@ -23813,7 +23821,7 @@ var init_FilterGroup = __esm({
23813
23821
  Select,
23814
23822
  {
23815
23823
  value: selectedValues[filter.field] || "all",
23816
- onChange: (v) => handleFilterSelect(filter.field, v),
23824
+ onValueChange: (v) => handleFilterSelect(filter.field, v),
23817
23825
  options: [
23818
23826
  { value: "all", label: t("filterGroup.allOf", { label: filter.label }) },
23819
23827
  ...filter.options?.map((opt) => ({
@@ -23931,7 +23939,7 @@ var init_FilterGroup = __esm({
23931
23939
  Select,
23932
23940
  {
23933
23941
  value: selectedValues[filter.field] || "all",
23934
- onChange: (v) => handleFilterSelect(filter.field, v),
23942
+ onValueChange: (v) => handleFilterSelect(filter.field, v),
23935
23943
  options: [
23936
23944
  { value: "all", label: t("filterGroup.all") },
23937
23945
  ...filter.options?.map((opt) => ({
@@ -33649,7 +33657,7 @@ var init_VersionDiff = __esm({
33649
33657
  {
33650
33658
  options,
33651
33659
  value: activeBeforeId,
33652
- onChange: handleBeforeChange,
33660
+ onValueChange: handleBeforeChange,
33653
33661
  "aria-label": t("versionDiff.beforeRevision")
33654
33662
  }
33655
33663
  ) }),
@@ -33659,7 +33667,7 @@ var init_VersionDiff = __esm({
33659
33667
  {
33660
33668
  options,
33661
33669
  value: activeAfterId,
33662
- onChange: handleAfterChange,
33670
+ onValueChange: handleAfterChange,
33663
33671
  "aria-label": t("versionDiff.afterRevision")
33664
33672
  }
33665
33673
  ) }),
@@ -38242,7 +38250,7 @@ function RuleEditor({
38242
38250
  Select,
38243
38251
  {
38244
38252
  value: rule.whenEvent,
38245
- onChange: handleWhenChange,
38253
+ onValueChange: handleWhenChange,
38246
38254
  options: availableEvents,
38247
38255
  disabled,
38248
38256
  className: "flex-1 min-w-0"
@@ -38253,7 +38261,7 @@ function RuleEditor({
38253
38261
  Select,
38254
38262
  {
38255
38263
  value: rule.thenAction,
38256
- onChange: handleThenChange,
38264
+ onValueChange: handleThenChange,
38257
38265
  options: availableActions,
38258
38266
  disabled,
38259
38267
  className: "flex-1 min-w-0"
@@ -39310,7 +39318,7 @@ var init_Form = __esm({
39310
39318
  ...commonProps,
39311
39319
  options,
39312
39320
  value: String(currentValue),
39313
- onChange: (v) => handleChange(fieldName, v),
39321
+ onValueChange: (v) => handleChange(fieldName, v),
39314
39322
  placeholder: field.placeholder || `Select ${label}...`
39315
39323
  }
39316
39324
  );
@@ -3391,6 +3391,7 @@ function NativeSelect({
3391
3391
  placeholder,
3392
3392
  error,
3393
3393
  onChange,
3394
+ onValueChange,
3394
3395
  value,
3395
3396
  ...props
3396
3397
  }) {
@@ -3399,8 +3400,9 @@ function NativeSelect({
3399
3400
  if (typeof onChange === "string") {
3400
3401
  eventBus.emit(`UI:${onChange}`, { value: e.target.value });
3401
3402
  } else {
3402
- onChange?.(e.target.value);
3403
+ onChange?.(e);
3403
3404
  }
3405
+ onValueChange?.(e.target.value);
3404
3406
  };
3405
3407
  return /* @__PURE__ */ jsxs("div", { className: "relative", children: [
3406
3408
  /* @__PURE__ */ jsxs(
@@ -3435,6 +3437,7 @@ function RichSelect({
3435
3437
  placeholder,
3436
3438
  error,
3437
3439
  onChange,
3440
+ onValueChange,
3438
3441
  value,
3439
3442
  multiple,
3440
3443
  searchable,
@@ -3458,18 +3461,16 @@ function RichSelect({
3458
3461
  }
3459
3462
  if (typeof onChange === "string") {
3460
3463
  eventBus.emit(`UI:${onChange}`, { value: next });
3461
- } else {
3462
- onChange?.(next);
3463
3464
  }
3465
+ onValueChange?.(next);
3464
3466
  };
3465
3467
  const clear = (e) => {
3466
3468
  e.stopPropagation();
3467
3469
  const next = multiple ? [] : "";
3468
3470
  if (typeof onChange === "string") {
3469
3471
  eventBus.emit(`UI:${onChange}`, { value: next });
3470
- } else {
3471
- onChange?.(next);
3472
3472
  }
3473
+ onValueChange?.(next);
3473
3474
  };
3474
3475
  useEffect(() => {
3475
3476
  const handler = (e) => {
@@ -3487,6 +3488,7 @@ function RichSelect({
3487
3488
  "button",
3488
3489
  {
3489
3490
  type: "button",
3491
+ dir: opt.dir,
3490
3492
  disabled: opt.disabled,
3491
3493
  onClick: () => !opt.disabled && toggle(opt.value),
3492
3494
  className: cn(
@@ -3496,8 +3498,14 @@ function RichSelect({
3496
3498
  selected.includes(opt.value) && "text-primary font-medium"
3497
3499
  ),
3498
3500
  children: [
3499
- /* @__PURE__ */ jsx("span", { children: opt.label }),
3500
- selected.includes(opt.value) && /* @__PURE__ */ jsx(Icon, { name: "check", className: "h-icon-default w-icon-default" })
3501
+ /* @__PURE__ */ jsxs("span", { className: "flex items-center gap-2 min-w-0", children: [
3502
+ opt.icon != null && /* @__PURE__ */ jsx("span", { className: "shrink-0 flex items-center", children: opt.icon }),
3503
+ /* @__PURE__ */ jsxs("span", { className: "flex flex-col min-w-0", children: [
3504
+ /* @__PURE__ */ jsx("span", { children: opt.label }),
3505
+ opt.secondaryLabel != null && /* @__PURE__ */ jsx("span", { className: "text-xs text-muted-foreground font-normal", children: opt.secondaryLabel })
3506
+ ] })
3507
+ ] }),
3508
+ selected.includes(opt.value) && /* @__PURE__ */ jsx(Icon, { name: "check", className: "h-icon-default w-icon-default shrink-0" })
3501
3509
  ]
3502
3510
  },
3503
3511
  opt.value
@@ -16261,7 +16269,7 @@ var init_BranchingLogicBuilder = __esm({
16261
16269
  options: sourceOptions,
16262
16270
  value: rule.sourceQuestionId,
16263
16271
  placeholder: t("branchingLogic.selectQuestion"),
16264
- onChange: handleSource,
16272
+ onValueChange: handleSource,
16265
16273
  disabled: readOnly,
16266
16274
  error: broken ? t("branchingLogic.brokenReference") : void 0
16267
16275
  }
@@ -16271,7 +16279,7 @@ var init_BranchingLogicBuilder = __esm({
16271
16279
  {
16272
16280
  options: operatorOptions,
16273
16281
  value: rule.operator,
16274
- onChange: handleOperator,
16282
+ onValueChange: handleOperator,
16275
16283
  disabled: readOnly
16276
16284
  }
16277
16285
  ) }),
@@ -16293,7 +16301,7 @@ var init_BranchingLogicBuilder = __esm({
16293
16301
  options: valueOptions.filter((o) => !chips.includes(o.value)),
16294
16302
  value: "",
16295
16303
  placeholder: t("branchingLogic.addValue"),
16296
- onChange: handleAddChip,
16304
+ onValueChange: handleAddChip,
16297
16305
  disabled: readOnly
16298
16306
  }
16299
16307
  ) }) : /* @__PURE__ */ jsx(
@@ -16319,7 +16327,7 @@ var init_BranchingLogicBuilder = __esm({
16319
16327
  options: valueOptions,
16320
16328
  value: scalarValue,
16321
16329
  placeholder: t("branchingLogic.selectValue"),
16322
- onChange: (v) => onChange({ ...rule, value: v }),
16330
+ onValueChange: (v) => onChange({ ...rule, value: v }),
16323
16331
  disabled: readOnly
16324
16332
  }
16325
16333
  ) : /* @__PURE__ */ jsx(
@@ -16342,7 +16350,7 @@ var init_BranchingLogicBuilder = __esm({
16342
16350
  options: targetOptions,
16343
16351
  value: rule.targetQuestionId,
16344
16352
  placeholder: t("branchingLogic.selectTarget"),
16345
- onChange: handleTarget,
16353
+ onValueChange: handleTarget,
16346
16354
  disabled: readOnly,
16347
16355
  error: broken && rule.targetQuestionId !== END_OF_SURVEY ? t("branchingLogic.brokenReference") : void 0
16348
16356
  }
@@ -18751,7 +18759,7 @@ var init_Pagination = __esm({
18751
18759
  Select,
18752
18760
  {
18753
18761
  value: String(pageSize),
18754
- onChange: (v) => handlePageSizeChange(Number(v)),
18762
+ onValueChange: (v) => handlePageSizeChange(Number(v)),
18755
18763
  options: pageSizeOptions.map((size) => ({
18756
18764
  value: String(size),
18757
18765
  label: String(size)
@@ -23681,7 +23689,7 @@ var init_FilterGroup = __esm({
23681
23689
  Select,
23682
23690
  {
23683
23691
  value: selectedValues[filter.field] || "all",
23684
- onChange: (v) => handleFilterSelect(filter.field, v),
23692
+ onValueChange: (v) => handleFilterSelect(filter.field, v),
23685
23693
  options: [
23686
23694
  { value: "all", label: t("filterGroup.all") },
23687
23695
  ...filter.options?.map((opt) => ({
@@ -23764,7 +23772,7 @@ var init_FilterGroup = __esm({
23764
23772
  Select,
23765
23773
  {
23766
23774
  value: selectedValues[filter.field] || "all",
23767
- onChange: (v) => handleFilterSelect(filter.field, v),
23775
+ onValueChange: (v) => handleFilterSelect(filter.field, v),
23768
23776
  options: [
23769
23777
  { value: "all", label: t("filterGroup.allOf", { label: filter.label }) },
23770
23778
  ...filter.options?.map((opt) => ({
@@ -23882,7 +23890,7 @@ var init_FilterGroup = __esm({
23882
23890
  Select,
23883
23891
  {
23884
23892
  value: selectedValues[filter.field] || "all",
23885
- onChange: (v) => handleFilterSelect(filter.field, v),
23893
+ onValueChange: (v) => handleFilterSelect(filter.field, v),
23886
23894
  options: [
23887
23895
  { value: "all", label: t("filterGroup.all") },
23888
23896
  ...filter.options?.map((opt) => ({
@@ -33600,7 +33608,7 @@ var init_VersionDiff = __esm({
33600
33608
  {
33601
33609
  options,
33602
33610
  value: activeBeforeId,
33603
- onChange: handleBeforeChange,
33611
+ onValueChange: handleBeforeChange,
33604
33612
  "aria-label": t("versionDiff.beforeRevision")
33605
33613
  }
33606
33614
  ) }),
@@ -33610,7 +33618,7 @@ var init_VersionDiff = __esm({
33610
33618
  {
33611
33619
  options,
33612
33620
  value: activeAfterId,
33613
- onChange: handleAfterChange,
33621
+ onValueChange: handleAfterChange,
33614
33622
  "aria-label": t("versionDiff.afterRevision")
33615
33623
  }
33616
33624
  ) }),
@@ -38193,7 +38201,7 @@ function RuleEditor({
38193
38201
  Select,
38194
38202
  {
38195
38203
  value: rule.whenEvent,
38196
- onChange: handleWhenChange,
38204
+ onValueChange: handleWhenChange,
38197
38205
  options: availableEvents,
38198
38206
  disabled,
38199
38207
  className: "flex-1 min-w-0"
@@ -38204,7 +38212,7 @@ function RuleEditor({
38204
38212
  Select,
38205
38213
  {
38206
38214
  value: rule.thenAction,
38207
- onChange: handleThenChange,
38215
+ onValueChange: handleThenChange,
38208
38216
  options: availableActions,
38209
38217
  disabled,
38210
38218
  className: "flex-1 min-w-0"
@@ -39261,7 +39269,7 @@ var init_Form = __esm({
39261
39269
  ...commonProps,
39262
39270
  options,
39263
39271
  value: String(currentValue),
39264
- onChange: (v) => handleChange(fieldName, v),
39272
+ onValueChange: (v) => handleChange(fieldName, v),
39265
39273
  placeholder: field.placeholder || `Select ${label}...`
39266
39274
  }
39267
39275
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@almadar/ui",
3
- "version": "5.31.0",
3
+ "version": "5.32.0",
4
4
  "description": "React UI components, hooks, and providers for Almadar",
5
5
  "type": "module",
6
6
  "sideEffects": [