@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/module.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import {jsx as $hgUW1$jsx, jsxs as $hgUW1$jsxs, Fragment as $hgUW1$Fragment} from "react/jsx-runtime";
2
2
  import $hgUW1$react, {forwardRef as $hgUW1$forwardRef, createContext as $hgUW1$createContext, Children as $hgUW1$Children, useMemo as $hgUW1$useMemo, isValidElement as $hgUW1$isValidElement, useContext as $hgUW1$useContext, useRef as $hgUW1$useRef, cloneElement as $hgUW1$cloneElement, createElement as $hgUW1$createElement, useState as $hgUW1$useState, useEffect as $hgUW1$useEffect, useCallback as $hgUW1$useCallback} from "react";
3
3
  import {useTextField as $hgUW1$useTextField, useLocale as $hgUW1$useLocale, useNumberField as $hgUW1$useNumberField, useToggleButton as $hgUW1$useToggleButton, useButton as $hgUW1$useButton, useCheckbox as $hgUW1$useCheckbox, useCheckboxGroupItem as $hgUW1$useCheckboxGroupItem, useFocusRing as $hgUW1$useFocusRing, VisuallyHidden as $hgUW1$VisuallyHidden, useCheckboxGroup as $hgUW1$useCheckboxGroup, useMenuTrigger as $hgUW1$useMenuTrigger, usePress as $hgUW1$usePress, mergeProps as $hgUW1$mergeProps, useMenu as $hgUW1$useMenu, useMenuItem as $hgUW1$useMenuItem, useMenuSection as $hgUW1$useMenuSection, useSeparator as $hgUW1$useSeparator, usePopover as $hgUW1$usePopover, Overlay as $hgUW1$Overlay, useFilter as $hgUW1$useFilter, useComboBox as $hgUW1$useComboBox, useListBox as $hgUW1$useListBox, useOption as $hgUW1$useOption, useListBoxSection as $hgUW1$useListBoxSection, useRadio as $hgUW1$useRadio, useRadioGroup as $hgUW1$useRadioGroup, useDatePicker as $hgUW1$useDatePicker, useDateField as $hgUW1$useDateField, useDateSegment as $hgUW1$useDateSegment, useCalendar as $hgUW1$useCalendar, useCalendarGrid as $hgUW1$useCalendarGrid, useCalendarCell as $hgUW1$useCalendarCell, useDrop as $hgUW1$useDrop, useProgressBar as $hgUW1$useProgressBar, useHover as $hgUW1$useHover, useSwitch as $hgUW1$useSwitch, useNumberFormatter as $hgUW1$useNumberFormatter, useSlider as $hgUW1$useSlider, useSliderThumb as $hgUW1$useSliderThumb, useTabList as $hgUW1$useTabList, useTab as $hgUW1$useTab, useTabPanel as $hgUW1$useTabPanel, useModalOverlay as $hgUW1$useModalOverlay, useDialog as $hgUW1$useDialog, useOverlayTrigger as $hgUW1$useOverlayTrigger, useTag as $hgUW1$useTag, useTagGroup as $hgUW1$useTagGroup} from "react-aria";
4
- import {useNumberFieldState as $hgUW1$useNumberFieldState, useToggleState as $hgUW1$useToggleState, useCheckboxGroupState as $hgUW1$useCheckboxGroupState, useMenuTriggerState as $hgUW1$useMenuTriggerState, useTreeState as $hgUW1$useTreeState, Item as $hgUW1$Item, Section as $hgUW1$Section, useComboBoxState as $hgUW1$useComboBoxState, useListState as $hgUW1$useListState, useRadioGroupState as $hgUW1$useRadioGroupState, useDatePickerState as $hgUW1$useDatePickerState, useDateFieldState as $hgUW1$useDateFieldState, useCalendarState as $hgUW1$useCalendarState, useSliderState as $hgUW1$useSliderState, useTabListState as $hgUW1$useTabListState, useOverlayTriggerState as $hgUW1$useOverlayTriggerState} from "react-stately";
4
+ import {useNumberFieldState as $hgUW1$useNumberFieldState, useToggleState as $hgUW1$useToggleState, useCheckboxGroupState as $hgUW1$useCheckboxGroupState, useMenuTriggerState as $hgUW1$useMenuTriggerState, useTreeState as $hgUW1$useTreeState, Item as $hgUW1$Item, Section as $hgUW1$Section, useAsyncList as $hgUW1$useAsyncList, useComboBoxState as $hgUW1$useComboBoxState, useListState as $hgUW1$useListState, useRadioGroupState as $hgUW1$useRadioGroupState, useDatePickerState as $hgUW1$useDatePickerState, useDateFieldState as $hgUW1$useDateFieldState, useCalendarState as $hgUW1$useCalendarState, useSliderState as $hgUW1$useSliderState, useTabListState as $hgUW1$useTabListState, useOverlayTriggerState as $hgUW1$useOverlayTriggerState} from "react-stately";
5
5
  import {HiEye as $hgUW1$HiEye, HiCheck as $hgUW1$HiCheck, HiSelector as $hgUW1$HiSelector, HiOutlineCalendar as $hgUW1$HiOutlineCalendar, HiChevronLeft as $hgUW1$HiChevronLeft, HiChevronRight as $hgUW1$HiChevronRight, HiOutlineDocumentAdd as $hgUW1$HiOutlineDocumentAdd, HiOutlineCheckCircle as $hgUW1$HiOutlineCheckCircle, HiOutlineTrash as $hgUW1$HiOutlineTrash, HiOutlineExclamationCircle as $hgUW1$HiOutlineExclamationCircle, HiOutlineRefresh as $hgUW1$HiOutlineRefresh, HiOutlinePaperClip as $hgUW1$HiOutlinePaperClip, HiX as $hgUW1$HiX} from "react-icons/hi";
6
6
  import {parseDate as $hgUW1$parseDate, GregorianCalendar as $hgUW1$GregorianCalendar, createCalendar as $hgUW1$createCalendar, endOfMonth as $hgUW1$endOfMonth, getWeeksInMonth as $hgUW1$getWeeksInMonth, isSameMonth as $hgUW1$isSameMonth} from "@internationalized/date";
7
7
  import {parseColor as $hgUW1$parseColor, useColorAreaState as $hgUW1$useColorAreaState, useColorFieldState as $hgUW1$useColorFieldState, useColorSliderState as $hgUW1$useColorSliderState} from "@react-stately/color";
@@ -353,6 +353,11 @@ const $074ec3363f6c932f$export$b4e0e71242920c6a = {
353
353
  };
354
354
 
355
355
 
356
+ function $0ad0bc75b5eb16a6$export$de9bdbce6502b027(name, length = 1) {
357
+ if (!name || length < 1) return "";
358
+ if (length == 1) return name.charAt(0);
359
+ return name.trim().split(/\s+/).slice(0, length).map((c)=>c.charAt(0)).join("");
360
+ }
356
361
  function $0ad0bc75b5eb16a6$export$1c4d39b152e0f791(deprecatedProp, newProp, value) {
357
362
  if (!(0, $0f90ef71a188bc45$export$ae45edb09e2fe7c2)(value)) console.warn(`${deprecatedProp} is deprecated and will be removed in a future release. ${newProp ? `Please use ${newProp} instead.` : ""}`);
358
363
  }
@@ -587,6 +592,7 @@ function $5fc28f26e128d5c0$export$d8964aec282183a3(props) {
587
592
  value: themeProps,
588
593
  children: /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
589
594
  id: "parrot-theme-provider",
595
+ "data-gray-variant": themeProps.grayVariant,
590
596
  "data-radius": themeProps.radius,
591
597
  "data-color": themeProps.color,
592
598
  "data-scaling": scaling,
@@ -1577,12 +1583,15 @@ function $b71fd84ba612e4b0$export$3d7d0414f6db67e7({ children: children, renderO
1577
1583
  if (item?.[sectionKey]) return /*#__PURE__*/ (0, $hgUW1$jsx)((0, $c35269c9504bc94d$export$ef146090a6472d9e), {
1578
1584
  items: sectionChildren,
1579
1585
  title: renderSectionLabel?.(item),
1580
- children: (item)=>/*#__PURE__*/ (0, $hgUW1$jsx)((0, $c35269c9504bc94d$export$5b7f4051a57920d0), {
1586
+ children: (item)=>{
1587
+ return /*#__PURE__*/ (0, $hgUW1$jsx)((0, $c35269c9504bc94d$export$5b7f4051a57920d0), {
1581
1588
  textValue: item?.[labelKey ?? "label"],
1582
1589
  children: renderOption?.(item) ?? item?.[labelKey ?? "label"]
1583
- }, item?.[valueKey ?? "id" ?? "key" ?? "value"])
1590
+ }, item?.[valueKey ?? "id" ?? "key" ?? "value"]);
1591
+ }
1584
1592
  }, value);
1585
1593
  return /*#__PURE__*/ (0, $hgUW1$jsx)((0, $c35269c9504bc94d$export$5b7f4051a57920d0), {
1594
+ "aria-label": label,
1586
1595
  textValue: label,
1587
1596
  children: renderOption?.(item) ?? label
1588
1597
  }, value);
@@ -1777,7 +1786,25 @@ function $6ae005878b435ce8$var$ListSection({ state: state, section: section }) {
1777
1786
 
1778
1787
 
1779
1788
 
1780
- function $618e53c42107439d$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 }) {
1789
+
1790
+ function $618e53c42107439d$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, $hgUW1$jsx)((0, $e1148cdb3a130657$export$3b0d6d7590275603), {
1791
+ size: "xs"
1792
+ }), ...props }) {
1793
+ let list = null;
1794
+ if (loadData) list = (0, $hgUW1$useAsyncList)({
1795
+ async load ({ filterText: filterText }) {
1796
+ const res = await loadData(filterText);
1797
+ return {
1798
+ items: res
1799
+ };
1800
+ }
1801
+ });
1802
+ if (list) {
1803
+ props.items = list.items;
1804
+ props.inputValue = list.filterText;
1805
+ props.onInputChange = list.setFilterText;
1806
+ isLoading = list.isLoading;
1807
+ }
1781
1808
  const { contains: contains } = (0, $hgUW1$useFilter)({
1782
1809
  sensitivity: "base"
1783
1810
  });
@@ -1825,7 +1852,7 @@ function $618e53c42107439d$export$72b9695b8216309a({ description: description, d
1825
1852
  color: "gray",
1826
1853
  size: selectorSize,
1827
1854
  ...buttonProps,
1828
- children: selectorIcon
1855
+ children: isLoading ? loadingIndicator : selectorIcon
1829
1856
  })
1830
1857
  ]
1831
1858
  }),
@@ -2591,9 +2618,13 @@ $48aceaf3289ec325$export$7edc06cf1783b30f.displayName = "DateInput";
2591
2618
 
2592
2619
 
2593
2620
 
2594
- const $55bcc0e5986993c4$export$e2255cf6045e8d47 = /*#__PURE__*/ $hgUW1$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)=>{
2621
+ const $55bcc0e5986993c4$export$e2255cf6045e8d47 = /*#__PURE__*/ $hgUW1$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)=>{
2595
2622
  const [imageError, setImageError] = $hgUW1$useState(false);
2596
2623
  const theme = (0, $5fc28f26e128d5c0$export$93d4e7f90805808f)();
2624
+ const initials = $hgUW1$useMemo(()=>{
2625
+ if (!name) return "";
2626
+ return (0, $0ad0bc75b5eb16a6$export$de9bdbce6502b027)(name, initialsLength);
2627
+ }, []);
2597
2628
  function getAvatarRadius() {
2598
2629
  (0, $0ad0bc75b5eb16a6$export$1c4d39b152e0f791)("shape", "radius", shape);
2599
2630
  // TODO: remove this when we remove the deprecated shape prop
@@ -2625,7 +2656,7 @@ const $55bcc0e5986993c4$export$e2255cf6045e8d47 = /*#__PURE__*/ $hgUW1$forwardRe
2625
2656
  "avatar-fallback",
2626
2657
  classNames?.fallback
2627
2658
  ]),
2628
- children: name.charAt(0)
2659
+ children: initials
2629
2660
  });
2630
2661
  return children;
2631
2662
  };