@parrot-co/parrot-ui 0.1.23 → 0.1.25

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/main.js CHANGED
@@ -423,6 +423,11 @@ const $8ddcc69383feb36a$export$b4e0e71242920c6a = {
423
423
  };
424
424
 
425
425
 
426
+ function $4af7da5c7dd0b9c2$export$de9bdbce6502b027(name, length = 1) {
427
+ if (!name || length < 1) return "";
428
+ if (length == 1) return name.charAt(0);
429
+ return name.trim().split(/\s+/).slice(0, length).map((c)=>c.charAt(0)).join("");
430
+ }
426
431
  function $4af7da5c7dd0b9c2$export$1c4d39b152e0f791(deprecatedProp, newProp, value) {
427
432
  if (!(0, $d99c85a751d7ffbd$export$ae45edb09e2fe7c2)(value)) console.warn(`${deprecatedProp} is deprecated and will be removed in a future release. ${newProp ? `Please use ${newProp} instead.` : ""}`);
428
433
  }
@@ -1648,12 +1653,15 @@ function $fc43ab93aaa777d9$export$3d7d0414f6db67e7({ children: children, renderO
1648
1653
  if (item?.[sectionKey]) return /*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsx)((0, $86685406b084d356$export$ef146090a6472d9e), {
1649
1654
  items: sectionChildren,
1650
1655
  title: renderSectionLabel?.(item),
1651
- children: (item)=>/*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsx)((0, $86685406b084d356$export$5b7f4051a57920d0), {
1656
+ children: (item)=>{
1657
+ return /*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsx)((0, $86685406b084d356$export$5b7f4051a57920d0), {
1652
1658
  textValue: item?.[labelKey ?? "label"],
1653
1659
  children: renderOption?.(item) ?? item?.[labelKey ?? "label"]
1654
- }, item?.[valueKey ?? "id" ?? "key" ?? "value"])
1660
+ }, item?.[valueKey ?? "id" ?? "key" ?? "value"]);
1661
+ }
1655
1662
  }, value);
1656
1663
  return /*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsx)((0, $86685406b084d356$export$5b7f4051a57920d0), {
1664
+ "aria-label": label,
1657
1665
  textValue: label,
1658
1666
  children: renderOption?.(item) ?? label
1659
1667
  }, value);
@@ -1848,7 +1856,25 @@ function $dcfc4542aa84c062$var$ListSection({ state: state, section: section }) {
1848
1856
 
1849
1857
 
1850
1858
 
1851
- function $d67a8dc6cbdaa7ed$export$72b9695b8216309a({ description: description, descriptionProps: descriptionProps, error: error, errorMessageProps: errorMessageProps, label: label, labelProps: labelProps, selectorIcon: selectorIcon, selectorSize: selectorSize = "sm", style: style, styles: styles, className: className, classNames: classNames, ...props }) {
1859
+
1860
+ function $d67a8dc6cbdaa7ed$export$72b9695b8216309a({ description: description, descriptionProps: descriptionProps, error: error, errorMessageProps: errorMessageProps, label: label, labelProps: labelProps, selectorIcon: selectorIcon, selectorSize: selectorSize = "sm", style: style, styles: styles, className: className, classNames: classNames, isLoading: isLoading, loadData: loadData, loadingIndicator: loadingIndicator = /*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsx)((0, $a28e128499dd0b02$export$3b0d6d7590275603), {
1861
+ size: "xs"
1862
+ }), ...props }) {
1863
+ let list = null;
1864
+ if (loadData) list = (0, $8zHUo$reactstately.useAsyncList)({
1865
+ async load ({ filterText: filterText, signal: signal }) {
1866
+ const res = await loadData(filterText, signal);
1867
+ return {
1868
+ items: res
1869
+ };
1870
+ }
1871
+ });
1872
+ if (list) {
1873
+ props.items = list.items;
1874
+ props.inputValue = list.filterText;
1875
+ props.onInputChange = list.setFilterText;
1876
+ isLoading = list.isLoading;
1877
+ }
1852
1878
  const { contains: contains } = (0, $8zHUo$reactaria.useFilter)({
1853
1879
  sensitivity: "base"
1854
1880
  });
@@ -1896,7 +1922,7 @@ function $d67a8dc6cbdaa7ed$export$72b9695b8216309a({ description: description, d
1896
1922
  color: "gray",
1897
1923
  size: selectorSize,
1898
1924
  ...buttonProps,
1899
- children: selectorIcon
1925
+ children: isLoading ? loadingIndicator : selectorIcon
1900
1926
  })
1901
1927
  ]
1902
1928
  }),
@@ -2662,9 +2688,13 @@ $e0a58c83d4c36e4e$export$7edc06cf1783b30f.displayName = "DateInput";
2662
2688
 
2663
2689
 
2664
2690
 
2665
- const $2fdd5844efb4cca1$export$e2255cf6045e8d47 = /*#__PURE__*/ $8zHUo$react.forwardRef(({ src: src, alt: alt, name: name, color: color, variant: variant = "light", fallback: fallback, children: children, size: size = "md", shape: shape, className: className, radius: radius = "full", classNames: classNames, styles: styles, style: style, ...props }, ref)=>{
2691
+ const $2fdd5844efb4cca1$export$e2255cf6045e8d47 = /*#__PURE__*/ $8zHUo$react.forwardRef(({ src: src, alt: alt, name: name, color: color, variant: variant = "light", fallback: fallback, children: children, size: size = "md", shape: shape, className: className, radius: radius = "full", classNames: classNames, styles: styles, style: style, initialsLength: initialsLength = 1, ...props }, ref)=>{
2666
2692
  const [imageError, setImageError] = $8zHUo$react.useState(false);
2667
2693
  const theme = (0, $f2fd0cbe11b7f0dd$export$93d4e7f90805808f)();
2694
+ const initials = $8zHUo$react.useMemo(()=>{
2695
+ if (!name) return "";
2696
+ return (0, $4af7da5c7dd0b9c2$export$de9bdbce6502b027)(name, initialsLength);
2697
+ }, []);
2668
2698
  function getAvatarRadius() {
2669
2699
  (0, $4af7da5c7dd0b9c2$export$1c4d39b152e0f791)("shape", "radius", shape);
2670
2700
  // TODO: remove this when we remove the deprecated shape prop
@@ -2696,7 +2726,7 @@ const $2fdd5844efb4cca1$export$e2255cf6045e8d47 = /*#__PURE__*/ $8zHUo$react.for
2696
2726
  "avatar-fallback",
2697
2727
  classNames?.fallback
2698
2728
  ]),
2699
- children: name.charAt(0)
2729
+ children: initials
2700
2730
  });
2701
2731
  return children;
2702
2732
  };