@transferwise/components 0.0.0-experimental-9f2982a → 0.0.0-experimental-52c0a68

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.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/i18n/index.ts"],"names":[],"mappings":"AAiBA,QAAA,MAAM,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAiBxD,CAAC;AAEF,eAAe,YAAY,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/i18n/index.ts"],"names":[],"mappings":"AAmBA,QAAA,MAAM,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAmBxD,CAAC;AAEF,eAAe,YAAY,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"SelectInput.d.ts","sourceRoot":"","sources":["../../../src/inputs/SelectInput.tsx"],"names":[],"mappings":";AAeA,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AA6CjC,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,oBA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AAC,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CACxB;AAED,wBAAgB,wBAAwB,CAAC,EACvC,KAAK,EACL,IAAI,EACJ,WAAW,EACX,IAAI,GACL,EAAE,6BAA6B,+BAiD/B"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@transferwise/components",
3
- "version": "0.0.0-experimental-9f2982a",
3
+ "version": "0.0.0-experimental-52c0a68",
4
4
  "description": "Neptune React components",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -1,12 +1,4 @@
1
- import translationFiles from '../../i18n';
2
-
3
- import {
4
- getLangFromLocale,
5
- adjustLocale,
6
- getCountryFromLocale,
7
- SUPPORTED_LANGUAGES,
8
- getDirectionFromLocale,
9
- } from '.';
1
+ import { getLangFromLocale, adjustLocale, getCountryFromLocale, getDirectionFromLocale } from '.';
10
2
 
11
3
  describe('locale utils', () => {
12
4
  beforeAll(() => {
@@ -72,31 +64,6 @@ describe('locale utils', () => {
72
64
  });
73
65
  });
74
66
 
75
- describe('contract between SUPPORTED_LANGUAGES and names of translations files', () => {
76
- it('number of lang codes should be equal to number of translations files', () => {
77
- expect(SUPPORTED_LANGUAGES).toHaveLength(Object.keys(translationFiles).length);
78
- });
79
-
80
- it('lang codes should match to names of translations object', () => {
81
- Object.keys(translationFiles).forEach((property) => {
82
- const result = SUPPORTED_LANGUAGES.includes(property);
83
- if (!result) {
84
- // eslint-disable-next-line no-console
85
- console.log(`'${property}' doesn't exist in ${[SUPPORTED_LANGUAGES]}`);
86
- }
87
- expect(result).toBe(true);
88
- });
89
- });
90
-
91
- it('lang codes should match with names of translations files', async () => {
92
- for (const locale of SUPPORTED_LANGUAGES) {
93
- const file = await import(`../../i18n/${locale}.json`);
94
- expect(file).not.toBeNull();
95
- expect(file.default).toBe(translationFiles[locale]);
96
- }
97
- });
98
- });
99
-
100
67
  describe('getCountryFromLocale', () => {
101
68
  it.each([
102
69
  ['en', null],
package/src/i18n/en.json CHANGED
@@ -18,7 +18,6 @@
18
18
  "neptune.Link.opensInNewTab": "(opens in new tab)",
19
19
  "neptune.MoneyInput.Select.placeholder": "Select an option...",
20
20
  "neptune.Select.searchPlaceholder": "Search...",
21
- "neptune.SelectInput.noResultsFound": "No results found",
22
21
  "neptune.Summary.statusDone": "Item done",
23
22
  "neptune.Summary.statusNotDone": "Item to do",
24
23
  "neptune.Summary.statusPending": "Item pending",
package/src/i18n/index.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import cs from './cs.json';
1
2
  import de from './de.json';
2
3
  import en from './en.json';
3
4
  import es from './es.json';
@@ -13,9 +14,11 @@ import ru from './ru.json';
13
14
  import th from './th.json';
14
15
  import tr from './tr.json';
15
16
  import uk from './uk.json';
16
- import zh from './zh.json';
17
+ import zhCN from './zh-CN.json';
18
+ import zhHK from './zh-HK.json';
17
19
 
18
20
  const translations: Record<string, Record<string, string>> = {
21
+ cs,
19
22
  de,
20
23
  en,
21
24
  es,
@@ -31,7 +34,8 @@ const translations: Record<string, Record<string, string>> = {
31
34
  th,
32
35
  tr,
33
36
  uk,
34
- zh,
37
+ 'zh-CN': zhCN,
38
+ 'zh-HK': zhHK,
35
39
  };
36
40
 
37
41
  export default translations;
@@ -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-options-status{align-items:center;-moz-column-gap:8px;column-gap:8px;-moz-column-gap:var(--size-8);column-gap:var(--size-8);display:flex;padding:8px 24px 0;padding:var(--size-8) var(--size-24) 0}.np-select-input-options-status-icon{color:#768e9c;color:var(--color-content-tertiary);padding:0 4px;padding:0 var(--size-4)}.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)}
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)}
@@ -26,18 +26,6 @@
26
26
  }
27
27
  }
28
28
 
29
- .np-select-input-options-status {
30
- display: flex;
31
- align-items: center;
32
- column-gap: var(--size-8);
33
- padding: var(--size-8) var(--size-24) 0px;
34
- }
35
-
36
- .np-select-input-options-status-icon {
37
- padding: 0 var(--size-4);
38
- color: var(--color-content-tertiary);
39
- }
40
-
41
29
  .np-select-input-query-container {
42
30
  display: flex;
43
31
  flex-direction: column;
@@ -1,6 +1,6 @@
1
1
  import { Listbox as ListboxBase } from '@headlessui/react';
2
2
  import { useId } from '@radix-ui/react-id';
3
- import { Check, ChevronDown, Cross, CrossCircle } from '@transferwise/icons';
3
+ import { Check, ChevronDown, Cross } from '@transferwise/icons';
4
4
  import classNames from 'classnames';
5
5
  import mergeProps from 'merge-props';
6
6
  import { createContext, forwardRef, useContext, useEffect, useMemo, useRef, useState } from 'react';
@@ -11,13 +11,12 @@ import { useEffectEvent } from '../common/hooks/useEffectEvent';
11
11
  import { useScreenSize } from '../common/hooks/useScreenSize';
12
12
  import { PolymorphicWithOverrides } from '../common/polymorphicWithOverrides/PolymorphicWithOverrides';
13
13
  import { Breakpoint } from '../common/propsValues/breakpoint';
14
- import dateTriggerMessages from '../dateLookup/dateTrigger/DateTrigger.messages';
14
+ import messages from '../dateLookup/dateTrigger/DateTrigger.messages';
15
15
  import { wrapInFragment } from '../utilities/wrapInFragment';
16
16
  import { Merge } from '../utils';
17
17
 
18
18
  import { InputGroup } from './InputGroup';
19
19
  import { SearchInput } from './SearchInput';
20
- import messages from './SelectInput.messages';
21
20
  import { BottomSheet } from './_BottomSheet';
22
21
  import { ButtonInput } from './_ButtonInput';
23
22
  import { Popover } from './_Popover';
@@ -84,11 +83,14 @@ function dedupeSelectInputOptionItem<T>(
84
83
  item: SelectInputOptionItem<T>,
85
84
  existingValues: Set<T>,
86
85
  ): SelectInputOptionItem<T | undefined> {
87
- if (!existingValues.has(item.value)) {
88
- existingValues.add(item.value);
89
- return item;
86
+ if (existingValues.has(item.value)) {
87
+ return {
88
+ ...item,
89
+ value: undefined,
90
+ };
90
91
  }
91
- return { ...item, value: undefined };
92
+ existingValues.add(item.value);
93
+ return item;
92
94
  }
93
95
 
94
96
  function dedupeSelectInputItems<T>(
@@ -114,27 +116,6 @@ function dedupeSelectInputItems<T>(
114
116
  });
115
117
  }
116
118
 
117
- function filterSelectInputOptionItem<T>(item: SelectInputOptionItem<T>, needle: string) {
118
- return inferSearchableStrings(item.filterMatchers ?? item.value).some((haystack) =>
119
- haystack.includes(needle),
120
- );
121
- }
122
-
123
- function filterSelectInputItems<T>(items: readonly SelectInputItem<T>[], needle: string) {
124
- return items.filter((item) => {
125
- switch (item.type) {
126
- case 'option': {
127
- return filterSelectInputOptionItem(item, needle);
128
- }
129
- case 'group': {
130
- return item.options.some((option) => filterSelectInputOptionItem(option, needle));
131
- }
132
- default:
133
- }
134
- return false;
135
- });
136
- }
137
-
138
119
  export interface SelectInputProps<T = string> {
139
120
  name?: string;
140
121
  placeholder?: string;
@@ -205,7 +186,7 @@ function SelectInputClearButton({ className, onClick }: SelectInputClearButtonPr
205
186
  return (
206
187
  <button
207
188
  type="button"
208
- aria-label={intl.formatMessage(dateTriggerMessages.ariaLabel)}
189
+ aria-label={intl.formatMessage(messages.ariaLabel)}
209
190
  className={classNames(className, 'np-select-input-addon np-select-input-addon--interactive')}
210
191
  onClick={onClick}
211
192
  >
@@ -392,10 +373,6 @@ function SelectInputOptions<T = string>({
392
373
  searchInputRef,
393
374
  listboxRef,
394
375
  }: SelectInputOptionsProps<T>) {
395
- const intl = useIntl();
396
-
397
- const controllerRef = filterable ? searchInputRef : listboxRef;
398
-
399
376
  const [query, setQuery] = useState('');
400
377
  const needle = useMemo(() => {
401
378
  if (filterable) {
@@ -403,7 +380,6 @@ function SelectInputOptions<T = string>({
403
380
  }
404
381
  return undefined;
405
382
  }, [filterable, query]);
406
- const empty = needle != null && filterSelectInputItems(items, needle).length === 0;
407
383
 
408
384
  const listboxContainerRef = useRef<HTMLDivElement>(null);
409
385
  useEffect(() => {
@@ -415,10 +391,10 @@ function SelectInputOptions<T = string>({
415
391
  }
416
392
  }, []);
417
393
 
418
- const showStatus = empty;
419
- const statusId = useId();
420
394
  const listboxId = useId();
421
395
 
396
+ const controllerRef = filterable ? searchInputRef : listboxRef;
397
+
422
398
  return (
423
399
  <ListboxBase.Options
424
400
  as={SelectInputOptionsContainer}
@@ -442,7 +418,6 @@ function SelectInputOptions<T = string>({
442
418
  placeholder={filterPlaceholder}
443
419
  value={query}
444
420
  aria-controls={listboxId}
445
- aria-describedby={showStatus ? statusId : undefined}
446
421
  onKeyDown={(event) => {
447
422
  // Prevent interfering with the matcher of Headless UI
448
423
  // https://mathiasbynens.be/notes/javascript-unicode#regex
@@ -465,13 +440,6 @@ function SelectInputOptions<T = string>({
465
440
  'np-select-input-listbox-container--has-group',
466
441
  )}
467
442
  >
468
- {empty ? (
469
- <div id={statusId} className="np-select-input-options-status">
470
- <CrossCircle size={16} className="np-select-input-options-status-icon" />
471
- {intl.formatMessage(messages.noResultsFound)}
472
- </div>
473
- ) : null}
474
-
475
443
  <div
476
444
  ref={listboxRef}
477
445
  id={listboxId}
@@ -480,7 +448,7 @@ function SelectInputOptions<T = string>({
480
448
  tabIndex={0}
481
449
  className="np-select-input-listbox"
482
450
  >
483
- {(needle != null ? dedupeSelectInputItems(items) : items).map((item, index) => (
451
+ {(needle == null ? items : dedupeSelectInputItems(items)).map((item, index) => (
484
452
  <SelectInputItemView
485
453
  // eslint-disable-next-line react/no-array-index-key
486
454
  key={index}
@@ -510,7 +478,13 @@ function SelectInputItemView<T = string>({
510
478
  }: SelectInputItemViewProps<T>) {
511
479
  switch (item.type) {
512
480
  case 'option': {
513
- if (item.value != null && (needle == null || filterSelectInputOptionItem(item, needle))) {
481
+ if (
482
+ item.value != null &&
483
+ (!needle ||
484
+ inferSearchableStrings(item.filterMatchers ?? item.value).some((haystack) =>
485
+ haystack.includes(needle),
486
+ ))
487
+ ) {
514
488
  return (
515
489
  <SelectInputOption value={item.value} disabled={item.disabled}>
516
490
  {renderValue(item.value, false)}
@@ -74,29 +74,29 @@ export function BottomSheet({
74
74
  setFloatingKey((prev) => prev + 1);
75
75
  }}
76
76
  >
77
- <FocusBoundary>
78
- <Transition.Child
79
- enter="np-bottom-sheet-v2-backdrop-container--enter"
80
- enterFrom="np-bottom-sheet-v2-backdrop-container--enter-from"
81
- leave="np-bottom-sheet-v2-backdrop-container--leave"
82
- leaveTo="np-bottom-sheet-v2-backdrop-container--leave-to"
83
- >
84
- <div className="np-bottom-sheet-v2-backdrop" />
85
- </Transition.Child>
77
+ <Transition.Child
78
+ enter="np-bottom-sheet-v2-backdrop-container--enter"
79
+ enterFrom="np-bottom-sheet-v2-backdrop-container--enter-from"
80
+ leave="np-bottom-sheet-v2-backdrop-container--leave"
81
+ leaveTo="np-bottom-sheet-v2-backdrop-container--leave-to"
82
+ >
83
+ <div className="np-bottom-sheet-v2-backdrop" />
84
+ </Transition.Child>
86
85
 
87
- <FloatingFocusManager
88
- context={context}
89
- initialFocus={initialFocusRef}
90
- guards={false}
91
- modal={false}
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"
92
93
  >
93
- <div className="np-bottom-sheet-v2">
94
- <Transition.Child
95
- className="np-bottom-sheet-v2-content"
96
- enter="np-bottom-sheet-v2-content--enter"
97
- enterFrom="np-bottom-sheet-v2-content--enter-from"
98
- leave="np-bottom-sheet-v2-content--leave"
99
- leaveTo="np-bottom-sheet-v2-content--leave-to"
94
+ <FocusBoundary>
95
+ <FloatingFocusManager
96
+ context={context}
97
+ initialFocus={initialFocusRef}
98
+ guards={false}
99
+ modal={false}
100
100
  >
101
101
  <div
102
102
  key={floatingKey} // Force inner state invalidation on open
@@ -129,10 +129,10 @@ export function BottomSheet({
129
129
  </div>
130
130
  </div>
131
131
  </div>
132
- </Transition.Child>
133
- </div>
134
- </FloatingFocusManager>
135
- </FocusBoundary>
132
+ </FloatingFocusManager>
133
+ </FocusBoundary>
134
+ </Transition.Child>
135
+ </div>
136
136
  </Transition>
137
137
  </ThemeProvider>
138
138
  </FloatingPortal>