nexus-shared 1.1.12 → 1.1.13

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/package.json CHANGED
@@ -1,15 +1,19 @@
1
1
  {
2
2
  "name": "nexus-shared",
3
- "version": "1.1.12",
3
+ "version": "1.1.13",
4
4
  "description": "Nexus shared React components for Next.js",
5
5
  "type": "module",
6
- "sideEffects": [ "**/*.css" ],
6
+ "sideEffects": [
7
+ "**/*.css"
8
+ ],
7
9
  "exports": {
8
10
  ".": "./src/index.ts",
9
11
  "./client": "./src/client.ts",
10
12
  "./interface": "./src/interface.ts"
11
13
  },
12
- "files": [ "src" ],
14
+ "files": [
15
+ "src"
16
+ ],
13
17
  "scripts": {
14
18
  "typecheck": "tsc --noEmit"
15
19
  },
@@ -4,6 +4,7 @@ import { DEFAULT_ICON_ELEMENT_NAME, EIcons, EIconTypes } from "../../interfaces/
4
4
  import { EBadgeTypes, EOpacity, ESizes } from "../../interfaces/layout-interfaces";
5
5
  import { EBackgrounds } from "../../interfaces/theme-interfaces";
6
6
  import { ClickHandler, UN } from "../../interfaces/type-interfaces";
7
+ import { NEXUS_CONFIG } from "../../nexus.environments";
7
8
 
8
9
  interface IIconBoxProps {
9
10
  icon: EIcons;
@@ -89,4 +90,4 @@ export const CreateIconBox = (icon: EIcons, parent?: HTMLElement | UN, children?
89
90
  return iconBox;
90
91
  };
91
92
 
92
- export const CreateToggleButton = (parentElement?: HTMLElement | null, children?: HTMLElement | UN, id?: string, boxSize?: ESizes | null, iconSize?: ESizes | null, opacity?: EOpacity | UN, iconType?: EIconTypes | null, boxBackground?: EBackgrounds) => CreateIconBox(EIcons.ELLIPSIS_HORIZONTAL, parentElement, children, id, iconType, boxBackground, boxSize, iconSize, `h ${boxBackground ?? "bg1"} ml5`, "r90");
93
+ export const CreateToggleButton = (parentElement?: HTMLElement | null, children?: HTMLElement | UN, id?: string, boxSize?: ESizes | null, iconSize?: ESizes | null, opacity?: EOpacity | UN, iconType?: EIconTypes | null, boxBackground?: EBackgrounds) => CreateIconBox(EIcons.ELLIPSIS_HORIZONTAL, parentElement, children, id, iconType, boxBackground, boxSize, iconSize, `h ${boxBackground ?? NEXUS_CONFIG.DEFAULT_BACKGROUND} ml5`, "r90");
@@ -1,4 +1,4 @@
1
- 'use client';
1
+ "use client";
2
2
 
3
3
  import React, { useEffect, useState } from "react";
4
4
  import { CreateClone, DynamicSorting, GetVisibleAndHiddenItems } from "../../helpers/datasource-helpers";
@@ -8,6 +8,7 @@ import { IDialogboxResults } from "../../interfaces/dialogbox-interfaces";
8
8
  import { DEFAULT_ICON_ELEMENT_NAME, EIcons, EIconTypes } from "../../interfaces/icon-interfaces";
9
9
  import { EPositions } from "../../interfaces/layout-interfaces";
10
10
  import { ClickHandler, UN } from "../../interfaces/type-interfaces";
11
+ import { NEXUS_CONFIG } from "../../nexus.environments";
11
12
  import { GlobalDialogbox, InitializeDialogbox } from "./../layouts/global-dialogbox";
12
13
  import { Button, Buttons, CreateButton, CreateButtons, SET_BUTTON_ACTIVE_CLASS } from "./button";
13
14
  import { CreateToggleButton, Iconbox } from "./icon-box";
@@ -80,7 +81,7 @@ export function CreateTabButtons<T>(buttons: IButton[], parent: HTMLElement | nu
80
81
  }
81
82
  }
82
83
  };
83
- const onVisibility = (isVisible: boolean) => {
84
+ const onVisibility = () => {
84
85
  if (linkButtons) linkButtons.remove();
85
86
  linkButtons = CreateButtons(hiddenItems, themeContainer, null, 6, 0);
86
87
  };
@@ -124,10 +125,10 @@ export const TabButtons = ({ buttons, activeButton, onClicked }: { buttons: IBut
124
125
  if (active && active.id && btn.id === active.id) {
125
126
  btn.iconType = EIconTypes.FILLED;
126
127
  btn.defaultClass = "btn active jc r";
127
- } else btn.defaultClass = "bg1 jc r";
128
+ } else btn.defaultClass = `jc r ${NEXUS_CONFIG.DEFAULT_BACKGROUND}`;
128
129
  }
129
130
 
130
- for (const btn of hiddenItems) btn.defaultClass = "bg1";
131
+ for (const btn of hiddenItems) btn.defaultClass = NEXUS_CONFIG.DEFAULT_BACKGROUND;
131
132
 
132
133
  for (const btn of newButtons) {
133
134
  btn.onClick = (event, element, data, index) => {
@@ -1,9 +1,10 @@
1
1
  import { DEFAULT_INPUT_BORDER_SIZE, IInputRootParameters, REQUIRED_TEXT1 } from "../../interfaces/input-interfaces";
2
2
  import { EBackgrounds } from "../../interfaces/theme-interfaces";
3
+ import { NEXUS_CONFIG } from "../../nexus.environments";
3
4
  import { CreateIconBox } from "../documents/icon-box";
4
5
 
5
6
  export const CreateInputBox = (param: IInputRootParameters<any>, child: HTMLElement | null, parent: HTMLElement | null, isTabular: boolean) => {
6
- const bg = param.background ?? "bg1";
7
+ const bg = param.background ?? NEXUS_CONFIG.DEFAULT_BACKGROUND;
7
8
 
8
9
  const BORDER_SIZE = param.borderSize ?? DEFAULT_INPUT_BORDER_SIZE;
9
10
 
@@ -1,3 +1,4 @@
1
+ import { DEFAULT_ICON_ELEMENT_NAME } from "../interface";
1
2
  import { EValueChangeTypes, IInputCreateResults, IInputRootParameters } from "../interfaces/input-interfaces";
2
3
  import { ESizes } from "../interfaces/layout-interfaces";
3
4
  import { UN } from "../interfaces/type-interfaces";
@@ -22,3 +23,22 @@ export const ForceSetValue = (input?: IInputCreateResults | null, value?: any |
22
23
  clearTimeout(timeoutValue);
23
24
  }, timeout ?? 0);
24
25
  };
26
+ export const ApplyPasswordInput = (iconbox: HTMLElement | null, inputElement: HTMLElement | null) => {
27
+ const input = inputElement as HTMLInputElement | undefined;
28
+ if (!input || !iconbox) return;
29
+ const icon = iconbox.querySelector(DEFAULT_ICON_ELEMENT_NAME) as HTMLElement | null;
30
+ if (icon) icon.setAttribute("name", "eye");
31
+ const onMouseLeave = () => {
32
+ iconbox.removeEventListener("mouseleave", onMouseLeave);
33
+ iconbox.removeEventListener("click", onClicked);
34
+ input.type = "password";
35
+ if (icon) icon.setAttribute("name", "key");
36
+ };
37
+ const onClicked = () => {
38
+ const isPassword = input.type === "password";
39
+ input.type = isPassword ? "text" : "password";
40
+ if (icon) icon.setAttribute("name", isPassword ? "eye-off" : "eye");
41
+ };
42
+ iconbox.addEventListener("mouseleave", onMouseLeave);
43
+ iconbox.addEventListener("click", onClicked);
44
+ };
@@ -2,26 +2,30 @@ import { ENexusModules } from "./interfaces/system-interfaces";
2
2
  import { EBackgrounds } from "./interfaces/theme-interfaces";
3
3
 
4
4
  export const APIS = {
5
- DRIVE: "",
5
+ DRIVE: process.env.API_DRIVE,
6
+ AUTHENTICATION: process.env.API_AUTHENTICATION,
7
+ CONFIGURATION: process.env.API_CONFIGURATION,
8
+ CURRENT: process.env.API_CURRENT,
6
9
  };
7
- const FILE = (filePath: string, fileExtension: string, fileName: string) => `${APIS.DRIVE}/static-files/${encodeURIComponent(filePath)}/${encodeURIComponent(fileExtension)}/${encodeURIComponent(fileName)}`;
10
+ const FILE = (apiName: string, filePath: string, fileName: string) => `${APIS.DRIVE}/Resources/${apiName}/${encodeURIComponent(filePath)}/${encodeURIComponent(fileName)}`;
8
11
  export const FILES = {
9
12
  LOGO: {
10
- ICON: "/static-files/logos/icon-logo.png",
11
- FULL: "/static-files/logos/full-logo.png",
12
- FULL_TEXT: "/static-files/logos/full-text-logo.png",
13
+ ICON: FILE("Image", "logos", "icon-logo.png"),
14
+ FULL: FILE("Image", "logos", "full-logo.png"),
15
+ FULL_TEXT: FILE("Image", "logos", "full-text-logo.png"),
13
16
  },
17
+ SCRIPT: (fileName: string, isStyles: boolean = false) => FILE("Script", isStyles ? "css" : "js", fileName),
14
18
  };
15
19
  export const NEXUS_INFO = {
16
20
  CURRENT_MODULE: process.env.CURRENT_MODULE !== undefined ? (parseInt(process.env.CURRENT_MODULE) as ENexusModules) : undefined,
17
21
  CURRENT_MODULE_NAME: process.env.CURRENT_MODULE_NAME,
18
22
  CURRENT_MODULE_SHORT_NAME: process.env.CURRENT_MODULE_SHORT_NAME,
19
23
  IS_PRODUCTION: process.env.NODE_ENV === "production",
20
- SOFTWARE_COMPANY_SHORT_NAME: "Nexus Solutions",
21
- SOFTWARE_COMPANY_FULL_NAME: "Nexus Solutions Pvt. Ltd.",
24
+ SOFTWARE_COMPANY_SHORT_NAME: process.env.SOFTWARE_COMPANY_SHORT_NAME,
25
+ SOFTWARE_COMPANY_FULL_NAME: process.env.SOFTWARE_COMPANY_FULL_NAME,
22
26
  SOFTWARE_VERSION: process.env.SOFTWARE_VERSION,
23
27
  SOFTWARE_LAST_UPDATE_DATE: process.env.SOFTWARE_LAST_UPDATE_DATE,
24
- SOFTWARE_COMPANY_WEBSITE: "https://www.bjadhikari.com.np",
28
+ SOFTWARE_COMPANY_WEBSITE: process.env.SOFTWARE_COMPANY_WEBSITE,
25
29
  };
26
30
  export const NEXUS_CONFIG = {
27
31
  /** Default revalidate time for static generation (in minutes) */
@@ -30,5 +34,5 @@ export const NEXUS_CONFIG = {
30
34
  /** Default timeout for HTTP requests (in milliseconds) */
31
35
  DEFAULT_HTTP_REQUEST_TIMEOUT: NEXUS_INFO.IS_PRODUCTION ? 60000 : 1000000,
32
36
 
33
- DEFAULT_BACKGROUND: EBackgrounds.Background1,
37
+ DEFAULT_BACKGROUND: process.env.DEFAULT_BACKGROUND ?? EBackgrounds.Background1,
34
38
  };