@nextui-org/radio
Advanced tools
Comparing version 0.0.0-dev-v2-20230405200614 to 0.0.0-dev-v2-20230405205125
@@ -72,2 +72,3 @@ "use strict"; | ||
disableAnimation = (_e = groupContext == null ? void 0 : groupContext.disableAnimation) != null ? _e : false, | ||
onChange = groupContext == null ? void 0 : groupContext.onChange, | ||
autoFocus = false, | ||
@@ -94,6 +95,5 @@ className, | ||
}, [groupContext.isRequired]); | ||
const isInvalid = (0, import_react2.useMemo)( | ||
() => groupContext.validationState === "invalid", | ||
[groupContext.validationState] | ||
); | ||
const isInvalid = (0, import_react2.useMemo)(() => groupContext.validationState === "invalid", [ | ||
groupContext.validationState | ||
]); | ||
const ariaRadioProps = (0, import_react2.useMemo)(() => { | ||
@@ -175,3 +175,4 @@ const ariaLabel = otherProps["aria-label"] || typeof children === "string" ? children : void 0; | ||
"data-readonly": (0, import_shared_utils2.dataAttr)(inputProps.readOnly), | ||
...(0, import_utils.mergeProps)(inputProps, focusProps) | ||
...(0, import_utils.mergeProps)(inputProps, focusProps), | ||
onChange: (0, import_utils.chain)(inputProps.onChange, onChange) | ||
}; | ||
@@ -281,2 +282,4 @@ }; | ||
className, | ||
onChange, | ||
onValueChange, | ||
...otherProps | ||
@@ -291,5 +294,6 @@ } = props; | ||
isRequired, | ||
orientation | ||
orientation, | ||
onChange: onValueChange | ||
}; | ||
}, [otherProps]); | ||
}, [otherProps, onValueChange]); | ||
const groupState = (0, import_radio2.useRadioGroupState)(otherPropsWithOrientation); | ||
@@ -309,5 +313,16 @@ const { labelProps, radioGroupProps: groupProps } = (0, import_radio3.useRadioGroup)( | ||
isDisabled, | ||
disableAnimation | ||
disableAnimation, | ||
onChange | ||
}), | ||
[size, color, radius, groupState, isRequired, validationState, isDisabled, disableAnimation] | ||
[ | ||
size, | ||
color, | ||
radius, | ||
groupState, | ||
isRequired, | ||
validationState, | ||
isDisabled, | ||
disableAnimation, | ||
onChange | ||
] | ||
); | ||
@@ -350,3 +365,11 @@ const slots = (0, import_react3.useMemo)(() => (0, import_theme2.radioGroup)(), []); | ||
var RadioGroup = (0, import_system2.forwardRef)((props, ref) => { | ||
const { Component, children, label, context, getGroupProps, getLabelProps, getWrapperProps } = useRadioGroup({ ref, ...props }); | ||
const { | ||
Component, | ||
children, | ||
label, | ||
context, | ||
getGroupProps, | ||
getLabelProps, | ||
getWrapperProps | ||
} = useRadioGroup({ ref, ...props }); | ||
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Component, { ...getGroupProps(), children: [ | ||
@@ -353,0 +376,0 @@ label && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("label", { ...getLabelProps(), children: label }), |
@@ -60,2 +60,4 @@ "use strict"; | ||
className, | ||
onChange, | ||
onValueChange, | ||
...otherProps | ||
@@ -70,5 +72,6 @@ } = props; | ||
isRequired, | ||
orientation | ||
orientation, | ||
onChange: onValueChange | ||
}; | ||
}, [otherProps]); | ||
}, [otherProps, onValueChange]); | ||
const groupState = (0, import_radio.useRadioGroupState)(otherPropsWithOrientation); | ||
@@ -88,5 +91,16 @@ const { labelProps, radioGroupProps: groupProps } = (0, import_radio2.useRadioGroup)( | ||
isDisabled, | ||
disableAnimation | ||
disableAnimation, | ||
onChange | ||
}), | ||
[size, color, radius, groupState, isRequired, validationState, isDisabled, disableAnimation] | ||
[ | ||
size, | ||
color, | ||
radius, | ||
groupState, | ||
isRequired, | ||
validationState, | ||
isDisabled, | ||
disableAnimation, | ||
onChange | ||
] | ||
); | ||
@@ -129,3 +143,11 @@ const slots = (0, import_react.useMemo)(() => (0, import_theme.radioGroup)(), []); | ||
var RadioGroup = (0, import_system.forwardRef)((props, ref) => { | ||
const { Component, children, label, context, getGroupProps, getLabelProps, getWrapperProps } = useRadioGroup({ ref, ...props }); | ||
const { | ||
Component, | ||
children, | ||
label, | ||
context, | ||
getGroupProps, | ||
getLabelProps, | ||
getWrapperProps | ||
} = useRadioGroup({ ref, ...props }); | ||
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Component, { ...getGroupProps(), children: [ | ||
@@ -132,0 +154,0 @@ label && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("label", { ...getLabelProps(), children: label }), |
@@ -65,2 +65,3 @@ "use strict"; | ||
disableAnimation = (_e = groupContext == null ? void 0 : groupContext.disableAnimation) != null ? _e : false, | ||
onChange = groupContext == null ? void 0 : groupContext.onChange, | ||
autoFocus = false, | ||
@@ -87,6 +88,5 @@ className, | ||
}, [groupContext.isRequired]); | ||
const isInvalid = (0, import_react2.useMemo)( | ||
() => groupContext.validationState === "invalid", | ||
[groupContext.validationState] | ||
); | ||
const isInvalid = (0, import_react2.useMemo)(() => groupContext.validationState === "invalid", [ | ||
groupContext.validationState | ||
]); | ||
const ariaRadioProps = (0, import_react2.useMemo)(() => { | ||
@@ -168,3 +168,4 @@ const ariaLabel = otherProps["aria-label"] || typeof children === "string" ? children : void 0; | ||
"data-readonly": (0, import_shared_utils2.dataAttr)(inputProps.readOnly), | ||
...(0, import_utils.mergeProps)(inputProps, focusProps) | ||
...(0, import_utils.mergeProps)(inputProps, focusProps), | ||
onChange: (0, import_utils.chain)(inputProps.onChange, onChange) | ||
}; | ||
@@ -171,0 +172,0 @@ }; |
@@ -13,3 +13,3 @@ import * as react from 'react'; | ||
interface Props extends HTMLNextUIProps<"div", AriaRadioGroupProps> { | ||
interface Props extends HTMLNextUIProps<"div"> { | ||
/** | ||
@@ -40,4 +40,8 @@ * Ref to the DOM node. | ||
styles?: SlotsToClasses<RadioGroupSlots>; | ||
/** | ||
* React aria onChange event. | ||
*/ | ||
onValueChange?: AriaRadioGroupProps["onChange"]; | ||
} | ||
type UseRadioGroupProps = Omit<Props, "defaultChecked"> & Pick<RadioProps, "color" | "size" | "radius" | "isDisabled" | "disableAnimation">; | ||
type UseRadioGroupProps = Omit<Props, "defaultChecked"> & Omit<AriaRadioGroupProps, "onChange"> & Pick<RadioProps, "color" | "size" | "radius" | "isDisabled" | "disableAnimation" | "onChange">; | ||
type ContextType = { | ||
@@ -52,2 +56,3 @@ groupState: RadioGroupState; | ||
disableAnimation?: RadioProps["disableAnimation"]; | ||
onChange?: RadioProps["onChange"]; | ||
}; | ||
@@ -54,0 +59,0 @@ declare function useRadioGroup(props: UseRadioGroupProps): { |
@@ -49,2 +49,4 @@ "use strict"; | ||
className, | ||
onChange, | ||
onValueChange, | ||
...otherProps | ||
@@ -59,5 +61,6 @@ } = props; | ||
isRequired, | ||
orientation | ||
orientation, | ||
onChange: onValueChange | ||
}; | ||
}, [otherProps]); | ||
}, [otherProps, onValueChange]); | ||
const groupState = (0, import_radio.useRadioGroupState)(otherPropsWithOrientation); | ||
@@ -77,5 +80,16 @@ const { labelProps, radioGroupProps: groupProps } = (0, import_radio2.useRadioGroup)( | ||
isDisabled, | ||
disableAnimation | ||
disableAnimation, | ||
onChange | ||
}), | ||
[size, color, radius, groupState, isRequired, validationState, isDisabled, disableAnimation] | ||
[ | ||
size, | ||
color, | ||
radius, | ||
groupState, | ||
isRequired, | ||
validationState, | ||
isDisabled, | ||
disableAnimation, | ||
onChange | ||
] | ||
); | ||
@@ -82,0 +96,0 @@ const slots = (0, import_react.useMemo)(() => (0, import_theme.radioGroup)(), []); |
@@ -46,8 +46,8 @@ import * as tailwind_variants from 'tailwind-variants'; | ||
label: (slotProps?: tailwind_variants.ClassProp<tailwind_variants.ClassValue> | undefined) => string; | ||
description: (slotProps?: tailwind_variants.ClassProp<tailwind_variants.ClassValue> | undefined) => string; | ||
labelWrapper: (slotProps?: tailwind_variants.ClassProp<tailwind_variants.ClassValue> | undefined) => string; | ||
description: (slotProps?: tailwind_variants.ClassProp<tailwind_variants.ClassValue> | undefined) => string; | ||
wrapper: (slotProps?: tailwind_variants.ClassProp<tailwind_variants.ClassValue> | undefined) => string; | ||
control: (slotProps?: tailwind_variants.ClassProp<tailwind_variants.ClassValue> | undefined) => string; | ||
}; | ||
styles: SlotsToClasses<"base" | "label" | "labelWrapper" | "description" | "wrapper" | "control"> | undefined; | ||
styles: SlotsToClasses<"base" | "label" | "description" | "labelWrapper" | "wrapper" | "control"> | undefined; | ||
description: ReactNode; | ||
@@ -54,0 +54,0 @@ isSelected: boolean | undefined; |
@@ -61,2 +61,3 @@ "use strict"; | ||
disableAnimation = (_e = groupContext == null ? void 0 : groupContext.disableAnimation) != null ? _e : false, | ||
onChange = groupContext == null ? void 0 : groupContext.onChange, | ||
autoFocus = false, | ||
@@ -83,6 +84,5 @@ className, | ||
}, [groupContext.isRequired]); | ||
const isInvalid = (0, import_react2.useMemo)( | ||
() => groupContext.validationState === "invalid", | ||
[groupContext.validationState] | ||
); | ||
const isInvalid = (0, import_react2.useMemo)(() => groupContext.validationState === "invalid", [ | ||
groupContext.validationState | ||
]); | ||
const ariaRadioProps = (0, import_react2.useMemo)(() => { | ||
@@ -164,3 +164,4 @@ const ariaLabel = otherProps["aria-label"] || typeof children === "string" ? children : void 0; | ||
"data-readonly": (0, import_shared_utils2.dataAttr)(inputProps.readOnly), | ||
...(0, import_utils.mergeProps)(inputProps, focusProps) | ||
...(0, import_utils.mergeProps)(inputProps, focusProps), | ||
onChange: (0, import_utils.chain)(inputProps.onChange, onChange) | ||
}; | ||
@@ -167,0 +168,0 @@ }; |
{ | ||
"name": "@nextui-org/radio", | ||
"version": "0.0.0-dev-v2-20230405200614", | ||
"version": "0.0.0-dev-v2-20230405205125", | ||
"description": "Radios allow users to select a single option from a list of mutually exclusive options.", | ||
@@ -37,6 +37,6 @@ "keywords": [ | ||
"@react-stately/radio": "^3.7.0", | ||
"@nextui-org/theme": "0.0.0-dev-v2-20230405200614", | ||
"@nextui-org/dom-utils": "0.0.0-dev-v2-20230405200614", | ||
"@nextui-org/shared-utils": "0.0.0-dev-v2-20230405200614", | ||
"@nextui-org/system": "0.0.0-dev-v2-20230405200614" | ||
"@nextui-org/shared-utils": "0.0.0-dev-v2-20230405205125", | ||
"@nextui-org/system": "0.0.0-dev-v2-20230405205125", | ||
"@nextui-org/theme": "0.0.0-dev-v2-20230405205125", | ||
"@nextui-org/dom-utils": "0.0.0-dev-v2-20230405205125" | ||
}, | ||
@@ -48,3 +48,3 @@ "devDependencies": { | ||
"react": "^18.0.0", | ||
"@nextui-org/button": "0.0.0-dev-v2-20230405200614" | ||
"@nextui-org/button": "0.0.0-dev-v2-20230405205125" | ||
}, | ||
@@ -51,0 +51,0 @@ "clean-package": "../../../clean-package.config.json", |
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
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
65692
1745
+ Added@nextui-org/dom-utils@0.0.0-dev-v2-20230405205125(transitive)
+ Added@nextui-org/shared-utils@0.0.0-dev-v2-20230405205125(transitive)
+ Added@nextui-org/system@0.0.0-dev-v2-20230405205125(transitive)
+ Added@nextui-org/theme@0.0.0-dev-v2-20230405205125(transitive)
- Removed@nextui-org/dom-utils@0.0.0-dev-v2-20230405200614(transitive)
- Removed@nextui-org/shared-utils@0.0.0-dev-v2-20230405200614(transitive)
- Removed@nextui-org/system@0.0.0-dev-v2-20230405200614(transitive)
- Removed@nextui-org/theme@0.0.0-dev-v2-20230405200614(transitive)