@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.mjs CHANGED
@@ -20348,6 +20348,117 @@ registerTheme(
20348
20348
  version: "1.0.0"
20349
20349
  }
20350
20350
  );
20351
+ var FEISHU_ICON_URL = "https://p1-hera.feishucdn.com/tos-cn-i-jbbdkfciu3/84a9f036fe2b44f99b899fff4beeb963~tplv-jbbdkfciu3-image:0:0.image";
20352
+ var FeishuIcon = ({
20353
+ alt = "feishu",
20354
+ width = 16,
20355
+ height = 16,
20356
+ style,
20357
+ ...props
20358
+ }) => /* @__PURE__ */ jsx(
20359
+ "img",
20360
+ {
20361
+ src: FEISHU_ICON_URL,
20362
+ alt,
20363
+ width,
20364
+ height,
20365
+ style: { display: "block", ...style },
20366
+ ...props
20367
+ }
20368
+ );
20369
+ var WeWorkIcon = ({
20370
+ width = 16,
20371
+ height = 16,
20372
+ style,
20373
+ ...props
20374
+ }) => /* @__PURE__ */ jsxs(
20375
+ "svg",
20376
+ {
20377
+ width,
20378
+ height,
20379
+ viewBox: "0 0 24 24",
20380
+ fill: "none",
20381
+ xmlns: "http://www.w3.org/2000/svg",
20382
+ style: { display: "block", ...style },
20383
+ ...props,
20384
+ children: [
20385
+ /* @__PURE__ */ jsx(
20386
+ "path",
20387
+ {
20388
+ 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",
20389
+ fill: "#1683FF"
20390
+ }
20391
+ ),
20392
+ /* @__PURE__ */ jsx(
20393
+ "path",
20394
+ {
20395
+ 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",
20396
+ fill: "#07C160"
20397
+ }
20398
+ ),
20399
+ /* @__PURE__ */ jsx("circle", { cx: "7.2", cy: "9.75", r: "1.05", fill: "#FFFFFF" }),
20400
+ /* @__PURE__ */ jsx("circle", { cx: "11.1", cy: "9.75", r: "1.05", fill: "#FFFFFF" }),
20401
+ /* @__PURE__ */ jsx("circle", { cx: "15.8", cy: "11.9", r: "0.95", fill: "#FFFFFF" }),
20402
+ /* @__PURE__ */ jsx("circle", { cx: "19", cy: "11.9", r: "0.95", fill: "#FFFFFF" })
20403
+ ]
20404
+ }
20405
+ );
20406
+ var DingtalkIcon = ({
20407
+ className,
20408
+ width = 16,
20409
+ height = 16,
20410
+ style,
20411
+ ...props
20412
+ }) => /* @__PURE__ */ jsx(
20413
+ "svg",
20414
+ {
20415
+ width,
20416
+ height,
20417
+ viewBox: "64 64 896 896",
20418
+ xmlns: "http://www.w3.org/2000/svg",
20419
+ className,
20420
+ style: { display: "block", ...style },
20421
+ ...props,
20422
+ children: /* @__PURE__ */ jsx(
20423
+ "path",
20424
+ {
20425
+ 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",
20426
+ fill: "#1683FF"
20427
+ }
20428
+ )
20429
+ }
20430
+ );
20431
+ var SSOIcon = ({ width = 16, height = 16, style, ...props }) => /* @__PURE__ */ jsxs(
20432
+ "svg",
20433
+ {
20434
+ width,
20435
+ height,
20436
+ viewBox: "0 0 24 24",
20437
+ fill: "none",
20438
+ xmlns: "http://www.w3.org/2000/svg",
20439
+ style: { display: "block", ...style },
20440
+ ...props,
20441
+ children: [
20442
+ /* @__PURE__ */ jsx(
20443
+ "path",
20444
+ {
20445
+ 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",
20446
+ fill: "#2563EB"
20447
+ }
20448
+ ),
20449
+ /* @__PURE__ */ jsx(
20450
+ "path",
20451
+ {
20452
+ 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",
20453
+ fill: "#38BDF8"
20454
+ }
20455
+ ),
20456
+ /* @__PURE__ */ jsx("circle", { cx: "12", cy: "10.1", r: "2.15", fill: "#FFFFFF" }),
20457
+ /* @__PURE__ */ jsx("path", { d: "M12 12.25v3.3", stroke: "#FFFFFF", strokeWidth: "1.8", strokeLinecap: "round" }),
20458
+ /* @__PURE__ */ jsx("path", { d: "M12 15.05h2.2", stroke: "#FFFFFF", strokeWidth: "1.8", strokeLinecap: "round" })
20459
+ ]
20460
+ }
20461
+ );
20351
20462
  var LOGIN_LOGO_POSITIONS = ["top", "middle", "bottom"];
20352
20463
  var normalizeCssValue = (value) => {
20353
20464
  const trimmed = value?.trim();
@@ -20360,6 +20471,37 @@ var createBackgroundImage = (gradient, imageUrl) => {
20360
20471
  };
20361
20472
  var normalizeLogoPosition = (position) => position && LOGIN_LOGO_POSITIONS.includes(position) ? position : "bottom";
20362
20473
  var normalizeLogoScale = (scale) => typeof scale === "number" && Number.isFinite(scale) && scale > 0 ? scale : void 0;
20474
+ var resolveLogoUrls = (logo) => {
20475
+ const url = normalizeCssValue(logo?.url);
20476
+ const lightUrl = normalizeCssValue(logo?.lightUrl) || url;
20477
+ const darkUrl = normalizeCssValue(logo?.darkUrl) || url || lightUrl;
20478
+ return { lightUrl, darkUrl };
20479
+ };
20480
+ var normalizeProviderType = (value) => normalizeCssValue(value)?.toLowerCase().replace(/^oauth[-_:]/, "").replace(/[\s_]+/g, "-");
20481
+ var getDefaultExternalMethodIcon = (method) => {
20482
+ const providerType = normalizeProviderType(method.providerType) ?? normalizeProviderType(method.id);
20483
+ switch (providerType) {
20484
+ case "dingtalk":
20485
+ case "ding-talk":
20486
+ case "dingding":
20487
+ return /* @__PURE__ */ jsx(DingtalkIcon, { "aria-hidden": "true" });
20488
+ case "feishu":
20489
+ case "lark":
20490
+ return /* @__PURE__ */ jsx(FeishuIcon, { alt: "", "aria-hidden": "true" });
20491
+ case "wework":
20492
+ case "wecom":
20493
+ case "wechat-work":
20494
+ case "wechatwork":
20495
+ return /* @__PURE__ */ jsx(WeWorkIcon, { "aria-hidden": "true" });
20496
+ case "oidc":
20497
+ case "sso":
20498
+ case "saml":
20499
+ case "saml-sso":
20500
+ return /* @__PURE__ */ jsx(SSOIcon, { "aria-hidden": "true" });
20501
+ default:
20502
+ return null;
20503
+ }
20504
+ };
20363
20505
  function LoginPage({
20364
20506
  className,
20365
20507
  style,
@@ -20389,6 +20531,9 @@ function LoginPage({
20389
20531
  const backgroundMode = backgroundImage ? "custom" : "default";
20390
20532
  const logoPosition = normalizeLogoPosition(logo?.position);
20391
20533
  const logoScale = normalizeLogoScale(logo?.scale);
20534
+ const { lightUrl: logoLightUrl, darkUrl: logoDarkUrl } = resolveLogoUrls(logo);
20535
+ const hasLogo = Boolean(logoLightUrl || logoDarkUrl);
20536
+ const usesSeparateModeLogos = Boolean(logoLightUrl && logoDarkUrl && logoLightUrl !== logoDarkUrl);
20392
20537
  useEffect(() => {
20393
20538
  if (!availableMethods.length) {
20394
20539
  setInternalMethodId(void 0);
@@ -20413,6 +20558,7 @@ function LoginPage({
20413
20558
  onMethodChange?.(methodId);
20414
20559
  };
20415
20560
  const renderExternalMethod = (method) => {
20561
+ const icon = method.icon === void 0 ? getDefaultExternalMethodIcon(method) : method.icon;
20416
20562
  const button = /* @__PURE__ */ jsxs(
20417
20563
  "button",
20418
20564
  {
@@ -20423,7 +20569,7 @@ function LoginPage({
20423
20569
  onClick: method.onClick,
20424
20570
  disabled: method.disabled,
20425
20571
  children: [
20426
- method.icon ? /* @__PURE__ */ jsx("span", { className: "login-page__oauth-icon", "data-login-part": "external-icon", children: method.icon }) : null,
20572
+ icon ? /* @__PURE__ */ jsx("span", { className: "login-page__oauth-icon", "data-login-part": "external-icon", children: icon }) : null,
20427
20573
  /* @__PURE__ */ jsx("span", { children: method.label })
20428
20574
  ]
20429
20575
  }
@@ -20451,19 +20597,42 @@ function LoginPage({
20451
20597
  }
20452
20598
  ),
20453
20599
  toolbar ? /* @__PURE__ */ jsx("div", { className: "login-page__toolbar", "data-login-part": "toolbar", children: toolbar }) : null,
20454
- logo?.url ? /* @__PURE__ */ jsx(
20600
+ hasLogo ? /* @__PURE__ */ jsx(
20455
20601
  "div",
20456
20602
  {
20457
20603
  className: `login-page__logo login-page__logo--${logoPosition}`,
20458
20604
  "data-login-part": "logo",
20459
20605
  "data-logo-position": logoPosition,
20460
- children: /* @__PURE__ */ jsx(
20606
+ children: usesSeparateModeLogos ? /* @__PURE__ */ jsxs(Fragment, { children: [
20607
+ /* @__PURE__ */ jsx(
20608
+ "img",
20609
+ {
20610
+ className: "login-page__logo-image login-page__logo-image--light",
20611
+ "data-login-part": "logo-image",
20612
+ "data-login-logo-mode": "light",
20613
+ src: logoLightUrl,
20614
+ alt: logo?.alt ?? "",
20615
+ style: logoScale ? { transform: `scale(${logoScale})` } : void 0
20616
+ }
20617
+ ),
20618
+ /* @__PURE__ */ jsx(
20619
+ "img",
20620
+ {
20621
+ className: "login-page__logo-image login-page__logo-image--dark",
20622
+ "data-login-part": "logo-image",
20623
+ "data-login-logo-mode": "dark",
20624
+ src: logoDarkUrl,
20625
+ alt: logo?.alt ?? "",
20626
+ style: logoScale ? { transform: `scale(${logoScale})` } : void 0
20627
+ }
20628
+ )
20629
+ ] }) : /* @__PURE__ */ jsx(
20461
20630
  "img",
20462
20631
  {
20463
20632
  className: "login-page__logo-image",
20464
20633
  "data-login-part": "logo-image",
20465
- src: logo.url,
20466
- alt: logo.alt ?? "",
20634
+ src: logoLightUrl || logoDarkUrl,
20635
+ alt: logo?.alt ?? "",
20467
20636
  style: logoScale ? { transform: `scale(${logoScale})` } : void 0
20468
20637
  }
20469
20638
  )
@@ -20496,7 +20665,7 @@ function LoginPage({
20496
20665
  onClick: () => handleMethodChange(method.id),
20497
20666
  children: [
20498
20667
  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 })
20668
+ /* @__PURE__ */ jsx("span", { className: "login-page__tab-label", children: method.label })
20500
20669
  ]
20501
20670
  },
20502
20671
  method.id