@ruc-lib/drawer 2.0.0 → 2.0.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.
package/README.md CHANGED
@@ -1,136 +1,207 @@
1
1
  # ruclib-drawer
2
2
 
3
- This library provides a flexible and customizable drawer component for your Angular applications. Users can integrate the drawer component using Angular selectors with ease. Below are the features, usage instructions, and integration details:
4
-
5
- ## RUC Library Installation Guide
6
-
7
- Users can easily install the RUC (Ruxptest Library) from npm. Additionally, they can also choose to install individual components based on their requirements.
8
-
9
- ## Install complete library
10
-
11
- `npm install @uxpractice/ruc-lib`
12
-
13
- ## Install individual component
14
-
15
- If users only need the drawer component, they can install it separately
3
+ A highly configurable drawer component that provides a slide-in panel from any of the four directions (left, right, top, or bottom). It's designed for displaying supplementary content, navigation, or forms without navigating away from the current view.
4
+
5
+ ## Features
6
+
7
+ - **Flexible Positioning**: Open the drawer from the 'left', 'right', 'top', or 'bottom' of the container.
8
+ - **Custom Sizing**: Define custom width for vertical drawers and height for horizontal drawers.
9
+ - **Smooth Animations**: Configurable slide-in/out animation duration.
10
+ - **Display Modes**: Supports an 'over' mode where the drawer slides over the main content.
11
+ - **Content Customization**: Set a custom title and use rich HTML for the drawer's body and the main content area.
12
+ - **Interactive Toggle**:
13
+ - Optionally display a toggle button in the main content area.
14
+ - Customize button text for 'open' and 'close' states.
15
+ - Use Material icons or custom image URLs for the button.
16
+ - **Backdrop Control**: Enable or disable a backdrop, and customize its background color.
17
+ - **Close Mechanisms**:
18
+ - Show or hide a close icon within the drawer.
19
+ - Prevent closing via the Escape key or backdrop click.
20
+ - **Theming**: Apply custom theme classes for tailored styling.
21
+
22
+ ## Installation Guide
23
+
24
+ ### Install the Entire Library
25
+ ```bash
26
+ npm install @uxpractice/ruc-lib
27
+ ```
16
28
 
17
- `npm install @ruc-lib/drawer`
29
+ ### Install Individual Component
30
+ If you only need the Drawer component:
31
+ ```bash
32
+ npm install @ruc-lib/drawer
33
+ ```
18
34
 
19
35
  ## Usage
20
36
 
21
- To use the drawer component in your project, follow the integration guidelines provided in the documentation. Customize the drawer as per your requirements by adjusting the configuration options.
22
-
23
- ## Using Selector
24
-
25
- 1. Import `DrawerModule` into `app.module.ts` file.
26
- `( import { RuclibDrawerModule } from '@ruc-lib/drawer'; OR import { RuclibDrawerModule } from '@ uxpractice /ruc-lib/drawer'; )`
27
- 2. Use the drawer selector in your HTML file.
28
- 3. Handle input and output bindings accordingly.
29
-
37
+ ### 1. Import the Module
38
+ In your Angular module file (e.g., `app.module.ts`), import the `RuclibDrawerModule`:
39
+
40
+ ```typescript
41
+ // For Complete Library
42
+ import { RuclibDrawerModule } from '@uxpractice/ruc-lib/drawer';
43
+
44
+ // For Individual Package
45
+ import { RuclibDrawerModule } from '@ruc-lib/drawer';
46
+
47
+ import { AppComponent } from './app.component';
48
+ import { NgModule } from '@angular/core';
49
+ import { BrowserModule } from '@angular/platform-browser';
50
+ import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
51
+
52
+ @NgModule({
53
+ declarations: [AppComponent],
54
+ imports: [
55
+ BrowserModule,
56
+ BrowserAnimationsModule,
57
+ RuclibDrawerModule
58
+ ],
59
+ providers: [],
60
+ bootstrap: [AppComponent]
61
+ })
62
+ export class AppModule {}
30
63
  ```
31
- <uxp-ruclib-drawer
32
- (rucEvent)="passEvent($event)"
33
- [rucInputData]="inputObjectDataDrawer"
34
- [customTheme]="customTheme">
35
- </uxp-ruclib-drawer>
36
- ```
37
-
38
- # Input and Output
39
-
40
- ## Input and Output
41
64
 
42
- Inputs:
43
- • rucInputData: Data to be passed to the drawer.
44
- • customTheme: Custom styling/theme for the drawer.
65
+ ### 2. Use the Component
66
+ In your component's template, use the `<uxp-ruclib-drawer>` selector:
45
67
 
46
- Outputs:
47
- • rucEvent: Event emitted from the drawer.
48
-
49
-
50
- ## rucInputData configurations options-
51
-
52
- ```
53
- DrawerDefaultConfig {
54
- drawerPosition: string = 'left',
55
- mode: string = 'over',
56
- initialOpenedState: boolean = false,
57
- drawerWidth: string = '250px',
58
- drawerHeight: string = '',
59
- content: {
60
- drawerTitle: string = 'Drawer Title',
61
- drawerBody: string = '<p>This is the <strong>body</strong> content of the drawer.</p><p>It can contain <em>HTML</em>.</p>',
62
- mainBody: string = '<h2>Main Content Area</h2><p>This is where the main application content would go.</p>',
63
- },
64
- disableToggleButtonInMainContent: boolean = false,
65
- toggleButtonText: object = {
66
- open: string = 'Open Drawer',
67
- close: string = 'Close Drawer',
68
- },
69
- hasBackdrop: boolean = true,
70
- backdropBackgroundColor: string = 'rgba(129, 124, 124, 0.6)',
71
- showCloseIcon: boolean = true,
72
- disableClose: boolean = false,
73
- animationDuration: string = '300ms',
74
- toggleButtonIcon: string = '',
75
- toggleButtonImageAlt: string = '',
76
- toggleButtonImageUrl: string = '',
77
- toggleButtonDimensions: ButtonDimensions = {
78
- width: string = 'auto',
79
- height: string = '40px',
80
- padding: string = '10px',
81
- fontSize: string = '13px',
82
- iconSize: string = '24px',
83
- },
84
- closeButtonDimensions: IconDimensions = {
85
- width: string = '40px',
86
- height: string = '40px',
87
- iconSize: string = '24px',
88
- },
89
- };
68
+ ```html
69
+ <uxp-ruclib-drawer
70
+ [rucInputData]="drawerInput"
71
+ [customTheme]="customTheme"
72
+ (rucEvent)="passEvent($event)">
73
+ </uxp-ruclib-drawer>
90
74
  ```
91
75
 
92
- # Default value be like –
93
-
94
- ```
95
- export const mockDrawerInput = {
76
+ ## API Reference
77
+
78
+ ### Component Inputs
79
+
80
+ | Input | Type | Description |
81
+ |----------------|-----------------------|--------------------------------------------------|
82
+ | `rucInputData` | `RuclibDrawerInput` | The main configuration object for the drawer. |
83
+ | `customTheme` | `string` | An optional CSS class for custom theming. |
84
+
85
+ ### Component Outputs
86
+
87
+ | Output | Type | Description |
88
+ |------------|-------|----------------------------------------------|
89
+ | `rucEvent` | `any` | Emits events from the drawer. |
90
+
91
+ ### `rucInputData` (`RuclibDrawerInput`)
92
+ This is the main configuration object for the Drawer component.
93
+
94
+ | Property | Type | Description |
95
+ |------------------------------------|----------------------|---------------------------------------------------------------------------------------------------------|
96
+ | `drawerPosition` | `string` | Position of the drawer. Can be `'left'`, `'right'`, `'top'`, or `'bottom'`. Default is `'left'`. |
97
+ | `mode` | `string` | Drawer mode. Can be `'over'`, `'push'`, or `'side'`. Default is `'over'`. |
98
+ | `initialOpenedState` | `boolean` | If `true`, the drawer is open initially. Default is `false`. |
99
+ | `drawerWidth` | `string` | Width of the drawer when `drawerPosition` is `'left'` or `'right'`. Default is `'250px'`. |
100
+ | `drawerHeight` | `string` | Height of the drawer when `drawerPosition` is `'top'` or `'bottom'`. |
101
+ | `content` | `object` | An object containing the HTML content for the drawer and main area. See `Content` table below. |
102
+ | `disableToggleButtonInMainContent` | `boolean` | If `true`, the toggle button in the main content area is hidden. Default is `false`. |
103
+ | `toggleButtonText` | `object` | An object for the toggle button's text. See `ToggleButtonText` table below. |
104
+ | `hasBackdrop` | `boolean` | If `true`, a backdrop is shown when the drawer is open. Default is `true`. |
105
+ | `backdropBackgroundColor` | `string` | The CSS background color for the backdrop. Default is `'rgba(129, 124, 124, 0.6)'`. |
106
+ | `showCloseIcon` | `boolean` | If `true`, a close icon is displayed inside the drawer. Default is `true`. |
107
+ | `disableClose` | `boolean` | If `true`, the drawer cannot be closed by pressing Escape or clicking the backdrop. Default is `false`. |
108
+ | `animationDuration` | `string` | The duration of the open/close animation. Default is `'300ms'`. |
109
+ | `toggleButtonIcon` | `string` | The name of the Material Icon for the toggle button. |
110
+ | `toggleButtonImageUrl` | `string` | The URL for a custom image on the toggle button. |
111
+ | `toggleButtonDimensions` | `ButtonDimensions` | An object to control the dimensions of the toggle button. See `ButtonDimensions` table below. |
112
+ | `closeButtonDimensions` | `IconDimensions` | An object to control the dimensions of the close icon. See `IconDimensions` table below. |
113
+
114
+ ### `content`
115
+ | Property | Type | Description |
116
+ |---------------|----------|-------------------------------------------|
117
+ | `drawerTitle` | `string` | The title displayed in the drawer's header. |
118
+ | `drawerBody` | `string` | The HTML content for the drawer's body. |
119
+ | `mainBody` | `string` | The HTML content for the main area. |
120
+
121
+ ### `toggleButtonText`
122
+ | Property | Type | Description |
123
+ |----------|----------|---------------------------------------------|
124
+ | `open` | `string` | Text for the toggle button to open the drawer. |
125
+ | `close` | `string` | Text for the toggle button to close the drawer. |
126
+
127
+ ### `toggleButtonDimensions` (`ButtonDimensions`)
128
+ | Property | Type | Description |
129
+ |------------|----------|-------------------------------------------|
130
+ | `width` | `string` | The width of the toggle button. |
131
+ | `height` | `string` | The height of the toggle button. |
132
+ | `padding` | `string` | The padding of the toggle button. |
133
+ | `fontSize` | `string` | The font size of the toggle button text. |
134
+ | `iconSize` | `string` | The size of the icon on the toggle button. |
135
+
136
+ ### `closeButtonDimensions` (`IconDimensions`)
137
+ | Property | Type | Description |
138
+ |------------|----------|----------------------------------|
139
+ | `width` | `string` | The width of the close button. |
140
+ | `height` | `string` | The height of the close button. |
141
+ | `iconSize` | `string` | The size of the close icon. |
142
+
143
+ ## Example Configuration
144
+
145
+ Here's an example of how to configure the Drawer component in your component's TypeScript file.
146
+
147
+ ```typescript
148
+ import { Component } from '@angular/core';
149
+
150
+ // For Complete Library
151
+ import { RuclibDrawerModule, RuclibDrawerInput, ButtonDimensions, IconDimensions } from '@uxpractice/ruc-lib/drawer';
152
+
153
+ // For Individual package
154
+ import { RuclibDrawerModule, RuclibDrawerInput, ButtonDimensions, IconDimensions } from '@ruc-lib/drawer';
155
+
156
+ @Component({
157
+ selector: 'app-root',
158
+ templateUrl: './app.component.html',
159
+ })
160
+ export class AppComponent {
161
+ customTheme = 'ruc-custom-theme';
162
+
163
+ drawerInput: RuclibDrawerInput = {
96
164
  drawerPosition: 'left',
97
165
  mode: 'over',
98
166
  initialOpenedState: false,
99
- drawerWidth: '250px',
167
+ drawerWidth: '300px',
100
168
  drawerHeight: '',
101
169
  content: {
102
- drawerTitle: 'Drawer Title',
103
- drawerBody: '<p>This is the <strong>body</strong> content of the drawer.</p><p>It can contain <em>HTML</em>.</p>',
104
- mainBody: '<h2>Main Content Area</h2><p>This is where the main application content would go.</p>',
170
+ drawerTitle: 'Navigation Menu',
171
+ drawerBody: '<p>This is where your navigation links or filters would go.</p>',
172
+ mainBody: '<h2>Main Application Content</h2><p>Click the button to open the drawer.</p>',
105
173
  },
106
174
  disableToggleButtonInMainContent: false,
107
175
  toggleButtonText: {
108
- open: 'Open Drawer',
109
- close: 'Close Drawer',
176
+ open: 'Open Menu',
177
+ close: 'Close Menu',
110
178
  },
111
179
  hasBackdrop: true,
112
- backdropBackgroundColor: 'rgba(129, 124, 124, 0.6)',
180
+ backdropBackgroundColor: 'rgba(0, 0, 0, 0.5)',
113
181
  showCloseIcon: true,
114
182
  disableClose: false,
115
- animationDuration: '300ms',
116
- toggleButtonIcon: '',
117
- toggleButtonImageAlt: '',
183
+ animationDuration: '400ms',
184
+ toggleButtonIcon: 'menu',
118
185
  toggleButtonImageUrl: '',
119
186
  toggleButtonDimensions: {
120
187
  width: 'auto',
121
- height: '40px',
122
- padding: '10px',
123
- fontSize: '13px',
188
+ height: '48px',
189
+ padding: '0 16px',
190
+ fontSize: '14px',
124
191
  iconSize: '24px',
125
192
  },
126
193
  closeButtonDimensions: {
127
- width: '40px',
128
- height: '40px',
194
+ width: '48px',
195
+ height: '48px',
129
196
  iconSize: '24px',
130
197
  },
131
- };
132
- ```
198
+ };
133
199
 
200
+ passEvent(event: any) {
201
+ console.log('Drawer Event:', event);
202
+ }
203
+ }
204
+ ```
134
205
 
135
206
  # Contribution
136
207
 
package/esm2020/index.mjs CHANGED
@@ -1,4 +1,5 @@
1
1
  export * from './lib/ruclib-drawer.module';
2
2
  export * from './lib/ruclib-drawer/ruclib-drawer.component';
3
3
  export * from './model/default-values';
4
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsY0FBYyw0QkFBNEIsQ0FBQztBQUMzQyxjQUFjLDZDQUE2QyxDQUFDO0FBQzVELGNBQWMsd0JBQXdCLENBQUMiLCJzb3VyY2VzQ29udGVudCI6WyJleHBvcnQgKiBmcm9tICcuL2xpYi9ydWNsaWItZHJhd2VyLm1vZHVsZSc7XHJcbmV4cG9ydCAqIGZyb20gJy4vbGliL3J1Y2xpYi1kcmF3ZXIvcnVjbGliLWRyYXdlci5jb21wb25lbnQnO1xyXG5leHBvcnQgKiBmcm9tICcuL21vZGVsL2RlZmF1bHQtdmFsdWVzJzsiXX0=
4
+ export * from './interface/drawer';
5
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsY0FBYyw0QkFBNEIsQ0FBQztBQUMzQyxjQUFjLDZDQUE2QyxDQUFDO0FBQzVELGNBQWMsd0JBQXdCLENBQUM7QUFDdkMsY0FBYyxvQkFBb0IsQ0FBQyIsInNvdXJjZXNDb250ZW50IjpbImV4cG9ydCAqIGZyb20gJy4vbGliL3J1Y2xpYi1kcmF3ZXIubW9kdWxlJztcclxuZXhwb3J0ICogZnJvbSAnLi9saWIvcnVjbGliLWRyYXdlci9ydWNsaWItZHJhd2VyLmNvbXBvbmVudCc7XHJcbmV4cG9ydCAqIGZyb20gJy4vbW9kZWwvZGVmYXVsdC12YWx1ZXMnO1xyXG5leHBvcnQgKiBmcm9tICcuL2ludGVyZmFjZS9kcmF3ZXInOyJdfQ==