@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
package/dist/index.js CHANGED
@@ -11743,6 +11743,448 @@ function BaseLoadingState({
11743
11743
  }
11744
11744
  );
11745
11745
  }
11746
+ function normalizeValues(values) {
11747
+ const nextValues = [];
11748
+ const seen = /* @__PURE__ */ new Set();
11749
+ values?.forEach((value) => {
11750
+ if (seen.has(value)) return;
11751
+ seen.add(value);
11752
+ nextValues.push(value);
11753
+ });
11754
+ return nextValues;
11755
+ }
11756
+ function getNextEnabledIndex(options, currentIndex, direction) {
11757
+ if (!options.length) return -1;
11758
+ const startIndex = currentIndex >= 0 ? currentIndex : 0;
11759
+ for (let offset = 1; offset <= options.length; offset += 1) {
11760
+ const nextIndex = (startIndex + offset * direction + options.length) % options.length;
11761
+ if (!options[nextIndex]?.disabled) {
11762
+ return nextIndex;
11763
+ }
11764
+ }
11765
+ return -1;
11766
+ }
11767
+ function getFirstEnabledIndex(options) {
11768
+ return options.findIndex((option) => !option.disabled);
11769
+ }
11770
+ function getSafeTagCount(maxTagCount, total) {
11771
+ if (maxTagCount === void 0) return total;
11772
+ if (!Number.isFinite(maxTagCount)) return total;
11773
+ return Math.max(0, Math.min(total, Math.floor(maxTagCount)));
11774
+ }
11775
+ function getDefaultRemoveLabel(option) {
11776
+ return `Remove ${option.value}`;
11777
+ }
11778
+ var BaseMultiSelect = React.forwardRef(
11779
+ function BaseMultiSelect2({
11780
+ options,
11781
+ value,
11782
+ defaultValue,
11783
+ name,
11784
+ placeholder = "Select options",
11785
+ icon,
11786
+ invalid = false,
11787
+ disabled = false,
11788
+ required = false,
11789
+ openForPreview = false,
11790
+ maxTagCount,
11791
+ removeLabel = getDefaultRemoveLabel,
11792
+ emptyLabel = "No options",
11793
+ appearance,
11794
+ className,
11795
+ classNames,
11796
+ style,
11797
+ id,
11798
+ "aria-invalid": nativeAriaInvalid,
11799
+ "aria-label": nativeAriaLabel,
11800
+ "aria-labelledby": nativeAriaLabelledBy,
11801
+ onValueChange,
11802
+ ...rootProps
11803
+ }, ref) {
11804
+ const theme = resolveBaseAppearance(appearance);
11805
+ const generatedId = React.useId();
11806
+ const multiSelectId = id ?? generatedId;
11807
+ const controlId = `${multiSelectId}-control`;
11808
+ const listboxId = `${multiSelectId}-listbox`;
11809
+ const rootRef = React.useRef(null);
11810
+ const optionList = options ?? [];
11811
+ const forceOpen = openForPreview;
11812
+ const [uncontrolledOpen, setUncontrolledOpen] = React.useState(false);
11813
+ const open = forceOpen || uncontrolledOpen;
11814
+ const [uncontrolledValue, setUncontrolledValue] = React.useState(
11815
+ () => normalizeValues(defaultValue)
11816
+ );
11817
+ const [activeIndex, setActiveIndex] = React.useState(
11818
+ () => getFirstEnabledIndex(optionList)
11819
+ );
11820
+ const isControlled = value !== void 0;
11821
+ const selectedValues = React.useMemo(
11822
+ () => normalizeValues(isControlled ? value : uncontrolledValue),
11823
+ [isControlled, uncontrolledValue, value]
11824
+ );
11825
+ const selectedValueSet = React.useMemo(
11826
+ () => new Set(selectedValues),
11827
+ [selectedValues]
11828
+ );
11829
+ const optionByValue = React.useMemo(() => {
11830
+ const map = /* @__PURE__ */ new Map();
11831
+ optionList.forEach((option) => {
11832
+ if (!map.has(option.value)) {
11833
+ map.set(option.value, option);
11834
+ }
11835
+ });
11836
+ return map;
11837
+ }, [optionList]);
11838
+ const selectedOptions = React.useMemo(
11839
+ () => selectedValues.map((selectedValue) => optionByValue.get(selectedValue)).filter(
11840
+ (option) => option !== void 0
11841
+ ),
11842
+ [optionByValue, selectedValues]
11843
+ );
11844
+ const firstEnabledIndex = React.useMemo(
11845
+ () => getFirstEnabledIndex(optionList),
11846
+ [optionList]
11847
+ );
11848
+ const resolvedActiveIndex = activeIndex >= 0 && !optionList[activeIndex]?.disabled ? activeIndex : firstEnabledIndex;
11849
+ const visibleTagCount = getSafeTagCount(
11850
+ maxTagCount,
11851
+ selectedOptions.length
11852
+ );
11853
+ const visibleOptions = selectedOptions.slice(0, visibleTagCount);
11854
+ const overflowCount = selectedOptions.length - visibleOptions.length;
11855
+ const isPlaceholder = selectedOptions.length === 0;
11856
+ const setRootRef = (node) => {
11857
+ rootRef.current = node;
11858
+ if (typeof ref === "function") {
11859
+ ref(node);
11860
+ } else if (ref) {
11861
+ ref.current = node;
11862
+ }
11863
+ };
11864
+ const setOpen = (nextOpen) => {
11865
+ if (disabled || forceOpen) return;
11866
+ setUncontrolledOpen(nextOpen);
11867
+ if (nextOpen) {
11868
+ setActiveIndex(resolvedActiveIndex);
11869
+ }
11870
+ };
11871
+ React.useEffect(() => {
11872
+ if (!open || forceOpen) return void 0;
11873
+ const handlePointerDown = (event) => {
11874
+ if (!rootRef.current?.contains(event.target)) {
11875
+ setUncontrolledOpen(false);
11876
+ }
11877
+ };
11878
+ document.addEventListener("pointerdown", handlePointerDown);
11879
+ return () => {
11880
+ document.removeEventListener("pointerdown", handlePointerDown);
11881
+ };
11882
+ }, [forceOpen, open]);
11883
+ React.useEffect(() => {
11884
+ if (resolvedActiveIndex >= 0 && resolvedActiveIndex !== activeIndex) {
11885
+ setActiveIndex(resolvedActiveIndex);
11886
+ }
11887
+ }, [activeIndex, resolvedActiveIndex]);
11888
+ const commitValues = (nextValues) => {
11889
+ const normalizedValues = normalizeValues(nextValues);
11890
+ if (!isControlled) {
11891
+ setUncontrolledValue(normalizedValues);
11892
+ }
11893
+ onValueChange?.(normalizedValues);
11894
+ };
11895
+ const toggleOption = (option) => {
11896
+ if (!option || option.disabled || disabled) return;
11897
+ const nextValues = selectedValueSet.has(option.value) ? selectedValues.filter((selectedValue) => selectedValue !== option.value) : [...selectedValues, option.value];
11898
+ commitValues(nextValues);
11899
+ };
11900
+ const removeOption = (option) => {
11901
+ if (disabled) return;
11902
+ commitValues(
11903
+ selectedValues.filter((selectedValue) => selectedValue !== option.value)
11904
+ );
11905
+ };
11906
+ const focusOption = (direction) => {
11907
+ const nextIndex = getNextEnabledIndex(
11908
+ optionList,
11909
+ resolvedActiveIndex,
11910
+ direction
11911
+ );
11912
+ if (nextIndex >= 0) {
11913
+ setActiveIndex(nextIndex);
11914
+ }
11915
+ };
11916
+ const handleKeyDown = (event) => {
11917
+ if (disabled) return;
11918
+ if (event.key === "ArrowDown" || event.key === "ArrowUp") {
11919
+ event.preventDefault();
11920
+ if (!open) {
11921
+ setOpen(true);
11922
+ setActiveIndex(firstEnabledIndex);
11923
+ return;
11924
+ }
11925
+ focusOption(event.key === "ArrowDown" ? 1 : -1);
11926
+ return;
11927
+ }
11928
+ if (event.key === "Home") {
11929
+ event.preventDefault();
11930
+ setOpen(true);
11931
+ setActiveIndex(firstEnabledIndex);
11932
+ return;
11933
+ }
11934
+ if (event.key === "End") {
11935
+ event.preventDefault();
11936
+ setOpen(true);
11937
+ for (let index = optionList.length - 1; index >= 0; index -= 1) {
11938
+ if (!optionList[index]?.disabled) {
11939
+ setActiveIndex(index);
11940
+ break;
11941
+ }
11942
+ }
11943
+ return;
11944
+ }
11945
+ if (event.key === "Enter" || event.key === " ") {
11946
+ event.preventDefault();
11947
+ if (!open) {
11948
+ setOpen(true);
11949
+ return;
11950
+ }
11951
+ toggleOption(optionList[resolvedActiveIndex]);
11952
+ return;
11953
+ }
11954
+ if (event.key === "Escape") {
11955
+ setOpen(false);
11956
+ }
11957
+ };
11958
+ return /* @__PURE__ */ jsxRuntime.jsxs(
11959
+ "div",
11960
+ {
11961
+ ...rootProps,
11962
+ id,
11963
+ ref: setRootRef,
11964
+ className: cn(
11965
+ theme.slots.controlWrapper,
11966
+ "overflow-visible",
11967
+ open && "z-50",
11968
+ invalid && theme.slots.controlInvalid,
11969
+ disabled && theme.slots.controlDisabled,
11970
+ classNames?.root,
11971
+ className
11972
+ ),
11973
+ style: {
11974
+ ...theme.styles.control,
11975
+ ...invalid ? theme.styles.controlInvalid : void 0,
11976
+ ...disabled ? theme.styles.controlDisabled : void 0,
11977
+ ...style
11978
+ },
11979
+ children: [
11980
+ hasRenderableNode(icon) ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: cn(theme.slots.controlIcon, classNames?.icon), children: icon }) : null,
11981
+ /* @__PURE__ */ jsxRuntime.jsx(
11982
+ "div",
11983
+ {
11984
+ id: controlId,
11985
+ role: "combobox",
11986
+ tabIndex: disabled ? -1 : 0,
11987
+ "aria-haspopup": "listbox",
11988
+ "aria-expanded": open,
11989
+ "aria-controls": listboxId,
11990
+ "aria-disabled": disabled || void 0,
11991
+ "aria-required": required || void 0,
11992
+ "aria-invalid": nativeAriaInvalid ?? (invalid || void 0),
11993
+ "aria-label": nativeAriaLabel,
11994
+ "aria-labelledby": nativeAriaLabelledBy,
11995
+ className: cn(
11996
+ theme.slots.controlBase,
11997
+ "flex min-h-9 cursor-pointer flex-wrap items-center gap-1.5 py-1.5 pr-9 text-left",
11998
+ disabled && "!cursor-not-allowed",
11999
+ classNames?.control
12000
+ ),
12001
+ onClick: () => setOpen(!open),
12002
+ onKeyDown: handleKeyDown,
12003
+ children: /* @__PURE__ */ jsxRuntime.jsxs(
12004
+ "span",
12005
+ {
12006
+ className: cn(
12007
+ "flex min-w-0 flex-1 flex-wrap items-center gap-1.5",
12008
+ classNames?.tagList
12009
+ ),
12010
+ children: [
12011
+ visibleOptions.map((option) => /* @__PURE__ */ jsxRuntime.jsxs(
12012
+ "span",
12013
+ {
12014
+ className: cn(
12015
+ "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",
12016
+ classNames?.tag
12017
+ ),
12018
+ children: [
12019
+ /* @__PURE__ */ jsxRuntime.jsx(
12020
+ "span",
12021
+ {
12022
+ className: cn(
12023
+ "max-w-40 truncate",
12024
+ classNames?.tagLabel
12025
+ ),
12026
+ children: option.label
12027
+ }
12028
+ ),
12029
+ /* @__PURE__ */ jsxRuntime.jsx(
12030
+ "button",
12031
+ {
12032
+ type: "button",
12033
+ "aria-label": removeLabel(option),
12034
+ disabled,
12035
+ className: cn(
12036
+ "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",
12037
+ classNames?.tagRemove
12038
+ ),
12039
+ onClick: (event) => {
12040
+ event.preventDefault();
12041
+ event.stopPropagation();
12042
+ removeOption(option);
12043
+ },
12044
+ onMouseDown: (event) => {
12045
+ event.preventDefault();
12046
+ event.stopPropagation();
12047
+ },
12048
+ onKeyDown: (event) => event.stopPropagation(),
12049
+ children: /* @__PURE__ */ jsxRuntime.jsx("span", { "aria-hidden": "true", children: "x" })
12050
+ }
12051
+ )
12052
+ ]
12053
+ },
12054
+ option.value
12055
+ )),
12056
+ overflowCount > 0 ? /* @__PURE__ */ jsxRuntime.jsxs(
12057
+ "span",
12058
+ {
12059
+ className: cn(
12060
+ "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",
12061
+ classNames?.tag
12062
+ ),
12063
+ children: [
12064
+ "+",
12065
+ overflowCount
12066
+ ]
12067
+ }
12068
+ ) : null,
12069
+ isPlaceholder ? /* @__PURE__ */ jsxRuntime.jsx(
12070
+ "span",
12071
+ {
12072
+ className: cn(
12073
+ "min-w-0 truncate",
12074
+ theme.slots.selectPlaceholder,
12075
+ classNames?.placeholder
12076
+ ),
12077
+ children: placeholder
12078
+ }
12079
+ ) : null
12080
+ ]
12081
+ }
12082
+ )
12083
+ }
12084
+ ),
12085
+ /* @__PURE__ */ jsxRuntime.jsx(
12086
+ "span",
12087
+ {
12088
+ className: cn(
12089
+ theme.slots.selectChevron,
12090
+ open && "rotate-[225deg]",
12091
+ classNames?.chevron
12092
+ )
12093
+ }
12094
+ ),
12095
+ name ? selectedValues.map((selectedValue) => /* @__PURE__ */ jsxRuntime.jsx(
12096
+ "input",
12097
+ {
12098
+ type: "hidden",
12099
+ name,
12100
+ value: selectedValue,
12101
+ className: classNames?.hiddenInput
12102
+ },
12103
+ selectedValue
12104
+ )) : null,
12105
+ open ? /* @__PURE__ */ jsxRuntime.jsx(
12106
+ "div",
12107
+ {
12108
+ id: listboxId,
12109
+ role: "listbox",
12110
+ "aria-multiselectable": "true",
12111
+ "aria-labelledby": controlId,
12112
+ className: cn(theme.slots.selectMenu, classNames?.menu),
12113
+ style: theme.styles.selectMenu,
12114
+ children: optionList.length > 0 ? optionList.map((option, index) => {
12115
+ const selected = selectedValueSet.has(option.value);
12116
+ const active = index === resolvedActiveIndex;
12117
+ return /* @__PURE__ */ jsxRuntime.jsxs(
12118
+ "button",
12119
+ {
12120
+ type: "button",
12121
+ role: "option",
12122
+ "aria-selected": selected,
12123
+ disabled: option.disabled,
12124
+ className: cn(
12125
+ theme.slots.selectOption,
12126
+ "gap-2",
12127
+ active && theme.slots.selectOptionActive,
12128
+ selected && theme.slots.selectOptionSelected,
12129
+ option.disabled && theme.slots.selectOptionDisabled,
12130
+ classNames?.option
12131
+ ),
12132
+ style: {
12133
+ ...theme.styles.selectOption,
12134
+ ...active ? theme.styles.selectOptionActive : void 0,
12135
+ ...selected ? theme.styles.selectOptionSelected : void 0
12136
+ },
12137
+ onMouseEnter: () => {
12138
+ if (!option.disabled) {
12139
+ setActiveIndex(index);
12140
+ }
12141
+ },
12142
+ onMouseDown: (event) => event.preventDefault(),
12143
+ onClick: () => toggleOption(option),
12144
+ children: [
12145
+ /* @__PURE__ */ jsxRuntime.jsx(
12146
+ "span",
12147
+ {
12148
+ "aria-hidden": "true",
12149
+ className: cn(
12150
+ "inline-flex h-4 w-4 shrink-0 items-center justify-center rounded-sm border border-border/70 text-[10px]",
12151
+ selected && "border-primary/40 bg-primary text-primary-foreground",
12152
+ classNames?.optionIndicator
12153
+ ),
12154
+ children: selected ? "\u2713" : null
12155
+ }
12156
+ ),
12157
+ /* @__PURE__ */ jsxRuntime.jsx(
12158
+ "span",
12159
+ {
12160
+ className: cn(
12161
+ "min-w-0 flex-1 truncate",
12162
+ classNames?.optionLabel
12163
+ ),
12164
+ children: option.label
12165
+ }
12166
+ )
12167
+ ]
12168
+ },
12169
+ option.value
12170
+ );
12171
+ }) : /* @__PURE__ */ jsxRuntime.jsx(
12172
+ "div",
12173
+ {
12174
+ className: cn(
12175
+ "px-2.5 py-2 text-sm text-muted-foreground",
12176
+ classNames?.empty
12177
+ ),
12178
+ children: emptyLabel
12179
+ }
12180
+ )
12181
+ }
12182
+ ) : null
12183
+ ]
12184
+ }
12185
+ );
12186
+ }
12187
+ );
11746
12188
  function BaseNotice({
11747
12189
  tone,
11748
12190
  icon,
@@ -12144,7 +12586,7 @@ function getInitialValue2(options, defaultValue) {
12144
12586
  }
12145
12587
  return "";
12146
12588
  }
12147
- function getNextEnabledIndex(options, currentIndex, direction) {
12589
+ function getNextEnabledIndex2(options, currentIndex, direction) {
12148
12590
  if (!options.length) return -1;
12149
12591
  for (let offset = 1; offset <= options.length; offset += 1) {
12150
12592
  const nextIndex = (currentIndex + offset * direction + options.length) % options.length;
@@ -12246,7 +12688,7 @@ var BaseSelect = React.forwardRef(
12246
12688
  };
12247
12689
  const focusOption = (direction) => {
12248
12690
  const currentIndex = activeIndex >= 0 ? activeIndex : 0;
12249
- const nextIndex = getNextEnabledIndex(optionList, currentIndex, direction);
12691
+ const nextIndex = getNextEnabledIndex2(optionList, currentIndex, direction);
12250
12692
  if (nextIndex >= 0) {
12251
12693
  commitValue(optionList[nextIndex].value, optionList[nextIndex].disabled);
12252
12694
  }
@@ -19931,6 +20373,265 @@ registerTheme(
19931
20373
  version: "1.0.0"
19932
20374
  }
19933
20375
  );
20376
+ var LOGIN_LOGO_POSITIONS = ["top", "middle", "bottom"];
20377
+ var normalizeCssValue = (value) => {
20378
+ const trimmed = value?.trim();
20379
+ return trimmed || void 0;
20380
+ };
20381
+ var createBackgroundImage = (gradient, imageUrl) => {
20382
+ const resolvedGradient = normalizeCssValue(gradient);
20383
+ const resolvedImageUrl = normalizeCssValue(imageUrl);
20384
+ return [resolvedGradient, resolvedImageUrl ? `url(${JSON.stringify(resolvedImageUrl)})` : void 0].filter(Boolean).join(", ");
20385
+ };
20386
+ var normalizeLogoPosition = (position) => position && LOGIN_LOGO_POSITIONS.includes(position) ? position : "bottom";
20387
+ var normalizeLogoScale = (scale) => typeof scale === "number" && Number.isFinite(scale) && scale > 0 ? scale : void 0;
20388
+ function LoginPage({
20389
+ className,
20390
+ style,
20391
+ background,
20392
+ logo,
20393
+ primaryColor,
20394
+ radius,
20395
+ customCss,
20396
+ toolbar,
20397
+ title,
20398
+ backAction,
20399
+ methods,
20400
+ activeMethodId,
20401
+ defaultMethodId,
20402
+ onMethodChange,
20403
+ externalLabel,
20404
+ externalMethods = [],
20405
+ callout
20406
+ }) {
20407
+ const availableMethods = React.useMemo(() => methods.filter((method) => !method.hidden), [methods]);
20408
+ const fallbackMethodId = defaultMethodId ?? availableMethods[0]?.id;
20409
+ const [internalMethodId, setInternalMethodId] = React.useState(fallbackMethodId);
20410
+ const currentMethodId = activeMethodId ?? internalMethodId;
20411
+ const activeMethod = availableMethods.find((method) => method.id === currentMethodId) ?? availableMethods[0];
20412
+ const hasTabs = availableMethods.length > 1;
20413
+ const backgroundImage = createBackgroundImage(background?.gradient, background?.imageUrl);
20414
+ const backgroundMode = backgroundImage ? "custom" : "default";
20415
+ const logoPosition = normalizeLogoPosition(logo?.position);
20416
+ const logoScale = normalizeLogoScale(logo?.scale);
20417
+ React.useEffect(() => {
20418
+ if (!availableMethods.length) {
20419
+ setInternalMethodId(void 0);
20420
+ return;
20421
+ }
20422
+ if (!currentMethodId || !availableMethods.some((method) => method.id === currentMethodId)) {
20423
+ setInternalMethodId(fallbackMethodId ?? availableMethods[0]?.id);
20424
+ }
20425
+ }, [availableMethods, currentMethodId, fallbackMethodId]);
20426
+ const rootStyle = React.useMemo(
20427
+ () => ({
20428
+ ...primaryColor ? { ["--login-page-theme-primary-color"]: primaryColor } : null,
20429
+ ...radius ? { ["--login-page-theme-radius"]: radius } : null,
20430
+ ...style
20431
+ }),
20432
+ [primaryColor, radius, style]
20433
+ );
20434
+ const handleMethodChange = (methodId) => {
20435
+ if (activeMethodId === void 0) {
20436
+ setInternalMethodId(methodId);
20437
+ }
20438
+ onMethodChange?.(methodId);
20439
+ };
20440
+ const renderExternalMethod = (method) => {
20441
+ const button = /* @__PURE__ */ jsxRuntime.jsxs(
20442
+ "button",
20443
+ {
20444
+ type: "button",
20445
+ className: "login-page__oauth-button",
20446
+ "data-login-part": "external-button",
20447
+ "data-login-method-id": method.id,
20448
+ onClick: method.onClick,
20449
+ disabled: method.disabled,
20450
+ children: [
20451
+ method.icon ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "login-page__oauth-icon", "data-login-part": "external-icon", children: method.icon }) : null,
20452
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: method.label })
20453
+ ]
20454
+ }
20455
+ );
20456
+ return /* @__PURE__ */ jsxRuntime.jsx(React__default.default.Fragment, { children: method.render ? method.render(button) : button }, method.id);
20457
+ };
20458
+ return /* @__PURE__ */ jsxRuntime.jsxs(
20459
+ "main",
20460
+ {
20461
+ className: ["login-page", className].filter(Boolean).join(" "),
20462
+ "data-login-page": true,
20463
+ "data-login-part": "root",
20464
+ "data-login-background": backgroundMode,
20465
+ style: rootStyle,
20466
+ children: [
20467
+ customCss ? /* @__PURE__ */ jsxRuntime.jsx("style", { "data-login-page-custom-css": true, children: customCss }) : null,
20468
+ /* @__PURE__ */ jsxRuntime.jsx(
20469
+ "div",
20470
+ {
20471
+ className: "login-page__background",
20472
+ "data-login-part": "background",
20473
+ "data-login-background": backgroundMode,
20474
+ style: backgroundImage ? { backgroundImage } : void 0,
20475
+ "aria-hidden": "true"
20476
+ }
20477
+ ),
20478
+ toolbar ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "login-page__toolbar", "data-login-part": "toolbar", children: toolbar }) : null,
20479
+ logo?.url ? /* @__PURE__ */ jsxRuntime.jsx(
20480
+ "div",
20481
+ {
20482
+ className: `login-page__logo login-page__logo--${logoPosition}`,
20483
+ "data-login-part": "logo",
20484
+ "data-logo-position": logoPosition,
20485
+ children: /* @__PURE__ */ jsxRuntime.jsx(
20486
+ "img",
20487
+ {
20488
+ className: "login-page__logo-image",
20489
+ "data-login-part": "logo-image",
20490
+ src: logo.url,
20491
+ alt: logo.alt ?? "",
20492
+ style: logoScale ? { transform: `scale(${logoScale})` } : void 0
20493
+ }
20494
+ )
20495
+ }
20496
+ ) : null,
20497
+ /* @__PURE__ */ jsxRuntime.jsxs(
20498
+ "section",
20499
+ {
20500
+ className: "login-page__form",
20501
+ "data-login-part": "panel",
20502
+ "aria-label": typeof title === "string" ? title : void 0,
20503
+ children: [
20504
+ backAction ? /* @__PURE__ */ jsxRuntime.jsxs("button", { type: "button", className: "login-page__back", "data-login-part": "back", onClick: backAction.onClick, children: [
20505
+ backAction.icon ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "login-page__back-icon", "data-login-part": "back-icon", children: backAction.icon }) : null,
20506
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: backAction.label })
20507
+ ] }) : null,
20508
+ title ? /* @__PURE__ */ jsxRuntime.jsx("h1", { className: "login-page__title", "data-login-part": "title", children: title }) : null,
20509
+ hasTabs ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "login-page__tabs", "data-login-part": "tabs", role: "tablist", children: availableMethods.map((method) => {
20510
+ const selected = method.id === activeMethod?.id;
20511
+ return /* @__PURE__ */ jsxRuntime.jsxs(
20512
+ "button",
20513
+ {
20514
+ type: "button",
20515
+ role: "tab",
20516
+ "aria-selected": selected,
20517
+ className: `login-page__tab ${selected ? "login-page__tab--active" : ""}`,
20518
+ "data-login-part": "tab",
20519
+ "data-login-method-id": method.id,
20520
+ "data-active": selected ? "true" : "false",
20521
+ onClick: () => handleMethodChange(method.id),
20522
+ children: [
20523
+ method.icon ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "login-page__tab-icon", "data-login-part": "tab-icon", children: method.icon }) : null,
20524
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: method.label })
20525
+ ]
20526
+ },
20527
+ method.id
20528
+ );
20529
+ }) }) : null,
20530
+ activeMethod ? /* @__PURE__ */ jsxRuntime.jsxs(
20531
+ "form",
20532
+ {
20533
+ className: "login-page__form-fields",
20534
+ "data-login-part": "form",
20535
+ "data-login-method-id": activeMethod.id,
20536
+ onSubmit: activeMethod.onSubmit,
20537
+ children: [
20538
+ activeMethod.fields.map((field) => /* @__PURE__ */ jsxRuntime.jsx("div", { className: "login-page__field", "data-login-part": "field", "data-login-field-name": field.name, children: /* @__PURE__ */ jsxRuntime.jsx(
20539
+ "input",
20540
+ {
20541
+ id: field.id,
20542
+ name: field.name,
20543
+ type: field.type ?? "text",
20544
+ value: field.value,
20545
+ placeholder: field.placeholder,
20546
+ autoComplete: field.autoComplete,
20547
+ inputMode: field.inputMode,
20548
+ maxLength: field.maxLength,
20549
+ pattern: field.pattern,
20550
+ disabled: activeMethod.disabled || activeMethod.isLoading || field.disabled,
20551
+ required: field.required,
20552
+ className: "login-page__input",
20553
+ "data-login-part": "input",
20554
+ onChange: (event) => field.onChange(event.target.value)
20555
+ }
20556
+ ) }, field.name)),
20557
+ activeMethod.checkbox ? /* @__PURE__ */ jsxRuntime.jsxs("label", { className: "login-page__remember", "data-login-part": "checkbox-label", htmlFor: activeMethod.checkbox.id, children: [
20558
+ /* @__PURE__ */ jsxRuntime.jsx(
20559
+ "input",
20560
+ {
20561
+ id: activeMethod.checkbox.id,
20562
+ type: "checkbox",
20563
+ className: "login-page__checkbox",
20564
+ "data-login-part": "checkbox",
20565
+ checked: activeMethod.checkbox.checked,
20566
+ disabled: activeMethod.disabled || activeMethod.isLoading || activeMethod.checkbox.disabled,
20567
+ onChange: (event) => activeMethod.checkbox?.onChange(event.target.checked)
20568
+ }
20569
+ ),
20570
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: activeMethod.checkbox.label })
20571
+ ] }) : null,
20572
+ activeMethod.footer || activeMethod.footerAction ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "login-page__method-footer", "data-login-part": "method-footer", children: [
20573
+ activeMethod.footer,
20574
+ activeMethod.footerAction ? /* @__PURE__ */ jsxRuntime.jsx(
20575
+ "button",
20576
+ {
20577
+ type: "button",
20578
+ className: "login-page__method-footer-action",
20579
+ "data-login-part": "method-footer-action",
20580
+ "data-login-method-id": activeMethod.id,
20581
+ onClick: activeMethod.footerAction.onClick,
20582
+ disabled: activeMethod.disabled || activeMethod.isLoading || activeMethod.footerAction.disabled,
20583
+ children: activeMethod.footerAction.label
20584
+ }
20585
+ ) : null
20586
+ ] }) : null,
20587
+ /* @__PURE__ */ jsxRuntime.jsx(
20588
+ "button",
20589
+ {
20590
+ type: "submit",
20591
+ className: "login-page__submit",
20592
+ "data-login-part": "submit-button",
20593
+ disabled: activeMethod.disabled || activeMethod.isLoading,
20594
+ children: activeMethod.isLoading && activeMethod.loadingLabel ? activeMethod.loadingLabel : activeMethod.submitLabel
20595
+ }
20596
+ )
20597
+ ]
20598
+ }
20599
+ ) : null,
20600
+ callout ? /* @__PURE__ */ jsxRuntime.jsxs(
20601
+ "div",
20602
+ {
20603
+ className: `login-page__callout login-page__callout--${callout.tone ?? "info"}`,
20604
+ "data-login-part": "callout",
20605
+ "data-tone": callout.tone ?? "info",
20606
+ children: [
20607
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "login-page__callout-title", "data-login-part": "callout-title", children: callout.title }),
20608
+ callout.description ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "login-page__callout-description", "data-login-part": "callout-description", children: callout.description }) : null,
20609
+ callout.detail ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "login-page__callout-detail", "data-login-part": "callout-detail", children: callout.detail }) : null,
20610
+ callout.action ? /* @__PURE__ */ jsxRuntime.jsx(
20611
+ "button",
20612
+ {
20613
+ type: "button",
20614
+ className: "login-page__callout-action",
20615
+ "data-login-part": "callout-action",
20616
+ onClick: callout.action.onClick,
20617
+ disabled: callout.action.disabled,
20618
+ children: callout.action.label
20619
+ }
20620
+ ) : null
20621
+ ]
20622
+ }
20623
+ ) : null,
20624
+ externalMethods.length ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "login-page__oauth-section", "data-login-part": "external-methods", children: [
20625
+ externalLabel ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "login-page__oauth-label", "data-login-part": "external-label", children: externalLabel }) : null,
20626
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "login-page__oauth-list", "data-login-part": "external-list", children: externalMethods.map(renderExternalMethod) })
20627
+ ] }) : null
20628
+ ]
20629
+ }
20630
+ )
20631
+ ]
20632
+ }
20633
+ );
20634
+ }
19934
20635
  var containerStyle = {
19935
20636
  display: "flex",
19936
20637
  alignItems: "center",
@@ -24740,6 +25441,7 @@ exports.BaseLayoutPane = BaseLayoutPane;
24740
25441
  exports.BaseLayoutResizeHandle = BaseLayoutResizeHandle;
24741
25442
  exports.BaseLayoutSplit = BaseLayoutSplit;
24742
25443
  exports.BaseLoadingState = BaseLoadingState;
25444
+ exports.BaseMultiSelect = BaseMultiSelect;
24743
25445
  exports.BaseNotice = BaseNotice;
24744
25446
  exports.BasePagination = BasePagination;
24745
25447
  exports.BasePanel = BasePanel;
@@ -24808,6 +25510,7 @@ exports.InteractiveTableEditableTextCell = InteractiveTableEditableTextCell;
24808
25510
  exports.InteractiveTableReadonlyCell = InteractiveTableReadonlyCell;
24809
25511
  exports.InteractiveTableSelectCell = InteractiveTableSelectCell;
24810
25512
  exports.LoginLayout = LoginLayout;
25513
+ exports.LoginPage = LoginPage;
24811
25514
  exports.MonkeysToastProvider = MonkeysToastProvider;
24812
25515
  exports.MonkeysToaster = MonkeysToaster;
24813
25516
  exports.NavButton = NavButton;