@mhome/ui 0.1.9 → 0.1.10

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mhome/ui",
3
- "version": "0.1.9",
3
+ "version": "0.1.10",
4
4
  "type": "module",
5
5
  "description": "mHome UI Component Library",
6
6
  "main": "dist/index.cjs.js",
@@ -34,6 +34,7 @@
34
34
  "dependencies": {
35
35
  "class-variance-authority": "^0.7.1",
36
36
  "clsx": "^2.1.1",
37
+ "dayjs": "^1.11.10",
37
38
  "tailwind-merge": "^3.4.0"
38
39
  },
39
40
  "devDependencies": {
@@ -1,27 +1,13 @@
1
1
  import * as React from "react";
2
2
  import { cn } from "../lib/utils";
3
3
  import { TextField } from "./text-field";
4
+ // Import dayjs - handle both ESM and CJS formats
5
+ // dayjs is a CommonJS module that exports the function directly
6
+ // When imported as namespace, the function is available directly
4
7
  import * as dayjsModule from "dayjs";
5
-
6
- // Ensure dayjs is a function at runtime
7
- // Handle both ESM and CJS dayjs exports
8
- let dayjs;
9
- if (typeof dayjsModule === "function") {
10
- dayjs = dayjsModule;
11
- } else if (dayjsModule.default && typeof dayjsModule.default === "function") {
12
- dayjs = dayjsModule.default;
13
- } else {
14
- // Fallback: try to get the function from the module
15
- dayjs = dayjsModule.default || dayjsModule;
16
- // If still not a function, this is an error
17
- if (typeof dayjs !== "function") {
18
- console.error("dayjs is not a function. Module:", dayjsModule);
19
- // Create a fallback that throws an error
20
- dayjs = function() {
21
- throw new Error("dayjs is not properly initialized");
22
- };
23
- }
24
- }
8
+ // In CommonJS/UMD, dayjsModule is the function itself
9
+ // In ESM, it's wrapped in namespace, but the function is still accessible
10
+ const dayjs = typeof dayjsModule === "function" ? dayjsModule : dayjsModule;
25
11
 
26
12
  const DatePicker = React.forwardRef(
27
13
  (
@@ -335,17 +335,17 @@ const DialogHeaderContext = React.createContext(false);
335
335
 
336
336
  const DialogHeader = ({ className, ...props }) => (
337
337
  <DialogHeaderContext.Provider value={true}>
338
- <div
339
- className={cn(
340
- "flex flex-col space-y-1.5 px-6 pt-6",
341
- className
342
- )}
343
- style={{
344
- textAlign: "left", // Ensure left alignment for all children
345
- ...props.style,
346
- }}
347
- {...props}
348
- />
338
+ <div
339
+ className={cn(
340
+ "flex flex-col space-y-1.5 px-6 pt-6",
341
+ className
342
+ )}
343
+ style={{
344
+ textAlign: "left", // Ensure left alignment for all children
345
+ ...props.style,
346
+ }}
347
+ {...props}
348
+ />
349
349
  </DialogHeaderContext.Provider>
350
350
  );
351
351
  DialogHeader.displayName = "DialogHeader";