@egovernments/digit-ui-components 0.2.1 → 0.2.3

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,137 +1,437 @@
1
1
 
2
- # digit-ui-components
2
+ # DIGIT UI Components
3
3
 
4
- ## Install
4
+ A comprehensive React component library for DIGIT platform applications, providing standardized UI components, form composers, and search interfaces.
5
+
6
+ ## 📦 Install
5
7
 
6
8
  ```bash
7
9
  npm install --save @egovernments/digit-ui-components
8
10
  ```
9
11
 
10
- ## Limitation
12
+ **Latest Version: 0.2.1** 🎉
11
13
 
12
- ```bash
13
- This Package is more specific to DIGIT-UI's can be used across mission's
14
+ ## 🚀 What's New in v0.2.1
15
+
16
+ ### 🔄 InboxSearchComposer Enhancements
17
+
18
+ #### 1. **Enhanced Table Component**
19
+ - Replaced old table with **ResultsDataTable** using react-data-table-component (v7.6.2)
20
+ - Features: sorting, filtering, selection, pagination, and expandable rows
21
+ - Better performance and customization options
22
+
23
+ #### 2. **Link Column Support**
24
+ ```jsx
25
+ {
26
+ label: "Id",
27
+ jsonPath: "id",
28
+ link: true, // Creates clickable links
29
+ buttonProps: {
30
+ size: "medium",
31
+ icon: "Edit",
32
+ linkTo: "/edit-page" // Optional: direct navigation
33
+ }
34
+ }
14
35
  ```
15
36
 
16
- ## Usage
37
+ #### 3. **Row Selection & Actions**
38
+ ```jsx
39
+ // Row selection configuration
40
+ selectionProps: {
41
+ showCheckBox: true,
42
+ showSelectedState: true,
43
+ selectableRowsNoSelectAll: false,
44
+ showSelectedStatePosition: "top" // or "bottom"
45
+ }
46
+
47
+ // Action buttons for selected rows
48
+ actionProps: {
49
+ actions: [
50
+ { label: "Edit", variation: "secondary", icon: "Edit" },
51
+ { label: "Delete", variation: "primary", icon: "Delete" }
52
+ ]
53
+ }
54
+ ```
17
55
 
18
- After adding the dependency make sure you have this dependency in
56
+ #### 4. **Footer Actions**
57
+ ```jsx
58
+ footerProps: {
59
+ showFooter: true,
60
+ allowedRolesForFooter: ["ADMIN"],
61
+ actionFields: [
62
+ {
63
+ label: "Previous",
64
+ icon: "ArrowBack",
65
+ variation: "secondary",
66
+ allowedRoles: ["USER"]
67
+ },
68
+ {
69
+ label: "Next",
70
+ icon: "ArrowForward",
71
+ variation: "primary",
72
+ allowedRoles: ["ADMIN"]
73
+ }
74
+ ],
75
+ setactionFieldsToRight: true
76
+ }
77
+ ```
19
78
 
20
- ```bash
21
- frontend/micro-ui/web/package.json
79
+ #### 5. **Expandable Rows**
80
+ ```jsx
81
+ const ExpandedComponent = ({ data }) => (
82
+ <pre>{JSON.stringify(data, null, 2)}</pre>
83
+ );
84
+
85
+ expandableProps: {
86
+ expandableRows: true,
87
+ expandableRowsComponent: ExpandedComponent
88
+ }
22
89
  ```
23
90
 
24
- ```json
25
- "@egovernments/digit-ui-components":"0.0.1",
91
+ #### 6. **Editable Tables**
92
+ - **Inline Editing:** Edit fields directly within table rows
93
+ - **Popup Editing:** Edit in modal with additional fields
94
+ - **Field Validation:** FieldV1 configurations for consistency
95
+
96
+ ```jsx
97
+ // Inline editable column
98
+ {
99
+ label: "Name",
100
+ jsonPath: "data.name",
101
+ editable: true,
102
+ editableFieldConfig: {
103
+ type: "text",
104
+ validation: { minlength: 2 },
105
+ populators: { name: "row.name" }
106
+ }
107
+ }
108
+
109
+ // Additional popup fields
110
+ additionalPopupColumns: [
111
+ {
112
+ label: "Description",
113
+ jsonPath: "data.description",
114
+ editable: true,
115
+ editableFieldConfig: {
116
+ type: "textarea",
117
+ populators: { name: "row.description" }
118
+ }
119
+ }
120
+ ]
26
121
  ```
27
122
 
28
- then navigate to App.js
123
+ #### 7. **UICustomizations Handlers**
124
+ Enhanced event handling through UICustomizations:
29
125
 
30
- ```bash
31
- frontend/micro-ui/web/src/App.js
126
+ ```jsx
127
+ // Handle link column clicks
128
+ linkColumnHandler: (row) => {
129
+ const url = `/${window.contextPath}/employee/view?id=${row?.id}`;
130
+ window.location.href = url;
131
+ },
132
+
133
+ // Handle row selections
134
+ selectionHandler: (event) => {
135
+ const { allSelected, selectedCount, selectedRows } = event;
136
+ console.log('Selected:', selectedCount, 'rows');
137
+ },
138
+
139
+ // Handle action button clicks
140
+ actionSelectHandler: (index, label, selectedRows) => {
141
+ if (label === "Delete") {
142
+ // Handle delete action
143
+ }
144
+ },
145
+
146
+ // Handle footer action clicks
147
+ footerActionHandler: (index, event) => {
148
+ console.log('Footer action:', index, event);
149
+ }
32
150
  ```
33
151
 
34
- # Syntax for importing any components
152
+ ### 🎯 FormComposer Enhancements
35
153
 
154
+ #### 1. **Extended Field Types**
155
+ Now supports 20+ field types:
36
156
  ```jsx
37
- import { SVG } from "@egovernments/digit-ui-components";
157
+ // New field types added
158
+ "text", "date", "time", "geolocation", "password",
159
+ "search", "number", "numeric", "textarea", "radio",
160
+ "dropdown", "select", "radioordropdown", "toggle",
161
+ "checkbox", "multiselectdropdown", "mobileNumber",
162
+ "component", "custom", "amount", "locationdropdown",
163
+ "apidropdown", "dateRange"
164
+ ```
38
165
 
39
- <SVG.Accessibility />;
166
+ #### 2. **Boundary Dropdowns (Dependent Dropdowns)**
167
+ ```jsx
168
+ {
169
+ type: "boundary",
170
+ label: "Administrative Area",
171
+ populators: {
172
+ name: "boundary",
173
+ levelConfig: {
174
+ lowestLevel: "VILLAGE",
175
+ highestLevel: "STATE",
176
+ isSingleSelect: ["STATE"] // Single selection for state level
177
+ },
178
+ hierarchyType: "ADMIN_BOUNDARY",
179
+ layoutConfig: {
180
+ isDropdownLayoutHorizontal: true,
181
+ isLabelFieldLayoutHorizontal: false
182
+ },
183
+ preSelected: ["STATE_001", "DISTRICT_001"], // Pre-fill values
184
+ frozenData: [ // Locked selections
185
+ { code: "STATE_001", name: "State 1" }
186
+ ]
187
+ }
188
+ }
40
189
  ```
41
190
 
42
- # Local Development to check storybook
43
- Use Node 14 version
191
+ ### 🎨 Major Enhancements
192
+ - **🌍 Boundary Dropdowns** for hierarchical administrative boundary selection
193
+ - **📊 Editable Tables** with inline editing and popup functionality
194
+ - **🎨 Improved Typography & Styling** with responsive design updates
195
+ - **🔧 Better Component Variants** for increased flexibility
44
196
 
45
- Step 1
197
+ ### Breaking Changes
198
+ - **MDMS v2 Integration** - Updated prop formats required
199
+ - **Pagination Updates** - Enhanced pagination implementation
200
+ - **Employee → UserType** - Configuration property updates
201
+ - **Custom Row Components** - New structure requirements
46
202
 
47
- ```bash
48
- yarn install
203
+ 📖 **[Migration Guide](./migration/v0.2.0-to-v0.2.1-migration-guide.md)** - Complete guide for upgrading from v0.2.0
204
+
205
+ ## 🎯 Usage
206
+
207
+ ### Installation
208
+
209
+ Add the dependency to your package.json:
210
+
211
+ ```json
212
+ "@egovernments/digit-ui-components": "0.2.1"
49
213
  ```
50
214
 
51
- Step 2
215
+ ### Basic Import
52
216
 
53
- ```bash
54
- yarn storybook
217
+ ```jsx
218
+ // Import individual components
219
+ import { Button, TextInput, FormComposerV2, InboxSearchComposer } from "@egovernments/digit-ui-components";
220
+
221
+ // Import SVG icons
222
+ import { SVG } from "@egovernments/digit-ui-components";
223
+
224
+ // Usage
225
+ <Button variant="primary">Click Me</Button>
226
+ <SVG.Accessibility />
227
+ ```
228
+
229
+ ### Component Categories
230
+
231
+ #### 🔧 **Atoms** (Basic Components)
232
+ - Button, TextInput, Toggle, Tag, RadioButtons, OTPInput
233
+ - Dropdown, MultiSelectDropdown, CheckBox, Chip
234
+ - Loader, Toast, Timeline, Stepper, and more
235
+
236
+ #### 🧩 **Molecules** (Composite Components)
237
+ - CustomDropdown, ApiDropdown, ResultsDataTable
238
+ - FilterCard, SummaryCard, FormCard, PanelCard
239
+ - Header, Footer, SideNav, BottomSheet
240
+
241
+ #### 🎯 **HOCs** (Higher Order Components)
242
+ - **FormComposerV2** - Dynamic form builder
243
+ - **InboxSearchComposer** - Search & inbox interfaces
244
+ - **BoundaryFilter** - Hierarchical boundary selection
245
+
246
+ ## 📋 Quick Start Examples
247
+
248
+ ### FormComposer Usage
249
+ ```jsx
250
+ import { FormComposerV2 } from "@egovernments/digit-ui-components";
251
+
252
+ const formConfig = {
253
+ head: "User Details",
254
+ body: [
255
+ {
256
+ type: "text",
257
+ label: "Name",
258
+ isMandatory: true,
259
+ populators: { name: "userName" }
260
+ },
261
+ {
262
+ type: "boundary", // New boundary dropdown
263
+ label: "Location",
264
+ populators: {
265
+ name: "location",
266
+ hierarchyType: "ADMIN",
267
+ levelConfig: {
268
+ lowestLevel: "LOCALITY",
269
+ highestLevel: "STATE"
270
+ }
271
+ }
272
+ }
273
+ ]
274
+ };
275
+
276
+ <FormComposerV2
277
+ config={[formConfig]}
278
+ onSubmit={handleSubmit}
279
+ defaultValues={defaultData}
280
+ />
281
+ ```
282
+
283
+ ### InboxSearchComposer Usage
284
+ ```jsx
285
+ import { InboxSearchComposer } from "@egovernments/digit-ui-components";
286
+
287
+ const searchConfig = {
288
+ headerLabel: "Search Applications", // Updated from 'label'
289
+ type: "search",
290
+ actions: { // Updated structure
291
+ actionLabel: "Create New",
292
+ actionRoles: ["ADMIN"],
293
+ actionLink: "/create"
294
+ },
295
+ // ... rest of config
296
+ };
297
+
298
+ <div className="digit-inbox-search-wrapper">
299
+ <InboxSearchComposer configs={searchConfig} />
300
+ </div>
55
301
  ```
56
302
 
57
- ### New Changes
303
+ ## 🛠️ Local Development
58
304
 
59
- ## [0.0.1-beta.28] - 2024-05-24
305
+ ### Prerequisites
306
+ - Node.js 14+
307
+ - Yarn package manager
60
308
 
61
- - Added restrictSelection prop in Multiselectdropdown. If this is sent as true, it restricts any option to get selected.
309
+ ### Setup Storybook
62
310
 
63
- - Usage:
64
- ```jsx
65
- <MultiSelectDropdown
66
- restrictSelection={true}
67
- />
68
- ```
311
+ ```bash
312
+ # Step 1: Install dependencies
313
+ yarn install
69
314
 
70
- ### Breaking Changes while migrating from any version below 0.0.1-beta.22
315
+ # Step 2: Start Storybook
316
+ yarn storybook
317
+ ```
71
318
 
72
- ## [0.0.1-beta.22] - 2024-05-20
319
+ ## 🔄 Migration & Version History
73
320
 
74
- - Toast Component: From this version of `ui-components`, the `Toast` component has a new prop named `type`, replacing the separate props for `info`, `warning`, and `error`.
75
- - Old Usage:
76
- ```jsx
77
- <Toast info={true} label={"Info Toast"} />
78
- <Toast warning="warning" label={"Warning Toast"}/>
79
- <Toast error={true} label={"Error Toast"}/>
80
- ```
81
- - New Usage:
82
- ```jsx
83
- <Toast type="info" label={"Info Toast"} />
84
- <Toast type="warning" label={"Warning Toast"} />
85
- <Toast type="error" label={"Error Toast"} />
86
- <Toast type="success" label={"Success Toast"} />
87
- ```
321
+ ### **v0.2.1** (Current) - 2025-10-23
88
322
 
89
- ## Changelog
323
+ #### ✨ Major Features
324
+ - **Enhanced FormComposer & InboxSearchComposer** with improved config structure
325
+ - **Boundary Dropdowns** for hierarchical selection (Country → State → City)
326
+ - **Editable Tables** with inline editing and popup functionality
327
+ - **Footer Actions** support in InboxSearchComposer
328
+ - **Custom Row Components** in ResultsDataTable
90
329
 
91
- ### Summary for Version [0.0.2] - 2024-06-03
330
+ #### 🐛 Key Fixes
331
+ - Fixed pagination issues in InboxSearchComposer
332
+ - Resolved dropdown text clearing after re-render
333
+ - Fixed multiple API call prevention
334
+ - Improved error handling across components
92
335
 
93
- #### New Changes
336
+ #### ⚠️ Breaking Changes
337
+ - `label` → `headerLabel` in InboxSearchComposer configs
338
+ - `employee` → `userType` in actionLink configurations
339
+ - MDMS v2 prop format requirements
340
+ - Enhanced pagination implementation
94
341
 
95
- - Added Error Message Component.
96
- - Added Info Button Component.
97
- - Added Panels Component.
98
- - Added Popup Component with two variants: `default` and `alert`.
99
- - Added RemoveableTag Component.
100
- - Added Stepper Component.
101
- - Added TextBlock Component.
102
- - Added Timeline Component.
103
- - Added Uploader Component with three variants: `UploadFile`, `UploadPopup`, and `UploadImage`.
104
- - Added PanelCard Molecule.
342
+ **📖 [Full Migration Guide](./migration/v0.2.0-to-v0.2.1-migration-guide.md)**
343
+
344
+ ### **v0.2.0** - Previous Major Release
345
+
346
+ #### New Components Added
347
+ - Error Message, Info Button, Panels, Popup Components
348
+ - Stepper, TextBlock, Timeline Components
349
+ - Uploader variants (UploadFile, UploadPopup, UploadImage)
350
+ - PanelCard Molecule
105
351
 
106
352
  #### Enhancements
353
+ - Updated Button & Dropdown Component Styles
354
+ - Toast animations and new `type` prop
355
+ - Typography updates with lineHeight
356
+ - Enhanced Color Typography
357
+
358
+ ### Migration Examples
107
359
 
108
- - Updated Button Component Styles.
109
- - Updated Dropdown Component Styles and added SelectAll Option.
110
- - Updated InfoCard Component Styles.
111
- - Added Animation for Toast.
112
- - Added new prop `type` for Toast, replacing the separate props for `info`, `warning`, and `error`.
113
- - Updated Typography with lineHeight.
114
- - Updated Color Typography.
360
+ #### Toast Component (v0.2.0 Breaking Change)
361
+ ```jsx
362
+ // Old Usage (pre v0.2.0)
363
+ <Toast info={true} label={"Info Toast"} />
364
+ <Toast warning="warning" label={"Warning Toast"}/>
365
+
366
+ // New Usage (v0.2.0+)
367
+ <Toast type="info" label={"Info Toast"} />
368
+ <Toast type="warning" label={"Warning Toast"} />
369
+ <Toast type="success" label={"Success Toast"} />
370
+ ```
115
371
 
116
- For a detailed changelog, see the [CHANGELOG.md](./CHANGELOG.md) file.
372
+ #### InboxSearchComposer Config (v0.2.1 Breaking Change)
373
+ ```jsx
374
+ // ❌ Old Config (v0.2.0)
375
+ const oldConfig = {
376
+ label: "Search Applications",
377
+ actionLabel: "Create",
378
+ actionRoles: ["ADMIN"]
379
+ };
380
+
381
+ // ✅ New Config (v0.2.1)
382
+ const newConfig = {
383
+ headerLabel: "Search Applications", // Changed from 'label'
384
+ actions: { // Grouped under 'actions'
385
+ actionLabel: "Create",
386
+ actionRoles: ["ADMIN"],
387
+ actionLink: "/create"
388
+ }
389
+ };
390
+ ```
117
391
 
118
- ## Published from DIGIT-UI-LIBRARIES
392
+ ## 📖 Documentation & Resources
119
393
 
120
- DIGIT-UI-LIBRARIES Repo (https://github.com/egovernments/DIGIT-UI-LIBRARIES/tree/master)
394
+ ### 📚 **Documentation**
395
+ - **[Full Documentation](./DOCUMENTATION.md)** - Comprehensive component documentation
396
+ - **[Migration Guide](./migration/v0.2.0-to-v0.2.1-migration-guide.md)** - Step-by-step upgrade instructions
397
+ - **[Changelog](./CHANGELOG.md)** - Detailed version history and changes
121
398
 
122
- # Contributors
399
+ ### 📋 **Sample Configurations & Examples**
400
+ - **[Sample Configs](https://github.com/egovernments/DIGIT-Frontend/tree/sample/micro-ui/web/micro-ui-internals/packages/modules/sample/src/configs/uiComponentsConfigs)** - Complete configuration examples
401
+ - **[Sample Module Screens](https://github.com/egovernments/DIGIT-Frontend/tree/sample/micro-ui/web/micro-ui-internals/packages/modules/sample)** - Integration examples with new components
402
+ - **[Boundary Dropdown Examples](https://github.com/egovernments/DIGIT-Frontend/blob/sample/micro-ui/web/micro-ui-internals/packages/modules/sample/src/configs/uiComponentsConfigs/boundaryConfig.js)** - Dependent dropdown configurations
403
+ - **[Editable Table Examples](https://github.com/egovernments/DIGIT-Frontend/blob/sample/micro-ui/web/micro-ui-internals/packages/modules/sample/src/configs/uiComponentsConfigs/editableTableConfig.js)** - Inline and popup editing configs
123
404
 
124
- [nabeelmd-egov] [bhavya-eGov] [nipunarora-eGov] [swathi-egov] [jagankumar-egov]
405
+ ### 🎨 **Live Examples**
406
+ - **[Storybook](https://unified-dev.digit.org/storybook/)** - Interactive component playground
407
+ - **[Official DIGIT Documentation](https://core.digit.org/guides/developer-guide/ui-developer-guide/digit-ui/ui-components-standardisation/digit-ui-components0.2.0)** - Integration guides
125
408
 
126
- # Reference
409
+ ### 🔗 **Links**
410
+ - **[Source Repository](https://github.com/egovernments/DIGIT-UI-LIBRARIES/tree/develop)** - Main development repository
411
+ - **[NPM Package](https://www.npmjs.com/package/@egovernments/digit-ui-components)** - Published package
127
412
 
128
- Storybook (https://unified-dev.digit.org/storybook/)
413
+ ## 🤝 Contributors
129
414
 
130
- Documentation (https://core.digit.org/guides/developer-guide/ui-developer-guide/digit-ui/ui-components-standardisation/digit-ui-components0.2.0)
415
+ Special thanks to our contributors:
416
+ - [@swathi-egov](https://github.com/swathi-egov)
417
+ - [@nabeelmd-egov](https://github.com/nabeelmd-egov)
418
+ - [@bhavya-eGov](https://github.com/bhavya-eGov)
419
+ - [@nipunarora-eGov](https://github.com/nipunarora-eGov)
420
+ - [@tulika-egov](https://github.com/tulika-egov)
421
+ - [@jagankumar-egov](https://github.com/jagankumar-egov)
422
+ - [@Ramkrishna-egov](https://github.com/Ramkrishna-egov)
423
+ - [@piyushraj-egov](https://github.com/piyushraj-egov)
131
424
 
132
- ## License
425
+ ## 📄 License
133
426
 
134
427
  MIT © [jagankumar-egov](https://github.com/jagankumar-egov)
135
428
 
136
- ![Logo](https://s3.ap-south-1.amazonaws.com/works-dev-asset/mseva-white-logo.png)
429
+ ## 🏛️ About DIGIT
430
+
431
+ This component library is part of the **DIGIT** (Digital Infrastructure for Governance, Impact & Transformation) platform - India's largest open-source platform for digital governance.
432
+
433
+ ![DIGIT Logo](https://s3.ap-south-1.amazonaws.com/works-dev-asset/mseva-white-logo.png)
434
+
435
+ ---
137
436
 
437
+ **🎯 Ready to build with DIGIT UI Components?** Start with our [Quick Start Guide](#-quick-start-examples) or explore the [Storybook](https://unified-dev.digit.org/storybook/) for interactive examples!