@inf-monkeys-tech/monkeys-design 0.4.33 → 0.4.34

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.
Files changed (57) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +226 -226
  3. package/dist/components/base/index.d.mts +2 -2
  4. package/dist/components/base/index.d.ts +2 -2
  5. package/dist/components/base/index.js +445 -2
  6. package/dist/components/base/index.js.map +1 -1
  7. package/dist/components/base/index.mjs +445 -3
  8. package/dist/components/base/index.mjs.map +1 -1
  9. package/dist/components/data-explorer/index.js.map +1 -1
  10. package/dist/components/data-explorer/index.mjs.map +1 -1
  11. package/dist/components/layout/index.js.map +1 -1
  12. package/dist/components/layout/index.mjs.map +1 -1
  13. package/dist/components/login/index.js.map +1 -1
  14. package/dist/components/login/index.mjs.map +1 -1
  15. package/dist/components/toolbar/index.js.map +1 -1
  16. package/dist/components/toolbar/index.mjs.map +1 -1
  17. package/dist/components/workbench/index.d.mts +1 -1
  18. package/dist/components/workbench/index.d.ts +1 -1
  19. package/dist/components/workbench/index.js +444 -2
  20. package/dist/components/workbench/index.js.map +1 -1
  21. package/dist/components/workbench/index.mjs +444 -2
  22. package/dist/components/workbench/index.mjs.map +1 -1
  23. package/dist/icons/oauth/index.js.map +1 -1
  24. package/dist/icons/oauth/index.mjs.map +1 -1
  25. package/dist/index.d.mts +2 -2
  26. package/dist/index.d.ts +2 -2
  27. package/dist/index.js +445 -2
  28. package/dist/index.js.map +1 -1
  29. package/dist/index.mjs +445 -3
  30. package/dist/index.mjs.map +1 -1
  31. package/dist/palette/index.js.map +1 -1
  32. package/dist/palette/index.mjs.map +1 -1
  33. package/dist/registry/index.js.map +1 -1
  34. package/dist/registry/index.mjs.map +1 -1
  35. package/dist/styles/artist-login.scss +374 -374
  36. package/dist/styles/global.scss +21 -21
  37. package/dist/styles/workflow-board.scss +440 -440
  38. package/dist/styles/workflow-nodes.css +340 -340
  39. package/dist/{theme-Cuy60thu.d.ts → theme-Clm5dVb0.d.mts} +4 -2
  40. package/dist/{theme-CoG9vCPT.d.mts → theme-sIoU5-YC.d.ts} +4 -2
  41. package/dist/theme-system/index.d.mts +1 -1
  42. package/dist/theme-system/index.d.ts +1 -1
  43. package/dist/theme-system/index.js +444 -2
  44. package/dist/theme-system/index.js.map +1 -1
  45. package/dist/theme-system/index.mjs +444 -2
  46. package/dist/theme-system/index.mjs.map +1 -1
  47. package/dist/themes/artist/index.js.map +1 -1
  48. package/dist/themes/artist/index.mjs.map +1 -1
  49. package/dist/themes/bsd/index.js.map +1 -1
  50. package/dist/themes/bsd/index.mjs.map +1 -1
  51. package/dist/themes/concept/index.js.map +1 -1
  52. package/dist/themes/concept/index.mjs.map +1 -1
  53. package/dist/themes/default/index.js.map +1 -1
  54. package/dist/themes/default/index.mjs.map +1 -1
  55. package/dist/{types-CZALgtez.d.mts → types-Bn6PEDsX.d.mts} +43 -1
  56. package/dist/{types-CZALgtez.d.ts → types-Bn6PEDsX.d.ts} +43 -1
  57. package/package.json +139 -139
@@ -3546,6 +3546,448 @@ function BaseLoadingState({
3546
3546
  }
3547
3547
  );
3548
3548
  }
3549
+ function normalizeValues(values) {
3550
+ const nextValues = [];
3551
+ const seen = /* @__PURE__ */ new Set();
3552
+ values?.forEach((value) => {
3553
+ if (seen.has(value)) return;
3554
+ seen.add(value);
3555
+ nextValues.push(value);
3556
+ });
3557
+ return nextValues;
3558
+ }
3559
+ function getNextEnabledIndex(options, currentIndex, direction) {
3560
+ if (!options.length) return -1;
3561
+ const startIndex = currentIndex >= 0 ? currentIndex : 0;
3562
+ for (let offset = 1; offset <= options.length; offset += 1) {
3563
+ const nextIndex = (startIndex + offset * direction + options.length) % options.length;
3564
+ if (!options[nextIndex]?.disabled) {
3565
+ return nextIndex;
3566
+ }
3567
+ }
3568
+ return -1;
3569
+ }
3570
+ function getFirstEnabledIndex(options) {
3571
+ return options.findIndex((option) => !option.disabled);
3572
+ }
3573
+ function getSafeTagCount(maxTagCount, total) {
3574
+ if (maxTagCount === void 0) return total;
3575
+ if (!Number.isFinite(maxTagCount)) return total;
3576
+ return Math.max(0, Math.min(total, Math.floor(maxTagCount)));
3577
+ }
3578
+ function getDefaultRemoveLabel(option) {
3579
+ return `Remove ${option.value}`;
3580
+ }
3581
+ var BaseMultiSelect = react.forwardRef(
3582
+ function BaseMultiSelect2({
3583
+ options,
3584
+ value,
3585
+ defaultValue,
3586
+ name,
3587
+ placeholder = "Select options",
3588
+ icon,
3589
+ invalid = false,
3590
+ disabled = false,
3591
+ required = false,
3592
+ openForPreview = false,
3593
+ maxTagCount,
3594
+ removeLabel = getDefaultRemoveLabel,
3595
+ emptyLabel = "No options",
3596
+ appearance,
3597
+ className,
3598
+ classNames,
3599
+ style,
3600
+ id,
3601
+ "aria-invalid": nativeAriaInvalid,
3602
+ "aria-label": nativeAriaLabel,
3603
+ "aria-labelledby": nativeAriaLabelledBy,
3604
+ onValueChange,
3605
+ ...rootProps
3606
+ }, ref) {
3607
+ const theme = resolveBaseAppearance(appearance);
3608
+ const generatedId = react.useId();
3609
+ const multiSelectId = id ?? generatedId;
3610
+ const controlId = `${multiSelectId}-control`;
3611
+ const listboxId = `${multiSelectId}-listbox`;
3612
+ const rootRef = react.useRef(null);
3613
+ const optionList = options ?? [];
3614
+ const forceOpen = openForPreview;
3615
+ const [uncontrolledOpen, setUncontrolledOpen] = react.useState(false);
3616
+ const open = forceOpen || uncontrolledOpen;
3617
+ const [uncontrolledValue, setUncontrolledValue] = react.useState(
3618
+ () => normalizeValues(defaultValue)
3619
+ );
3620
+ const [activeIndex, setActiveIndex] = react.useState(
3621
+ () => getFirstEnabledIndex(optionList)
3622
+ );
3623
+ const isControlled = value !== void 0;
3624
+ const selectedValues = react.useMemo(
3625
+ () => normalizeValues(isControlled ? value : uncontrolledValue),
3626
+ [isControlled, uncontrolledValue, value]
3627
+ );
3628
+ const selectedValueSet = react.useMemo(
3629
+ () => new Set(selectedValues),
3630
+ [selectedValues]
3631
+ );
3632
+ const optionByValue = react.useMemo(() => {
3633
+ const map = /* @__PURE__ */ new Map();
3634
+ optionList.forEach((option) => {
3635
+ if (!map.has(option.value)) {
3636
+ map.set(option.value, option);
3637
+ }
3638
+ });
3639
+ return map;
3640
+ }, [optionList]);
3641
+ const selectedOptions = react.useMemo(
3642
+ () => selectedValues.map((selectedValue) => optionByValue.get(selectedValue)).filter(
3643
+ (option) => option !== void 0
3644
+ ),
3645
+ [optionByValue, selectedValues]
3646
+ );
3647
+ const firstEnabledIndex = react.useMemo(
3648
+ () => getFirstEnabledIndex(optionList),
3649
+ [optionList]
3650
+ );
3651
+ const resolvedActiveIndex = activeIndex >= 0 && !optionList[activeIndex]?.disabled ? activeIndex : firstEnabledIndex;
3652
+ const visibleTagCount = getSafeTagCount(
3653
+ maxTagCount,
3654
+ selectedOptions.length
3655
+ );
3656
+ const visibleOptions = selectedOptions.slice(0, visibleTagCount);
3657
+ const overflowCount = selectedOptions.length - visibleOptions.length;
3658
+ const isPlaceholder = selectedOptions.length === 0;
3659
+ const setRootRef = (node) => {
3660
+ rootRef.current = node;
3661
+ if (typeof ref === "function") {
3662
+ ref(node);
3663
+ } else if (ref) {
3664
+ ref.current = node;
3665
+ }
3666
+ };
3667
+ const setOpen = (nextOpen) => {
3668
+ if (disabled || forceOpen) return;
3669
+ setUncontrolledOpen(nextOpen);
3670
+ if (nextOpen) {
3671
+ setActiveIndex(resolvedActiveIndex);
3672
+ }
3673
+ };
3674
+ react.useEffect(() => {
3675
+ if (!open || forceOpen) return void 0;
3676
+ const handlePointerDown = (event) => {
3677
+ if (!rootRef.current?.contains(event.target)) {
3678
+ setUncontrolledOpen(false);
3679
+ }
3680
+ };
3681
+ document.addEventListener("pointerdown", handlePointerDown);
3682
+ return () => {
3683
+ document.removeEventListener("pointerdown", handlePointerDown);
3684
+ };
3685
+ }, [forceOpen, open]);
3686
+ react.useEffect(() => {
3687
+ if (resolvedActiveIndex >= 0 && resolvedActiveIndex !== activeIndex) {
3688
+ setActiveIndex(resolvedActiveIndex);
3689
+ }
3690
+ }, [activeIndex, resolvedActiveIndex]);
3691
+ const commitValues = (nextValues) => {
3692
+ const normalizedValues = normalizeValues(nextValues);
3693
+ if (!isControlled) {
3694
+ setUncontrolledValue(normalizedValues);
3695
+ }
3696
+ onValueChange?.(normalizedValues);
3697
+ };
3698
+ const toggleOption = (option) => {
3699
+ if (!option || option.disabled || disabled) return;
3700
+ const nextValues = selectedValueSet.has(option.value) ? selectedValues.filter((selectedValue) => selectedValue !== option.value) : [...selectedValues, option.value];
3701
+ commitValues(nextValues);
3702
+ };
3703
+ const removeOption = (option) => {
3704
+ if (disabled) return;
3705
+ commitValues(
3706
+ selectedValues.filter((selectedValue) => selectedValue !== option.value)
3707
+ );
3708
+ };
3709
+ const focusOption = (direction) => {
3710
+ const nextIndex = getNextEnabledIndex(
3711
+ optionList,
3712
+ resolvedActiveIndex,
3713
+ direction
3714
+ );
3715
+ if (nextIndex >= 0) {
3716
+ setActiveIndex(nextIndex);
3717
+ }
3718
+ };
3719
+ const handleKeyDown = (event) => {
3720
+ if (disabled) return;
3721
+ if (event.key === "ArrowDown" || event.key === "ArrowUp") {
3722
+ event.preventDefault();
3723
+ if (!open) {
3724
+ setOpen(true);
3725
+ setActiveIndex(firstEnabledIndex);
3726
+ return;
3727
+ }
3728
+ focusOption(event.key === "ArrowDown" ? 1 : -1);
3729
+ return;
3730
+ }
3731
+ if (event.key === "Home") {
3732
+ event.preventDefault();
3733
+ setOpen(true);
3734
+ setActiveIndex(firstEnabledIndex);
3735
+ return;
3736
+ }
3737
+ if (event.key === "End") {
3738
+ event.preventDefault();
3739
+ setOpen(true);
3740
+ for (let index = optionList.length - 1; index >= 0; index -= 1) {
3741
+ if (!optionList[index]?.disabled) {
3742
+ setActiveIndex(index);
3743
+ break;
3744
+ }
3745
+ }
3746
+ return;
3747
+ }
3748
+ if (event.key === "Enter" || event.key === " ") {
3749
+ event.preventDefault();
3750
+ if (!open) {
3751
+ setOpen(true);
3752
+ return;
3753
+ }
3754
+ toggleOption(optionList[resolvedActiveIndex]);
3755
+ return;
3756
+ }
3757
+ if (event.key === "Escape") {
3758
+ setOpen(false);
3759
+ }
3760
+ };
3761
+ return /* @__PURE__ */ jsxRuntime.jsxs(
3762
+ "div",
3763
+ {
3764
+ ...rootProps,
3765
+ id,
3766
+ ref: setRootRef,
3767
+ className: cn(
3768
+ theme.slots.controlWrapper,
3769
+ "overflow-visible",
3770
+ open && "z-50",
3771
+ invalid && theme.slots.controlInvalid,
3772
+ disabled && theme.slots.controlDisabled,
3773
+ classNames?.root,
3774
+ className
3775
+ ),
3776
+ style: {
3777
+ ...theme.styles.control,
3778
+ ...invalid ? theme.styles.controlInvalid : void 0,
3779
+ ...disabled ? theme.styles.controlDisabled : void 0,
3780
+ ...style
3781
+ },
3782
+ children: [
3783
+ hasRenderableNode(icon) ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: cn(theme.slots.controlIcon, classNames?.icon), children: icon }) : null,
3784
+ /* @__PURE__ */ jsxRuntime.jsx(
3785
+ "div",
3786
+ {
3787
+ id: controlId,
3788
+ role: "combobox",
3789
+ tabIndex: disabled ? -1 : 0,
3790
+ "aria-haspopup": "listbox",
3791
+ "aria-expanded": open,
3792
+ "aria-controls": listboxId,
3793
+ "aria-disabled": disabled || void 0,
3794
+ "aria-required": required || void 0,
3795
+ "aria-invalid": nativeAriaInvalid ?? (invalid || void 0),
3796
+ "aria-label": nativeAriaLabel,
3797
+ "aria-labelledby": nativeAriaLabelledBy,
3798
+ className: cn(
3799
+ theme.slots.controlBase,
3800
+ "flex min-h-9 cursor-pointer flex-wrap items-center gap-1.5 py-1.5 pr-9 text-left",
3801
+ disabled && "!cursor-not-allowed",
3802
+ classNames?.control
3803
+ ),
3804
+ onClick: () => setOpen(!open),
3805
+ onKeyDown: handleKeyDown,
3806
+ children: /* @__PURE__ */ jsxRuntime.jsxs(
3807
+ "span",
3808
+ {
3809
+ className: cn(
3810
+ "flex min-w-0 flex-1 flex-wrap items-center gap-1.5",
3811
+ classNames?.tagList
3812
+ ),
3813
+ children: [
3814
+ visibleOptions.map((option) => /* @__PURE__ */ jsxRuntime.jsxs(
3815
+ "span",
3816
+ {
3817
+ className: cn(
3818
+ "inline-flex max-w-full items-center gap-1 rounded-full border border-border/70 bg-muted/65 px-2 py-0.5 text-xs font-medium text-foreground",
3819
+ classNames?.tag
3820
+ ),
3821
+ children: [
3822
+ /* @__PURE__ */ jsxRuntime.jsx(
3823
+ "span",
3824
+ {
3825
+ className: cn(
3826
+ "max-w-40 truncate",
3827
+ classNames?.tagLabel
3828
+ ),
3829
+ children: option.label
3830
+ }
3831
+ ),
3832
+ /* @__PURE__ */ jsxRuntime.jsx(
3833
+ "button",
3834
+ {
3835
+ type: "button",
3836
+ "aria-label": removeLabel(option),
3837
+ disabled,
3838
+ className: cn(
3839
+ "inline-flex h-4 w-4 shrink-0 items-center justify-center rounded-full text-muted-foreground hover:bg-background/80 hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/30 disabled:!cursor-not-allowed",
3840
+ classNames?.tagRemove
3841
+ ),
3842
+ onClick: (event) => {
3843
+ event.preventDefault();
3844
+ event.stopPropagation();
3845
+ removeOption(option);
3846
+ },
3847
+ onMouseDown: (event) => {
3848
+ event.preventDefault();
3849
+ event.stopPropagation();
3850
+ },
3851
+ onKeyDown: (event) => event.stopPropagation(),
3852
+ children: /* @__PURE__ */ jsxRuntime.jsx("span", { "aria-hidden": "true", children: "x" })
3853
+ }
3854
+ )
3855
+ ]
3856
+ },
3857
+ option.value
3858
+ )),
3859
+ overflowCount > 0 ? /* @__PURE__ */ jsxRuntime.jsxs(
3860
+ "span",
3861
+ {
3862
+ className: cn(
3863
+ "inline-flex max-w-full items-center rounded-full border border-border/70 bg-muted/45 px-2 py-0.5 text-xs font-medium text-muted-foreground",
3864
+ classNames?.tag
3865
+ ),
3866
+ children: [
3867
+ "+",
3868
+ overflowCount
3869
+ ]
3870
+ }
3871
+ ) : null,
3872
+ isPlaceholder ? /* @__PURE__ */ jsxRuntime.jsx(
3873
+ "span",
3874
+ {
3875
+ className: cn(
3876
+ "min-w-0 truncate",
3877
+ theme.slots.selectPlaceholder,
3878
+ classNames?.placeholder
3879
+ ),
3880
+ children: placeholder
3881
+ }
3882
+ ) : null
3883
+ ]
3884
+ }
3885
+ )
3886
+ }
3887
+ ),
3888
+ /* @__PURE__ */ jsxRuntime.jsx(
3889
+ "span",
3890
+ {
3891
+ className: cn(
3892
+ theme.slots.selectChevron,
3893
+ open && "rotate-[225deg]",
3894
+ classNames?.chevron
3895
+ )
3896
+ }
3897
+ ),
3898
+ name ? selectedValues.map((selectedValue) => /* @__PURE__ */ jsxRuntime.jsx(
3899
+ "input",
3900
+ {
3901
+ type: "hidden",
3902
+ name,
3903
+ value: selectedValue,
3904
+ className: classNames?.hiddenInput
3905
+ },
3906
+ selectedValue
3907
+ )) : null,
3908
+ open ? /* @__PURE__ */ jsxRuntime.jsx(
3909
+ "div",
3910
+ {
3911
+ id: listboxId,
3912
+ role: "listbox",
3913
+ "aria-multiselectable": "true",
3914
+ "aria-labelledby": controlId,
3915
+ className: cn(theme.slots.selectMenu, classNames?.menu),
3916
+ style: theme.styles.selectMenu,
3917
+ children: optionList.length > 0 ? optionList.map((option, index) => {
3918
+ const selected = selectedValueSet.has(option.value);
3919
+ const active = index === resolvedActiveIndex;
3920
+ return /* @__PURE__ */ jsxRuntime.jsxs(
3921
+ "button",
3922
+ {
3923
+ type: "button",
3924
+ role: "option",
3925
+ "aria-selected": selected,
3926
+ disabled: option.disabled,
3927
+ className: cn(
3928
+ theme.slots.selectOption,
3929
+ "gap-2",
3930
+ active && theme.slots.selectOptionActive,
3931
+ selected && theme.slots.selectOptionSelected,
3932
+ option.disabled && theme.slots.selectOptionDisabled,
3933
+ classNames?.option
3934
+ ),
3935
+ style: {
3936
+ ...theme.styles.selectOption,
3937
+ ...active ? theme.styles.selectOptionActive : void 0,
3938
+ ...selected ? theme.styles.selectOptionSelected : void 0
3939
+ },
3940
+ onMouseEnter: () => {
3941
+ if (!option.disabled) {
3942
+ setActiveIndex(index);
3943
+ }
3944
+ },
3945
+ onMouseDown: (event) => event.preventDefault(),
3946
+ onClick: () => toggleOption(option),
3947
+ children: [
3948
+ /* @__PURE__ */ jsxRuntime.jsx(
3949
+ "span",
3950
+ {
3951
+ "aria-hidden": "true",
3952
+ className: cn(
3953
+ "inline-flex h-4 w-4 shrink-0 items-center justify-center rounded-sm border border-border/70 text-[10px]",
3954
+ selected && "border-primary/40 bg-primary text-primary-foreground",
3955
+ classNames?.optionIndicator
3956
+ ),
3957
+ children: selected ? "\u2713" : null
3958
+ }
3959
+ ),
3960
+ /* @__PURE__ */ jsxRuntime.jsx(
3961
+ "span",
3962
+ {
3963
+ className: cn(
3964
+ "min-w-0 flex-1 truncate",
3965
+ classNames?.optionLabel
3966
+ ),
3967
+ children: option.label
3968
+ }
3969
+ )
3970
+ ]
3971
+ },
3972
+ option.value
3973
+ );
3974
+ }) : /* @__PURE__ */ jsxRuntime.jsx(
3975
+ "div",
3976
+ {
3977
+ className: cn(
3978
+ "px-2.5 py-2 text-sm text-muted-foreground",
3979
+ classNames?.empty
3980
+ ),
3981
+ children: emptyLabel
3982
+ }
3983
+ )
3984
+ }
3985
+ ) : null
3986
+ ]
3987
+ }
3988
+ );
3989
+ }
3990
+ );
3549
3991
  function BaseNotice({
3550
3992
  tone,
3551
3993
  icon,
@@ -3947,7 +4389,7 @@ function getInitialValue2(options, defaultValue) {
3947
4389
  }
3948
4390
  return "";
3949
4391
  }
3950
- function getNextEnabledIndex(options, currentIndex, direction) {
4392
+ function getNextEnabledIndex2(options, currentIndex, direction) {
3951
4393
  if (!options.length) return -1;
3952
4394
  for (let offset = 1; offset <= options.length; offset += 1) {
3953
4395
  const nextIndex = (currentIndex + offset * direction + options.length) % options.length;
@@ -4049,7 +4491,7 @@ var BaseSelect = react.forwardRef(
4049
4491
  };
4050
4492
  const focusOption = (direction) => {
4051
4493
  const currentIndex = activeIndex >= 0 ? activeIndex : 0;
4052
- const nextIndex = getNextEnabledIndex(optionList, currentIndex, direction);
4494
+ const nextIndex = getNextEnabledIndex2(optionList, currentIndex, direction);
4053
4495
  if (nextIndex >= 0) {
4054
4496
  commitValue(optionList[nextIndex].value, optionList[nextIndex].disabled);
4055
4497
  }
@@ -5448,6 +5890,7 @@ exports.BaseLayoutPane = BaseLayoutPane;
5448
5890
  exports.BaseLayoutResizeHandle = BaseLayoutResizeHandle;
5449
5891
  exports.BaseLayoutSplit = BaseLayoutSplit;
5450
5892
  exports.BaseLoadingState = BaseLoadingState;
5893
+ exports.BaseMultiSelect = BaseMultiSelect;
5451
5894
  exports.BaseNotice = BaseNotice;
5452
5895
  exports.BasePagination = BasePagination;
5453
5896
  exports.BasePanel = BasePanel;