Security News
Node.js EOL Versions CVE Dubbed the "Worst CVE of the Year" by Security Experts
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
@stenajs-webui/filter
Advanced tools
This package contains components and functionality that makes it easy to create custom filters in a drawer, and an overview row containing chips.
This package is alpha. API:s will most likely change, and more features added. If you use it, be ready for breaking changes.
A section is one expandable part of the filter. The filter can consist of many sections. Each section can how none, one or many chips.
The filter components access state, dispatch and actions. These are fetched from context, so any filter components must be wrapped with
<SearchFilterContext actions={actions} state={state} dispatch={dispatch}>
<SearchFilterButton/>
<SearchFilterChips>
<SectionChips {...stuff} />
</SearchFilterChips>
<SearchFilterDrawer>
... sections
</SearchFilterDrawer>
If you are only using local state (no Redux, persistence, etc),
you can use SearchFilterLocalStateContext
.
It will automatically setup actions, state and dispatch.
<SearchFilterLocalStateContext<FormModel>
initialFormModel={{ startDate: undefined, endDate: undefined }}
>
... same as above
</SearchFilterLocalStateContext>
If you use SearchFilterLocalStateContext
, you can use this to access filter state.
const state = useSearchFilterState();
You can create custom sections easily.
const MySection = (...props) => (
<SearchFilterSection sectionId={sectionId} loading={loading} error={error}>
<ChipMultiSelect
options={filteredOptions}
value={listValue}
onValueChange={onValueChangeInternal}
inputValue={text}
onInputChange={setText}
/>
</SearchFilterSection>
);
See source code for examples.
There are sections available ready to use.
More will be made available as the filter
package matures.
Add the section to the drawer.
<DateRangeCalendarSection
sectionId={"comparisonDate"}
{...createDateRangeSectionProps(state.formModel, "startDate", "endDate")}
/>
And add the chips.
<SectionChips
sectionId={"comparisonDate"}
emptyChipLabel={"No dates"}
{...createChipsPropsForDateRange(state.formModel, "startDate", "endDate")}
/>
Add the section to the drawer. This section does not have a helper method for creating props.
They must be specified manually. This might change.
<ChipMultiSelectSection
sectionId={"divisions"}
loading={false}
options={divisionOptions}
value={state.formModel.divisions}
onValueChange={(divisions) =>
dispatch(actions.setFormModelFields({ divisions }))
}
/>
And add the chips.
<SectionChips
sectionId={"divisions"}
emptyChipLabel={"All division"}
{...createChipsPropsForBooleanRecord(
state.formModel,
"divisions",
divisionOptions
)}
/>
In this example, state.formModel.divisions
must be a BooleanRecord
.
Another section for BooleanRecord
is SimpleCheckboxListSection
.
They are API compatible and are interchangeable.
<SimpleCheckboxListSection
sectionId={"divisions"}
loading={false}
options={divisionOptions}
value={state.formModel.divisions}
onValueChange={(divisions) =>
dispatch(actions.setFormModelFields({ divisions }))
}
/>
You can add all chips for a section using the SectionChips
component.
<SectionChips
sectionId={"divisions"}
emptyChipLabel={"All division"}
{...createChipsPropsForBooleanRecord(
state.formModel,
"divisions",
divisionOptions
)}
/>
If you need more manual control over each chip, you can add them individually.
{
myList.map(({ value, label }) => (
<SearchFilterChip
key={value}
label={label ?? sectionId}
sectionId={sectionId}
onClickRemove={onClickRemoveOnChip}
value={value}
/>
));
}
If you need a chip to indicate no selection, you can use EmptyChip
.
<EmptyChip sectionId={sectionId} label={emptyChipLabel} />
FAQs
Unknown package
The npm package @stenajs-webui/filter receives a total of 235 weekly downloads. As such, @stenajs-webui/filter popularity was classified as not popular.
We found that @stenajs-webui/filter demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 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.
Security News
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.