@wello-dev/core 1.0.4 → 1.0.5

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.
Files changed (47) hide show
  1. package/dist/{chunk-PPKKOBHB.js → chunk-5XXK7KQE.js} +2 -2
  2. package/dist/{chunk-YOL5PMHU.js → chunk-7S7RIVCI.js} +2 -2
  3. package/dist/{chunk-TJUOXXLK.js → chunk-BVGYS3NN.js} +2 -2
  4. package/dist/{chunk-6U4Y3AUT.js → chunk-COAMHU2N.js} +2 -2
  5. package/dist/{chunk-2XGMU4QA.js → chunk-DZ7HIMJ5.js} +20 -4
  6. package/dist/chunk-DZ7HIMJ5.js.map +1 -0
  7. package/dist/{chunk-O4MQLZEH.js → chunk-KNN75VAT.js} +2 -2
  8. package/dist/{chunk-K2Q5Q6WQ.js → chunk-N7T45HQC.js} +4 -4
  9. package/dist/chunk-N7T45HQC.js.map +1 -0
  10. package/dist/{chunk-F4OMXH3E.js → chunk-QSFXOVRL.js} +5 -5
  11. package/dist/{chunk-F4OMXH3E.js.map → chunk-QSFXOVRL.js.map} +1 -1
  12. package/dist/{chunk-QZFPW75D.js → chunk-SJBYDDDD.js} +19 -3
  13. package/dist/chunk-SJBYDDDD.js.map +1 -0
  14. package/dist/{chunk-KEYIOWAG.js → chunk-TIVOXLDX.js} +3 -3
  15. package/dist/{chunk-KEYIOWAG.js.map → chunk-TIVOXLDX.js.map} +1 -1
  16. package/dist/{chunk-GD5URO3H.js → chunk-ULMVA37U.js} +4 -4
  17. package/dist/chunk-X7WXW6AV.js +206 -0
  18. package/dist/chunk-X7WXW6AV.js.map +1 -0
  19. package/dist/components/ColorPicker/ColorInput.js +3 -3
  20. package/dist/components/Combobox/Combobox.js +3 -3
  21. package/dist/components/Combobox/Select.js +4 -4
  22. package/dist/components/Combobox/TagsInput.js +4 -4
  23. package/dist/components/Menu/Menu.js +3 -3
  24. package/dist/components/NumberFormatter/NumberFormatter.js +1 -1
  25. package/dist/components/PhoneInput/PhoneInput.js +5 -5
  26. package/dist/components/Popover/Popover.js +2 -2
  27. package/dist/components/TextInput/TextInput.js +2 -2
  28. package/dist/components/Tooltip/Tooltip.js +2 -2
  29. package/dist/index.cjs +134 -88
  30. package/dist/index.cjs.map +1 -1
  31. package/dist/index.d.cts +5 -0
  32. package/dist/index.d.ts +5 -0
  33. package/dist/index.js +70 -70
  34. package/dist/shadcn/Floating.js +5 -5
  35. package/dist/styles.css +119 -15
  36. package/package.json +1 -1
  37. package/dist/chunk-2XGMU4QA.js.map +0 -1
  38. package/dist/chunk-K2Q5Q6WQ.js.map +0 -1
  39. package/dist/chunk-QZFPW75D.js.map +0 -1
  40. package/dist/chunk-YHPHWOAE.js +0 -192
  41. package/dist/chunk-YHPHWOAE.js.map +0 -1
  42. /package/dist/{chunk-PPKKOBHB.js.map → chunk-5XXK7KQE.js.map} +0 -0
  43. /package/dist/{chunk-YOL5PMHU.js.map → chunk-7S7RIVCI.js.map} +0 -0
  44. /package/dist/{chunk-TJUOXXLK.js.map → chunk-BVGYS3NN.js.map} +0 -0
  45. /package/dist/{chunk-6U4Y3AUT.js.map → chunk-COAMHU2N.js.map} +0 -0
  46. /package/dist/{chunk-O4MQLZEH.js.map → chunk-KNN75VAT.js.map} +0 -0
  47. /package/dist/{chunk-GD5URO3H.js.map → chunk-ULMVA37U.js.map} +0 -0
package/dist/index.cjs CHANGED
@@ -5584,7 +5584,7 @@ function formatNumber(value, options = {}) {
5584
5584
  }
5585
5585
  function NumberFormatter(_props) {
5586
5586
  const { value, ...options } = useProps("NumberFormatter", {}, _props);
5587
- return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(import_jsx_runtime51.Fragment, { children: formatNumber(value, options) });
5587
+ return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("span", { dir: "ltr", style: { unicodeBidi: "isolate" }, children: formatNumber(value, options) });
5588
5588
  }
5589
5589
 
5590
5590
  // src/components/Popover/Popover.tsx
@@ -5718,17 +5718,17 @@ function useFloating(options) {
5718
5718
  }, [opened, update2]);
5719
5719
  const setReference = (0, import_react32.useCallback)(
5720
5720
  (node) => {
5721
- if (!node || node === reference.current) return;
5721
+ if (node === reference.current) return;
5722
5722
  reference.current = node;
5723
- if (opened) update2();
5723
+ if (node && opened) update2();
5724
5724
  },
5725
5725
  [opened, update2]
5726
5726
  );
5727
5727
  const setFloating = (0, import_react32.useCallback)(
5728
5728
  (node) => {
5729
- if (!node || node === floating.current) return;
5729
+ if (node === floating.current) return;
5730
5730
  floating.current = node;
5731
- update2();
5731
+ if (node) update2();
5732
5732
  },
5733
5733
  [update2]
5734
5734
  );
@@ -5784,14 +5784,14 @@ function Popover(_props) {
5784
5784
  props.onChange?.(next);
5785
5785
  (next ? props.onOpen : props.onClose)?.();
5786
5786
  };
5787
- const { dir } = useDirection();
5787
+ const { dir: appDir } = useDirection();
5788
5788
  const floating = useFloating({
5789
5789
  opened,
5790
5790
  position: props.position,
5791
5791
  offset: props.offset + (props.withArrow ? props.arrowSize / 2 : 0),
5792
5792
  flip: props.middlewares?.flip ?? true,
5793
5793
  shift: props.middlewares?.shift ?? true,
5794
- dir,
5794
+ dir: props.dir ?? appDir,
5795
5795
  arrowSize: props.withArrow ? props.arrowSize : 0,
5796
5796
  arrowOffset: props.arrowOffset,
5797
5797
  arrowPosition: props.arrowPosition,
@@ -8588,12 +8588,28 @@ function comparable(value) {
8588
8588
  if (typeof value === "object" && "id" in value) return String(value.id);
8589
8589
  return String(value);
8590
8590
  }
8591
+ function pickPlainLabel(raw2, fallback) {
8592
+ if (typeof raw2 === "string" || typeof raw2 === "number") return raw2;
8593
+ if ((0, import_react45.isValidElement)(raw2)) return raw2;
8594
+ if (raw2 && typeof raw2 === "object" && !Array.isArray(raw2)) {
8595
+ const map = raw2;
8596
+ for (const key of ["ar", "en", "label", "name", "title"]) {
8597
+ const hit = map[key];
8598
+ if (typeof hit === "string" && hit.trim()) return hit.trim();
8599
+ }
8600
+ for (const hit of Object.values(map)) {
8601
+ if (typeof hit === "string" && hit.trim()) return hit.trim();
8602
+ }
8603
+ }
8604
+ return fallback;
8605
+ }
8591
8606
  function toSelectItem(entry, keys) {
8592
8607
  const record = typeof entry === "object" ? entry : { value: entry, label: String(entry) };
8593
8608
  const value = comparable(record.value ?? record[keys.valueKey]);
8594
8609
  const raw2 = record.label ?? record[keys.labelKey];
8595
- const plain = typeof raw2 === "string" || typeof raw2 === "number" || (0, import_react45.isValidElement)(raw2) ? raw2 : value;
8596
- const node = keys.getOptionLabel ? keys.getOptionLabel(record) : plain;
8610
+ const plain = pickPlainLabel(raw2, value);
8611
+ const fromGetter = keys.getOptionLabel ? keys.getOptionLabel(record) : void 0;
8612
+ const node = fromGetter !== void 0 && fromGetter !== null && fromGetter !== "" ? fromGetter : plain;
8597
8613
  const text = typeof node === "string" || typeof node === "number" ? String(node) : typeof raw2 === "string" ? raw2 : value;
8598
8614
  const label = record.searchText ?? (typeof record.description === "string" ? `${text} ${record.description}` : text);
8599
8615
  return { value, label, node, display: record.displayLabel ?? node, disabled: record.disabled, option: entry, record };
@@ -9669,6 +9685,7 @@ var PhoneInput = factory((_props, ref) => {
9669
9685
  const shownPlaceholder = typeof placeholder === "function" ? placeholder(limit) : placeholder ?? (limit ? labels.phoneDigits(limit) : void 0);
9670
9686
  const layout = { m, mt, mb, ml, mr, ms, me, mx, my, w, miw, maw, flex };
9671
9687
  if (loading) return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(Skeleton, { height: 36, radius: 999, ...layout });
9688
+ const selectPropClassNames = typeof selectProps?.classNames === "object" && selectProps.classNames ? selectProps.classNames : {};
9672
9689
  const select = {
9673
9690
  value: code,
9674
9691
  emptyValue: "",
@@ -9677,10 +9694,25 @@ var PhoneInput = factory((_props, ref) => {
9677
9694
  placeholder: codePlaceholder,
9678
9695
  withFooter: false,
9679
9696
  radius: 0,
9680
- comboboxProps: { width: 240, position: "bottom-start", withinPortal: true },
9681
9697
  "aria-invalid": !!codeError || void 0,
9682
9698
  "aria-label": codePlaceholder,
9683
9699
  ...selectProps,
9700
+ // PhoneInput wins these after selectProps — dial codes stay LTR and compact.
9701
+ searchable: false,
9702
+ checkIconPosition: "right",
9703
+ classNames: {
9704
+ ...selectPropClassNames,
9705
+ dropdown: ["wello-PhoneInput-dropdown", selectPropClassNames.dropdown].filter(Boolean).join(" ")
9706
+ },
9707
+ comboboxProps: {
9708
+ width: "target",
9709
+ middlewares: { flip: true, shift: true },
9710
+ ...selectProps?.comboboxProps,
9711
+ position: "bottom-start",
9712
+ withinPortal: true,
9713
+ // Don't RTL-flip start/end — dial code stays left-anchored like a phone number.
9714
+ dir: "ltr"
9715
+ },
9684
9716
  onChange: (next, option) => {
9685
9717
  const resolved = option?.resolved ?? null;
9686
9718
  if (resolved) setFetched(resolved);
@@ -10279,87 +10311,101 @@ var ColorInput = factory((_props, ref) => {
10279
10311
  const [eyeDropperSupported, setSupported] = (0, import_react49.useState)(false);
10280
10312
  (0, import_react49.useEffect)(() => setSupported(typeof window !== "undefined" && "EyeDropper" in window), []);
10281
10313
  const named = typeof size2 === "string" ? size2 : "sm";
10282
- return /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)(Popover, { position: "bottom-start", offset: 5, opened, width: fullWidth ? "target" : void 0, transitionProps: { duration: 0 }, ...popoverProps, withRoles: false, disabled: readOnly || withPicker === false && !swatches?.length, children: [
10283
- /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(PopoverTarget, { children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
10284
- InputBase,
10285
- {
10286
- autoComplete: "off",
10287
- spellCheck: false,
10288
- ...others,
10289
- __staticSelector: "ColorInput",
10290
- ref,
10291
- classNames: partClasses,
10292
- styles: partStyles,
10293
- unstyled,
10294
- size: size2,
10295
- disabled,
10296
- readOnly: disallowInput || readOnly,
10297
- pointer: disallowInput,
10298
- value: current,
10299
- onFocus: (event) => {
10300
- onFocus?.(event);
10301
- setOpened(true);
10302
- },
10303
- onBlur: (event) => {
10304
- if (fixOnBlur && current !== lastValid.current) setValue(lastValid.current);
10305
- onBlur?.(event);
10306
- setOpened(false);
10307
- },
10308
- onClick: (event) => {
10309
- onClick2?.(event);
10310
- setOpened(true);
10311
- },
10312
- onChange: (event) => {
10313
- const next = event.currentTarget.value;
10314
- setValue(next);
10315
- if (isColorValid(next)) onChangeEnd?.(convertHsvaTo(format, parseColor(next)));
10316
- },
10317
- leftSection: leftSection || (withPreview ? /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(ColorSwatch, { color: isColorValid(current) ? current : "#fff", size: PREVIEW_SIZE[named] ?? 18, ...getStyles("colorPreview") }) : null),
10318
- rightSectionPointerEvents: "auto",
10319
- rightSection: rightSection || (withEyeDropper && !disabled && !readOnly && eyeDropperSupported ? /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
10320
- ActionIcon,
10314
+ return /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)(
10315
+ Popover,
10316
+ {
10317
+ position: "bottom-start",
10318
+ offset: 5,
10319
+ opened,
10320
+ width: fullWidth ? "target" : void 0,
10321
+ transitionProps: { duration: 0 },
10322
+ ...popoverProps,
10323
+ dir: popoverProps?.dir ?? "ltr",
10324
+ withRoles: false,
10325
+ disabled: readOnly || withPicker === false && !swatches?.length,
10326
+ children: [
10327
+ /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(PopoverTarget, { children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
10328
+ InputBase,
10321
10329
  {
10322
- "aria-label": labels.colorEyeDropper,
10323
- ...eyeDropperButtonProps,
10324
- ...getStyles("eyeDropperButton"),
10325
- variant: "subtle",
10326
- color: "gray",
10327
- onMouseDown: (event) => event.preventDefault(),
10328
- onClick: () => {
10329
- const EyeDropper = window.EyeDropper;
10330
- new EyeDropper().open().then(({ sRGBHex }) => {
10331
- const color2 = convertHsvaTo(format, parseColor(sRGBHex));
10332
- setValue(color2);
10333
- onChangeEnd?.(color2);
10334
- }).catch(() => void 0);
10330
+ autoComplete: "off",
10331
+ spellCheck: false,
10332
+ ...others,
10333
+ __staticSelector: "ColorInput",
10334
+ ref,
10335
+ classNames: partClasses,
10336
+ styles: partStyles,
10337
+ unstyled,
10338
+ size: size2,
10339
+ disabled,
10340
+ readOnly: disallowInput || readOnly,
10341
+ pointer: disallowInput,
10342
+ value: current,
10343
+ onFocus: (event) => {
10344
+ onFocus?.(event);
10345
+ setOpened(true);
10346
+ },
10347
+ onBlur: (event) => {
10348
+ if (fixOnBlur && current !== lastValid.current) setValue(lastValid.current);
10349
+ onBlur?.(event);
10350
+ setOpened(false);
10351
+ },
10352
+ onClick: (event) => {
10353
+ onClick2?.(event);
10354
+ setOpened(true);
10335
10355
  },
10336
- children: eyeDropperIcon || /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(EyeDropperIcon, { size: ICON_SIZE[named] ?? 16, ...getStyles("eyeDropperIcon") })
10356
+ onChange: (event) => {
10357
+ const next = event.currentTarget.value;
10358
+ setValue(next);
10359
+ if (isColorValid(next)) onChangeEnd?.(convertHsvaTo(format, parseColor(next)));
10360
+ },
10361
+ leftSection: leftSection || (withPreview ? /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(ColorSwatch, { color: isColorValid(current) ? current : "#fff", size: PREVIEW_SIZE[named] ?? 18, ...getStyles("colorPreview") }) : null),
10362
+ rightSectionPointerEvents: "auto",
10363
+ rightSection: rightSection || (withEyeDropper && !disabled && !readOnly && eyeDropperSupported ? /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
10364
+ ActionIcon,
10365
+ {
10366
+ "aria-label": labels.colorEyeDropper,
10367
+ ...eyeDropperButtonProps,
10368
+ ...getStyles("eyeDropperButton"),
10369
+ variant: "subtle",
10370
+ color: "gray",
10371
+ onMouseDown: (event) => event.preventDefault(),
10372
+ onClick: () => {
10373
+ const EyeDropper = window.EyeDropper;
10374
+ new EyeDropper().open().then(({ sRGBHex }) => {
10375
+ const color2 = convertHsvaTo(format, parseColor(sRGBHex));
10376
+ setValue(color2);
10377
+ onChangeEnd?.(color2);
10378
+ }).catch(() => void 0);
10379
+ },
10380
+ children: eyeDropperIcon || /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(EyeDropperIcon, { size: ICON_SIZE[named] ?? 16, ...getStyles("eyeDropperIcon") })
10381
+ }
10382
+ ) : null)
10337
10383
  }
10338
- ) : null)
10339
- }
10340
- ) }),
10341
- /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(PopoverDropdown, { ...getStyles("dropdown"), onMouseDown: (event) => event.preventDefault(), children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
10342
- ColorPicker,
10343
- {
10344
- value: current,
10345
- onChange: setValue,
10346
- onChangeEnd,
10347
- format,
10348
- swatches,
10349
- swatchesPerRow,
10350
- withPicker,
10351
- size: size2,
10352
- focusable: false,
10353
- unstyled,
10354
- classNames: partClasses,
10355
- styles: partStyles,
10356
- fullWidth,
10357
- onColorSwatchClick: () => {
10358
- if (closeOnColorSwatchClick) setOpened(false);
10359
- }
10360
- }
10361
- ) })
10362
- ] });
10384
+ ) }),
10385
+ /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(PopoverDropdown, { ...getStyles("dropdown"), onMouseDown: (event) => event.preventDefault(), children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
10386
+ ColorPicker,
10387
+ {
10388
+ value: current,
10389
+ onChange: setValue,
10390
+ onChangeEnd,
10391
+ format,
10392
+ swatches,
10393
+ swatchesPerRow,
10394
+ withPicker,
10395
+ size: size2,
10396
+ focusable: false,
10397
+ unstyled,
10398
+ classNames: partClasses,
10399
+ styles: partStyles,
10400
+ fullWidth,
10401
+ onColorSwatchClick: () => {
10402
+ if (closeOnColorSwatchClick) setOpened(false);
10403
+ }
10404
+ }
10405
+ ) })
10406
+ ]
10407
+ }
10408
+ );
10363
10409
  });
10364
10410
  ColorInput.displayName = "ColorInput";
10365
10411