@stackshift-ui/radio-group 6.0.11 → 7.0.0-beta.1
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/chunk-VF5HEQDQ.mjs +1 -0
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/dist/radio-group.d.ts +5 -14
- package/dist/radio-group.js +2 -1
- package/dist/radio-group.mjs +2 -1
- package/package.json +9 -7
- package/src/radio-group.test.tsx +5 -2
- package/src/radio-group.tsx +42 -49
- package/dist/chunk-4DUYAL2R.mjs +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import*as o from"@radix-ui/react-radio-group";import{Circle as f}from"lucide-react";import*as m from"react";import{cn as n,DefaultComponent as s,useStackShiftUIComponents as p}from"@stackshift-ui/system";import{jsx as e}from"react/jsx-runtime";var c="RadioGroup",d="RadioGroupItem",u=m.forwardRef(({className:i,...t},r)=>{let{[c]:a=s}=p();return e(a,{as:o.Root,className:n("grid gap-2",i),...t,ref:r})});u.displayName=c;var R=m.forwardRef(({className:i,...t},r)=>{let{[d]:a=s}=p();return e(a,{as:o.Item,ref:r,className:n("aspect-square h-4 w-4 rounded-full border border-primary text-primary ring-offset-background focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",i),...t,children:e(o.Indicator,{className:"flex items-center justify-center",children:e(f,{className:"h-2.5 w-2.5 fill-current text-current"})})})});R.displayName=d;export{u as a,R as b};
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
"use strict";var
|
|
2
|
+
"use strict";var v=Object.create;var s=Object.defineProperty;var y=Object.getOwnPropertyDescriptor;var P=Object.getOwnPropertyNames;var I=Object.getPrototypeOf,b=Object.prototype.hasOwnProperty;var g=(o,e)=>{for(var t in e)s(o,t,{get:e[t],enumerable:!0})},c=(o,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let m of P(e))!b.call(o,m)&&m!==t&&s(o,m,{get:()=>e[m],enumerable:!(r=y(e,m))||r.enumerable});return o};var f=(o,e,t)=>(t=o!=null?v(I(o)):{},c(e||!o||!o.__esModule?s(t,"default",{value:o,enumerable:!0}):t,o)),C=o=>c(s({},"__esModule",{value:!0}),o);var N={};g(N,{RadioGroup:()=>l,RadioGroupItem:()=>G});module.exports=C(N);var a=f(require("@radix-ui/react-radio-group")),u=require("lucide-react"),p=f(require("react")),i=require("@stackshift-ui/system"),n=require("react/jsx-runtime"),d="RadioGroup",R="RadioGroupItem",l=p.forwardRef(({className:o,...e},t)=>{let{[d]:r=i.DefaultComponent}=(0,i.useStackShiftUIComponents)();return(0,n.jsx)(r,{as:a.Root,className:(0,i.cn)("grid gap-2",o),...e,ref:t})});l.displayName=d;var G=p.forwardRef(({className:o,...e},t)=>{let{[R]:r=i.DefaultComponent}=(0,i.useStackShiftUIComponents)();return(0,n.jsx)(r,{as:a.Item,ref:t,className:(0,i.cn)("aspect-square h-4 w-4 rounded-full border border-primary text-primary ring-offset-background focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",o),...e,children:(0,n.jsx)(a.Indicator,{className:"flex items-center justify-center",children:(0,n.jsx)(u.Circle,{className:"h-2.5 w-2.5 fill-current text-current"})})})});G.displayName=R;0&&(module.exports={RadioGroup,RadioGroupItem});
|
package/dist/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
"use strict";import{a as e}from"./chunk-
|
|
2
|
+
"use strict";import{a as e,b as o}from"./chunk-VF5HEQDQ.mjs";export{e as RadioGroup,o as RadioGroupItem};
|
package/dist/radio-group.d.ts
CHANGED
|
@@ -1,14 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
name: string;
|
|
7
|
-
labelClass?: string;
|
|
8
|
-
noLabel?: boolean;
|
|
9
|
-
children?: ReactNode;
|
|
10
|
-
className?: string;
|
|
11
|
-
as?: ElementType;
|
|
12
|
-
}
|
|
13
|
-
export declare const RadioGroup: React.FC<RadioGroupProps>;
|
|
14
|
-
export {};
|
|
1
|
+
import * as RadioGroupPrimitive from "@radix-ui/react-radio-group";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
declare const RadioGroup: React.ForwardRefExoticComponent<Omit<RadioGroupPrimitive.RadioGroupProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
4
|
+
declare const RadioGroupItem: React.ForwardRefExoticComponent<Omit<RadioGroupPrimitive.RadioGroupItemProps & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
5
|
+
export { RadioGroup, RadioGroupItem };
|
package/dist/radio-group.js
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
"use
|
|
1
|
+
"use client";
|
|
2
|
+
"use strict";var v=Object.create;var s=Object.defineProperty;var y=Object.getOwnPropertyDescriptor;var P=Object.getOwnPropertyNames;var I=Object.getPrototypeOf,b=Object.prototype.hasOwnProperty;var g=(o,e)=>{for(var i in e)s(o,i,{get:e[i],enumerable:!0})},c=(o,e,i,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let m of P(e))!b.call(o,m)&&m!==i&&s(o,m,{get:()=>e[m],enumerable:!(r=y(e,m))||r.enumerable});return o};var d=(o,e,i)=>(i=o!=null?v(I(o)):{},c(e||!o||!o.__esModule?s(i,"default",{value:o,enumerable:!0}):i,o)),C=o=>c(s({},"__esModule",{value:!0}),o);var N={};g(N,{RadioGroup:()=>l,RadioGroupItem:()=>G});module.exports=C(N);var a=d(require("@radix-ui/react-radio-group")),f=require("lucide-react"),p=d(require("react")),t=require("@stackshift-ui/system"),n=require("react/jsx-runtime"),u="RadioGroup",R="RadioGroupItem",l=p.forwardRef(({className:o,...e},i)=>{let{[u]:r=t.DefaultComponent}=(0,t.useStackShiftUIComponents)();return(0,n.jsx)(r,{as:a.Root,className:(0,t.cn)("grid gap-2",o),...e,ref:i})});l.displayName=u;var G=p.forwardRef(({className:o,...e},i)=>{let{[R]:r=t.DefaultComponent}=(0,t.useStackShiftUIComponents)();return(0,n.jsx)(r,{as:a.Item,ref:i,className:(0,t.cn)("aspect-square h-4 w-4 rounded-full border border-primary text-primary ring-offset-background focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",o),...e,children:(0,n.jsx)(a.Indicator,{className:"flex items-center justify-center",children:(0,n.jsx)(f.Circle,{className:"h-2.5 w-2.5 fill-current text-current"})})})});G.displayName=R;0&&(module.exports={RadioGroup,RadioGroupItem});
|
package/dist/radio-group.mjs
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
"use client";
|
|
2
|
+
"use strict";import{a,b}from"./chunk-VF5HEQDQ.mjs";export{a as RadioGroup,b as RadioGroupItem};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stackshift-ui/radio-group",
|
|
3
3
|
"description": "",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "7.0.0-beta.1",
|
|
5
5
|
"private": false,
|
|
6
6
|
"sideEffects": false,
|
|
7
7
|
"main": "./dist/index.js",
|
|
@@ -29,20 +29,22 @@
|
|
|
29
29
|
"typescript": "^5.6.2",
|
|
30
30
|
"vite-tsconfig-paths": "^5.0.1",
|
|
31
31
|
"vitest": "^2.1.1",
|
|
32
|
-
"@stackshift-ui/
|
|
33
|
-
"@stackshift-ui/
|
|
32
|
+
"@stackshift-ui/eslint-config": "6.0.10",
|
|
33
|
+
"@stackshift-ui/typescript-config": "6.0.10"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
+
"@radix-ui/react-radio-group": "^1.3.7",
|
|
36
37
|
"classnames": "^2.5.1",
|
|
37
|
-
"
|
|
38
|
-
"@stackshift-ui/
|
|
38
|
+
"lucide-react": "^0.468.0",
|
|
39
|
+
"@stackshift-ui/scripts": "6.1.0-beta.0",
|
|
40
|
+
"@stackshift-ui/system": "6.1.0-beta.1"
|
|
39
41
|
},
|
|
40
42
|
"peerDependencies": {
|
|
43
|
+
"@stackshift-ui/system": ">=6.1.0-beta.1",
|
|
41
44
|
"@types/react": "16.8 - 19",
|
|
42
45
|
"next": "10 - 14",
|
|
43
46
|
"react": "16.8 - 19",
|
|
44
|
-
"react-dom": "16.8 - 19"
|
|
45
|
-
"@stackshift-ui/system": ">=6.0.11"
|
|
47
|
+
"react-dom": "16.8 - 19"
|
|
46
48
|
},
|
|
47
49
|
"peerDependenciesMeta": {
|
|
48
50
|
"next": {
|
package/src/radio-group.test.tsx
CHANGED
|
@@ -7,7 +7,10 @@ describe.concurrent("radio-group", () => {
|
|
|
7
7
|
|
|
8
8
|
test("Common: Radio Group - test if renders without errors", ({ expect }) => {
|
|
9
9
|
const clx = "radiogroup-class";
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
const { unmount } = render(
|
|
11
|
+
<RadioGroup data-testid="radio-group" className={clx} name="stackshift-radiogroup" />,
|
|
12
|
+
);
|
|
13
|
+
expect(screen.getByTestId("radio-group").classList).toContain(clx);
|
|
14
|
+
unmount();
|
|
12
15
|
});
|
|
13
16
|
});
|
package/src/radio-group.tsx
CHANGED
|
@@ -1,59 +1,52 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
export interface RadioGroupProps extends Omit<HTMLProps<HTMLElement>, "as"> {
|
|
9
|
-
variant?: Variant;
|
|
10
|
-
label?: string;
|
|
11
|
-
name: string;
|
|
12
|
-
labelClass?: string;
|
|
13
|
-
noLabel?: boolean;
|
|
14
|
-
children?: ReactNode;
|
|
15
|
-
className?: string;
|
|
16
|
-
as?: ElementType;
|
|
17
|
-
}
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import * as RadioGroupPrimitive from "@radix-ui/react-radio-group";
|
|
4
|
+
import { Circle } from "lucide-react";
|
|
5
|
+
import * as React from "react";
|
|
6
|
+
|
|
7
|
+
import { cn, DefaultComponent, useStackShiftUIComponents } from "@stackshift-ui/system";
|
|
18
8
|
|
|
19
9
|
const displayName = "RadioGroup";
|
|
10
|
+
const displayNameItem = "RadioGroupItem";
|
|
20
11
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
labelClass,
|
|
26
|
-
noLabel = false,
|
|
27
|
-
children,
|
|
28
|
-
className,
|
|
29
|
-
as,
|
|
30
|
-
...props
|
|
31
|
-
}) => {
|
|
12
|
+
const RadioGroup = React.forwardRef<
|
|
13
|
+
React.ElementRef<typeof RadioGroupPrimitive.Root>,
|
|
14
|
+
React.ComponentPropsWithoutRef<typeof RadioGroupPrimitive.Root>
|
|
15
|
+
>(({ className, ...props }, ref) => {
|
|
32
16
|
const { [displayName]: Component = DefaultComponent } = useStackShiftUIComponents();
|
|
33
17
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
18
|
+
return (
|
|
19
|
+
<Component
|
|
20
|
+
as={RadioGroupPrimitive.Root}
|
|
21
|
+
className={cn("grid gap-2", className)}
|
|
22
|
+
{...props}
|
|
23
|
+
ref={ref}
|
|
24
|
+
/>
|
|
25
|
+
);
|
|
26
|
+
});
|
|
27
|
+
RadioGroup.displayName = displayName;
|
|
42
28
|
|
|
43
|
-
|
|
29
|
+
const RadioGroupItem = React.forwardRef<
|
|
30
|
+
React.ElementRef<typeof RadioGroupPrimitive.Item>,
|
|
31
|
+
React.ComponentPropsWithoutRef<typeof RadioGroupPrimitive.Item>
|
|
32
|
+
>(({ className, ...props }, ref) => {
|
|
33
|
+
const { [displayNameItem]: Component = DefaultComponent } = useStackShiftUIComponents();
|
|
44
34
|
|
|
45
35
|
return (
|
|
46
|
-
<
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
36
|
+
<Component
|
|
37
|
+
as={RadioGroupPrimitive.Item}
|
|
38
|
+
ref={ref}
|
|
39
|
+
className={cn(
|
|
40
|
+
"aspect-square h-4 w-4 rounded-full border border-primary text-primary ring-offset-background focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",
|
|
41
|
+
className,
|
|
42
|
+
)}
|
|
43
|
+
{...props}>
|
|
44
|
+
<RadioGroupPrimitive.Indicator className="flex items-center justify-center">
|
|
45
|
+
<Circle className="h-2.5 w-2.5 fill-current text-current" />
|
|
46
|
+
</RadioGroupPrimitive.Indicator>
|
|
47
|
+
</Component>
|
|
56
48
|
);
|
|
57
|
-
};
|
|
49
|
+
});
|
|
50
|
+
RadioGroupItem.displayName = displayNameItem;
|
|
58
51
|
|
|
59
|
-
RadioGroup
|
|
52
|
+
export { RadioGroup, RadioGroupItem };
|
package/dist/chunk-4DUYAL2R.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{DefaultComponent as g,useStackShiftUIComponents as N}from"@stackshift-ui/system";import T from"classnames";import{jsx as s,jsxs as v}from"react/jsx-runtime";var a="RadioGroup",u=({variant:o="primary",label:r,name:i,labelClass:p,noLabel:l=!1,children:m,className:c,as:d,...y})=>{var n;let{[a]:f=g}=N(),t="ml-2",e=`${t}`,C=`${t} flex items-center gap-2`,R=(n={primary:e,inline:C}[o])!=null?n:e;return v("div",{children:[!l&&s("p",{className:p,children:r||i}),s(f,{as:d,className:T(R,c),...y,"data-testid":a,children:m})]})};u.displayName=a;export{u as a};
|