Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
MIcro REact COmponents - extensible library for interfaces with no heavy deps
Mireco is an extensible library for user interfaces with no heavy dependencies (especially css).
"The golden teaspoon of date pickers"
- Luke Hodkinson
Looking for a Mireco interface but styled to your favourite web theme? Check out our styled wrappers:
Check out the live demo page here.
Above all else, Mireco aims to be the best interface for dealing with input components. All components adhere to the following guidelines:
value
and onChange
onChange
is a function callback with the new value
as an argument (consumers do no
direct reading from dom elements with refs)onChange
callback and value
prop both use the same value
format, which is always a
primitive or predefined shape of primitivesCheckbox
component uses a convenience label="label contents"
prop instead of requiring
<Label><Checkbox/> label contents</Label>
Non battle-tested guidelines:
style
and className
should be passed through - with prefixes
where there are multiple injection points eg. containerStyle
and inputStyle
style
prop refers to the outermost container of a Mireco component. More specific style
overrides are given with explicit references eg. inputStyle
and labelStyle
. Where these
overlap and refer to the same element as the style
prop, they are merged with the more specific
name taking precedent.All Mireco components should be designed with the following in mind:
svg
so they support css styling,
only use native fonts<div>
html
form
valuerem
(except for em
for line-height
s relative to font-size
)inline
or inline-block
by
default. For convenience, the Mireco api provides a block version of all inputs by passing a
block
propflex-basis
to take up multiple rows when necessaryInstall the package from npm:
npm install mireco
Make sure your html document is encoded properly (required by parse-duration
micro symbol):
<html>
<head>
<meta charset="utf-8">
</head>
</html>
Add the stylesheets:
<link rel="stylesheet" href="node_modules/mireco/dist/mireco-layout.css" />
<link rel="stylesheet" href="node_modules/mireco/dist/mireco-theme.css" />
To support inputs that have modal dropdowns, ensure that the body of your document (and any
absolutely positioned content blocks such as modals) all have a padding of at least 15rem
at the
bottom.
For convenience install mise to manage your environment.
When it's installed setup mise
with:
mise install
This will install the required versions of node
and ruby
.
To install the project dependencies:
bundle
npm install
( cd demo && npm install )
This will install the gems
(for demo site hosting) and node_modules
(for package building).
With the environment and project installation complete, you can build mireco
with:
npm run build
Or more likely for development convenience, you'll want to watch for changes with:
npm run watch
With mireco
built, you can build the demo site (using your local copy of mireco
) with:
( cd demo && npm run build )
Or again for convenience, you will want to both watch for changes and host the site with:
( cd demo && npm run start )
This will use jekyll
to host the demo site on your computer.
Check out the API Documentation.
Basic form inputs:
Compound form inputs:
Layout:
Having properly bound components in React is tricky when the components that the user needs to interact with are required to sometimes be in invalid states.
The best example of this is a date selector with a text input component - if a user is typing in a
value of 31/3/2012
, between each keystroke the value when parsed could either be completely
different (31/3
would resolve to the current year) or invalid (31
would be of the current month
which does not necessarily contain 31 days).
Most packages get around this with a variety of strategies that have their own drawbacks:
All Mireco components should instead follow this flow of value update:
undefined
means that a true value
cannot in any way be understood from the
various state contents
null
means that the value is explicitly set to nothingtrue value
(of whatever data type is appropriate for your input, eg. milliseconds integer)
is reported when the value can be parsed with the most generous rules possible (does not have to
be perfect)prop value
, it is compared to the current various state contents
. If it has changed:
prop value
is set to undefined
, do absolutely nothingprop value
is set to a true value
or null
:
various state contents
:
various state contents
to a perfectly formatted representation of the new
prop value
, as this means the parent has explicitly overridden our valueprop value
is set to a true value
:
various state contents
to a perfectly formatted representation of the prop value
various state contents
to defaultsFollowing this flow, self-initiated updates of value are non destructive to the current state whilst
still allowing the parent to change its value. Also, as undefined
and null
are often
interchangeable you can simply take the given value
onChange
without any validation or workflow
in Mireco consumers.
FAQs
MIcro REact COmponents - extensible library for interfaces with no heavy deps
The npm package mireco receives a total of 2,891 weekly downloads. As such, mireco popularity was classified as popular.
We found that mireco 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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.