react-timezone-select
Advanced tools
Comparing version 1.5.6 to 2.0.0
import { Props as Props$1 } from 'react-select'; | ||
declare type ICustomTimezone = { | ||
[key: string]: string | ||
} | ||
declare type ILabelStyle = 'original' | 'altName' | 'abbrev' | ||
[key: string]: string; | ||
}; | ||
declare type ILabelStyle = 'original' | 'altName' | 'abbrev'; | ||
interface ITimezoneOption { | ||
value: string | ||
label: string | ||
offset: number | ||
abbrev?: string | ||
altName?: string | ||
value: string; | ||
label: string; | ||
abbrev?: string; | ||
altName?: string; | ||
offset?: number; | ||
} | ||
declare type ITimezone = ITimezoneOption | string | ||
interface Props | ||
extends Omit<Props$1<ITimezone, false>, 'onChange'> { | ||
value: ITimezone | ||
labelStyle?: ILabelStyle | ||
onChange?: (timezone: ITimezoneOption) => void | ||
timezones?: ICustomTimezone | ||
maxAbbrLength?: number | ||
declare type ITimezone = ITimezoneOption | string; | ||
interface Props extends Omit<Props$1<ITimezone, false>, 'onChange'> { | ||
value: ITimezone; | ||
labelStyle?: ILabelStyle; | ||
onChange?: (timezone: ITimezoneOption) => void; | ||
timezones?: ICustomTimezone; | ||
maxAbbrLength?: number; | ||
} | ||
@@ -26,12 +25,4 @@ | ||
declare const TimezoneSelect: ({ | ||
value, | ||
onBlur, | ||
onChange, | ||
labelStyle, | ||
timezones, | ||
maxAbbrLength, | ||
...props | ||
}: Props) => JSX.Element | ||
declare const TimezoneSelect: ({ value, onBlur, onChange, labelStyle, timezones, maxAbbrLength, ...props }: Props) => JSX.Element; | ||
export { ILabelStyle, ITimezone, ITimezoneOption, Props, allTimezones, TimezoneSelect as default }; |
@@ -97,10 +97,8 @@ // src/index.tsx | ||
labelStyle = "original", | ||
timezones, | ||
timezones = timezone_list_default, | ||
maxAbbrLength = 4, | ||
...props | ||
}) => { | ||
if (!timezones) | ||
timezones = timezone_list_default; | ||
const getOptions = React.useMemo(() => { | ||
return Object.entries(timezones).reduce((selectOptions, zone) => { | ||
const getOptions = React.useMemo( | ||
() => Object.entries(timezones).reduce((selectOptions, zone) => { | ||
try { | ||
@@ -140,4 +138,5 @@ const now = spacetime.now(zone[0]); | ||
} | ||
}, []).sort((a, b) => a.offset - b.offset); | ||
}, [labelStyle, timezones]); | ||
}, []).sort((a, b) => a.offset - b.offset), | ||
[labelStyle, timezones] | ||
); | ||
const handleChange = (tz) => { | ||
@@ -198,6 +197,5 @@ onChange && onChange(tz); | ||
}; | ||
var src_default = TimezoneSelect; | ||
export { | ||
timezone_list_default as allTimezones, | ||
src_default as default | ||
TimezoneSelect as default | ||
}; |
{ | ||
"name": "react-timezone-select", | ||
"version": "1.5.6", | ||
"version": "2.0.0", | ||
"description": "Usable, dynamic React Timezone Select", | ||
@@ -51,6 +51,6 @@ "scripts": { | ||
"react": "^18 || ^17.0.1 || ^16", | ||
"react-dom": "^18 || ^17.0.1 || ^16" | ||
"react-dom": "^18 || ^17.0.1 || ^16", | ||
"react-select": "^5.7.0" | ||
}, | ||
"dependencies": { | ||
"react-select": "^5.7.0", | ||
"spacetime": "^7.4.1", | ||
@@ -57,0 +57,0 @@ "timezone-soft": "^1.4.1" |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
26155
448
- Removedreact-select@^5.7.0