@parrot-co/parrot-ui 0.0.92 → 0.0.93
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 +86 -32
- package/dist/main.js.map +1 -1
- package/dist/module.js +87 -33
- package/dist/module.js.map +1 -1
- package/dist/types.d.ts +15 -8
- package/dist/types.d.ts.map +1 -1
- package/package.json +4 -4
- package/styles.css +1 -1
package/dist/module.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {jsx as $hgUW1$jsx, jsxs as $hgUW1$jsxs} from "react/jsx-runtime";
|
|
2
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";
|
|
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
|
-
import {HiMinus as $hgUW1$HiMinus, HiPlus as $hgUW1$HiPlus, HiEye as $hgUW1$HiEye,
|
|
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";
|
|
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
|
|
|
@@ -979,6 +979,8 @@ function $61ac9d13c14b7f5b$export$5b6b19405a83ff9d({ state: state, children: chi
|
|
|
979
979
|
|
|
980
980
|
|
|
981
981
|
|
|
982
|
+
|
|
983
|
+
|
|
982
984
|
const $ad85ba12e832a3ea$var$DropdownContext = /*#__PURE__*/ $hgUW1$createContext(null);
|
|
983
985
|
function $ad85ba12e832a3ea$export$e44a253a59704894({ children: children, ...props }) {
|
|
984
986
|
const triggerRef = $hgUW1$useRef(null);
|
|
@@ -1015,12 +1017,12 @@ function $ad85ba12e832a3ea$export$e7eb525bc415b4b4({ asChild: asChild, children:
|
|
|
1015
1017
|
children: children
|
|
1016
1018
|
});
|
|
1017
1019
|
}
|
|
1018
|
-
function $ad85ba12e832a3ea$export$d9b273488cd8ce6f(props) {
|
|
1020
|
+
function $ad85ba12e832a3ea$export$d9b273488cd8ce6f({ placement: placement = "bottom start", offset: offset = 8, ...props }) {
|
|
1019
1021
|
const ctx = $hgUW1$useContext($ad85ba12e832a3ea$var$DropdownContext);
|
|
1020
1022
|
if (!ctx?.triggerState.isOpen) return null;
|
|
1021
1023
|
return /*#__PURE__*/ (0, $hgUW1$jsx)((0, $61ac9d13c14b7f5b$export$5b6b19405a83ff9d), {
|
|
1022
|
-
placement:
|
|
1023
|
-
offset:
|
|
1024
|
+
placement: placement,
|
|
1025
|
+
offset: offset,
|
|
1024
1026
|
state: ctx?.triggerState,
|
|
1025
1027
|
triggerRef: ctx?.triggerRef,
|
|
1026
1028
|
children: /*#__PURE__*/ (0, $hgUW1$jsx)($ad85ba12e832a3ea$var$MenuInner, {
|
|
@@ -1028,7 +1030,7 @@ function $ad85ba12e832a3ea$export$d9b273488cd8ce6f(props) {
|
|
|
1028
1030
|
})
|
|
1029
1031
|
});
|
|
1030
1032
|
}
|
|
1031
|
-
function $ad85ba12e832a3ea$var$MenuInner({ menuHeader: menuHeader, menuFooter: menuFooter, ...props }) {
|
|
1033
|
+
function $ad85ba12e832a3ea$var$MenuInner({ menuHeader: menuHeader, menuFooter: menuFooter, className: className, color: color, maxHeight: maxHeight = 300, minWidth: minWidth = 200, maxWidth: maxWidth, ...props }) {
|
|
1032
1034
|
const state = (0, $hgUW1$useTreeState)(props);
|
|
1033
1035
|
const ref = $hgUW1$useRef(null);
|
|
1034
1036
|
const { menuProps: menuProps } = (0, $hgUW1$useMenu)({
|
|
@@ -1049,11 +1051,13 @@ function $ad85ba12e832a3ea$var$MenuInner({ menuHeader: menuHeader, menuFooter: m
|
|
|
1049
1051
|
stack: true,
|
|
1050
1052
|
ref: ref,
|
|
1051
1053
|
...menuProps,
|
|
1052
|
-
"data-color": theme?.color ?? "violet",
|
|
1054
|
+
"data-color": color ?? theme?.color ?? "violet",
|
|
1053
1055
|
"data-radius": theme?.radius ?? "lg",
|
|
1054
|
-
className: "p-list-box-wrapper",
|
|
1056
|
+
className: (0, $cce662c1d2ec881b$export$a274e22fb40f762e)("p-list-box-wrapper", className),
|
|
1055
1057
|
style: {
|
|
1056
|
-
minWidth: `max(200px, ${`${
|
|
1058
|
+
minWidth: `max(200px, ${`${minWidth}`.replace("px", "")}px)`,
|
|
1059
|
+
maxWidth: `${`${maxWidth}`.replace("px", "")}px`,
|
|
1060
|
+
maxHeight: `${`${maxHeight}`.replace("px", "")}px`
|
|
1057
1061
|
},
|
|
1058
1062
|
children: [
|
|
1059
1063
|
resolvedMenuHeader(),
|
|
@@ -1063,7 +1067,8 @@ function $ad85ba12e832a3ea$var$MenuInner({ menuHeader: menuHeader, menuFooter: m
|
|
|
1063
1067
|
].map((item)=>{
|
|
1064
1068
|
if (item.type === "section") return /*#__PURE__*/ (0, $hgUW1$jsx)($ad85ba12e832a3ea$var$MenuSectionInner, {
|
|
1065
1069
|
state: state,
|
|
1066
|
-
section: item
|
|
1070
|
+
section: item,
|
|
1071
|
+
...item.props
|
|
1067
1072
|
}, item.key);
|
|
1068
1073
|
return /*#__PURE__*/ (0, $hgUW1$createElement)($ad85ba12e832a3ea$var$MenuItemInner, {
|
|
1069
1074
|
...item.props,
|
|
@@ -1079,24 +1084,59 @@ function $ad85ba12e832a3ea$var$MenuInner({ menuHeader: menuHeader, menuFooter: m
|
|
|
1079
1084
|
}
|
|
1080
1085
|
function $ad85ba12e832a3ea$var$MenuItemInner({ state: state, item: item, ...otherProps }) {
|
|
1081
1086
|
const ref = $hgUW1$useRef(null);
|
|
1082
|
-
const { menuItemProps: menuItemProps, isSelected: isSelected, isFocused: isFocused, isPressed: isPressed, isDisabled: isDisabled } = (0, $hgUW1$useMenuItem)({
|
|
1087
|
+
const { menuItemProps: menuItemProps, isSelected: isSelected, isFocused: isFocused, isPressed: isPressed, isDisabled: isDisabled, descriptionProps: descriptionProps } = (0, $hgUW1$useMenuItem)({
|
|
1083
1088
|
key: item?.key
|
|
1084
1089
|
}, state, ref);
|
|
1085
|
-
const { className: className, style: style, isReadOnly: isReadOnly } = otherProps;
|
|
1086
|
-
return /*#__PURE__*/ (0, $hgUW1$
|
|
1090
|
+
const { className: className, style: style, isReadOnly: isReadOnly, icon: icon, color: color, description: description, label: label } = otherProps;
|
|
1091
|
+
return /*#__PURE__*/ (0, $hgUW1$jsxs)("li", {
|
|
1087
1092
|
ref: ref,
|
|
1088
|
-
className: (0, $cce662c1d2ec881b$export$a274e22fb40f762e)(className, "p-list-option"),
|
|
1093
|
+
className: (0, $cce662c1d2ec881b$export$a274e22fb40f762e)(className, "p-list-option p-menu-item"),
|
|
1089
1094
|
"data-selected": isSelected,
|
|
1090
1095
|
"data-focused": isFocused,
|
|
1091
1096
|
"data-pressed": isPressed,
|
|
1092
1097
|
"data-disabled": isDisabled,
|
|
1093
1098
|
"data-readonly": isReadOnly,
|
|
1094
1099
|
style: style,
|
|
1100
|
+
"data-color": color,
|
|
1095
1101
|
...menuItemProps,
|
|
1096
|
-
children:
|
|
1102
|
+
children: [
|
|
1103
|
+
/*#__PURE__*/ (0, $hgUW1$jsxs)((0, $e2f278d76a00796a$export$f51f4c4ede09e011), {
|
|
1104
|
+
align: "center",
|
|
1105
|
+
children: [
|
|
1106
|
+
icon && /*#__PURE__*/ (0, $hgUW1$jsx)((0, $e2f278d76a00796a$export$f51f4c4ede09e011), {
|
|
1107
|
+
className: "p-list-option-icon-wrapper",
|
|
1108
|
+
children: /*#__PURE__*/ $hgUW1$isValidElement(icon) && /*#__PURE__*/ $hgUW1$cloneElement(icon, {
|
|
1109
|
+
className: "p-list-option-icon",
|
|
1110
|
+
size: 18,
|
|
1111
|
+
...icon?.props
|
|
1112
|
+
})
|
|
1113
|
+
}),
|
|
1114
|
+
/*#__PURE__*/ (0, $hgUW1$jsxs)((0, $e2f278d76a00796a$export$f51f4c4ede09e011), {
|
|
1115
|
+
gap: "3xs",
|
|
1116
|
+
stack: true,
|
|
1117
|
+
children: [
|
|
1118
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)((0, $3157c40f7d0e6fa2$export$5f1af8db9871e1d6), {
|
|
1119
|
+
as: "div",
|
|
1120
|
+
color: "black",
|
|
1121
|
+
children: label ?? item.rendered
|
|
1122
|
+
}),
|
|
1123
|
+
description && /*#__PURE__*/ (0, $hgUW1$jsx)((0, $3157c40f7d0e6fa2$export$5f1af8db9871e1d6), {
|
|
1124
|
+
as: "div",
|
|
1125
|
+
lineHeight: "base",
|
|
1126
|
+
...descriptionProps,
|
|
1127
|
+
children: description
|
|
1128
|
+
})
|
|
1129
|
+
]
|
|
1130
|
+
})
|
|
1131
|
+
]
|
|
1132
|
+
}),
|
|
1133
|
+
isSelected && /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$HiCheck), {
|
|
1134
|
+
className: "selected-marker"
|
|
1135
|
+
})
|
|
1136
|
+
]
|
|
1097
1137
|
});
|
|
1098
1138
|
}
|
|
1099
|
-
function $ad85ba12e832a3ea$var$MenuSectionInner({ state: state, section: section }) {
|
|
1139
|
+
function $ad85ba12e832a3ea$var$MenuSectionInner({ state: state, section: section, className: className, style: style }) {
|
|
1100
1140
|
const { itemProps: itemProps, headingProps: headingProps, groupProps: groupProps } = (0, $hgUW1$useMenuSection)({
|
|
1101
1141
|
heading: section?.rendered,
|
|
1102
1142
|
"aria-label": section?.["aria-label"]
|
|
@@ -1108,30 +1148,41 @@ function $ad85ba12e832a3ea$var$MenuSectionInner({ state: state, section: section
|
|
|
1108
1148
|
if (state?.collection.getChildren) return [
|
|
1109
1149
|
...state.collection.getChildren(section.key)
|
|
1110
1150
|
];
|
|
1111
|
-
return [
|
|
1151
|
+
return [
|
|
1152
|
+
...section.childNodes
|
|
1153
|
+
];
|
|
1112
1154
|
}
|
|
1113
1155
|
return /*#__PURE__*/ (0, $hgUW1$jsxs)((0, $e2f278d76a00796a$export$f51f4c4ede09e011), {
|
|
1114
|
-
|
|
1156
|
+
stack: true,
|
|
1157
|
+
as: "ul",
|
|
1158
|
+
style: style,
|
|
1159
|
+
className: (0, $cce662c1d2ec881b$export$a274e22fb40f762e)(className, "p-list-section"),
|
|
1115
1160
|
children: [
|
|
1116
1161
|
/*#__PURE__*/ (0, $hgUW1$jsx)("li", {
|
|
1117
1162
|
className: "p-list-separator",
|
|
1118
1163
|
...separatorProps
|
|
1119
1164
|
}),
|
|
1120
|
-
/*#__PURE__*/ (0, $hgUW1$
|
|
1165
|
+
/*#__PURE__*/ (0, $hgUW1$jsxs)("li", {
|
|
1121
1166
|
...itemProps,
|
|
1122
|
-
children:
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1167
|
+
children: [
|
|
1168
|
+
section?.rendered && /*#__PURE__*/ (0, $hgUW1$jsx)((0, $3157c40f7d0e6fa2$export$5f1af8db9871e1d6), {
|
|
1169
|
+
as: "h4",
|
|
1170
|
+
className: "p-list-section-header",
|
|
1171
|
+
...headingProps,
|
|
1172
|
+
children: section?.rendered
|
|
1173
|
+
}),
|
|
1174
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)("ul", {
|
|
1175
|
+
...groupProps,
|
|
1176
|
+
children: getChildren().map((item)=>{
|
|
1177
|
+
return /*#__PURE__*/ (0, $hgUW1$createElement)($ad85ba12e832a3ea$var$MenuItemInner, {
|
|
1178
|
+
...item.props,
|
|
1179
|
+
state: state,
|
|
1180
|
+
item: item,
|
|
1181
|
+
key: item.key
|
|
1182
|
+
});
|
|
1183
|
+
})
|
|
1184
|
+
})
|
|
1185
|
+
]
|
|
1135
1186
|
})
|
|
1136
1187
|
]
|
|
1137
1188
|
});
|
|
@@ -1178,7 +1229,6 @@ function $b71fd84ba612e4b0$export$3d7d0414f6db67e7({ children: children, renderO
|
|
|
1178
1229
|
const label = item?.[labelKey ?? "label"];
|
|
1179
1230
|
const value = item?.[valueKey ?? "id"];
|
|
1180
1231
|
const sectionChildren = item?.[sectionKey ?? "children"] ?? [];
|
|
1181
|
-
console.log(label, "label");
|
|
1182
1232
|
if (item?.[sectionKey]) return /*#__PURE__*/ (0, $hgUW1$jsx)((0, $6ae005878b435ce8$export$6e2c8f0811a474ce), {
|
|
1183
1233
|
items: sectionChildren,
|
|
1184
1234
|
title: getSectionLabel?.(item),
|
|
@@ -1793,7 +1843,9 @@ function $9f79d30a629e2c71$export$ef9b1a59e592288f({ label: label, selectionMode
|
|
|
1793
1843
|
position: "relative",
|
|
1794
1844
|
stretchX: true,
|
|
1795
1845
|
children: [
|
|
1796
|
-
selectionMode === "single" &&
|
|
1846
|
+
selectionMode === "single" && // Implement a hidden select element to allow for native form submission
|
|
1847
|
+
// should work for both single and multiple selection modes
|
|
1848
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$HiddenSelect), {
|
|
1797
1849
|
triggerRef: triggerRef,
|
|
1798
1850
|
label: label,
|
|
1799
1851
|
name: props.name,
|
|
@@ -2867,6 +2919,7 @@ function $4bad2c10a2b6e638$var$Dialog({ width: width = 400, title: title, onCanc
|
|
|
2867
2919
|
...dialogProps,
|
|
2868
2920
|
children: [
|
|
2869
2921
|
/*#__PURE__*/ (0, $hgUW1$jsxs)((0, $e2f278d76a00796a$export$f51f4c4ede09e011), {
|
|
2922
|
+
align: "center",
|
|
2870
2923
|
as: "header",
|
|
2871
2924
|
justify: "space-between",
|
|
2872
2925
|
gap: "2xl",
|
|
@@ -2905,6 +2958,7 @@ function $4bad2c10a2b6e638$var$Dialog({ width: width = 400, title: title, onCanc
|
|
|
2905
2958
|
]
|
|
2906
2959
|
}),
|
|
2907
2960
|
/*#__PURE__*/ (0, $hgUW1$jsx)((0, $e2f278d76a00796a$export$f51f4c4ede09e011), {
|
|
2961
|
+
stack: true,
|
|
2908
2962
|
className: "p-modal-body",
|
|
2909
2963
|
children: children
|
|
2910
2964
|
}),
|