@inf-monkeys-tech/monkeys-design 0.4.36 → 0.4.38

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/index.mjs CHANGED
@@ -3,6 +3,8 @@ import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
3
3
  import * as ContextMenu from '@radix-ui/react-context-menu';
4
4
  import * as DropdownMenu3 from '@radix-ui/react-dropdown-menu';
5
5
  import { useSensors, useSensor, PointerSensor, DndContext, DragOverlay, useDroppable, useDraggable } from '@dnd-kit/core';
6
+ import '@dnd-kit/sortable';
7
+ import '@dnd-kit/utilities';
6
8
  import { toast as toast$1, Toaster } from 'sonner';
7
9
  import * as Tooltip from '@radix-ui/react-tooltip';
8
10
 
@@ -20346,6 +20348,265 @@ registerTheme(
20346
20348
  version: "1.0.0"
20347
20349
  }
20348
20350
  );
20351
+ var LOGIN_LOGO_POSITIONS = ["top", "middle", "bottom"];
20352
+ var normalizeCssValue = (value) => {
20353
+ const trimmed = value?.trim();
20354
+ return trimmed || void 0;
20355
+ };
20356
+ var createBackgroundImage = (gradient, imageUrl) => {
20357
+ const resolvedGradient = normalizeCssValue(gradient);
20358
+ const resolvedImageUrl = normalizeCssValue(imageUrl);
20359
+ return [resolvedGradient, resolvedImageUrl ? `url(${JSON.stringify(resolvedImageUrl)})` : void 0].filter(Boolean).join(", ");
20360
+ };
20361
+ var normalizeLogoPosition = (position) => position && LOGIN_LOGO_POSITIONS.includes(position) ? position : "bottom";
20362
+ var normalizeLogoScale = (scale) => typeof scale === "number" && Number.isFinite(scale) && scale > 0 ? scale : void 0;
20363
+ function LoginPage({
20364
+ className,
20365
+ style,
20366
+ background,
20367
+ logo,
20368
+ primaryColor,
20369
+ radius,
20370
+ customCss,
20371
+ toolbar,
20372
+ title,
20373
+ backAction,
20374
+ methods,
20375
+ activeMethodId,
20376
+ defaultMethodId,
20377
+ onMethodChange,
20378
+ externalLabel,
20379
+ externalMethods = [],
20380
+ callout
20381
+ }) {
20382
+ const availableMethods = useMemo(() => methods.filter((method) => !method.hidden), [methods]);
20383
+ const fallbackMethodId = defaultMethodId ?? availableMethods[0]?.id;
20384
+ const [internalMethodId, setInternalMethodId] = useState(fallbackMethodId);
20385
+ const currentMethodId = activeMethodId ?? internalMethodId;
20386
+ const activeMethod = availableMethods.find((method) => method.id === currentMethodId) ?? availableMethods[0];
20387
+ const hasTabs = availableMethods.length > 1;
20388
+ const backgroundImage = createBackgroundImage(background?.gradient, background?.imageUrl);
20389
+ const backgroundMode = backgroundImage ? "custom" : "default";
20390
+ const logoPosition = normalizeLogoPosition(logo?.position);
20391
+ const logoScale = normalizeLogoScale(logo?.scale);
20392
+ useEffect(() => {
20393
+ if (!availableMethods.length) {
20394
+ setInternalMethodId(void 0);
20395
+ return;
20396
+ }
20397
+ if (!currentMethodId || !availableMethods.some((method) => method.id === currentMethodId)) {
20398
+ setInternalMethodId(fallbackMethodId ?? availableMethods[0]?.id);
20399
+ }
20400
+ }, [availableMethods, currentMethodId, fallbackMethodId]);
20401
+ const rootStyle = useMemo(
20402
+ () => ({
20403
+ ...primaryColor ? { ["--login-page-theme-primary-color"]: primaryColor } : null,
20404
+ ...radius ? { ["--login-page-theme-radius"]: radius } : null,
20405
+ ...style
20406
+ }),
20407
+ [primaryColor, radius, style]
20408
+ );
20409
+ const handleMethodChange = (methodId) => {
20410
+ if (activeMethodId === void 0) {
20411
+ setInternalMethodId(methodId);
20412
+ }
20413
+ onMethodChange?.(methodId);
20414
+ };
20415
+ const renderExternalMethod = (method) => {
20416
+ const button = /* @__PURE__ */ jsxs(
20417
+ "button",
20418
+ {
20419
+ type: "button",
20420
+ className: "login-page__oauth-button",
20421
+ "data-login-part": "external-button",
20422
+ "data-login-method-id": method.id,
20423
+ onClick: method.onClick,
20424
+ disabled: method.disabled,
20425
+ children: [
20426
+ method.icon ? /* @__PURE__ */ jsx("span", { className: "login-page__oauth-icon", "data-login-part": "external-icon", children: method.icon }) : null,
20427
+ /* @__PURE__ */ jsx("span", { children: method.label })
20428
+ ]
20429
+ }
20430
+ );
20431
+ return /* @__PURE__ */ jsx(React.Fragment, { children: method.render ? method.render(button) : button }, method.id);
20432
+ };
20433
+ return /* @__PURE__ */ jsxs(
20434
+ "main",
20435
+ {
20436
+ className: ["login-page", className].filter(Boolean).join(" "),
20437
+ "data-login-page": true,
20438
+ "data-login-part": "root",
20439
+ "data-login-background": backgroundMode,
20440
+ style: rootStyle,
20441
+ children: [
20442
+ customCss ? /* @__PURE__ */ jsx("style", { "data-login-page-custom-css": true, children: customCss }) : null,
20443
+ /* @__PURE__ */ jsx(
20444
+ "div",
20445
+ {
20446
+ className: "login-page__background",
20447
+ "data-login-part": "background",
20448
+ "data-login-background": backgroundMode,
20449
+ style: backgroundImage ? { backgroundImage } : void 0,
20450
+ "aria-hidden": "true"
20451
+ }
20452
+ ),
20453
+ toolbar ? /* @__PURE__ */ jsx("div", { className: "login-page__toolbar", "data-login-part": "toolbar", children: toolbar }) : null,
20454
+ logo?.url ? /* @__PURE__ */ jsx(
20455
+ "div",
20456
+ {
20457
+ className: `login-page__logo login-page__logo--${logoPosition}`,
20458
+ "data-login-part": "logo",
20459
+ "data-logo-position": logoPosition,
20460
+ children: /* @__PURE__ */ jsx(
20461
+ "img",
20462
+ {
20463
+ className: "login-page__logo-image",
20464
+ "data-login-part": "logo-image",
20465
+ src: logo.url,
20466
+ alt: logo.alt ?? "",
20467
+ style: logoScale ? { transform: `scale(${logoScale})` } : void 0
20468
+ }
20469
+ )
20470
+ }
20471
+ ) : null,
20472
+ /* @__PURE__ */ jsxs(
20473
+ "section",
20474
+ {
20475
+ className: "login-page__form",
20476
+ "data-login-part": "panel",
20477
+ "aria-label": typeof title === "string" ? title : void 0,
20478
+ children: [
20479
+ backAction ? /* @__PURE__ */ jsxs("button", { type: "button", className: "login-page__back", "data-login-part": "back", onClick: backAction.onClick, children: [
20480
+ backAction.icon ? /* @__PURE__ */ jsx("span", { className: "login-page__back-icon", "data-login-part": "back-icon", children: backAction.icon }) : null,
20481
+ /* @__PURE__ */ jsx("span", { children: backAction.label })
20482
+ ] }) : null,
20483
+ title ? /* @__PURE__ */ jsx("h1", { className: "login-page__title", "data-login-part": "title", children: title }) : null,
20484
+ hasTabs ? /* @__PURE__ */ jsx("div", { className: "login-page__tabs", "data-login-part": "tabs", role: "tablist", children: availableMethods.map((method) => {
20485
+ const selected = method.id === activeMethod?.id;
20486
+ return /* @__PURE__ */ jsxs(
20487
+ "button",
20488
+ {
20489
+ type: "button",
20490
+ role: "tab",
20491
+ "aria-selected": selected,
20492
+ className: `login-page__tab ${selected ? "login-page__tab--active" : ""}`,
20493
+ "data-login-part": "tab",
20494
+ "data-login-method-id": method.id,
20495
+ "data-active": selected ? "true" : "false",
20496
+ onClick: () => handleMethodChange(method.id),
20497
+ children: [
20498
+ method.icon ? /* @__PURE__ */ jsx("span", { className: "login-page__tab-icon", "data-login-part": "tab-icon", children: method.icon }) : null,
20499
+ /* @__PURE__ */ jsx("span", { children: method.label })
20500
+ ]
20501
+ },
20502
+ method.id
20503
+ );
20504
+ }) }) : null,
20505
+ activeMethod ? /* @__PURE__ */ jsxs(
20506
+ "form",
20507
+ {
20508
+ className: "login-page__form-fields",
20509
+ "data-login-part": "form",
20510
+ "data-login-method-id": activeMethod.id,
20511
+ onSubmit: activeMethod.onSubmit,
20512
+ children: [
20513
+ activeMethod.fields.map((field) => /* @__PURE__ */ jsx("div", { className: "login-page__field", "data-login-part": "field", "data-login-field-name": field.name, children: /* @__PURE__ */ jsx(
20514
+ "input",
20515
+ {
20516
+ id: field.id,
20517
+ name: field.name,
20518
+ type: field.type ?? "text",
20519
+ value: field.value,
20520
+ placeholder: field.placeholder,
20521
+ autoComplete: field.autoComplete,
20522
+ inputMode: field.inputMode,
20523
+ maxLength: field.maxLength,
20524
+ pattern: field.pattern,
20525
+ disabled: activeMethod.disabled || activeMethod.isLoading || field.disabled,
20526
+ required: field.required,
20527
+ className: "login-page__input",
20528
+ "data-login-part": "input",
20529
+ onChange: (event) => field.onChange(event.target.value)
20530
+ }
20531
+ ) }, field.name)),
20532
+ activeMethod.checkbox ? /* @__PURE__ */ jsxs("label", { className: "login-page__remember", "data-login-part": "checkbox-label", htmlFor: activeMethod.checkbox.id, children: [
20533
+ /* @__PURE__ */ jsx(
20534
+ "input",
20535
+ {
20536
+ id: activeMethod.checkbox.id,
20537
+ type: "checkbox",
20538
+ className: "login-page__checkbox",
20539
+ "data-login-part": "checkbox",
20540
+ checked: activeMethod.checkbox.checked,
20541
+ disabled: activeMethod.disabled || activeMethod.isLoading || activeMethod.checkbox.disabled,
20542
+ onChange: (event) => activeMethod.checkbox?.onChange(event.target.checked)
20543
+ }
20544
+ ),
20545
+ /* @__PURE__ */ jsx("span", { children: activeMethod.checkbox.label })
20546
+ ] }) : null,
20547
+ activeMethod.footer || activeMethod.footerAction ? /* @__PURE__ */ jsxs("div", { className: "login-page__method-footer", "data-login-part": "method-footer", children: [
20548
+ activeMethod.footer,
20549
+ activeMethod.footerAction ? /* @__PURE__ */ jsx(
20550
+ "button",
20551
+ {
20552
+ type: "button",
20553
+ className: "login-page__method-footer-action",
20554
+ "data-login-part": "method-footer-action",
20555
+ "data-login-method-id": activeMethod.id,
20556
+ onClick: activeMethod.footerAction.onClick,
20557
+ disabled: activeMethod.disabled || activeMethod.isLoading || activeMethod.footerAction.disabled,
20558
+ children: activeMethod.footerAction.label
20559
+ }
20560
+ ) : null
20561
+ ] }) : null,
20562
+ /* @__PURE__ */ jsx(
20563
+ "button",
20564
+ {
20565
+ type: "submit",
20566
+ className: "login-page__submit",
20567
+ "data-login-part": "submit-button",
20568
+ disabled: activeMethod.disabled || activeMethod.isLoading,
20569
+ children: activeMethod.isLoading && activeMethod.loadingLabel ? activeMethod.loadingLabel : activeMethod.submitLabel
20570
+ }
20571
+ )
20572
+ ]
20573
+ }
20574
+ ) : null,
20575
+ callout ? /* @__PURE__ */ jsxs(
20576
+ "div",
20577
+ {
20578
+ className: `login-page__callout login-page__callout--${callout.tone ?? "info"}`,
20579
+ "data-login-part": "callout",
20580
+ "data-tone": callout.tone ?? "info",
20581
+ children: [
20582
+ /* @__PURE__ */ jsx("div", { className: "login-page__callout-title", "data-login-part": "callout-title", children: callout.title }),
20583
+ callout.description ? /* @__PURE__ */ jsx("p", { className: "login-page__callout-description", "data-login-part": "callout-description", children: callout.description }) : null,
20584
+ callout.detail ? /* @__PURE__ */ jsx("p", { className: "login-page__callout-detail", "data-login-part": "callout-detail", children: callout.detail }) : null,
20585
+ callout.action ? /* @__PURE__ */ jsx(
20586
+ "button",
20587
+ {
20588
+ type: "button",
20589
+ className: "login-page__callout-action",
20590
+ "data-login-part": "callout-action",
20591
+ onClick: callout.action.onClick,
20592
+ disabled: callout.action.disabled,
20593
+ children: callout.action.label
20594
+ }
20595
+ ) : null
20596
+ ]
20597
+ }
20598
+ ) : null,
20599
+ externalMethods.length ? /* @__PURE__ */ jsxs("div", { className: "login-page__oauth-section", "data-login-part": "external-methods", children: [
20600
+ externalLabel ? /* @__PURE__ */ jsx("div", { className: "login-page__oauth-label", "data-login-part": "external-label", children: externalLabel }) : null,
20601
+ /* @__PURE__ */ jsx("div", { className: "login-page__oauth-list", "data-login-part": "external-list", children: externalMethods.map(renderExternalMethod) })
20602
+ ] }) : null
20603
+ ]
20604
+ }
20605
+ )
20606
+ ]
20607
+ }
20608
+ );
20609
+ }
20349
20610
  var containerStyle = {
20350
20611
  display: "flex",
20351
20612
  alignItems: "center",
@@ -25116,6 +25377,6 @@ lodash/lodash.js:
25116
25377
  *)
25117
25378
  */
25118
25379
 
25119
- export { ARTIST_CONFIG, ARTIST_DEFAULT_QUICK_ACTIONS, AppHeader, AppLayout, AppSidebar, ArtistLandingPage, AuthDivider, BSD_CONFIG, BSD_DEFAULT_FEATURE_CARDS, 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, BsdLandingPage, BsdToolboxPanel, CONCEPT_CONFIG, CONCEPT_DEFAULT_QUICK_ACTIONS, ConceptDesignLandingPage, DarkModeSelector, DarkModeSubMenu, DataExplorerActionBar, DataExplorerButton, DataExplorerCheckbox, DataExplorerCollectionFooter, DataExplorerDetailField, DataExplorerDetailSection, DataExplorerDetailShell, DataExplorerDisplayActionMenu, DataExplorerDisplayCard, DataExplorerDisplayCollectionView, DataExplorerDisplayListItem, DataExplorerDisplayMedia, DataExplorerImagePreview, DataExplorerPage, DataExplorerRecordCard, DataExplorerSelect, DataExplorerToolbarActions, DataExplorerToolbarShell, DataExplorerTree, DataExplorerTreeShell, DataExplorerView, DataExplorerViewCollection, DataExplorerViewItem, DataExplorerViewItemShell, DataExplorerViewShell, DataExplorerViewTree, DefaultLandingPage, DynamicComponent, EmailAuth, I18nSelector, InteractiveTable, InteractiveTableEditableTextCell, InteractiveTableReadonlyCell, InteractiveTableSelectCell, LoginLayout, MonkeysToastProvider, MonkeysToaster, NavButton, OAuthButton, OIDCButton, PendingApproval, MonkeysToastProvider as ToastProvider, MonkeysToaster as Toaster, WorkbenchContentPane, WorkbenchContentToolbar, WorkbenchDetailSidebar, WorkbenchGalleryCard, WorkbenchGallerySettingsButton, WorkbenchGallerySettingsPanel, WorkbenchGalleryView, WorkbenchLaneView, WorkbenchMasonryLayout, WorkbenchResizableSidebar, WorkbenchTableView, applyMonkeysTheme, calculateHue, calculateLightness, calculateSaturation, clearRegistry, cn3 as cn, createSolidColorScale, extractToastMessage, genTailwindTheme, getBaseBadgeToneClassName, getBaseButtonToneClassName, getBaseMenuItemToneClassName, getBaseNoticeToneClassName, getDataExplorerActionToneClassName, getDataExplorerMenuItemToneClassName, getRegisteredComponents, getRegisteredThemes, getThemeConfig, hasCustomComponent, markDarkColor, registerComponent, registerTheme, resolveBaseAppearance, resolveComponent, resolveDataExplorerAppearance, resolveMonkeysTheme, resolveToastVariantForMessage, setNeocardTheme, setTailwindTheme, toast, useDarkMode, useToastFeed, useToastOnValue };
25380
+ export { ARTIST_CONFIG, ARTIST_DEFAULT_QUICK_ACTIONS, AppHeader, AppLayout, AppSidebar, ArtistLandingPage, AuthDivider, BSD_CONFIG, BSD_DEFAULT_FEATURE_CARDS, 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, BsdLandingPage, BsdToolboxPanel, CONCEPT_CONFIG, CONCEPT_DEFAULT_QUICK_ACTIONS, ConceptDesignLandingPage, DarkModeSelector, DarkModeSubMenu, DataExplorerActionBar, DataExplorerButton, DataExplorerCheckbox, DataExplorerCollectionFooter, DataExplorerDetailField, DataExplorerDetailSection, DataExplorerDetailShell, DataExplorerDisplayActionMenu, DataExplorerDisplayCard, DataExplorerDisplayCollectionView, DataExplorerDisplayListItem, DataExplorerDisplayMedia, DataExplorerImagePreview, DataExplorerPage, DataExplorerRecordCard, DataExplorerSelect, DataExplorerToolbarActions, DataExplorerToolbarShell, DataExplorerTree, DataExplorerTreeShell, DataExplorerView, DataExplorerViewCollection, DataExplorerViewItem, DataExplorerViewItemShell, DataExplorerViewShell, DataExplorerViewTree, DefaultLandingPage, DynamicComponent, EmailAuth, I18nSelector, InteractiveTable, InteractiveTableEditableTextCell, InteractiveTableReadonlyCell, InteractiveTableSelectCell, LoginLayout, LoginPage, MonkeysToastProvider, MonkeysToaster, NavButton, OAuthButton, OIDCButton, PendingApproval, MonkeysToastProvider as ToastProvider, MonkeysToaster as Toaster, WorkbenchContentPane, WorkbenchContentToolbar, WorkbenchDetailSidebar, WorkbenchGalleryCard, WorkbenchGallerySettingsButton, WorkbenchGallerySettingsPanel, WorkbenchGalleryView, WorkbenchLaneView, WorkbenchMasonryLayout, WorkbenchResizableSidebar, WorkbenchTableView, applyMonkeysTheme, calculateHue, calculateLightness, calculateSaturation, clearRegistry, cn3 as cn, createSolidColorScale, extractToastMessage, genTailwindTheme, getBaseBadgeToneClassName, getBaseButtonToneClassName, getBaseMenuItemToneClassName, getBaseNoticeToneClassName, getDataExplorerActionToneClassName, getDataExplorerMenuItemToneClassName, getRegisteredComponents, getRegisteredThemes, getThemeConfig, hasCustomComponent, markDarkColor, registerComponent, registerTheme, resolveBaseAppearance, resolveComponent, resolveDataExplorerAppearance, resolveMonkeysTheme, resolveToastVariantForMessage, setNeocardTheme, setTailwindTheme, toast, useDarkMode, useToastFeed, useToastOnValue };
25120
25381
  //# sourceMappingURL=index.mjs.map
25121
25382
  //# sourceMappingURL=index.mjs.map