-
Notifications
You must be signed in to change notification settings - Fork 4.6k
chore: Allow currency and phone dial code change #38141
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 6 commits
f2e506a
8274bc3
a6637a9
275b6af
4ccdbf4
1644d08
50cd6dc
1987d37
61c8e4c
a3db386
4141ec7
349a3f2
f4cf381
36030b3
a01c037
e4a075e
d5300a0
508d3f8
b8bb738
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| div.comboboxInputGroup { | ||
| padding-inline: 0; | ||
| } | ||
|
|
||
| input.comboboxInput { | ||
| padding-inline: var(--inner-spacing-2); | ||
| } | ||
|
|
||
| .comboboxTriggerButton { | ||
| margin-inline-end: var(--inner-spacing-2); | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,12 +6,8 @@ | |
| width: 100%; | ||
| } | ||
|
|
||
| .input { | ||
| position: relative; | ||
| display: flex; | ||
| flex: 1; | ||
| align-items: center; | ||
| box-sizing: content-box; | ||
| .inputGroup { | ||
| background-color: var(--color-bg); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove redundant The .inputGroup {
/* ... */
- background-color: var(--color-bg);
/* ... */
background-color: var(--color-bg-neutral-subtle);
+ /* Removed duplicate background-color */
/* ... */
}Also applies to: 17-17 |
||
| max-inline-size: 100%; | ||
| padding-block: var(--inner-spacing-1); | ||
| padding-inline: var(--inner-spacing-2); | ||
|
|
@@ -25,8 +21,12 @@ | |
| overflow: hidden; | ||
| } | ||
|
|
||
| .input:has(> [data-select-text]) { | ||
| block-size: var(--body-line-height); | ||
| .input { | ||
| border: none; | ||
| outline: none; | ||
| background-color: transparent; | ||
| flex: 1; | ||
| padding: 0; | ||
| } | ||
|
|
||
| .input:is(textarea) { | ||
|
|
@@ -57,59 +57,27 @@ | |
| ); | ||
| } | ||
|
|
||
| .inputGroup:has(> [data-input-prefix]) .input { | ||
| padding-left: var(--sizing-8); | ||
| } | ||
|
|
||
| .inputGroup:has(> [data-input-prefix]) .input[data-size="large"] { | ||
| padding-left: var(--sizing-12); | ||
| } | ||
|
|
||
| .inputGroup:has(> [data-input-prefix]) .input[data-size="small"] { | ||
| padding-left: var(--sizing-6); | ||
| } | ||
|
|
||
| .inputGroup:has(> [data-input-prefix]) [data-input-prefix] { | ||
| left: var(--inner-spacing-1); | ||
| position: absolute; | ||
| } | ||
|
|
||
| .inputGroup:has(> [data-input-suffix]) .input { | ||
| padding-right: var(--sizing-8); | ||
| } | ||
|
|
||
| .inputGroup:has(> [data-input-suffix]) .input[data-size="large"] { | ||
| padding-right: var(--sizing-12); | ||
| } | ||
|
|
||
| .inputGroup:has(> [data-input-suffix]) .input[data-size="small"] { | ||
| padding-right: var(--sizing-6); | ||
| } | ||
|
|
||
| .inputGroup:has(> [data-input-suffix]) [data-input-suffix] { | ||
| right: var(--inner-spacing-1); | ||
| position: absolute; | ||
| } | ||
|
|
||
| .inputGroup :is([data-input-suffix], [data-input-prefix]) { | ||
| display: flex; | ||
| justify-content: center; | ||
| align-items: center; | ||
| height: 0; | ||
|
jsartisan marked this conversation as resolved.
|
||
| } | ||
|
|
||
| /** | ||
| * ---------------------------------------------------------------------------- | ||
| * HOVERED | ||
| * ---------------------------------------------------------------------------- | ||
| */ | ||
| .inputGroup[data-hovered] | ||
| .input:not( | ||
| :is( | ||
| [data-focused], | ||
| [data-readonly], | ||
| [data-disabled], | ||
| [data-focus-within], | ||
| :has(~ input[data-disabled="true"]) | ||
| .inputGroup[data-hovered]:has( | ||
|
KelvinOm marked this conversation as resolved.
|
||
| > .input:not( | ||
| :is( | ||
| [data-focused], | ||
| [data-readonly], | ||
| [data-disabled], | ||
| [data-focus-within], | ||
| :has(~ input[data-disabled="true"]) | ||
| ) | ||
| ) | ||
| ) { | ||
| background-color: var(--color-bg-neutral-subtle-hover); | ||
|
|
@@ -157,8 +125,8 @@ | |
| * DISABLED | ||
| * ---------------------------------------------------------------------------- | ||
| */ | ||
| .input[data-disabled], | ||
| .input:has(~ input[data-disabled]) { | ||
| .inputGroup:has(> .input[data-disabled]), | ||
| .inputGroup:has(> .input:has(~ input[data-disabled])) { | ||
| cursor: not-allowed; | ||
| box-shadow: none; | ||
| } | ||
|
|
@@ -168,13 +136,14 @@ | |
| * INVALID | ||
| * ---------------------------------------------------------------------------- | ||
| */ | ||
| .input[data-invalid] { | ||
| .inputGroup:has(> .input[data-invalid]) { | ||
| box-shadow: 0 0 0 1px var(--color-bd-negative); | ||
| } | ||
|
|
||
| .inputGroup[data-hovered] | ||
| .input[data-invalid]:not( | ||
| :is([data-focused], [data-readonly], [data-disabled]) | ||
| .inputGroup[data-hovered]:has( | ||
| > .input[data-invalid]:not( | ||
| :is([data-focused], [data-readonly], [data-disabled]) | ||
| ) | ||
| ) { | ||
| box-shadow: 0 0 0 1px var(--color-bd-negative-hover); | ||
| } | ||
|
|
@@ -184,7 +153,9 @@ | |
| * FOCUSSED | ||
| * ---------------------------------------------------------------------------- | ||
| */ | ||
| .input:is([data-focused], [data-focus-within]):not([data-readonly]) { | ||
| .inputGroup:has( | ||
| > .input:is([data-focused], [data-focus-within]):not([data-readonly]) | ||
| ) { | ||
| background-color: transparent; | ||
| box-shadow: 0 0 0 2px var(--color-bd-focus); | ||
| } | ||
|
|
@@ -194,31 +165,17 @@ | |
| * SIZE | ||
| * ---------------------------------------------------------------------------- | ||
| */ | ||
| .input[data-size="small"] { | ||
| .inputGroup:has(> .input[data-size="small"]) { | ||
| block-size: calc( | ||
| var(--body-line-height) + var(--body-margin-start) + var(--body-margin-end) | ||
| ); | ||
| padding-block: var(--inner-spacing-2); | ||
| } | ||
|
|
||
| .input[data-size="large"] { | ||
| .inputGroup:has(> .input[data-size="large"]) { | ||
| block-size: calc( | ||
| var(--body-line-height) + var(--body-margin-start) + var(--body-margin-end) | ||
| ); | ||
| padding-block: var(--inner-spacing-3); | ||
| padding-inline: var(--inner-spacing-3); | ||
| } | ||
|
|
||
| /** | ||
| * ---------------------------------------------------------------------------- | ||
|
KelvinOm marked this conversation as resolved.
|
||
| * SELECT BUTTON's TEXT | ||
| * ---------------------------------------------------------------------------- | ||
| */ | ||
| .input [data-select-text] { | ||
| display: flex; | ||
| align-items: center; | ||
| } | ||
|
|
||
| .input [data-select-text] [data-icon] { | ||
| margin-inline-end: var(--inner-spacing-1); | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,12 +2,13 @@ import React, { createContext, useContext } from "react"; | |
| import { listStyles, Popover } from "@appsmith/wds"; | ||
| import { Menu as HeadlessMenu } from "react-aria-components"; | ||
|
|
||
| import styles from "./styles.module.css"; | ||
| import type { MenuProps } from "./types"; | ||
|
|
||
| const MenuNestingContext = createContext(0); | ||
|
|
||
| export const Menu = (props: MenuProps) => { | ||
| const { children } = props; | ||
| const { children, maxHeight } = props; | ||
| const root = document.body.querySelector( | ||
| "[data-theme-provider]", | ||
| ) as HTMLButtonElement; | ||
|
|
@@ -18,7 +19,11 @@ export const Menu = (props: MenuProps) => { | |
| return ( | ||
| <MenuNestingContext.Provider value={nestingLevel + 1}> | ||
| {/* Only the parent Popover should be placed in the root. Placing child popoves in root would cause the menu to function incorrectly */} | ||
| <Popover UNSTABLE_portalContainer={isRootMenu ? root : undefined}> | ||
| <Popover | ||
| UNSTABLE_portalContainer={isRootMenu ? root : undefined} | ||
| className={styles.menuPopover} | ||
| maxHeight={maxHeight} | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why is this implemented only for
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added POPOVER_LIST_BOX_MAX_HEIGHT and used it in menu, select and combobox. |
||
| > | ||
| <HeadlessMenu className={listStyles.listBox} {...props}> | ||
| {children} | ||
| </HeadlessMenu> | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,3 +10,7 @@ | |
| ); | ||
| } | ||
| } | ||
|
|
||
| .menuPopover { | ||
| overflow-y: auto; | ||
| } | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Review nested scrolling behavior Both Consider consolidating the overflow behavior in one container: .menuPopover {
- overflow-y: auto;
+ /* Add other necessary styles without overflow */
}
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,5 @@ | ||
| import type { MenuProps as AriaMenuProps } from "react-aria-components"; | ||
|
|
||
| export interface MenuProps | ||
| extends Omit< | ||
| AriaMenuProps<object>, | ||
| "slot" | "selectionMode" | "selectedKeys" | ||
| > {} | ||
| export interface MenuProps extends Omit<AriaMenuProps<object>, "slot"> { | ||
| maxHeight?: number; | ||
| } |
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,8 +1,10 @@ | ||||||||||||||
| import clsx from "clsx"; | ||||||||||||||
| import React from "react"; | ||||||||||||||
| import { Icon, Spinner, textInputStyles } from "@appsmith/wds"; | ||||||||||||||
| import { getTypographyClassName } from "@appsmith/wds-theming"; | ||||||||||||||
| import { Button, Group, SelectValue } from "react-aria-components"; | ||||||||||||||
|
|
||||||||||||||
| import styles from "./styles.module.css"; | ||||||||||||||
| import type { SelectProps } from "./types"; | ||||||||||||||
|
|
||||||||||||||
| interface SelectTriggerProps { | ||||||||||||||
|
|
@@ -17,9 +19,11 @@ export const SelectTrigger: React.FC<SelectTriggerProps> = (props) => { | |||||||||||||
| const { isDisabled, isInvalid, isLoading, placeholder, size } = props; | ||||||||||||||
|
|
||||||||||||||
| return ( | ||||||||||||||
| <Group className={textInputStyles.inputGroup}> | ||||||||||||||
| <Group | ||||||||||||||
| className={clsx(textInputStyles.inputGroup, styles.selectInputGroup)} | ||||||||||||||
| > | ||||||||||||||
| <Button | ||||||||||||||
| className={textInputStyles.input} | ||||||||||||||
| className={clsx(textInputStyles.input, styles.selectTriggerButton)} | ||||||||||||||
| data-invalid={Boolean(isInvalid) ? "" : undefined} | ||||||||||||||
| data-size={size} | ||||||||||||||
| isDisabled={isDisabled} | ||||||||||||||
|
|
@@ -32,10 +36,14 @@ export const SelectTrigger: React.FC<SelectTriggerProps> = (props) => { | |||||||||||||
| isPlaceholder ? placeholder : defaultChildren | ||||||||||||||
| } | ||||||||||||||
| </SelectValue> | ||||||||||||||
| <span data-input-suffix> | ||||||||||||||
| {Boolean(isLoading) ? ( | ||||||||||||||
| <Spinner /> | ||||||||||||||
| ) : ( | ||||||||||||||
| <Icon name="chevron-down" size="medium" /> | ||||||||||||||
| )} | ||||||||||||||
| </span> | ||||||||||||||
|
Comment on lines
+37
to
+45
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Remove redundant Boolean conversion The Boolean conversion is unnecessary as the condition will already be coerced to a boolean in the ternary operation. <span data-input-suffix>
- {Boolean(isLoading) ? <Spinner /> : <Icon name="chevron-down" />}
+ {isLoading ? <Spinner /> : <Icon name="chevron-down" />}
</span>📝 Committable suggestion
Suggested change
🧰 Tools🪛 Biome (1.9.4)[error] 38-38: Avoid redundant It is not necessary to use (lint/complexity/noExtraBooleanCast) |
||||||||||||||
| </Button> | ||||||||||||||
| <span data-input-suffix> | ||||||||||||||
| {Boolean(isLoading) ? <Spinner /> : <Icon name="chevron-down" />} | ||||||||||||||
| </span> | ||||||||||||||
| </Group> | ||||||||||||||
| ); | ||||||||||||||
| }; | ||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All these styles are needed so that the popover takes full width.