ui-soxo-bootstrap-core 2.6.0 → 2.6.1-dev.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.
@@ -1,33 +1,63 @@
1
1
  # This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
2
2
  # For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages
3
3
 
4
- name: Node.js Package
4
+ name: Publish Node Package (OIDC)
5
5
 
6
6
  on:
7
7
  release:
8
8
  types: [created]
9
9
 
10
+ permissions:
11
+ contents: read
12
+ id-token: write # REQUIRED for OIDC
13
+
10
14
  jobs:
11
- build:
15
+ publish:
12
16
  runs-on: ubuntu-latest
13
- steps:
14
- - uses: actions/checkout@v3
15
- - uses: actions/setup-node@v3
16
- with:
17
- node-version: 16
18
- - run: npm i
19
- # - run: npm test
20
17
 
21
- publish-npm:
22
- needs: build
23
- runs-on: ubuntu-latest
24
18
  steps:
25
- - uses: actions/checkout@v3
26
- - uses: actions/setup-node@v3
19
+ # 1. Checkout the exact commit the release was created from
20
+ - name: Checkout repository
21
+ uses: actions/checkout@v4
22
+
23
+ # 2. Setup Node.js
24
+ # Node 22 = current LTS
25
+ - name: Setup Node.js
26
+ uses: actions/setup-node@v4
27
27
  with:
28
- node-version: 16
28
+ node-version: 22
29
29
  registry-url: https://registry.npmjs.org/
30
- - run: npm i
31
- - run: npm publish
32
- env:
33
- NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
30
+ cache: npm
31
+
32
+ # 3. Install dependencies deterministically
33
+ - name: Install dependencies
34
+ run: npm ci
35
+
36
+ # 4. Verify git tag matches package.json version
37
+ # This prevents publishing the wrong version
38
+ - name: Verify tag matches package.json version
39
+ run: |
40
+ TAG="${{ github.event.release.tag_name }}"
41
+ VERSION=$(node -p "require('./package.json').version")
42
+
43
+ echo "Release tag: $TAG"
44
+ echo "Package version: $VERSION"
45
+
46
+ if [[ "$TAG" != "v$VERSION"* ]]; then
47
+ echo "::error::Release tag does not match package.json version"
48
+ exit 1
49
+ fi
50
+
51
+ # 5. Publish using OIDC (NO TOKEN)
52
+ # --provenance triggers GitHub → npm identity verification
53
+ - name: Publish to npm (OIDC)
54
+ run: |
55
+ TAG="${{ github.event.release.tag_name }}"
56
+
57
+ if [[ "$TAG" == *"dev"* ]]; then
58
+ echo "Publishing dev release"
59
+ npm publish --tag dev --provenance
60
+ else
61
+ echo "Publishing stable release"
62
+ npm publish --provenance
63
+ fi
@@ -99,9 +99,9 @@ export default class MenuTemplateAPI extends Component {
99
99
  }
100
100
 
101
101
 
102
- if (menu && menu.model_id) {
102
+ if (menu && menu?.model_id) {
103
103
 
104
- if (menu.model_id && allModels[menu.model.name]) {
104
+ if (menu?.model_id && allModels[menu?.model?.name]) {
105
105
 
106
106
  this.loadedModel = allModels[menu.model.name]
107
107
 
@@ -6,79 +6,48 @@
6
6
  * Ensure to follow a minimal standard
7
7
  */
8
8
  import React, { useState, useEffect, useRef } from 'react';
9
-
10
9
  import PhoneInput from 'react-phone-input-2';
11
-
12
10
  import 'react-phone-input-2/lib/style.css';
13
-
14
- import PropTypes from "prop-types";
15
-
11
+ import PropTypes from 'prop-types';
16
12
  import './phone-input.scss';
17
13
 
14
+ export default function CountryPhoneInput({ value, onChange, disabled, disableCountryCode, required, defaultCountryCode, onBlur,className }) {
15
+ const inputRef = useRef();
16
+ const hasInitializedRef = useRef(false); // IMPORTANT
18
17
 
19
- export default function CountryPhoneInput({ value, onChange, disabled, disableCountryCode, required, defaultCountryCode, onBlur }) {
20
-
21
- let inputRef = useRef();
22
-
23
- const [phone, setPhone] = useState();
18
+ const [phone, setPhone] = useState('');
24
19
 
20
+ /**
21
+ * run ONLY ONCE when initial value has dial code
22
+ */
25
23
  useEffect(() => {
26
- if (value && value.code && value.code.dialCode !== null) {
27
- // To prepopulate phone number ,concat dialCode and phone number
24
+ if (
25
+ !hasInitializedRef.current &&
26
+ value?.code?.dialCode &&
27
+ value?.value
28
+ ) {
28
29
  setPhone(value.code.dialCode + value.value);
29
-
30
- // In case of update , to identify the country code that is getting selected
31
- // We are setting a timeout
32
- setTimeout(() => {
33
- // Using the reference , we get the internal state of the library component
34
- let selectedCountry = null;
35
-
36
- let selectedCode = null;
37
-
38
- if (
39
- inputRef.current &&
40
- inputRef.current.state &&
41
- inputRef.current.state.selectedCountry
42
- ) {
43
- selectedCountry = inputRef.current.state.selectedCountry;
44
-
45
- // Once we get the selected country ,we format it to the form that is received for normal onChange
46
- selectedCode = {
47
- countryCode: selectedCountry.iso2,
48
- dialCode: selectedCountry.dialCode,
49
- name: selectedCountry.name,
50
- };
51
- }
52
-
53
- // Below being the format expected , we trigger the onChange to manually update the form
54
- let updatedValue = {
55
- value: value.code.dialCode + value.value,
56
- code: selectedCode,
57
- };
58
-
59
- onChange(updatedValue);
60
- }, 0);
30
+ hasInitializedRef.current = true; // 👈 mark as done
61
31
  }
62
- }, []);
32
+ }, [value]);
63
33
 
64
34
  /**
65
- * To get value in parent component
66
- * @param {*} value
35
+ * handle user input
67
36
  */
68
- function handleInput(value, code) {
69
- if (code.dialCode) {
70
- value = value.substring(code.dialCode.length);
71
- }
72
- // To get country code with phone number in parent component
73
- value = {
74
- value,
37
+ function handleInput(inputValue, code) {
38
+ if (!code?.dialCode) return;
39
+
40
+ const phoneNumber = inputValue.slice(code.dialCode.length);
41
+
42
+ // remove autofill class when user edits field (if you use it)
43
+ onChange({
44
+ value: phoneNumber,
75
45
  code,
76
- };
77
- onChange(value);
46
+ });
78
47
  }
79
48
 
80
49
  return (
81
- <div className="phone-input">
50
+ <div className={`phone-input ${className || ''}`}>
82
51
  <PhoneInput
83
52
  ref={inputRef}
84
53
  country={defaultCountryCode || 'in'}
@@ -12,6 +12,20 @@
12
12
  // }
13
13
  }
14
14
 
15
+ .autofilled-field {
16
+ .react-tel-input {
17
+ .form-control {
18
+ border-color: #fa8c16 !important; // AntD warning orange
19
+ background-color: #fff7e6;
20
+ box-shadow: none;
21
+ }
22
+
23
+ .flag-dropdown {
24
+ border-color: #fa8c16 !important;
25
+ background-color: #fff7e6;
26
+ }
27
+ }
28
+ }
15
29
  // /* For tablets and smaller screens (max-width: 1024px) */
16
30
  // @media (max-width: 1024px) {
17
31
  // .phone-input {