@parrot-co/parrot-ui 0.0.46 → 0.0.48

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
@@ -43,6 +43,7 @@ $parcel$export(module.exports, "Switch", () => $063a8b2ca5e15636$export$b5d5cf89
43
43
  $parcel$export(module.exports, "ColorTray", () => $41fe5e52028acbc1$export$dbada5ace43900dd);
44
44
  $parcel$export(module.exports, "IconTray", () => $d9681b77772be59b$export$50e381fea3a45244);
45
45
  $parcel$export(module.exports, "Sticker", () => $a15741e0d788b3da$export$ea98c603db73aee7);
46
+ $parcel$export(module.exports, "DropdownMenu", () => $39b5e387b93e95b5$export$e44a253a59704894);
46
47
  /* eslint-disable @typescript-eslint/no-explicit-any */
47
48
 
48
49
  const $80923bc9c1ba824c$export$8f45430ccf837300 = {
@@ -4463,4 +4464,163 @@ $a15741e0d788b3da$export$ea98c603db73aee7.displayName = "Sticker";
4463
4464
 
4464
4465
 
4465
4466
 
4467
+
4468
+
4469
+
4470
+
4471
+
4472
+
4473
+ const $6e67a85cec29589c$export$59308621e1a05692 = (0, $80923bc9c1ba824c$export$3817b7a54a07cec7)((0, $7003944ca9ba7b6a$export$2e2bcd8739ae039), {
4474
+ listStyle: "none",
4475
+ padding: 0,
4476
+ margin: 0,
4477
+ outline: "none"
4478
+ });
4479
+ const $6e67a85cec29589c$export$6648d5fa18559e7f = (0, $80923bc9c1ba824c$export$3817b7a54a07cec7)("li", {
4480
+ py: 8,
4481
+ px: 8,
4482
+ borderRadius: 7,
4483
+ outline: "none",
4484
+ '&[data-selected="true"]': {
4485
+ backgroundColor: "$violet3",
4486
+ color: "$primary"
4487
+ },
4488
+ "&[data-focused='true']": {
4489
+ background: "$gray3"
4490
+ }
4491
+ });
4492
+
4493
+
4494
+ function $39b5e387b93e95b5$var$_Dropdown({ triggerComponent: triggerComponent , menuFooter: menuFooter , menuHeader: menuHeader , ...props }) {
4495
+ const state = (0, $E4F9t$reactstately.useMenuTriggerState)(props);
4496
+ const triggerRef = $E4F9t$react.useRef(null);
4497
+ const { menuTriggerProps: menuTriggerProps , menuProps: menuProps } = (0, $E4F9t$reactaria.useMenuTrigger)(props, state, triggerRef);
4498
+ return /*#__PURE__*/ (0, $E4F9t$reactjsxruntime.jsxs)((0, $E4F9t$reactjsxruntime.Fragment), {
4499
+ children: [
4500
+ triggerComponent && /*#__PURE__*/ $E4F9t$react.cloneElement(triggerComponent, {
4501
+ ...triggerComponent.props,
4502
+ ...menuTriggerProps,
4503
+ ref: triggerRef
4504
+ }),
4505
+ !triggerComponent && /*#__PURE__*/ (0, $E4F9t$reactjsxruntime.jsx)((0, $8d4373b1a05e63fb$export$353f5b6fc5456de1), {
4506
+ appearance: triggerComponent ? "unstyled" : undefined,
4507
+ ...menuTriggerProps,
4508
+ ref: triggerRef,
4509
+ children: props.label
4510
+ }),
4511
+ state.isOpen && /*#__PURE__*/ (0, $E4F9t$reactjsxruntime.jsx)((0, $3347a410c0691704$export$5b6b19405a83ff9d), {
4512
+ state: state,
4513
+ triggerRef: triggerRef,
4514
+ placement: "bottom start",
4515
+ children: /*#__PURE__*/ (0, $E4F9t$reactjsxruntime.jsx)($39b5e387b93e95b5$var$Menu, {
4516
+ menuFooter: menuFooter,
4517
+ menuHeader: menuHeader,
4518
+ ...menuProps,
4519
+ ...props
4520
+ })
4521
+ })
4522
+ ]
4523
+ });
4524
+ }
4525
+ function $39b5e387b93e95b5$var$Menu({ menuFooter: menuFooter , menuHeader: menuHeader , ...props }) {
4526
+ const state = (0, $E4F9t$reactstately.useTreeState)(props);
4527
+ const menuRef = $E4F9t$react.useRef(null);
4528
+ const { menuProps: menuProps } = (0, $E4F9t$reactaria.useMenu)(props, state, menuRef);
4529
+ return /*#__PURE__*/ (0, $E4F9t$reactjsxruntime.jsxs)((0, $E4F9t$reactjsxruntime.Fragment), {
4530
+ children: [
4531
+ menuHeader,
4532
+ /*#__PURE__*/ (0, $E4F9t$reactjsxruntime.jsx)((0, $6e67a85cec29589c$export$59308621e1a05692), {
4533
+ as: "ul",
4534
+ ...menuProps,
4535
+ ref: menuRef,
4536
+ children: [
4537
+ ...state.collection
4538
+ ].map((item)=>{
4539
+ return item.type === "section" ? /*#__PURE__*/ (0, $E4F9t$reactjsxruntime.jsx)($39b5e387b93e95b5$var$MenuSection, {
4540
+ section: item,
4541
+ state: state
4542
+ }, item.key) : /*#__PURE__*/ (0, $E4F9t$reactjsxruntime.jsx)($39b5e387b93e95b5$var$MenuItem, {
4543
+ state: state,
4544
+ item: item
4545
+ }, item.key);
4546
+ })
4547
+ }),
4548
+ menuFooter
4549
+ ]
4550
+ });
4551
+ }
4552
+ function $39b5e387b93e95b5$var$MenuSection({ section: section , state: state }) {
4553
+ const { itemProps: itemProps , headingProps: headingProps , groupProps: groupProps } = (0, $E4F9t$reactaria.useMenuSection)({
4554
+ heading: section.rendered,
4555
+ "aria-label": section["aria-label"]
4556
+ });
4557
+ const { separatorProps: separatorProps } = (0, $E4F9t$reactaria.useSeparator)({
4558
+ elementType: "li"
4559
+ });
4560
+ return /*#__PURE__*/ (0, $E4F9t$reactjsxruntime.jsxs)((0, $E4F9t$reactjsxruntime.Fragment), {
4561
+ children: [
4562
+ section.key !== state.collection.getFirstKey() && /*#__PURE__*/ (0, $E4F9t$reactjsxruntime.jsx)("li", {
4563
+ ...separatorProps
4564
+ }),
4565
+ /*#__PURE__*/ (0, $E4F9t$reactjsxruntime.jsxs)($39b5e387b93e95b5$var$MenuItem, {
4566
+ ...itemProps,
4567
+ children: [
4568
+ section.rendered && /*#__PURE__*/ (0, $E4F9t$reactjsxruntime.jsx)("span", {
4569
+ ...headingProps,
4570
+ children: section.rendered
4571
+ }),
4572
+ /*#__PURE__*/ (0, $E4F9t$reactjsxruntime.jsx)("ul", {
4573
+ ...groupProps,
4574
+ children: [
4575
+ ...section.childNodes
4576
+ ].map((item)=>{
4577
+ return /*#__PURE__*/ (0, $E4F9t$reactjsxruntime.jsx)($39b5e387b93e95b5$var$MenuItem, {
4578
+ item: item,
4579
+ state: state
4580
+ }, item.key);
4581
+ })
4582
+ })
4583
+ ]
4584
+ })
4585
+ ]
4586
+ });
4587
+ }
4588
+ function $39b5e387b93e95b5$var$MenuItem({ item: item , state: state }) {
4589
+ const itemRef = $E4F9t$react.useRef(null);
4590
+ const { menuItemProps: menuItemProps , isFocused: isFocused , isSelected: isSelected , isDisabled: isDisabled } = (0, $E4F9t$reactaria.useMenuItem)({
4591
+ key: item.key
4592
+ }, state, itemRef);
4593
+ return /*#__PURE__*/ (0, $E4F9t$reactjsxruntime.jsx)((0, $6e67a85cec29589c$export$6648d5fa18559e7f), {
4594
+ "data-focused": isFocused,
4595
+ "data-selected": isSelected,
4596
+ "data-disabled": isDisabled,
4597
+ ref: itemRef,
4598
+ ...menuItemProps,
4599
+ children: item.rendered
4600
+ });
4601
+ }
4602
+ function $39b5e387b93e95b5$export$e44a253a59704894(props) {
4603
+ if (!props.items) return /*#__PURE__*/ (0, $E4F9t$reactjsxruntime.jsx)($39b5e387b93e95b5$var$_Dropdown, {
4604
+ ...props
4605
+ });
4606
+ function findAction(key) {
4607
+ const items = props.items;
4608
+ const action = items.find((item)=>item.key === key)?.action;
4609
+ action?.();
4610
+ }
4611
+ return /*#__PURE__*/ (0, $E4F9t$reactjsxruntime.jsx)($39b5e387b93e95b5$var$_Dropdown, {
4612
+ ...props,
4613
+ onAction: findAction,
4614
+ children: (item)=>/*#__PURE__*/ (0, $E4F9t$reactjsxruntime.jsx)((0, $E4F9t$reactstately.Item), {
4615
+ textValue: item.key,
4616
+ children: props.renderOption ? props.renderOption(item) : item.label
4617
+ }, item.key)
4618
+ });
4619
+ }
4620
+
4621
+
4622
+
4623
+
4624
+
4625
+
4466
4626
  //# sourceMappingURL=main.js.map