Socket
Socket
Sign inDemoInstall

@radix-ui/react-radio-group

Package Overview
Dependencies
Maintainers
6
Versions
210
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@radix-ui/react-radio-group - npm Package Compare versions

Comparing version 0.0.14 to 0.0.15

18

dist/index.d.ts
import * as React from "react";
import { Primitive } from "@radix-ui/react-primitive";
import * as Polymorphic from "@radix-ui/react-polymorphic";
import { RovingFocusGroup } from "@radix-ui/react-roving-focus";
declare const RADIO_DEFAULT_TAG = "button";

@@ -10,3 +11,2 @@ type InputDOMProps = React.ComponentProps<'input'>;

required?: InputDOMProps['required'];
readOnly?: InputDOMProps['readOnly'];
onCheckedChange?: InputDOMProps['onChange'];

@@ -16,3 +16,4 @@ }>;

declare const Radio: RadioPrimitive;
type RadioGroupOwnProps = Polymorphic.Merge<Polymorphic.OwnProps<typeof Primitive>, {
declare const RADIO_GROUP_DEFAULT_TAG = "div";
type RadioGroupOwnProps = Polymorphic.Merge<Omit<Polymorphic.OwnProps<typeof RovingFocusGroup>, 'currentTabStopId' | 'defaultCurrentTabStopId' | 'onCurrentTabStopIdChange' | 'onEntryFocus'>, {
name?: string;

@@ -22,15 +23,12 @@ value?: string;

required?: React.ComponentProps<typeof Radio>['required'];
rovingFocus?: boolean;
onValueChange?: (event: React.ChangeEvent<HTMLInputElement>) => void;
}>;
type RadioGroupPrimitive = Polymorphic.ForwardRefComponent<Polymorphic.IntrinsicElement<typeof Primitive>, RadioGroupOwnProps>;
type RadioGroupPrimitive = Polymorphic.ForwardRefComponent<typeof RADIO_GROUP_DEFAULT_TAG, RadioGroupOwnProps>;
export const RadioGroup: RadioGroupPrimitive;
type RadioGroupItemOwnProps = Polymorphic.OwnProps<typeof RadioGroupItemImpl>;
type RadioGroupItemPrimitive = Polymorphic.ForwardRefComponent<Polymorphic.IntrinsicElement<typeof RadioGroupItemImpl>, RadioGroupItemOwnProps>;
export const RadioGroupItem: RadioGroupItemPrimitive;
type RadioGroupItemImplOwnProps = Polymorphic.Merge<Omit<Polymorphic.OwnProps<typeof Radio>, 'name'>, {
type RadioGroupItemOwnProps = Polymorphic.Merge<Polymorphic.OwnProps<typeof Radio>, {
value: string;
name?: never;
}>;
type RadioGroupItemImplPrimitive = Polymorphic.ForwardRefComponent<Polymorphic.IntrinsicElement<typeof Radio>, RadioGroupItemImplOwnProps>;
declare const RadioGroupItemImpl: RadioGroupItemImplPrimitive;
type RadioGroupItemPrimitive = Polymorphic.ForwardRefComponent<Polymorphic.IntrinsicElement<typeof Radio>, RadioGroupItemOwnProps>;
export const RadioGroupItem: RadioGroupItemPrimitive;
export const RadioGroupIndicator: Polymorphic.ForwardRefComponent<"span", Polymorphic.Merge<{}, {

@@ -37,0 +35,0 @@ forceMount?: true | undefined;

@@ -1,2 +0,2 @@

var e,r,a,o=require("@radix-ui/react-roving-focus"),t=o.RovingFocusGroup,n=o.useRovingFocus,u=require("@radix-ui/react-label").useLabelContext,d=require("@radix-ui/react-presence").Presence,i=require("@radix-ui/react-primitive"),l=i.Primitive,c=i.extendPrimitive,s=require("@radix-ui/react-use-controllable-state").useControllableState,f=require("@radix-ui/react-use-callback-ref").useCallbackRef,p=require("@radix-ui/react-context").createContext,m=require("@radix-ui/react-compose-refs").useComposedRefs,v=require("@radix-ui/primitive").composeEventHandlers,b=(e={},r=require("react"),Object.keys(r).forEach((function(a){"default"!==a&&"__esModule"!==a&&Object.defineProperty(e,a,{enumerable:!0,get:function(){return r[a]}})})),e),h=(a=require("@babel/runtime/helpers/extends"))&&a.__esModule?a.default:a;const R="button",[k,x]=p("Radio"),C=/*#__PURE__*/b.forwardRef(((e,r)=>{const{as:a=R,"aria-labelledby":o,name:t,checked:n,defaultChecked:d,required:i,disabled:c,readOnly:f,value:p="on",onCheckedChange:x,...C}=e,g=b.useRef(null),q=b.useRef(null),E=m(r,q),w=u(q),F=o||w,[G=!1,I]=s({prop:n,defaultProp:d});/*#__PURE__*/return b.createElement(b.Fragment,null,/*#__PURE__*/b.createElement("input",{ref:g,type:"radio",name:t,checked:G,required:i,disabled:c,readOnly:f,value:p,hidden:!0,onChange:v(x,(e=>{I(e.target.checked)}))}),/*#__PURE__*/b.createElement(k,{checked:G,disabled:c},/*#__PURE__*/b.createElement(l,h({type:"button",role:"radio","aria-checked":G,"aria-labelledby":F,"data-state":y(G),"data-readonly":f,"data-disabled":c?"":void 0,disabled:c,value:p},C,{as:a,ref:E,onClick:v(e.onClick,(()=>{var e;return null===(e=g.current)||void 0===e?void 0:e.click()}),{checkForDefaultPrevented:!1})}))))})),g="span",q=/*#__PURE__*/b.forwardRef(((e,r)=>{const{as:a=g,forceMount:o,...t}=e,n=x("RadioIndicator");/*#__PURE__*/return b.createElement(d,{present:o||n.checked},/*#__PURE__*/b.createElement(l,h({"data-state":y(n.checked),"data-disabled":n.disabled?"":void 0},t,{as:a,ref:r})))}));function y(e){return e?"checked":"unchecked"}const[E,w]=p("RadioGroup"),F=/*#__PURE__*/b.forwardRef(((e,r)=>{const{name:a,"aria-labelledby":o,defaultValue:n,value:d,required:i,rovingFocus:c=!0,onValueChange:p,...m}=e,R=u(),k=o||R,x=f(p),[C,g]=s({prop:d,defaultProp:n}),q=/*#__PURE__*/b.createElement(l,h({},m,{ref:r,role:"radiogroup","aria-labelledby":k}));/*#__PURE__*/return b.createElement(E,{name:a,value:C,required:i,rovingFocus:c,onValueChange:b.useCallback(v(x,(e=>g(e.target.value))),[x])},c?/*#__PURE__*/b.createElement(t,{loop:!0},q):q)}));exports.RadioGroup=F;const G=/*#__PURE__*/b.forwardRef(((e,r)=>w("RadioGroupItem").rovingFocus?/*#__PURE__*/b.createElement(I,h({},e,{ref:r})):/*#__PURE__*/b.createElement(D,h({},e,{ref:r}))));exports.RadioGroupItem=G;const I=/*#__PURE__*/b.forwardRef(((e,r)=>{const{disabled:a,...o}=e,t=w("RadioGroupItem"),u=b.useRef(null),d=m(r,u),i=t.value===o.value,l=n({disabled:a,active:i});/*#__PURE__*/return b.createElement(D,h({disabled:a},o,l,{ref:d,onKeyDown:v(o.onKeyDown,l.onKeyDown),onMouseDown:v(o.onMouseDown,l.onMouseDown),onFocus:v(o.onFocus,v(l.onFocus,(()=>{var e;void 0!==t.value&&(null===(e=u.current)||void 0===e||e.click())})))}))})),D=/*#__PURE__*/b.forwardRef(((e,r)=>{const a=w("RadioGroupItem"),o=a.value===e.value;/*#__PURE__*/return b.createElement(C,h({required:a.required,checked:o,name:a.name},e,{ref:r,onCheckedChange:v(e.onCheckedChange,a.onValueChange)}))})),P=c(q,{displayName:"RadioGroupIndicator"});exports.RadioGroupIndicator=P;const M=F;exports.Root=M;const O=G;exports.Item=O;const V=P;exports.Indicator=V;
var e,r,a,t=require("@radix-ui/react-presence").Presence,o=require("@radix-ui/react-use-controllable-state").useControllableState,i=require("@radix-ui/react-use-callback-ref").useCallbackRef,n=require("@radix-ui/react-slot").Slot,d=require("@radix-ui/react-roving-focus"),l=d.RovingFocusGroup,u=d.RovingFocusItem,c=require("@radix-ui/react-primitive"),s=c.extendPrimitive,p=c.Primitive,f=require("@radix-ui/react-context").createContext,b=require("@radix-ui/react-compose-refs").useComposedRefs,m=require("@radix-ui/react-label").useLabelContext,v=require("@radix-ui/primitive").composeEventHandlers,h=(e={},r=require("react"),Object.keys(r).forEach((function(a){"default"!==a&&"__esModule"!==a&&Object.defineProperty(e,a,{enumerable:!0,get:function(){return r[a]}})})),e),k=(a=require("@babel/runtime/helpers/extends"))&&a.__esModule?a.default:a;const x="button",[C,R]=f("Radio"),q=/*#__PURE__*/h.forwardRef(((e,r)=>{const{as:a=x,"aria-labelledby":t,name:i,checked:n,defaultChecked:d,required:l,disabled:u,value:c="on",onCheckedChange:s,...f}=e,R=h.useRef(null),[q,g]=h.useState(null),E=b(r,(e=>g(e))),I=m(q),G=t||I,[P=!1,F]=o({prop:n,defaultProp:d});/*#__PURE__*/return h.createElement(h.Fragment,null,/*#__PURE__*/h.createElement("input",{ref:R,type:"radio",name:i,checked:P,required:l,disabled:u,value:c,style:{display:"none"},onChange:v(s,(e=>{F(e.target.checked)}))}),/*#__PURE__*/h.createElement(C,{checked:P,disabled:u},/*#__PURE__*/h.createElement(p,k({type:"button",role:"radio","aria-checked":P,"aria-labelledby":G,"data-state":y(P),"data-disabled":u?"":void 0,disabled:u,value:c},f,{as:a,ref:E,onClick:v(e.onClick,(()=>{var e;return null===(e=R.current)||void 0===e?void 0:e.click()}),{checkForDefaultPrevented:!1})}))))})),g="span",E=/*#__PURE__*/h.forwardRef(((e,r)=>{const{as:a=g,forceMount:o,...i}=e,n=R("RadioIndicator");/*#__PURE__*/return h.createElement(t,{present:o||n.checked},/*#__PURE__*/h.createElement(p,k({"data-state":y(n.checked),"data-disabled":n.disabled?"":void 0},i,{as:a,ref:r})))}));function y(e){return e?"checked":"unchecked"}const I="div",[G,P]=f("RadioGroup"),F=/*#__PURE__*/h.forwardRef(((e,r)=>{const{as:a=I,name:t,"aria-labelledby":n,defaultValue:d,value:u,required:c,orientation:s,dir:p="ltr",loop:f=!0,onValueChange:b,...x}=e,C=m(),R=n||C,q=i(b),[g,E]=o({prop:u,defaultProp:d});/*#__PURE__*/return h.createElement(G,{name:t,value:g,required:c,onValueChange:h.useCallback(v(q,(e=>E(e.target.value))),[q])},/*#__PURE__*/h.createElement(l,k({role:"radiogroup","aria-labelledby":R,orientation:s,dir:p,loop:f},x,{as:a,ref:r})))}));exports.RadioGroup=F;const w=/*#__PURE__*/h.forwardRef(((e,r)=>{const{disabled:a,...t}=e,o=P("RadioGroupItem"),i=h.useRef(null),d=b(r,i),l=o.value===t.value;/*#__PURE__*/return h.createElement(u,{as:n,focusable:!a,active:l},/*#__PURE__*/h.createElement(q,k({disabled:a,required:o.required,checked:l},t,{name:o.name,ref:d,onCheckedChange:v(e.onCheckedChange,o.onValueChange),onFocus:v(t.onFocus,(()=>{var e;void 0!==o.value&&(null===(e=i.current)||void 0===e||e.click())}))})))}));exports.RadioGroupItem=w;const V=s(E,{displayName:"RadioGroupIndicator"});exports.RadioGroupIndicator=V;const _=F;exports.Root=_;const M=w;exports.Item=M;const S=V;exports.Indicator=S;
//# sourceMappingURL=index.js.map

@@ -1,2 +0,2 @@

import{RovingFocusGroup as e,useRovingFocus as r}from"@radix-ui/react-roving-focus";import{useLabelContext as a}from"@radix-ui/react-label";import{Presence as o}from"@radix-ui/react-presence";import{Primitive as t,extendPrimitive as n}from"@radix-ui/react-primitive";import{useControllableState as d}from"@radix-ui/react-use-controllable-state";import{useCallbackRef as i}from"@radix-ui/react-use-callback-ref";import{createContext as c}from"@radix-ui/react-context";import{useComposedRefs as l}from"@radix-ui/react-compose-refs";import{composeEventHandlers as u}from"@radix-ui/primitive";import*as s from"react";import m from"@babel/runtime/helpers/esm/extends";const p="button",[f,v]=c("Radio"),b=/*#__PURE__*/s.forwardRef(((e,r)=>{const{as:o=p,"aria-labelledby":n,name:i,checked:c,defaultChecked:v,required:b,disabled:h,readOnly:R,value:x="on",onCheckedChange:g,...C}=e,y=s.useRef(null),E=s.useRef(null),w=l(r,E),G=a(E),I=n||G,[F=!1,D]=d({prop:c,defaultProp:v});/*#__PURE__*/return s.createElement(s.Fragment,null,/*#__PURE__*/s.createElement("input",{ref:y,type:"radio",name:i,checked:F,required:b,disabled:h,readOnly:R,value:x,hidden:!0,onChange:u(g,(e=>{D(e.target.checked)}))}),/*#__PURE__*/s.createElement(f,{checked:F,disabled:h},/*#__PURE__*/s.createElement(t,m({type:"button",role:"radio","aria-checked":F,"aria-labelledby":I,"data-state":k(F),"data-readonly":R,"data-disabled":h?"":void 0,disabled:h,value:x},C,{as:o,ref:w,onClick:u(e.onClick,(()=>{var e;return null===(e=y.current)||void 0===e?void 0:e.click()}),{checkForDefaultPrevented:!1})}))))})),h="span",R=/*#__PURE__*/s.forwardRef(((e,r)=>{const{as:a=h,forceMount:n,...d}=e,i=v("RadioIndicator");/*#__PURE__*/return s.createElement(o,{present:n||i.checked},/*#__PURE__*/s.createElement(t,m({"data-state":k(i.checked),"data-disabled":i.disabled?"":void 0},d,{as:a,ref:r})))}));function k(e){return e?"checked":"unchecked"}const[x,g]=c("RadioGroup");export const RadioGroup=/*#__PURE__*/s.forwardRef(((r,o)=>{const{name:n,"aria-labelledby":c,defaultValue:l,value:p,required:f,rovingFocus:v=!0,onValueChange:b,...h}=r,R=a(),k=c||R,g=i(b),[C,y]=d({prop:p,defaultProp:l}),E=/*#__PURE__*/s.createElement(t,m({},h,{ref:o,role:"radiogroup","aria-labelledby":k}));/*#__PURE__*/return s.createElement(x,{name:n,value:C,required:f,rovingFocus:v,onValueChange:s.useCallback(u(g,(e=>y(e.target.value))),[g])},v?/*#__PURE__*/s.createElement(e,{loop:!0},E):E)}));/*#__PURE__*/export const RadioGroupItem=/*#__PURE__*/s.forwardRef(((e,r)=>g("RadioGroupItem").rovingFocus?/*#__PURE__*/s.createElement(C,m({},e,{ref:r})):/*#__PURE__*/s.createElement(y,m({},e,{ref:r}))));/*#__PURE__*/const C=/*#__PURE__*/s.forwardRef(((e,a)=>{const{disabled:o,...t}=e,n=g("RadioGroupItem"),d=s.useRef(null),i=l(a,d),c=n.value===t.value,p=r({disabled:o,active:c});/*#__PURE__*/return s.createElement(y,m({disabled:o},t,p,{ref:i,onKeyDown:u(t.onKeyDown,p.onKeyDown),onMouseDown:u(t.onMouseDown,p.onMouseDown),onFocus:u(t.onFocus,u(p.onFocus,(()=>{var e;void 0!==n.value&&(null===(e=d.current)||void 0===e||e.click())})))}))})),y=/*#__PURE__*/s.forwardRef(((e,r)=>{const a=g("RadioGroupItem"),o=a.value===e.value;/*#__PURE__*/return s.createElement(b,m({required:a.required,checked:o,name:a.name},e,{ref:r,onCheckedChange:u(e.onCheckedChange,a.onValueChange)}))}));export const RadioGroupIndicator=n(R,{displayName:"RadioGroupIndicator"});export const Root=RadioGroup;export const Item=RadioGroupItem;export const Indicator=RadioGroupIndicator;
import{Presence as e}from"@radix-ui/react-presence";import{useControllableState as r}from"@radix-ui/react-use-controllable-state";import{useCallbackRef as a}from"@radix-ui/react-use-callback-ref";import{Slot as o}from"@radix-ui/react-slot";import{RovingFocusGroup as t,RovingFocusItem as i}from"@radix-ui/react-roving-focus";import{extendPrimitive as d,Primitive as n}from"@radix-ui/react-primitive";import{createContext as l}from"@radix-ui/react-context";import{useComposedRefs as c}from"@radix-ui/react-compose-refs";import{useLabelContext as u}from"@radix-ui/react-label";import{composeEventHandlers as s}from"@radix-ui/primitive";import*as m from"react";import p from"@babel/runtime/helpers/esm/extends";const f="button",[b,h]=l("Radio"),v=/*#__PURE__*/m.forwardRef(((e,a)=>{const{as:o=f,"aria-labelledby":t,name:i,checked:d,defaultChecked:l,required:h,disabled:v,value:k="on",onCheckedChange:x,...C}=e,g=m.useRef(null),[E,y]=m.useState(null),G=c(a,(e=>y(e))),I=u(E),q=t||I,[w=!1,F]=r({prop:d,defaultProp:l});/*#__PURE__*/return m.createElement(m.Fragment,null,/*#__PURE__*/m.createElement("input",{ref:g,type:"radio",name:i,checked:w,required:h,disabled:v,value:k,style:{display:"none"},onChange:s(x,(e=>{F(e.target.checked)}))}),/*#__PURE__*/m.createElement(b,{checked:w,disabled:v},/*#__PURE__*/m.createElement(n,p({type:"button",role:"radio","aria-checked":w,"aria-labelledby":q,"data-state":R(w),"data-disabled":v?"":void 0,disabled:v,value:k},C,{as:o,ref:G,onClick:s(e.onClick,(()=>{var e;return null===(e=g.current)||void 0===e?void 0:e.click()}),{checkForDefaultPrevented:!1})}))))})),k="span",x=/*#__PURE__*/m.forwardRef(((r,a)=>{const{as:o=k,forceMount:t,...i}=r,d=h("RadioIndicator");/*#__PURE__*/return m.createElement(e,{present:t||d.checked},/*#__PURE__*/m.createElement(n,p({"data-state":R(d.checked),"data-disabled":d.disabled?"":void 0},i,{as:o,ref:a})))}));function R(e){return e?"checked":"unchecked"}const C="div",[g,E]=l("RadioGroup");export const RadioGroup=/*#__PURE__*/m.forwardRef(((e,o)=>{const{as:i=C,name:d,"aria-labelledby":n,defaultValue:l,value:c,required:f,orientation:b,dir:h="ltr",loop:v=!0,onValueChange:k,...x}=e,R=u(),E=n||R,y=a(k),[G,I]=r({prop:c,defaultProp:l});/*#__PURE__*/return m.createElement(g,{name:d,value:G,required:f,onValueChange:m.useCallback(s(y,(e=>I(e.target.value))),[y])},/*#__PURE__*/m.createElement(t,p({role:"radiogroup","aria-labelledby":E,orientation:b,dir:h,loop:v},x,{as:i,ref:o})))}));/*#__PURE__*/export const RadioGroupItem=/*#__PURE__*/m.forwardRef(((e,r)=>{const{disabled:a,...t}=e,d=E("RadioGroupItem"),n=m.useRef(null),l=c(r,n),u=d.value===t.value;/*#__PURE__*/return m.createElement(i,{as:o,focusable:!a,active:u},/*#__PURE__*/m.createElement(v,p({disabled:a,required:d.required,checked:u},t,{name:d.name,ref:l,onCheckedChange:s(e.onCheckedChange,d.onValueChange),onFocus:s(t.onFocus,(()=>{var e;void 0!==d.value&&(null===(e=n.current)||void 0===e||e.click())}))})))}));/*#__PURE__*/export const RadioGroupIndicator=d(x,{displayName:"RadioGroupIndicator"});export const Root=RadioGroup;export const Item=RadioGroupItem;export const Indicator=RadioGroupIndicator;
//# sourceMappingURL=index.module.js.map
{
"name": "@radix-ui/react-radio-group",
"version": "0.0.14",
"version": "0.0.15",
"license": "MIT",

@@ -24,7 +24,8 @@ "source": "src/index.ts",

"@radix-ui/react-context": "0.0.5",
"@radix-ui/react-label": "0.0.11",
"@radix-ui/react-polymorphic": "0.0.10",
"@radix-ui/react-label": "0.0.12",
"@radix-ui/react-polymorphic": "0.0.11",
"@radix-ui/react-presence": "0.0.13",
"@radix-ui/react-primitive": "0.0.11",
"@radix-ui/react-roving-focus": "0.0.11",
"@radix-ui/react-primitive": "0.0.12",
"@radix-ui/react-roving-focus": "0.0.12",
"@radix-ui/react-slot": "0.0.10",
"@radix-ui/react-use-callback-ref": "0.0.5",

@@ -31,0 +32,0 @@ "@radix-ui/react-use-controllable-state": "0.0.6"

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc