@ladder-ui/radio-group 0.5.0 → 0.7.0
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.js +1 -1
- package/dist/index.mjs +1 -1
- package/dist/radio-group.d.ts +25 -2
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var e=require("react/jsx-runtime"),a=require("react"),r=require("@ladder-ui/core"),i=require("@ladder-ui/layout"),o=require("@ladder-ui/primitives");const u=a.createContext(null),s=r.cva({base:"lui-radio-group-item",variants:{size:{sm:"lui-radio-group-item--sm",md:"lui-radio-group-item--md",lg:"lui-radio-group-item--lg"},status:{default:"",error:"lui-radio-group-item--error"},disabled:{true:"lui-radio-group-item--disabled",false:""}},defaultVariants:{size:"md",status:"default"}});function l({ref:a,children:s,className:l,value:t,defaultValue:d,onValueChange:n,name:m,disabled:c,orientation:p="vertical",...g}){const h=o.useRadioGroup({value:t,defaultValue:d,onValueChange:n,name:m,disabled:c});return e.jsx(u,{value:h,children:e.jsx(i.Flex,{ref:a,role:"radiogroup",direction:"horizontal"===p?"row":"column",gap:"2",className:r.concatClassNames("lui-radio-group","horizontal"===p&&"lui-radio-group--horizontal",l),...g,children:s})})}function t({ref:r,className:o,value:l,size:t,status:d,disabled:n,...m}){const c=a.use(u);if(!c)return null;const p=c.value===l,g=n||c.disabled;return e.jsxs(i.Box,{as:"span","data-slot":"radio-group-item",className:s({size:t,status:d,disabled:g,className:o}),children:[e.jsx("input",{ref:r,type:"radio",name:c.name,value:l,checked:p,disabled:g,"aria-invalid":"error"===d||void 0,className:"lui-radio-group-item__input",onChange:()=>c.onValueChange(l),...m}),e.jsx(i.Box,{as:"span",className:"lui-radio-group-item__control","aria-hidden":"true",children:e.jsx(i.Box,{as:"span",className:"lui-radio-group-item__dot"})})]})}l.displayName="RadioGroup",t.displayName="RadioGroupItem",exports.RadioGroup=l,exports.RadioGroupItem=t;
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as a,jsxs as e}from"react/jsx-runtime";import{createContext as i,
|
|
1
|
+
import{jsx as a,jsxs as e}from"react/jsx-runtime";import{createContext as i,use as r}from"react";import{cva as o,concatClassNames as l}from"@ladder-ui/core";import{Flex as u,Box as t}from"@ladder-ui/layout";import{useRadioGroup as d}from"@ladder-ui/primitives";const s=i(null),n=o({base:"lui-radio-group-item",variants:{size:{sm:"lui-radio-group-item--sm",md:"lui-radio-group-item--md",lg:"lui-radio-group-item--lg"},status:{default:"",error:"lui-radio-group-item--error"},disabled:{true:"lui-radio-group-item--disabled",false:""}},defaultVariants:{size:"md",status:"default"}});function m({ref:e,children:i,className:r,value:o,defaultValue:t,onValueChange:n,name:m,disabled:p,orientation:c="vertical",...g}){const f=d({value:o,defaultValue:t,onValueChange:n,name:m,disabled:p});return a(s,{value:f,children:a(u,{ref:e,role:"radiogroup",direction:"horizontal"===c?"row":"column",gap:"2",className:l("lui-radio-group","horizontal"===c&&"lui-radio-group--horizontal",r),...g,children:i})})}function p({ref:i,className:o,value:l,size:u,status:d,disabled:m,...p}){const c=r(s);if(!c)return null;const g=c.value===l,f=m||c.disabled;return e(t,{as:"span","data-slot":"radio-group-item",className:n({size:u,status:d,disabled:f,className:o}),children:[a("input",{ref:i,type:"radio",name:c.name,value:l,checked:g,disabled:f,"aria-invalid":"error"===d||void 0,className:"lui-radio-group-item__input",onChange:()=>c.onValueChange(l),...p}),a(t,{as:"span",className:"lui-radio-group-item__control","aria-hidden":"true",children:a(t,{as:"span",className:"lui-radio-group-item__dot"})})]})}m.displayName="RadioGroup",p.displayName="RadioGroupItem";export{m as RadioGroup,p as RadioGroupItem};
|
package/dist/radio-group.d.ts
CHANGED
|
@@ -19,15 +19,38 @@ declare const radioGroupItemVariants: (props?: (import("packages/core/dist/cva")
|
|
|
19
19
|
className?: string;
|
|
20
20
|
}) | undefined) => string;
|
|
21
21
|
export interface RadioGroupProps extends Omit<HTMLAttributes<HTMLDivElement>, "defaultValue">, UseRadioGroupProps {
|
|
22
|
+
/** React 19 ref — points to the root `<div>` element. */
|
|
23
|
+
ref?: Ref<HTMLDivElement>;
|
|
22
24
|
children?: ReactNode;
|
|
25
|
+
/** Controlled selected value. */
|
|
26
|
+
value?: string;
|
|
27
|
+
/** Initial selected value for uncontrolled usage. */
|
|
28
|
+
defaultValue?: string;
|
|
29
|
+
/** Callback fired when the selected value changes. */
|
|
30
|
+
onValueChange?: (value: string) => void;
|
|
31
|
+
/** Shared `name` attribute forwarded to all radio inputs — required for native form submission. */
|
|
32
|
+
name?: string;
|
|
33
|
+
/** Disables all radio items in the group. @default false */
|
|
34
|
+
disabled?: boolean;
|
|
35
|
+
/** Layout direction of the radio items. @default "vertical" */
|
|
23
36
|
orientation?: "vertical" | "horizontal";
|
|
24
37
|
}
|
|
25
|
-
export declare
|
|
38
|
+
export declare function RadioGroup({ ref, children, className, value, defaultValue, onValueChange, name, disabled, orientation, ...props }: RadioGroupProps): import("react/jsx-runtime").JSX.Element;
|
|
39
|
+
export declare namespace RadioGroup {
|
|
40
|
+
var displayName: string;
|
|
41
|
+
}
|
|
26
42
|
export interface RadioGroupItemProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, "size" | "type" | "value">, VariantProps<typeof radioGroupItemVariants> {
|
|
43
|
+
/** React 19 ref — points to the native `<input type="radio">` element. */
|
|
27
44
|
ref?: Ref<HTMLInputElement>;
|
|
45
|
+
/** Value submitted with the form when this item is selected. */
|
|
28
46
|
value: string;
|
|
47
|
+
/** Size of the radio control. @default "md" */
|
|
29
48
|
size?: "sm" | "md" | "lg";
|
|
49
|
+
/** Visual validation state — `"error"` highlights the control in red. @default "default" */
|
|
30
50
|
status?: "default" | "error";
|
|
31
51
|
}
|
|
32
|
-
export declare
|
|
52
|
+
export declare function RadioGroupItem({ ref, className, value, size, status, disabled, ...props }: RadioGroupItemProps): import("react/jsx-runtime").JSX.Element | null;
|
|
53
|
+
export declare namespace RadioGroupItem {
|
|
54
|
+
var displayName: string;
|
|
55
|
+
}
|
|
33
56
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ladder-ui/radio-group",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"sass": "^1.90.0",
|
|
50
50
|
"tslib": "^2.6.2",
|
|
51
51
|
"typescript": "^5.3.3",
|
|
52
|
-
"@ladder-ui/core": "0.
|
|
52
|
+
"@ladder-ui/core": "0.7.0"
|
|
53
53
|
},
|
|
54
54
|
"peerDependencies": {
|
|
55
55
|
"@ladder-ui/core": ">=0.0.0",
|
|
@@ -59,8 +59,8 @@
|
|
|
59
59
|
"**/*.css"
|
|
60
60
|
],
|
|
61
61
|
"dependencies": {
|
|
62
|
-
"@ladder-ui/layout": "^0.
|
|
63
|
-
"@ladder-ui/primitives": "^0.
|
|
62
|
+
"@ladder-ui/layout": "^0.7.0",
|
|
63
|
+
"@ladder-ui/primitives": "^0.7.0"
|
|
64
64
|
},
|
|
65
65
|
"scripts": {
|
|
66
66
|
"build": "pnpm clean && rollup -c",
|