@mijn-ui/react-card 0.0.5 → 0.0.7

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/README.md ADDED
@@ -0,0 +1,15 @@
1
+ # @mijn-ui/react-card
2
+
3
+ A container for grouping and displaying related content or actions.
4
+
5
+ [Documentation](https://mijn-ui.vercel.app/docs/components/card)
6
+
7
+ ## Installation
8
+
9
+ ```sh
10
+ npm install @mijn-ui/react-card
11
+ ```
12
+
13
+ ## License
14
+
15
+ This project is licensed under the terms of the [MIT license.](https://github.com/mijn-ui/mijn-ui-react/blob/main/LICENSE)
package/dist/index.js CHANGED
@@ -1,96 +1,47 @@
1
1
  "use client"
2
2
 
3
3
  // src/card.tsx
4
- import { UnstyledProvider, useUnstyled } from "@mijn-ui/react-utilities/context";
5
- import {
6
- applyUnstyled,
7
- cn
8
- } from "@mijn-ui/react-utilities/shared";
4
+ import { createContext } from "@mijn-ui/react-utilities/context";
5
+ import { cn } from "@mijn-ui/react-utilities/shared";
6
+ import { cardStyles } from "@mijn-ui/react-theme";
7
+ import { useTVUnstyled } from "@mijn-ui/react-hooks";
9
8
  import { jsx } from "react/jsx-runtime";
10
- var Card = ({ className, unstyled = false, ...props }) => /* @__PURE__ */ jsx(UnstyledProvider, { unstyled, children: /* @__PURE__ */ jsx(
11
- "div",
12
- {
13
- className: cn(
14
- "bg-surface text-surface-text rounded-lg shadow-sm",
15
- className
16
- ),
17
- ...props
18
- }
19
- ) });
9
+ var [CardProvider, useCardContext] = createContext({
10
+ name: "CardContext",
11
+ strict: true,
12
+ errorMessage: "useCardContext: `context` is undefined. Seems you forgot to wrap component within <Card />"
13
+ });
14
+ var useCardStyles = (unstyledOverride) => {
15
+ const context = useCardContext();
16
+ return useTVUnstyled(context, unstyledOverride);
17
+ };
18
+ var Card = ({ className, unstyled = false, ...props }) => {
19
+ const styles = cardStyles();
20
+ return /* @__PURE__ */ jsx(CardProvider, { value: { unstyled, styles }, children: /* @__PURE__ */ jsx("div", { className: cn(styles.base({ className })), ...props }) });
21
+ };
20
22
  var CardHeader = ({ className, unstyled, ...props }) => {
21
- const { unstyled: contextUnstyled } = useUnstyled();
22
- const isUnstyled = unstyled ?? contextUnstyled;
23
- return /* @__PURE__ */ jsx(
24
- "div",
25
- {
26
- className: applyUnstyled(
27
- isUnstyled,
28
- "flex flex-col space-y-1.5 p-4",
29
- className
30
- ),
31
- ...props
32
- }
33
- );
23
+ const { header } = useCardStyles(unstyled);
24
+ return /* @__PURE__ */ jsx("div", { className: header({ className }), ...props });
34
25
  };
35
26
  var CardTitle = ({ className, unstyled, ...props }) => {
36
- const { unstyled: contextUnstyled } = useUnstyled();
37
- const isUnstyled = unstyled ?? contextUnstyled;
38
- return /* @__PURE__ */ jsx(
39
- "div",
40
- {
41
- className: applyUnstyled(
42
- isUnstyled,
43
- "text-2xl font-semibold leading-none tracking-tight",
44
- className
45
- ),
46
- ...props
47
- }
48
- );
27
+ const { title } = useCardStyles(unstyled);
28
+ return /* @__PURE__ */ jsx("div", { className: title({ className }), ...props });
49
29
  };
50
30
  var CardDescription = ({
51
31
  className,
52
32
  unstyled,
53
33
  ...props
54
34
  }) => {
55
- const { unstyled: contextUnstyled } = useUnstyled();
56
- const isUnstyled = unstyled ?? contextUnstyled;
57
- return /* @__PURE__ */ jsx(
58
- "div",
59
- {
60
- className: applyUnstyled(
61
- isUnstyled,
62
- "text-sm text-muted-text",
63
- className
64
- ),
65
- ...props
66
- }
67
- );
35
+ const { description } = useCardStyles(unstyled);
36
+ return /* @__PURE__ */ jsx("div", { className: description({ className }), ...props });
68
37
  };
69
38
  var CardContent = ({ className, unstyled, ...props }) => {
70
- const { unstyled: contextUnstyled } = useUnstyled();
71
- const isUnstyled = unstyled ?? contextUnstyled;
72
- return /* @__PURE__ */ jsx(
73
- "div",
74
- {
75
- className: applyUnstyled(isUnstyled, "p-4 pt-0", className),
76
- ...props
77
- }
78
- );
39
+ const { content } = useCardStyles(unstyled);
40
+ return /* @__PURE__ */ jsx("div", { className: content({ className }), ...props });
79
41
  };
80
42
  var CardFooter = ({ className, unstyled, ...props }) => {
81
- const { unstyled: contextUnstyled } = useUnstyled();
82
- const isUnstyled = unstyled ?? contextUnstyled;
83
- return /* @__PURE__ */ jsx(
84
- "div",
85
- {
86
- className: applyUnstyled(
87
- isUnstyled,
88
- "flex items-center p-4 pt-0",
89
- className
90
- ),
91
- ...props
92
- }
93
- );
43
+ const { footer } = useCardStyles(unstyled);
44
+ return /* @__PURE__ */ jsx("div", { className: footer({ className }), ...props });
94
45
  };
95
46
  export {
96
47
  Card,
@@ -1 +1 @@
1
- {"inputs":{"src/card.tsx":{"bytes":4225,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@mijn-ui/react-utilities/context","kind":"import-statement","external":true},{"path":"@mijn-ui/react-utilities/shared","kind":"import-statement","external":true},{"path":"react/jsx-runtime","kind":"import-statement","external":true}],"format":"esm"},"src/index.ts":{"bytes":23,"imports":[{"path":"src/card.tsx","kind":"import-statement","original":"./card"}],"format":"esm"}},"outputs":{"dist/index.js":{"imports":[{"path":"@mijn-ui/react-utilities/context","kind":"import-statement","external":true},{"path":"@mijn-ui/react-utilities/shared","kind":"import-statement","external":true},{"path":"react/jsx-runtime","kind":"import-statement","external":true}],"exports":["Card","CardContent","CardDescription","CardFooter","CardHeader","CardTitle"],"entryPoint":"src/index.ts","inputs":{"src/card.tsx":{"bytesInOutput":2237},"src/index.ts":{"bytesInOutput":0}},"bytes":2347}}}
1
+ {"inputs":{"src/card.tsx":{"bytes":4438,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@mijn-ui/react-utilities/context","kind":"import-statement","external":true},{"path":"@mijn-ui/react-utilities/shared","kind":"import-statement","external":true},{"path":"@mijn-ui/react-theme","kind":"import-statement","external":true},{"path":"@mijn-ui/react-hooks","kind":"import-statement","external":true},{"path":"react/jsx-runtime","kind":"import-statement","external":true}],"format":"esm"},"src/index.ts":{"bytes":23,"imports":[{"path":"src/card.tsx","kind":"import-statement","original":"./card"}],"format":"esm"}},"outputs":{"dist/index.js":{"imports":[{"path":"@mijn-ui/react-utilities/context","kind":"import-statement","external":true},{"path":"@mijn-ui/react-utilities/shared","kind":"import-statement","external":true},{"path":"@mijn-ui/react-theme","kind":"import-statement","external":true},{"path":"@mijn-ui/react-hooks","kind":"import-statement","external":true},{"path":"react/jsx-runtime","kind":"import-statement","external":true}],"exports":["Card","CardContent","CardDescription","CardFooter","CardHeader","CardTitle"],"entryPoint":"src/index.ts","inputs":{"src/card.tsx":{"bytesInOutput":1852},"src/index.ts":{"bytesInOutput":0}},"bytes":1962}}}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@mijn-ui/react-card",
3
3
  "author": "Htet Aung Lin<htetaunglin.coder@gmail.com>",
4
- "version": "0.0.5",
4
+ "version": "0.0.7",
5
5
  "homepage": "https://mijn-ui.vercel.app",
6
6
  "license": "MIT",
7
7
  "type": "module",
@@ -24,13 +24,15 @@
24
24
  "@types/react": "^18.3.12",
25
25
  "@types/react-dom": "^18.3.1",
26
26
  "eslint-config-custom": "0.0.1",
27
- "tsconfig": "0.0.0"
27
+ "tsconfig": "0.0.0",
28
+ "tsup-config": "0.0.0"
28
29
  },
29
30
  "dependencies": {
30
31
  "react": "19.0.0-rc-b01722d5-20241114",
31
32
  "react-dom": "19.0.0-rc-b01722d5-20241114",
32
- "class-variance-authority": "^0.7.0",
33
- "@mijn-ui/react-utilities": "0.0.5"
33
+ "@mijn-ui/react-utilities": "0.0.7",
34
+ "@mijn-ui/react-hooks": "0.0.8",
35
+ "@mijn-ui/react-theme": "0.0.6"
34
36
  },
35
37
  "peerDependencies": {
36
38
  "react": "^19.0",
@@ -39,6 +41,11 @@
39
41
  "publishConfig": {
40
42
  "access": "public"
41
43
  },
44
+ "keywords": [
45
+ "card",
46
+ "react",
47
+ "nextjs"
48
+ ],
42
49
  "scripts": {
43
50
  "clean": "rimraf dist",
44
51
  "build": "tsup",