Security News
pnpm 10.0.0 Blocks Lifecycle Scripts by Default
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
@kleeen/core-react
Advanced tools
Component to show/hide elements according the user role.
setAccessControl:
Set the user permissions in the redux state.
Type | Name | Description |
---|---|---|
object | accessControlSettings | Settings for the accessControl |
object | accessControlSettings.permissions | Permissions json base |
string | accessControlSettings.setPathToRoleOnState | Path to the rol property on state |
function | customRenderView | Function to eval the render of the AccessControl |
function | customAccessControlChecker | Function to eval the permissions |
const permissions = {
WORKBENCH: {
CHILDREN: {
ACTIONS: {
PERMISSIONS: {
ADMIN: 'SHOW',
GUEST: 'HIDE',
},
}
}
}
};
setAccessControl({ permissions, pathToRoleOnState: 'user.role' });
Type | Name | Description |
---|---|---|
string | id | Permission id to be evaluated with all permissions |
string | role | Get current role from redux state |
node | children | According to the permssions it is shown/hidden |
function | children | Execute the function with the user's permission to be used as the user requires |
<AccessControl id="LAYOUT.SEARCH_BOX">
<input type="text" />
</AccessControl>
<AccessControl id="LAYOUT.HEALTH_SPARKLINE">
{({ permission }) => (
permission === 'SHOW'
? <input type="text" />
: null
)
}
</AccessControl>
Provider for the use of icons defined in a file with the following structure (iconRegistry):
{
name: { path: './path.svg', alt: 'Icon name' }
}
Type | Name | Default Values |
---|---|---|
json | iconRegistry | { } |
IconRegistryProvider({ iconRegistry })
import { IconRegistryConsumer } from '@kleeen/core-react';
<IconRegistryConsumer>
{({ getIcon }) => (
<img className="icon" src={getIcon(kuiIcon).path} alt={getIcon(kuiIcon).alt} />
)}
</IconRegistryConsumer>
Provider to change the theme of the application by adding or modifying the classes of the html tag.
Type | Name | Default Values |
---|---|---|
String | initialTheme |
ThemingProvider({ themeName })
import { ThemingConsumer } from '@kleeen/core-react';
<ThemingConsumer>
{({ setTheme }) => (
{setTheme('newThemeName')}
)}
</ThemingConsumer>
Provider for the internationalization of the application defined in a file with the following structure (localeData):
{
"en": {
"textKey": "English translation!"
},
"es": {
"textKey": "¡Traducción español!"
}
}
Type | Name | Default Values |
---|---|---|
String | locale | Navigator Languaje |
Array | languageToSupport | [ es , en , fr , it ] |
Json | localeData | { } |
TranslationProvider({ localeData, locale: 'en' })
import { ThemingConsumer } from '@kleeen/core-react';
<ThemingConsumer>
{({ setLocale }) => (
select onChange={e => setLocale(e.target.value)}>
<option value="en">Ingles</option>
<option value="es">Español</option>
</select>
)}
</ThemingConsumer>
<Translate defaultMessage="content only for Admin">{'App.adminText'}</Translate>
It allows to add the consumers of the combine consumer to a component to pass the props and these can be used from that component.
import { KUIConnect } from '@kleeen/core-react';
const App = (props) => {
render (
const { translate, getIcon, setLocale } = props;
return (
<div>
...
</div>
);
);
};
compose(
connect(state => state, ({ logIn })),
KUIConnect(state => state),
)(App);
Component that combines several providers, allows consuming components to subscribe to context changes. The properties for this function are children
and providers
.
<KUICombineProviders providers = {[
TranslationProvider({ localeData, locale: 'en' }),
ReduxProvider,
IconRegistryProvider({ iconRegistry }),
]}
>
Function that subscribes to context changes. The properties for this function are children
and consumers
.
KUICombineConsumers({
children,
consumers: {
theming: ThemingConsumer,
icons: IconRegistryConsumer,
translation: TranslationConsumer,
},
});
FAQs
Kleeen SDK React core
The npm package @kleeen/core-react receives a total of 3 weekly downloads. As such, @kleeen/core-react popularity was classified as not popular.
We found that @kleeen/core-react demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.
Research
Security News
Socket researchers have discovered multiple malicious npm packages targeting Solana private keys, abusing Gmail to exfiltrate the data and drain Solana wallets.