Skip to content

Commit

Permalink
Merge pull request #571 from commercelayer/fix/address-fields
Browse files Browse the repository at this point in the history
Address fields
  • Loading branch information
acasazza authored Aug 9, 2024
2 parents 67b2461 + 8939a86 commit f2766ae
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 11 deletions.
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"$schema": "node_modules/lerna/schemas/lerna-schema.json",
"useNx": false,
"npmClient": "pnpm",
"version": "4.15.7",
"version": "4.15.8-beta.1",
"command": {
"version": {
"preid": "beta"
Expand Down
2 changes: 1 addition & 1 deletion packages/react-components/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@commercelayer/react-components",
"version": "4.15.7",
"version": "4.15.8-beta.1",
"description": "The Official Commerce Layer React Components",
"main": "lib/cjs/index.js",
"module": "lib/esm/index.js",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,6 @@ export function AddressStateSelector(props: Props): JSX.Element {
const classNameComputed = !isEmptyStates()
? `${className} ${selectClassName} ${hasError ? errorClassName : ''}`
: `${className} ${inputClassName} ${hasError ? errorClassName : ''}`

return !isEmptyStates() ? (
<BaseSelect
{...p}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,13 @@ export function CheckoutLink(props: Props): JSX.Element {
}
}).then((config) => {
if (config?.links?.checkout) {
location.href = config.links.checkout
window.open(config.links.checkout, '_top')
} else {
location.href = currentHref
window.open(currentHref, '_top')
}
})
} else {
location.href = currentHref
window.open(currentHref, '_top')
}
}
return children ? (
Expand Down
10 changes: 5 additions & 5 deletions packages/react-components/src/components/utils/BaseSelect.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import React, { type ForwardRefRenderFunction } from 'react'
import Parent from './Parent'
import { type BaseSelectComponentProps } from '#typings'
import { findIndex } from 'lodash'

export type BaseSelectProps = BaseSelectComponentProps

Expand All @@ -16,10 +15,11 @@ const BaseSelect: ForwardRefRenderFunction<any, BaseSelectProps> = (
value = '',
...p
} = props
if (findIndex(options, placeholder) === -1) {
options.unshift(placeholder)
} else {
options[0] = placeholder
if (placeholder != null) {
const isPlaceholderInOptions = options.some((option) => option.value === placeholder.value)
if (!isPlaceholderInOptions) {
options.unshift(placeholder)
}
}
const Options = options.map((o, k) => {
const { label, ...option } = o
Expand Down

0 comments on commit f2766ae

Please sign in to comment.