@parrot-co/parrot-ui 0.1.22 → 0.1.24

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
  }
@@ -657,6 +662,7 @@ function $f2fd0cbe11b7f0dd$export$d8964aec282183a3(props) {
657
662
  value: themeProps,
658
663
  children: /*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsx)("div", {
659
664
  id: "parrot-theme-provider",
665
+ "data-gray-variant": themeProps.grayVariant,
660
666
  "data-radius": themeProps.radius,
661
667
  "data-color": themeProps.color,
662
668
  "data-scaling": scaling,
@@ -1647,12 +1653,15 @@ function $fc43ab93aaa777d9$export$3d7d0414f6db67e7({ children: children, renderO
1647
1653
  if (item?.[sectionKey]) return /*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsx)((0, $86685406b084d356$export$ef146090a6472d9e), {
1648
1654
  items: sectionChildren,
1649
1655
  title: renderSectionLabel?.(item),
1650
- 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), {
1651
1658
  textValue: item?.[labelKey ?? "label"],
1652
1659
  children: renderOption?.(item) ?? item?.[labelKey ?? "label"]
1653
- }, item?.[valueKey ?? "id" ?? "key" ?? "value"])
1660
+ }, item?.[valueKey ?? "id" ?? "key" ?? "value"]);
1661
+ }
1654
1662
  }, value);
1655
1663
  return /*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsx)((0, $86685406b084d356$export$5b7f4051a57920d0), {
1664
+ "aria-label": label,
1656
1665
  textValue: label,
1657
1666
  children: renderOption?.(item) ?? label
1658
1667
  }, value);
@@ -1847,7 +1856,25 @@ function $dcfc4542aa84c062$var$ListSection({ state: state, section: section }) {
1847
1856
 
1848
1857
 
1849
1858
 
1850
- 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 }) {
1866
+ const res = await loadData(filterText);
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
+ }
1851
1878
  const { contains: contains } = (0, $8zHUo$reactaria.useFilter)({
1852
1879
  sensitivity: "base"
1853
1880
  });
@@ -1895,7 +1922,7 @@ function $d67a8dc6cbdaa7ed$export$72b9695b8216309a({ description: description, d
1895
1922
  color: "gray",
1896
1923
  size: selectorSize,
1897
1924
  ...buttonProps,
1898
- children: selectorIcon
1925
+ children: isLoading ? loadingIndicator : selectorIcon
1899
1926
  })
1900
1927
  ]
1901
1928
  }),
@@ -2661,9 +2688,13 @@ $e0a58c83d4c36e4e$export$7edc06cf1783b30f.displayName = "DateInput";
2661
2688
 
2662
2689
 
2663
2690
 
2664
- 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)=>{
2665
2692
  const [imageError, setImageError] = $8zHUo$react.useState(false);
2666
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
+ }, []);
2667
2698
  function getAvatarRadius() {
2668
2699
  (0, $4af7da5c7dd0b9c2$export$1c4d39b152e0f791)("shape", "radius", shape);
2669
2700
  // TODO: remove this when we remove the deprecated shape prop
@@ -2695,7 +2726,7 @@ const $2fdd5844efb4cca1$export$e2255cf6045e8d47 = /*#__PURE__*/ $8zHUo$react.for
2695
2726
  "avatar-fallback",
2696
2727
  classNames?.fallback
2697
2728
  ]),
2698
- children: name.charAt(0)
2729
+ children: initials
2699
2730
  });
2700
2731
  return children;
2701
2732
  };