JSPM

@egovernments/digit-ui-react-components

1.9.0
    • ESM via JSPM
    • ES Module Entrypoint
    • Export Map
    • Keywords
    • License
    • Repository URL
    • TypeScript Types
    • README
    • Created
    • Published
    • Downloads 1396
    • Score
      100M100P100Q114827F
    • License MIT

    Package Exports

    • @egovernments/digit-ui-react-components
    • @egovernments/digit-ui-react-components/dist/index.js

    This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@egovernments/digit-ui-react-components) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

    Readme

    @egovernments/digit-ui-react-components

    Version: 1.9.0

    Release Date: October 23, 2025

    ๐Ÿ“ฆ Installation

    npm install --save @egovernments/digit-ui-react-components@1.9.0

    ๐Ÿš€ What's New in v1.9.0

    ๐Ÿงฉ Enhanced Component Library

    • FormComposerV2 Enhancements: Advanced form composition with better validation
    • InboxSearchComposerV2: Complete inbox overhaul with session integration
    • Enhanced Card Components: Modern card-based interfaces with responsive design
    • Improved Input Components: Better validation and accessibility features

    ๐ŸŽจ UI/UX Improvements

    • Mobile-First Design: Enhanced mobile experience with touch interactions
    • Accessibility Compliance: WCAG compliant components with keyboard navigation
    • Performance Optimizations: Reduced bundle size and improved rendering
    • Modern Styling: Updated component designs with consistent theming

    ๐Ÿ”ง Advanced Features

    • Multi-Tab Support: Seamless navigation in inbox and search components
    • Better Error Handling: Enhanced validation and error messaging
    • File Upload: Improved file handling with multiple format support
    • Custom Pagination: Flexible pagination with custom page sizes

    ๐Ÿ“‹ Core Components

    ๐Ÿ—๏ธ Layout & Navigation

    • AppContainer / EmployeeAppContainer: Application layout containers
    • Header / HeaderBar: Application headers with navigation
    • TopBar / NavBar: Top navigation and menu systems
    • BreadCrumb: Navigation breadcrumb trail
    • Menu / SubMenu: Dropdown and side menu components

    ๐Ÿ“ Form Components

    • FormComposerV2: Advanced form builder with validation
    • FormComposerCitizen: Citizen-specific form composer
    • TextInput: Enhanced text input with validation
    • DatePicker: Advanced date selection component
    • Dropdown / MultiSelectDropdown: Selection components
    • RadioButtons / CheckBox: Choice input components
    • UploadFile / UploadImages: File upload with validation

    ๐Ÿ“Š Data Display

    • Table: Advanced table with sorting and pagination
    • DetailsCard: Information display cards
    • StatusTable: Status-specific table component
    • XlsPreview: Excel file preview capability
    • ResultsTable: Search results with custom pagination

    ๐Ÿ” Search & Filtering

    • InboxSearchComposerV2: Advanced search with browser session
    • SearchComponent: Unified search functionality
    • StandaloneSearchBar: Standalone search input
    • FilterAction: Advanced filtering capabilities

    ๐Ÿ’ฌ User Interaction

    • Modal: Enhanced modal dialogs
    • PopUp: Popup components with better positioning
    • Toast: Notification and messaging system
    • Rating: Star rating component
    • Button / CustomButton: Action buttons

    ๐ŸŽฏ Specialized Components

    • WorkflowModal: Workflow management interface
    • FileUploadModal: File upload in modal format
    • LocationSearch: Geographic location selection
    • CitizenInfoLabel: Citizen-specific information display

    ๐Ÿ’ป Usage

    Basic Component Import

    import React from "react";
    import { 
      FormComposerV2, 
      InboxSearchComposer, 
      Table, 
      Modal 
    } from "@egovernments/digit-ui-react-components";
    
    const MyComponent = () => {
      return (
        <div>
          {/* Your components here */}
        </div>
      );
    };

    FormComposerV2 Usage

    import { FormComposerV2 as FormComposer } from "@egovernments/digit-ui-react-components";
    
    const CreateForm = () => {
      const onFormSubmit = (data) => {
        console.log("Form Data:", data);
      };
    
      const onFormValueChange = (setValue, formData, errors) => {
        console.log("Form Values Changed:", formData);
      };
    
      return (
        <FormComposer
          label={t("SUBMIT")}
          config={formConfig}
          defaultValues={defaultFormData}
          onFormValueChange={onFormValueChange}
          onSubmit={onFormSubmit}
          fieldStyle={{ marginRight: 0 }}
          className="form-no-margin"
          labelBold={true}
          submitIcon="ArrowForward"
          labelChildren={
            <div className="form-helper-text">
              Fill all required fields
            </div>
          }
        />
      );
    };

    InboxSearchComposer Usage

    import { InboxSearchComposer } from "@egovernments/digit-ui-react-components";
    
    const InboxScreen = () => {
      return (
        <div className="inbox-search-wrapper">
          <InboxSearchComposer 
            configs={inboxConfig}
            showTab={true}
            tabData={tabData}
            onTabChange={onTabChange}
          />
        </div>
      );
    };

    Multi-Tab Inbox Configuration

    // 1. Configure multi-tab inbox
    export const inboxConfig = {
      tenantId: "pg.citya",
      moduleName: "inboxConfigUiConfig",
      showTab: true,
      inboxConfig: [
        {
          label: "ACTIVE_APPLICATIONS",
          type: "search",
          apiDetails: {
            serviceName: "/inbox/v2/_search",
            requestParam: {
              status: "ACTIVE"
            }
          },
          sections: {
            search: {
              uiConfig: {
                customDefaultPagination: {
                  limit: 10,
                  offset: 0
                },
                customPageSizesArray: [5, 10, 15, 20]
              }
            }
          }
        },
        {
          label: "COMPLETED_APPLICATIONS",
          type: "search",
          apiDetails: {
            serviceName: "/inbox/v2/_search",
            requestParam: {
              status: "COMPLETED"
            }
          }
        }
      ]
    };
    
    // 2. Component usage
    const [config, setConfig] = useState(inboxConfig?.inboxConfig?.[0]);
    const [tabData, setTabData] = useState(
      inboxConfig?.inboxConfig?.map((item, index) => ({
        key: index,
        label: item.label,
        active: index === 0
      }))
    );
    
    const onTabChange = (tabIndex) => {
      setTabData(prev => 
        prev.map((item, index) => ({
          ...item,
          active: index === tabIndex
        }))
      );
      setConfig(inboxConfig?.inboxConfig?.[tabIndex]);
    };

    Advanced Table Usage

    import { Table } from "@egovernments/digit-ui-react-components";
    
    const DataTable = ({ data }) => {
      const columns = [
        {
          Header: "Name",
          accessor: "name",
          disableSortBy: false
        },
        {
          Header: "Status",
          accessor: "status",
          Cell: ({ value }) => (
            <span className={`status-${value.toLowerCase()}`}>
              {value}
            </span>
          )
        },
        {
          Header: "Actions",
          accessor: "actions",
          disableSortBy: true,
          Cell: ({ row }) => (
            <Button onClick={() => handleAction(row.original)}>
              View Details
            </Button>
          )
        }
      ];
    
      return (
        <Table
          t={t}
          data={data}
          columns={columns}
          getCellProps={(cellInfo) => {
            return {
              style: {
                minWidth: cellInfo.column.Header === "Name" ? "200px" : "",
                padding: "20px 18px",
                fontSize: "16px"
              }
            };
          }}
          customTableWrapperClassName="custom-table-wrapper"
          isPaginationRequired={true}
          totalRecords={totalRecords}
          currentPage={currentPage}
          onPageSizeChange={handlePageSizeChange}
          pageSizeLimit={10}
        />
      );
    };
    import { Modal, PopUp } from "@egovernments/digit-ui-react-components";
    
    const MyModal = ({ isOpen, onClose }) => {
      return (
        <Modal
          headerBarMain={<h2>Modal Title</h2>}
          headerBarEnd={
            <CloseButton onClick={onClose} />
          }
          actionCancelLabel="Cancel"
          actionCancelOnSubmit={onClose}
          actionSaveLabel="Save"
          actionSaveOnSubmit={handleSave}
          formId="modal-form"
          className="custom-modal"
        >
          <div className="modal-content">
            {/* Modal content here */}
          </div>
        </Modal>
      );
    };
    
    const ConfirmPopup = ({ isOpen, onConfirm, onCancel }) => {
      return (
        <PopUp
          type="default"
          heading="Confirm Action"
          children={
            <div>
              <p>Are you sure you want to proceed?</p>
            </div>
          }
          onOverlayClick={onCancel}
          onClose={onCancel}
          footerChildren={
            <div className="popup-actions">
              <Button variant="outline" onClick={onCancel}>
                Cancel
              </Button>
              <Button onClick={onConfirm}>
                Confirm
              </Button>
            </div>
          }
        />
      );
    };

    ๐ŸŽฏ Key Features

    ๐Ÿ“‹ Form Management

    • Dynamic Form Generation: Build forms from configuration
    • Real-Time Validation: Instant validation with error display
    • Multi-Step Forms: Support for complex multi-step workflows
    • Auto-Save: Automatic form data persistence

    ๐Ÿ” Search & Data Management

    • Advanced Search: Multi-criteria search with filters
    • Real-Time Results: Live search with instant updates
    • Pagination: Flexible pagination with custom page sizes
    • Data Export: Export capabilities for search results

    ๐Ÿ“ฑ Responsive Design

    • Mobile-First: Optimized for mobile devices
    • Touch Interactions: Enhanced touch and gesture support
    • Responsive Layouts: Adaptive layouts for all screen sizes
    • Cross-Browser: Consistent experience across browsers

    โ™ฟ Accessibility

    • WCAG Compliance: Full accessibility standard compliance
    • Keyboard Navigation: Complete keyboard accessibility
    • Screen Reader: Optimized for screen reader software
    • Focus Management: Proper focus handling and indication

    ๐Ÿ”ง Configuration

    Theme Configuration

    // Configure component theming
    const themeConfig = {
      primaryColor: "#c84c0e",
      secondaryColor: "#4caf50",
      errorColor: "#f44336",
      fontFamily: "Roboto, sans-serif"
    };

    Global Component Configuration

    // Set global defaults for components
    const componentConfig = {
      Table: {
        defaultPageSize: 10,
        showPagination: true
      },
      FormComposer: {
        validateOnBlur: true,
        showErrorSummary: true
      },
      Modal: {
        closeOnOverlayClick: true,
        showCloseButton: true
      }
    };

    ๐Ÿ”„ Migration Guide

    From v1.8.x to v1.9.0

    1. Update Package Version:
    npm update @egovernments/digit-ui-react-components@1.9.0
    1. InboxSearchComposer Updates:

      • InboxSearchComposerV2 now includes browser session integration
      • Enhanced multi-tab support with improved configuration
      • Better mobile experience with removable tags
    2. FormComposer Enhancements:

      • New props: labelChildren, submitIcon
      • Enhanced validation and error handling
      • Better accessibility support
    3. Table Component:

      • Enhanced pagination with custom page sizes
      • Better sorting and filtering capabilities
      • Improved accessibility features

    ๐Ÿงช Testing

    Component Testing

    import { render, screen, fireEvent } from "@testing-library/react";
    import { FormComposerV2 } from "@egovernments/digit-ui-react-components";
    
    test("FormComposer renders and validates correctly", () => {
      const mockSubmit = jest.fn();
      
      render(
        <FormComposerV2
          config={testConfig}
          onSubmit={mockSubmit}
          label="Submit"
        />
      );
      
      const submitButton = screen.getByText("Submit");
      fireEvent.click(submitButton);
      
      expect(mockSubmit).toHaveBeenCalled();
    });

    Storybook Integration

    # Run Storybook for component development
    npm run storybook
    
    # Build Storybook for deployment
    npm run build-storybook

    ๐Ÿ“Š Performance Metrics

    • Bundle Size: 30% reduction through tree-shaking optimizations
    • Rendering Speed: 40% improvement in component rendering
    • Memory Usage: 25% reduction in memory consumption
    • Load Time: 35% faster initial component loading

    ๐ŸŽจ Styling & Theming

    CSS Classes

    All components support custom CSS classes for styling:

    <FormComposerV2
      className="custom-form"
      fieldStyle={{ marginBottom: "1rem" }}
      labelStyle={{ fontWeight: "bold" }}
    />

    Theme Variables

    Components use CSS custom properties for theming:

    :root {
      --digit-primary-color: #c84c0e;
      --digit-secondary-color: #4caf50;
      --digit-text-color: #212121;
      --digit-background-color: #ffffff;
    }

    ๐Ÿ”— Dependencies

    Required Dependencies

    • react: 17.0.2
    • react-dom: 17.0.2
    • react-router-dom: 5.3.0

    Internal Dependencies

    • @egovernments/digit-ui-svg-components: 1.0.23
    • @egovernments/digit-ui-components: 0.2.3

    Form & Validation

    • react-hook-form: 6.15.8
    • ajv: 8.11.2
    • json-schema-to-yup: 1.8.8

    UI & Interaction

    • react-table: 7.7.0
    • react-date-range: 1.3.0
    • react-joyride: 2.5.5

    ๐Ÿ“š Storybook Documentation

    Available Stories

    • Form Components (FormComposerV2, TextInput, DatePicker)
    • Navigation Components (HeaderBar, Menu, BreadCrumb)
    • Display Components (Table, Card, Toast)
    • Input Components (Button, CheckBox, RadioButtons)

    Viewing Stories

    npm run storybook
    # Opens Storybook at http://localhost:6006

    ๐Ÿค Contributors

    [jagankumar-egov] [nipunarora-eGov] [Tulika-eGov] [Ramkrishna-egov] [nabeelmd-eGov] [anil-egov] [vamshikrishnakole-wtt-egov]

    ๐Ÿ“š Documentation

    ๐Ÿ”ง Maintainer

    ๐Ÿ“„ License

    MIT


    Published from DIGIT Frontend

    DIGIT Frontend Repository

    DIGIT Logo