@transferwise/components 45.19.5 → 45.20.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/index.esm.js +38 -32
- package/build/index.esm.js.map +1 -1
- package/build/index.js +38 -32
- package/build/index.js.map +1 -1
- package/build/main.css +1 -1
- package/build/styles/inputs/SelectInput.css +1 -1
- package/build/styles/main.css +1 -1
- package/build/types/inputs/SelectInput.d.ts +6 -3
- package/build/types/inputs/SelectInput.d.ts.map +1 -1
- package/build/types/inputs/_BottomSheet.d.ts.map +1 -1
- package/build/types/inputs/_Popover.d.ts +2 -2
- package/build/types/inputs/_Popover.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/inputs/SelectInput.css +1 -1
- package/src/inputs/SelectInput.less +17 -7
- package/src/inputs/SelectInput.tsx +36 -11
- package/src/inputs/_BottomSheet.tsx +18 -20
- package/src/inputs/_Popover.tsx +3 -5
- package/src/main.css +1 -1
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
+
import { Merge } from '../utils';
|
|
2
3
|
export interface SelectInputOptionItem<T = string> {
|
|
3
4
|
type: 'option';
|
|
4
5
|
value: T;
|
|
@@ -39,10 +40,11 @@ export interface SelectInputProps<T = string> {
|
|
|
39
40
|
onClear?: () => void;
|
|
40
41
|
}
|
|
41
42
|
export declare function SelectInput<T = string>({ name, placeholder, items, defaultValue, value: controlledValue, compareValues, renderValue, renderTrigger, filterable, filterPlaceholder, disabled, size, className, onChange, onClear, }: SelectInputProps<T>): import("react").JSX.Element;
|
|
42
|
-
|
|
43
|
+
type SelectInputTriggerButtonElementType = 'button' | React.ComponentType;
|
|
44
|
+
export type SelectInputTriggerButtonProps<T extends SelectInputTriggerButtonElementType = 'button'> = Merge<React.ComponentPropsWithoutRef<T>, {
|
|
43
45
|
as?: T;
|
|
44
|
-
}
|
|
45
|
-
export declare function SelectInputTriggerButton<T extends
|
|
46
|
+
}>;
|
|
47
|
+
export declare function SelectInputTriggerButton<T extends SelectInputTriggerButtonElementType = 'button'>({ as, ...restProps }: SelectInputTriggerButtonProps<T>): import("react").JSX.Element;
|
|
46
48
|
export interface SelectInputOptionContentProps {
|
|
47
49
|
title: string;
|
|
48
50
|
note?: string;
|
|
@@ -50,4 +52,5 @@ export interface SelectInputOptionContentProps {
|
|
|
50
52
|
icon?: React.ReactNode;
|
|
51
53
|
}
|
|
52
54
|
export declare function SelectInputOptionContent({ title, note, description, icon, }: SelectInputOptionContentProps): import("react").JSX.Element;
|
|
55
|
+
export {};
|
|
53
56
|
//# sourceMappingURL=SelectInput.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectInput.d.ts","sourceRoot":"","sources":["../../../src/inputs/SelectInput.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"SelectInput.d.ts","sourceRoot":"","sources":["../../../src/inputs/SelectInput.tsx"],"names":[],"mappings":";AAeA,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AA4CjC,MAAM,WAAW,qBAAqB,CAAC,CAAC,GAAG,MAAM;IAC/C,IAAI,EAAE,QAAQ,CAAC;IACf,KAAK,EAAE,CAAC,CAAC;IACT,cAAc,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACnC,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,WAAW,oBAAoB,CAAC,CAAC,GAAG,MAAM;IAC9C,IAAI,EAAE,OAAO,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,SAAS,qBAAqB,CAAC,CAAC,CAAC,EAAE,CAAC;CAC9C;AAED,MAAM,WAAW,wBAAwB;IACvC,IAAI,EAAE,WAAW,CAAC;CACnB;AAED,MAAM,MAAM,eAAe,CAAC,CAAC,GAAG,MAAM,IAClC,qBAAqB,CAAC,CAAC,CAAC,GACxB,oBAAoB,CAAC,CAAC,CAAC,GACvB,wBAAwB,CAAC;AAuC7B,MAAM,W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AAC;CACtB;AAED,wBAAgB,WAAW,CAAC,EAC1B,IAAI,EACJ,aAAa,EACb,KAAK,EACL,eAAe,EACf,OAAc,EACd,QAAQ,EACR,OAAO,GACR,EAAE,gBAAgB,+BAmGlB"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { type
|
|
2
|
+
import { type Placement } from '@floating-ui/react';
|
|
3
3
|
export interface PopoverProps {
|
|
4
|
-
placement?:
|
|
4
|
+
placement?: Placement;
|
|
5
5
|
open: boolean;
|
|
6
6
|
renderTrigger: (args: {
|
|
7
7
|
ref: React.RefCallback<Element>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"_Popover.d.ts","sourceRoot":"","sources":["../../../src/inputs/_Popover.tsx"],"names":[],"mappings":";AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"_Popover.d.ts","sourceRoot":"","sources":["../../../src/inputs/_Popover.tsx"],"names":[],"mappings":";AAAA,OAAO,EAML,KAAK,SAAS,EAOf,MAAM,oBAAoB,CAAC;AAS5B,MAAM,WAAW,YAAY;IAC3B,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,IAAI,EAAE,OAAO,CAAC;IACd,aAAa,EAAE,CAAC,IAAI,EAAE;QACpB,GAAG,EAAE,KAAK,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;QAChC,mBAAmB,EAAE,CAAC,mBAAmB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,OAAO,CAAC,KAAK;YACvE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;SACxB,CAAC;KACH,KAAK,KAAK,CAAC,SAAS,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB;AAID,wBAAgB,OAAO,CAAC,EACtB,SAAS,EACT,IAAI,EACJ,aAAa,EACb,KAAK,EACL,OAAc,EACd,QAAQ,EACR,OAAO,GACR,EAAE,YAAY,+BA8Ed"}
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.np-bottom-sheet-v2-container{position:relative;z-index:1060}.np-bottom-sheet-v2-backdrop-container--enter,.np-bottom-sheet-v2-backdrop-container--leave{transition-duration:.15s;transition-property:opacity;transition-timing-function:ease-out}.np-bottom-sheet-v2-backdrop-container--enter-from,.np-bottom-sheet-v2-backdrop-container--leave-to{opacity:0}.np-bottom-sheet-v2-backdrop{background-color:#37517e;background-color:var(--color-content-primary);inset:0;opacity:.4;position:fixed}.np-bottom-sheet-v2{display:flex;flex-direction:column;inset:0;justify-content:flex-end;padding-left:8px;padding-left:var(--size-8);padding-right:8px;padding-right:var(--size-8);padding-top:64px;padding-top:var(--size-64);position:fixed}.np-bottom-sheet-v2-content{max-height:100%}.np-bottom-sheet-v2-content--enter,.np-bottom-sheet-v2-content--leave{transition-duration:.3s;transition-property:transform;transition-timing-function:ease-out}@media (prefers-reduced-motion:reduce){.np-bottom-sheet-v2-content--enter,.np-bottom-sheet-v2-content--leave{transition-property:opacity}}@media (prefers-reduced-motion:no-preference){.np-bottom-sheet-v2-content--enter-from,.np-bottom-sheet-v2-content--leave-to{transform:translateY(100%)}}@media (prefers-reduced-motion:reduce){.np-bottom-sheet-v2-content--enter-from,.np-bottom-sheet-v2-content--leave-to{opacity:0}}.np-bottom-sheet-v2-content-inner-container{background-color:#fff;background-color:var(--color-background-elevated);border-top-left-radius:32px;border-top-right-radius:32px;box-shadow:0 0 40px rgba(69,71,69,.2);display:flex;flex-direction:column;height:100%}.np-bottom-sheet-v2-content-inner-container:focus{outline:none}.np-bottom-sheet-v2-header{align-self:flex-end;padding:16px;padding:var(--size-16)}.np-bottom-sheet-v2-content-inner{display:grid;grid-template-rows:repeat(1,minmax(0,1fr));overflow-y:auto;padding-top:0;row-gap:8px;row-gap:var(--size-8)}.np-bottom-sheet-v2-content-inner--has-title{grid-template-rows:auto 1fr}.np-bottom-sheet-v2-content-inner--padding-md{padding:16px;padding:var(--size-16)}.np-bottom-sheet-v2-title{color:#37517e;color:var(--color-content-primary)}.np-bottom-sheet-v2-body{color:#5d7079;color:var(--color-content-secondary)}.np-button-input{align-content:center;border-radius:10px;border-radius:var(--size-10);display:inline-grid;grid-auto-columns:minmax(0,1fr);text-align:start}.np-popover-v2-container{background-color:#fff;background-color:var(--color-background-elevated);border-radius:10px;border-radius:var(--radius-small);box-shadow:0 0 40px rgba(69,71,69,.2);display:flex;flex-direction:column;max-height:var(--max-height);min-width:20rem;width:var(--width);z-index:1060}.np-popover-v2-container:focus{outline:none}.np-popover-v2{display:grid;grid-template-rows:repeat(1,minmax(0,1fr));overflow-y:auto;row-gap:8px;row-gap:var(--size-8)}.np-popover-v2--has-title{grid-template-rows:auto 1fr}.np-popover-v2--padding-md{padding:16px;padding:var(--size-16)}.np-popover-v2-title{color:#37517e;color:var(--color-content-primary)}.np-popover-v2-content{color:#5d7079;color:var(--color-content-secondary)}.np-select-input-placeholder{color:#768e9c;color:var(--color-content-tertiary);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.np-select-input-options-container{display:flex;flex-direction:column;height:100%}.np-select-input-options-container:focus{outline:none}@media (min-width:576px){.np-select-input-options-container{max-height:28rem}}.np-select-input-query-container{display:flex;flex-direction:column;padding:8px;padding:var(--size-8);padding-top:0}@media (min-width:576px){.np-select-input-query-container{padding-top:8px;padding-top:var(--size-8)}}.np-select-input-listbox-container{height:var(--initial-height);overflow-y:auto;position:relative;scroll-padding-bottom:8px;scroll-padding-bottom:var(--size-8);scroll-padding-top:8px;scroll-padding-top:var(--size-8)}@media (min-width:576px){.np-select-input-listbox-container{height:auto}}.np-select-input-listbox-container--has-group{scroll-padding-top:32px;scroll-padding-top:var(--size-32)}.np-select-input-listbox{padding:8px;padding:var(--size-8)}.np-select-input-listbox:focus{outline:none}.np-select-input-separator-item{border-top-width:1px;margin:8px;margin:var(--size-8)}.np-select-input-group-item--without-needle:first-child{margin-top:-8px;margin-top:calc(var(--size-8)*-1)}.np-select-input-group-item-header{background-color:#fff;background-color:var(--color-background-elevated);color:#5d7079;color:var(--color-content-secondary);padding:8px 16px 4px;padding:var(--size-8) var(--size-16) var(--size-4);position:sticky;top:0;z-index:10}.np-select-input-option-container{align-items:center;border-radius:10px;border-radius:var(--radius-small);color
|
|
1
|
+
.np-bottom-sheet-v2-container{position:relative;z-index:1060}.np-bottom-sheet-v2-backdrop-container--enter,.np-bottom-sheet-v2-backdrop-container--leave{transition-duration:.15s;transition-property:opacity;transition-timing-function:ease-out}.np-bottom-sheet-v2-backdrop-container--enter-from,.np-bottom-sheet-v2-backdrop-container--leave-to{opacity:0}.np-bottom-sheet-v2-backdrop{background-color:#37517e;background-color:var(--color-content-primary);inset:0;opacity:.4;position:fixed}.np-bottom-sheet-v2{display:flex;flex-direction:column;inset:0;justify-content:flex-end;padding-left:8px;padding-left:var(--size-8);padding-right:8px;padding-right:var(--size-8);padding-top:64px;padding-top:var(--size-64);position:fixed}.np-bottom-sheet-v2-content{max-height:100%}.np-bottom-sheet-v2-content--enter,.np-bottom-sheet-v2-content--leave{transition-duration:.3s;transition-property:transform;transition-timing-function:ease-out}@media (prefers-reduced-motion:reduce){.np-bottom-sheet-v2-content--enter,.np-bottom-sheet-v2-content--leave{transition-property:opacity}}@media (prefers-reduced-motion:no-preference){.np-bottom-sheet-v2-content--enter-from,.np-bottom-sheet-v2-content--leave-to{transform:translateY(100%)}}@media (prefers-reduced-motion:reduce){.np-bottom-sheet-v2-content--enter-from,.np-bottom-sheet-v2-content--leave-to{opacity:0}}.np-bottom-sheet-v2-content-inner-container{background-color:#fff;background-color:var(--color-background-elevated);border-top-left-radius:32px;border-top-right-radius:32px;box-shadow:0 0 40px rgba(69,71,69,.2);display:flex;flex-direction:column;height:100%}.np-bottom-sheet-v2-content-inner-container:focus{outline:none}.np-bottom-sheet-v2-header{align-self:flex-end;padding:16px;padding:var(--size-16)}.np-bottom-sheet-v2-content-inner{display:grid;grid-template-rows:repeat(1,minmax(0,1fr));overflow-y:auto;padding-top:0;row-gap:8px;row-gap:var(--size-8)}.np-bottom-sheet-v2-content-inner--has-title{grid-template-rows:auto 1fr}.np-bottom-sheet-v2-content-inner--padding-md{padding:16px;padding:var(--size-16)}.np-bottom-sheet-v2-title{color:#37517e;color:var(--color-content-primary)}.np-bottom-sheet-v2-body{color:#5d7079;color:var(--color-content-secondary)}.np-button-input{align-content:center;border-radius:10px;border-radius:var(--size-10);display:inline-grid;grid-auto-columns:minmax(0,1fr);text-align:start}.np-popover-v2-container{background-color:#fff;background-color:var(--color-background-elevated);border-radius:10px;border-radius:var(--radius-small);box-shadow:0 0 40px rgba(69,71,69,.2);display:flex;flex-direction:column;max-height:var(--max-height);min-width:20rem;width:var(--width);z-index:1060}.np-popover-v2-container:focus{outline:none}.np-popover-v2{display:grid;grid-template-rows:repeat(1,minmax(0,1fr));overflow-y:auto;row-gap:8px;row-gap:var(--size-8)}.np-popover-v2--has-title{grid-template-rows:auto 1fr}.np-popover-v2--padding-md{padding:16px;padding:var(--size-16)}.np-popover-v2-title{color:#37517e;color:var(--color-content-primary)}.np-popover-v2-content{color:#5d7079;color:var(--color-content-secondary)}.np-select-input-placeholder{color:#768e9c;color:var(--color-content-tertiary);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.np-select-input-options-container{display:flex;flex-direction:column;height:100%}.np-select-input-options-container:focus{outline:none}@media (min-width:576px){.np-select-input-options-container{max-height:28rem}}.np-select-input-query-container{display:flex;flex-direction:column;padding:8px;padding:var(--size-8);padding-top:0}@media (min-width:576px){.np-select-input-query-container{padding-top:8px;padding-top:var(--size-8)}}.np-select-input-listbox-container{height:var(--initial-height);overflow-y:auto;position:relative;scroll-padding-bottom:8px;scroll-padding-bottom:var(--size-8);scroll-padding-top:8px;scroll-padding-top:var(--size-8)}@media (min-width:576px){.np-select-input-listbox-container{height:auto}}.np-select-input-listbox-container--has-group{scroll-padding-top:32px;scroll-padding-top:var(--size-32)}.np-select-input-listbox{padding:8px;padding:var(--size-8)}.np-select-input-listbox:focus{outline:none}.np-select-input-separator-item{border-top-width:1px;margin:8px;margin:var(--size-8)}.np-select-input-group-item--without-needle:first-child{margin-top:-8px;margin-top:calc(var(--size-8)*-1)}.np-select-input-group-item-header{background-color:#fff;background-color:var(--color-background-elevated);color:#5d7079;color:var(--color-content-secondary);padding:8px 16px 4px;padding:var(--size-8) var(--size-16) var(--size-4);position:sticky;top:0;z-index:10}.np-select-input-option-container{align-items:center;border-radius:10px;border-radius:var(--radius-small);color:var(--color-interactive-primary);-moz-column-gap:8px;column-gap:8px;-moz-column-gap:var(--size-8);column-gap:var(--size-8);cursor:default;display:flex;padding:12px 16px;padding:var(--size-12) var(--size-16);-webkit-user-select:none;-moz-user-select:none;user-select:none}.np-select-input-option-container--active{background-color:var(--color-interactive-primary)}.np-select-input-option-container--active.np-select-input-option-container--active *{color:#00a2dd;color:var(--color-interactive-accent)}.np-select-input-option-container--disabled{opacity:.45}.np-select-input-option-check{padding:0 4px;padding:0 var(--size-4)}.np-select-input-option-check--not-selected{visibility:hidden}.np-select-input-option-check-placeholder{display:inline-block;margin-inline-start:16px;margin-inline-start:var(--size-16);width:16px;width:var(--size-16)}.np-select-input-option{flex:1}.np-select-input-option-content-container{align-items:center;color:#37517e;color:var(--color-content-primary);-moz-column-gap:8px;column-gap:8px;-moz-column-gap:var(--size-8);column-gap:var(--size-8);display:flex}.np-select-input-option-content-icon{display:flex}.np-select-input-option-content-icon--not-within-trigger{align-self:flex-start}.np-select-input-option-content-text{display:flex;flex:1;flex-direction:column;overflow:hidden}.np-select-input-option-content-text-primary{font:inherit}.np-select-input-option-content-text-secondary{color:#5d7079;color:var(--color-content-secondary)}.np-select-input-option-content-text-within-trigger{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.np-select-input-option-content-text-line-1>:not([hidden])~:not([hidden]){margin-left:8px;margin-left:var(--size-8);margin-right:8px;margin-right:var(--size-8)}.np-select-input-addon-container{align-items:center;display:inline-flex;pointer-events:none}.np-select-input-addon-container,.np-select-input-addon-container>:not([hidden])~:not([hidden]){margin-inline-start:4px;margin-inline-start:var(--size-4)}.np-select-input-addon{align-items:center;background:none;border-radius:.125rem;border-width:0;display:inline-flex;height:24px;height:var(--size-24);justify-content:center;width:24px;width:var(--size-24)}.np-select-input-addon--interactive{color:#c9cbce;color:var(--color-interactive-secondary);pointer-events:auto}.np-select-input-addon--interactive:hover{color:#b5b7ba;color:var(--color-interactive-secondary-hover)}.np-select-input-addon--interactive:focus{outline:none}.np-select-input-addon--interactive:focus-visible{outline:var(--ring-outline-color) solid var(--ring-outline-width);outline-offset:var(--ring-outline-offset)}.np-select-input-addon-separator{border-inline-start:1px solid #0000001a;border-inline-start:1px solid var(--color-border-neutral);height:24px;height:var(--size-24)}
|
|
@@ -93,14 +93,14 @@
|
|
|
93
93
|
column-gap: var(--size-8);
|
|
94
94
|
border-radius: var(--radius-small);
|
|
95
95
|
padding: var(--size-12) var(--size-16);
|
|
96
|
-
color: var(--color-
|
|
97
|
-
|
|
98
|
-
&--selected {
|
|
99
|
-
box-shadow: inset 0 0 0 1px var(--color-interactive-secondary);
|
|
100
|
-
}
|
|
96
|
+
color: var(--color-interactive-primary);
|
|
101
97
|
|
|
102
98
|
&--active {
|
|
103
|
-
background-color: var(--color-
|
|
99
|
+
background-color: var(--color-interactive-primary);
|
|
100
|
+
|
|
101
|
+
&& * {
|
|
102
|
+
color: var(--color-interactive-accent); /* TODO: Use contrast token */
|
|
103
|
+
}
|
|
104
104
|
}
|
|
105
105
|
|
|
106
106
|
&--disabled {
|
|
@@ -109,7 +109,17 @@
|
|
|
109
109
|
}
|
|
110
110
|
|
|
111
111
|
.np-select-input-option-check {
|
|
112
|
-
|
|
112
|
+
padding: 0 var(--size-4);
|
|
113
|
+
|
|
114
|
+
&--not-selected {
|
|
115
|
+
visibility: hidden;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
.np-select-input-option-check-placeholder {
|
|
120
|
+
margin-inline-start: var(--size-16);
|
|
121
|
+
display: inline-block;
|
|
122
|
+
width: var(--size-16);
|
|
113
123
|
}
|
|
114
124
|
|
|
115
125
|
.np-select-input-option {
|
|
@@ -13,6 +13,7 @@ import { PolymorphicWithOverrides } from '../common/polymorphicWithOverrides/Pol
|
|
|
13
13
|
import { Breakpoint } from '../common/propsValues/breakpoint';
|
|
14
14
|
import messages from '../dateLookup/dateTrigger/DateTrigger.messages';
|
|
15
15
|
import { wrapInFragment } from '../utilities/wrapInFragment';
|
|
16
|
+
import { Merge } from '../utils';
|
|
16
17
|
|
|
17
18
|
import { InputGroup } from './InputGroup';
|
|
18
19
|
import { SearchInput } from './SearchInput';
|
|
@@ -38,7 +39,17 @@ function inferSearchableStrings(value: unknown) {
|
|
|
38
39
|
return [];
|
|
39
40
|
}
|
|
40
41
|
|
|
41
|
-
const
|
|
42
|
+
const SelectInputItemCheckPaddingContext = createContext(false);
|
|
43
|
+
|
|
44
|
+
function useSelectInputItemCheckPadding() {
|
|
45
|
+
const checkPadding = useContext(SelectInputItemCheckPaddingContext);
|
|
46
|
+
|
|
47
|
+
// Avoid layout shifts during transitions via caching
|
|
48
|
+
const [initialCheckPadding] = useState(checkPadding);
|
|
49
|
+
|
|
50
|
+
return initialCheckPadding;
|
|
51
|
+
}
|
|
52
|
+
|
|
42
53
|
const SelectInputTriggerButtonPropsContext = createContext<{
|
|
43
54
|
ref?: React.ForwardedRef<HTMLButtonElement>;
|
|
44
55
|
onClick?: () => void;
|
|
@@ -227,8 +238,9 @@ export function SelectInput<T = string>({
|
|
|
227
238
|
}}
|
|
228
239
|
>
|
|
229
240
|
{({ disabled: uiDisabled, value }) => (
|
|
230
|
-
<
|
|
241
|
+
<SelectInputItemCheckPaddingContext.Provider value={Boolean(filterable) || value != null}>
|
|
231
242
|
<OptionsOverlay
|
|
243
|
+
placement="bottom-start"
|
|
232
244
|
open={open}
|
|
233
245
|
renderTrigger={({ ref, getInteractionProps }) => (
|
|
234
246
|
<SelectInputTriggerButtonPropsContext.Provider
|
|
@@ -283,17 +295,19 @@ export function SelectInput<T = string>({
|
|
|
283
295
|
listboxRef={listboxRef}
|
|
284
296
|
/>
|
|
285
297
|
</OptionsOverlay>
|
|
286
|
-
</
|
|
298
|
+
</SelectInputItemCheckPaddingContext.Provider>
|
|
287
299
|
)}
|
|
288
300
|
</ListboxBase>
|
|
289
301
|
);
|
|
290
302
|
}
|
|
291
303
|
|
|
292
|
-
|
|
293
|
-
as?: T;
|
|
294
|
-
} & React.ComponentPropsWithoutRef<T>;
|
|
304
|
+
type SelectInputTriggerButtonElementType = 'button' | React.ComponentType;
|
|
295
305
|
|
|
296
|
-
export
|
|
306
|
+
export type SelectInputTriggerButtonProps<
|
|
307
|
+
T extends SelectInputTriggerButtonElementType = 'button',
|
|
308
|
+
> = Merge<React.ComponentPropsWithoutRef<T>, { as?: T }>;
|
|
309
|
+
|
|
310
|
+
export function SelectInputTriggerButton<T extends SelectInputTriggerButtonElementType = 'button'>({
|
|
297
311
|
as = 'button' as T,
|
|
298
312
|
...restProps
|
|
299
313
|
}: SelectInputTriggerButtonProps<T>) {
|
|
@@ -354,7 +368,7 @@ interface SelectInputOptionsProps<T = string>
|
|
|
354
368
|
function SelectInputOptions<T = string>({
|
|
355
369
|
items,
|
|
356
370
|
renderValue = wrapInFragment,
|
|
357
|
-
filterable,
|
|
371
|
+
filterable = false,
|
|
358
372
|
filterPlaceholder,
|
|
359
373
|
searchInputRef,
|
|
360
374
|
listboxRef,
|
|
@@ -501,6 +515,7 @@ function SelectInputGroupItemView<T = string>({
|
|
|
501
515
|
needle,
|
|
502
516
|
}: SelectInputGroupItemViewProps<T>) {
|
|
503
517
|
const headerId = useId();
|
|
518
|
+
const checkPadding = useSelectInputItemCheckPadding();
|
|
504
519
|
|
|
505
520
|
return (
|
|
506
521
|
// An empty container may be rendered when no options match `needle`
|
|
@@ -516,6 +531,7 @@ function SelectInputGroupItemView<T = string>({
|
|
|
516
531
|
role="presentation"
|
|
517
532
|
className="np-select-input-group-item-header np-text-title-group"
|
|
518
533
|
>
|
|
534
|
+
{checkPadding ? <span className="np-select-input-option-check-placeholder" /> : null}
|
|
519
535
|
{item.label}
|
|
520
536
|
</header>
|
|
521
537
|
) : null}
|
|
@@ -539,24 +555,33 @@ interface SelectInputOptionProps<T = string> {
|
|
|
539
555
|
}
|
|
540
556
|
|
|
541
557
|
function SelectInputOption<T = string>({ value, disabled, children }: SelectInputOptionProps<T>) {
|
|
558
|
+
const checkPadding = useSelectInputItemCheckPadding();
|
|
559
|
+
|
|
542
560
|
return (
|
|
543
561
|
<ListboxBase.Option
|
|
544
562
|
as="div"
|
|
545
563
|
value={value}
|
|
546
564
|
disabled={disabled}
|
|
547
|
-
className={({ active,
|
|
565
|
+
className={({ active, disabled: uiDisabled }) =>
|
|
548
566
|
classNames(
|
|
549
567
|
'np-select-input-option-container np-text-body-large',
|
|
550
568
|
active && 'np-select-input-option-container--active',
|
|
551
|
-
selected && 'np-select-input-option-container--selected',
|
|
552
569
|
uiDisabled && 'np-select-input-option-container--disabled',
|
|
553
570
|
)
|
|
554
571
|
}
|
|
555
572
|
>
|
|
556
573
|
{({ selected }) => (
|
|
557
574
|
<>
|
|
575
|
+
{checkPadding ? (
|
|
576
|
+
<Check
|
|
577
|
+
size={16}
|
|
578
|
+
className={classNames(
|
|
579
|
+
'np-select-input-option-check',
|
|
580
|
+
!selected && 'np-select-input-option-check--not-selected',
|
|
581
|
+
)}
|
|
582
|
+
/>
|
|
583
|
+
) : null}
|
|
558
584
|
<div className="np-select-input-option">{children}</div>
|
|
559
|
-
{selected && <Check size={24} className={classNames('np-select-input-option-check')} />}
|
|
560
585
|
</>
|
|
561
586
|
)}
|
|
562
587
|
</ListboxBase.Option>
|
|
@@ -49,9 +49,7 @@ export function BottomSheet({
|
|
|
49
49
|
},
|
|
50
50
|
});
|
|
51
51
|
|
|
52
|
-
const dismiss = useDismiss(context
|
|
53
|
-
outsidePressEvent: 'mousedown',
|
|
54
|
-
});
|
|
52
|
+
const dismiss = useDismiss(context);
|
|
55
53
|
const role = useRole(context);
|
|
56
54
|
const { getReferenceProps, getFloatingProps } = useInteractions([dismiss, role]);
|
|
57
55
|
|
|
@@ -85,20 +83,20 @@ export function BottomSheet({
|
|
|
85
83
|
<div className="np-bottom-sheet-v2-backdrop" />
|
|
86
84
|
</Transition.Child>
|
|
87
85
|
|
|
88
|
-
<
|
|
89
|
-
<
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
86
|
+
<div className="np-bottom-sheet-v2">
|
|
87
|
+
<Transition.Child
|
|
88
|
+
className="np-bottom-sheet-v2-content"
|
|
89
|
+
enter="np-bottom-sheet-v2-content--enter"
|
|
90
|
+
enterFrom="np-bottom-sheet-v2-content--enter-from"
|
|
91
|
+
leave="np-bottom-sheet-v2-content--leave"
|
|
92
|
+
leaveTo="np-bottom-sheet-v2-content--leave-to"
|
|
94
93
|
>
|
|
95
|
-
<
|
|
96
|
-
<
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
leaveTo="np-bottom-sheet-v2-content--leave-to"
|
|
94
|
+
<FocusBoundary>
|
|
95
|
+
<FloatingFocusManager
|
|
96
|
+
context={context}
|
|
97
|
+
initialFocus={initialFocusRef}
|
|
98
|
+
guards={false}
|
|
99
|
+
modal={false}
|
|
102
100
|
>
|
|
103
101
|
<div
|
|
104
102
|
key={floatingKey} // Force inner state invalidation on open
|
|
@@ -131,10 +129,10 @@ export function BottomSheet({
|
|
|
131
129
|
</div>
|
|
132
130
|
</div>
|
|
133
131
|
</div>
|
|
134
|
-
</
|
|
135
|
-
</
|
|
136
|
-
</
|
|
137
|
-
</
|
|
132
|
+
</FloatingFocusManager>
|
|
133
|
+
</FocusBoundary>
|
|
134
|
+
</Transition.Child>
|
|
135
|
+
</div>
|
|
138
136
|
</Transition>
|
|
139
137
|
</ThemeProvider>
|
|
140
138
|
</FloatingPortal>
|
package/src/inputs/_Popover.tsx
CHANGED
|
@@ -4,8 +4,8 @@ import {
|
|
|
4
4
|
FloatingFocusManager,
|
|
5
5
|
FloatingPortal,
|
|
6
6
|
offset,
|
|
7
|
+
type Placement,
|
|
7
8
|
shift,
|
|
8
|
-
type Side,
|
|
9
9
|
size,
|
|
10
10
|
useDismiss,
|
|
11
11
|
useFloating,
|
|
@@ -21,7 +21,7 @@ import FocusBoundary from '../common/focusBoundary/FocusBoundary';
|
|
|
21
21
|
import { PreventScroll } from '../common/preventScroll/PreventScroll';
|
|
22
22
|
|
|
23
23
|
export interface PopoverProps {
|
|
24
|
-
placement?:
|
|
24
|
+
placement?: Placement;
|
|
25
25
|
open: boolean;
|
|
26
26
|
renderTrigger: (args: {
|
|
27
27
|
ref: React.RefCallback<Element>;
|
|
@@ -69,9 +69,7 @@ export function Popover({
|
|
|
69
69
|
},
|
|
70
70
|
});
|
|
71
71
|
|
|
72
|
-
const dismiss = useDismiss(context
|
|
73
|
-
outsidePressEvent: 'mousedown',
|
|
74
|
-
});
|
|
72
|
+
const dismiss = useDismiss(context);
|
|
75
73
|
const role = useRole(context);
|
|
76
74
|
const { getReferenceProps, getFloatingProps } = useInteractions([role, dismiss]);
|
|
77
75
|
|