|
| 1 | +# @aziontech/webkit Storybook |
| 2 | + |
| 3 | +This is the Storybook documentation application for the `@aziontech/webkit` component library. It provides interactive documentation and development environment for all webkit components. |
| 4 | + |
| 5 | +## Technology Stack |
| 6 | + |
| 7 | +- **Storybook 8.x** - Component documentation tool |
| 8 | +- **Vue 3.5.x** - Frontend framework |
| 9 | +- **Vite 6.x** - Build tool |
| 10 | +- **PrimeVue 3.47.2** - UI component library |
| 11 | +- **PrimeFlex 3.3.1** - CSS utility library |
| 12 | +- **Tailwind CSS 3.4.x** - Utility-first CSS |
| 13 | +- **azion-theme 1.18.3** - Azion custom theming |
| 14 | +- **vee-validate 4.15.x** - Form validation |
| 15 | + |
| 16 | +## Getting Started |
| 17 | + |
| 18 | +### Prerequisites |
| 19 | + |
| 20 | +Make sure you have the following installed: |
| 21 | +- Node.js 18.x or higher |
| 22 | +- pnpm 10.x or higher |
| 23 | + |
| 24 | +### Installation |
| 25 | + |
| 26 | +From the root of the monorepo: |
| 27 | + |
| 28 | +```bash |
| 29 | +pnpm install |
| 30 | +``` |
| 31 | + |
| 32 | +### Running Storybook |
| 33 | + |
| 34 | +To start the Storybook development server: |
| 35 | + |
| 36 | +```bash |
| 37 | +# From the root |
| 38 | +pnpm storybook:dev |
| 39 | + |
| 40 | +# Or from this directory |
| 41 | +pnpm dev |
| 42 | +``` |
| 43 | + |
| 44 | +The Storybook will be available at `http://localhost:6006`. |
| 45 | + |
| 46 | +### Building Storybook |
| 47 | + |
| 48 | +To build a static version of the Storybook: |
| 49 | + |
| 50 | +```bash |
| 51 | +# From the root |
| 52 | +pnpm storybook:build |
| 53 | + |
| 54 | +# Or from this directory |
| 55 | +pnpm build |
| 56 | +``` |
| 57 | + |
| 58 | +The static files will be generated in the `dist` directory. |
| 59 | + |
| 60 | +### Previewing Built Storybook |
| 61 | + |
| 62 | +To preview the built Storybook: |
| 63 | + |
| 64 | +```bash |
| 65 | +pnpm preview |
| 66 | +``` |
| 67 | + |
| 68 | +## Project Structure |
| 69 | + |
| 70 | +``` |
| 71 | +apps/storybook/ |
| 72 | +├── .storybook/ |
| 73 | +│ ├── main.js # Main Storybook configuration |
| 74 | +│ └── preview.js # Global decorators and parameters |
| 75 | +├── src/ |
| 76 | +│ ├── stories/ |
| 77 | +│ │ ├── core/ |
| 78 | +│ │ │ ├── form/ # Form component stories |
| 79 | +│ │ │ │ ├── FieldText.stories.js |
| 80 | +│ │ │ │ ├── FieldDropdown.stories.js |
| 81 | +│ │ │ │ └── ... # Other form field stories |
| 82 | +│ │ │ └── SelectorBlock.stories.js |
| 83 | +│ │ └── components/ |
| 84 | +│ │ └── AzionSystemStatus.stories.js |
| 85 | +│ └── styles/ |
| 86 | +│ └── preview.css # Global styles |
| 87 | +├── package.json |
| 88 | +├── tailwind.config.js |
| 89 | +├── postcss.config.js |
| 90 | +└── README.md |
| 91 | +``` |
| 92 | + |
| 93 | +## Component Categories |
| 94 | + |
| 95 | +### Form Components |
| 96 | + |
| 97 | +All form components are located under `Core/Form/` in the Storybook sidebar: |
| 98 | + |
| 99 | +- FieldText - Basic text input |
| 100 | +- FieldTextArea - Multi-line text input |
| 101 | +- FieldDropdown - Select dropdown |
| 102 | +- FieldDropdownIcon - Dropdown with icons |
| 103 | +- FieldDropdownLazyLoader - Lazy-loading dropdown |
| 104 | +- FieldDropdownLazyLoaderDynamic - Dynamic lazy dropdown |
| 105 | +- FieldDropdownLazyLoaderWithFilter - Lazy dropdown with filter |
| 106 | +- FieldDropdownMultiSelectLazyLoader - Multi-select lazy dropdown |
| 107 | +- FieldCheckboxBlock - Checkbox with label |
| 108 | +- FieldRadioBlock - Radio button with label |
| 109 | +- FieldSwitch - Toggle switch |
| 110 | +- FieldSwitchBlock - Switch with label block |
| 111 | +- FieldGroupCheckbox - Checkbox group |
| 112 | +- FieldGroupRadio - Radio button group |
| 113 | +- FieldGroupSwitch - Switch group |
| 114 | +- FieldMultiSelect - Multi-select dropdown |
| 115 | +- FieldNumber - Number input |
| 116 | +- FieldPhoneNumber - Phone number input |
| 117 | +- FieldPhoneNumberCountry - Phone with country selector |
| 118 | +- FieldAutoComplete - Autocomplete input |
| 119 | +- FieldPickList - Pick list component |
| 120 | +- FieldInputGroup - Input with addons |
| 121 | +- FieldTextIcon - Text input with icon |
| 122 | +- FieldTextPassword - Password input |
| 123 | +- FieldTextPrivacy - Privacy-sensitive input |
| 124 | +- Label - Form label component |
| 125 | + |
| 126 | +### Core Components |
| 127 | + |
| 128 | +- SelectorBlock - Selection block component |
| 129 | + |
| 130 | +### UI Components |
| 131 | + |
| 132 | +- AzionSystemStatus - System status indicator |
| 133 | + |
| 134 | +## Writing Stories |
| 135 | + |
| 136 | +Stories are written using the Component Story Format (CSF). Here's an example: |
| 137 | + |
| 138 | +```javascript |
| 139 | +import FieldText from '@aziontech/webkit/field-text'; |
| 140 | + |
| 141 | +export default { |
| 142 | + title: 'Core/Form/FieldText', |
| 143 | + component: FieldText, |
| 144 | + tags: ['autodocs'], |
| 145 | + argTypes: { |
| 146 | + name: { control: 'text' }, |
| 147 | + label: { control: 'text' }, |
| 148 | + disabled: { control: 'boolean' } |
| 149 | + } |
| 150 | +}; |
| 151 | + |
| 152 | +export const Default = { |
| 153 | + args: { |
| 154 | + name: 'field-text', |
| 155 | + label: 'Text Field', |
| 156 | + placeholder: 'Enter text...' |
| 157 | + } |
| 158 | +}; |
| 159 | +``` |
| 160 | + |
| 161 | +## Adding New Stories |
| 162 | + |
| 163 | +1. Create a new file in the appropriate directory under `src/stories/` |
| 164 | +2. Name the file following the pattern: `ComponentName.stories.js` |
| 165 | +3. Import the component from `@aziontech/webkit` |
| 166 | +4. Define the default export with title, component, and argTypes |
| 167 | +5. Export named story variants |
| 168 | + |
| 169 | +## Testing Components |
| 170 | + |
| 171 | +Storybook provides interactive controls for testing different prop combinations. Use the Controls panel to modify props in real-time. |
| 172 | + |
| 173 | +## Documentation |
| 174 | + |
| 175 | +Each component has auto-generated documentation (via `autodocs` tag) that shows: |
| 176 | +- Component description |
| 177 | +- Available props and their types |
| 178 | +- Default values |
| 179 | +- Usage examples |
| 180 | + |
| 181 | +## Related Documentation |
| 182 | + |
| 183 | +- [Storybook Documentation](https://storybook.js.org/docs) |
| 184 | +- [Vue 3 Documentation](https://vuejs.org/) |
| 185 | +- [PrimeVue Documentation](https://primevue.org/) |
| 186 | +- [VeeValidate Documentation](https://vee-validate.logaretm.com/) |
| 187 | + |
| 188 | +## License |
| 189 | + |
| 190 | +MIT |
0 commit comments