
Research
/Security News
Weaponizing Discord for Command and Control Across npm, PyPI, and RubyGems.org
Socket researchers uncover how threat actors weaponize Discord across the npm, PyPI, and RubyGems ecosystems to exfiltrate sensitive data.
@promaster-sdk/react-property-selectors
Advanced tools
Hooks for building UI for selection of a single property value.
A common task in product selection tools is to have an UI that allows the user to make a valid property value selection. This package contains a react components for showing different UI for selection of a single property, such as a dropdown, textbox etc.
This package uses hooks and prop-getters to create headless UI components. Similar to downshift and react-table.
NOTE: Starting with v7 the old component based versions of the selectors are deprecated. See the old README for info on them.
npm install --save @promaster-sdk/react-property-selectors
The library is compiled to ES5 and no polyfills are required.
This is a library of react components so it cannot be run directly. To demonstrate and test the react component react-storybook is used. To start storybook just run:
yarn storybook
The storybooks stories is currently the best examples how to use this package.
const sel = useAmountInputBox({
value: state.amount,
inputUnit: state.selectedUnit,
inputDecimalCount: state.selectedDecimalCount,
onValueChange,
readonly: false,
errorMessage: "",
isRequiredMessage: "Is required",
notNumericMessage: "Not numeric",
debounceTime: 350,
});
const sel = useAmountFormatSelector({
selectedUnit: state.selectedUnit,
selectedDecimalCount: state.selectedDecimalCount,
onFormatChanged: (selectedUnit: Unit.Unit<unknown>, selectedDecimalCount: number) =>
setState(merge(state, { selectedUnit, selectedDecimalCount })),
onFormatCleared: () =>
setState(
merge(state, {
selectedUnit: BaseUnits.Meter,
selectedDecimalCount: 2,
})
),
unitsFormat: unitsFormat,
units: units,
});
const sel = useAmountPropertySelector({
fieldName: "a",
propertyName: "a",
propertyValueSet: state.propertyValueSet,
inputUnit: state.selectedUnit,
inputDecimalCount: state.selectedDecimalCount,
onValueChange,
filterPrettyPrint: filterPrettyPrint,
validationFilter: validationFilter,
readonly: false,
isRequiredMessage: "Is required",
notNumericMessage: "Not numeric",
onFormatChanged,
onFormatCleared,
unitsFormat: unitsFormat,
units: units,
});
const sel = useCheckboxPropertySelector({
propertyName: "a",
valueItems: valueItems1,
propertyValueSet: myState,
locked: false,
showCodes: true,
onValueChange: (pv) => setMyState(PropertyValueSet.set("a", pv as PropertyValue.PropertyValue, myState)),
filterPrettyPrint: () => "",
readOnly: false,
});
const sel = useComboboxPropertySelector({
propertyName: "a",
valueItems: valueItems1,
propertyValueSet: myState,
locked: false,
showCodes: true,
sortValidFirst: true,
onValueChange: (pv) => setMyState(PropertyValueSet.set("a", pv as PropertyValue.PropertyValue, myState)),
filterPrettyPrint: filterPrettyPrint,
readOnly: false,
});
const sel = useImageComboboxPropertySelector({
propertyName: "b",
valueItems: valueItems2,
propertyValueSet: myState,
locked: false,
showCodes: true,
sortValidFirst: true,
onValueChange: (pv) => setMyState(PropertyValueSet.set("b", pv as PropertyValue.PropertyValue, myState)),
filterPrettyPrint: filterPrettyPrint,
readOnly: false,
});
const sel = useRadioGroupPropertySelector({
propertyName: "a",
valueItems: valueItems1,
propertyValueSet: state,
locked: false,
showCodes: true,
onValueChange: (pv) => setState(PropertyValueSet.set("a", pv as PropertyValue.PropertyValue, state)),
filterPrettyPrint: filterPrettyPrint,
readOnly: false,
});
const { getInputProps } = useTextboxPropertySelector({
propertyName: "a",
propertyValueSet: myState,
onValueChange,
readOnly: false,
debounceTime: 600,
});
FAQs
Hooks for building UI for selection of property values
The npm package @promaster-sdk/react-property-selectors receives a total of 88 weekly downloads. As such, @promaster-sdk/react-property-selectors popularity was classified as not popular.
We found that @promaster-sdk/react-property-selectors demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 11 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
/Security News
Socket researchers uncover how threat actors weaponize Discord across the npm, PyPI, and RubyGems ecosystems to exfiltrate sensitive data.
Security News
Socket now integrates with Bun 1.3’s Security Scanner API to block risky packages at install time and enforce your organization’s policies in local dev and CI.
Research
The Socket Threat Research Team is tracking weekly intrusions into the npm registry that follow a repeatable adversarial playbook used by North Korean state-sponsored actors.