@parrot-co/parrot-ui 0.0.93 → 0.0.95

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,5 +1,5 @@
1
1
  import {jsx as $hgUW1$jsx, jsxs as $hgUW1$jsxs} from "react/jsx-runtime";
2
- import $hgUW1$react, {forwardRef as $hgUW1$forwardRef, useCallback as $hgUW1$useCallback, 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} from "react";
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, 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, HiddenSelect as $hgUW1$HiddenSelect, 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, useTabList as $hgUW1$useTabList, useTab as $hgUW1$useTab, useTabPanel as $hgUW1$useTabPanel, useHover as $hgUW1$useHover, useSwitch as $hgUW1$useSwitch, useModalOverlay as $hgUW1$useModalOverlay, useDialog as $hgUW1$useDialog} from "react-aria";
4
4
  import {HiMinus as $hgUW1$HiMinus, HiPlus as $hgUW1$HiPlus, HiEye as $hgUW1$HiEye, HiCheck as $hgUW1$HiCheck, HiSelector as $hgUW1$HiSelector, HiX as $hgUW1$HiX, 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} from "react-icons/hi";
5
5
  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, useTabListState as $hgUW1$useTabListState, useOverlayTriggerState as $hgUW1$useOverlayTriggerState} from "react-stately";
@@ -108,39 +108,107 @@ const $ee0105641360f1c1$export$e71c4d32a2263218 = /*#__PURE__*/ $hgUW1$forwardRe
108
108
 
109
109
 
110
110
 
111
- const $11bc53f9891a6532$export$ef2184bd89960b14 = /*#__PURE__*/ $hgUW1$forwardRef(({ columns: columns = 12, gap: gap, gapX: gapX, gapY: gapY, align: align, justify: justify, as: as, className: className, ...props }, ref)=>{
112
- return /*#__PURE__*/ (0, $hgUW1$jsx)((0, $ee0105641360f1c1$export$e71c4d32a2263218), {
111
+ const $074ec3363f6c932f$export$36308cce1deef340 = [
112
+ "tomato",
113
+ "red",
114
+ "crimson",
115
+ "pink",
116
+ "plum",
117
+ "purple",
118
+ "violet",
119
+ "indigo",
120
+ "blue",
121
+ "cyan",
122
+ "teal",
123
+ "green",
124
+ "grass",
125
+ "orange",
126
+ "brown",
127
+ "sky",
128
+ "mint",
129
+ "lime",
130
+ "yellow",
131
+ "amber",
132
+ "gold",
133
+ "bronze",
134
+ "gray",
135
+ "mauve",
136
+ "slate",
137
+ "sage",
138
+ "olive",
139
+ "sand"
140
+ ];
141
+ const $074ec3363f6c932f$export$b4e0e71242920c6a = {
142
+ sharp: "none",
143
+ pill: "full",
144
+ rounded: undefined
145
+ };
146
+ function $074ec3363f6c932f$var$ps(styles) {
147
+ // 1. iterate over the keys of the styles object
148
+ // 2. for each key, check is is valid css property
149
+ }
150
+
151
+
152
+ function $0ad0bc75b5eb16a6$export$d41d9ab3de2def3d(text) {
153
+ const str = String(text);
154
+ let hash = 0;
155
+ let char;
156
+ if (str.trim().length === 0) return hash;
157
+ for(let i = 0; i < str.length; i++){
158
+ char = str.charCodeAt(i);
159
+ hash = (hash << 5) - hash + char;
160
+ // Convert to 32bit integer
161
+ hash &= hash;
162
+ }
163
+ return Math.abs(hash);
164
+ }
165
+ function $0ad0bc75b5eb16a6$export$d560c7e4a29451c2() {
166
+ return Math.random().toString(36);
167
+ }
168
+ function $0ad0bc75b5eb16a6$export$e4369cabd7e84cd9(string) {
169
+ const hash = $0ad0bc75b5eb16a6$export$d41d9ab3de2def3d(string);
170
+ return (0, $074ec3363f6c932f$export$36308cce1deef340)[hash % (0, $074ec3363f6c932f$export$36308cce1deef340).length];
171
+ }
172
+ function $0ad0bc75b5eb16a6$export$2db1d02db18b2d82(prefix, value) {
173
+ if (!value) return "";
174
+ if (typeof value === "string" || typeof value === "number") return `${prefix}-${value}`;
175
+ let classNames = "";
176
+ for (const key of Object.keys(value)){
177
+ const breakpoint = key;
178
+ const breakpointValue = value[breakpoint];
179
+ if (breakpointValue) {
180
+ classNames && (classNames += " ");
181
+ classNames += breakpoint === "base" ? `${prefix}-${breakpointValue}` : `${breakpoint}:${prefix}-${breakpointValue}`;
182
+ }
183
+ }
184
+ return classNames;
185
+ }
186
+
187
+
188
+ const $11bc53f9891a6532$export$de87bc49c164ff72 = (props, ref)=>{
189
+ const { columns: columns = 12, gap: gap = "sm", gapX: gapX, gapY: gapY, align: align, justify: justify, as: as, className: className, ...otherProps } = props;
190
+ return(// TODO figure out why ts is screaming over here
191
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
192
+ //@ts-ignore
193
+ /*#__PURE__*/ (0, $hgUW1$jsx)((0, $ee0105641360f1c1$export$e71c4d32a2263218), {
113
194
  as: as,
114
195
  ref: ref,
115
- className: (0, $cce662c1d2ec881b$export$a274e22fb40f762e)({
116
- "p-grid": true,
117
- "display-grid": true,
118
- [`columns-${columns}`]: !!columns,
119
- [`gap-${gap}`]: !!gap,
120
- [`column-gap-${gapX}`]: !!gapX,
121
- [`row-gap-${gapY}`]: !!gapY,
122
- [`flex-align-${align}`]: !!align,
123
- [`flex-justify-${justify}`]: !!justify,
124
- [`${className}`]: !!className
125
- }),
126
- ...props
127
- });
128
- });
129
- $11bc53f9891a6532$export$ef2184bd89960b14.displayName = "Grid";
130
- const $11bc53f9891a6532$export$9eb849b9b922d396 = /*#__PURE__*/ $hgUW1$forwardRef(({ colSpan: colSpan = 1, as: as, className: className, ...props }, ref)=>{
196
+ className: (0, $cce662c1d2ec881b$export$a274e22fb40f762e)("p-grid", "display-grid", (0, $0ad0bc75b5eb16a6$export$2db1d02db18b2d82)("columns", columns), (0, $0ad0bc75b5eb16a6$export$2db1d02db18b2d82)("gap", gap), (0, $0ad0bc75b5eb16a6$export$2db1d02db18b2d82)("column-gap", gapX), (0, $0ad0bc75b5eb16a6$export$2db1d02db18b2d82)("row-gap", gapY), (0, $0ad0bc75b5eb16a6$export$2db1d02db18b2d82)("flex-align", align), (0, $0ad0bc75b5eb16a6$export$2db1d02db18b2d82)("flex-justify", justify), className),
197
+ ...otherProps
198
+ }));
199
+ };
200
+ $11bc53f9891a6532$export$de87bc49c164ff72.displayName = "Grid";
201
+ const $11bc53f9891a6532$export$ef2184bd89960b14 = /*#__PURE__*/ $hgUW1$forwardRef($11bc53f9891a6532$export$de87bc49c164ff72);
202
+ const $11bc53f9891a6532$export$faaf771f35016530 = (props, ref)=>{
131
203
  return /*#__PURE__*/ (0, $hgUW1$jsx)((0, $ee0105641360f1c1$export$e71c4d32a2263218), {
132
- as: as,
133
- stretchX: true,
134
- className: (0, $cce662c1d2ec881b$export$a274e22fb40f762e)({
135
- "p-grid-item": true,
136
- [`col-span-${colSpan}`]: !!colSpan,
137
- [`${className}`]: !!className
138
- }),
139
204
  ref: ref,
205
+ className: (0, $cce662c1d2ec881b$export$a274e22fb40f762e)("p-grid-item", (0, $0ad0bc75b5eb16a6$export$2db1d02db18b2d82)("col-span", props.colSpan), props.className),
140
206
  ...props
141
207
  });
142
- });
143
- $11bc53f9891a6532$export$9eb849b9b922d396.displayName = "GridItem";
208
+ };
209
+ const $11bc53f9891a6532$export$9eb849b9b922d396 = /*#__PURE__*/ $hgUW1$forwardRef($11bc53f9891a6532$export$faaf771f35016530);
210
+ $11bc53f9891a6532$export$faaf771f35016530.displayName = "GridItem";
211
+
144
212
 
145
213
 
146
214
 
@@ -151,25 +219,9 @@ $11bc53f9891a6532$export$9eb849b9b922d396.displayName = "GridItem";
151
219
 
152
220
  const $e2f278d76a00796a$export$21ee1313e2afe36c = (props, ref)=>{
153
221
  const { justify: justify, align: align, direction: direction, gap: gap = "sm", columnGap: columnGap, rowGap: rowGap, inline: inline, wrap: wrap, stack: stack, className: className, ...otherProps } = props;
154
- const getDirection = $hgUW1$useCallback(()=>{
155
- if (stack) return "column";
156
- return direction || "row";
157
- }, [
158
- stack,
159
- direction
160
- ]);
222
+ const flexDirection = stack ? "column" : direction ?? "row";
161
223
  return /*#__PURE__*/ (0, $hgUW1$jsx)((0, $ee0105641360f1c1$export$e71c4d32a2263218), {
162
- className: (0, $cce662c1d2ec881b$export$a274e22fb40f762e)({
163
- [`${className}`]: !!className,
164
- [inline ? "display-inline-flex" : "display-flex"]: true,
165
- [`flex-justify-${justify}`]: !!justify,
166
- [`flex-align-${align}`]: !!align,
167
- [`flex-direction-${getDirection()}`]: !!getDirection(),
168
- [`gap-${gap}`]: !!gap,
169
- [`column-gap-${columnGap}`]: !!columnGap,
170
- [`row-gap-${rowGap}`]: !!rowGap,
171
- [`flex-${wrap}`]: !!wrap
172
- }),
224
+ className: (0, $cce662c1d2ec881b$export$a274e22fb40f762e)(className, inline ? "display-inline-flex" : "display-flex", `flex-direction-${flexDirection}`, `flex-${wrap}`, `flex-justify-${justify}`, `flex-align-${align}`, (0, $0ad0bc75b5eb16a6$export$2db1d02db18b2d82)("gap", gap), (0, $0ad0bc75b5eb16a6$export$2db1d02db18b2d82)("column-gap", columnGap), (0, $0ad0bc75b5eb16a6$export$2db1d02db18b2d82)("row-gap", rowGap)),
173
225
  // TODO - Fix types here - seems to work just fine though
174
226
  ref: ref,
175
227
  ...otherProps,
@@ -318,13 +370,14 @@ function $41cc567ab0625f8f$export$450c36e0b0e62ccd() {
318
370
 
319
371
  const $5fc28f26e128d5c0$var$ThemeContext = /*#__PURE__*/ $hgUW1$createContext(null);
320
372
  function $5fc28f26e128d5c0$export$d8964aec282183a3(props) {
321
- const { children: children, className: className, ...themeProps } = props;
373
+ const { children: children, className: className, scaling: scaling = "100%", ...themeProps } = props;
322
374
  return /*#__PURE__*/ (0, $hgUW1$jsx)($5fc28f26e128d5c0$var$ThemeContext.Provider, {
323
375
  value: themeProps,
324
376
  children: /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
325
377
  id: "parrot-theme-provider",
326
378
  "data-radius": themeProps.radius,
327
379
  "data-color": themeProps.color,
380
+ "data-scaling": scaling,
328
381
  className: (0, $cce662c1d2ec881b$export$a274e22fb40f762e)([
329
382
  "parrot-theme",
330
383
  className
@@ -534,6 +587,7 @@ function $9230e224c5c26d9c$export$749e21be8b14b968() {
534
587
 
535
588
 
536
589
 
590
+
537
591
  const $d95a2216d3ccf702$export$353f5b6fc5456de1 = /*#__PURE__*/ (0, $hgUW1$react).forwardRef((props, ref)=>{
538
592
  const space = (0, $41cc567ab0625f8f$export$450c36e0b0e62ccd)();
539
593
  const buttonGroupProps = (0, $9230e224c5c26d9c$export$749e21be8b14b968)();
@@ -574,8 +628,7 @@ const $d95a2216d3ccf702$export$353f5b6fc5456de1 = /*#__PURE__*/ (0, $hgUW1$react
574
628
  "aria-busy": isLoading,
575
629
  "data-color": getColor().color,
576
630
  "data-variant": getColor().variant,
577
- "data-size": size,
578
- className: (0, $cce662c1d2ec881b$export$a274e22fb40f762e)(className, "p-button", space.classNames),
631
+ className: (0, $cce662c1d2ec881b$export$a274e22fb40f762e)((0, $0ad0bc75b5eb16a6$export$2db1d02db18b2d82)("size", size), className, "p-button", space.classNames),
579
632
  ref: (0, $cce662c1d2ec881b$export$c9058316764c140e)(ref, buttonRef),
580
633
  form: otherProps.form,
581
634
  ...buttonProps,
@@ -1158,7 +1211,7 @@ function $ad85ba12e832a3ea$var$MenuSectionInner({ state: state, section: section
1158
1211
  style: style,
1159
1212
  className: (0, $cce662c1d2ec881b$export$a274e22fb40f762e)(className, "p-list-section"),
1160
1213
  children: [
1161
- /*#__PURE__*/ (0, $hgUW1$jsx)("li", {
1214
+ section.key !== state.collection.getFirstKey() && /*#__PURE__*/ (0, $hgUW1$jsx)("li", {
1162
1215
  className: "p-list-separator",
1163
1216
  ...separatorProps
1164
1217
  }),
@@ -1673,68 +1726,6 @@ $e3711da06539818f$export$f8afaea2e9656b91.displayName = "RadioCard";
1673
1726
 
1674
1727
 
1675
1728
 
1676
- const $074ec3363f6c932f$export$36308cce1deef340 = [
1677
- "tomato",
1678
- "red",
1679
- "crimson",
1680
- "pink",
1681
- "plum",
1682
- "purple",
1683
- "violet",
1684
- "indigo",
1685
- "blue",
1686
- "cyan",
1687
- "teal",
1688
- "green",
1689
- "grass",
1690
- "orange",
1691
- "brown",
1692
- "sky",
1693
- "mint",
1694
- "lime",
1695
- "yellow",
1696
- "amber",
1697
- "gold",
1698
- "bronze",
1699
- "gray",
1700
- "mauve",
1701
- "slate",
1702
- "sage",
1703
- "olive",
1704
- "sand"
1705
- ];
1706
- const $074ec3363f6c932f$export$b4e0e71242920c6a = {
1707
- sharp: "none",
1708
- pill: "full",
1709
- rounded: undefined
1710
- };
1711
- function $074ec3363f6c932f$var$ps(styles) {
1712
- // 1. iterate over the keys of the styles object
1713
- // 2. for each key, check is is valid css property
1714
- }
1715
-
1716
-
1717
- function $0ad0bc75b5eb16a6$export$d41d9ab3de2def3d(text) {
1718
- const str = String(text);
1719
- let hash = 0;
1720
- let char;
1721
- if (str.trim().length === 0) return hash;
1722
- for(let i = 0; i < str.length; i++){
1723
- char = str.charCodeAt(i);
1724
- hash = (hash << 5) - hash + char;
1725
- // Convert to 32bit integer
1726
- hash &= hash;
1727
- }
1728
- return Math.abs(hash);
1729
- }
1730
- function $0ad0bc75b5eb16a6$export$d560c7e4a29451c2() {
1731
- return Math.random().toString(36);
1732
- }
1733
- function $0ad0bc75b5eb16a6$export$e4369cabd7e84cd9(string) {
1734
- const hash = $0ad0bc75b5eb16a6$export$d41d9ab3de2def3d(string);
1735
- return (0, $074ec3363f6c932f$export$36308cce1deef340)[hash % (0, $074ec3363f6c932f$export$36308cce1deef340).length];
1736
- }
1737
-
1738
1729
 
1739
1730
 
1740
1731
 
@@ -2880,6 +2871,7 @@ function $727b3a4d9b39464f$export$e6a97ba2cae5bb94({ items: items, render: rende
2880
2871
 
2881
2872
 
2882
2873
 
2874
+
2883
2875
  function $4bad2c10a2b6e638$export$c6fdb837b070b4ff({ children: children, state: state, ...props }) {
2884
2876
  const modalRef = $hgUW1$useRef(null);
2885
2877
  const { modalProps: modalProps, underlayProps: underlayProps } = (0, $hgUW1$useModalOverlay)(props, // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
@@ -2898,7 +2890,7 @@ function $4bad2c10a2b6e638$export$c6fdb837b070b4ff({ children: children, state:
2898
2890
  })
2899
2891
  });
2900
2892
  }
2901
- function $4bad2c10a2b6e638$var$Dialog({ width: width = 400, title: title, onCancel: onCancel, onConfirm: onConfirm, confirmLabel: confirmLabel = "Confirm", cancelLabel: cancelLabel = "Cancel", description: description, children: children, confirmButtonProps: confirmButtonProps, cancelButtonProps: cancelButtonProps, variant: variant = "modal", showCloseButton: showCloseButton = true, onClose: onClose, onOpenChange: onOpenChange, ...props }) {
2893
+ function $4bad2c10a2b6e638$var$Dialog({ width: width = 400, title: title, onCancel: onCancel, onConfirm: onConfirm, confirmLabel: confirmLabel = "Confirm", cancelLabel: cancelLabel = "Cancel", description: description, children: children, confirmButtonProps: confirmButtonProps, cancelButtonProps: cancelButtonProps, variant: variant = "modal", showCloseButton: showCloseButton = true, onClose: onClose, onOpenChange: onOpenChange, className: className, style: style, hideTitle: hideTitle, ...props }) {
2902
2894
  const dialogRef = $hgUW1$useRef(null);
2903
2895
  const { dialogProps: dialogProps, titleProps: titleProps } = (0, $hgUW1$useDialog)({
2904
2896
  role: "dialog",
@@ -2910,15 +2902,16 @@ function $4bad2c10a2b6e638$var$Dialog({ width: width = 400, title: title, onCanc
2910
2902
  }
2911
2903
  return /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
2912
2904
  "data-radius": "md",
2913
- className: "p-modal-content",
2905
+ className: (0, $cce662c1d2ec881b$export$a274e22fb40f762e)("p-modal-content", className),
2914
2906
  "data-variant": variant,
2915
2907
  style: {
2916
- minWidth: width
2908
+ minWidth: width,
2909
+ ...style
2917
2910
  },
2918
2911
  ref: dialogRef,
2919
2912
  ...dialogProps,
2920
2913
  children: [
2921
- /*#__PURE__*/ (0, $hgUW1$jsxs)((0, $e2f278d76a00796a$export$f51f4c4ede09e011), {
2914
+ !hideTitle && /*#__PURE__*/ (0, $hgUW1$jsxs)((0, $e2f278d76a00796a$export$f51f4c4ede09e011), {
2922
2915
  align: "center",
2923
2916
  as: "header",
2924
2917
  justify: "space-between",