@mijn-ui/react-tabs 0.0.4 → 0.0.5

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.d.ts CHANGED
@@ -1,9 +1,15 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
1
2
  import * as React from 'react';
2
3
  import * as TabsPrimitive from '@radix-ui/react-tabs';
4
+ import { UnstyledProps } from '@mijn-ui/react-utilities/shared';
3
5
 
4
- declare const Tabs: React.ForwardRefExoticComponent<TabsPrimitive.TabsProps & React.RefAttributes<HTMLDivElement>>;
5
- declare const TabsList: React.ForwardRefExoticComponent<Omit<TabsPrimitive.TabsListProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
6
- declare const TabsTrigger: React.ForwardRefExoticComponent<Omit<TabsPrimitive.TabsTriggerProps & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
7
- declare const TabsContent: React.ForwardRefExoticComponent<Omit<TabsPrimitive.TabsContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
6
+ type TabsProps = React.ComponentPropsWithRef<typeof TabsPrimitive.Root> & UnstyledProps;
7
+ declare const Tabs: ({ children, unstyled, ...props }: TabsProps) => react_jsx_runtime.JSX.Element;
8
+ type TabsListProps = React.ComponentPropsWithRef<typeof TabsPrimitive.List> & UnstyledProps;
9
+ declare const TabsList: ({ className, unstyled, ...props }: TabsListProps) => react_jsx_runtime.JSX.Element;
10
+ type TabsTriggerProps = React.ComponentPropsWithRef<typeof TabsPrimitive.Trigger> & UnstyledProps;
11
+ declare const TabsTrigger: ({ className, unstyled, ...props }: TabsTriggerProps) => react_jsx_runtime.JSX.Element;
12
+ type TabsContentProps = React.ComponentPropsWithRef<typeof TabsPrimitive.Content> & UnstyledProps;
13
+ declare const TabsContent: ({ className, unstyled, ...props }: TabsContentProps) => react_jsx_runtime.JSX.Element;
8
14
 
9
15
  export { Tabs, TabsContent, TabsList, TabsTrigger };
package/dist/index.js CHANGED
@@ -1,47 +1,56 @@
1
1
  "use client"
2
2
 
3
3
  // src/tabs.tsx
4
- import * as React from "react";
5
4
  import * as TabsPrimitive from "@radix-ui/react-tabs";
6
- import { cn } from "@mijn-ui/react-utilities/shared";
5
+ import { applyUnstyled } from "@mijn-ui/react-utilities/shared";
6
+ import { UnstyledProvider, useUnstyled } from "@mijn-ui/react-utilities/context";
7
7
  import { jsx } from "react/jsx-runtime";
8
- var Tabs = TabsPrimitive.Root;
9
- var TabsList = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
10
- TabsPrimitive.List,
11
- {
12
- ref,
13
- className: cn(
14
- "bg-neutral text-neutral-text inline-flex h-10 items-center justify-center rounded-md p-1",
15
- className
16
- ),
17
- ...props
18
- }
19
- ));
20
- TabsList.displayName = TabsPrimitive.List.displayName;
21
- var TabsTrigger = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
22
- TabsPrimitive.Trigger,
23
- {
24
- ref,
25
- className: cn(
26
- "focus-visible:ring-ring data-[state=active]:bg-main data-[state=active]:text-main-text inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium transition-all focus-visible:outline-none focus-visible:ring-1 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:shadow-sm",
27
- className
28
- ),
29
- ...props
30
- }
31
- ));
32
- TabsTrigger.displayName = TabsPrimitive.Trigger.displayName;
33
- var TabsContent = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
34
- TabsPrimitive.Content,
35
- {
36
- ref,
37
- className: cn(
38
- "focus-visible:ring-ring mt-2 focus-visible:outline-none focus-visible:ring-1",
39
- className
40
- ),
41
- ...props
42
- }
43
- ));
44
- TabsContent.displayName = TabsPrimitive.Content.displayName;
8
+ var Tabs = ({ children, unstyled = false, ...props }) => /* @__PURE__ */ jsx(UnstyledProvider, { unstyled, children: /* @__PURE__ */ jsx(TabsPrimitive.Root, { ...props, children }) });
9
+ var TabsList = ({ className, unstyled, ...props }) => {
10
+ const { unstyled: contextUnstyled } = useUnstyled();
11
+ const isUnstyled = unstyled ?? contextUnstyled;
12
+ return /* @__PURE__ */ jsx(
13
+ TabsPrimitive.List,
14
+ {
15
+ className: applyUnstyled(
16
+ isUnstyled,
17
+ "bg-main text-neutral-text inline-flex h-10 items-center justify-center rounded-lg p-1",
18
+ className
19
+ ),
20
+ ...props
21
+ }
22
+ );
23
+ };
24
+ var TabsTrigger = ({ className, unstyled, ...props }) => {
25
+ const { unstyled: contextUnstyled } = useUnstyled();
26
+ const isUnstyled = unstyled ?? contextUnstyled;
27
+ return /* @__PURE__ */ jsx(
28
+ TabsPrimitive.Trigger,
29
+ {
30
+ className: applyUnstyled(
31
+ isUnstyled,
32
+ "focus-visible:ring-ring data-[state=active]:bg-surface data-[state=active]:text-main-text inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1.5 text-sm font-medium transition-all focus-visible:outline-none focus-visible:ring-1 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:shadow-sm",
33
+ className
34
+ ),
35
+ ...props
36
+ }
37
+ );
38
+ };
39
+ var TabsContent = ({ className, unstyled, ...props }) => {
40
+ const { unstyled: contextUnstyled } = useUnstyled();
41
+ const isUnstyled = unstyled ?? contextUnstyled;
42
+ return /* @__PURE__ */ jsx(
43
+ TabsPrimitive.Content,
44
+ {
45
+ className: applyUnstyled(
46
+ isUnstyled,
47
+ "focus-visible:ring-ring mt-2 focus-visible:outline-none focus-visible:ring-1",
48
+ className
49
+ ),
50
+ ...props
51
+ }
52
+ );
53
+ };
45
54
  export {
46
55
  Tabs,
47
56
  TabsContent,
@@ -1 +1 @@
1
- {"inputs":{"src/tabs.tsx":{"bytes":1809,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@radix-ui/react-tabs","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/tabs.tsx","kind":"import-statement","original":"./tabs"}],"format":"esm"}},"outputs":{"dist/index.js":{"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@radix-ui/react-tabs","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":["Tabs","TabsContent","TabsList","TabsTrigger"],"entryPoint":"src/index.ts","inputs":{"src/tabs.tsx":{"bytesInOutput":1480},"src/index.ts":{"bytesInOutput":0}},"bytes":1557}}}
1
+ {"inputs":{"src/tabs.tsx":{"bytes":3162,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@radix-ui/react-tabs","kind":"import-statement","external":true},{"path":"@mijn-ui/react-utilities/shared","kind":"import-statement","external":true},{"path":"@mijn-ui/react-utilities/context","kind":"import-statement","external":true},{"path":"react/jsx-runtime","kind":"import-statement","external":true}],"format":"esm"},"src/index.ts":{"bytes":23,"imports":[{"path":"src/tabs.tsx","kind":"import-statement","original":"./tabs"}],"format":"esm"}},"outputs":{"dist/index.js":{"imports":[{"path":"@radix-ui/react-tabs","kind":"import-statement","external":true},{"path":"@mijn-ui/react-utilities/shared","kind":"import-statement","external":true},{"path":"@mijn-ui/react-utilities/context","kind":"import-statement","external":true},{"path":"react/jsx-runtime","kind":"import-statement","external":true}],"exports":["Tabs","TabsContent","TabsList","TabsTrigger"],"entryPoint":"src/index.ts","inputs":{"src/tabs.tsx":{"bytesInOutput":1956},"src/index.ts":{"bytesInOutput":0}},"bytes":2033}}}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@mijn-ui/react-tabs",
3
3
  "author": "Htet Aung Lin<htetaunglin.coder@gmail.com>",
4
- "version": "0.0.4",
4
+ "version": "0.0.5",
5
5
  "homepage": "https://mijn-ui.vercel.app",
6
6
  "license": "MIT",
7
7
  "type": "module",