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

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.js CHANGED
@@ -20375,6 +20375,117 @@ registerTheme(
20375
20375
  version: "1.0.0"
20376
20376
  }
20377
20377
  );
20378
+ var FEISHU_ICON_URL = "https://p1-hera.feishucdn.com/tos-cn-i-jbbdkfciu3/84a9f036fe2b44f99b899fff4beeb963~tplv-jbbdkfciu3-image:0:0.image";
20379
+ var FeishuIcon = ({
20380
+ alt = "feishu",
20381
+ width = 16,
20382
+ height = 16,
20383
+ style,
20384
+ ...props
20385
+ }) => /* @__PURE__ */ jsxRuntime.jsx(
20386
+ "img",
20387
+ {
20388
+ src: FEISHU_ICON_URL,
20389
+ alt,
20390
+ width,
20391
+ height,
20392
+ style: { display: "block", ...style },
20393
+ ...props
20394
+ }
20395
+ );
20396
+ var WeWorkIcon = ({
20397
+ width = 16,
20398
+ height = 16,
20399
+ style,
20400
+ ...props
20401
+ }) => /* @__PURE__ */ jsxRuntime.jsxs(
20402
+ "svg",
20403
+ {
20404
+ width,
20405
+ height,
20406
+ viewBox: "0 0 24 24",
20407
+ fill: "none",
20408
+ xmlns: "http://www.w3.org/2000/svg",
20409
+ style: { display: "block", ...style },
20410
+ ...props,
20411
+ children: [
20412
+ /* @__PURE__ */ jsxRuntime.jsx(
20413
+ "path",
20414
+ {
20415
+ d: "M13.9 5.25c-4.45 0-8.05 2.84-8.05 6.35 0 1.89 1.06 3.6 2.72 4.76l-.45 2.01c-.1.45.38.8.78.57l2.42-1.38c.82.25 1.69.39 2.58.39 4.45 0 8.05-2.84 8.05-6.35s-3.6-6.35-8.05-6.35Z",
20416
+ fill: "#1683FF"
20417
+ }
20418
+ ),
20419
+ /* @__PURE__ */ jsxRuntime.jsx(
20420
+ "path",
20421
+ {
20422
+ d: "M10.15 3.7c-4.5 0-8.15 2.86-8.15 6.4 0 1.78.94 3.39 2.45 4.55l-.36 1.88c-.08.43.36.75.75.55l2.18-1.15c.7.18 1.44.27 2.2.27 4.5 0 8.15-2.86 8.15-6.4s-3.65-6.1-7.22-6.1Z",
20423
+ fill: "#07C160"
20424
+ }
20425
+ ),
20426
+ /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "7.2", cy: "9.75", r: "1.05", fill: "#FFFFFF" }),
20427
+ /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "11.1", cy: "9.75", r: "1.05", fill: "#FFFFFF" }),
20428
+ /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "15.8", cy: "11.9", r: "0.95", fill: "#FFFFFF" }),
20429
+ /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "19", cy: "11.9", r: "0.95", fill: "#FFFFFF" })
20430
+ ]
20431
+ }
20432
+ );
20433
+ var DingtalkIcon = ({
20434
+ className,
20435
+ width = 16,
20436
+ height = 16,
20437
+ style,
20438
+ ...props
20439
+ }) => /* @__PURE__ */ jsxRuntime.jsx(
20440
+ "svg",
20441
+ {
20442
+ width,
20443
+ height,
20444
+ viewBox: "64 64 896 896",
20445
+ xmlns: "http://www.w3.org/2000/svg",
20446
+ className,
20447
+ style: { display: "block", ...style },
20448
+ ...props,
20449
+ children: /* @__PURE__ */ jsxRuntime.jsx(
20450
+ "path",
20451
+ {
20452
+ d: "M573.7 252.5C422.5 197.4 201.3 96.7 201.3 96.7c-15.7-4.1-17.9 11.1-17.9 11.1-5 61.1 33.6 160.5 53.6 182.8 19.9 22.3 319.1 113.7 319.1 113.7S326 357.9 270.5 341.9c-55.6-16-37.9 17.8-37.9 17.8 11.4 61.7 64.9 131.8 107.2 138.4 42.2 6.6 220.1 4 220.1 4s-35.5 4.1-93.2 11.9c-42.7 5.8-97 12.5-111.1 17.8-33.1 12.5 24 62.6 24 62.6 84.7 76.8 129.7 50.5 129.7 50.5 33.3-10.7 61.4-18.5 85.2-24.2L565 743.1h84.6L603 928l205.3-271.9H700.8l22.3-38.7c.3.5.4.8.4.8S799.8 496.1 829 433.8l.6-1h-.1c5-10.8 8.6-19.7 10-25.8 17-71.3-114.5-99.4-265.8-154.5z",
20453
+ fill: "#1683FF"
20454
+ }
20455
+ )
20456
+ }
20457
+ );
20458
+ var SSOIcon = ({ width = 16, height = 16, style, ...props }) => /* @__PURE__ */ jsxRuntime.jsxs(
20459
+ "svg",
20460
+ {
20461
+ width,
20462
+ height,
20463
+ viewBox: "0 0 24 24",
20464
+ fill: "none",
20465
+ xmlns: "http://www.w3.org/2000/svg",
20466
+ style: { display: "block", ...style },
20467
+ ...props,
20468
+ children: [
20469
+ /* @__PURE__ */ jsxRuntime.jsx(
20470
+ "path",
20471
+ {
20472
+ d: "M12 2.65 5.35 5.4v5.2c0 4.75 2.85 8.98 6.65 10.75 3.8-1.77 6.65-6 6.65-10.75V5.4L12 2.65Z",
20473
+ fill: "#2563EB"
20474
+ }
20475
+ ),
20476
+ /* @__PURE__ */ jsxRuntime.jsx(
20477
+ "path",
20478
+ {
20479
+ d: "M12 4.65 7.15 6.62v4.02c0 3.5 2 6.72 4.85 8.28 2.85-1.56 4.85-4.78 4.85-8.28V6.62L12 4.65Z",
20480
+ fill: "#38BDF8"
20481
+ }
20482
+ ),
20483
+ /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "12", cy: "10.1", r: "2.15", fill: "#FFFFFF" }),
20484
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M12 12.25v3.3", stroke: "#FFFFFF", strokeWidth: "1.8", strokeLinecap: "round" }),
20485
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M12 15.05h2.2", stroke: "#FFFFFF", strokeWidth: "1.8", strokeLinecap: "round" })
20486
+ ]
20487
+ }
20488
+ );
20378
20489
  var LOGIN_LOGO_POSITIONS = ["top", "middle", "bottom"];
20379
20490
  var normalizeCssValue = (value) => {
20380
20491
  const trimmed = value?.trim();
@@ -20387,6 +20498,37 @@ var createBackgroundImage = (gradient, imageUrl) => {
20387
20498
  };
20388
20499
  var normalizeLogoPosition = (position) => position && LOGIN_LOGO_POSITIONS.includes(position) ? position : "bottom";
20389
20500
  var normalizeLogoScale = (scale) => typeof scale === "number" && Number.isFinite(scale) && scale > 0 ? scale : void 0;
20501
+ var resolveLogoUrls = (logo) => {
20502
+ const url = normalizeCssValue(logo?.url);
20503
+ const lightUrl = normalizeCssValue(logo?.lightUrl) || url;
20504
+ const darkUrl = normalizeCssValue(logo?.darkUrl) || url || lightUrl;
20505
+ return { lightUrl, darkUrl };
20506
+ };
20507
+ var normalizeProviderType = (value) => normalizeCssValue(value)?.toLowerCase().replace(/^oauth[-_:]/, "").replace(/[\s_]+/g, "-");
20508
+ var getDefaultExternalMethodIcon = (method) => {
20509
+ const providerType = normalizeProviderType(method.providerType) ?? normalizeProviderType(method.id);
20510
+ switch (providerType) {
20511
+ case "dingtalk":
20512
+ case "ding-talk":
20513
+ case "dingding":
20514
+ return /* @__PURE__ */ jsxRuntime.jsx(DingtalkIcon, { "aria-hidden": "true" });
20515
+ case "feishu":
20516
+ case "lark":
20517
+ return /* @__PURE__ */ jsxRuntime.jsx(FeishuIcon, { alt: "", "aria-hidden": "true" });
20518
+ case "wework":
20519
+ case "wecom":
20520
+ case "wechat-work":
20521
+ case "wechatwork":
20522
+ return /* @__PURE__ */ jsxRuntime.jsx(WeWorkIcon, { "aria-hidden": "true" });
20523
+ case "oidc":
20524
+ case "sso":
20525
+ case "saml":
20526
+ case "saml-sso":
20527
+ return /* @__PURE__ */ jsxRuntime.jsx(SSOIcon, { "aria-hidden": "true" });
20528
+ default:
20529
+ return null;
20530
+ }
20531
+ };
20390
20532
  function LoginPage({
20391
20533
  className,
20392
20534
  style,
@@ -20416,6 +20558,9 @@ function LoginPage({
20416
20558
  const backgroundMode = backgroundImage ? "custom" : "default";
20417
20559
  const logoPosition = normalizeLogoPosition(logo?.position);
20418
20560
  const logoScale = normalizeLogoScale(logo?.scale);
20561
+ const { lightUrl: logoLightUrl, darkUrl: logoDarkUrl } = resolveLogoUrls(logo);
20562
+ const hasLogo = Boolean(logoLightUrl || logoDarkUrl);
20563
+ const usesSeparateModeLogos = Boolean(logoLightUrl && logoDarkUrl && logoLightUrl !== logoDarkUrl);
20419
20564
  React.useEffect(() => {
20420
20565
  if (!availableMethods.length) {
20421
20566
  setInternalMethodId(void 0);
@@ -20440,6 +20585,7 @@ function LoginPage({
20440
20585
  onMethodChange?.(methodId);
20441
20586
  };
20442
20587
  const renderExternalMethod = (method) => {
20588
+ const icon = method.icon === void 0 ? getDefaultExternalMethodIcon(method) : method.icon;
20443
20589
  const button = /* @__PURE__ */ jsxRuntime.jsxs(
20444
20590
  "button",
20445
20591
  {
@@ -20450,7 +20596,7 @@ function LoginPage({
20450
20596
  onClick: method.onClick,
20451
20597
  disabled: method.disabled,
20452
20598
  children: [
20453
- method.icon ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "login-page__oauth-icon", "data-login-part": "external-icon", children: method.icon }) : null,
20599
+ icon ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "login-page__oauth-icon", "data-login-part": "external-icon", children: icon }) : null,
20454
20600
  /* @__PURE__ */ jsxRuntime.jsx("span", { children: method.label })
20455
20601
  ]
20456
20602
  }
@@ -20478,19 +20624,42 @@ function LoginPage({
20478
20624
  }
20479
20625
  ),
20480
20626
  toolbar ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "login-page__toolbar", "data-login-part": "toolbar", children: toolbar }) : null,
20481
- logo?.url ? /* @__PURE__ */ jsxRuntime.jsx(
20627
+ hasLogo ? /* @__PURE__ */ jsxRuntime.jsx(
20482
20628
  "div",
20483
20629
  {
20484
20630
  className: `login-page__logo login-page__logo--${logoPosition}`,
20485
20631
  "data-login-part": "logo",
20486
20632
  "data-logo-position": logoPosition,
20487
- children: /* @__PURE__ */ jsxRuntime.jsx(
20633
+ children: usesSeparateModeLogos ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
20634
+ /* @__PURE__ */ jsxRuntime.jsx(
20635
+ "img",
20636
+ {
20637
+ className: "login-page__logo-image login-page__logo-image--light",
20638
+ "data-login-part": "logo-image",
20639
+ "data-login-logo-mode": "light",
20640
+ src: logoLightUrl,
20641
+ alt: logo?.alt ?? "",
20642
+ style: logoScale ? { transform: `scale(${logoScale})` } : void 0
20643
+ }
20644
+ ),
20645
+ /* @__PURE__ */ jsxRuntime.jsx(
20646
+ "img",
20647
+ {
20648
+ className: "login-page__logo-image login-page__logo-image--dark",
20649
+ "data-login-part": "logo-image",
20650
+ "data-login-logo-mode": "dark",
20651
+ src: logoDarkUrl,
20652
+ alt: logo?.alt ?? "",
20653
+ style: logoScale ? { transform: `scale(${logoScale})` } : void 0
20654
+ }
20655
+ )
20656
+ ] }) : /* @__PURE__ */ jsxRuntime.jsx(
20488
20657
  "img",
20489
20658
  {
20490
20659
  className: "login-page__logo-image",
20491
20660
  "data-login-part": "logo-image",
20492
- src: logo.url,
20493
- alt: logo.alt ?? "",
20661
+ src: logoLightUrl || logoDarkUrl,
20662
+ alt: logo?.alt ?? "",
20494
20663
  style: logoScale ? { transform: `scale(${logoScale})` } : void 0
20495
20664
  }
20496
20665
  )
@@ -20523,7 +20692,7 @@ function LoginPage({
20523
20692
  onClick: () => handleMethodChange(method.id),
20524
20693
  children: [
20525
20694
  method.icon ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "login-page__tab-icon", "data-login-part": "tab-icon", children: method.icon }) : null,
20526
- /* @__PURE__ */ jsxRuntime.jsx("span", { children: method.label })
20695
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "login-page__tab-label", children: method.label })
20527
20696
  ]
20528
20697
  },
20529
20698
  method.id