You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

@react-stately/checkbox

Package Overview
Dependencies
Maintainers
2
Versions
1053
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@react-stately/checkbox - npm Package Compare versions

Comparing version

to
3.0.0-nightly-e97af2b53-250726

2

dist/types.d.ts

@@ -7,2 +7,4 @@ import { CheckboxGroupProps } from "@react-types/checkbox";

readonly value: readonly string[];
/** Default selected values. */
readonly defaultValue: readonly string[];
/** Whether the checkbox group is disabled. */

@@ -9,0 +11,0 @@ readonly isDisabled: boolean;

9

dist/useCheckboxGroupState.main.js

@@ -26,2 +26,3 @@ var $6SsBH$reactstatelyform = require("@react-stately/form");

let [selectedValues, setValue] = (0, $6SsBH$reactstatelyutils.useControlledState)(props.value, props.defaultValue || [], props.onChange);
let [initialValues] = (0, $6SsBH$react.useState)(selectedValues);
let isRequired = !!props.isRequired && selectedValues.length === 0;

@@ -34,6 +35,7 @@ let invalidValues = (0, $6SsBH$react.useRef)(new Map());

let isInvalid = validation.displayValidation.isInvalid;
var _props_validationState;
var _props_defaultValue, _props_validationState;
const state = {
...validation,
value: selectedValues,
defaultValue: (_props_defaultValue = props.defaultValue) !== null && _props_defaultValue !== void 0 ? _props_defaultValue : initialValues,
setValue (value) {

@@ -50,3 +52,6 @@ if (props.isReadOnly || props.isDisabled) return;

if (props.isReadOnly || props.isDisabled) return;
if (!selectedValues.includes(value)) setValue(selectedValues.concat(value));
if (!selectedValues.includes(value)) {
selectedValues = selectedValues.concat(value);
setValue(selectedValues);
}
},

@@ -53,0 +58,0 @@ removeValue (value) {

import {useFormValidationState as $3Of4A$useFormValidationState, mergeValidation as $3Of4A$mergeValidation} from "@react-stately/form";
import {useControlledState as $3Of4A$useControlledState} from "@react-stately/utils";
import {useRef as $3Of4A$useRef} from "react";
import {useState as $3Of4A$useState, useRef as $3Of4A$useRef} from "react";

@@ -20,2 +20,3 @@ /*

let [selectedValues, setValue] = (0, $3Of4A$useControlledState)(props.value, props.defaultValue || [], props.onChange);
let [initialValues] = (0, $3Of4A$useState)(selectedValues);
let isRequired = !!props.isRequired && selectedValues.length === 0;

@@ -28,6 +29,7 @@ let invalidValues = (0, $3Of4A$useRef)(new Map());

let isInvalid = validation.displayValidation.isInvalid;
var _props_validationState;
var _props_defaultValue, _props_validationState;
const state = {
...validation,
value: selectedValues,
defaultValue: (_props_defaultValue = props.defaultValue) !== null && _props_defaultValue !== void 0 ? _props_defaultValue : initialValues,
setValue (value) {

@@ -44,3 +46,6 @@ if (props.isReadOnly || props.isDisabled) return;

if (props.isReadOnly || props.isDisabled) return;
if (!selectedValues.includes(value)) setValue(selectedValues.concat(value));
if (!selectedValues.includes(value)) {
selectedValues = selectedValues.concat(value);
setValue(selectedValues);
}
},

@@ -47,0 +52,0 @@ removeValue (value) {

{
"name": "@react-stately/checkbox",
"version": "3.0.0-nightly-e94e36431-241203",
"version": "3.0.0-nightly-e97af2b53-250726",
"description": "Spectrum UI components in React",

@@ -9,3 +9,7 @@ "license": "Apache-2.0",

"exports": {
"types": "./dist/types.d.ts",
"source": "./src/index.ts",
"types": [
"./dist/types.d.ts",
"./src/index.ts"
],
"import": "./dist/import.mjs",

@@ -26,6 +30,6 @@ "require": "./dist/main.js"

"dependencies": {
"@react-stately/form": "^3.0.0-nightly-e94e36431-241203",
"@react-stately/utils": "^3.0.0-nightly-e94e36431-241203",
"@react-types/checkbox": "^3.0.0-nightly-e94e36431-241203",
"@react-types/shared": "^3.0.0-nightly-e94e36431-241203",
"@react-stately/form": "3.0.0-nightly-e97af2b53-250726",
"@react-stately/utils": "3.0.0-nightly-e97af2b53-250726",
"@react-types/checkbox": "3.0.0-nightly-e97af2b53-250726",
"@react-types/shared": "3.0.0-nightly-e97af2b53-250726",
"@swc/helpers": "^0.5.0"

@@ -38,4 +42,3 @@ },

"access": "public"
},
"stableVersion": "3.6.10"
}
}

@@ -16,3 +16,3 @@ /*

import {useControlledState} from '@react-stately/utils';
import {useRef} from 'react';
import {useRef, useState} from 'react';
import {ValidationResult, ValidationState} from '@react-types/shared';

@@ -23,2 +23,4 @@

readonly value: readonly string[],
/** Default selected values. */
readonly defaultValue: readonly string[],

@@ -71,2 +73,3 @@ /** Whether the checkbox group is disabled. */

let [selectedValues, setValue] = useControlledState(props.value, props.defaultValue || [], props.onChange);
let [initialValues] = useState(selectedValues);
let isRequired = !!props.isRequired && selectedValues.length === 0;

@@ -84,2 +87,3 @@

value: selectedValues,
defaultValue: props.defaultValue ?? initialValues,
setValue(value) {

@@ -102,3 +106,4 @@ if (props.isReadOnly || props.isDisabled) {

if (!selectedValues.includes(value)) {
setValue(selectedValues.concat(value));
selectedValues = selectedValues.concat(value);
setValue(selectedValues);
}

@@ -105,0 +110,0 @@ },

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