@parrot-co/parrot-ui 0.0.82 → 0.0.83

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
@@ -47,6 +47,7 @@ $parcel$export(module.exports, "Tabs", function () { return $7cf6c6e3ac4b7c72$ex
47
47
  $parcel$export(module.exports, "Table", function () { return $aa44ec0d52177dbe$export$54ec01a60f47d33d; });
48
48
  $parcel$export(module.exports, "Timeline", function () { return $3dc285189c5cc5d1$export$e6a97ba2cae5bb94; });
49
49
  $parcel$export(module.exports, "Modal", function () { return $61ad51d3c2a11900$export$2b77a92f1a5ad772; });
50
+ $parcel$export(module.exports, "useModal", function () { return $61ad51d3c2a11900$export$33ffd74ebf07f060; });
50
51
  $parcel$export(module.exports, "Space", function () { return $951f2dc4112308d0$export$eef1e68107c58ef2; });
51
52
  $parcel$export(module.exports, "TagInput", function () { return $3f3afa75ddfe07d0$export$39299b56cfd4e361; });
52
53
  $parcel$export(module.exports, "ThemeProvider", function () { return $df07e85003035def$export$d8964aec282183a3; });
@@ -1082,24 +1083,27 @@ function $d14b866db34f150f$export$3d7d0414f6db67e7({ children: children , render
1082
1083
  if (hasChildren) return children;
1083
1084
  if (items) // eslint-disable-next-line react/display-name
1084
1085
  return (item)=>{
1085
- const label = item?.[labelKey ?? "label"] ?? renderOption?.(item);
1086
+ const label = item?.[labelKey ?? "label"];
1086
1087
  const value = item?.[valueKey ?? "id"];
1087
1088
  const sectionChildren = item?.[sectionKey ?? "children"] ?? [];
1088
1089
  if (item?.[sectionKey]) return /*#__PURE__*/ (0, $4Lhmj$reactjsxruntime.jsx)((0, $895088a96d07d13e$export$6e2c8f0811a474ce), {
1089
1090
  items: sectionChildren,
1090
1091
  title: getSectionLabel?.(item),
1091
1092
  children: (item)=>/*#__PURE__*/ (0, $4Lhmj$reactjsxruntime.jsx)((0, $895088a96d07d13e$export$36d18380658d5d20), {
1093
+ textValue: item?.[labelKey ?? "label"],
1092
1094
  children: item?.[labelKey ?? "label"] ?? renderOption?.(item)
1093
1095
  }, item?.[valueKey ?? "id"])
1094
1096
  }, value);
1095
1097
  return /*#__PURE__*/ (0, $4Lhmj$reactjsxruntime.jsx)((0, $895088a96d07d13e$export$36d18380658d5d20), {
1096
- children: label ?? renderOption?.(item)
1098
+ textValue: label,
1099
+ children: renderOption?.(item) ?? label
1097
1100
  }, item?.[valueKey ?? "id"]);
1098
1101
  };
1099
1102
  }
1100
1103
 
1101
1104
 
1102
- function $895088a96d07d13e$export$41f133550aa26f48({ state: state , color: color , ...props }) {
1105
+
1106
+ function $895088a96d07d13e$export$41f133550aa26f48({ state: state , color: color , width: width = 300 , ...props }) {
1103
1107
  const internalState = (0, $4Lhmj$reactstately.useListState)({
1104
1108
  ...props,
1105
1109
  children: (0, $d14b866db34f150f$export$3d7d0414f6db67e7)(props)
@@ -1113,7 +1117,8 @@ function $895088a96d07d13e$export$41f133550aa26f48({ state: state , color: color
1113
1117
  return /*#__PURE__*/ (0, $4Lhmj$reactjsxruntime.jsxs)((0, $0fbc6d8e58c7ff1b$export$f51f4c4ede09e011), {
1114
1118
  "data-color": color,
1115
1119
  style: {
1116
- width: 400
1120
+ width: width,
1121
+ minWidth: 300
1117
1122
  },
1118
1123
  stack: true,
1119
1124
  gap: "md",
@@ -1173,7 +1178,9 @@ function $895088a96d07d13e$var$ListOption({ state: state , item: item }) {
1173
1178
  "data-pressed": isPressed,
1174
1179
  "data-selected": isSelected,
1175
1180
  ...optionProps,
1176
- ...item.props,
1181
+ ...(0, $d179231b21283096$export$30a06c8d3562193f)(item.props, [
1182
+ "textValue"
1183
+ ]),
1177
1184
  ref: optionRef,
1178
1185
  children: item.rendered
1179
1186
  });
@@ -1267,6 +1274,10 @@ const $06de8c3bf84a7234$export$b4e0e71242920c6a = {
1267
1274
  pill: "full",
1268
1275
  rounded: undefined
1269
1276
  };
1277
+ function $06de8c3bf84a7234$var$ps(styles) {
1278
+ // 1. iterate over the keys of the styles object
1279
+ // 2. for each key, check is is valid css property
1280
+ }
1270
1281
 
1271
1282
 
1272
1283
  function $a3b8f4d4af23e61c$export$d41d9ab3de2def3d(text) {
@@ -1325,11 +1336,10 @@ $df7f5cf79280971b$export$3288d34c523a1192.displayName = "Tag";
1325
1336
  function $8c3b8477473df88b$export$5b6b19405a83ff9d({ state: state , children: children , ...props }) {
1326
1337
  const popoverRef = $4Lhmj$react.useRef(null);
1327
1338
  const theme = (0, $df07e85003035def$export$93d4e7f90805808f)();
1328
- const { popoverProps: popoverProps , underlayProps: underlayProps , placement: placement } = (0, $4Lhmj$reactaria.usePopover)({
1339
+ const { popoverProps: popoverProps , underlayProps: underlayProps } = (0, $4Lhmj$reactaria.usePopover)({
1329
1340
  ...props,
1330
1341
  popoverRef: popoverRef
1331
1342
  }, state);
1332
- console.log(popoverProps, placement);
1333
1343
  return /*#__PURE__*/ (0, $4Lhmj$reactjsxruntime.jsxs)((0, $4Lhmj$reactaria.Overlay), {
1334
1344
  children: [
1335
1345
  /*#__PURE__*/ (0, $4Lhmj$reactjsxruntime.jsx)("div", {
@@ -1350,7 +1360,10 @@ function $8c3b8477473df88b$export$5b6b19405a83ff9d({ state: state , children: ch
1350
1360
 
1351
1361
 
1352
1362
 
1353
- function $d9e1022f7af5df7f$export$ef9b1a59e592288f({ label: label , selectionMode: selectionMode = "single" , appearance: appearance = "outline" , append: append , prepend: prepend , renderValue: renderValue , color: color = "gray" , error: error , description: description , size: size = "sm" , shape: shape = "rounded" , ...props }) {
1363
+
1364
+ function $d9e1022f7af5df7f$export$ef9b1a59e592288f({ label: label , selectionMode: selectionMode = "single" , appearance: appearance = "outline" , append: append , prepend: prepend , renderValue: renderValue , color: color = "gray" , error: error , description: description , size: size = "sm" , shape: shape = "rounded" , listBoxColor: listBoxColor , className: className , ...props }) {
1365
+ const space = (0, $951f2dc4112308d0$export$450c36e0b0e62ccd)();
1366
+ const [isFocused, setIsFocused] = $4Lhmj$react.useState(false);
1354
1367
  const triggerState = (0, $4Lhmj$reactstately.useMenuTriggerState)({});
1355
1368
  const listState = (0, $4Lhmj$reactstately.useListState)({
1356
1369
  ...props,
@@ -1397,31 +1410,56 @@ function $d9e1022f7af5df7f$export$ef9b1a59e592288f({ label: label , selectionMod
1397
1410
  variant: "default",
1398
1411
  color: color,
1399
1412
  className: "single-value",
1400
- children: selectedItems[0]?.rendered
1413
+ children: renderValue?.(selectedItems[0]?.value) ?? selectedItems[0]?.value[props.labelKey ?? "label"]
1401
1414
  });
1402
1415
  }
1403
1416
  return /*#__PURE__*/ (0, $4Lhmj$reactjsxruntime.jsxs)((0, $f9c6775c22423d58$export$e71c4d32a2263218), {
1417
+ as: "span",
1418
+ position: "relative",
1404
1419
  stretchX: true,
1405
1420
  children: [
1421
+ selectionMode === "single" && /*#__PURE__*/ (0, $4Lhmj$reactjsxruntime.jsx)((0, $4Lhmj$reactaria.HiddenSelect), {
1422
+ triggerRef: triggerRef,
1423
+ label: label,
1424
+ name: props.name,
1425
+ state: {
1426
+ selectedItem: selectedItems[0],
1427
+ selectedKey: selectedItems[0]?.key,
1428
+ setSelectedKey: (key)=>listState.selectionManager.setSelectedKeys([
1429
+ key
1430
+ ]),
1431
+ isFocused: isFocused,
1432
+ setFocused: setIsFocused,
1433
+ ...listState,
1434
+ ...triggerState
1435
+ },
1436
+ isDisabled: props.isDisabled
1437
+ }),
1406
1438
  /*#__PURE__*/ (0, $4Lhmj$reactjsxruntime.jsxs)((0, $0fbc6d8e58c7ff1b$export$f51f4c4ede09e011), {
1407
1439
  "data-radius": getRadius(),
1408
1440
  gap: "2xs",
1409
1441
  stack: true,
1410
- className: "p-input-group",
1442
+ className: (0, $5d3f3512fadee416$export$a274e22fb40f762e)({
1443
+ [`${space.compactItemWrapperAdjust}`]: true,
1444
+ "p-input-group": true,
1445
+ [`${className}`]: !!className
1446
+ }),
1411
1447
  "data-size": size,
1412
1448
  "data-color": color,
1413
1449
  children: [
1414
- /*#__PURE__*/ (0, $4Lhmj$reactjsxruntime.jsx)((0, $909969c92fb7eab4$export$2e2bcd8739ae039), {
1450
+ label && /*#__PURE__*/ (0, $4Lhmj$reactjsxruntime.jsx)((0, $909969c92fb7eab4$export$2e2bcd8739ae039), {
1415
1451
  children: label
1416
1452
  }),
1417
1453
  /*#__PURE__*/ (0, $4Lhmj$reactjsxruntime.jsxs)("div", {
1454
+ "data-selection-mode": selectionMode,
1418
1455
  tabIndex: 0,
1419
1456
  role: "button",
1420
1457
  ref: triggerRef,
1421
1458
  color: "gray",
1422
1459
  className: (0, $5d3f3512fadee416$export$a274e22fb40f762e)({
1423
1460
  "p-input": true,
1424
- "p-select": true
1461
+ "p-select": true,
1462
+ ...space.classNames
1425
1463
  }),
1426
1464
  "data-appearance": appearance,
1427
1465
  ...triggerProps,
@@ -1436,12 +1474,14 @@ function $d9e1022f7af5df7f$export$ef9b1a59e592288f({ label: label , selectionMod
1436
1474
  ]
1437
1475
  }),
1438
1476
  triggerState.isOpen && /*#__PURE__*/ (0, $4Lhmj$reactjsxruntime.jsx)((0, $8c3b8477473df88b$export$5b6b19405a83ff9d), {
1477
+ placement: "bottom start",
1439
1478
  offset: 4,
1440
1479
  shouldUpdatePosition: true,
1441
1480
  triggerRef: triggerRef,
1442
1481
  state: triggerState,
1443
1482
  children: /*#__PURE__*/ (0, $4Lhmj$reactjsxruntime.jsx)((0, $895088a96d07d13e$export$41f133550aa26f48), {
1444
- color: color,
1483
+ width: triggerRef.current?.getBoundingClientRect().width,
1484
+ color: listBoxColor ?? color,
1445
1485
  shouldFocusOnHover: true,
1446
1486
  state: listState,
1447
1487
  ...props