@mbao01/common 0.4.2 → 0.4.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.
@@ -8,6 +8,7 @@ export declare const DatetimeInput: import('react').ForwardRefExoticComponent<{
8
8
  outline?: boolean | undefined;
9
9
  wide?: boolean | undefined;
10
10
  disabled?: boolean | undefined;
11
+ readOnly?: boolean | undefined;
11
12
  } & {
12
13
  date?: Date;
13
14
  calendar?: {
@@ -5,6 +5,7 @@ export declare const Input: React.ForwardRefExoticComponent<Omit<React.InputHTML
5
5
  size?: "xs" | "sm" | "md" | "lg" | undefined;
6
6
  outline?: boolean | undefined;
7
7
  wide?: boolean | undefined;
8
+ readOnly?: boolean | undefined;
8
9
  }, "type"> & {
9
10
  label?: React.ReactNode;
10
11
  labelPosition?: "start" | "end" | "floating";
@@ -4,6 +4,7 @@ export declare const getInputClasses: (props?: ({
4
4
  wide?: boolean | null | undefined;
5
5
  size?: "xs" | "sm" | "md" | "lg" | null | undefined;
6
6
  type?: string | number | null | undefined;
7
+ readOnly?: boolean | null | undefined;
7
8
  } & import('class-variance-authority/types').ClassProp) | undefined) => string;
8
9
  export declare const getFloatingLabelClasses: (props?: import('class-variance-authority/types').ClassProp | undefined) => string;
9
10
  export declare const getInputLabelClasses: (props?: ({
@@ -15,4 +16,5 @@ export declare const getInputCommonClasses: (props?: ({
15
16
  disabled?: boolean | null | undefined;
16
17
  wide?: boolean | null | undefined;
17
18
  size?: "xs" | "sm" | "md" | "lg" | null | undefined;
19
+ readOnly?: boolean | null | undefined;
18
20
  } & import('class-variance-authority/types').ClassProp) | undefined) => string;
@@ -12,4 +12,5 @@ export declare const TagsInput: import('react').ForwardRefExoticComponent<import
12
12
  outline?: boolean | undefined;
13
13
  wide?: boolean | undefined;
14
14
  disabled?: boolean | undefined;
15
+ readOnly?: boolean | undefined;
15
16
  } & import('react').RefAttributes<HTMLDivElement>>;
@@ -5,6 +5,7 @@ export declare const TextField: React.ForwardRefExoticComponent<Omit<React.Input
5
5
  size?: "xs" | "sm" | "md" | "lg" | undefined;
6
6
  outline?: boolean | undefined;
7
7
  wide?: boolean | undefined;
8
+ readOnly?: boolean | undefined;
8
9
  }, "type"> & {
9
10
  label?: React.ReactNode;
10
11
  labelPosition?: "start" | "end" | "floating";
@@ -13,6 +13,7 @@ declare const Sidebar: {
13
13
  size?: "xs" | "sm" | "md" | "lg" | undefined;
14
14
  outline?: boolean | undefined;
15
15
  wide?: boolean | undefined;
16
+ readOnly?: boolean | undefined;
16
17
  }, "type"> & {
17
18
  label?: import('react').ReactNode;
18
19
  labelPosition?: "start" | "end" | "floating";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@mbao01/common",
3
3
  "private": false,
4
- "version": "0.4.2",
4
+ "version": "0.4.3",
5
5
  "type": "module",
6
6
  "author": "Ayomide Bakare",
7
7
  "license": "MIT",
@@ -99,28 +99,28 @@
99
99
  "cmdk": "^1.1.1",
100
100
  "date-fns": "^4.1.0",
101
101
  "embla-carousel-react": "^8.6.0",
102
- "lucide-react": "^0.522.0",
103
- "react-day-picker": "^9.7.0",
102
+ "lucide-react": "^0.525.0",
103
+ "react-day-picker": "^9.8.0",
104
104
  "react-dropzone": "^14.3.8",
105
105
  "react-international-phone": "^4.5.0",
106
106
  "react-otp-input": "^3.1.1",
107
107
  "react-resizable-panels": "^3.0.3",
108
- "sonner": "^2.0.5",
108
+ "sonner": "^2.0.6",
109
109
  "tailwind-merge": "^3.3.1",
110
110
  "timescape": "^0.7.1",
111
111
  "universal-cookie": "^8.0.1",
112
112
  "vaul": "^1.1.2"
113
113
  },
114
114
  "devDependencies": {
115
- "@eslint/js": "^9.30.0",
116
- "@ianvs/prettier-plugin-sort-imports": "^4.4.2",
117
- "@storybook/addon-a11y": "^9.0.15",
115
+ "@eslint/js": "^9.30.1",
116
+ "@ianvs/prettier-plugin-sort-imports": "^4.5.1",
117
+ "@storybook/addon-a11y": "^9.0.16",
118
118
  "@storybook/addon-coverage": "^2.0.0",
119
- "@storybook/addon-docs": "^9.0.15",
120
- "@storybook/addon-links": "^9.0.15",
121
- "@storybook/addon-onboarding": "^9.0.15",
122
- "@storybook/addon-themes": "^9.0.15",
123
- "@storybook/react-vite": "^9.0.15",
119
+ "@storybook/addon-docs": "^9.0.16",
120
+ "@storybook/addon-links": "^9.0.16",
121
+ "@storybook/addon-onboarding": "^9.0.16",
122
+ "@storybook/addon-themes": "^9.0.16",
123
+ "@storybook/react-vite": "^9.0.16",
124
124
  "@storybook/test-runner": "^0.23.0",
125
125
  "@tailwindcss/postcss": "^4.1.11",
126
126
  "@tailwindcss/vite": "^4.1.11",
@@ -128,21 +128,21 @@
128
128
  "@testing-library/react": "^16.3.0",
129
129
  "@testing-library/user-event": "^14.6.1",
130
130
  "@types/jest-image-snapshot": "^6.4.0",
131
- "@types/node": "^24.0.8",
131
+ "@types/node": "^24.0.13",
132
132
  "@types/react": "^19.1.8",
133
133
  "@types/react-dom": "^19.1.6",
134
- "@typescript-eslint/eslint-plugin": "^8.35.1",
135
- "@typescript-eslint/parser": "^8.35.1",
134
+ "@typescript-eslint/eslint-plugin": "^8.36.0",
135
+ "@typescript-eslint/parser": "^8.36.0",
136
136
  "@vitejs/plugin-react": "^4.6.0",
137
137
  "@vitest/coverage-v8": "^3.2.4",
138
138
  "@vitest/ui": "^3.2.4",
139
139
  "axe-playwright": "^2.1.0",
140
- "daisyui": "^5.0.43",
141
- "eslint": "^9.30.0",
140
+ "daisyui": "^5.0.46",
141
+ "eslint": "^9.30.1",
142
142
  "eslint-plugin-react": "^7.37.5",
143
143
  "eslint-plugin-react-hooks": "^5.2.0",
144
144
  "eslint-plugin-react-refresh": "^0.4.20",
145
- "eslint-plugin-storybook": "^9.0.15",
145
+ "eslint-plugin-storybook": "^9.0.16",
146
146
  "globals": "^16.3.0",
147
147
  "jest-image-snapshot": "^6.5.1",
148
148
  "jsdom": "^26.1.0",
@@ -153,10 +153,10 @@
153
153
  "react-dom": "^19.1.0",
154
154
  "react-router-dom": "^7.6.3",
155
155
  "recharts": "^2.15.4",
156
- "storybook": "^9.0.15",
156
+ "storybook": "^9.0.16",
157
157
  "tailwindcss": "^4.1.11",
158
158
  "typescript": "^5.8.3",
159
- "typescript-eslint": "^8.35.1",
159
+ "typescript-eslint": "^8.36.0",
160
160
  "vite": "^6.3.5",
161
161
  "vite-plugin-dts": "^4.5.4",
162
162
  "vitest": "^3.2.4"
@@ -168,5 +168,5 @@
168
168
  "recharts": "2",
169
169
  "typescript": "5"
170
170
  },
171
- "gitHead": "9e8a4cdc9a652cda29754e1357bef95383023ee0"
171
+ "gitHead": "f1e87f8fc6fc61de80777905e5d8e3bb214fab28"
172
172
  }
@@ -30,6 +30,7 @@ export const Input = React.forwardRef<HTMLInputElement, InputProps>(
30
30
  outline,
31
31
  className,
32
32
  type,
33
+ readOnly,
33
34
  ...props
34
35
  }: InputProps,
35
36
  ref
@@ -43,7 +44,11 @@ export const Input = React.forwardRef<HTMLInputElement, InputProps>(
43
44
  id={id}
44
45
  ref={ref}
45
46
  type={type}
46
- className={cn(getInputClasses({ type, size, wide, variant, outline }), className)}
47
+ readOnly={readOnly}
48
+ className={cn(
49
+ getInputClasses({ type, size, wide, variant, outline, readOnly }),
50
+ className
51
+ )}
47
52
  {...props}
48
53
  />
49
54
  </label>
@@ -53,10 +58,13 @@ export const Input = React.forwardRef<HTMLInputElement, InputProps>(
53
58
  return (
54
59
  <label
55
60
  htmlFor={id}
56
- className={cn(getInputClasses({ type, size, wide, variant, outline }), className)}
61
+ className={cn(
62
+ getInputClasses({ type, size, wide, variant, outline, readOnly }),
63
+ className
64
+ )}
57
65
  >
58
66
  {labelPosition === "start" && <InputLabel>{label}</InputLabel>}
59
- <input id={id} ref={ref} type={type} {...props} />
67
+ <input id={id} ref={ref} type={type} readOnly={readOnly} {...props} />
60
68
  {labelPosition === "end" && <InputLabel>{label}</InputLabel>}
61
69
  </label>
62
70
  );
@@ -67,7 +75,8 @@ export const Input = React.forwardRef<HTMLInputElement, InputProps>(
67
75
  id={id}
68
76
  ref={ref}
69
77
  type={type}
70
- className={cn(getInputClasses({ type, size, wide, variant, outline }), className)}
78
+ readOnly={readOnly}
79
+ className={cn(getInputClasses({ type, size, wide, variant, outline, readOnly }), className)}
71
80
  {...props}
72
81
  />
73
82
  );
@@ -29,6 +29,9 @@ export const getInputClasses = cva("input rounded-md transition-all duration-100
29
29
  ["file" as string]:
30
30
  "file:border-0 file:bg-transparent file:text-sm file:font-medium file:h-full",
31
31
  },
32
+ readOnly: {
33
+ true: "cursor-not-allowed! bg-base-200!",
34
+ },
32
35
  },
33
36
  compoundVariants: [
34
37
  {
@@ -101,6 +104,9 @@ export const getInputCommonClasses = cva(
101
104
  md: "h-12 leading-loose text-sm px-2",
102
105
  lg: "h-16 leading-loose text-lg px-3",
103
106
  },
107
+ readOnly: {
108
+ true: "cursor-not-allowed! bg-base-200!",
109
+ },
104
110
  },
105
111
  compoundVariants: [
106
112
  {