@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.
@@ -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 x=Object.create;var r=Object.defineProperty;var V=Object.getOwnPropertyDescriptor;var b=Object.getOwnPropertyNames;var G=Object.getPrototypeOf,L=Object.prototype.hasOwnProperty;var P=(t,a)=>{for(var e in a)r(t,e,{get:a[e],enumerable:!0})},d=(t,a,e,s)=>{if(a&&typeof a=="object"||typeof a=="function")for(let n of b(a))!L.call(t,n)&&n!==e&&r(t,n,{get:()=>a[n],enumerable:!(s=V(a,n))||s.enumerable});return t};var S=(t,a,e)=>(e=t!=null?x(G(t)):{},d(a||!t||!t.__esModule?r(e,"default",{value:t,enumerable:!0}):e,t)),E=t=>d(r({},"__esModule",{value:!0}),t);var H={};P(H,{RadioGroup:()=>f});module.exports=E(H);var i=require("@stackshift-ui/system"),y=S(require("classnames")),o=require("react/jsx-runtime"),p="RadioGroup",f=({variant:t="primary",label:a,name:e,labelClass:s,noLabel:n=!1,children:C,className:R,as:g,...u})=>{var c;let{[p]:N=i.DefaultComponent}=(0,i.useStackShiftUIComponents)(),l="ml-2",m=`${l}`,T=`${l} flex items-center gap-2`,v=(c={primary:m,inline:T}[t])!=null?c:m;return(0,o.jsxs)("div",{children:[!n&&(0,o.jsx)("p",{className:s,children:a||e}),(0,o.jsx)(N,{as:g,className:(0,y.default)(v,R),...u,"data-testid":p,children:C})]})};f.displayName=p;0&&(module.exports={RadioGroup});
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-4DUYAL2R.mjs";export{e as RadioGroup};
2
+ "use strict";import{a as e,b as o}from"./chunk-VF5HEQDQ.mjs";export{e as RadioGroup,o as RadioGroupItem};
@@ -1,14 +1,5 @@
1
- import type { ElementType, HTMLProps, ReactNode } from "react";
2
- type Variant = "primary" | "inline";
3
- export interface RadioGroupProps extends Omit<HTMLProps<HTMLElement>, "as"> {
4
- variant?: Variant;
5
- label?: string;
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 };
@@ -1 +1,2 @@
1
- "use strict";var V=Object.create;var r=Object.defineProperty;var b=Object.getOwnPropertyDescriptor;var x=Object.getOwnPropertyNames;var G=Object.getPrototypeOf,L=Object.prototype.hasOwnProperty;var P=(a,t)=>{for(var e in t)r(a,e,{get:t[e],enumerable:!0})},d=(a,t,e,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of x(t))!L.call(a,n)&&n!==e&&r(a,n,{get:()=>t[n],enumerable:!(o=b(t,n))||o.enumerable});return a};var S=(a,t,e)=>(e=a!=null?V(G(a)):{},d(t||!a||!a.__esModule?r(e,"default",{value:a,enumerable:!0}):e,a)),E=a=>d(r({},"__esModule",{value:!0}),a);var H={};P(H,{RadioGroup:()=>f});module.exports=E(H);var i=require("@stackshift-ui/system"),y=S(require("classnames")),s=require("react/jsx-runtime"),p="RadioGroup",f=({variant:a="primary",label:t,name:e,labelClass:o,noLabel:n=!1,children:C,className:R,as:g,...N})=>{var c;let{[p]:T=i.DefaultComponent}=(0,i.useStackShiftUIComponents)(),l="ml-2",m=`${l}`,u=`${l} flex items-center gap-2`,v=(c={primary:m,inline:u}[a])!=null?c:m;return(0,s.jsxs)("div",{children:[!n&&(0,s.jsx)("p",{className:o,children:t||e}),(0,s.jsx)(T,{as:g,className:(0,y.default)(v,R),...N,"data-testid":p,children:C})]})};f.displayName=p;0&&(module.exports={RadioGroup});
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});
@@ -1 +1,2 @@
1
- import{a}from"./chunk-4DUYAL2R.mjs";export{a as RadioGroup};
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": "6.0.11",
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/typescript-config": "6.0.10",
33
- "@stackshift-ui/eslint-config": "6.0.10"
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
- "@stackshift-ui/scripts": "6.0.10",
38
- "@stackshift-ui/system": "6.0.11"
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": {
@@ -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
- render(<RadioGroup className={clx} name="stackshift-radiogroup" />);
11
- expect(screen.getByTestId("div").classList).toContain(clx);
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
  });
@@ -1,59 +1,52 @@
1
- import { DefaultComponent, useStackShiftUIComponents } from "@stackshift-ui/system";
2
- import type { ElementType, HTMLProps, ReactNode } from "react";
3
- import cn from "classnames";
4
-
5
- type StyleVariants<T extends string> = Record<T, string>;
6
- type Variant = "primary" | "inline";
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
- export const RadioGroup: React.FC<RadioGroupProps> = ({
22
- variant = "primary",
23
- label,
24
- name,
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
- const commonClass = "ml-2";
35
- const primary = `${commonClass}`;
36
- const inline = `${commonClass} flex items-center gap-2`;
37
-
38
- const variants: StyleVariants<Variant> = {
39
- primary,
40
- inline,
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
- const variantClass = variants[variant] ?? primary;
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
- <div>
47
- {!noLabel && <p className={labelClass}>{label || name}</p>}
48
- <Component
49
- as={as}
50
- className={cn(variantClass, className)}
51
- {...props}
52
- data-testid={displayName}>
53
- {children}
54
- </Component>
55
- </div>
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.displayName = displayName;
52
+ export { RadioGroup, RadioGroupItem };
@@ -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};