Browse Source

Remove default value for country code

Make user specify country code for PhoneNumberInput.
master
TheoryOfNekomata 1 year ago
parent
commit
2e05524119
4 changed files with 8 additions and 4 deletions
  1. +1
    -1
      TODO.md
  2. +2
    -3
      categories/formatted/react/src/components/PhoneNumberInput/index.tsx
  3. +4
    -0
      showcases/web-kitchensink-reactnext/src/pages/categories/formatted/index.tsx
  4. +1
    -0
      showcases/web-kitchensink-reactnext/src/pages/examples/registration-form/index.tsx

+ 1
- 1
TODO.md View File

@@ -3,7 +3,7 @@
- Action - Action
- [X] ActionButton - [X] ActionButton
- Blob (choose to extract each preview component to their own library?) - Blob (choose to extract each preview component to their own library?)
- [-] FileSelectBox
- [X] FileSelectBox
- Choice - Choice
- [X] ComboBox - [X] ComboBox
- [X] DropdownSelect - [X] DropdownSelect


+ 2
- 3
categories/formatted/react/src/components/PhoneNumberInput/index.tsx View File

@@ -48,7 +48,7 @@ export interface PhoneNumberInputProps extends Omit<React.HTMLProps<PhoneNumberI
/** /**
* Country where the phone number should be formatted for. * Country where the phone number should be formatted for.
*/ */
country?: Country,
country: Country,
/** /**
* Visual length of the input. * Visual length of the input.
*/ */
@@ -74,7 +74,7 @@ export const PhoneNumberInput = React.forwardRef<
id: idProp, id: idProp,
style, style,
enhanced = false as const, enhanced = false as const,
country = 'PH' as const,
country,
value, value,
onChange, onChange,
name, name,
@@ -247,6 +247,5 @@ PhoneNumberInput.defaultProps = {
variant: 'default' as const, variant: 'default' as const,
hiddenLabel: false as const, hiddenLabel: false as const,
enhanced: false as const, enhanced: false as const,
country: 'PH' as const,
length: undefined, length: undefined,
}; };

+ 4
- 0
showcases/web-kitchensink-reactnext/src/pages/categories/formatted/index.tsx View File

@@ -12,6 +12,7 @@ const TemporalPage: NextPage = () => {
<Section title="PhoneNumberInput"> <Section title="PhoneNumberInput">
<Subsection title="Default"> <Subsection title="Default">
<Formatted.PhoneNumberInput <Formatted.PhoneNumberInput
country="PH"
label="Phone" label="Phone"
name="phone" name="phone"
enhanced enhanced
@@ -23,6 +24,7 @@ const TemporalPage: NextPage = () => {
</Subsection> </Subsection>
<Subsection title="Non-enhanced"> <Subsection title="Non-enhanced">
<Formatted.PhoneNumberInput <Formatted.PhoneNumberInput
country="PH"
label="Phone" label="Phone"
name="phone" name="phone"
border border
@@ -33,6 +35,7 @@ const TemporalPage: NextPage = () => {
</Subsection> </Subsection>
<Subsection title="With Default Value"> <Subsection title="With Default Value">
<Formatted.PhoneNumberInput <Formatted.PhoneNumberInput
country="PH"
label="Phone" label="Phone"
name="phone2" name="phone2"
enhanced enhanced
@@ -44,6 +47,7 @@ const TemporalPage: NextPage = () => {
<div className="flex gap-4 flex-wrap"> <div className="flex gap-4 flex-wrap">
<div> <div>
<Formatted.PhoneNumberInput <Formatted.PhoneNumberInput
country="PH"
label="Phone" label="Phone"
name="phone3" name="phone3"
enhanced enhanced


+ 1
- 0
showcases/web-kitchensink-reactnext/src/pages/examples/registration-form/index.tsx View File

@@ -87,6 +87,7 @@ const RegistrationFormPage: NextPage = () => {
</div> </div>
<div className="sm:col-span-2"> <div className="sm:col-span-2">
<Formatted.PhoneNumberInput <Formatted.PhoneNumberInput
country="PH"
block block
border border
label="Phone" label="Phone"


Loading…
Cancel
Save