Skip to content

Commit

Permalink
Merge pull request #88 from trinhthinh388/master
Browse files Browse the repository at this point in the history
Release package
  • Loading branch information
trinhthinh388 authored Mar 6, 2024
2 parents 1058df3 + 676a596 commit 36fb176
Show file tree
Hide file tree
Showing 9 changed files with 331 additions and 115 deletions.
2 changes: 1 addition & 1 deletion apps/docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"clean": "rimraf .turbo && rimraf node_modules && rimraf .next"
},
"dependencies": {
"@react-awesome/components": "1.0.15",
"@react-awesome/components": "1.0.16",
"classnames": "^2.5.1",
"lodash": "^4.17.21",
"lucide-react": "^0.315.0",
Expand Down
4 changes: 4 additions & 0 deletions apps/docs/src/pages/about.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ One package to solve every problem.
- https://www.npmjs.com/package/libphonenumber-js
- https://www.npmjs.com/package/@uidotdev/usehooks

All test data has been generated by:

- https://dotrand.com

## License

The **React Awesome Components** project are licensed under the MIT license.
7 changes: 7 additions & 0 deletions packages/components/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# @react-awesome/components

## 1.0.16

### Patch Changes

- Updated dependencies
- @react-awesome/phone-input@1.1.4

## 1.0.15

### Patch Changes
Expand Down
4 changes: 2 additions & 2 deletions packages/components/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@react-awesome/components",
"version": "1.0.15",
"version": "1.0.16",
"main": "./dist/index.cjs",
"module": "./dist/index.js",
"types": "./dist/index.d.ts",
Expand Down Expand Up @@ -39,7 +39,7 @@
"access": "public"
},
"dependencies": {
"@react-awesome/phone-input": "1.1.3",
"@react-awesome/phone-input": "1.1.4",
"@react-awesome/use-click-outside": "0.0.3",
"@react-awesome/use-preserve-input-caret-position": "0.0.3",
"@react-awesome/use-selection-range": "0.0.3",
Expand Down
6 changes: 6 additions & 0 deletions packages/phone-input/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# @react-awesome/phone-input

## 1.1.4

### Patch Changes

- usePhoneInput doesn't switch country on paste when in national mode

## 1.1.3

### Patch Changes
Expand Down
3 changes: 2 additions & 1 deletion packages/phone-input/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@react-awesome/phone-input",
"version": "1.1.3",
"version": "1.1.4",
"main": "./dist/index.cjs",
"module": "./dist/index.js",
"types": "./dist/index.d.ts",
Expand All @@ -25,6 +25,7 @@
"lint": "eslint \"src/**/*.ts*\"",
"clean": "rimraf .turbo && rimraf node_modules && rimraf dist",
"test": "vitest --config ../../vite.config.ts --coverage --run",
"test:watch": "vitest --config ../../vite.config.ts --coverage",
"test:ui": "vitest --config ../../vite.config.ts --coverage --ui",
"typecheck": "tsc --noEmit"
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
import { formatWithFixedCountry } from './formatWithFixedCountry'

describe('formatWithFixedCountry', () => {
it('Should return empty string when phone value is invalid', () => {
expect(formatWithFixedCountry('', 'US')).toBe('')
})

it('Should leave as-is when the value is already has valid country code.', () => {
expect(formatWithFixedCountry('+123456', 'US')).toBe('+123456')
})

it('Should format to the correct country code.', () => {
expect(formatWithFixedCountry('+123456', 'VN')).toBe('+84123456')
expect(formatWithFixedCountry('0123456', 'VN')).toBe('+84123456')
expect(formatWithFixedCountry('123456', 'VN')).toBe('+84123456')
})
})
Loading

0 comments on commit 36fb176

Please sign in to comment.