adnbn-ui 0.0.2 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/README.md +1057 -0
  2. package/package.json +19 -3
  3. package/.prettierignore +0 -3
  4. package/.prettierrc +0 -28
  5. package/.storybook/main.ts +0 -22
  6. package/.storybook/preview.tsx +0 -100
  7. package/.storybook/styles/custom.scss +0 -59
  8. package/.storybook/styles/preview.css +0 -58
  9. package/.storybook/vitest.setup.ts +0 -9
  10. package/eslint.config.js +0 -39
  11. package/src/components/Avatar/Avatar.stories.tsx +0 -118
  12. package/src/components/Button/Button.stories.tsx +0 -148
  13. package/src/components/Checkbox/Checkbox.stories.tsx +0 -180
  14. package/src/components/Drawer/Drawer.stories.tsx +0 -89
  15. package/src/components/Footer/Footer.stories.tsx +0 -118
  16. package/src/components/Header/Header.stories.tsx +0 -49
  17. package/src/components/Highlight/Highlight.stories.tsx +0 -83
  18. package/src/components/IconButton/IconButton.stories.tsx +0 -179
  19. package/src/components/Layout/Layout.stories.tsx +0 -88
  20. package/src/components/List/List.stories.tsx +0 -81
  21. package/src/components/Modal/Modal.stories.tsx +0 -95
  22. package/src/components/Odometer/Odometer.stories.tsx +0 -66
  23. package/src/components/ScrollArea/ScrollArea.stories.tsx +0 -58
  24. package/src/components/Switch/Switch.stories.tsx +0 -25
  25. package/src/components/Tag/Tag.stories.tsx +0 -157
  26. package/src/components/TextArea/TextArea.stories.tsx +0 -145
  27. package/src/components/TextField/TextField.stories.tsx +0 -177
  28. package/src/components/Toast/Toast.stories.tsx +0 -209
  29. package/src/components/Tooltip/Tooltip.stories.tsx +0 -80
  30. package/src/components/View/View.stories.tsx +0 -47
  31. package/src/components/ViewDrawer/ViewDrawer.stories.tsx +0 -75
  32. package/src/components/ViewModal/ViewModal.stories.tsx +0 -68
  33. package/tsconfig.json +0 -18
  34. package/vite.config.ts +0 -11
  35. package/vitest.workspace.ts +0 -19
package/README.md ADDED
@@ -0,0 +1,1057 @@
1
+ # AddonBone UI (adnbn-ui)
2
+
3
+ [![npm version](https://img.shields.io/npm/v/adnbn-ui.svg)](https://www.npmjs.com/package/adnbn-ui)
4
+ [![npm downloads](https://img.shields.io/npm/dm/adnbn-ui.svg)](https://www.npmjs.com/package/adnbn-ui)
5
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
6
+
7
+ A comprehensive UI component library designed for the AddonBone framework. This library provides a set of customizable React components with theming capabilities to build modern, responsive user interfaces.
8
+
9
+ ## Features
10
+
11
+ - 🎨 **Customizable Theming**: Easily customize the look and feel of components through theme configuration
12
+ - 🧩 **Rich Component Set**: Includes buttons, forms, layouts, modals, and more
13
+ - 🔌 **AddonBone Integration**: Seamless integration with the AddonBone framework
14
+ - 📚 **Storybook Documentation**: Comprehensive component documentation with examples
15
+ - 🛠️ **TypeScript Support**: Full TypeScript support with type definitions
16
+
17
+ ## Table of Contents
18
+
19
+ - [Installation](#installation)
20
+ - [Basic Usage](#basic-usage)
21
+ - [Integration](#integration)
22
+ - [Customization](#customization)
23
+ - [Component Examples](#component-examples)
24
+ - [Supported Components](#supported-components)
25
+ - [Avatar](#avatar)
26
+ - [BaseButton](#basebutton)
27
+ - [Button](#button)
28
+ - [Checkbox](#checkbox)
29
+ - [Dialog](#dialog)
30
+ - [Drawer](#drawer)
31
+ - [Footer](#footer)
32
+ - [Header](#header)
33
+ - [Highlight](#highlight)
34
+ - [Icon](#icon)
35
+ - [IconButton](#iconbutton)
36
+ - [Layout](#layout)
37
+ - [List](#list)
38
+ - [ListItem](#listitem)
39
+ - [Modal](#modal)
40
+ - [Odometer](#odometer)
41
+ - [ScrollArea](#scrollarea)
42
+ - [SvgSprite](#svgsprite)
43
+ - [Switch](#switch)
44
+ - [Tag](#tag)
45
+ - [TextArea](#textarea)
46
+ - [TextField](#textfield)
47
+ - [Toast](#toast)
48
+ - [Tooltip](#tooltip)
49
+ - [View](#view)
50
+ - [ViewDrawer](#viewdrawer)
51
+ - [ViewModal](#viewmodal)
52
+ - [License](#license)
53
+
54
+ ## Installation
55
+
56
+ Using npm:
57
+
58
+ ```bash
59
+ npm install adnbn-ui
60
+ ```
61
+
62
+ Using Yarn:
63
+
64
+ ```bash
65
+ yarn add adnbn-ui
66
+ ```
67
+
68
+ ## Basic Usage
69
+
70
+ ```jsx
71
+ import React from "react";
72
+ import {Button, ButtonColor, ButtonVariant, TextField, UIProvider} from "adnbn-ui";
73
+
74
+ function App() {
75
+ return (
76
+ <UIProvider>
77
+ <div>
78
+ <TextField label="Username" placeholder="Enter your username" />
79
+ <Button color={ButtonColor.Primary} variant={ButtonVariant.Contained}>
80
+ Submit
81
+ </Button>
82
+ </div>
83
+ </UIProvider>
84
+ );
85
+ }
86
+
87
+ export default App;
88
+ ```
89
+
90
+ ## Integration
91
+
92
+ AddonBone UI is designed exclusively for the AddonBone framework and does not have a standalone build as it's connected as a plugin. This library is an integral part of the AddonBone ecosystem for developing browser extensions with a shared codebase.
93
+
94
+ AddonBone is a framework for developing browser extensions with a common codebase. This means you can create multiple extensions with the same functionality but with different designs, localizations, and feature sets depending on the needs of each extension while maintaining access to a shared codebase.
95
+
96
+ ### Plugin Setup
97
+
98
+ ```ts
99
+ // adnbn.config.ts
100
+ import {defineConfig} from "adnbn";
101
+ import ui from "adnbn-ui/plugin";
102
+
103
+ export default defineConfig({
104
+ // ... other AddonBone configuration
105
+ plugins: [
106
+ ui({
107
+ themeDir: "./theme", // Directory for theme files
108
+ configFileName: "ui.config", // Name of config files
109
+ styleFileName: "ui.style", // Name of style files
110
+ mergeConfig: true, // Merge configs from different directories
111
+ mergeStyles: true, // Merge styles from different directories
112
+ }),
113
+ ],
114
+ });
115
+ ```
116
+
117
+ ### Configuration Files
118
+
119
+ The `adnbn-ui` configuration is designed to retrieve configuration from each extension separately, allowing for different designs for different extensions without changing any code. You only need to modify the configuration, style variables, and icons.
120
+
121
+ The plugin looks for configuration files in specific directories within your project. By default, it searches in the following locations (in order of priority):
122
+
123
+ 1. **App-specific directory**: `src/apps/[app-name]/[app-src-dir]/[theme-dir]`
124
+ 2. **Shared directory**: `src/shared/[theme-dir]`
125
+
126
+ Where `[theme-dir]` is the directory specified in the `themeDir` option (defaults to the current directory).
127
+
128
+ The `mergeConfig` option (default: `true`) determines whether configurations from multiple directories should be merged. When enabled, configurations from both app-specific and shared directories will be combined, with app-specific values taking precedence in case of conflicts. If disabled, only the first configuration found will be used (with app-specific having priority).
129
+
130
+ You can create these files to customize the UI components:
131
+
132
+ #### ui.config.ts
133
+
134
+ You can use the `defineConfig` helper which provides type checking:
135
+
136
+ ```ts
137
+ // src/shared/theme/ui.config.ts
138
+ import {ButtonColor, ButtonRadius, ButtonVariant, TextFieldRadius, TextFieldSize, defineConfig} from "adnbn-ui/config";
139
+ import CloseIcon from "./icons/close.svg?react";
140
+
141
+ export default defineConfig({
142
+ props: {
143
+ button: {
144
+ variant: ButtonVariant.Contained,
145
+ color: ButtonColor.Primary,
146
+ radius: ButtonRadius.Medium,
147
+ },
148
+ textField: {
149
+ size: TextFieldSize.Medium,
150
+ radius: TextFieldRadius.Small,
151
+ },
152
+ // ... other component configurations
153
+ },
154
+ icons: {
155
+ close: CloseIcon,
156
+ // Other custom icons
157
+ },
158
+ });
159
+ ```
160
+
161
+ The example above shows how to use the TypeScript configuration with the AddonBone framework. The `defineConfig` helper provides type checking and autocompletion for your configuration. You can import enum values from "adnbn-ui/config" to ensure type safety when configuring components. The configuration can also include SVG icons imported directly from your project files.
162
+
163
+ #### ui.style.scss
164
+
165
+ Similar to configuration files, style files are also searched for in the same directories with the same priority order. The `mergeStyles` option (default: `true`) works the same way as `mergeConfig`, allowing styles from multiple directories to be combined when enabled.
166
+
167
+ ```scss
168
+ // src/shared/theme/ui.style.scss
169
+ // Custom CSS variables and mixins for theming
170
+ @import "adnbn-ui/theme";
171
+
172
+ @include light {
173
+ // Base colors
174
+ --primary-color: #3f51b5;
175
+ --secondary-color: #f50057;
176
+ --accent-color: #4caf50;
177
+
178
+ // Text colors
179
+ --text-primary-color: #212121;
180
+ --text-secondary-color: #757575;
181
+
182
+ // Background colors
183
+ --bg-primary-color: #ffffff;
184
+ --bg-secondary-color: #f5f5f5;
185
+
186
+ // Font settings
187
+ --font-family: "Roboto", sans-serif;
188
+ --font-size: 14px;
189
+ --line-height: 1.5;
190
+
191
+ // Button specific variables
192
+ --button-font-family: var(--font-family);
193
+ --button-font-size: var(--font-size);
194
+ --button-height: 34px;
195
+ --button-border-radius: 10px;
196
+
197
+ // Button size variants
198
+ --button-height-sm: 24px;
199
+ --button-height-md: 44px;
200
+ --button-height-lg: 54px;
201
+
202
+ // Button radius variants
203
+ --button-border-radius-sm: 5px;
204
+ --button-border-radius-md: 12px;
205
+ --button-border-radius-lg: 15px;
206
+ }
207
+
208
+ @include dark {
209
+ // Base colors for dark theme
210
+ --primary-color: #7986cb;
211
+ --secondary-color: #ff4081;
212
+ --accent-color: #66bb6a;
213
+
214
+ // Text colors for dark theme
215
+ --text-primary-color: #ffffff;
216
+ --text-secondary-color: #b0bec5;
217
+
218
+ // Background colors for dark theme
219
+ --bg-primary-color: #121212;
220
+ --bg-secondary-color: #1e1e1e;
221
+ }
222
+ ```
223
+
224
+ ## Customization
225
+
226
+ The `adnbn-ui` library allows for extensive customization to create different designs for different extensions without changing code. This is particularly useful in the AddonBone framework where you might need to maintain multiple browser extensions with the same functionality but different visual appearances.
227
+
228
+ ### Global Theme Customization
229
+
230
+ You can customize the theme globally by passing props to the UIProvider:
231
+
232
+ ```jsx
233
+ import {UIProvider} from "adnbn-ui";
234
+
235
+ const customTheme = {
236
+ props: {
237
+ button: {
238
+ variant: "outlined",
239
+ color: "primary",
240
+ },
241
+ textField: {
242
+ radius: "medium",
243
+ },
244
+ },
245
+ icons: {
246
+ // Custom icons
247
+ },
248
+ };
249
+
250
+ function App() {
251
+ return <UIProvider {...customTheme}>{/* Your application */}</UIProvider>;
252
+ }
253
+ ```
254
+
255
+ ## Component Examples
256
+
257
+ ### Buttons
258
+
259
+ ```jsx
260
+ import {Button, ButtonColor, ButtonSize, ButtonVariant} from 'adnbn-ui';
261
+
262
+ // Basic button
263
+ <Button>Click me</Button>
264
+
265
+ // Variants
266
+ <Button variant={ButtonVariant.Contained}>Contained</Button>
267
+ <Button variant={ButtonVariant.Outlined}>Outlined</Button>
268
+ <Button variant={ButtonVariant.Text}>Text</Button>
269
+
270
+ // Colors
271
+ <Button color={ButtonColor.Primary}>Primary</Button>
272
+ <Button color={ButtonColor.Secondary}>Secondary</Button>
273
+ <Button color={ButtonColor.Accent}>Accent</Button>
274
+
275
+ // Sizes
276
+ <Button size={ButtonSize.Small}>Small</Button>
277
+ <Button size={ButtonSize.Medium}>Medium</Button>
278
+ <Button size={ButtonSize.Large}>Large</Button>
279
+
280
+ // Disabled state
281
+ <Button disabled>Disabled</Button>
282
+ ```
283
+
284
+ ### Form Components
285
+
286
+ ```jsx
287
+ import {TextField, TextArea, Checkbox, Switch} from 'adnbn-ui';
288
+
289
+ // Text input
290
+ <TextField label="Username" placeholder="Enter username" />
291
+
292
+ // Text area
293
+ <TextArea label="Description" placeholder="Enter description" />
294
+
295
+ // Checkbox
296
+ <Checkbox label="Remember me" />
297
+
298
+ // Switch
299
+ <Switch label="Enable notifications" />
300
+ ```
301
+
302
+ ### Layout Components
303
+
304
+ ```jsx
305
+ import {Layout, Header, Footer} from "adnbn-ui";
306
+
307
+ <Layout>
308
+ <Header>My Application</Header>
309
+ <div>Content goes here</div>
310
+ <Footer>© 2023 My Company</Footer>
311
+ </Layout>;
312
+ ```
313
+
314
+ ### Feedback Components
315
+
316
+ ```jsx
317
+ import {Toast, Modal, Dialog, Drawer} from 'adnbn-ui';
318
+
319
+ // Toast notification
320
+ <Toast message="Operation successful!" />
321
+
322
+ // Modal dialog
323
+ <Modal open={isOpen} onClose={handleClose}>
324
+ <h2>Modal Title</h2>
325
+ <p>Modal content goes here</p>
326
+ </Modal>
327
+
328
+ // Confirmation dialog
329
+ <Dialog
330
+ title="Confirm Action"
331
+ content="Are you sure you want to proceed?"
332
+ confirmText="Yes"
333
+ cancelText="No"
334
+ onConfirm={handleConfirm}
335
+ onCancel={handleCancel}
336
+ />
337
+
338
+ // Side drawer
339
+ <Drawer open={isOpen} onClose={handleClose} position="right">
340
+ <h2>Drawer Content</h2>
341
+ <p>Drawer content goes here</p>
342
+ </Drawer>
343
+ ```
344
+
345
+ ## Supported Components
346
+
347
+ ### Button
348
+
349
+ The Button component provides a customizable button with various styles, colors, and sizes.
350
+
351
+ #### Props
352
+
353
+ | Prop | Type | Description |
354
+ | ----------------- | ------------- | ----------------------------------------- |
355
+ | variant | ButtonVariant | Button style variant |
356
+ | color | ButtonColor | Button color |
357
+ | size | ButtonSize | Button size |
358
+ | radius | ButtonRadius | Button border radius |
359
+ | after | ReactNode | Content to display after the button text |
360
+ | before | ReactNode | Content to display before the button text |
361
+ | afterClassName | string | Class name for the after content |
362
+ | beforeClassName | string | Class name for the before content |
363
+ | childrenClassName | string | Class name for the children content |
364
+
365
+ #### Enums
366
+
367
+ ```jsx
368
+ // Available variants
369
+ ButtonVariant.Contained;
370
+ ButtonVariant.Outlined;
371
+ ButtonVariant.Text;
372
+
373
+ // Available colors
374
+ ButtonColor.Primary;
375
+ ButtonColor.Secondary;
376
+ ButtonColor.Accent;
377
+
378
+ // Available sizes
379
+ ButtonSize.Small;
380
+ ButtonSize.Medium;
381
+ ButtonSize.Large;
382
+
383
+ // Available radius options
384
+ ButtonRadius.Small;
385
+ ButtonRadius.Medium;
386
+ ButtonRadius.Large;
387
+ ButtonRadius.Full;
388
+ ```
389
+
390
+ #### Example
391
+
392
+ ```jsx
393
+ import {Button, ButtonVariant, ButtonColor, ButtonSize, ButtonRadius} from "adnbn-ui";
394
+
395
+ <Button
396
+ variant={ButtonVariant.Contained}
397
+ color={ButtonColor.Primary}
398
+ size={ButtonSize.Medium}
399
+ radius={ButtonRadius.Medium}
400
+ >
401
+ Click me
402
+ </Button>;
403
+ ```
404
+
405
+ ### TextField
406
+
407
+ The TextField component provides a customizable text input field with various styles, sizes, and validation states.
408
+
409
+ #### Props
410
+
411
+ | Prop | Type | Description |
412
+ | --------------- | ---------------- | ---------------------------------------- |
413
+ | variant | TextFieldVariant | Input style variant |
414
+ | accent | TextFieldAccent | Input accent color for validation states |
415
+ | radius | TextFieldRadius | Input border radius |
416
+ | customSize | TextFieldSize | Input size |
417
+ | label | string | Input label |
418
+ | fullWidth | boolean | Whether the input should take full width |
419
+ | before | ReactNode | Content to display before the input |
420
+ | after | ReactNode | Content to display after the input |
421
+ | inputClassName | string | Class name for the input element |
422
+ | afterClassName | string | Class name for the after content |
423
+ | beforeClassName | string | Class name for the before content |
424
+
425
+ #### Enums
426
+
427
+ ```jsx
428
+ // Available variants
429
+ TextFieldVariant.Regular;
430
+ TextFieldVariant.Outlined;
431
+ TextFieldVariant.Filled;
432
+
433
+ // Available sizes
434
+ TextFieldSize.Small;
435
+ TextFieldSize.Medium;
436
+ TextFieldSize.Large;
437
+
438
+ // Available radius options
439
+ TextFieldRadius.None;
440
+ TextFieldRadius.Small;
441
+ TextFieldRadius.Medium;
442
+ TextFieldRadius.Large;
443
+ TextFieldRadius.Full;
444
+
445
+ // Available accent options
446
+ TextFieldAccent.Success;
447
+ TextFieldAccent.Error;
448
+ ```
449
+
450
+ #### Example
451
+
452
+ ```jsx
453
+ import {TextField, TextFieldVariant, TextFieldSize, TextFieldRadius, TextFieldAccent} from "adnbn-ui";
454
+
455
+ <TextField
456
+ variant={TextFieldVariant.Outlined}
457
+ customSize={TextFieldSize.Medium}
458
+ radius={TextFieldRadius.Medium}
459
+ accent={TextFieldAccent.Success}
460
+ label="Username"
461
+ placeholder="Enter your username"
462
+ fullWidth
463
+ />;
464
+ ```
465
+
466
+ ### TextArea
467
+
468
+ The TextArea component provides a customizable multi-line text input with auto-resizing capability.
469
+
470
+ #### Props
471
+
472
+ | Prop | Type | Description |
473
+ | --------- | --------------- | ------------------------------------------- |
474
+ | variant | TextAreaVariant | TextArea style variant |
475
+ | radius | TextAreaRadius | TextArea border radius |
476
+ | size | TextAreaSize | TextArea size |
477
+ | fullWidth | boolean | Whether the textarea should take full width |
478
+ | label | string | TextArea label |
479
+
480
+ #### Enums
481
+
482
+ ```jsx
483
+ // Available variants
484
+ TextAreaVariant.Regular;
485
+ TextAreaVariant.Outlined;
486
+ TextAreaVariant.Filled;
487
+
488
+ // Available sizes
489
+ TextAreaSize.Small;
490
+ TextAreaSize.Medium;
491
+ TextAreaSize.Large;
492
+
493
+ // Available radius options
494
+ TextAreaRadius.None;
495
+ TextAreaRadius.Small;
496
+ TextAreaRadius.Medium;
497
+ TextAreaRadius.Large;
498
+ ```
499
+
500
+ #### Example
501
+
502
+ ```jsx
503
+ import {TextArea, TextAreaVariant, TextAreaSize, TextAreaRadius} from "adnbn-ui";
504
+
505
+ <TextArea
506
+ variant={TextAreaVariant.Outlined}
507
+ size={TextAreaSize.Medium}
508
+ radius={TextAreaRadius.Medium}
509
+ label="Description"
510
+ placeholder="Enter description"
511
+ rows={4}
512
+ fullWidth
513
+ />;
514
+ ```
515
+
516
+ ### Checkbox
517
+
518
+ The Checkbox component provides a customizable checkbox with various styles and sizes.
519
+
520
+ #### Props
521
+
522
+ | Prop | Type | Description |
523
+ | ------------------ | --------------- | ------------------------------------ |
524
+ | indicatorClassName | string | Class name for the indicator element |
525
+ | size | CheckboxSize | Checkbox size |
526
+ | radius | CheckboxRadius | Checkbox border radius |
527
+ | variant | CheckboxVariant | Checkbox style variant |
528
+ | checkedIcon | ReactElement | Custom icon for checked state |
529
+ | indeterminateIcon | ReactElement | Custom icon for indeterminate state |
530
+
531
+ #### Enums
532
+
533
+ ```jsx
534
+ // Available variants
535
+ CheckboxVariant.Classic;
536
+ CheckboxVariant.Soft;
537
+
538
+ // Available sizes
539
+ CheckboxSize.Small;
540
+ CheckboxSize.Medium;
541
+ CheckboxSize.Large;
542
+
543
+ // Available radius options
544
+ CheckboxRadius.Small;
545
+ CheckboxRadius.Large;
546
+ ```
547
+
548
+ #### Example
549
+
550
+ ```jsx
551
+ import {Checkbox, CheckboxVariant, CheckboxSize, CheckboxRadius} from "adnbn-ui";
552
+
553
+ <Checkbox variant={CheckboxVariant.Classic} size={CheckboxSize.Medium} radius={CheckboxRadius.Small} checked={true} />;
554
+ ```
555
+
556
+ ### Switch
557
+
558
+ The Switch component provides a toggle switch control.
559
+
560
+ #### Props
561
+
562
+ | Prop | Type | Description |
563
+ | -------------- | ------ | -------------------------------- |
564
+ | thumbClassName | string | Class name for the thumb element |
565
+
566
+ #### Example
567
+
568
+ ```jsx
569
+ import {Switch} from "adnbn-ui";
570
+
571
+ <Switch checked={isEnabled} onCheckedChange={setIsEnabled} />;
572
+ ```
573
+
574
+ ### Avatar
575
+
576
+ The Avatar component displays a user's profile picture or a fallback when the image is not available.
577
+
578
+ #### Props
579
+
580
+ | Prop | Type | Description |
581
+ | ----------------- | ------------ | -------------------------------------------------- |
582
+ | size | AvatarSize | Avatar size |
583
+ | radius | AvatarRadius | Avatar border radius |
584
+ | fallback | ReactNode | Content to display when the image is not available |
585
+ | fallbackClassName | string | Class name for the fallback content |
586
+ | imageClassName | string | Class name for the image element |
587
+ | cursorPointer | boolean | Whether the avatar should have a pointer cursor |
588
+ | delayMs | number | Delay before showing the fallback content |
589
+
590
+ #### Enums
591
+
592
+ ```jsx
593
+ // Available sizes
594
+ AvatarSize.Small;
595
+ AvatarSize.Medium;
596
+ AvatarSize.Large;
597
+
598
+ // Available radius options
599
+ AvatarRadius.Small;
600
+ AvatarRadius.Medium;
601
+ AvatarRadius.Large;
602
+ ```
603
+
604
+ #### Example
605
+
606
+ ```jsx
607
+ import {Avatar, AvatarSize, AvatarRadius} from "adnbn-ui";
608
+
609
+ <Avatar
610
+ src="https://example.com/avatar.jpg"
611
+ alt="User Avatar"
612
+ size={AvatarSize.Medium}
613
+ radius={AvatarRadius.Medium}
614
+ fallback="JD"
615
+ />;
616
+ ```
617
+
618
+ ### BaseButton
619
+
620
+ The BaseButton component is a foundational button component that provides basic button functionality.
621
+
622
+ #### Props
623
+
624
+ | Prop | Type | Description |
625
+ | ----------------- | --------- | ----------------------------------------- |
626
+ | after | ReactNode | Content to display after the button text |
627
+ | before | ReactNode | Content to display before the button text |
628
+ | afterClassName | string | Class name for the after content |
629
+ | beforeClassName | string | Class name for the before content |
630
+ | childrenClassName | string | Class name for the children content |
631
+
632
+ #### Example
633
+
634
+ ```jsx
635
+ import {BaseButton} from "adnbn-ui";
636
+
637
+ <BaseButton before={<Icon name="star" />} after={<Icon name="arrow-right" />}>
638
+ Click me
639
+ </BaseButton>;
640
+ ```
641
+
642
+ ### Dialog
643
+
644
+ The Dialog component displays a modal dialog that overlays the page content.
645
+
646
+ #### Props
647
+
648
+ | Prop | Type | Description |
649
+ | ----------------- | ----------- | -------------------------------------------------------------- |
650
+ | speed | number | Animation speed in milliseconds |
651
+ | description | string | Dialog description (for accessibility) |
652
+ | fullscreen | boolean | Whether the dialog should be fullscreen |
653
+ | overlayClassName | string | Class name for the overlay element |
654
+ | childrenClassName | string | Class name for the children content |
655
+ | open | boolean | Whether the dialog is open |
656
+ | onOpenChange | function | Callback when the open state changes |
657
+ | modal | boolean | Whether the dialog is modal (blocks interaction with the page) |
658
+ | container | HTMLElement | Container element for the dialog |
659
+ | title | string | Dialog title (for accessibility) |
660
+
661
+ #### Example
662
+
663
+ ```jsx
664
+ import {Dialog} from "adnbn-ui";
665
+
666
+ <Dialog open={isOpen} onOpenChange={setIsOpen} title="Confirmation" description="Please confirm your action">
667
+ <div>
668
+ <h2>Are you sure?</h2>
669
+ <p>This action cannot be undone.</p>
670
+ <div>
671
+ <Button onClick={() => setIsOpen(false)}>Cancel</Button>
672
+ <Button onClick={handleConfirm}>Confirm</Button>
673
+ </div>
674
+ </div>
675
+ </Dialog>;
676
+ ```
677
+
678
+ ### Drawer
679
+
680
+ The Drawer component displays a sliding panel that comes from the edge of the screen.
681
+
682
+ #### Props
683
+
684
+ | Prop | Type | Description |
685
+ | -------- | -------------------------------------- | ---------------------------------- |
686
+ | position | 'left' \| 'right' \| 'top' \| 'bottom' | Position of the drawer |
687
+ | open | boolean | Whether the drawer is open |
688
+ | onClose | function | Callback when the drawer is closed |
689
+
690
+ #### Example
691
+
692
+ ```jsx
693
+ import {Drawer} from "adnbn-ui";
694
+
695
+ <Drawer open={isOpen} onClose={() => setIsOpen(false)} position="right">
696
+ <div>Drawer content</div>
697
+ </Drawer>;
698
+ ```
699
+
700
+ ### Footer
701
+
702
+ The Footer component provides a consistent footer layout.
703
+
704
+ #### Example
705
+
706
+ ```jsx
707
+ import {Footer} from "adnbn-ui";
708
+
709
+ <Footer>
710
+ <div>© 2023 My Company</div>
711
+ </Footer>;
712
+ ```
713
+
714
+ ### Header
715
+
716
+ The Header component provides a consistent header layout.
717
+
718
+ #### Example
719
+
720
+ ```jsx
721
+ import {Header} from "adnbn-ui";
722
+
723
+ <Header>
724
+ <div>My Application</div>
725
+ </Header>;
726
+ ```
727
+
728
+ ### Highlight
729
+
730
+ The Highlight component highlights text matches within content.
731
+
732
+ #### Props
733
+
734
+ | Prop | Type | Description |
735
+ | ------------------ | -------- | ------------------------------- |
736
+ | searchWords | string[] | Words to highlight |
737
+ | textToHighlight | string | Text content to search within |
738
+ | highlightClassName | string | Class name for highlighted text |
739
+
740
+ #### Example
741
+
742
+ ```jsx
743
+ import {Highlight} from "adnbn-ui";
744
+
745
+ <Highlight searchWords={["react", "component"]} textToHighlight="This is a React component library" />;
746
+ ```
747
+
748
+ ### Icon
749
+
750
+ The Icon component displays vector icons.
751
+
752
+ #### Props
753
+
754
+ | Prop | Type | Description |
755
+ | ----- | ------ | ----------- |
756
+ | name | string | Icon name |
757
+ | size | number | Icon size |
758
+ | color | string | Icon color |
759
+
760
+ #### Example
761
+
762
+ ```jsx
763
+ import {Icon} from "adnbn-ui";
764
+
765
+ <Icon name="star" size={24} color="#f5a623" />;
766
+ ```
767
+
768
+ ### IconButton
769
+
770
+ The IconButton component combines an icon with button functionality.
771
+
772
+ #### Props
773
+
774
+ | Prop | Type | Description |
775
+ | ----- | ------------------------------------ | --------------- |
776
+ | icon | ReactNode | Icon to display |
777
+ | size | 'small' \| 'medium' \| 'large' | Button size |
778
+ | color | 'primary' \| 'secondary' \| 'accent' | Button color |
779
+
780
+ #### Example
781
+
782
+ ```jsx
783
+ import {IconButton, Icon} from "adnbn-ui";
784
+
785
+ <IconButton icon={<Icon name="star" />} size="medium" color="primary" onClick={handleClick} />;
786
+ ```
787
+
788
+ ### Layout
789
+
790
+ The Layout component provides a consistent page layout structure.
791
+
792
+ #### Example
793
+
794
+ ```jsx
795
+ import {Layout, Header, Footer} from "adnbn-ui";
796
+
797
+ <Layout>
798
+ <Header>My Application</Header>
799
+ <div>Content goes here</div>
800
+ <Footer>© 2023 My Company</Footer>
801
+ </Layout>;
802
+ ```
803
+
804
+ ### List
805
+
806
+ The List component displays a list of items.
807
+
808
+ #### Props
809
+
810
+ | Prop | Type | Description |
811
+ | ------- | ---------------------------------- | --------------------- |
812
+ | variant | 'ordered' \| 'unordered' | List type |
813
+ | spacing | 'compact' \| 'normal' \| 'relaxed' | Spacing between items |
814
+
815
+ #### Example
816
+
817
+ ```jsx
818
+ import {List, ListItem} from "adnbn-ui";
819
+
820
+ <List variant="unordered" spacing="normal">
821
+ <ListItem>Item 1</ListItem>
822
+ <ListItem>Item 2</ListItem>
823
+ <ListItem>Item 3</ListItem>
824
+ </List>;
825
+ ```
826
+
827
+ ### ListItem
828
+
829
+ The ListItem component represents an item in a List.
830
+
831
+ #### Example
832
+
833
+ ```jsx
834
+ import {ListItem} from "adnbn-ui";
835
+
836
+ <ListItem>Item content</ListItem>;
837
+ ```
838
+
839
+ ### Modal
840
+
841
+ The Modal component displays content in a layer above the page.
842
+
843
+ #### Props
844
+
845
+ | Prop | Type | Description |
846
+ | ------- | --------- | --------------------------------- |
847
+ | open | boolean | Whether the modal is open |
848
+ | onClose | function | Callback when the modal is closed |
849
+ | title | string | Modal title |
850
+ | footer | ReactNode | Modal footer content |
851
+
852
+ #### Example
853
+
854
+ ```jsx
855
+ import {Modal, Button} from "adnbn-ui";
856
+
857
+ <Modal
858
+ open={isOpen}
859
+ onClose={() => setIsOpen(false)}
860
+ title="Modal Title"
861
+ footer={<Button onClick={() => setIsOpen(false)}>Close</Button>}
862
+ >
863
+ <p>Modal content goes here</p>
864
+ </Modal>;
865
+ ```
866
+
867
+ ### Odometer
868
+
869
+ The Odometer component displays animated number transitions.
870
+
871
+ #### Props
872
+
873
+ | Prop | Type | Description |
874
+ | -------- | ------ | ---------------------------------- |
875
+ | value | number | Current value to display |
876
+ | format | string | Number format |
877
+ | duration | number | Animation duration in milliseconds |
878
+
879
+ #### Example
880
+
881
+ ```jsx
882
+ import {Odometer} from "adnbn-ui";
883
+
884
+ <Odometer value={1234} format="(,ddd)" duration={1000} />;
885
+ ```
886
+
887
+ ### ScrollArea
888
+
889
+ The ScrollArea component provides a customizable scrollable area.
890
+
891
+ #### Props
892
+
893
+ | Prop | Type | Description |
894
+ | --------------- | ----------------------------------------- | ------------------------------ |
895
+ | type | 'auto' \| 'always' \| 'scroll' \| 'hover' | When to show scrollbars |
896
+ | scrollHideDelay | number | Delay before hiding scrollbars |
897
+
898
+ #### Example
899
+
900
+ ```jsx
901
+ import {ScrollArea} from "adnbn-ui";
902
+
903
+ <ScrollArea type="hover" scrollHideDelay={800} style={{height: 200}}>
904
+ <div>Content that might overflow</div>
905
+ </ScrollArea>;
906
+ ```
907
+
908
+ ### SvgSprite
909
+
910
+ The SvgSprite component manages SVG sprite definitions.
911
+
912
+ #### Example
913
+
914
+ ```jsx
915
+ import {SvgSprite} from "adnbn-ui";
916
+
917
+ <SvgSprite />;
918
+ ```
919
+
920
+ ### Tag
921
+
922
+ The Tag component displays a label or category tag.
923
+
924
+ #### Props
925
+
926
+ | Prop | Type | Description |
927
+ | ------- | ------------------------------------------------------------- | ----------------------------------------- |
928
+ | color | 'primary' \| 'secondary' \| 'success' \| 'warning' \| 'error' | Tag color |
929
+ | size | 'small' \| 'medium' \| 'large' | Tag size |
930
+ | onClose | function | Callback when the close button is clicked |
931
+
932
+ #### Example
933
+
934
+ ```jsx
935
+ import {Tag} from "adnbn-ui";
936
+
937
+ <Tag color="primary" size="medium" onClose={handleClose}>
938
+ Featured
939
+ </Tag>;
940
+ ```
941
+
942
+ ### Toast
943
+
944
+ The Toast component displays brief notifications.
945
+
946
+ #### Props
947
+
948
+ | Prop | Type | Description |
949
+ | -------- | --------------------------------------------------------------------------------- | ------------------------ |
950
+ | message | string | Toast message |
951
+ | type | 'info' \| 'success' \| 'warning' \| 'error' | Toast type |
952
+ | duration | number | Duration in milliseconds |
953
+ | position | 'top' \| 'bottom' \| 'top-left' \| 'top-right' \| 'bottom-left' \| 'bottom-right' | Toast position |
954
+
955
+ #### Example
956
+
957
+ ```jsx
958
+ import {Toast} from "adnbn-ui";
959
+
960
+ <Toast message="Operation successful!" type="success" duration={3000} position="top-right" />;
961
+ ```
962
+
963
+ ### Tooltip
964
+
965
+ The Tooltip component displays informative text when hovering over an element.
966
+
967
+ #### Props
968
+
969
+ | Prop | Type | Description |
970
+ | -------- | -------------------------------------- | -------------------------------- |
971
+ | content | ReactNode | Tooltip content |
972
+ | position | 'top' \| 'bottom' \| 'left' \| 'right' | Tooltip position |
973
+ | delay | number | Delay before showing the tooltip |
974
+
975
+ #### Example
976
+
977
+ ```jsx
978
+ import {Tooltip, Button} from "adnbn-ui";
979
+
980
+ <Tooltip content="More information" position="top" delay={300}>
981
+ <Button>Hover me</Button>
982
+ </Tooltip>;
983
+ ```
984
+
985
+ ### View
986
+
987
+ The View component provides a container for content with consistent styling.
988
+
989
+ #### Example
990
+
991
+ ```jsx
992
+ import {View} from "adnbn-ui";
993
+
994
+ <View>
995
+ <h1>Page Title</h1>
996
+ <p>Page content</p>
997
+ </View>;
998
+ ```
999
+
1000
+ ### ViewDrawer
1001
+
1002
+ The ViewDrawer component combines View and Drawer components.
1003
+
1004
+ #### Example
1005
+
1006
+ ```jsx
1007
+ import {ViewDrawer} from "adnbn-ui";
1008
+
1009
+ <ViewDrawer open={isOpen} onClose={() => setIsOpen(false)} position="right">
1010
+ <h1>Drawer Title</h1>
1011
+ <p>Drawer content</p>
1012
+ </ViewDrawer>;
1013
+ ```
1014
+
1015
+ ### ViewModal
1016
+
1017
+ The ViewModal component combines View and Modal components.
1018
+
1019
+ #### Example
1020
+
1021
+ ```jsx
1022
+ import {ViewModal} from "adnbn-ui";
1023
+
1024
+ <ViewModal open={isOpen} onClose={() => setIsOpen(false)} title="Modal Title">
1025
+ <p>Modal content</p>
1026
+ </ViewModal>;
1027
+ ```
1028
+
1029
+ ## Component Props
1030
+
1031
+ All components accept standard HTML attributes in addition to their specific props. Here are some common props for key components:
1032
+
1033
+ ### Button
1034
+
1035
+ | Prop | Type | Default | Description |
1036
+ | -------- | ---------------------------------------- | ----------- | ------------------------------ |
1037
+ | variant | 'contained' \| 'outlined' \| 'text' | 'contained' | Button style variant |
1038
+ | color | 'primary' \| 'secondary' \| 'accent' | undefined | Button color |
1039
+ | size | 'small' \| 'medium' \| 'large' | undefined | Button size |
1040
+ | radius | 'small' \| 'medium' \| 'large' \| 'full' | undefined | Button border radius |
1041
+ | disabled | boolean | false | Whether the button is disabled |
1042
+
1043
+ ### TextField
1044
+
1045
+ | Prop | Type | Default | Description |
1046
+ | ----------- | -------- | --------- | ------------------------------ |
1047
+ | label | string | undefined | Input label |
1048
+ | placeholder | string | undefined | Input placeholder |
1049
+ | value | string | undefined | Input value |
1050
+ | onChange | function | undefined | Change event handler |
1051
+ | error | boolean | false | Whether the input has an error |
1052
+ | helperText | string | undefined | Helper text to display |
1053
+ | disabled | boolean | false | Whether the input is disabled |
1054
+
1055
+ ## License
1056
+
1057
+ This project is licensed under the MIT License - see the LICENSE file for details.