@inf-monkeys-tech/monkeys-design 0.4.35 → 0.4.37

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 (38) hide show
  1. package/README.md +103 -0
  2. package/dist/components/base/index.d.mts +2 -2
  3. package/dist/components/base/index.d.ts +2 -2
  4. package/dist/components/base/index.js +445 -2
  5. package/dist/components/base/index.js.map +1 -1
  6. package/dist/components/base/index.mjs +445 -3
  7. package/dist/components/base/index.mjs.map +1 -1
  8. package/dist/components/login/index.d.mts +97 -1
  9. package/dist/components/login/index.d.ts +97 -1
  10. package/dist/components/login/index.js +262 -2
  11. package/dist/components/login/index.js.map +1 -1
  12. package/dist/components/login/index.mjs +262 -3
  13. package/dist/components/login/index.mjs.map +1 -1
  14. package/dist/components/workbench/index.d.mts +1 -1
  15. package/dist/components/workbench/index.d.ts +1 -1
  16. package/dist/components/workbench/index.js +444 -2
  17. package/dist/components/workbench/index.js.map +1 -1
  18. package/dist/components/workbench/index.mjs +444 -2
  19. package/dist/components/workbench/index.mjs.map +1 -1
  20. package/dist/index.d.mts +3 -3
  21. package/dist/index.d.ts +3 -3
  22. package/dist/index.js +705 -2
  23. package/dist/index.js.map +1 -1
  24. package/dist/index.mjs +704 -3
  25. package/dist/index.mjs.map +1 -1
  26. package/dist/styles/login-page.scss +423 -0
  27. package/dist/{theme-Cuy60thu.d.ts → theme-Clm5dVb0.d.mts} +4 -2
  28. package/dist/{theme-CoG9vCPT.d.mts → theme-sIoU5-YC.d.ts} +4 -2
  29. package/dist/theme-system/index.d.mts +1 -1
  30. package/dist/theme-system/index.d.ts +1 -1
  31. package/dist/theme-system/index.js +444 -2
  32. package/dist/theme-system/index.js.map +1 -1
  33. package/dist/theme-system/index.mjs +444 -2
  34. package/dist/theme-system/index.mjs.map +1 -1
  35. package/dist/{types-CZALgtez.d.ts → types-Bn6PEDsX.d.mts} +43 -1
  36. package/dist/{types-CZALgtez.d.mts → types-Bn6PEDsX.d.ts} +43 -1
  37. package/package.json +5 -2
  38. package/dist/styles/artist-login.scss +0 -375
@@ -3524,6 +3524,448 @@ function BaseLoadingState({
3524
3524
  }
3525
3525
  );
3526
3526
  }
3527
+ function normalizeValues(values) {
3528
+ const nextValues = [];
3529
+ const seen = /* @__PURE__ */ new Set();
3530
+ values?.forEach((value) => {
3531
+ if (seen.has(value)) return;
3532
+ seen.add(value);
3533
+ nextValues.push(value);
3534
+ });
3535
+ return nextValues;
3536
+ }
3537
+ function getNextEnabledIndex(options, currentIndex, direction) {
3538
+ if (!options.length) return -1;
3539
+ const startIndex = currentIndex >= 0 ? currentIndex : 0;
3540
+ for (let offset = 1; offset <= options.length; offset += 1) {
3541
+ const nextIndex = (startIndex + offset * direction + options.length) % options.length;
3542
+ if (!options[nextIndex]?.disabled) {
3543
+ return nextIndex;
3544
+ }
3545
+ }
3546
+ return -1;
3547
+ }
3548
+ function getFirstEnabledIndex(options) {
3549
+ return options.findIndex((option) => !option.disabled);
3550
+ }
3551
+ function getSafeTagCount(maxTagCount, total) {
3552
+ if (maxTagCount === void 0) return total;
3553
+ if (!Number.isFinite(maxTagCount)) return total;
3554
+ return Math.max(0, Math.min(total, Math.floor(maxTagCount)));
3555
+ }
3556
+ function getDefaultRemoveLabel(option) {
3557
+ return `Remove ${option.value}`;
3558
+ }
3559
+ var BaseMultiSelect = forwardRef(
3560
+ function BaseMultiSelect2({
3561
+ options,
3562
+ value,
3563
+ defaultValue,
3564
+ name,
3565
+ placeholder = "Select options",
3566
+ icon,
3567
+ invalid = false,
3568
+ disabled = false,
3569
+ required = false,
3570
+ openForPreview = false,
3571
+ maxTagCount,
3572
+ removeLabel = getDefaultRemoveLabel,
3573
+ emptyLabel = "No options",
3574
+ appearance,
3575
+ className,
3576
+ classNames,
3577
+ style,
3578
+ id,
3579
+ "aria-invalid": nativeAriaInvalid,
3580
+ "aria-label": nativeAriaLabel,
3581
+ "aria-labelledby": nativeAriaLabelledBy,
3582
+ onValueChange,
3583
+ ...rootProps
3584
+ }, ref) {
3585
+ const theme = resolveBaseAppearance(appearance);
3586
+ const generatedId = useId();
3587
+ const multiSelectId = id ?? generatedId;
3588
+ const controlId = `${multiSelectId}-control`;
3589
+ const listboxId = `${multiSelectId}-listbox`;
3590
+ const rootRef = useRef(null);
3591
+ const optionList = options ?? [];
3592
+ const forceOpen = openForPreview;
3593
+ const [uncontrolledOpen, setUncontrolledOpen] = useState(false);
3594
+ const open = forceOpen || uncontrolledOpen;
3595
+ const [uncontrolledValue, setUncontrolledValue] = useState(
3596
+ () => normalizeValues(defaultValue)
3597
+ );
3598
+ const [activeIndex, setActiveIndex] = useState(
3599
+ () => getFirstEnabledIndex(optionList)
3600
+ );
3601
+ const isControlled = value !== void 0;
3602
+ const selectedValues = useMemo(
3603
+ () => normalizeValues(isControlled ? value : uncontrolledValue),
3604
+ [isControlled, uncontrolledValue, value]
3605
+ );
3606
+ const selectedValueSet = useMemo(
3607
+ () => new Set(selectedValues),
3608
+ [selectedValues]
3609
+ );
3610
+ const optionByValue = useMemo(() => {
3611
+ const map = /* @__PURE__ */ new Map();
3612
+ optionList.forEach((option) => {
3613
+ if (!map.has(option.value)) {
3614
+ map.set(option.value, option);
3615
+ }
3616
+ });
3617
+ return map;
3618
+ }, [optionList]);
3619
+ const selectedOptions = useMemo(
3620
+ () => selectedValues.map((selectedValue) => optionByValue.get(selectedValue)).filter(
3621
+ (option) => option !== void 0
3622
+ ),
3623
+ [optionByValue, selectedValues]
3624
+ );
3625
+ const firstEnabledIndex = useMemo(
3626
+ () => getFirstEnabledIndex(optionList),
3627
+ [optionList]
3628
+ );
3629
+ const resolvedActiveIndex = activeIndex >= 0 && !optionList[activeIndex]?.disabled ? activeIndex : firstEnabledIndex;
3630
+ const visibleTagCount = getSafeTagCount(
3631
+ maxTagCount,
3632
+ selectedOptions.length
3633
+ );
3634
+ const visibleOptions = selectedOptions.slice(0, visibleTagCount);
3635
+ const overflowCount = selectedOptions.length - visibleOptions.length;
3636
+ const isPlaceholder = selectedOptions.length === 0;
3637
+ const setRootRef = (node) => {
3638
+ rootRef.current = node;
3639
+ if (typeof ref === "function") {
3640
+ ref(node);
3641
+ } else if (ref) {
3642
+ ref.current = node;
3643
+ }
3644
+ };
3645
+ const setOpen = (nextOpen) => {
3646
+ if (disabled || forceOpen) return;
3647
+ setUncontrolledOpen(nextOpen);
3648
+ if (nextOpen) {
3649
+ setActiveIndex(resolvedActiveIndex);
3650
+ }
3651
+ };
3652
+ useEffect(() => {
3653
+ if (!open || forceOpen) return void 0;
3654
+ const handlePointerDown = (event) => {
3655
+ if (!rootRef.current?.contains(event.target)) {
3656
+ setUncontrolledOpen(false);
3657
+ }
3658
+ };
3659
+ document.addEventListener("pointerdown", handlePointerDown);
3660
+ return () => {
3661
+ document.removeEventListener("pointerdown", handlePointerDown);
3662
+ };
3663
+ }, [forceOpen, open]);
3664
+ useEffect(() => {
3665
+ if (resolvedActiveIndex >= 0 && resolvedActiveIndex !== activeIndex) {
3666
+ setActiveIndex(resolvedActiveIndex);
3667
+ }
3668
+ }, [activeIndex, resolvedActiveIndex]);
3669
+ const commitValues = (nextValues) => {
3670
+ const normalizedValues = normalizeValues(nextValues);
3671
+ if (!isControlled) {
3672
+ setUncontrolledValue(normalizedValues);
3673
+ }
3674
+ onValueChange?.(normalizedValues);
3675
+ };
3676
+ const toggleOption = (option) => {
3677
+ if (!option || option.disabled || disabled) return;
3678
+ const nextValues = selectedValueSet.has(option.value) ? selectedValues.filter((selectedValue) => selectedValue !== option.value) : [...selectedValues, option.value];
3679
+ commitValues(nextValues);
3680
+ };
3681
+ const removeOption = (option) => {
3682
+ if (disabled) return;
3683
+ commitValues(
3684
+ selectedValues.filter((selectedValue) => selectedValue !== option.value)
3685
+ );
3686
+ };
3687
+ const focusOption = (direction) => {
3688
+ const nextIndex = getNextEnabledIndex(
3689
+ optionList,
3690
+ resolvedActiveIndex,
3691
+ direction
3692
+ );
3693
+ if (nextIndex >= 0) {
3694
+ setActiveIndex(nextIndex);
3695
+ }
3696
+ };
3697
+ const handleKeyDown = (event) => {
3698
+ if (disabled) return;
3699
+ if (event.key === "ArrowDown" || event.key === "ArrowUp") {
3700
+ event.preventDefault();
3701
+ if (!open) {
3702
+ setOpen(true);
3703
+ setActiveIndex(firstEnabledIndex);
3704
+ return;
3705
+ }
3706
+ focusOption(event.key === "ArrowDown" ? 1 : -1);
3707
+ return;
3708
+ }
3709
+ if (event.key === "Home") {
3710
+ event.preventDefault();
3711
+ setOpen(true);
3712
+ setActiveIndex(firstEnabledIndex);
3713
+ return;
3714
+ }
3715
+ if (event.key === "End") {
3716
+ event.preventDefault();
3717
+ setOpen(true);
3718
+ for (let index = optionList.length - 1; index >= 0; index -= 1) {
3719
+ if (!optionList[index]?.disabled) {
3720
+ setActiveIndex(index);
3721
+ break;
3722
+ }
3723
+ }
3724
+ return;
3725
+ }
3726
+ if (event.key === "Enter" || event.key === " ") {
3727
+ event.preventDefault();
3728
+ if (!open) {
3729
+ setOpen(true);
3730
+ return;
3731
+ }
3732
+ toggleOption(optionList[resolvedActiveIndex]);
3733
+ return;
3734
+ }
3735
+ if (event.key === "Escape") {
3736
+ setOpen(false);
3737
+ }
3738
+ };
3739
+ return /* @__PURE__ */ jsxs(
3740
+ "div",
3741
+ {
3742
+ ...rootProps,
3743
+ id,
3744
+ ref: setRootRef,
3745
+ className: cn(
3746
+ theme.slots.controlWrapper,
3747
+ "overflow-visible",
3748
+ open && "z-50",
3749
+ invalid && theme.slots.controlInvalid,
3750
+ disabled && theme.slots.controlDisabled,
3751
+ classNames?.root,
3752
+ className
3753
+ ),
3754
+ style: {
3755
+ ...theme.styles.control,
3756
+ ...invalid ? theme.styles.controlInvalid : void 0,
3757
+ ...disabled ? theme.styles.controlDisabled : void 0,
3758
+ ...style
3759
+ },
3760
+ children: [
3761
+ hasRenderableNode(icon) ? /* @__PURE__ */ jsx("span", { className: cn(theme.slots.controlIcon, classNames?.icon), children: icon }) : null,
3762
+ /* @__PURE__ */ jsx(
3763
+ "div",
3764
+ {
3765
+ id: controlId,
3766
+ role: "combobox",
3767
+ tabIndex: disabled ? -1 : 0,
3768
+ "aria-haspopup": "listbox",
3769
+ "aria-expanded": open,
3770
+ "aria-controls": listboxId,
3771
+ "aria-disabled": disabled || void 0,
3772
+ "aria-required": required || void 0,
3773
+ "aria-invalid": nativeAriaInvalid ?? (invalid || void 0),
3774
+ "aria-label": nativeAriaLabel,
3775
+ "aria-labelledby": nativeAriaLabelledBy,
3776
+ className: cn(
3777
+ theme.slots.controlBase,
3778
+ "flex min-h-9 cursor-pointer flex-wrap items-center gap-1.5 py-1.5 pr-9 text-left",
3779
+ disabled && "!cursor-not-allowed",
3780
+ classNames?.control
3781
+ ),
3782
+ onClick: () => setOpen(!open),
3783
+ onKeyDown: handleKeyDown,
3784
+ children: /* @__PURE__ */ jsxs(
3785
+ "span",
3786
+ {
3787
+ className: cn(
3788
+ "flex min-w-0 flex-1 flex-wrap items-center gap-1.5",
3789
+ classNames?.tagList
3790
+ ),
3791
+ children: [
3792
+ visibleOptions.map((option) => /* @__PURE__ */ jsxs(
3793
+ "span",
3794
+ {
3795
+ className: cn(
3796
+ "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",
3797
+ classNames?.tag
3798
+ ),
3799
+ children: [
3800
+ /* @__PURE__ */ jsx(
3801
+ "span",
3802
+ {
3803
+ className: cn(
3804
+ "max-w-40 truncate",
3805
+ classNames?.tagLabel
3806
+ ),
3807
+ children: option.label
3808
+ }
3809
+ ),
3810
+ /* @__PURE__ */ jsx(
3811
+ "button",
3812
+ {
3813
+ type: "button",
3814
+ "aria-label": removeLabel(option),
3815
+ disabled,
3816
+ className: cn(
3817
+ "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",
3818
+ classNames?.tagRemove
3819
+ ),
3820
+ onClick: (event) => {
3821
+ event.preventDefault();
3822
+ event.stopPropagation();
3823
+ removeOption(option);
3824
+ },
3825
+ onMouseDown: (event) => {
3826
+ event.preventDefault();
3827
+ event.stopPropagation();
3828
+ },
3829
+ onKeyDown: (event) => event.stopPropagation(),
3830
+ children: /* @__PURE__ */ jsx("span", { "aria-hidden": "true", children: "x" })
3831
+ }
3832
+ )
3833
+ ]
3834
+ },
3835
+ option.value
3836
+ )),
3837
+ overflowCount > 0 ? /* @__PURE__ */ jsxs(
3838
+ "span",
3839
+ {
3840
+ className: cn(
3841
+ "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",
3842
+ classNames?.tag
3843
+ ),
3844
+ children: [
3845
+ "+",
3846
+ overflowCount
3847
+ ]
3848
+ }
3849
+ ) : null,
3850
+ isPlaceholder ? /* @__PURE__ */ jsx(
3851
+ "span",
3852
+ {
3853
+ className: cn(
3854
+ "min-w-0 truncate",
3855
+ theme.slots.selectPlaceholder,
3856
+ classNames?.placeholder
3857
+ ),
3858
+ children: placeholder
3859
+ }
3860
+ ) : null
3861
+ ]
3862
+ }
3863
+ )
3864
+ }
3865
+ ),
3866
+ /* @__PURE__ */ jsx(
3867
+ "span",
3868
+ {
3869
+ className: cn(
3870
+ theme.slots.selectChevron,
3871
+ open && "rotate-[225deg]",
3872
+ classNames?.chevron
3873
+ )
3874
+ }
3875
+ ),
3876
+ name ? selectedValues.map((selectedValue) => /* @__PURE__ */ jsx(
3877
+ "input",
3878
+ {
3879
+ type: "hidden",
3880
+ name,
3881
+ value: selectedValue,
3882
+ className: classNames?.hiddenInput
3883
+ },
3884
+ selectedValue
3885
+ )) : null,
3886
+ open ? /* @__PURE__ */ jsx(
3887
+ "div",
3888
+ {
3889
+ id: listboxId,
3890
+ role: "listbox",
3891
+ "aria-multiselectable": "true",
3892
+ "aria-labelledby": controlId,
3893
+ className: cn(theme.slots.selectMenu, classNames?.menu),
3894
+ style: theme.styles.selectMenu,
3895
+ children: optionList.length > 0 ? optionList.map((option, index) => {
3896
+ const selected = selectedValueSet.has(option.value);
3897
+ const active = index === resolvedActiveIndex;
3898
+ return /* @__PURE__ */ jsxs(
3899
+ "button",
3900
+ {
3901
+ type: "button",
3902
+ role: "option",
3903
+ "aria-selected": selected,
3904
+ disabled: option.disabled,
3905
+ className: cn(
3906
+ theme.slots.selectOption,
3907
+ "gap-2",
3908
+ active && theme.slots.selectOptionActive,
3909
+ selected && theme.slots.selectOptionSelected,
3910
+ option.disabled && theme.slots.selectOptionDisabled,
3911
+ classNames?.option
3912
+ ),
3913
+ style: {
3914
+ ...theme.styles.selectOption,
3915
+ ...active ? theme.styles.selectOptionActive : void 0,
3916
+ ...selected ? theme.styles.selectOptionSelected : void 0
3917
+ },
3918
+ onMouseEnter: () => {
3919
+ if (!option.disabled) {
3920
+ setActiveIndex(index);
3921
+ }
3922
+ },
3923
+ onMouseDown: (event) => event.preventDefault(),
3924
+ onClick: () => toggleOption(option),
3925
+ children: [
3926
+ /* @__PURE__ */ jsx(
3927
+ "span",
3928
+ {
3929
+ "aria-hidden": "true",
3930
+ className: cn(
3931
+ "inline-flex h-4 w-4 shrink-0 items-center justify-center rounded-sm border border-border/70 text-[10px]",
3932
+ selected && "border-primary/40 bg-primary text-primary-foreground",
3933
+ classNames?.optionIndicator
3934
+ ),
3935
+ children: selected ? "\u2713" : null
3936
+ }
3937
+ ),
3938
+ /* @__PURE__ */ jsx(
3939
+ "span",
3940
+ {
3941
+ className: cn(
3942
+ "min-w-0 flex-1 truncate",
3943
+ classNames?.optionLabel
3944
+ ),
3945
+ children: option.label
3946
+ }
3947
+ )
3948
+ ]
3949
+ },
3950
+ option.value
3951
+ );
3952
+ }) : /* @__PURE__ */ jsx(
3953
+ "div",
3954
+ {
3955
+ className: cn(
3956
+ "px-2.5 py-2 text-sm text-muted-foreground",
3957
+ classNames?.empty
3958
+ ),
3959
+ children: emptyLabel
3960
+ }
3961
+ )
3962
+ }
3963
+ ) : null
3964
+ ]
3965
+ }
3966
+ );
3967
+ }
3968
+ );
3527
3969
  function BaseNotice({
3528
3970
  tone,
3529
3971
  icon,
@@ -3925,7 +4367,7 @@ function getInitialValue2(options, defaultValue) {
3925
4367
  }
3926
4368
  return "";
3927
4369
  }
3928
- function getNextEnabledIndex(options, currentIndex, direction) {
4370
+ function getNextEnabledIndex2(options, currentIndex, direction) {
3929
4371
  if (!options.length) return -1;
3930
4372
  for (let offset = 1; offset <= options.length; offset += 1) {
3931
4373
  const nextIndex = (currentIndex + offset * direction + options.length) % options.length;
@@ -4027,7 +4469,7 @@ var BaseSelect = forwardRef(
4027
4469
  };
4028
4470
  const focusOption = (direction) => {
4029
4471
  const currentIndex = activeIndex >= 0 ? activeIndex : 0;
4030
- const nextIndex = getNextEnabledIndex(optionList, currentIndex, direction);
4472
+ const nextIndex = getNextEnabledIndex2(optionList, currentIndex, direction);
4031
4473
  if (nextIndex >= 0) {
4032
4474
  commitValue(optionList[nextIndex].value, optionList[nextIndex].disabled);
4033
4475
  }
@@ -5396,6 +5838,6 @@ function BaseToolbar({
5396
5838
  );
5397
5839
  }
5398
5840
 
5399
- export { BaseAccordion, BaseAvatar, BaseBadge, BaseBreadcrumb, BaseButton, BaseCheckbox, BaseContextMenu, BaseContextMenuCheckboxItem, BaseContextMenuContent, BaseContextMenuItem, BaseContextMenuLabel, BaseContextMenuRadioGroup, BaseContextMenuRadioItem, BaseContextMenuSeparator, BaseContextMenuSub, BaseContextMenuSubContent, BaseContextMenuSubTrigger, BaseContextMenuTrigger, BaseDescriptionList, BaseDialog, BaseDivider, BaseDropdownMenu, BaseEmptyState, BaseField, BaseInput, BaseLayout, BaseLayoutPane, BaseLayoutResizeHandle, BaseLayoutSplit, BaseLoadingState, BaseNotice, BasePagination, BasePanel, BaseProgress, BaseRadioGroup, BaseSectionHeader, BaseSegmentedControl, BaseSelect, BaseSkeleton, BaseSwitch, BaseTable, BaseTableBody, BaseTableCaption, BaseTableCell, BaseTableContainer, BaseTableEmpty, BaseTableFooter, BaseTableFooterBar, BaseTableHead, BaseTableHeader, BaseTableLoading, BaseTableRow, BaseTabs, BaseTextarea, BaseToolbar, BaseTooltip, cn, getBaseBadgeToneClassName, getBaseButtonToneClassName, getBaseMenuItemToneClassName, getBaseNoticeToneClassName, resolveBaseAppearance };
5841
+ export { BaseAccordion, BaseAvatar, BaseBadge, BaseBreadcrumb, BaseButton, BaseCheckbox, BaseContextMenu, BaseContextMenuCheckboxItem, BaseContextMenuContent, BaseContextMenuItem, BaseContextMenuLabel, BaseContextMenuRadioGroup, BaseContextMenuRadioItem, BaseContextMenuSeparator, BaseContextMenuSub, BaseContextMenuSubContent, BaseContextMenuSubTrigger, BaseContextMenuTrigger, BaseDescriptionList, BaseDialog, BaseDivider, BaseDropdownMenu, BaseEmptyState, BaseField, BaseInput, BaseLayout, BaseLayoutPane, BaseLayoutResizeHandle, BaseLayoutSplit, BaseLoadingState, BaseMultiSelect, BaseNotice, BasePagination, BasePanel, BaseProgress, BaseRadioGroup, BaseSectionHeader, BaseSegmentedControl, BaseSelect, BaseSkeleton, BaseSwitch, BaseTable, BaseTableBody, BaseTableCaption, BaseTableCell, BaseTableContainer, BaseTableEmpty, BaseTableFooter, BaseTableFooterBar, BaseTableHead, BaseTableHeader, BaseTableLoading, BaseTableRow, BaseTabs, BaseTextarea, BaseToolbar, BaseTooltip, cn, getBaseBadgeToneClassName, getBaseButtonToneClassName, getBaseMenuItemToneClassName, getBaseNoticeToneClassName, resolveBaseAppearance };
5400
5842
  //# sourceMappingURL=index.mjs.map
5401
5843
  //# sourceMappingURL=index.mjs.map