@inf-monkeys-tech/monkeys-design 0.4.36 → 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.
package/dist/index.mjs CHANGED
@@ -20346,6 +20346,265 @@ registerTheme(
20346
20346
  version: "1.0.0"
20347
20347
  }
20348
20348
  );
20349
+ var LOGIN_LOGO_POSITIONS = ["top", "middle", "bottom"];
20350
+ var normalizeCssValue = (value) => {
20351
+ const trimmed = value?.trim();
20352
+ return trimmed || void 0;
20353
+ };
20354
+ var createBackgroundImage = (gradient, imageUrl) => {
20355
+ const resolvedGradient = normalizeCssValue(gradient);
20356
+ const resolvedImageUrl = normalizeCssValue(imageUrl);
20357
+ return [resolvedGradient, resolvedImageUrl ? `url(${JSON.stringify(resolvedImageUrl)})` : void 0].filter(Boolean).join(", ");
20358
+ };
20359
+ var normalizeLogoPosition = (position) => position && LOGIN_LOGO_POSITIONS.includes(position) ? position : "bottom";
20360
+ var normalizeLogoScale = (scale) => typeof scale === "number" && Number.isFinite(scale) && scale > 0 ? scale : void 0;
20361
+ function LoginPage({
20362
+ className,
20363
+ style,
20364
+ background,
20365
+ logo,
20366
+ primaryColor,
20367
+ radius,
20368
+ customCss,
20369
+ toolbar,
20370
+ title,
20371
+ backAction,
20372
+ methods,
20373
+ activeMethodId,
20374
+ defaultMethodId,
20375
+ onMethodChange,
20376
+ externalLabel,
20377
+ externalMethods = [],
20378
+ callout
20379
+ }) {
20380
+ const availableMethods = useMemo(() => methods.filter((method) => !method.hidden), [methods]);
20381
+ const fallbackMethodId = defaultMethodId ?? availableMethods[0]?.id;
20382
+ const [internalMethodId, setInternalMethodId] = useState(fallbackMethodId);
20383
+ const currentMethodId = activeMethodId ?? internalMethodId;
20384
+ const activeMethod = availableMethods.find((method) => method.id === currentMethodId) ?? availableMethods[0];
20385
+ const hasTabs = availableMethods.length > 1;
20386
+ const backgroundImage = createBackgroundImage(background?.gradient, background?.imageUrl);
20387
+ const backgroundMode = backgroundImage ? "custom" : "default";
20388
+ const logoPosition = normalizeLogoPosition(logo?.position);
20389
+ const logoScale = normalizeLogoScale(logo?.scale);
20390
+ useEffect(() => {
20391
+ if (!availableMethods.length) {
20392
+ setInternalMethodId(void 0);
20393
+ return;
20394
+ }
20395
+ if (!currentMethodId || !availableMethods.some((method) => method.id === currentMethodId)) {
20396
+ setInternalMethodId(fallbackMethodId ?? availableMethods[0]?.id);
20397
+ }
20398
+ }, [availableMethods, currentMethodId, fallbackMethodId]);
20399
+ const rootStyle = useMemo(
20400
+ () => ({
20401
+ ...primaryColor ? { ["--login-page-theme-primary-color"]: primaryColor } : null,
20402
+ ...radius ? { ["--login-page-theme-radius"]: radius } : null,
20403
+ ...style
20404
+ }),
20405
+ [primaryColor, radius, style]
20406
+ );
20407
+ const handleMethodChange = (methodId) => {
20408
+ if (activeMethodId === void 0) {
20409
+ setInternalMethodId(methodId);
20410
+ }
20411
+ onMethodChange?.(methodId);
20412
+ };
20413
+ const renderExternalMethod = (method) => {
20414
+ const button = /* @__PURE__ */ jsxs(
20415
+ "button",
20416
+ {
20417
+ type: "button",
20418
+ className: "login-page__oauth-button",
20419
+ "data-login-part": "external-button",
20420
+ "data-login-method-id": method.id,
20421
+ onClick: method.onClick,
20422
+ disabled: method.disabled,
20423
+ children: [
20424
+ method.icon ? /* @__PURE__ */ jsx("span", { className: "login-page__oauth-icon", "data-login-part": "external-icon", children: method.icon }) : null,
20425
+ /* @__PURE__ */ jsx("span", { children: method.label })
20426
+ ]
20427
+ }
20428
+ );
20429
+ return /* @__PURE__ */ jsx(React.Fragment, { children: method.render ? method.render(button) : button }, method.id);
20430
+ };
20431
+ return /* @__PURE__ */ jsxs(
20432
+ "main",
20433
+ {
20434
+ className: ["login-page", className].filter(Boolean).join(" "),
20435
+ "data-login-page": true,
20436
+ "data-login-part": "root",
20437
+ "data-login-background": backgroundMode,
20438
+ style: rootStyle,
20439
+ children: [
20440
+ customCss ? /* @__PURE__ */ jsx("style", { "data-login-page-custom-css": true, children: customCss }) : null,
20441
+ /* @__PURE__ */ jsx(
20442
+ "div",
20443
+ {
20444
+ className: "login-page__background",
20445
+ "data-login-part": "background",
20446
+ "data-login-background": backgroundMode,
20447
+ style: backgroundImage ? { backgroundImage } : void 0,
20448
+ "aria-hidden": "true"
20449
+ }
20450
+ ),
20451
+ toolbar ? /* @__PURE__ */ jsx("div", { className: "login-page__toolbar", "data-login-part": "toolbar", children: toolbar }) : null,
20452
+ logo?.url ? /* @__PURE__ */ jsx(
20453
+ "div",
20454
+ {
20455
+ className: `login-page__logo login-page__logo--${logoPosition}`,
20456
+ "data-login-part": "logo",
20457
+ "data-logo-position": logoPosition,
20458
+ children: /* @__PURE__ */ jsx(
20459
+ "img",
20460
+ {
20461
+ className: "login-page__logo-image",
20462
+ "data-login-part": "logo-image",
20463
+ src: logo.url,
20464
+ alt: logo.alt ?? "",
20465
+ style: logoScale ? { transform: `scale(${logoScale})` } : void 0
20466
+ }
20467
+ )
20468
+ }
20469
+ ) : null,
20470
+ /* @__PURE__ */ jsxs(
20471
+ "section",
20472
+ {
20473
+ className: "login-page__form",
20474
+ "data-login-part": "panel",
20475
+ "aria-label": typeof title === "string" ? title : void 0,
20476
+ children: [
20477
+ backAction ? /* @__PURE__ */ jsxs("button", { type: "button", className: "login-page__back", "data-login-part": "back", onClick: backAction.onClick, children: [
20478
+ backAction.icon ? /* @__PURE__ */ jsx("span", { className: "login-page__back-icon", "data-login-part": "back-icon", children: backAction.icon }) : null,
20479
+ /* @__PURE__ */ jsx("span", { children: backAction.label })
20480
+ ] }) : null,
20481
+ title ? /* @__PURE__ */ jsx("h1", { className: "login-page__title", "data-login-part": "title", children: title }) : null,
20482
+ hasTabs ? /* @__PURE__ */ jsx("div", { className: "login-page__tabs", "data-login-part": "tabs", role: "tablist", children: availableMethods.map((method) => {
20483
+ const selected = method.id === activeMethod?.id;
20484
+ return /* @__PURE__ */ jsxs(
20485
+ "button",
20486
+ {
20487
+ type: "button",
20488
+ role: "tab",
20489
+ "aria-selected": selected,
20490
+ className: `login-page__tab ${selected ? "login-page__tab--active" : ""}`,
20491
+ "data-login-part": "tab",
20492
+ "data-login-method-id": method.id,
20493
+ "data-active": selected ? "true" : "false",
20494
+ onClick: () => handleMethodChange(method.id),
20495
+ children: [
20496
+ method.icon ? /* @__PURE__ */ jsx("span", { className: "login-page__tab-icon", "data-login-part": "tab-icon", children: method.icon }) : null,
20497
+ /* @__PURE__ */ jsx("span", { children: method.label })
20498
+ ]
20499
+ },
20500
+ method.id
20501
+ );
20502
+ }) }) : null,
20503
+ activeMethod ? /* @__PURE__ */ jsxs(
20504
+ "form",
20505
+ {
20506
+ className: "login-page__form-fields",
20507
+ "data-login-part": "form",
20508
+ "data-login-method-id": activeMethod.id,
20509
+ onSubmit: activeMethod.onSubmit,
20510
+ children: [
20511
+ activeMethod.fields.map((field) => /* @__PURE__ */ jsx("div", { className: "login-page__field", "data-login-part": "field", "data-login-field-name": field.name, children: /* @__PURE__ */ jsx(
20512
+ "input",
20513
+ {
20514
+ id: field.id,
20515
+ name: field.name,
20516
+ type: field.type ?? "text",
20517
+ value: field.value,
20518
+ placeholder: field.placeholder,
20519
+ autoComplete: field.autoComplete,
20520
+ inputMode: field.inputMode,
20521
+ maxLength: field.maxLength,
20522
+ pattern: field.pattern,
20523
+ disabled: activeMethod.disabled || activeMethod.isLoading || field.disabled,
20524
+ required: field.required,
20525
+ className: "login-page__input",
20526
+ "data-login-part": "input",
20527
+ onChange: (event) => field.onChange(event.target.value)
20528
+ }
20529
+ ) }, field.name)),
20530
+ activeMethod.checkbox ? /* @__PURE__ */ jsxs("label", { className: "login-page__remember", "data-login-part": "checkbox-label", htmlFor: activeMethod.checkbox.id, children: [
20531
+ /* @__PURE__ */ jsx(
20532
+ "input",
20533
+ {
20534
+ id: activeMethod.checkbox.id,
20535
+ type: "checkbox",
20536
+ className: "login-page__checkbox",
20537
+ "data-login-part": "checkbox",
20538
+ checked: activeMethod.checkbox.checked,
20539
+ disabled: activeMethod.disabled || activeMethod.isLoading || activeMethod.checkbox.disabled,
20540
+ onChange: (event) => activeMethod.checkbox?.onChange(event.target.checked)
20541
+ }
20542
+ ),
20543
+ /* @__PURE__ */ jsx("span", { children: activeMethod.checkbox.label })
20544
+ ] }) : null,
20545
+ activeMethod.footer || activeMethod.footerAction ? /* @__PURE__ */ jsxs("div", { className: "login-page__method-footer", "data-login-part": "method-footer", children: [
20546
+ activeMethod.footer,
20547
+ activeMethod.footerAction ? /* @__PURE__ */ jsx(
20548
+ "button",
20549
+ {
20550
+ type: "button",
20551
+ className: "login-page__method-footer-action",
20552
+ "data-login-part": "method-footer-action",
20553
+ "data-login-method-id": activeMethod.id,
20554
+ onClick: activeMethod.footerAction.onClick,
20555
+ disabled: activeMethod.disabled || activeMethod.isLoading || activeMethod.footerAction.disabled,
20556
+ children: activeMethod.footerAction.label
20557
+ }
20558
+ ) : null
20559
+ ] }) : null,
20560
+ /* @__PURE__ */ jsx(
20561
+ "button",
20562
+ {
20563
+ type: "submit",
20564
+ className: "login-page__submit",
20565
+ "data-login-part": "submit-button",
20566
+ disabled: activeMethod.disabled || activeMethod.isLoading,
20567
+ children: activeMethod.isLoading && activeMethod.loadingLabel ? activeMethod.loadingLabel : activeMethod.submitLabel
20568
+ }
20569
+ )
20570
+ ]
20571
+ }
20572
+ ) : null,
20573
+ callout ? /* @__PURE__ */ jsxs(
20574
+ "div",
20575
+ {
20576
+ className: `login-page__callout login-page__callout--${callout.tone ?? "info"}`,
20577
+ "data-login-part": "callout",
20578
+ "data-tone": callout.tone ?? "info",
20579
+ children: [
20580
+ /* @__PURE__ */ jsx("div", { className: "login-page__callout-title", "data-login-part": "callout-title", children: callout.title }),
20581
+ callout.description ? /* @__PURE__ */ jsx("p", { className: "login-page__callout-description", "data-login-part": "callout-description", children: callout.description }) : null,
20582
+ callout.detail ? /* @__PURE__ */ jsx("p", { className: "login-page__callout-detail", "data-login-part": "callout-detail", children: callout.detail }) : null,
20583
+ callout.action ? /* @__PURE__ */ jsx(
20584
+ "button",
20585
+ {
20586
+ type: "button",
20587
+ className: "login-page__callout-action",
20588
+ "data-login-part": "callout-action",
20589
+ onClick: callout.action.onClick,
20590
+ disabled: callout.action.disabled,
20591
+ children: callout.action.label
20592
+ }
20593
+ ) : null
20594
+ ]
20595
+ }
20596
+ ) : null,
20597
+ externalMethods.length ? /* @__PURE__ */ jsxs("div", { className: "login-page__oauth-section", "data-login-part": "external-methods", children: [
20598
+ externalLabel ? /* @__PURE__ */ jsx("div", { className: "login-page__oauth-label", "data-login-part": "external-label", children: externalLabel }) : null,
20599
+ /* @__PURE__ */ jsx("div", { className: "login-page__oauth-list", "data-login-part": "external-list", children: externalMethods.map(renderExternalMethod) })
20600
+ ] }) : null
20601
+ ]
20602
+ }
20603
+ )
20604
+ ]
20605
+ }
20606
+ );
20607
+ }
20349
20608
  var containerStyle = {
20350
20609
  display: "flex",
20351
20610
  alignItems: "center",
@@ -25116,6 +25375,6 @@ lodash/lodash.js:
25116
25375
  *)
25117
25376
  */
25118
25377
 
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 };
25378
+ 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
25379
  //# sourceMappingURL=index.mjs.map
25121
25380
  //# sourceMappingURL=index.mjs.map