From 6816365dcf8fd6b63ce75325c9fa4397b8ab02ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Romain?= Date: Mon, 6 Nov 2023 17:28:56 +0100 Subject: [PATCH 1/3] fix(design-system): binding in forms (#4970) --- .changeset/nervous-plums-drop.md | 5 +++++ .../src/components/Form/Affix/variations/AffixSelect.tsx | 4 ++-- .../src/components/Form/Field/Datalist/Datalist.tsx | 3 +++ .../src/components/Form/Field/Input/Input.Copy.tsx | 2 ++ .../src/components/Form/Field/Input/Input.File.tsx | 9 ++++++++- .../src/components/Form/Field/Input/Input.tsx | 4 ++-- .../src/components/Form/Field/Select/Select.tsx | 2 +- .../src/components/Form/Field/Textarea/Textarea.tsx | 1 + .../src/components/Form/__snapshots__/Form.test.tsx.snap | 2 ++ 9 files changed, 26 insertions(+), 6 deletions(-) create mode 100644 .changeset/nervous-plums-drop.md diff --git a/.changeset/nervous-plums-drop.md b/.changeset/nervous-plums-drop.md new file mode 100644 index 00000000000..f95b283f797 --- /dev/null +++ b/.changeset/nervous-plums-drop.md @@ -0,0 +1,5 @@ +--- +'@talend/design-system': patch +--- + +fix: binding in forms diff --git a/packages/design-system/src/components/Form/Affix/variations/AffixSelect.tsx b/packages/design-system/src/components/Form/Affix/variations/AffixSelect.tsx index 6f1115d2a0e..c33ad507758 100644 --- a/packages/design-system/src/components/Form/Affix/variations/AffixSelect.tsx +++ b/packages/design-system/src/components/Form/Affix/variations/AffixSelect.tsx @@ -15,7 +15,7 @@ const AffixSelect = forwardRef((props: AffixSelectPropsType, ref: Ref, + selectProps: Omit, ) { return ( @@ -25,7 +25,7 @@ const AffixSelect = forwardRef((props: AffixSelectPropsType, ref: Ref - + ); } diff --git a/packages/design-system/src/components/Form/Field/Datalist/Datalist.tsx b/packages/design-system/src/components/Form/Field/Datalist/Datalist.tsx index 1bcaae456b5..4a03dec6ce4 100644 --- a/packages/design-system/src/components/Form/Field/Datalist/Datalist.tsx +++ b/packages/design-system/src/components/Form/Field/Datalist/Datalist.tsx @@ -55,6 +55,9 @@ const Datalist = forwardRef( - + ); }, diff --git a/packages/design-system/src/components/Form/Field/Input/Input.tsx b/packages/design-system/src/components/Form/Field/Input/Input.tsx index 8b6e420fba5..9bb1ce5e756 100644 --- a/packages/design-system/src/components/Form/Field/Input/Input.tsx +++ b/packages/design-system/src/components/Form/Field/Input/Input.tsx @@ -43,11 +43,11 @@ const Field = forwardRef((props: InputFieldProps, ref: Ref) => ); diff --git a/packages/design-system/src/components/Form/Field/Select/Select.tsx b/packages/design-system/src/components/Form/Field/Select/Select.tsx index da881226bf5..22d0101e7e4 100644 --- a/packages/design-system/src/components/Form/Field/Select/Select.tsx +++ b/packages/design-system/src/components/Form/Field/Select/Select.tsx @@ -97,8 +97,8 @@ const Select = forwardRef((props: SelectProps, ref: Ref diff --git a/packages/design-system/src/components/Form/Field/Textarea/Textarea.tsx b/packages/design-system/src/components/Form/Field/Textarea/Textarea.tsx index ebf486ccd30..d7833f54a7d 100644 --- a/packages/design-system/src/components/Form/Field/Textarea/Textarea.tsx +++ b/packages/design-system/src/components/Form/Field/Textarea/Textarea.tsx @@ -44,6 +44,7 @@ const Textarea = forwardRef((props: InputTextareaProps, ref: Ref diff --git a/packages/design-system/src/components/Form/__snapshots__/Form.test.tsx.snap b/packages/design-system/src/components/Form/__snapshots__/Form.test.tsx.snap index 309bb9c8d7e..1887952bb60 100644 --- a/packages/design-system/src/components/Form/__snapshots__/Form.test.tsx.snap +++ b/packages/design-system/src/components/Form/__snapshots__/Form.test.tsx.snap @@ -115,6 +115,7 @@ exports[`Form should render a11y html 1`] = `
Date: Mon, 6 Nov 2023 21:34:57 +0100 Subject: [PATCH 2/3] chore: prepare release (#4971) --- .changeset/nervous-plums-drop.md | 5 ----- packages/design-system/CHANGELOG.md | 6 ++++++ packages/design-system/package.json | 2 +- 3 files changed, 7 insertions(+), 6 deletions(-) delete mode 100644 .changeset/nervous-plums-drop.md diff --git a/.changeset/nervous-plums-drop.md b/.changeset/nervous-plums-drop.md deleted file mode 100644 index f95b283f797..00000000000 --- a/.changeset/nervous-plums-drop.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@talend/design-system': patch ---- - -fix: binding in forms diff --git a/packages/design-system/CHANGELOG.md b/packages/design-system/CHANGELOG.md index 75bf0580d1f..d0c41a618b4 100644 --- a/packages/design-system/CHANGELOG.md +++ b/packages/design-system/CHANGELOG.md @@ -1,5 +1,11 @@ # @talend/design-system +## 8.1.1 + +### Patch Changes + +- 6816365dc: fix: binding in forms + ## 8.1.0 ### Minor Changes diff --git a/packages/design-system/package.json b/packages/design-system/package.json index 2f5c2a99e8f..315c7e2e3f8 100644 --- a/packages/design-system/package.json +++ b/packages/design-system/package.json @@ -1,6 +1,6 @@ { "name": "@talend/design-system", - "version": "8.1.0", + "version": "8.1.1", "description": "Talend Design System", "main": "lib/index.js", "types": "lib/index.d.ts", From 841be39f34ef8e579f8c6e548ee1b3323605f589 Mon Sep 17 00:00:00 2001 From: Inna Ivashchuk Date: Wed, 8 Nov 2023 09:36:21 +0200 Subject: [PATCH 3/3] fix(TDOPS-5386/utils): remove phone validation as not in use (#4972) * fix(TDOPS-5386/utils): remove phone validation as not in use * chore: generate chnageset * fix: remove PHONE import --- .changeset/moody-turtles-study.md | 5 ++ packages/utils/src/validation/methods.test.ts | 55 +++++-------------- packages/utils/src/validation/methods.ts | 9 +-- packages/utils/src/validation/regexp.ts | 7 --- packages/utils/src/validation/testValues.ts | 11 ---- 5 files changed, 20 insertions(+), 67 deletions(-) create mode 100644 .changeset/moody-turtles-study.md diff --git a/.changeset/moody-turtles-study.md b/.changeset/moody-turtles-study.md new file mode 100644 index 00000000000..cff03295e12 --- /dev/null +++ b/.changeset/moody-turtles-study.md @@ -0,0 +1,5 @@ +--- +'@talend/utils': minor +--- + +TDOPS-5386 - remove phone validation as not in use diff --git a/packages/utils/src/validation/methods.test.ts b/packages/utils/src/validation/methods.test.ts index ca28d05b1a3..195f181b07c 100644 --- a/packages/utils/src/validation/methods.test.ts +++ b/packages/utils/src/validation/methods.test.ts @@ -1,67 +1,40 @@ -import { validFirstName, validLastName, validEmail, validPhone } from './methods'; -import { - validNames, - invalidNames, - validEmails, - invalidEmails, - validPhones, - invalidPhones, -} from './testValues'; +import { validFirstName, validLastName, validEmail } from './methods'; +import { validNames, invalidNames, validEmails, invalidEmails } from './testValues'; describe('methods', () => { describe('validFirstName', () => { // Test valid values - test.each(validNames)( - '"%s" should be an acceptable first name', - (value: string) => expect(validFirstName(value)).toBe(true), + test.each(validNames)('"%s" should be an acceptable first name', (value: string) => + expect(validFirstName(value)).toBe(true), ); // Test invalid values - test.each(invalidNames)( - '"%s" should not be an acceptable first name', - (value: string) => expect(validFirstName(value)).toBe(false), + test.each(invalidNames)('"%s" should not be an acceptable first name', (value: string) => + expect(validFirstName(value)).toBe(false), ); }); describe('validLastName', () => { // Test valid values - test.each(validNames)( - '"%s" should be an acceptable last name', - (value: string) => expect(validLastName(value)).toBe(true), + test.each(validNames)('"%s" should be an acceptable last name', (value: string) => + expect(validLastName(value)).toBe(true), ); // Test invalid values - test.each(invalidNames)( - '"%s" should not be an acceptable last name', - (value: string) => expect(validLastName(value)).toBe(false), + test.each(invalidNames)('"%s" should not be an acceptable last name', (value: string) => + expect(validLastName(value)).toBe(false), ); }); describe('validEmail', () => { // Test valid values - test.each(validEmails)( - '"%s" should be an acceptable email', - (value: string) => expect(validEmail(value)).toBe(true), + test.each(validEmails)('"%s" should be an acceptable email', (value: string) => + expect(validEmail(value)).toBe(true), ); // Test invalid values - test.each(invalidEmails)( - '"%s" should not be an acceptable email', - (value: string) => expect(validEmail(value)).toBe(false), - ); - }); - - describe('validPhone', () => { - // Test valid values - test.each(validPhones)( - '"%s" should be an acceptable phone', - (value: string) => expect(validPhone(value)).toBe(true), - ); - - // Test invalid values - test.each(invalidPhones)( - '"%s" should not be an acceptable phone', - (value: string) => expect(validPhone(value)).toBe(false), + test.each(invalidEmails)('"%s" should not be an acceptable email', (value: string) => + expect(validEmail(value)).toBe(false), ); }); }); diff --git a/packages/utils/src/validation/methods.ts b/packages/utils/src/validation/methods.ts index 1e6212ecd6b..7306237da90 100644 --- a/packages/utils/src/validation/methods.ts +++ b/packages/utils/src/validation/methods.ts @@ -1,4 +1,4 @@ -import { NAME, EMAIL, DOMAIN, PHONE } from './regexp'; +import { NAME, EMAIL, DOMAIN } from './regexp'; /** * Build a validation method along a given regular expression @@ -36,10 +36,3 @@ export const validEmail: Function = getValidationMethod(EMAIL); * @returns {boolean} */ export const validDomain: Function = getValidationMethod(DOMAIN); - -/** - * Check that a given value is a valid phone number - * @param {string} value - * @returns {boolean} - */ -export const validPhone: Function = getValidationMethod(PHONE); diff --git a/packages/utils/src/validation/regexp.ts b/packages/utils/src/validation/regexp.ts index a4454c1a495..47b21cfac1b 100644 --- a/packages/utils/src/validation/regexp.ts +++ b/packages/utils/src/validation/regexp.ts @@ -1,13 +1,6 @@ -/* eslint-disable no-useless-escape */ - -export const PHONE = - /^((?:\+[\d().-]*\d[\d().-]*|[0-9A-F*#().-]*[0-9A-F*#][0-9A-F*#().-]*(?:;[a-z\d-]+(?:=(?:[a-z\d\[\]\/:&+$_!~*'().-]|%[\dA-F]{2})+)?)*;phone-context=(?:\+[\d().-]*\d[\d().-]*|(?:[a-z0-9]\.|[a-z0-9][a-z0-9-]*[a-z0-9]\.)*(?:[a-z]|[a-z][a-z0-9-]*[a-z0-9])))(?:;[a-z\d-]+(?:=(?:[a-z\d\[\]\/:&+$_!~*'().-]|%[\dA-F]{2})+)?)*(?:,(?:\+[\d().-]*\d[\d().-]*|[0-9A-F*#().-]*[0-9A-F*#][0-9A-F*#().-]*(?:;[a-z\d-]+(?:=(?:[a-z\d\[\]\/:&+$_!~*'().-]|%[\dA-F]{2})+)?)*;?)*)*)$/; - export const EMAIL = /^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)*[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i; export const NAME = /^[^\~!@#$%^&*()|+=?;:",<>\{\}\[\]\\\/¤€¨£°§]*$/i; export const DOMAIN = /^[^\~!#$%^&*()|+=?;:",<>\{\}\[\]\\\/¤€¨£°§]*$/i; - -/* eslint-enable no-useless-escape */ diff --git a/packages/utils/src/validation/testValues.ts b/packages/utils/src/validation/testValues.ts index 448644a5a69..42bf34fa75a 100644 --- a/packages/utils/src/validation/testValues.ts +++ b/packages/utils/src/validation/testValues.ts @@ -46,14 +46,3 @@ export const validEmails: Array = [ ]; export const invalidEmails: Array = ['john', 'john@', 'john @', 'john\\@re']; - -// Phones -export const validPhones: Array = ['+33102030405']; - -export const invalidPhones: Array = [ - 'john', - 'john@', - 'john @', - 'sarah@something.fr', - 'Fred', -];