@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
package/dist/index.js CHANGED
@@ -11742,6 +11742,448 @@ function BaseLoadingState({
11742
11742
  }
11743
11743
  );
11744
11744
  }
11745
+ function normalizeValues(values) {
11746
+ const nextValues = [];
11747
+ const seen = /* @__PURE__ */ new Set();
11748
+ values?.forEach((value) => {
11749
+ if (seen.has(value)) return;
11750
+ seen.add(value);
11751
+ nextValues.push(value);
11752
+ });
11753
+ return nextValues;
11754
+ }
11755
+ function getNextEnabledIndex(options, currentIndex, direction) {
11756
+ if (!options.length) return -1;
11757
+ const startIndex = currentIndex >= 0 ? currentIndex : 0;
11758
+ for (let offset = 1; offset <= options.length; offset += 1) {
11759
+ const nextIndex = (startIndex + offset * direction + options.length) % options.length;
11760
+ if (!options[nextIndex]?.disabled) {
11761
+ return nextIndex;
11762
+ }
11763
+ }
11764
+ return -1;
11765
+ }
11766
+ function getFirstEnabledIndex(options) {
11767
+ return options.findIndex((option) => !option.disabled);
11768
+ }
11769
+ function getSafeTagCount(maxTagCount, total) {
11770
+ if (maxTagCount === void 0) return total;
11771
+ if (!Number.isFinite(maxTagCount)) return total;
11772
+ return Math.max(0, Math.min(total, Math.floor(maxTagCount)));
11773
+ }
11774
+ function getDefaultRemoveLabel(option) {
11775
+ return `Remove ${option.value}`;
11776
+ }
11777
+ var BaseMultiSelect = React.forwardRef(
11778
+ function BaseMultiSelect2({
11779
+ options,
11780
+ value,
11781
+ defaultValue,
11782
+ name,
11783
+ placeholder = "Select options",
11784
+ icon,
11785
+ invalid = false,
11786
+ disabled = false,
11787
+ required = false,
11788
+ openForPreview = false,
11789
+ maxTagCount,
11790
+ removeLabel = getDefaultRemoveLabel,
11791
+ emptyLabel = "No options",
11792
+ appearance,
11793
+ className,
11794
+ classNames,
11795
+ style,
11796
+ id,
11797
+ "aria-invalid": nativeAriaInvalid,
11798
+ "aria-label": nativeAriaLabel,
11799
+ "aria-labelledby": nativeAriaLabelledBy,
11800
+ onValueChange,
11801
+ ...rootProps
11802
+ }, ref) {
11803
+ const theme = resolveBaseAppearance(appearance);
11804
+ const generatedId = React.useId();
11805
+ const multiSelectId = id ?? generatedId;
11806
+ const controlId = `${multiSelectId}-control`;
11807
+ const listboxId = `${multiSelectId}-listbox`;
11808
+ const rootRef = React.useRef(null);
11809
+ const optionList = options ?? [];
11810
+ const forceOpen = openForPreview;
11811
+ const [uncontrolledOpen, setUncontrolledOpen] = React.useState(false);
11812
+ const open = forceOpen || uncontrolledOpen;
11813
+ const [uncontrolledValue, setUncontrolledValue] = React.useState(
11814
+ () => normalizeValues(defaultValue)
11815
+ );
11816
+ const [activeIndex, setActiveIndex] = React.useState(
11817
+ () => getFirstEnabledIndex(optionList)
11818
+ );
11819
+ const isControlled = value !== void 0;
11820
+ const selectedValues = React.useMemo(
11821
+ () => normalizeValues(isControlled ? value : uncontrolledValue),
11822
+ [isControlled, uncontrolledValue, value]
11823
+ );
11824
+ const selectedValueSet = React.useMemo(
11825
+ () => new Set(selectedValues),
11826
+ [selectedValues]
11827
+ );
11828
+ const optionByValue = React.useMemo(() => {
11829
+ const map = /* @__PURE__ */ new Map();
11830
+ optionList.forEach((option) => {
11831
+ if (!map.has(option.value)) {
11832
+ map.set(option.value, option);
11833
+ }
11834
+ });
11835
+ return map;
11836
+ }, [optionList]);
11837
+ const selectedOptions = React.useMemo(
11838
+ () => selectedValues.map((selectedValue) => optionByValue.get(selectedValue)).filter(
11839
+ (option) => option !== void 0
11840
+ ),
11841
+ [optionByValue, selectedValues]
11842
+ );
11843
+ const firstEnabledIndex = React.useMemo(
11844
+ () => getFirstEnabledIndex(optionList),
11845
+ [optionList]
11846
+ );
11847
+ const resolvedActiveIndex = activeIndex >= 0 && !optionList[activeIndex]?.disabled ? activeIndex : firstEnabledIndex;
11848
+ const visibleTagCount = getSafeTagCount(
11849
+ maxTagCount,
11850
+ selectedOptions.length
11851
+ );
11852
+ const visibleOptions = selectedOptions.slice(0, visibleTagCount);
11853
+ const overflowCount = selectedOptions.length - visibleOptions.length;
11854
+ const isPlaceholder = selectedOptions.length === 0;
11855
+ const setRootRef = (node) => {
11856
+ rootRef.current = node;
11857
+ if (typeof ref === "function") {
11858
+ ref(node);
11859
+ } else if (ref) {
11860
+ ref.current = node;
11861
+ }
11862
+ };
11863
+ const setOpen = (nextOpen) => {
11864
+ if (disabled || forceOpen) return;
11865
+ setUncontrolledOpen(nextOpen);
11866
+ if (nextOpen) {
11867
+ setActiveIndex(resolvedActiveIndex);
11868
+ }
11869
+ };
11870
+ React.useEffect(() => {
11871
+ if (!open || forceOpen) return void 0;
11872
+ const handlePointerDown = (event) => {
11873
+ if (!rootRef.current?.contains(event.target)) {
11874
+ setUncontrolledOpen(false);
11875
+ }
11876
+ };
11877
+ document.addEventListener("pointerdown", handlePointerDown);
11878
+ return () => {
11879
+ document.removeEventListener("pointerdown", handlePointerDown);
11880
+ };
11881
+ }, [forceOpen, open]);
11882
+ React.useEffect(() => {
11883
+ if (resolvedActiveIndex >= 0 && resolvedActiveIndex !== activeIndex) {
11884
+ setActiveIndex(resolvedActiveIndex);
11885
+ }
11886
+ }, [activeIndex, resolvedActiveIndex]);
11887
+ const commitValues = (nextValues) => {
11888
+ const normalizedValues = normalizeValues(nextValues);
11889
+ if (!isControlled) {
11890
+ setUncontrolledValue(normalizedValues);
11891
+ }
11892
+ onValueChange?.(normalizedValues);
11893
+ };
11894
+ const toggleOption = (option) => {
11895
+ if (!option || option.disabled || disabled) return;
11896
+ const nextValues = selectedValueSet.has(option.value) ? selectedValues.filter((selectedValue) => selectedValue !== option.value) : [...selectedValues, option.value];
11897
+ commitValues(nextValues);
11898
+ };
11899
+ const removeOption = (option) => {
11900
+ if (disabled) return;
11901
+ commitValues(
11902
+ selectedValues.filter((selectedValue) => selectedValue !== option.value)
11903
+ );
11904
+ };
11905
+ const focusOption = (direction) => {
11906
+ const nextIndex = getNextEnabledIndex(
11907
+ optionList,
11908
+ resolvedActiveIndex,
11909
+ direction
11910
+ );
11911
+ if (nextIndex >= 0) {
11912
+ setActiveIndex(nextIndex);
11913
+ }
11914
+ };
11915
+ const handleKeyDown = (event) => {
11916
+ if (disabled) return;
11917
+ if (event.key === "ArrowDown" || event.key === "ArrowUp") {
11918
+ event.preventDefault();
11919
+ if (!open) {
11920
+ setOpen(true);
11921
+ setActiveIndex(firstEnabledIndex);
11922
+ return;
11923
+ }
11924
+ focusOption(event.key === "ArrowDown" ? 1 : -1);
11925
+ return;
11926
+ }
11927
+ if (event.key === "Home") {
11928
+ event.preventDefault();
11929
+ setOpen(true);
11930
+ setActiveIndex(firstEnabledIndex);
11931
+ return;
11932
+ }
11933
+ if (event.key === "End") {
11934
+ event.preventDefault();
11935
+ setOpen(true);
11936
+ for (let index = optionList.length - 1; index >= 0; index -= 1) {
11937
+ if (!optionList[index]?.disabled) {
11938
+ setActiveIndex(index);
11939
+ break;
11940
+ }
11941
+ }
11942
+ return;
11943
+ }
11944
+ if (event.key === "Enter" || event.key === " ") {
11945
+ event.preventDefault();
11946
+ if (!open) {
11947
+ setOpen(true);
11948
+ return;
11949
+ }
11950
+ toggleOption(optionList[resolvedActiveIndex]);
11951
+ return;
11952
+ }
11953
+ if (event.key === "Escape") {
11954
+ setOpen(false);
11955
+ }
11956
+ };
11957
+ return /* @__PURE__ */ jsxRuntime.jsxs(
11958
+ "div",
11959
+ {
11960
+ ...rootProps,
11961
+ id,
11962
+ ref: setRootRef,
11963
+ className: cn(
11964
+ theme.slots.controlWrapper,
11965
+ "overflow-visible",
11966
+ open && "z-50",
11967
+ invalid && theme.slots.controlInvalid,
11968
+ disabled && theme.slots.controlDisabled,
11969
+ classNames?.root,
11970
+ className
11971
+ ),
11972
+ style: {
11973
+ ...theme.styles.control,
11974
+ ...invalid ? theme.styles.controlInvalid : void 0,
11975
+ ...disabled ? theme.styles.controlDisabled : void 0,
11976
+ ...style
11977
+ },
11978
+ children: [
11979
+ hasRenderableNode(icon) ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: cn(theme.slots.controlIcon, classNames?.icon), children: icon }) : null,
11980
+ /* @__PURE__ */ jsxRuntime.jsx(
11981
+ "div",
11982
+ {
11983
+ id: controlId,
11984
+ role: "combobox",
11985
+ tabIndex: disabled ? -1 : 0,
11986
+ "aria-haspopup": "listbox",
11987
+ "aria-expanded": open,
11988
+ "aria-controls": listboxId,
11989
+ "aria-disabled": disabled || void 0,
11990
+ "aria-required": required || void 0,
11991
+ "aria-invalid": nativeAriaInvalid ?? (invalid || void 0),
11992
+ "aria-label": nativeAriaLabel,
11993
+ "aria-labelledby": nativeAriaLabelledBy,
11994
+ className: cn(
11995
+ theme.slots.controlBase,
11996
+ "flex min-h-9 cursor-pointer flex-wrap items-center gap-1.5 py-1.5 pr-9 text-left",
11997
+ disabled && "!cursor-not-allowed",
11998
+ classNames?.control
11999
+ ),
12000
+ onClick: () => setOpen(!open),
12001
+ onKeyDown: handleKeyDown,
12002
+ children: /* @__PURE__ */ jsxRuntime.jsxs(
12003
+ "span",
12004
+ {
12005
+ className: cn(
12006
+ "flex min-w-0 flex-1 flex-wrap items-center gap-1.5",
12007
+ classNames?.tagList
12008
+ ),
12009
+ children: [
12010
+ visibleOptions.map((option) => /* @__PURE__ */ jsxRuntime.jsxs(
12011
+ "span",
12012
+ {
12013
+ className: cn(
12014
+ "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",
12015
+ classNames?.tag
12016
+ ),
12017
+ children: [
12018
+ /* @__PURE__ */ jsxRuntime.jsx(
12019
+ "span",
12020
+ {
12021
+ className: cn(
12022
+ "max-w-40 truncate",
12023
+ classNames?.tagLabel
12024
+ ),
12025
+ children: option.label
12026
+ }
12027
+ ),
12028
+ /* @__PURE__ */ jsxRuntime.jsx(
12029
+ "button",
12030
+ {
12031
+ type: "button",
12032
+ "aria-label": removeLabel(option),
12033
+ disabled,
12034
+ className: cn(
12035
+ "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",
12036
+ classNames?.tagRemove
12037
+ ),
12038
+ onClick: (event) => {
12039
+ event.preventDefault();
12040
+ event.stopPropagation();
12041
+ removeOption(option);
12042
+ },
12043
+ onMouseDown: (event) => {
12044
+ event.preventDefault();
12045
+ event.stopPropagation();
12046
+ },
12047
+ onKeyDown: (event) => event.stopPropagation(),
12048
+ children: /* @__PURE__ */ jsxRuntime.jsx("span", { "aria-hidden": "true", children: "x" })
12049
+ }
12050
+ )
12051
+ ]
12052
+ },
12053
+ option.value
12054
+ )),
12055
+ overflowCount > 0 ? /* @__PURE__ */ jsxRuntime.jsxs(
12056
+ "span",
12057
+ {
12058
+ className: cn(
12059
+ "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",
12060
+ classNames?.tag
12061
+ ),
12062
+ children: [
12063
+ "+",
12064
+ overflowCount
12065
+ ]
12066
+ }
12067
+ ) : null,
12068
+ isPlaceholder ? /* @__PURE__ */ jsxRuntime.jsx(
12069
+ "span",
12070
+ {
12071
+ className: cn(
12072
+ "min-w-0 truncate",
12073
+ theme.slots.selectPlaceholder,
12074
+ classNames?.placeholder
12075
+ ),
12076
+ children: placeholder
12077
+ }
12078
+ ) : null
12079
+ ]
12080
+ }
12081
+ )
12082
+ }
12083
+ ),
12084
+ /* @__PURE__ */ jsxRuntime.jsx(
12085
+ "span",
12086
+ {
12087
+ className: cn(
12088
+ theme.slots.selectChevron,
12089
+ open && "rotate-[225deg]",
12090
+ classNames?.chevron
12091
+ )
12092
+ }
12093
+ ),
12094
+ name ? selectedValues.map((selectedValue) => /* @__PURE__ */ jsxRuntime.jsx(
12095
+ "input",
12096
+ {
12097
+ type: "hidden",
12098
+ name,
12099
+ value: selectedValue,
12100
+ className: classNames?.hiddenInput
12101
+ },
12102
+ selectedValue
12103
+ )) : null,
12104
+ open ? /* @__PURE__ */ jsxRuntime.jsx(
12105
+ "div",
12106
+ {
12107
+ id: listboxId,
12108
+ role: "listbox",
12109
+ "aria-multiselectable": "true",
12110
+ "aria-labelledby": controlId,
12111
+ className: cn(theme.slots.selectMenu, classNames?.menu),
12112
+ style: theme.styles.selectMenu,
12113
+ children: optionList.length > 0 ? optionList.map((option, index) => {
12114
+ const selected = selectedValueSet.has(option.value);
12115
+ const active = index === resolvedActiveIndex;
12116
+ return /* @__PURE__ */ jsxRuntime.jsxs(
12117
+ "button",
12118
+ {
12119
+ type: "button",
12120
+ role: "option",
12121
+ "aria-selected": selected,
12122
+ disabled: option.disabled,
12123
+ className: cn(
12124
+ theme.slots.selectOption,
12125
+ "gap-2",
12126
+ active && theme.slots.selectOptionActive,
12127
+ selected && theme.slots.selectOptionSelected,
12128
+ option.disabled && theme.slots.selectOptionDisabled,
12129
+ classNames?.option
12130
+ ),
12131
+ style: {
12132
+ ...theme.styles.selectOption,
12133
+ ...active ? theme.styles.selectOptionActive : void 0,
12134
+ ...selected ? theme.styles.selectOptionSelected : void 0
12135
+ },
12136
+ onMouseEnter: () => {
12137
+ if (!option.disabled) {
12138
+ setActiveIndex(index);
12139
+ }
12140
+ },
12141
+ onMouseDown: (event) => event.preventDefault(),
12142
+ onClick: () => toggleOption(option),
12143
+ children: [
12144
+ /* @__PURE__ */ jsxRuntime.jsx(
12145
+ "span",
12146
+ {
12147
+ "aria-hidden": "true",
12148
+ className: cn(
12149
+ "inline-flex h-4 w-4 shrink-0 items-center justify-center rounded-sm border border-border/70 text-[10px]",
12150
+ selected && "border-primary/40 bg-primary text-primary-foreground",
12151
+ classNames?.optionIndicator
12152
+ ),
12153
+ children: selected ? "\u2713" : null
12154
+ }
12155
+ ),
12156
+ /* @__PURE__ */ jsxRuntime.jsx(
12157
+ "span",
12158
+ {
12159
+ className: cn(
12160
+ "min-w-0 flex-1 truncate",
12161
+ classNames?.optionLabel
12162
+ ),
12163
+ children: option.label
12164
+ }
12165
+ )
12166
+ ]
12167
+ },
12168
+ option.value
12169
+ );
12170
+ }) : /* @__PURE__ */ jsxRuntime.jsx(
12171
+ "div",
12172
+ {
12173
+ className: cn(
12174
+ "px-2.5 py-2 text-sm text-muted-foreground",
12175
+ classNames?.empty
12176
+ ),
12177
+ children: emptyLabel
12178
+ }
12179
+ )
12180
+ }
12181
+ ) : null
12182
+ ]
12183
+ }
12184
+ );
12185
+ }
12186
+ );
11745
12187
  function BaseNotice({
11746
12188
  tone,
11747
12189
  icon,
@@ -12143,7 +12585,7 @@ function getInitialValue2(options, defaultValue) {
12143
12585
  }
12144
12586
  return "";
12145
12587
  }
12146
- function getNextEnabledIndex(options, currentIndex, direction) {
12588
+ function getNextEnabledIndex2(options, currentIndex, direction) {
12147
12589
  if (!options.length) return -1;
12148
12590
  for (let offset = 1; offset <= options.length; offset += 1) {
12149
12591
  const nextIndex = (currentIndex + offset * direction + options.length) % options.length;
@@ -12245,7 +12687,7 @@ var BaseSelect = React.forwardRef(
12245
12687
  };
12246
12688
  const focusOption = (direction) => {
12247
12689
  const currentIndex = activeIndex >= 0 ? activeIndex : 0;
12248
- const nextIndex = getNextEnabledIndex(optionList, currentIndex, direction);
12690
+ const nextIndex = getNextEnabledIndex2(optionList, currentIndex, direction);
12249
12691
  if (nextIndex >= 0) {
12250
12692
  commitValue(optionList[nextIndex].value, optionList[nextIndex].disabled);
12251
12693
  }
@@ -24475,6 +24917,7 @@ exports.BaseLayoutPane = BaseLayoutPane;
24475
24917
  exports.BaseLayoutResizeHandle = BaseLayoutResizeHandle;
24476
24918
  exports.BaseLayoutSplit = BaseLayoutSplit;
24477
24919
  exports.BaseLoadingState = BaseLoadingState;
24920
+ exports.BaseMultiSelect = BaseMultiSelect;
24478
24921
  exports.BaseNotice = BaseNotice;
24479
24922
  exports.BasePagination = BasePagination;
24480
24923
  exports.BasePanel = BasePanel;