@transferwise/components 46.160.2 → 46.160.4
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/FlowNavigation/FlowNavigation.js +6 -4
- package/build/FlowNavigation/FlowNavigation.js.map +1 -1
- package/build/FlowNavigation/FlowNavigation.mjs +6 -4
- package/build/FlowNavigation/FlowNavigation.mjs.map +1 -1
- package/build/Inputs/SelectInput/Options/SelectInputOptions.js +33 -5
- package/build/Inputs/SelectInput/Options/SelectInputOptions.js.map +1 -1
- package/build/Inputs/SelectInput/Options/SelectInputOptions.mjs +34 -6
- package/build/Inputs/SelectInput/Options/SelectInputOptions.mjs.map +1 -1
- package/build/Inputs/SelectInput/SelectInput.js +28 -4
- package/build/Inputs/SelectInput/SelectInput.js.map +1 -1
- package/build/Inputs/SelectInput/SelectInput.mjs +29 -5
- package/build/Inputs/SelectInput/SelectInput.mjs.map +1 -1
- package/build/Inputs/SelectInput/SelectInput.utils.js +0 -2
- package/build/Inputs/SelectInput/SelectInput.utils.js.map +1 -1
- package/build/Inputs/SelectInput/SelectInput.utils.mjs +1 -2
- package/build/Inputs/SelectInput/SelectInput.utils.mjs.map +1 -1
- package/build/Inputs/SelectInput/TriggerButton/SelectInputTriggerButton.js +5 -1
- package/build/Inputs/SelectInput/TriggerButton/SelectInputTriggerButton.js.map +1 -1
- package/build/Inputs/SelectInput/TriggerButton/SelectInputTriggerButton.mjs +5 -1
- package/build/Inputs/SelectInput/TriggerButton/SelectInputTriggerButton.mjs.map +1 -1
- package/build/Inputs/SelectInput/constants.js +8 -0
- package/build/Inputs/SelectInput/constants.js.map +1 -0
- package/build/Inputs/SelectInput/constants.mjs +5 -0
- package/build/Inputs/SelectInput/constants.mjs.map +1 -0
- package/build/Inputs/SelectInput/hooks/useTypeahead.js +57 -0
- package/build/Inputs/SelectInput/hooks/useTypeahead.js.map +1 -0
- package/build/Inputs/SelectInput/hooks/useTypeahead.mjs +54 -0
- package/build/Inputs/SelectInput/hooks/useTypeahead.mjs.map +1 -0
- package/build/i18n/ja.json +1 -1
- package/build/i18n/ja.json.js +1 -1
- package/build/i18n/ja.json.mjs +1 -1
- package/build/main.css +10 -0
- package/build/styles/FlowNavigation/FlowNavigation.css +10 -0
- package/build/styles/main.css +10 -0
- package/build/types/FlowNavigation/FlowNavigation.d.ts.map +1 -1
- package/build/types/Inputs/SelectInput/Options/SelectInputOptions.d.ts +3 -1
- package/build/types/Inputs/SelectInput/Options/SelectInputOptions.d.ts.map +1 -1
- package/build/types/Inputs/SelectInput/SelectInput.d.ts.map +1 -1
- package/build/types/Inputs/SelectInput/SelectInput.utils.d.ts +0 -1
- package/build/types/Inputs/SelectInput/SelectInput.utils.d.ts.map +1 -1
- package/build/types/Inputs/SelectInput/TriggerButton/SelectInputTriggerButton.d.ts.map +1 -1
- package/build/types/Inputs/SelectInput/constants.d.ts +3 -0
- package/build/types/Inputs/SelectInput/constants.d.ts.map +1 -0
- package/build/types/Inputs/SelectInput/hooks/useTypeahead.d.ts +8 -0
- package/build/types/Inputs/SelectInput/hooks/useTypeahead.d.ts.map +1 -0
- package/package.json +2 -2
- package/src/FlowNavigation/FlowNavigation.css +10 -0
- package/src/FlowNavigation/FlowNavigation.less +11 -0
- package/src/FlowNavigation/FlowNavigation.tsx +6 -4
- package/src/Inputs/SelectInput/Options/SelectInputOptions.tsx +36 -6
- package/src/Inputs/SelectInput/SelectInput.test.tsx +143 -0
- package/src/Inputs/SelectInput/SelectInput.tsx +31 -5
- package/src/Inputs/SelectInput/SelectInput.utils.ts +0 -2
- package/src/Inputs/SelectInput/TriggerButton/SelectInputTriggerButton.tsx +3 -0
- package/src/Inputs/SelectInput/constants.ts +3 -0
- package/src/Inputs/SelectInput/hooks/useTypeahead.ts +82 -0
- package/src/i18n/ja.json +1 -1
- package/src/main.css +10 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectInput.utils.mjs","sources":["../../../src/Inputs/SelectInput/SelectInput.utils.ts"],"sourcesContent":["import { SelectInputItem, SelectInputOptionItem } from './SelectInput.types';\n\nexport const MAX_ITEMS_WITHOUT_VIRTUALIZATION = 50;\n\n/**\n * Converts a string to a normalized, searchable format by:\n * - Trimming whitespace\n * - Normalizing whitespace (convert multiple spaces to single space)\n * - Converting to NFD normalization form to handle diacritics\n * - Removing combining diacritical marks\n * - Converting to lowercase\n */\nexport function searchableString(value: string) {\n return (\n value\n .trim()\n .replace(/\\s+/gu, ' ')\n // NFD converts an Å to A + ̊ (and other special characters)\n .normalize('NFD')\n // and then this replaces the ̊ with nothing (and other special characters)\n .replace(/[\\u0300-\\u036f]/g, '')\n .toLowerCase()\n );\n}\n\n/**\n * Extracts searchable strings from a value.\n * - If the value is a string, returns a normalized version.\n * - If the value is an object, extracts all string values and normalizes them.\n * - Otherwise returns an empty array.\n */\nexport function inferSearchableStrings(value: unknown) {\n if (typeof value === 'string') {\n return [searchableString(value)];\n }\n\n if (typeof value === 'object' && value != null) {\n return Object.values(value)\n .filter((innerValue) => typeof innerValue === 'string')\n .map((innerValue) => searchableString(innerValue));\n }\n\n return [];\n}\n\n/**\n * Sets the value of a duplicate option item to undefined, effectively hiding it when rendered.\n */\nexport function dedupeSelectInputOptionItem<T>(\n item: SelectInputOptionItem<T>,\n existingValues: Set<T>,\n compareValues?: (a: T, b: T) => boolean,\n): SelectInputOptionItem<T | undefined> {\n const isDuplicate = compareValues\n ? Array.from(existingValues).some((existingValue) => compareValues(item.value, existingValue))\n : existingValues.has(item.value);\n\n if (!isDuplicate) {\n existingValues.add(item.value);\n return item;\n }\n return { ...item, value: undefined };\n}\n\n/**\n * Sets the `value` of duplicate option items to `undefined`, hiding them when\n * rendered. Indexes are kept intact within groups to preserve the active item\n * between filter changes when possible.\n */\nexport function dedupeSelectInputItems<T>(\n items: readonly SelectInputItem<T>[],\n compareValues?: (a: T, b: T) => boolean,\n): SelectInputItem<T | undefined>[] {\n const existingValues = new Set<T>();\n\n return items.map((item) => {\n switch (item.type) {\n case 'option': {\n return dedupeSelectInputOptionItem(item, existingValues, compareValues);\n }\n case 'group': {\n return {\n ...item,\n options: item.options.map((option) =>\n dedupeSelectInputOptionItem(option, existingValues, compareValues),\n ),\n };\n }\n default:\n }\n return item;\n });\n}\n\n/**\n * Checks if a SelectInputOptionItem matches the search needle.\n */\nexport function selectInputOptionItemIncludesNeedle<T>(\n item: SelectInputOptionItem<T>,\n needle: string,\n) {\n return inferSearchableStrings(item.filterMatchers ?? item.value).some((haystack) =>\n haystack.includes(needle),\n );\n}\n\n/**\n * Filters SelectInputItems based on the provided predicate function.\n * For group items, it checks if any of their options match the predicate.\n */\nexport function filterSelectInputItems<T>(\n items: readonly SelectInputItem<T>[],\n predicate: (item: SelectInputOptionItem<T>) => boolean,\n) {\n return items.filter((item) => {\n switch (item.type) {\n case 'option': {\n return predicate(item);\n }\n case 'group': {\n return item.options.some((option) => predicate(option));\n }\n default:\n }\n return false;\n });\n}\n\n/**\n * Flattens and sorts filtered options using the provided comparator.\n * Extracts all options from groups, filters out undefined values (deduplicated items),\n * sorts them, and returns as a flat list of option items.\n */\nexport function sortSelectInputItems<T>(\n items: readonly SelectInputItem<T | undefined>[],\n compareFn: (\n a: SelectInputOptionItem<NonNullable<T>>,\n b: SelectInputOptionItem<NonNullable<T>>,\n searchQuery: string,\n ) => number,\n searchQuery: string,\n): SelectInputItem<NonNullable<T>>[] {\n const flattenedOption = items.flatMap((item) => {\n if (item.type === 'option') {\n return item.value !== undefined ? [item as SelectInputOptionItem<NonNullable<T>>] : [];\n }\n\n if (item.type === 'group') {\n return item.options.filter(\n (option): option is SelectInputOptionItem<NonNullable<T>> => option.value !== undefined,\n );\n }\n\n return [];\n });\n\n // eslint-disable-next-line functional/immutable-data\n return flattenedOption.sort((a, b) => compareFn(a, b, searchQuery));\n}\n\n/**\n * A prebuilt sort function for `sortFilteredOptions` that sorts options by relevance to the search query.\n * Prioritizes: exact matches > starts with > contains > alphabetical.\n *\n * @param getLabel - Function to extract the label string from the option value. Defaults to using `title` property.\n *\n * @example\n * ```tsx\n * <SelectInput\n * filterable\n * sortFilteredOptions={sortByRelevance((value) => value.name)}\n * // ...\n * />\n * ```\n */\nexport function sortByRelevance<T>(\n getLabel: (value: T) => string = (value) => (value as { title: string }).title,\n): (a: SelectInputOptionItem<T>, b: SelectInputOptionItem<T>, searchQuery: string) => number {\n return (a, b, searchQuery) => {\n const normalizedQuery = searchQuery.toLowerCase();\n const labelA = getLabel(a.value).toLowerCase();\n const labelB = getLabel(b.value).toLowerCase();\n\n // Prioritize exact matches\n const aExactMatch = labelA === normalizedQuery;\n const bExactMatch = labelB === normalizedQuery;\n if (aExactMatch && !bExactMatch) return -1;\n if (!aExactMatch && bExactMatch) return 1;\n\n // Then prioritize options where label starts with the search query\n const aStartsWith = labelA.startsWith(normalizedQuery);\n const bStartsWith = labelB.startsWith(normalizedQuery);\n if (aStartsWith && !bStartsWith) return -1;\n if (!aStartsWith && bStartsWith) return 1;\n\n // Then prioritize options where label contains the search query\n const aContains = labelA.includes(normalizedQuery);\n const bContains = labelB.includes(normalizedQuery);\n if (aContains && !bContains) return -1;\n if (!aContains && bContains) return 1;\n\n // Finally sort alphabetically\n return labelA.localeCompare(labelB);\n };\n}\n"],"names":["MAX_ITEMS_WITHOUT_VIRTUALIZATION","searchableString","value","trim","replace","normalize","toLowerCase","inferSearchableStrings","Object","values","filter","innerValue","map","dedupeSelectInputOptionItem","item","existingValues","compareValues","isDuplicate","Array","from","some","existingValue","has","add","undefined","dedupeSelectInputItems","items","Set","type","options","option","selectInputOptionItemIncludesNeedle","needle","filterMatchers","haystack","includes","filterSelectInputItems","predicate","sortSelectInputItems","compareFn","searchQuery","flattenedOption","flatMap","sort","a","b","sortByRelevance","getLabel","title","normalizedQuery","labelA","labelB","aExactMatch","bExactMatch","aStartsWith","startsWith","bStartsWith","aContains","bContains","localeCompare"],"mappings":"AAEO,MAAMA,gCAAgC,GAAG;AAEhD;;;;;;;AAOG;AACG,SAAUC,gBAAgBA,CAACC,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AAC9C,IAAA,IAAIG,WAAW,IAAI,CAACC,WAAW,EAAE,OAAO,EAAE;AAC1C,IAAA,IAAI,CAACD,WAAW,IAAIC,WAAW,EAAE,OAAO,CAAC;AAEzC;AACA,IAAA,MAAMC,WAAW,GAAGJ,MAAM,CAACK,UAAU,CAACN,eAAe,CAAC;AACtD,IAAA,MAAMO,WAAW,GAAGL,MAAM,CAACI,UAAU,CAACN,eAAe,CAAC;AACtD,IAAA,IAAIK,WAAW,IAAI,CAACE,WAAW,EAAE,OAAO,EAAE;AAC1C,IAAA,IAAI,CAACF,WAAW,IAAIE,WAAW,EAAE,OAAO,CAAC;AAEzC;AACA,IAAA,MAAMC,SAAS,GAAGP,MAAM,CAACf,QAAQ,CAACc,eAAe,CAAC;AAClD,IAAA,MAAMS,SAAS,GAAGP,MAAM,CAAChB,QAAQ,CAACc,eAAe,CAAC;AAClD,IAAA,IAAIQ,SAAS,IAAI,CAACC,SAAS,EAAE,OAAO,EAAE;AACtC,IAAA,IAAI,CAACD,SAAS,IAAIC,SAAS,EAAE,OAAO,CAAC;AAErC;AACA,IAAA,OAAOR,MAAM,CAACS,aAAa,CAACR,MAAM,CAAC;EACrC,CAAC;AACH;;;;"}
|
|
1
|
+
{"version":3,"file":"SelectInput.utils.mjs","sources":["../../../src/Inputs/SelectInput/SelectInput.utils.ts"],"sourcesContent":["import { SelectInputItem, SelectInputOptionItem } from './SelectInput.types';\n\n/**\n * Converts a string to a normalized, searchable format by:\n * - Trimming whitespace\n * - Normalizing whitespace (convert multiple spaces to single space)\n * - Converting to NFD normalization form to handle diacritics\n * - Removing combining diacritical marks\n * - Converting to lowercase\n */\nexport function searchableString(value: string) {\n return (\n value\n .trim()\n .replace(/\\s+/gu, ' ')\n // NFD converts an Å to A + ̊ (and other special characters)\n .normalize('NFD')\n // and then this replaces the ̊ with nothing (and other special characters)\n .replace(/[\\u0300-\\u036f]/g, '')\n .toLowerCase()\n );\n}\n\n/**\n * Extracts searchable strings from a value.\n * - If the value is a string, returns a normalized version.\n * - If the value is an object, extracts all string values and normalizes them.\n * - Otherwise returns an empty array.\n */\nexport function inferSearchableStrings(value: unknown) {\n if (typeof value === 'string') {\n return [searchableString(value)];\n }\n\n if (typeof value === 'object' && value != null) {\n return Object.values(value)\n .filter((innerValue) => typeof innerValue === 'string')\n .map((innerValue) => searchableString(innerValue));\n }\n\n return [];\n}\n\n/**\n * Sets the value of a duplicate option item to undefined, effectively hiding it when rendered.\n */\nexport function dedupeSelectInputOptionItem<T>(\n item: SelectInputOptionItem<T>,\n existingValues: Set<T>,\n compareValues?: (a: T, b: T) => boolean,\n): SelectInputOptionItem<T | undefined> {\n const isDuplicate = compareValues\n ? Array.from(existingValues).some((existingValue) => compareValues(item.value, existingValue))\n : existingValues.has(item.value);\n\n if (!isDuplicate) {\n existingValues.add(item.value);\n return item;\n }\n return { ...item, value: undefined };\n}\n\n/**\n * Sets the `value` of duplicate option items to `undefined`, hiding them when\n * rendered. Indexes are kept intact within groups to preserve the active item\n * between filter changes when possible.\n */\nexport function dedupeSelectInputItems<T>(\n items: readonly SelectInputItem<T>[],\n compareValues?: (a: T, b: T) => boolean,\n): SelectInputItem<T | undefined>[] {\n const existingValues = new Set<T>();\n\n return items.map((item) => {\n switch (item.type) {\n case 'option': {\n return dedupeSelectInputOptionItem(item, existingValues, compareValues);\n }\n case 'group': {\n return {\n ...item,\n options: item.options.map((option) =>\n dedupeSelectInputOptionItem(option, existingValues, compareValues),\n ),\n };\n }\n default:\n }\n return item;\n });\n}\n\n/**\n * Checks if a SelectInputOptionItem matches the search needle.\n */\nexport function selectInputOptionItemIncludesNeedle<T>(\n item: SelectInputOptionItem<T>,\n needle: string,\n) {\n return inferSearchableStrings(item.filterMatchers ?? item.value).some((haystack) =>\n haystack.includes(needle),\n );\n}\n\n/**\n * Filters SelectInputItems based on the provided predicate function.\n * For group items, it checks if any of their options match the predicate.\n */\nexport function filterSelectInputItems<T>(\n items: readonly SelectInputItem<T>[],\n predicate: (item: SelectInputOptionItem<T>) => boolean,\n) {\n return items.filter((item) => {\n switch (item.type) {\n case 'option': {\n return predicate(item);\n }\n case 'group': {\n return item.options.some((option) => predicate(option));\n }\n default:\n }\n return false;\n });\n}\n\n/**\n * Flattens and sorts filtered options using the provided comparator.\n * Extracts all options from groups, filters out undefined values (deduplicated items),\n * sorts them, and returns as a flat list of option items.\n */\nexport function sortSelectInputItems<T>(\n items: readonly SelectInputItem<T | undefined>[],\n compareFn: (\n a: SelectInputOptionItem<NonNullable<T>>,\n b: SelectInputOptionItem<NonNullable<T>>,\n searchQuery: string,\n ) => number,\n searchQuery: string,\n): SelectInputItem<NonNullable<T>>[] {\n const flattenedOption = items.flatMap((item) => {\n if (item.type === 'option') {\n return item.value !== undefined ? [item as SelectInputOptionItem<NonNullable<T>>] : [];\n }\n\n if (item.type === 'group') {\n return item.options.filter(\n (option): option is SelectInputOptionItem<NonNullable<T>> => option.value !== undefined,\n );\n }\n\n return [];\n });\n\n // eslint-disable-next-line functional/immutable-data\n return flattenedOption.sort((a, b) => compareFn(a, b, searchQuery));\n}\n\n/**\n * A prebuilt sort function for `sortFilteredOptions` that sorts options by relevance to the search query.\n * Prioritizes: exact matches > starts with > contains > alphabetical.\n *\n * @param getLabel - Function to extract the label string from the option value. Defaults to using `title` property.\n *\n * @example\n * ```tsx\n * <SelectInput\n * filterable\n * sortFilteredOptions={sortByRelevance((value) => value.name)}\n * // ...\n * />\n * ```\n */\nexport function sortByRelevance<T>(\n getLabel: (value: T) => string = (value) => (value as { title: string }).title,\n): (a: SelectInputOptionItem<T>, b: SelectInputOptionItem<T>, searchQuery: string) => number {\n return (a, b, searchQuery) => {\n const normalizedQuery = searchQuery.toLowerCase();\n const labelA = getLabel(a.value).toLowerCase();\n const labelB = getLabel(b.value).toLowerCase();\n\n // Prioritize exact matches\n const aExactMatch = labelA === normalizedQuery;\n const bExactMatch = labelB === normalizedQuery;\n if (aExactMatch && !bExactMatch) return -1;\n if (!aExactMatch && bExactMatch) return 1;\n\n // Then prioritize options where label starts with the search query\n const aStartsWith = labelA.startsWith(normalizedQuery);\n const bStartsWith = labelB.startsWith(normalizedQuery);\n if (aStartsWith && !bStartsWith) return -1;\n if (!aStartsWith && bStartsWith) return 1;\n\n // Then prioritize options where label contains the search query\n const aContains = labelA.includes(normalizedQuery);\n const bContains = labelB.includes(normalizedQuery);\n if (aContains && !bContains) return -1;\n if (!aContains && bContains) return 1;\n\n // Finally sort alphabetically\n return labelA.localeCompare(labelB);\n };\n}\n"],"names":["searchableString","value","trim","replace","normalize","toLowerCase","inferSearchableStrings","Object","values","filter","innerValue","map","dedupeSelectInputOptionItem","item","existingValues","compareValues","isDuplicate","Array","from","some","existingValue","has","add","undefined","dedupeSelectInputItems","items","Set","type","options","option","selectInputOptionItemIncludesNeedle","needle","filterMatchers","haystack","includes","filterSelectInputItems","predicate","sortSelectInputItems","compareFn","searchQuery","flattenedOption","flatMap","sort","a","b","sortByRelevance","getLabel","title","normalizedQuery","labelA","labelB","aExactMatch","bExactMatch","aStartsWith","startsWith","bStartsWith","aContains","bContains","localeCompare"],"mappings":"AAEA;;;;;;;AAOG;AACG,SAAUA,gBAAgBA,CAACC,KAAa,EAAA;EAC5C,OACEA,KAAK,CACFC,IAAI,EAAE,CACNC,OAAO,CAAC,OAAO,EAAE,GAAG;AACrB;GACCC,SAAS,CAAC,KAAK;AAChB;GACCD,OAAO,CAAC,kBAAkB,EAAE,EAAE,CAAC,CAC/BE,WAAW,EAAE;AAEpB;AAEA;;;;;AAKG;AACG,SAAUC,sBAAsBA,CAACL,KAAc,EAAA;AACnD,EAAA,IAAI,OAAOA,KAAK,KAAK,QAAQ,EAAE;AAC7B,IAAA,OAAO,CAACD,gBAAgB,CAACC,KAAK,CAAC,CAAC;AAClC,EAAA;EAEA,IAAI,OAAOA,KAAK,KAAK,QAAQ,IAAIA,KAAK,IAAI,IAAI,EAAE;IAC9C,OAAOM,MAAM,CAACC,MAAM,CAACP,KAAK,CAAC,CACxBQ,MAAM,CAAEC,UAA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AAQ,CAACc,eAAe,CAAC;AAClD,IAAA,IAAIQ,SAAS,IAAI,CAACC,SAAS,EAAE,OAAO,EAAE;AACtC,IAAA,IAAI,CAACD,SAAS,IAAIC,SAAS,EAAE,OAAO,CAAC;AAErC;AACA,IAAA,OAAOR,MAAM,CAACS,aAAa,CAACR,MAAM,CAAC;EACrC,CAAC;AACH;;;;"}
|
|
@@ -25,7 +25,11 @@ function SelectInputTriggerButton({
|
|
|
25
25
|
return /*#__PURE__*/jsxRuntime.jsx(react.ListboxButton, {
|
|
26
26
|
ref: ref,
|
|
27
27
|
as: PolymorphicWithOverrides.PolymorphicWithOverrides,
|
|
28
|
-
role: "combobox"
|
|
28
|
+
role: "combobox"
|
|
29
|
+
// Safari can omit buttons from sequential keyboard navigation unless their
|
|
30
|
+
// focus order is explicit. Zero keeps the trigger in the natural tab order.
|
|
31
|
+
,
|
|
32
|
+
tabIndex: 0,
|
|
29
33
|
__overrides: {
|
|
30
34
|
as,
|
|
31
35
|
size,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectInputTriggerButton.js","sources":["../../../../src/Inputs/SelectInput/TriggerButton/SelectInputTriggerButton.tsx"],"sourcesContent":["import { ListboxButton } from '@headlessui/react';\nimport mergeProps from 'merge-props';\nimport { useContext } from 'react';\nimport { PolymorphicWithOverrides } from '../../../common/PolymorphicWithOverrides/PolymorphicWithOverrides';\nimport { Merge } from '../../../utils';\nimport { SelectInputTriggerButtonPropsContext } from '../SelectInput.contexts';\n\nexport type SelectInputTriggerButtonElementType = React.ElementType;\n\nexport type SelectInputTriggerButtonProps<\n T extends SelectInputTriggerButtonElementType = 'button',\n> = Merge<React.ComponentPropsWithoutRef<T>, { as?: T }>;\n\n/**\n * The trigger button component for SelectInput.\n * Uses Headless UI's ListboxButton with polymorphic support to allow\n * rendering as different element types.\n */\nexport function SelectInputTriggerButton<T extends SelectInputTriggerButtonElementType = 'button'>({\n as = 'button' as T,\n ...restProps\n}: SelectInputTriggerButtonProps<T>) {\n const { ref, onClick, onKeyDown, size, ...interactionProps } = useContext(\n SelectInputTriggerButtonPropsContext,\n );\n\n return (\n <ListboxButton\n ref={ref}\n as={PolymorphicWithOverrides}\n role=\"combobox\"\n __overrides={{ as, size, ...interactionProps }}\n {...mergeProps({ onClick, onKeyDown }, restProps)}\n />\n );\n}\n"],"names":["SelectInputTriggerButton","as","restProps","ref","onClick","onKeyDown","size","interactionProps","useContext","SelectInputTriggerButtonPropsContext","_jsx","ListboxButton","PolymorphicWithOverrides","role","__overrides","mergeProps"],"mappings":";;;;;;;;;;;;;AAkBM,SAAUA,wBAAwBA,CAA2D;AACjGC,EAAAA,EAAE,GAAG,QAAa;EAClB,GAAGC;AAAS,CACqB,EAAA;EACjC,MAAM;IAAEC,GAAG;IAAEC,OAAO;IAAEC,SAAS;IAAEC,IAAI;IAAE,GAAGC;AAAgB,GAAE,GAAGC,gBAAU,CACvEC,yDAAoC,CACrC;EAED,oBACEC,cAAA,CAACC,mBAAa,EAAA;AACZR,IAAAA,GAAG,EAAEA,GAAI;AACTF,IAAAA,EAAE,EAAEW,iDAAyB;AAC7BC,IAAAA,IAAI,EAAC,
|
|
1
|
+
{"version":3,"file":"SelectInputTriggerButton.js","sources":["../../../../src/Inputs/SelectInput/TriggerButton/SelectInputTriggerButton.tsx"],"sourcesContent":["import { ListboxButton } from '@headlessui/react';\nimport mergeProps from 'merge-props';\nimport { useContext } from 'react';\nimport { PolymorphicWithOverrides } from '../../../common/PolymorphicWithOverrides/PolymorphicWithOverrides';\nimport { Merge } from '../../../utils';\nimport { SelectInputTriggerButtonPropsContext } from '../SelectInput.contexts';\n\nexport type SelectInputTriggerButtonElementType = React.ElementType;\n\nexport type SelectInputTriggerButtonProps<\n T extends SelectInputTriggerButtonElementType = 'button',\n> = Merge<React.ComponentPropsWithoutRef<T>, { as?: T }>;\n\n/**\n * The trigger button component for SelectInput.\n * Uses Headless UI's ListboxButton with polymorphic support to allow\n * rendering as different element types.\n */\nexport function SelectInputTriggerButton<T extends SelectInputTriggerButtonElementType = 'button'>({\n as = 'button' as T,\n ...restProps\n}: SelectInputTriggerButtonProps<T>) {\n const { ref, onClick, onKeyDown, size, ...interactionProps } = useContext(\n SelectInputTriggerButtonPropsContext,\n );\n\n return (\n <ListboxButton\n ref={ref}\n as={PolymorphicWithOverrides}\n role=\"combobox\"\n // Safari can omit buttons from sequential keyboard navigation unless their\n // focus order is explicit. Zero keeps the trigger in the natural tab order.\n tabIndex={0}\n __overrides={{ as, size, ...interactionProps }}\n {...mergeProps({ onClick, onKeyDown }, restProps)}\n />\n );\n}\n"],"names":["SelectInputTriggerButton","as","restProps","ref","onClick","onKeyDown","size","interactionProps","useContext","SelectInputTriggerButtonPropsContext","_jsx","ListboxButton","PolymorphicWithOverrides","role","tabIndex","__overrides","mergeProps"],"mappings":";;;;;;;;;;;;;AAkBM,SAAUA,wBAAwBA,CAA2D;AACjGC,EAAAA,EAAE,GAAG,QAAa;EAClB,GAAGC;AAAS,CACqB,EAAA;EACjC,MAAM;IAAEC,GAAG;IAAEC,OAAO;IAAEC,SAAS;IAAEC,IAAI;IAAE,GAAGC;AAAgB,GAAE,GAAGC,gBAAU,CACvEC,yDAAoC,CACrC;EAED,oBACEC,cAAA,CAACC,mBAAa,EAAA;AACZR,IAAAA,GAAG,EAAEA,GAAI;AACTF,IAAAA,EAAE,EAAEW,iDAAyB;AAC7BC,IAAAA,IAAI,EAAC;AACL;AACA;AAAA;AACAC,IAAAA,QAAQ,EAAE,CAAE;AACZC,IAAAA,WAAW,EAAE;MAAEd,EAAE;MAAEK,IAAI;MAAE,GAAGC;KAAmB;AAAA,IAAA,GAC3CS,2BAAU,CAAC;MAAEZ,OAAO;AAAEC,MAAAA;AAAS,KAAE,EAAEH,SAAS;AAAC,GAAC,CAClD;AAEN;;;;"}
|
|
@@ -19,7 +19,11 @@ function SelectInputTriggerButton({
|
|
|
19
19
|
return /*#__PURE__*/jsx(ListboxButton, {
|
|
20
20
|
ref: ref,
|
|
21
21
|
as: PolymorphicWithOverrides,
|
|
22
|
-
role: "combobox"
|
|
22
|
+
role: "combobox"
|
|
23
|
+
// Safari can omit buttons from sequential keyboard navigation unless their
|
|
24
|
+
// focus order is explicit. Zero keeps the trigger in the natural tab order.
|
|
25
|
+
,
|
|
26
|
+
tabIndex: 0,
|
|
23
27
|
__overrides: {
|
|
24
28
|
as,
|
|
25
29
|
size,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectInputTriggerButton.mjs","sources":["../../../../src/Inputs/SelectInput/TriggerButton/SelectInputTriggerButton.tsx"],"sourcesContent":["import { ListboxButton } from '@headlessui/react';\nimport mergeProps from 'merge-props';\nimport { useContext } from 'react';\nimport { PolymorphicWithOverrides } from '../../../common/PolymorphicWithOverrides/PolymorphicWithOverrides';\nimport { Merge } from '../../../utils';\nimport { SelectInputTriggerButtonPropsContext } from '../SelectInput.contexts';\n\nexport type SelectInputTriggerButtonElementType = React.ElementType;\n\nexport type SelectInputTriggerButtonProps<\n T extends SelectInputTriggerButtonElementType = 'button',\n> = Merge<React.ComponentPropsWithoutRef<T>, { as?: T }>;\n\n/**\n * The trigger button component for SelectInput.\n * Uses Headless UI's ListboxButton with polymorphic support to allow\n * rendering as different element types.\n */\nexport function SelectInputTriggerButton<T extends SelectInputTriggerButtonElementType = 'button'>({\n as = 'button' as T,\n ...restProps\n}: SelectInputTriggerButtonProps<T>) {\n const { ref, onClick, onKeyDown, size, ...interactionProps } = useContext(\n SelectInputTriggerButtonPropsContext,\n );\n\n return (\n <ListboxButton\n ref={ref}\n as={PolymorphicWithOverrides}\n role=\"combobox\"\n __overrides={{ as, size, ...interactionProps }}\n {...mergeProps({ onClick, onKeyDown }, restProps)}\n />\n );\n}\n"],"names":["SelectInputTriggerButton","as","restProps","ref","onClick","onKeyDown","size","interactionProps","useContext","SelectInputTriggerButtonPropsContext","_jsx","ListboxButton","PolymorphicWithOverrides","role","__overrides","mergeProps"],"mappings":";;;;;;;AAkBM,SAAUA,wBAAwBA,CAA2D;AACjGC,EAAAA,EAAE,GAAG,QAAa;EAClB,GAAGC;AAAS,CACqB,EAAA;EACjC,MAAM;IAAEC,GAAG;IAAEC,OAAO;IAAEC,SAAS;IAAEC,IAAI;IAAE,GAAGC;AAAgB,GAAE,GAAGC,UAAU,CACvEC,oCAAoC,CACrC;EAED,oBACEC,GAAA,CAACC,aAAa,EAAA;AACZR,IAAAA,GAAG,EAAEA,GAAI;AACTF,IAAAA,EAAE,EAAEW,wBAAyB;AAC7BC,IAAAA,IAAI,EAAC,
|
|
1
|
+
{"version":3,"file":"SelectInputTriggerButton.mjs","sources":["../../../../src/Inputs/SelectInput/TriggerButton/SelectInputTriggerButton.tsx"],"sourcesContent":["import { ListboxButton } from '@headlessui/react';\nimport mergeProps from 'merge-props';\nimport { useContext } from 'react';\nimport { PolymorphicWithOverrides } from '../../../common/PolymorphicWithOverrides/PolymorphicWithOverrides';\nimport { Merge } from '../../../utils';\nimport { SelectInputTriggerButtonPropsContext } from '../SelectInput.contexts';\n\nexport type SelectInputTriggerButtonElementType = React.ElementType;\n\nexport type SelectInputTriggerButtonProps<\n T extends SelectInputTriggerButtonElementType = 'button',\n> = Merge<React.ComponentPropsWithoutRef<T>, { as?: T }>;\n\n/**\n * The trigger button component for SelectInput.\n * Uses Headless UI's ListboxButton with polymorphic support to allow\n * rendering as different element types.\n */\nexport function SelectInputTriggerButton<T extends SelectInputTriggerButtonElementType = 'button'>({\n as = 'button' as T,\n ...restProps\n}: SelectInputTriggerButtonProps<T>) {\n const { ref, onClick, onKeyDown, size, ...interactionProps } = useContext(\n SelectInputTriggerButtonPropsContext,\n );\n\n return (\n <ListboxButton\n ref={ref}\n as={PolymorphicWithOverrides}\n role=\"combobox\"\n // Safari can omit buttons from sequential keyboard navigation unless their\n // focus order is explicit. Zero keeps the trigger in the natural tab order.\n tabIndex={0}\n __overrides={{ as, size, ...interactionProps }}\n {...mergeProps({ onClick, onKeyDown }, restProps)}\n />\n );\n}\n"],"names":["SelectInputTriggerButton","as","restProps","ref","onClick","onKeyDown","size","interactionProps","useContext","SelectInputTriggerButtonPropsContext","_jsx","ListboxButton","PolymorphicWithOverrides","role","tabIndex","__overrides","mergeProps"],"mappings":";;;;;;;AAkBM,SAAUA,wBAAwBA,CAA2D;AACjGC,EAAAA,EAAE,GAAG,QAAa;EAClB,GAAGC;AAAS,CACqB,EAAA;EACjC,MAAM;IAAEC,GAAG;IAAEC,OAAO;IAAEC,SAAS;IAAEC,IAAI;IAAE,GAAGC;AAAgB,GAAE,GAAGC,UAAU,CACvEC,oCAAoC,CACrC;EAED,oBACEC,GAAA,CAACC,aAAa,EAAA;AACZR,IAAAA,GAAG,EAAEA,GAAI;AACTF,IAAAA,EAAE,EAAEW,wBAAyB;AAC7BC,IAAAA,IAAI,EAAC;AACL;AACA;AAAA;AACAC,IAAAA,QAAQ,EAAE,CAAE;AACZC,IAAAA,WAAW,EAAE;MAAEd,EAAE;MAAEK,IAAI;MAAE,GAAGC;KAAmB;AAAA,IAAA,GAC3CS,UAAU,CAAC;MAAEZ,OAAO;AAAEC,MAAAA;AAAS,KAAE,EAAEH,SAAS;AAAC,GAAC,CAClD;AAEN;;;;"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const MAX_ITEMS_WITHOUT_VIRTUALIZATION = 50;
|
|
4
|
+
const TYPEAHEAD_QUERY_RESET_TIMEOUT_MS = 350;
|
|
5
|
+
|
|
6
|
+
exports.MAX_ITEMS_WITHOUT_VIRTUALIZATION = MAX_ITEMS_WITHOUT_VIRTUALIZATION;
|
|
7
|
+
exports.TYPEAHEAD_QUERY_RESET_TIMEOUT_MS = TYPEAHEAD_QUERY_RESET_TIMEOUT_MS;
|
|
8
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sources":["../../../src/Inputs/SelectInput/constants.ts"],"sourcesContent":["export const MAX_ITEMS_WITHOUT_VIRTUALIZATION = 50;\n\nexport const TYPEAHEAD_QUERY_RESET_TIMEOUT_MS = 350;\n"],"names":["MAX_ITEMS_WITHOUT_VIRTUALIZATION","TYPEAHEAD_QUERY_RESET_TIMEOUT_MS"],"mappings":";;AAAO,MAAMA,gCAAgC,GAAG;AAEzC,MAAMC,gCAAgC,GAAG;;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.mjs","sources":["../../../src/Inputs/SelectInput/constants.ts"],"sourcesContent":["export const MAX_ITEMS_WITHOUT_VIRTUALIZATION = 50;\n\nexport const TYPEAHEAD_QUERY_RESET_TIMEOUT_MS = 350;\n"],"names":["MAX_ITEMS_WITHOUT_VIRTUALIZATION","TYPEAHEAD_QUERY_RESET_TIMEOUT_MS"],"mappings":"AAAO,MAAMA,gCAAgC,GAAG;AAEzC,MAAMC,gCAAgC,GAAG;;;;"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var React = require('react');
|
|
4
|
+
var constants = require('../constants.js');
|
|
5
|
+
var SelectInput_utils = require('../SelectInput.utils.js');
|
|
6
|
+
|
|
7
|
+
const resetsTypeaheadQuery = key => key === 'ArrowDown' || key === 'ArrowUp' || key === 'Home' || key === 'End' || key === 'PageDown' || key === 'PageUp';
|
|
8
|
+
const isTypingKey = (event, query = '') => !event.metaKey && !event.ctrlKey && !event.nativeEvent.isComposing && /^.$/u.test(event.key) && (event.key !== ' ' || query !== '');
|
|
9
|
+
function useTypeahead({
|
|
10
|
+
disabled = false,
|
|
11
|
+
onMatch
|
|
12
|
+
} = {}) {
|
|
13
|
+
const queryRef = React.useRef('');
|
|
14
|
+
const timeoutRef = React.useRef(null);
|
|
15
|
+
const resetQuery = React.useCallback(() => {
|
|
16
|
+
queryRef.current = '';
|
|
17
|
+
if (timeoutRef.current != null) {
|
|
18
|
+
clearTimeout(timeoutRef.current);
|
|
19
|
+
timeoutRef.current = null;
|
|
20
|
+
}
|
|
21
|
+
}, []);
|
|
22
|
+
React.useEffect(() => resetQuery, [resetQuery]);
|
|
23
|
+
return React.useCallback(event => {
|
|
24
|
+
if (disabled || !isTypingKey(event, queryRef.current)) {
|
|
25
|
+
if (resetsTypeaheadQuery(event.key)) {
|
|
26
|
+
resetQuery();
|
|
27
|
+
}
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
event.preventDefault();
|
|
31
|
+
event.stopPropagation();
|
|
32
|
+
queryRef.current += event.key;
|
|
33
|
+
const needle = SelectInput_utils.searchableString(queryRef.current);
|
|
34
|
+
if (timeoutRef.current != null) {
|
|
35
|
+
clearTimeout(timeoutRef.current);
|
|
36
|
+
}
|
|
37
|
+
timeoutRef.current = setTimeout(resetQuery, constants.TYPEAHEAD_QUERY_RESET_TIMEOUT_MS);
|
|
38
|
+
const options = Array.from(event.currentTarget.querySelectorAll('[role="option"]:not([aria-disabled="true"])'));
|
|
39
|
+
const optionLabels = options.map(option => SelectInput_utils.searchableString(option.textContent ?? ''));
|
|
40
|
+
const matchingIndex = optionLabels.findIndex(label => label.startsWith(needle));
|
|
41
|
+
const closestIndex = matchingIndex === -1 ? optionLabels.findIndex(label => label.includes(needle)) : matchingIndex;
|
|
42
|
+
if (closestIndex === -1) {
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
options[closestIndex].focus({
|
|
46
|
+
preventScroll: true
|
|
47
|
+
});
|
|
48
|
+
event.currentTarget.focus({
|
|
49
|
+
preventScroll: true
|
|
50
|
+
});
|
|
51
|
+
onMatch?.();
|
|
52
|
+
}, [disabled, onMatch, resetQuery]);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
exports.isTypingKey = isTypingKey;
|
|
56
|
+
exports.useTypeahead = useTypeahead;
|
|
57
|
+
//# sourceMappingURL=useTypeahead.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useTypeahead.js","sources":["../../../../src/Inputs/SelectInput/hooks/useTypeahead.ts"],"sourcesContent":["import { useCallback, useEffect, useRef } from 'react';\n\nimport { TYPEAHEAD_QUERY_RESET_TIMEOUT_MS } from '../constants';\nimport { searchableString } from '../SelectInput.utils';\n\nconst resetsTypeaheadQuery = (key: string) =>\n key === 'ArrowDown' ||\n key === 'ArrowUp' ||\n key === 'Home' ||\n key === 'End' ||\n key === 'PageDown' ||\n key === 'PageUp';\n\nexport const isTypingKey = (event: React.KeyboardEvent, query = '') =>\n !event.metaKey &&\n !event.ctrlKey &&\n !event.nativeEvent.isComposing &&\n /^.$/u.test(event.key) &&\n (event.key !== ' ' || query !== '');\n\ninterface UseTypeaheadParams {\n disabled?: boolean;\n onMatch?: () => void;\n}\n\nexport function useTypeahead({ disabled = false, onMatch }: UseTypeaheadParams = {}) {\n const queryRef = useRef('');\n const timeoutRef = useRef<ReturnType<typeof setTimeout> | null>(null);\n\n const resetQuery = useCallback(() => {\n queryRef.current = '';\n if (timeoutRef.current != null) {\n clearTimeout(timeoutRef.current);\n timeoutRef.current = null;\n }\n }, []);\n\n useEffect(() => resetQuery, [resetQuery]);\n\n return useCallback(\n (event: React.KeyboardEvent<HTMLDivElement>) => {\n if (disabled || !isTypingKey(event, queryRef.current)) {\n if (resetsTypeaheadQuery(event.key)) {\n resetQuery();\n }\n return;\n }\n\n event.preventDefault();\n event.stopPropagation();\n\n queryRef.current += event.key;\n const needle = searchableString(queryRef.current);\n\n if (timeoutRef.current != null) {\n clearTimeout(timeoutRef.current);\n }\n timeoutRef.current = setTimeout(resetQuery, TYPEAHEAD_QUERY_RESET_TIMEOUT_MS);\n\n const options = Array.from(\n event.currentTarget.querySelectorAll<HTMLElement>(\n '[role=\"option\"]:not([aria-disabled=\"true\"])',\n ),\n );\n const optionLabels = options.map((option) => searchableString(option.textContent ?? ''));\n const matchingIndex = optionLabels.findIndex((label) => label.startsWith(needle));\n const closestIndex =\n matchingIndex === -1\n ? optionLabels.findIndex((label) => label.includes(needle))\n : matchingIndex;\n\n if (closestIndex === -1) {\n return;\n }\n\n options[closestIndex].focus({ preventScroll: true });\n event.currentTarget.focus({ preventScroll: true });\n onMatch?.();\n },\n [disabled, onMatch, resetQuery],\n );\n}\n"],"names":["resetsTypeaheadQuery","key","isTypingKey","event","query","metaKey","ctrlKey","nativeEvent","isComposing","test","useTypeahead","disabled","onMatch","queryRef","useRef","timeoutRef","resetQuery","useCallback","current","clearTimeout","useEffect","preventDefault","stopPropagation","needle","searchableString","setTimeout","TYPEAHEAD_QUERY_RESET_TIMEOUT_MS","options","Array","from","currentTarget","querySelectorAll","optionLabels","map","option","textContent","matchingIndex","findIndex","label","startsWith","closestIndex","includes","focus","preventScroll"],"mappings":";;;;;;AAKA,MAAMA,oBAAoB,GAAIC,GAAW,IACvCA,GAAG,KAAK,WAAW,IACnBA,GAAG,KAAK,SAAS,IACjBA,GAAG,KAAK,MAAM,IACdA,GAAG,KAAK,KAAK,IACbA,GAAG,KAAK,UAAU,IAClBA,GAAG,KAAK,QAAQ;AAEX,MAAMC,WAAW,GAAGA,CAACC,KAA0B,EAAEC,KAAK,GAAG,EAAE,KAChE,CAACD,KAAK,CAACE,OAAO,IACd,CAACF,KAAK,CAACG,OAAO,IACd,CAACH,KAAK,CAACI,WAAW,CAACC,WAAW,IAC9B,MAAM,CAACC,IAAI,CAACN,KAAK,CAACF,GAAG,CAAC,KACrBE,KAAK,CAACF,GAAG,KAAK,GAAG,IAAIG,KAAK,KAAK,EAAE;AAO9B,SAAUM,YAAYA,CAAC;AAAEC,EAAAA,QAAQ,GAAG,KAAK;AAAEC,EAAAA;AAAO,CAAA,GAAyB,EAAE,EAAA;AACjF,EAAA,MAAMC,QAAQ,GAAGC,YAAM,CAAC,EAAE,CAAC;AAC3B,EAAA,MAAMC,UAAU,GAAGD,YAAM,CAAuC,IAAI,CAAC;AAErE,EAAA,MAAME,UAAU,GAAGC,iBAAW,CAAC,MAAK;IAClCJ,QAAQ,CAACK,OAAO,GAAG,EAAE;AACrB,IAAA,IAAIH,UAAU,CAACG,OAA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AC;IACjF,MAAMiB,YAAY,GAChBJ,aAAa,KAAK,EAAE,GAChBJ,YAAY,CAACK,SAAS,CAAEC,KAAK,IAAKA,KAAK,CAACG,QAAQ,CAAClB,MAAM,CAAC,CAAC,GACzDa,aAAa;AAEnB,IAAA,IAAII,YAAY,KAAK,EAAE,EAAE;AACvB,MAAA;AACF,IAAA;AAEAb,IAAAA,OAAO,CAACa,YAAY,CAAC,CAACE,KAAK,CAAC;AAAEC,MAAAA,aAAa,EAAE;AAAI,KAAE,CAAC;AACpDxC,IAAAA,KAAK,CAAC2B,aAAa,CAACY,KAAK,CAAC;AAAEC,MAAAA,aAAa,EAAE;AAAI,KAAE,CAAC;AAClD/B,IAAAA,OAAO,IAAI;EACb,CAAC,EACD,CAACD,QAAQ,EAAEC,OAAO,EAAEI,UAAU,CAAC,CAChC;AACH;;;;;"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { useRef, useCallback, useEffect } from 'react';
|
|
2
|
+
import { TYPEAHEAD_QUERY_RESET_TIMEOUT_MS } from '../constants.mjs';
|
|
3
|
+
import { searchableString } from '../SelectInput.utils.mjs';
|
|
4
|
+
|
|
5
|
+
const resetsTypeaheadQuery = key => key === 'ArrowDown' || key === 'ArrowUp' || key === 'Home' || key === 'End' || key === 'PageDown' || key === 'PageUp';
|
|
6
|
+
const isTypingKey = (event, query = '') => !event.metaKey && !event.ctrlKey && !event.nativeEvent.isComposing && /^.$/u.test(event.key) && (event.key !== ' ' || query !== '');
|
|
7
|
+
function useTypeahead({
|
|
8
|
+
disabled = false,
|
|
9
|
+
onMatch
|
|
10
|
+
} = {}) {
|
|
11
|
+
const queryRef = useRef('');
|
|
12
|
+
const timeoutRef = useRef(null);
|
|
13
|
+
const resetQuery = useCallback(() => {
|
|
14
|
+
queryRef.current = '';
|
|
15
|
+
if (timeoutRef.current != null) {
|
|
16
|
+
clearTimeout(timeoutRef.current);
|
|
17
|
+
timeoutRef.current = null;
|
|
18
|
+
}
|
|
19
|
+
}, []);
|
|
20
|
+
useEffect(() => resetQuery, [resetQuery]);
|
|
21
|
+
return useCallback(event => {
|
|
22
|
+
if (disabled || !isTypingKey(event, queryRef.current)) {
|
|
23
|
+
if (resetsTypeaheadQuery(event.key)) {
|
|
24
|
+
resetQuery();
|
|
25
|
+
}
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
event.preventDefault();
|
|
29
|
+
event.stopPropagation();
|
|
30
|
+
queryRef.current += event.key;
|
|
31
|
+
const needle = searchableString(queryRef.current);
|
|
32
|
+
if (timeoutRef.current != null) {
|
|
33
|
+
clearTimeout(timeoutRef.current);
|
|
34
|
+
}
|
|
35
|
+
timeoutRef.current = setTimeout(resetQuery, TYPEAHEAD_QUERY_RESET_TIMEOUT_MS);
|
|
36
|
+
const options = Array.from(event.currentTarget.querySelectorAll('[role="option"]:not([aria-disabled="true"])'));
|
|
37
|
+
const optionLabels = options.map(option => searchableString(option.textContent ?? ''));
|
|
38
|
+
const matchingIndex = optionLabels.findIndex(label => label.startsWith(needle));
|
|
39
|
+
const closestIndex = matchingIndex === -1 ? optionLabels.findIndex(label => label.includes(needle)) : matchingIndex;
|
|
40
|
+
if (closestIndex === -1) {
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
options[closestIndex].focus({
|
|
44
|
+
preventScroll: true
|
|
45
|
+
});
|
|
46
|
+
event.currentTarget.focus({
|
|
47
|
+
preventScroll: true
|
|
48
|
+
});
|
|
49
|
+
onMatch?.();
|
|
50
|
+
}, [disabled, onMatch, resetQuery]);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export { isTypingKey, useTypeahead };
|
|
54
|
+
//# sourceMappingURL=useTypeahead.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useTypeahead.mjs","sources":["../../../../src/Inputs/SelectInput/hooks/useTypeahead.ts"],"sourcesContent":["import { useCallback, useEffect, useRef } from 'react';\n\nimport { TYPEAHEAD_QUERY_RESET_TIMEOUT_MS } from '../constants';\nimport { searchableString } from '../SelectInput.utils';\n\nconst resetsTypeaheadQuery = (key: string) =>\n key === 'ArrowDown' ||\n key === 'ArrowUp' ||\n key === 'Home' ||\n key === 'End' ||\n key === 'PageDown' ||\n key === 'PageUp';\n\nexport const isTypingKey = (event: React.KeyboardEvent, query = '') =>\n !event.metaKey &&\n !event.ctrlKey &&\n !event.nativeEvent.isComposing &&\n /^.$/u.test(event.key) &&\n (event.key !== ' ' || query !== '');\n\ninterface UseTypeaheadParams {\n disabled?: boolean;\n onMatch?: () => void;\n}\n\nexport function useTypeahead({ disabled = false, onMatch }: UseTypeaheadParams = {}) {\n const queryRef = useRef('');\n const timeoutRef = useRef<ReturnType<typeof setTimeout> | null>(null);\n\n const resetQuery = useCallback(() => {\n queryRef.current = '';\n if (timeoutRef.current != null) {\n clearTimeout(timeoutRef.current);\n timeoutRef.current = null;\n }\n }, []);\n\n useEffect(() => resetQuery, [resetQuery]);\n\n return useCallback(\n (event: React.KeyboardEvent<HTMLDivElement>) => {\n if (disabled || !isTypingKey(event, queryRef.current)) {\n if (resetsTypeaheadQuery(event.key)) {\n resetQuery();\n }\n return;\n }\n\n event.preventDefault();\n event.stopPropagation();\n\n queryRef.current += event.key;\n const needle = searchableString(queryRef.current);\n\n if (timeoutRef.current != null) {\n clearTimeout(timeoutRef.current);\n }\n timeoutRef.current = setTimeout(resetQuery, TYPEAHEAD_QUERY_RESET_TIMEOUT_MS);\n\n const options = Array.from(\n event.currentTarget.querySelectorAll<HTMLElement>(\n '[role=\"option\"]:not([aria-disabled=\"true\"])',\n ),\n );\n const optionLabels = options.map((option) => searchableString(option.textContent ?? ''));\n const matchingIndex = optionLabels.findIndex((label) => label.startsWith(needle));\n const closestIndex =\n matchingIndex === -1\n ? optionLabels.findIndex((label) => label.includes(needle))\n : matchingIndex;\n\n if (closestIndex === -1) {\n return;\n }\n\n options[closestIndex].focus({ preventScroll: true });\n event.currentTarget.focus({ preventScroll: true });\n onMatch?.();\n },\n [disabled, onMatch, resetQuery],\n );\n}\n"],"names":["resetsTypeaheadQuery","key","isTypingKey","event","query","metaKey","ctrlKey","nativeEvent","isComposing","test","useTypeahead","disabled","onMatch","queryRef","useRef","timeoutRef","resetQuery","useCallback","current","clearTimeout","useEffect","preventDefault","stopPropagation","needle","searchableString","setTimeout","TYPEAHEAD_QUERY_RESET_TIMEOUT_MS","options","Array","from","currentTarget","querySelectorAll","optionLabels","map","option","textContent","matchingIndex","findIndex","label","startsWith","closestIndex","includes","focus","preventScroll"],"mappings":";;;;AAKA,MAAMA,oBAAoB,GAAIC,GAAW,IACvCA,GAAG,KAAK,WAAW,IACnBA,GAAG,KAAK,SAAS,IACjBA,GAAG,KAAK,MAAM,IACdA,GAAG,KAAK,KAAK,IACbA,GAAG,KAAK,UAAU,IAClBA,GAAG,KAAK,QAAQ;AAEX,MAAMC,WAAW,GAAGA,CAACC,KAA0B,EAAEC,KAAK,GAAG,EAAE,KAChE,CAACD,KAAK,CAACE,OAAO,IACd,CAACF,KAAK,CAACG,OAAO,IACd,CAACH,KAAK,CAACI,WAAW,CAACC,WAAW,IAC9B,MAAM,CAACC,IAAI,CAACN,KAAK,CAACF,GAAG,CAAC,KACrBE,KAAK,CAACF,GAAG,KAAK,GAAG,IAAIG,KAAK,KAAK,EAAE;AAO9B,SAAUM,YAAYA,CAAC;AAAEC,EAAAA,QAAQ,GAAG,KAAK;AAAEC,EAAAA;AAAO,CAAA,GAAyB,EAAE,EAAA;AACjF,EAAA,MAAMC,QAAQ,GAAGC,MAAM,CAAC,EAAE,CAAC;AAC3B,EAAA,MAAMC,UAAU,GAAGD,MAAM,CAAuC,IAAI,CAAC;AAErE,EAAA,MAAME,UAAU,GAAGC,WAAW,CAAC,MAAK;IAClCJ,QAAQ,CAACK,OAAO,GAAG,EAAE;AACrB,IAAA,IAAIH,UAAU,CAACG,OAAO,IAAI,IAAI,EAAE;AAC9BC,MAAAA,YAAY,CAACJ,UAAU,CAACG,OAAO,CAAC;MAChCH,UAAU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AK,IAAKA,KAAK,CAACG,QAAQ,CAAClB,MAAM,CAAC,CAAC,GACzDa,aAAa;AAEnB,IAAA,IAAII,YAAY,KAAK,EAAE,EAAE;AACvB,MAAA;AACF,IAAA;AAEAb,IAAAA,OAAO,CAACa,YAAY,CAAC,CAACE,KAAK,CAAC;AAAEC,MAAAA,aAAa,EAAE;AAAI,KAAE,CAAC;AACpDxC,IAAAA,KAAK,CAAC2B,aAAa,CAACY,KAAK,CAAC;AAAEC,MAAAA,aAAa,EAAE;AAAI,KAAE,CAAC;AAClD/B,IAAAA,OAAO,IAAI;EACb,CAAC,EACD,CAACD,QAAQ,EAAEC,OAAO,EAAEI,UAAU,CAAC,CAChC;AACH;;;;"}
|
package/build/i18n/ja.json
CHANGED
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"neptune.Table.loaded": "テーブルデータが読み込まれました",
|
|
51
51
|
"neptune.Table.loading": "テーブルデータを読み込み中です",
|
|
52
52
|
"neptune.Table.refreshPage": "ページを更新する",
|
|
53
|
-
"neptune.Typeahead.suggestionsLabel": "
|
|
53
|
+
"neptune.Typeahead.suggestionsLabel": "提案",
|
|
54
54
|
"neptune.Upload.csButtonText": "別のファイルをアップロードしますか?",
|
|
55
55
|
"neptune.Upload.csFailureText": "アップロードに失敗しました。もう一度やり直してください。",
|
|
56
56
|
"neptune.Upload.csSuccessText": "アップロードが完了しました。",
|
package/build/i18n/ja.json.js
CHANGED
|
@@ -54,7 +54,7 @@ var ja = {
|
|
|
54
54
|
"neptune.Table.loaded": "テーブルデータが読み込まれました",
|
|
55
55
|
"neptune.Table.loading": "テーブルデータを読み込み中です",
|
|
56
56
|
"neptune.Table.refreshPage": "ページを更新する",
|
|
57
|
-
"neptune.Typeahead.suggestionsLabel": "
|
|
57
|
+
"neptune.Typeahead.suggestionsLabel": "提案",
|
|
58
58
|
"neptune.Upload.csButtonText": "別のファイルをアップロードしますか?",
|
|
59
59
|
"neptune.Upload.csFailureText": "アップロードに失敗しました。もう一度やり直してください。",
|
|
60
60
|
"neptune.Upload.csSuccessText": "アップロードが完了しました。",
|
package/build/i18n/ja.json.mjs
CHANGED
|
@@ -50,7 +50,7 @@ var ja = {
|
|
|
50
50
|
"neptune.Table.loaded": "テーブルデータが読み込まれました",
|
|
51
51
|
"neptune.Table.loading": "テーブルデータを読み込み中です",
|
|
52
52
|
"neptune.Table.refreshPage": "ページを更新する",
|
|
53
|
-
"neptune.Typeahead.suggestionsLabel": "
|
|
53
|
+
"neptune.Typeahead.suggestionsLabel": "提案",
|
|
54
54
|
"neptune.Upload.csButtonText": "別のファイルをアップロードしますか?",
|
|
55
55
|
"neptune.Upload.csFailureText": "アップロードに失敗しました。もう一度やり直してください。",
|
|
56
56
|
"neptune.Upload.csSuccessText": "アップロードが完了しました。",
|
package/build/main.css
CHANGED
|
@@ -22323,6 +22323,16 @@ button.np-option {
|
|
|
22323
22323
|
min-block-size: 128px;
|
|
22324
22324
|
}
|
|
22325
22325
|
}
|
|
22326
|
+
.np-flow-navigation--no-steps {
|
|
22327
|
+
block-size: 80px;
|
|
22328
|
+
min-block-size: 80px;
|
|
22329
|
+
}
|
|
22330
|
+
@media (min-width: 320.02px) {
|
|
22331
|
+
.np-flow-navigation--no-steps {
|
|
22332
|
+
block-size: 80px;
|
|
22333
|
+
min-block-size: 80px;
|
|
22334
|
+
}
|
|
22335
|
+
}
|
|
22326
22336
|
.np-flow-navigation--border-bottom {
|
|
22327
22337
|
border-block-end: 1px solid rgba(0,0,0,0.10196);
|
|
22328
22338
|
border-block-end: 1px solid #0000001a;
|
|
@@ -11,6 +11,16 @@
|
|
|
11
11
|
min-block-size: 128px;
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
|
+
.np-flow-navigation--no-steps {
|
|
15
|
+
block-size: 80px;
|
|
16
|
+
min-block-size: 80px;
|
|
17
|
+
}
|
|
18
|
+
@media (min-width: 320.02px) {
|
|
19
|
+
.np-flow-navigation--no-steps {
|
|
20
|
+
block-size: 80px;
|
|
21
|
+
min-block-size: 80px;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
14
24
|
.np-flow-navigation--border-bottom {
|
|
15
25
|
border-block-end: 1px solid rgba(0,0,0,0.10196);
|
|
16
26
|
border-block-end: 1px solid #0000001a;
|
package/build/styles/main.css
CHANGED
|
@@ -22323,6 +22323,16 @@ button.np-option {
|
|
|
22323
22323
|
min-block-size: 128px;
|
|
22324
22324
|
}
|
|
22325
22325
|
}
|
|
22326
|
+
.np-flow-navigation--no-steps {
|
|
22327
|
+
block-size: 80px;
|
|
22328
|
+
min-block-size: 80px;
|
|
22329
|
+
}
|
|
22330
|
+
@media (min-width: 320.02px) {
|
|
22331
|
+
.np-flow-navigation--no-steps {
|
|
22332
|
+
block-size: 80px;
|
|
22333
|
+
min-block-size: 80px;
|
|
22334
|
+
}
|
|
22335
|
+
}
|
|
22326
22336
|
.np-flow-navigation--border-bottom {
|
|
22327
22337
|
border-block-end: 1px solid rgba(0,0,0,0.10196);
|
|
22328
22338
|
border-block-end: 1px solid #0000001a;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FlowNavigation.d.ts","sourceRoot":"","sources":["../../../src/FlowNavigation/FlowNavigation.tsx"],"names":[],"mappings":"AAQA,OAAgB,EAAE,KAAK,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAWxD,MAAM,WAAW,mBAAmB;IAClC,iBAAiB;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACzB,wBAAwB;IACxB,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACvB,qBAAqB;IACrB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,2FAA2F;IAC3F,OAAO,CAAC,EAAE,CAAC,MAAM,IAAI,CAAC,GAAG,KAAK,CAAC,iBAAiB,CAAC,iBAAiB,CAAC,CAAC;IACpE,sIAAsI;IACtI,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,iFAAiF;IACjF,KAAK,CAAC,EAAE,SAAS,IAAI,EAAE,CAAC;IACxB;;;OAGG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B;AAED,QAAA,MAAM,cAAc,GAAI,iFASrB,mBAAmB,
|
|
1
|
+
{"version":3,"file":"FlowNavigation.d.ts","sourceRoot":"","sources":["../../../src/FlowNavigation/FlowNavigation.tsx"],"names":[],"mappings":"AAQA,OAAgB,EAAE,KAAK,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAWxD,MAAM,WAAW,mBAAmB;IAClC,iBAAiB;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACzB,wBAAwB;IACxB,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACvB,qBAAqB;IACrB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,2FAA2F;IAC3F,OAAO,CAAC,EAAE,CAAC,MAAM,IAAI,CAAC,GAAG,KAAK,CAAC,iBAAiB,CAAC,iBAAiB,CAAC,CAAC;IACpE,sIAAsI;IACtI,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,iFAAiF;IACjF,KAAK,CAAC,EAAE,SAAS,IAAI,EAAE,CAAC;IACxB;;;OAGG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B;AAED,QAAA,MAAM,cAAc,GAAI,iFASrB,mBAAmB,gCA2ErB,CAAC;AAEF,eAAe,cAAc,CAAC"}
|
|
@@ -6,7 +6,9 @@ export interface SelectInputOptionsProps<T = string> extends Pick<SelectInputPro
|
|
|
6
6
|
searchInputRef: React.MutableRefObject<HTMLInputElement | null>;
|
|
7
7
|
listboxRef: React.MutableRefObject<HTMLDivElement | null>;
|
|
8
8
|
filterQuery: string;
|
|
9
|
+
initialTypeaheadKey?: string | null;
|
|
9
10
|
onFilterChange: (query: string) => void;
|
|
11
|
+
onInitialTypeaheadHandled?: () => void;
|
|
10
12
|
listBoxLabel?: string;
|
|
11
13
|
listBoxLabelledBy?: string;
|
|
12
14
|
autocomplete?: string;
|
|
@@ -17,5 +19,5 @@ export interface SelectInputOptionsProps<T = string> extends Pick<SelectInputPro
|
|
|
17
19
|
* The main options container component for SelectInput.
|
|
18
20
|
* Manages filtering, virtualisation, and rendering of options.
|
|
19
21
|
*/
|
|
20
|
-
export declare function SelectInputOptions<T = string>({ id, parentId, items, compareValues: compareValuesProp, renderValue, renderFooter, filterable, filterPlaceholder, sortFilteredOptions, searchInputRef, listboxRef, filterQuery, onFilterChange, listBoxLabel, listBoxLabelledBy, autocomplete, name, onAutocompleteSelect, }: SelectInputOptionsProps<T>): import("react").JSX.Element;
|
|
22
|
+
export declare function SelectInputOptions<T = string>({ id, parentId, items, compareValues: compareValuesProp, renderValue, renderFooter, filterable, filterPlaceholder, sortFilteredOptions, searchInputRef, listboxRef, filterQuery, initialTypeaheadKey, onFilterChange, onInitialTypeaheadHandled, listBoxLabel, listBoxLabelledBy, autocomplete, name, onAutocompleteSelect, }: SelectInputOptionsProps<T>): import("react").JSX.Element;
|
|
21
23
|
//# sourceMappingURL=SelectInputOptions.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectInputOptions.d.ts","sourceRoot":"","sources":["../../../../../src/Inputs/SelectInput/Options/SelectInputOptions.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SelectInputOptions.d.ts","sourceRoot":"","sources":["../../../../../src/Inputs/SelectInput/Options/SelectInputOptions.tsx"],"names":[],"mappings":"AAqBA,OAAO,EAAyB,gBAAgB,EAAmB,MAAM,sBAAsB,CAAC;AAMhG;;GAEG;AACH,MAAM,WAAW,uBAAuB,CAAC,CAAC,GAAG,MAAM,CAAE,SAAQ,IAAI,CAC/D,gBAAgB,CAAC,CAAC,CAAC,EACjB,OAAO,GACP,aAAa,GACb,cAAc,GACd,YAAY,GACZ,mBAAmB,GACnB,IAAI,GACJ,UAAU,GACV,eAAe,GACf,qBAAqB,CACxB;IACC,cAAc,EAAE,KAAK,CAAC,gBAAgB,CAAC,gBAAgB,GAAG,IAAI,CAAC,CAAC;IAChE,UAAU,EAAE,KAAK,CAAC,gBAAgB,CAAC,cAAc,GAAG,IAAI,CAAC,CAAC;IAC1D,WAAW,EAAE,MAAM,CAAC;IACpB,mBAAmB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACpC,cAAc,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC,yBAAyB,CAAC,EAAE,MAAM,IAAI,CAAC;IACvC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,oBAAoB,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,CAAC;CAC3C;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,CAAC,GAAG,MAAM,EAAE,EAC7C,EAAE,EACF,QAAQ,EACR,KAAK,EACL,aAAa,EAAE,iBAAiB,EAChC,WAAoB,EACpB,YAAY,EACZ,UAAkB,EAClB,iBAAiB,EACjB,mBAAmB,EACnB,cAAc,EACd,UAAU,EACV,WAAW,EACX,mBAAmB,EACnB,cAAc,EACd,yBAAyB,EACzB,YAAY,EACZ,iBAAiB,EACjB,YAAY,EACZ,IAAI,EACJ,oBAAoB,GACrB,EAAE,uBAAuB,CAAC,CAAC,CAAC,+BAwX5B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectInput.d.ts","sourceRoot":"","sources":["../../../../src/Inputs/SelectInput/SelectInput.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SelectInput.d.ts","sourceRoot":"","sources":["../../../../src/Inputs/SelectInput/SelectInput.tsx"],"names":[],"mappings":"AAmBA,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAIvD;;;GAGG;AACH,wBAAgB,WAAW,CAAC,CAAC,GAAG,MAAM,EAAE,CAAC,SAAS,OAAO,GAAG,KAAK,EAAE,EACjE,EAAE,EAAE,MAAM,EACV,QAAQ,EACR,IAAI,EACJ,QAAQ,EACR,WAAW,EACX,YAAY,EACZ,KAAK,EACL,YAAY,EACZ,KAAK,EAAE,eAAe,EACtB,aAAa,EACb,WAAoB,EACpB,YAAY,EACZ,aAAoC,EACpC,UAAU,EACV,iBAAiB,EACjB,mBAAmB,EACnB,QAAQ,EACR,IAAW,EACX,SAAS,EACT,yBAAyB,EACzB,UAAU,EAAE,kBAAkB,EAC9B,cAAqB,EACrB,QAAQ,EACR,MAAM,EACN,OAAO,EACP,OAAO,GACR,EAAE,gBAAgB,CAAC,CAAC,EAAE,CAAC,CAAC,+BAuOxB;yBAlQe,WAAW"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectInput.utils.d.ts","sourceRoot":"","sources":["../../../../src/Inputs/SelectInput/SelectInput.utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAE7E
|
|
1
|
+
{"version":3,"file":"SelectInput.utils.d.ts","sourceRoot":"","sources":["../../../../src/Inputs/SelectInput/SelectInput.utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAE7E;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,UAW7C;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,OAAO,YAYpD;AAED;;GAEG;AACH,wBAAgB,2BAA2B,CAAC,CAAC,EAC3C,IAAI,EAAE,qBAAqB,CAAC,CAAC,CAAC,EAC9B,cAAc,EAAE,GAAG,CAAC,CAAC,CAAC,EACtB,aAAa,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,EA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AW,EAAE,MAAM,KAAK,MAAM,CA2B3F"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectInputTriggerButton.d.ts","sourceRoot":"","sources":["../../../../../src/Inputs/SelectInput/TriggerButton/SelectInputTriggerButton.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAGvC,MAAM,MAAM,mCAAmC,GAAG,KAAK,CAAC,WAAW,CAAC;AAEpE,MAAM,MAAM,6BAA6B,CACvC,CAAC,SAAS,mCAAmC,GAAG,QAAQ,IACtD,KAAK,CAAC,KAAK,CAAC,wBAAwB,CAAC,CAAC,CAAC,EAAE;IAAE,EAAE,CAAC,EAAE,CAAC,CAAA;CAAE,CAAC,CAAC;AAEzD;;;;GAIG;AACH,wBAAgB,wBAAwB,CAAC,CAAC,SAAS,mCAAmC,GAAG,QAAQ,EAAE,EACjG,EAAkB,EAClB,GAAG,SAAS,EACb,EAAE,6BAA6B,CAAC,CAAC,CAAC,+
|
|
1
|
+
{"version":3,"file":"SelectInputTriggerButton.d.ts","sourceRoot":"","sources":["../../../../../src/Inputs/SelectInput/TriggerButton/SelectInputTriggerButton.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAGvC,MAAM,MAAM,mCAAmC,GAAG,KAAK,CAAC,WAAW,CAAC;AAEpE,MAAM,MAAM,6BAA6B,CACvC,CAAC,SAAS,mCAAmC,GAAG,QAAQ,IACtD,KAAK,CAAC,KAAK,CAAC,wBAAwB,CAAC,CAAC,CAAC,EAAE;IAAE,EAAE,CAAC,EAAE,CAAC,CAAA;CAAE,CAAC,CAAC;AAEzD;;;;GAIG;AACH,wBAAgB,wBAAwB,CAAC,CAAC,SAAS,mCAAmC,GAAG,QAAQ,EAAE,EACjG,EAAkB,EAClB,GAAG,SAAS,EACb,EAAE,6BAA6B,CAAC,CAAC,CAAC,+BAiBlC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../src/Inputs/SelectInput/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,gCAAgC,KAAK,CAAC;AAEnD,eAAO,MAAM,gCAAgC,MAAM,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare const isTypingKey: (event: React.KeyboardEvent, query?: string) => boolean;
|
|
2
|
+
interface UseTypeaheadParams {
|
|
3
|
+
disabled?: boolean;
|
|
4
|
+
onMatch?: () => void;
|
|
5
|
+
}
|
|
6
|
+
export declare function useTypeahead({ disabled, onMatch }?: UseTypeaheadParams): (event: React.KeyboardEvent<HTMLDivElement>) => void;
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=useTypeahead.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useTypeahead.d.ts","sourceRoot":"","sources":["../../../../../src/Inputs/SelectInput/hooks/useTypeahead.ts"],"names":[],"mappings":"AAaA,eAAO,MAAM,WAAW,GAAI,OAAO,KAAK,CAAC,aAAa,EAAE,cAAU,YAK7B,CAAC;AAEtC,UAAU,kBAAkB;IAC1B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB;AAED,wBAAgB,YAAY,CAAC,EAAE,QAAgB,EAAE,OAAO,EAAE,GAAE,kBAAuB,WAevE,KAAK,CAAC,aAAa,CAAC,cAAc,CAAC,UAyC9C"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@transferwise/components",
|
|
3
|
-
"version": "46.160.
|
|
3
|
+
"version": "46.160.4",
|
|
4
4
|
"description": "Neptune React components",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -91,8 +91,8 @@
|
|
|
91
91
|
"storybook": "^10.5.4",
|
|
92
92
|
"storybook-addon-tag-badges": "^3.1.0",
|
|
93
93
|
"storybook-addon-test-codegen": "^3.0.4",
|
|
94
|
-
"@transferwise/less-config": "3.2.0",
|
|
95
94
|
"@wise/components-theming": "1.10.3",
|
|
95
|
+
"@transferwise/less-config": "3.2.0",
|
|
96
96
|
"@wise/wds-configs": "0.0.0"
|
|
97
97
|
},
|
|
98
98
|
"peerDependencies": {
|
|
@@ -11,6 +11,16 @@
|
|
|
11
11
|
min-block-size: 128px;
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
|
+
.np-flow-navigation--no-steps {
|
|
15
|
+
block-size: 80px;
|
|
16
|
+
min-block-size: 80px;
|
|
17
|
+
}
|
|
18
|
+
@media (min-width: 320.02px) {
|
|
19
|
+
.np-flow-navigation--no-steps {
|
|
20
|
+
block-size: 80px;
|
|
21
|
+
min-block-size: 80px;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
14
24
|
.np-flow-navigation--border-bottom {
|
|
15
25
|
border-block-end: 1px solid rgba(0,0,0,0.10196);
|
|
16
26
|
border-block-end: 1px solid #0000001a;
|
|
@@ -15,6 +15,17 @@
|
|
|
15
15
|
min-height: 128px;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
+
// When there are no steps, use 80px height on all screen sizes
|
|
19
|
+
&--no-steps {
|
|
20
|
+
height: 80px;
|
|
21
|
+
min-height: 80px;
|
|
22
|
+
|
|
23
|
+
@media (--screen-xs) {
|
|
24
|
+
height: 80px;
|
|
25
|
+
min-height: 80px;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
18
29
|
&--border-bottom {
|
|
19
30
|
border-bottom: 1px solid var(--color-border-neutral);
|
|
20
31
|
}
|
|
@@ -52,10 +52,11 @@ const FlowNavigation = ({
|
|
|
52
52
|
const screenSm = useScreenSize(Breakpoint.SMALL);
|
|
53
53
|
const screenLg = useScreenSize(Breakpoint.LARGE);
|
|
54
54
|
|
|
55
|
-
const
|
|
55
|
+
const hasSteps = steps && steps.length > 0;
|
|
56
|
+
const displayGoBack = onGoBack != null && activeStep > 0;
|
|
56
57
|
|
|
58
|
+
const closeButton = onClose != null && <CloseButton size="lg" onClick={onClose} />;
|
|
57
59
|
const newAvatar = done ? null : avatar;
|
|
58
|
-
const displayGoBack = onGoBack != null && activeStep > 0;
|
|
59
60
|
|
|
60
61
|
const flowHeaderContent = (
|
|
61
62
|
<FlowHeader
|
|
@@ -85,7 +86,7 @@ const FlowNavigation = ({
|
|
|
85
86
|
) : (
|
|
86
87
|
<div className="np-flow-header__left">{logo}</div>
|
|
87
88
|
)}
|
|
88
|
-
{!screenSm && !done &&
|
|
89
|
+
{!screenSm && !done && hasSteps && (
|
|
89
90
|
<AnimatedLabel className="m-x-1" steps={steps} activeLabel={activeStep} />
|
|
90
91
|
)}
|
|
91
92
|
</>
|
|
@@ -98,7 +99,7 @@ const FlowNavigation = ({
|
|
|
98
99
|
</div>
|
|
99
100
|
}
|
|
100
101
|
bottomContent={
|
|
101
|
-
!done &&
|
|
102
|
+
!done && hasSteps ? (
|
|
102
103
|
<Stepper
|
|
103
104
|
activeStep={activeStep}
|
|
104
105
|
steps={steps}
|
|
@@ -115,6 +116,7 @@ const FlowNavigation = ({
|
|
|
115
116
|
size="fluid"
|
|
116
117
|
className={clsx('np-flow-navigation', {
|
|
117
118
|
'np-flow-navigation--border-bottom': showBottomBorder,
|
|
119
|
+
'np-flow-navigation--no-steps': !hasSteps || done,
|
|
118
120
|
})}
|
|
119
121
|
>
|
|
120
122
|
{flowHeaderContent}
|