@motor-hero/ui-kit 0.37.1 → 0.37.3

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
@@ -1464,11 +1464,15 @@ function FormDialogLayout({
1464
1464
  ] });
1465
1465
  }
1466
1466
  function FormDialog({ onSubmit, ...rest }) {
1467
+ const handleSubmit = (e) => {
1468
+ e.stopPropagation();
1469
+ onSubmit?.(e);
1470
+ };
1467
1471
  return /* @__PURE__ */ jsx15(
1468
1472
  BaseDialog,
1469
1473
  {
1470
1474
  ...rest,
1471
- contentWrapper: onSubmit ? (content) => /* @__PURE__ */ jsx15("form", { onSubmit, className: "flex min-h-0 flex-1 flex-col", children: content }) : void 0
1475
+ contentWrapper: onSubmit ? (content) => /* @__PURE__ */ jsx15("form", { onSubmit: handleSubmit, className: "flex min-h-0 flex-1 flex-col", children: content }) : void 0
1472
1476
  }
1473
1477
  );
1474
1478
  }
@@ -2350,11 +2354,16 @@ function Toaster(props) {
2350
2354
 
2351
2355
  // src/hooks/use-company-subdomain.ts
2352
2356
  import { useState as useState12 } from "react";
2353
- function getSubdomain(hostname) {
2357
+ var ALWAYS_RESERVED = ["www", "localhost"];
2358
+ function getSubdomain(hostname, reservedSubdomains = []) {
2354
2359
  const labels = hostname.split(".");
2355
2360
  if (labels.length < 2) return void 0;
2356
2361
  const first = labels[0];
2357
- if (!first || first === "www" || first === "localhost") return void 0;
2362
+ if (!first) return void 0;
2363
+ const reserved = [...ALWAYS_RESERVED, ...reservedSubdomains].map(
2364
+ (label) => label.toLowerCase()
2365
+ );
2366
+ if (reserved.includes(first.toLowerCase())) return void 0;
2358
2367
  return first;
2359
2368
  }
2360
2369
  function resolveOverride(storageKey) {
@@ -2372,14 +2381,18 @@ function resolveOverride(storageKey) {
2372
2381
  return window.localStorage.getItem(storageKey) ?? void 0;
2373
2382
  }
2374
2383
  function useCompanySubdomain(opts = {}) {
2375
- const { enableOverride = false, overrideStorageKey = "company-subdomain" } = opts;
2384
+ const {
2385
+ enableOverride = false,
2386
+ overrideStorageKey = "company-subdomain",
2387
+ reservedSubdomains = []
2388
+ } = opts;
2376
2389
  const [subdomain] = useState12(() => {
2377
2390
  if (enableOverride) {
2378
2391
  const override = resolveOverride(overrideStorageKey);
2379
2392
  if (override) return override;
2380
2393
  }
2381
2394
  if (typeof window === "undefined") return void 0;
2382
- return getSubdomain(window.location.hostname);
2395
+ return getSubdomain(window.location.hostname, reservedSubdomains);
2383
2396
  });
2384
2397
  return { subdomain };
2385
2398
  }