![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
@ergosign/storybook-addon-pseudo-states-angular
Advanced tools
Storybook decorator to enable automatic generation and displaying of CSS pseudo states for components.
Storybook Addon Pseudo States allows you to automatically display pseudo states (and attribute states) of a component in Storybook's preview area.
Framework | Display States | Tool-Button to show/hide |
---|---|---|
Angular | + | +* |
React | + | +* |
Lit | + | +* |
HTML | + | +* |
Vue | + | +* |
* Could lead to sync problems with other addons, like knobs
First of all, you need to install Pseudo States into your project as a dev dependency.
npm install @ergosign/storybook-addon-pseudo-states-angular --save-dev
Then, configure it as an addon by adding it to your main.js file (located in the Storybook config directory).
To display the pseudo states, you have to add specific css classes to your styling, see Styling
Then, you can set the decorator locally, see Usage.
Preset-Postcss adds postcss-loader to Storybook's custom webpack config.
You must also install postcss-pseudo-classes. Unfortunately, latest version is only tagged and not released. Please use at least tagged version 0.3.0
npm install postcss-pseudo-classes@0.3.0 --save-dev
Then add the preset preset-postcss
to your configuration in main.js
(located in the Storybook config directory):
main.js;
module.exports = {
presets: ['@ergosign/storybook-addon-pseudo-states-angular/preset-postcss'],
};
You can enable a toolbar button that toggles the Pseudo States in the Preview area.
See [Framework Support](##Framework Support) which Frameworks support this feature.
Enable the button by adding it to your main.js
file (located in the Storybook config directory):
// main.js
module.exports = {
addons: ['@ergosign/storybook-addon-pseudo-states-angular/register'],
};
WARNING:
withPseudo
should always the first element in yourdecorators
array because it alters the template of the story.
import { withPseudo } from '@ergosign/storybook-addon-pseudo-states-angular';
const section = {
component: ButtonComponent,
title: 'Button',
moduleMetadata: {
declarations: [ButtonComponent],
imports: [CommonModule],
},
decorators: [withPseudo()],
parameters: {
// <button> is a ViewChild of ButtonComponent
withPseudo: { selector: 'button' },
},
};
export default section;
export const Story = () => {
return {
component: ButtonComponent,
moduleMetadata: {
declarations: [ButtonComponent],
imports: [CommonModule],
},
// ButtonComponent has same properties as props' keys
props: {
label: 'Test Label',
anotherProperty: true,
},
};
};
export const StoryWithTemplate = () => {
return {
// always provide component!
component: ButtonComponent,
moduleMetadata: {
entryComponents: [ButtonComponent], // required to support other addons, like knobs addon
declarations: [ButtonComponent],
imports: [CommonModule],
},
template: `<test-button [label]="label" [anotherProperty]="anotherProperty"></test-button>`,
props: {
label: 'Test Label',
anotherProperty: true,
},
};
};
import { withPseudo } from '@ergosign/storybook-addon-pseudo-states-<framework>';
storiesOf('Button', module)
.addDecorator(withPseudo)
.addParameters({
withPseudo: {
selector: 'button', // css selector of pseudo state's host element
pseudos: ['focus', 'hover', 'hover & focus', 'active'],
attributes: ['disabled', 'readonly', 'error'],
},
})
.add('Icon Button', () => <Button />);
There is a default configuration for StateComposition
.
export interface PseudoStatesParameters {
disabled?: boolean;
// query for selector to host element[s] that have to be modified
selector?: Selector;
// prefix for state classes that will be added to host element
prefix?: string;
pseudos?: PseudoStates;
attributes?: AttributeStates;
}
export type PseudoState = PseudoStateEnum | string;
export type AttributeState = AttributeStatesEnum | string;
export type PseudoStates = Array<PseudoState>;
export type AttributeStates = Array<AttributeState>;
export const PseudoStatesDefault: PseudoStates = [FOCUS, HOVER, ACTIVE];
export const AttributesStatesDefault: AttributeStates = [DISABLED];
export const AttributesStatesInputDefault: AttributeStates = [
DISABLED,
READONLY,
];
FAQs
Storybook decorator to enable automatic generation and displaying of CSS pseudo states for components.
The npm package @ergosign/storybook-addon-pseudo-states-angular receives a total of 9 weekly downloads. As such, @ergosign/storybook-addon-pseudo-states-angular popularity was classified as not popular.
We found that @ergosign/storybook-addon-pseudo-states-angular demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 4 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
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.