@redsift/pickers 11.6.0-muiv5-alpha.10 → 11.6.0-muiv5-alpha.11
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/{_internal → _virtual/_internal}/_rollupPluginBabelHelpers.js +1 -1
- package/{_internal → components/combobox/_internal}/Combobox2.js +6 -5
- package/components/combobox/_internal/Combobox2.js.map +1 -0
- package/components/combobox/_internal/combobox.js +3 -0
- package/components/combobox/_internal/context.js +6 -0
- package/components/combobox/_internal/context.js.map +1 -0
- package/{_internal → components/combobox/_internal}/types.js +1 -5
- package/components/combobox/_internal/types.js.map +1 -0
- package/components/combobox/intl/_internal/en-US.js +13 -0
- package/components/combobox/intl/_internal/en-US.js.map +1 -0
- package/components/combobox/intl/_internal/fr-FR.js +13 -0
- package/components/combobox/intl/_internal/fr-FR.js.map +1 -0
- package/components/combobox/intl/index.js +10 -0
- package/components/combobox/intl/index.js.map +1 -0
- package/{_internal → components/combobox-content/_internal}/ComboboxContent.js +6 -6
- package/components/combobox-content/_internal/ComboboxContent.js.map +1 -0
- package/components/combobox-content/_internal/combobox-content.js +2 -0
- package/{_internal → components/combobox-content-footer/_internal}/ComboboxContentFooter.js +3 -11
- package/components/combobox-content-footer/_internal/ComboboxContentFooter.js.map +1 -0
- package/components/combobox-content-footer/_internal/combobox-content-footer.js +2 -0
- package/components/combobox-content-footer/_internal/styles.js +12 -0
- package/components/combobox-content-footer/_internal/styles.js.map +1 -0
- package/{_internal → components/combobox-content-header/_internal}/ComboboxContentHeader.js +3 -11
- package/components/combobox-content-header/_internal/ComboboxContentHeader.js.map +1 -0
- package/components/combobox-content-header/_internal/combobox-content-header.js +2 -0
- package/components/combobox-content-header/_internal/styles.js +12 -0
- package/components/combobox-content-header/_internal/styles.js.map +1 -0
- package/{_internal → components/combobox-content-listbox/_internal}/ComboboxContentListbox.js +4 -3
- package/components/combobox-content-listbox/_internal/ComboboxContentListbox.js.map +1 -0
- package/components/combobox-content-listbox/_internal/combobox-content-listbox.js +2 -0
- package/{_internal → components/combobox-trigger/_internal}/ComboboxTrigger.js +5 -30
- package/components/combobox-trigger/_internal/ComboboxTrigger.js.map +1 -0
- package/components/combobox-trigger/_internal/combobox-trigger.js +2 -0
- package/{_internal → components/item/_internal}/Item2.js +6 -68
- package/components/item/_internal/Item2.js.map +1 -0
- package/components/item/_internal/item.js +2 -0
- package/components/item/_internal/useMenuItem.js +69 -0
- package/components/item/_internal/useMenuItem.js.map +1 -0
- package/{_internal → components/menu-button/_internal}/MenuButton.js +5 -4
- package/components/menu-button/_internal/MenuButton.js.map +1 -0
- package/components/menu-button/_internal/context.js +6 -0
- package/components/menu-button/_internal/context.js.map +1 -0
- package/components/menu-button/_internal/menu-button.js +2 -0
- package/{_internal → components/menu-button-content/_internal}/MenuButtonContent.js +5 -5
- package/components/menu-button-content/_internal/MenuButtonContent.js.map +1 -0
- package/components/menu-button-content/_internal/menu-button-content.js +2 -0
- package/{_internal → components/menu-button-content-footer/_internal}/MenuButtonContentFooter.js +3 -11
- package/components/menu-button-content-footer/_internal/MenuButtonContentFooter.js.map +1 -0
- package/components/menu-button-content-footer/_internal/menu-button-content-footer.js +2 -0
- package/components/menu-button-content-footer/_internal/styles.js +12 -0
- package/components/menu-button-content-footer/_internal/styles.js.map +1 -0
- package/{_internal → components/menu-button-content-header/_internal}/MenuButtonContentHeader.js +3 -11
- package/components/menu-button-content-header/_internal/MenuButtonContentHeader.js.map +1 -0
- package/components/menu-button-content-header/_internal/menu-button-content-header.js +2 -0
- package/components/menu-button-content-header/_internal/styles.js +12 -0
- package/components/menu-button-content-header/_internal/styles.js.map +1 -0
- package/{_internal → components/menu-button-content-menu/_internal}/MenuButtonContentMenu.js +2 -2
- package/components/menu-button-content-menu/_internal/MenuButtonContentMenu.js.map +1 -0
- package/components/menu-button-content-menu/_internal/menu-button-content-menu.js +2 -0
- package/{_internal → components/menu-button-trigger/_internal}/MenuButtonTrigger.js +3 -4
- package/components/menu-button-trigger/_internal/MenuButtonTrigger.js.map +1 -0
- package/components/menu-button-trigger/_internal/menu-button-trigger.js +2 -0
- package/{_internal → components/select/_internal}/Select2.js +5 -4
- package/components/select/_internal/Select2.js.map +1 -0
- package/components/select/_internal/context.js +6 -0
- package/components/select/_internal/context.js.map +1 -0
- package/components/select/_internal/select.js +2 -0
- package/{_internal → components/select-content/_internal}/SelectContent.js +2 -2
- package/components/select-content/_internal/SelectContent.js.map +1 -0
- package/components/select-content/_internal/select-content.js +2 -0
- package/{_internal → components/select-trigger/_internal}/SelectTrigger.js +3 -4
- package/components/select-trigger/_internal/SelectTrigger.js.map +1 -0
- package/components/select-trigger/_internal/select-trigger.js +2 -0
- package/index.js +17 -17
- package/package.json +5 -5
- package/_internal/Combobox2.js.map +0 -1
- package/_internal/ComboboxContent.js.map +0 -1
- package/_internal/ComboboxContentFooter.js.map +0 -1
- package/_internal/ComboboxContentHeader.js.map +0 -1
- package/_internal/ComboboxContentListbox.js.map +0 -1
- package/_internal/ComboboxTrigger.js.map +0 -1
- package/_internal/Item2.js.map +0 -1
- package/_internal/MenuButton.js.map +0 -1
- package/_internal/MenuButtonContent.js.map +0 -1
- package/_internal/MenuButtonContentFooter.js.map +0 -1
- package/_internal/MenuButtonContentHeader.js.map +0 -1
- package/_internal/MenuButtonContentMenu.js.map +0 -1
- package/_internal/MenuButtonTrigger.js.map +0 -1
- package/_internal/Select2.js.map +0 -1
- package/_internal/SelectContent.js.map +0 -1
- package/_internal/SelectTrigger.js.map +0 -1
- package/_internal/combobox-content-footer.js +0 -2
- package/_internal/combobox-content-header.js +0 -2
- package/_internal/combobox-content-listbox.js +0 -2
- package/_internal/combobox-content.js +0 -2
- package/_internal/combobox-trigger.js +0 -2
- package/_internal/combobox.js +0 -3
- package/_internal/item.js +0 -2
- package/_internal/menu-button-content-footer.js +0 -2
- package/_internal/menu-button-content-header.js +0 -2
- package/_internal/menu-button-content-menu.js +0 -2
- package/_internal/menu-button-content.js +0 -2
- package/_internal/menu-button-trigger.js +0 -2
- package/_internal/menu-button.js +0 -2
- package/_internal/select-content.js +0 -2
- package/_internal/select-trigger.js +0 -2
- package/_internal/select.js +0 -2
- package/_internal/types.js.map +0 -1
- /package/{_internal → _virtual/_internal}/_rollupPluginBabelHelpers.js.map +0 -0
- /package/{_internal → components/combobox/_internal}/combobox.js.map +0 -0
- /package/{_internal → components/combobox-content/_internal}/combobox-content.js.map +0 -0
- /package/{_internal → components/combobox-content-footer/_internal}/combobox-content-footer.js.map +0 -0
- /package/{_internal → components/combobox-content-header/_internal}/combobox-content-header.js.map +0 -0
- /package/{_internal → components/combobox-content-listbox/_internal}/combobox-content-listbox.js.map +0 -0
- /package/{_internal → components/combobox-trigger/_internal}/combobox-trigger.js.map +0 -0
- /package/{_internal → components/item/_internal}/item.js.map +0 -0
- /package/{_internal → components/menu-button/_internal}/menu-button.js.map +0 -0
- /package/{_internal → components/menu-button-content/_internal}/menu-button-content.js.map +0 -0
- /package/{_internal → components/menu-button-content-footer/_internal}/menu-button-content-footer.js.map +0 -0
- /package/{_internal → components/menu-button-content-header/_internal}/menu-button-content-header.js.map +0 -0
- /package/{_internal → components/menu-button-content-menu/_internal}/menu-button-content-menu.js.map +0 -0
- /package/{_internal → components/menu-button-trigger/_internal}/menu-button-trigger.js.map +0 -0
- /package/{_internal → components/select/_internal}/select.js.map +0 -0
- /package/{_internal → components/select-content/_internal}/select-content.js.map +0 -0
- /package/{_internal → components/select-trigger/_internal}/select-trigger.js.map +0 -0
|
@@ -89,5 +89,5 @@ function _toPropertyKey(arg) {
|
|
|
89
89
|
return typeof key === "symbol" ? key : String(key);
|
|
90
90
|
}
|
|
91
91
|
|
|
92
|
-
export {
|
|
92
|
+
export { _defineProperty as defineProperty, _extends as extends, _objectSpread2 as objectSpread2, _objectWithoutProperties as objectWithoutProperties, _objectWithoutPropertiesLoose as objectWithoutPropertiesLoose, _toPrimitive as toPrimitive, _toPropertyKey as toPropertyKey };
|
|
93
93
|
//# sourceMappingURL=_rollupPluginBabelHelpers.js.map
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { extends as _extends } from '../../../_virtual/_internal/_rollupPluginBabelHelpers.js';
|
|
2
2
|
import React, { useState, useEffect, useReducer, useMemo, useRef } from 'react';
|
|
3
|
-
import {
|
|
3
|
+
import { ComboboxSelectionMode, ComboboxVariant } from './types.js';
|
|
4
4
|
import { Popover } from '@redsift/popovers';
|
|
5
|
+
import { ComboboxContext } from './context.js';
|
|
5
6
|
import { useTheme, ListboxReducer, ListboxActionType, useId, ThemeProvider, FocusWithinGroup, ListboxContext, Flexbox, Text, Theme } from '@redsift/design-system';
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
7
|
+
import { ComboboxTrigger } from '../../combobox-trigger/_internal/ComboboxTrigger.js';
|
|
8
|
+
import { ComboboxContent } from '../../combobox-content/_internal/ComboboxContent.js';
|
|
8
9
|
|
|
9
10
|
const COMPONENT_NAME = 'Combobox';
|
|
10
11
|
const CLASSNAME = 'redsift-combobox';
|
|
@@ -146,5 +147,5 @@ const Combobox = Object.assign(BaseCombobox, {
|
|
|
146
147
|
Content: ComboboxContent
|
|
147
148
|
});
|
|
148
149
|
|
|
149
|
-
export { BaseCombobox
|
|
150
|
+
export { BaseCombobox, Combobox };
|
|
150
151
|
//# sourceMappingURL=Combobox2.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Combobox2.js","sources":["../../../../src/components/combobox/Combobox.tsx"],"sourcesContent":["import React, { RefObject, useEffect, useMemo, useReducer, useRef, useState } from 'react';\nimport { ComboboxContent } from '../combobox-content';\nimport { ComboboxTrigger } from '../combobox-trigger';\n\nimport { ComboboxProps, ComboboxSelectionMode, ComboboxValue, ComboboxVariant } from './types';\nimport { Popover } from '@redsift/popovers';\nimport { ComboboxContext } from './context';\nimport {\n ListboxReducer,\n ListboxState,\n ListboxContextProps,\n FocusWithinGroup,\n ListboxContext,\n Flexbox,\n Text,\n ListboxActionType,\n Theme,\n useTheme,\n ThemeProvider,\n useId,\n} from '@redsift/design-system';\n\nconst COMPONENT_NAME = 'Combobox';\nconst CLASSNAME = 'redsift-combobox';\n\n/**\n * The Combobox component.\n */\nexport const BaseCombobox: React.FC<ComboboxProps> & {\n displayName?: string;\n className?: string;\n} = (props) => {\n const {\n defaultValue,\n description,\n descriptionProps,\n filter = {\n type: 'startsWith',\n caseSensitive: false,\n },\n formRef,\n submitRef,\n inputValue: propsInputValue,\n isDisabled,\n isInvalid,\n maxOptionsLength,\n minWidth = 'trigger-width',\n onChange,\n onInputChange,\n selectionMode = ComboboxSelectionMode.single,\n theme: propsTheme,\n triggerClassName,\n value,\n variant = ComboboxVariant.options,\n wrapperProps,\n } = props;\n\n const theme = useTheme(propsTheme);\n\n const [selectedValue, setValue] = useState<ComboboxValue>(\n value || defaultValue || (selectionMode === 'multiple' ? [] : '')\n );\n const [inputValue, setInputValue] = useState<string>(propsInputValue || '');\n useEffect(() => {\n if (value) {\n state.setValue(value);\n }\n }, [value]);\n useEffect(() => {\n if (propsInputValue) {\n state.setInputValue(propsInputValue);\n }\n }, [propsInputValue]);\n\n /** Listbox context */\n const [listboxState, listboxDispatch] = useReducer(ListboxReducer, {\n isDisabled,\n selectedValues: selectionMode === ComboboxSelectionMode.multiple ? selectedValue : [selectedValue],\n selectionMode,\n } as ListboxState);\n const listboxContext = useMemo<ListboxContextProps>(\n () => ({\n state: listboxState,\n dispatch: listboxDispatch,\n }),\n [listboxState]\n );\n useEffect(() => {\n listboxDispatch({\n type: ListboxActionType.UPDATE_OPTIONS,\n payload: {\n isDisabled: isDisabled || false,\n },\n });\n }, [isDisabled]);\n\n const freeTextItemRef = useRef<HTMLDivElement>();\n const [freeTextItemId] = useId();\n\n /** Combobox context. */\n const state = {\n filter,\n formRef,\n submitRef,\n value: selectedValue,\n inputValue,\n isDisabled: isDisabled || false,\n isInvalid: isInvalid || false,\n selectionMode,\n variant,\n freeTextItemRef: freeTextItemRef as RefObject<HTMLDivElement>,\n freeTextItemId,\n triggerClassName,\n setValue(value: ComboboxValue) {\n if (isDisabled) {\n return;\n }\n\n const previousValue = selectedValue;\n setValue(value);\n if (value !== previousValue && onChange) {\n onChange(value);\n }\n },\n setInputValue(value: string) {\n if (isDisabled) {\n return;\n }\n\n const previousValue = inputValue;\n setInputValue(value);\n if (value !== previousValue && onInputChange) {\n onInputChange(value);\n }\n },\n };\n\n return (\n <ThemeProvider value={{ theme }}>\n <FocusWithinGroup focusType=\"virtual-focus\" focusOnInit={false} maxOptionsLength={maxOptionsLength}>\n <ComboboxContext.Provider value={state}>\n <ListboxContext.Provider value={listboxContext}>\n <Flexbox flexDirection=\"column\" alignItems=\"flex-start\" gap=\"0px\" {...wrapperProps}>\n <Popover\n theme={theme}\n overrideDisplayName={{ content: 'ComboboxContent', trigger: 'ComboboxTrigger' }}\n placement=\"bottom-start\"\n role=\"listbox\"\n minWidth={minWidth}\n {...props}\n />\n {description && typeof description === 'string' ? (\n <Text\n theme={theme}\n marginTop=\"8px\"\n variant=\"caption\"\n color={isInvalid ? 'error' : theme === Theme.light ? 'dark-grey' : 'white'}\n {...descriptionProps}\n >\n {description}\n </Text>\n ) : React.isValidElement(description) ? (\n description\n ) : null}\n </Flexbox>\n </ListboxContext.Provider>\n </ComboboxContext.Provider>\n </FocusWithinGroup>\n </ThemeProvider>\n );\n};\nBaseCombobox.className = CLASSNAME;\nBaseCombobox.displayName = COMPONENT_NAME;\n\nexport const Combobox = Object.assign(BaseCombobox, {\n Trigger: ComboboxTrigger,\n Content: ComboboxContent,\n});\n"],"names":["COMPONENT_NAME","CLASSNAME","BaseCombobox","props","defaultValue","description","descriptionProps","filter","type","caseSensitive","formRef","submitRef","inputValue","propsInputValue","isDisabled","isInvalid","maxOptionsLength","minWidth","onChange","onInputChange","selectionMode","ComboboxSelectionMode","single","theme","propsTheme","triggerClassName","value","variant","ComboboxVariant","options","wrapperProps","useTheme","selectedValue","setValue","useState","setInputValue","useEffect","state","listboxState","listboxDispatch","useReducer","ListboxReducer","selectedValues","multiple","listboxContext","useMemo","dispatch","ListboxActionType","UPDATE_OPTIONS","payload","freeTextItemRef","useRef","freeTextItemId","useId","previousValue","React","createElement","ThemeProvider","FocusWithinGroup","focusType","focusOnInit","ComboboxContext","Provider","ListboxContext","Flexbox","_extends","flexDirection","alignItems","gap","Popover","overrideDisplayName","content","trigger","placement","role","Text","marginTop","color","Theme","light","isValidElement","className","displayName","Combobox","Object","assign","Trigger","ComboboxTrigger","Content","ComboboxContent"],"mappings":";;;;;;;;;AAsBA,MAAMA,cAAc,GAAG,UAAU,CAAA;AACjC,MAAMC,SAAS,GAAG,kBAAkB,CAAA;;AAEpC;AACA;AACA;AACaC,MAAAA,YAGZ,GAAIC,KAAK,IAAK;EACb,MAAM;IACJC,YAAY;IACZC,WAAW;IACXC,gBAAgB;AAChBC,IAAAA,MAAM,GAAG;AACPC,MAAAA,IAAI,EAAE,YAAY;AAClBC,MAAAA,aAAa,EAAE,KAAA;KAChB;IACDC,OAAO;IACPC,SAAS;AACTC,IAAAA,UAAU,EAAEC,eAAe;IAC3BC,UAAU;IACVC,SAAS;IACTC,gBAAgB;AAChBC,IAAAA,QAAQ,GAAG,eAAe;IAC1BC,QAAQ;IACRC,aAAa;IACbC,aAAa,GAAGC,qBAAqB,CAACC,MAAM;AAC5CC,IAAAA,KAAK,EAAEC,UAAU;IACjBC,gBAAgB;IAChBC,KAAK;IACLC,OAAO,GAAGC,eAAe,CAACC,OAAO;AACjCC,IAAAA,YAAAA;AACF,GAAC,GAAG3B,KAAK,CAAA;AAET,EAAA,MAAMoB,KAAK,GAAGQ,QAAQ,CAACP,UAAU,CAAC,CAAA;EAElC,MAAM,CAACQ,aAAa,EAAEC,QAAQ,CAAC,GAAGC,QAAQ,CACxCR,KAAK,IAAItB,YAAY,KAAKgB,aAAa,KAAK,UAAU,GAAG,EAAE,GAAG,EAAE,CAClE,CAAC,CAAA;EACD,MAAM,CAACR,UAAU,EAAEuB,aAAa,CAAC,GAAGD,QAAQ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AACC,MAAM,CAACnF,YAAY,EAAE;AAClDoF,EAAAA,OAAO,EAAEC,eAAe;AACxBC,EAAAA,OAAO,EAAEC,eAAAA;AACX,CAAC;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.js","sources":["../../../../src/components/combobox/context.ts"],"sourcesContent":["import React from 'react';\nimport { ComboboxState } from './types';\n\nexport const ComboboxContext = React.createContext<ComboboxState | null>(null);\n"],"names":["ComboboxContext","React","createContext"],"mappings":";;AAGO,MAAMA,eAAe,gBAAGC,KAAK,CAACC,aAAa,CAAuB,IAAI;;;;"}
|
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
|
|
3
|
-
const ComboboxContext = /*#__PURE__*/React.createContext(null);
|
|
4
|
-
|
|
5
1
|
/**
|
|
6
2
|
* Component variant.
|
|
7
3
|
*/
|
|
@@ -22,5 +18,5 @@ const ComboboxVariant = {
|
|
|
22
18
|
* Component props.
|
|
23
19
|
*/
|
|
24
20
|
|
|
25
|
-
export { ComboboxSelectionMode
|
|
21
|
+
export { ComboboxSelectionMode, ComboboxVariant };
|
|
26
22
|
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sources":["../../../../src/components/combobox/types.ts"],"sourcesContent":["import { FlexboxProps, TextProps, Theme, ValueOf } from '@redsift/design-system';\nimport { PopoverProps } from '@redsift/popovers';\nimport { ReactElement, RefObject } from 'react';\n\n/**\n * Component variant.\n */\nexport const ComboboxSelectionMode = {\n single: 'single',\n multiple: 'multiple',\n} as const;\nexport type ComboboxSelectionMode = ValueOf<typeof ComboboxSelectionMode>;\n\nexport const ComboboxVariant = {\n options: 'options',\n suggestions: 'suggestions',\n} as const;\nexport type ComboboxVariant = ValueOf<typeof ComboboxVariant>;\n\nexport type ComboboxValue = string | string[];\n\n/**\n * Context props.\n */\nexport type ComboboxState = {\n /** Filtering parameters. */\n readonly filter?: {\n type: 'startsWith' | 'contains' | 'endsWith';\n caseSensitive?: boolean;\n };\n /** Whether the combobox is disabled or not. */\n readonly isDisabled: boolean;\n /** Whether the combobox is invalid or not. */\n readonly isInvalid: boolean;\n /** Sets the selected value. */\n setValue(value: ComboboxValue): void;\n /** Current selected value. */\n readonly value: ComboboxValue;\n /** Sets the input value. */\n setInputValue(inputValue: string): void;\n /** Current input value. */\n readonly inputValue: string;\n /** Whether the Combobox allow multiple selection or not. */\n selectionMode?: ComboboxSelectionMode;\n /** If 'options', the input field cannot have free text, the selection has to be made within the options. If 'suggestions', then choosing from the list isn't mandatory and the user can write free text within the input. */\n variant?: ComboboxVariant;\n /** Ref to the first item used to create values. */\n freeTextItemRef?: RefObject<HTMLDivElement>;\n /** Id of the first item used to create values. */\n freeTextItemId?: string;\n /** Class name to append to the trigger. */\n readonly triggerClassName?: string;\n /** Ref to the form, if any. */\n formRef?: RefObject<HTMLFormElement>;\n /** Ref to the submit button, if any. */\n submitRef?: RefObject<HTMLButtonElement>;\n};\n\n/**\n * Component props.\n */\nexport interface ComboboxProps extends PopoverProps {\n /** If 'options', the input field cannot have free text, the selection has to be made within the options. If 'suggestions', then choosing from the list isn't mandatory and the user can write free text within the input. */\n variant?: ComboboxVariant;\n /**\n * Default selected value.\n * Used for uncontrolled version.\n */\n defaultValue?: ComboboxValue;\n /** Description of the combobox. */\n description?: string | ReactElement;\n /** Additional description properties. */\n descriptionProps?: Omit<TextProps, 'ref'>;\n /** Filtering parameters. */\n filter?: {\n type: 'startsWith' | 'contains' | 'endsWith';\n caseSensitive?: boolean;\n };\n /** Ref to the form, if any. */\n formRef?: RefObject<HTMLFormElement>;\n /** Ref to the submit button, if any. */\n submitRef?: RefObject<HTMLButtonElement>;\n /** Whether the component is disabled or not. */\n isDisabled?: boolean;\n /** Whether the component is invalid or not. */\n isInvalid?: boolean;\n /** Maximum number of options displayed. Useful when too many options are displayed. */\n maxOptionsLength?: number;\n /** Method to handle selection change. */\n onChange?(value: ComboboxValue): void;\n /** Method to handle input change. */\n onInputChange?(value: string): void;\n /**\n * Currently selected value.\n * Used for controlled version.\n */\n value?: ComboboxValue;\n /** Input value. */\n inputValue?: string;\n /** Whether the Combobox allow multiple selection or not. */\n selectionMode?: ComboboxSelectionMode;\n /** Theme. */\n theme?: Theme;\n /** Class name to append to the trigger. */\n triggerClassName?: string;\n /** Props to forward to the wrapper. */\n wrapperProps?: Omit<FlexboxProps, 'ref'>;\n}\n\nexport type StyledComboboxProps = ComboboxProps;\n"],"names":["ComboboxSelectionMode","single","multiple","ComboboxVariant","options","suggestions"],"mappings":"AAIA;AACA;AACA;AACO,MAAMA,qBAAqB,GAAG;AACnCC,EAAAA,MAAM,EAAE,QAAQ;AAChBC,EAAAA,QAAQ,EAAE,UAAA;AACZ,EAAU;AAGH,MAAMC,eAAe,GAAG;AAC7BC,EAAAA,OAAO,EAAE,SAAS;AAClBC,EAAAA,WAAW,EAAE,aAAA;AACf,EAAU;;AAKV;AACA;AACA;;AAmCA;AACA;AACA;;;;"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
var collapse = "Collapse";
|
|
2
|
+
var expand = "Expand";
|
|
3
|
+
var selected = "{count, plural, =0 {None selected} other {# selected}}";
|
|
4
|
+
var unselect = "Unselect {label}";
|
|
5
|
+
var enUS = {
|
|
6
|
+
collapse: collapse,
|
|
7
|
+
expand: expand,
|
|
8
|
+
selected: selected,
|
|
9
|
+
unselect: unselect
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export { collapse, enUS as default, expand, selected, unselect };
|
|
13
|
+
//# sourceMappingURL=en-US.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"en-US.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
var collapse = "Réduire";
|
|
2
|
+
var expand = "Développer";
|
|
3
|
+
var selected = "{count, plural, =0 {Aucun sélectionné} =1 {1 sélectionné} other {# sélectionnés}}";
|
|
4
|
+
var unselect = "Déselectionner {label}";
|
|
5
|
+
var frFR = {
|
|
6
|
+
collapse: collapse,
|
|
7
|
+
expand: expand,
|
|
8
|
+
selected: selected,
|
|
9
|
+
unselect: unselect
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export { collapse, frFR as default, expand, selected, unselect };
|
|
13
|
+
//# sourceMappingURL=fr-FR.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fr-FR.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/components/combobox/intl/index.ts"],"sourcesContent":["import enUS from './en-US.json';\nimport frFR from './fr-FR.json';\n\nexport default {\n 'en-US': enUS,\n 'fr-FR': frFR,\n};\n"],"names":["enUS","frFR"],"mappings":";;;AAGA,mBAAe;AACb,EAAA,OAAO,EAAEA,IAAI;AACb,EAAA,OAAO,EAAEC,IAAAA;AACX,CAAC;;;;"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { extends as _extends, objectSpread2 as _objectSpread2 } from '../../../_virtual/_internal/_rollupPluginBabelHelpers.js';
|
|
2
2
|
import React, { forwardRef, useContext } from 'react';
|
|
3
3
|
import classNames from 'classnames';
|
|
4
4
|
import { getContainerProps, AppContainerContext, FocusWithinGroupContext, ListboxContext, useTheme, partitionComponents, isComponent, Flexbox } from '@redsift/design-system';
|
|
5
5
|
import { usePopoverContext, useMergeRefs, FloatingPortal, StyledPopoverContent, PopoverContent } from '@redsift/popovers';
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
6
|
+
import { ComboboxContentListbox } from '../../combobox-content-listbox/_internal/ComboboxContentListbox.js';
|
|
7
|
+
import { ComboboxContext } from '../../combobox/_internal/context.js';
|
|
8
|
+
import { ComboboxContentHeader } from '../../combobox-content-header/_internal/ComboboxContentHeader.js';
|
|
9
|
+
import { ComboboxContentFooter } from '../../combobox-content-footer/_internal/ComboboxContentFooter.js';
|
|
10
10
|
|
|
11
11
|
const COMPONENT_NAME = 'ComboboxContent';
|
|
12
12
|
const CLASSNAME = 'redsift-combobox-content';
|
|
@@ -66,5 +66,5 @@ const ComboboxContent = Object.assign(BaseComboboxContent, {
|
|
|
66
66
|
Footer: ComboboxContentFooter
|
|
67
67
|
});
|
|
68
68
|
|
|
69
|
-
export { BaseComboboxContent
|
|
69
|
+
export { BaseComboboxContent, ComboboxContent };
|
|
70
70
|
//# sourceMappingURL=ComboboxContent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ComboboxContent.js","sources":["../../../../src/components/combobox-content/ComboboxContent.tsx"],"sourcesContent":["import React, { forwardRef, useContext } from 'react';\nimport classNames from 'classnames';\n\nimport {\n AppContainerContext,\n Comp,\n Flexbox,\n FocusWithinGroupContext,\n ListboxContext,\n getContainerProps,\n isComponent,\n partitionComponents,\n useTheme,\n} from '@redsift/design-system';\nimport { ComboboxContentProps } from './types';\nimport {\n FloatingPortal,\n PopoverContent,\n usePopoverContext,\n StyledPopoverContent,\n useMergeRefs,\n} from '@redsift/popovers';\nimport { ComboboxContentHeader } from '../combobox-content-header';\nimport { ComboboxContentFooter } from '../combobox-content-footer';\nimport { ComboboxContentListbox } from '../combobox-content-listbox/ComboboxContentListbox';\nimport { ComboboxContext } from '../combobox/context';\n\nconst COMPONENT_NAME = 'ComboboxContent';\nconst CLASSNAME = 'redsift-combobox-content';\n\n/**\n * The ComboboxContent component.\n */\nexport const BaseComboboxContent: Comp<ComboboxContentProps, HTMLDivElement> = forwardRef((props, ref) => {\n const { children, className, style } = props;\n const containerProps = getContainerProps(props);\n\n const { getFloatingProps, isOpen, refs, strategy, x, y } = usePopoverContext();\n const popoverRef = useMergeRefs([refs.setFloating, ref]);\n\n const appContainerState = useContext(AppContainerContext);\n const comboboxState = useContext(ComboboxContext);\n const focusContext = useContext(FocusWithinGroupContext);\n const listboxState = useContext(ListboxContext);\n const theme = useTheme();\n\n const [[header], [listbox], [footer]] = partitionComponents(React.Children.toArray(children), [\n isComponent('ComboboxContentHeader'),\n isComponent('ComboboxContentListbox'),\n isComponent('ComboboxContentFooter'),\n ]);\n\n return (\n <FloatingPortal root={appContainerState?.appContainerRef.current}>\n {isOpen && (\n <StyledPopoverContent\n $theme={theme!}\n ref={popoverRef}\n {...getFloatingProps(props)}\n style={{\n position: strategy,\n top: y ?? 0,\n left: x ?? 0,\n ...style,\n ...(comboboxState?.inputValue?.length && focusContext.state.tabStops.length === 0\n ? { display: 'none' }\n : {}),\n }}\n className={classNames(PopoverContent.className, BaseComboboxContent.className, className)}\n aria-disabled={listboxState.state.isDisabled}\n >\n <Flexbox flexDirection=\"column\" gap=\"0px\" width=\"100%\" {...containerProps}>\n {header}\n {listbox}\n {footer}\n </Flexbox>\n </StyledPopoverContent>\n )}\n </FloatingPortal>\n );\n});\nBaseComboboxContent.className = CLASSNAME;\nBaseComboboxContent.displayName = COMPONENT_NAME;\n\nexport const ComboboxContent = Object.assign(BaseComboboxContent, {\n Header: ComboboxContentHeader,\n Listbox: ComboboxContentListbox,\n Footer: ComboboxContentFooter,\n});\n"],"names":["COMPONENT_NAME","CLASSNAME","BaseComboboxContent","forwardRef","props","ref","_comboboxState$inputV","children","className","style","containerProps","getContainerProps","getFloatingProps","isOpen","refs","strategy","x","y","usePopoverContext","popoverRef","useMergeRefs","setFloating","appContainerState","useContext","AppContainerContext","comboboxState","ComboboxContext","focusContext","FocusWithinGroupContext","listboxState","ListboxContext","theme","useTheme","header","listbox","footer","partitionComponents","React","Children","toArray","isComponent","createElement","FloatingPortal","root","appContainerRef","current","StyledPopoverContent","_extends","$theme","_objectSpread","position","top","left","inputValue","length","state","tabStops","display","classNames","PopoverContent","isDisabled","Flexbox","flexDirection","gap","width","displayName","ComboboxContent","Object","assign","Header","ComboboxContentHeader","Listbox","ComboboxContentListbox","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,OAAO,EAAAd,QAAA,CAAA;AAACe,IAAAA,aAAa,EAAC,QAAQ;AAACC,IAAAA,GAAG,EAAC,KAAK;AAACC,IAAAA,KAAK,EAAC,MAAA;GAAWtD,EAAAA,cAAc,GACtEuB,MAAM,EACNC,OAAO,EACPC,MACM,CACW,CAEV,CAAC,CAAA;AAErB,CAAC,EAAC;AACFjC,mBAAmB,CAACM,SAAS,GAAGP,SAAS,CAAA;AACzCC,mBAAmB,CAAC+D,WAAW,GAAGjE,cAAc,CAAA;AAEzC,MAAMkE,eAAe,GAAGC,MAAM,CAACC,MAAM,CAAClE,mBAAmB,EAAE;AAChEmE,EAAAA,MAAM,EAAEC,qBAAqB;AAC7BC,EAAAA,OAAO,EAAEC,sBAAsB;AAC/BC,EAAAA,MAAM,EAAEC,qBAAAA;AACV,CAAC;;;;"}
|
|
@@ -1,15 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { objectWithoutProperties as _objectWithoutProperties, extends as _extends } from '../../../_virtual/_internal/_rollupPluginBabelHelpers.js';
|
|
2
2
|
import React, { forwardRef } from 'react';
|
|
3
3
|
import classNames from 'classnames';
|
|
4
|
-
import
|
|
5
|
-
import { baseContainer } from '@redsift/design-system';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Component style.
|
|
9
|
-
*/
|
|
10
|
-
const StyledComboboxContentFooter = styled.div`
|
|
11
|
-
${baseContainer}
|
|
12
|
-
`;
|
|
4
|
+
import { StyledComboboxContentFooter } from './styles.js';
|
|
13
5
|
|
|
14
6
|
const _excluded = ["children", "className"];
|
|
15
7
|
const COMPONENT_NAME = 'ComboboxContentFooter';
|
|
@@ -32,5 +24,5 @@ const ComboboxContentFooter = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
32
24
|
ComboboxContentFooter.className = CLASSNAME;
|
|
33
25
|
ComboboxContentFooter.displayName = COMPONENT_NAME;
|
|
34
26
|
|
|
35
|
-
export { ComboboxContentFooter
|
|
27
|
+
export { ComboboxContentFooter };
|
|
36
28
|
//# sourceMappingURL=ComboboxContentFooter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ComboboxContentFooter.js","sources":["../../../../src/components/combobox-content-footer/ComboboxContentFooter.tsx"],"sourcesContent":["import React, { forwardRef, RefObject } from 'react';\nimport classNames from 'classnames';\n\nimport { StyledComboboxContentFooter } from './styles';\nimport { ComboboxContentFooterProps } from './types';\nimport { Comp } from '@redsift/design-system';\n\nconst COMPONENT_NAME = 'ComboboxContentFooter';\nconst CLASSNAME = 'redsift-combobox-content-footer';\n\n/**\n * The ComboboxContentFooter component.\n */\nexport const ComboboxContentFooter: Comp<ComboboxContentFooterProps, HTMLDivElement> = forwardRef((props, ref) => {\n const { children, className, ...forwardedProps } = props;\n\n return (\n <StyledComboboxContentFooter\n {...forwardedProps}\n className={classNames(ComboboxContentFooter.className, className)}\n ref={ref as RefObject<HTMLDivElement>}\n >\n {children}\n </StyledComboboxContentFooter>\n );\n});\nComboboxContentFooter.className = CLASSNAME;\nComboboxContentFooter.displayName = COMPONENT_NAME;\n"],"names":["COMPONENT_NAME","CLASSNAME","ComboboxContentFooter","forwardRef","props","ref","children","className","forwardedProps","_objectWithoutProperties","_excluded","React","createElement","StyledComboboxContentFooter","_extends","classNames","displayName"],"mappings":";;;;;;AAOA,MAAMA,cAAc,GAAG,uBAAuB,CAAA;AAC9C,MAAMC,SAAS,GAAG,iCAAiC,CAAA;;AAEnD;AACA;AACA;AACO,MAAMC,qBAAuE,gBAAGC,UAAU,CAAC,CAACC,KAAK,EAAEC,GAAG,KAAK;EAChH,MAAM;MAAEC,QAAQ;AAAEC,MAAAA,SAAAA;AAA6B,KAAC,GAAGH,KAAK;AAAxBI,IAAAA,cAAc,GAAAC,wBAAA,CAAKL,KAAK,EAAAM,SAAA,CAAA,CAAA;EAExD,oBACEC,KAAA,CAAAC,aAAA,CAACC,2BAA2B,EAAAC,QAAA,KACtBN,cAAc,EAAA;IAClBD,SAAS,EAAEQ,UAAU,CAACb,qBAAqB,CAACK,SAAS,EAAEA,SAAS,CAAE;AAClEF,IAAAA,GAAG,EAAEA,GAAAA;AAAiC,GAAA,CAAA,EAErCC,QAC0B,CAAC,CAAA;AAElC,CAAC,EAAC;AACFJ,qBAAqB,CAACK,SAAS,GAAGN,SAAS,CAAA;AAC3CC,qBAAqB,CAACc,WAAW,GAAGhB,cAAc;;;;"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import styled from 'styled-components';
|
|
2
|
+
import { baseContainer } from '@redsift/design-system';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Component style.
|
|
6
|
+
*/
|
|
7
|
+
const StyledComboboxContentFooter = styled.div`
|
|
8
|
+
${baseContainer}
|
|
9
|
+
`;
|
|
10
|
+
|
|
11
|
+
export { StyledComboboxContentFooter };
|
|
12
|
+
//# sourceMappingURL=styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"styles.js","sources":["../../../../src/components/combobox-content-footer/styles.ts"],"sourcesContent":["import styled from 'styled-components';\nimport { StyledComboboxContentFooterProps } from './types';\nimport { baseContainer } from '@redsift/design-system';\n\n/**\n * Component style.\n */\nexport const StyledComboboxContentFooter = styled.div<StyledComboboxContentFooterProps>`\n ${baseContainer}\n`;\n"],"names":["StyledComboboxContentFooter","styled","div","baseContainer"],"mappings":";;;AAIA;AACA;AACA;AACaA,MAAAA,2BAA2B,GAAGC,MAAM,CAACC,GAAsC,CAAA;AACxF,EAAA,EAAIC,aAAc,CAAA;AAClB;;;;"}
|
|
@@ -1,15 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { objectWithoutProperties as _objectWithoutProperties, extends as _extends } from '../../../_virtual/_internal/_rollupPluginBabelHelpers.js';
|
|
2
2
|
import React, { forwardRef } from 'react';
|
|
3
3
|
import classNames from 'classnames';
|
|
4
|
-
import
|
|
5
|
-
import { baseContainer } from '@redsift/design-system';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Component style.
|
|
9
|
-
*/
|
|
10
|
-
const StyledComboboxContentHeader = styled.div`
|
|
11
|
-
${baseContainer}
|
|
12
|
-
`;
|
|
4
|
+
import { StyledComboboxContentHeader } from './styles.js';
|
|
13
5
|
|
|
14
6
|
const _excluded = ["children", "className"];
|
|
15
7
|
const COMPONENT_NAME = 'ComboboxContentHeader';
|
|
@@ -32,5 +24,5 @@ const ComboboxContentHeader = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
32
24
|
ComboboxContentHeader.className = CLASSNAME;
|
|
33
25
|
ComboboxContentHeader.displayName = COMPONENT_NAME;
|
|
34
26
|
|
|
35
|
-
export { ComboboxContentHeader
|
|
27
|
+
export { ComboboxContentHeader };
|
|
36
28
|
//# sourceMappingURL=ComboboxContentHeader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ComboboxContentHeader.js","sources":["../../../../src/components/combobox-content-header/ComboboxContentHeader.tsx"],"sourcesContent":["import React, { forwardRef, RefObject } from 'react';\nimport classNames from 'classnames';\n\nimport { StyledComboboxContentHeader } from './styles';\nimport { ComboboxContentHeaderProps } from './types';\nimport { Comp } from '@redsift/design-system';\n\nconst COMPONENT_NAME = 'ComboboxContentHeader';\nconst CLASSNAME = 'redsift-combobox-content-header';\n\n/**\n * The ComboboxContentHeader component.\n */\nexport const ComboboxContentHeader: Comp<ComboboxContentHeaderProps, HTMLDivElement> = forwardRef((props, ref) => {\n const { children, className, ...forwardedProps } = props;\n\n return (\n <StyledComboboxContentHeader\n {...forwardedProps}\n className={classNames(ComboboxContentHeader.className, className)}\n ref={ref as RefObject<HTMLDivElement>}\n >\n {children}\n </StyledComboboxContentHeader>\n );\n});\nComboboxContentHeader.className = CLASSNAME;\nComboboxContentHeader.displayName = COMPONENT_NAME;\n"],"names":["COMPONENT_NAME","CLASSNAME","ComboboxContentHeader","forwardRef","props","ref","children","className","forwardedProps","_objectWithoutProperties","_excluded","React","createElement","StyledComboboxContentHeader","_extends","classNames","displayName"],"mappings":";;;;;;AAOA,MAAMA,cAAc,GAAG,uBAAuB,CAAA;AAC9C,MAAMC,SAAS,GAAG,iCAAiC,CAAA;;AAEnD;AACA;AACA;AACO,MAAMC,qBAAuE,gBAAGC,UAAU,CAAC,CAACC,KAAK,EAAEC,GAAG,KAAK;EAChH,MAAM;MAAEC,QAAQ;AAAEC,MAAAA,SAAAA;AAA6B,KAAC,GAAGH,KAAK;AAAxBI,IAAAA,cAAc,GAAAC,wBAAA,CAAKL,KAAK,EAAAM,SAAA,CAAA,CAAA;EAExD,oBACEC,KAAA,CAAAC,aAAA,CAACC,2BAA2B,EAAAC,QAAA,KACtBN,cAAc,EAAA;IAClBD,SAAS,EAAEQ,UAAU,CAACb,qBAAqB,CAACK,SAAS,EAAEA,SAAS,CAAE;AAClEF,IAAAA,GAAG,EAAEA,GAAAA;AAAiC,GAAA,CAAA,EAErCC,QAC0B,CAAC,CAAA;AAElC,CAAC,EAAC;AACFJ,qBAAqB,CAACK,SAAS,GAAGN,SAAS,CAAA;AAC3CC,qBAAqB,CAACc,WAAW,GAAGhB,cAAc;;;;"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import styled from 'styled-components';
|
|
2
|
+
import { baseContainer } from '@redsift/design-system';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Component style.
|
|
6
|
+
*/
|
|
7
|
+
const StyledComboboxContentHeader = styled.div`
|
|
8
|
+
${baseContainer}
|
|
9
|
+
`;
|
|
10
|
+
|
|
11
|
+
export { StyledComboboxContentHeader };
|
|
12
|
+
//# sourceMappingURL=styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"styles.js","sources":["../../../../src/components/combobox-content-header/styles.ts"],"sourcesContent":["import styled from 'styled-components';\nimport { StyledComboboxContentHeaderProps } from './types';\nimport { baseContainer } from '@redsift/design-system';\n\n/**\n * Component style.\n */\nexport const StyledComboboxContentHeader = styled.div<StyledComboboxContentHeaderProps>`\n ${baseContainer}\n`;\n"],"names":["StyledComboboxContentHeader","styled","div","baseContainer"],"mappings":";;;AAIA;AACA;AACA;AACaA,MAAAA,2BAA2B,GAAGC,MAAM,CAACC,GAAsC,CAAA;AACxF,EAAA,EAAIC,aAAc,CAAA;AAClB;;;;"}
|
package/{_internal → components/combobox-content-listbox/_internal}/ComboboxContentListbox.js
RENAMED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { objectWithoutProperties as _objectWithoutProperties, extends as _extends } from '../../../_virtual/_internal/_rollupPluginBabelHelpers.js';
|
|
2
2
|
import React, { forwardRef, useContext, useEffect } from 'react';
|
|
3
3
|
import classNames from 'classnames';
|
|
4
4
|
import { FocusWithinGroupContext, ListboxContext, isComponent, Item, useListboxItem, useTheme, Flexbox, StyledItem } from '@redsift/design-system';
|
|
5
|
-
import {
|
|
5
|
+
import { ComboboxContext } from '../../combobox/_internal/context.js';
|
|
6
|
+
import { ComboboxSelectionMode, ComboboxVariant } from '../../combobox/_internal/types.js';
|
|
6
7
|
|
|
7
8
|
const _excluded = ["children", "className", "renderFreeTextItem"];
|
|
8
9
|
const COMPONENT_NAME = 'ComboboxContentListbox';
|
|
@@ -119,5 +120,5 @@ const ComboboxContentListbox = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
119
120
|
ComboboxContentListbox.className = CLASSNAME;
|
|
120
121
|
ComboboxContentListbox.displayName = COMPONENT_NAME;
|
|
121
122
|
|
|
122
|
-
export { ComboboxContentListbox
|
|
123
|
+
export { ComboboxContentListbox };
|
|
123
124
|
//# sourceMappingURL=ComboboxContentListbox.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ComboboxContentListbox.js","sources":["../../../../src/components/combobox-content-listbox/ComboboxContentListbox.tsx"],"sourcesContent":["import React, { ReactNode, forwardRef, useContext, useEffect, RefObject, ReactElement } from 'react';\nimport classNames from 'classnames';\n\nimport {\n Comp,\n Flexbox,\n FocusWithinGroupContext,\n Item,\n ListboxContext,\n StyledItem,\n isComponent,\n useListboxItem,\n useTheme,\n} from '@redsift/design-system';\nimport { ComboboxContentListboxProps } from './types';\nimport { ComboboxContext } from '../combobox/context';\nimport { ComboboxSelectionMode, ComboboxVariant } from '../combobox/types';\n\nconst COMPONENT_NAME = 'ComboboxContentListbox';\nconst CLASSNAME = 'redsift-combobox-content-listbox';\n\n/**\n * The ComboboxContentListbox component.\n */\nexport const ComboboxContentListbox: Comp<ComboboxContentListboxProps, HTMLDivElement> = forwardRef((props, ref) => {\n const { children, className, renderFreeTextItem, ...forwardedProps } = props;\n\n const focusContext = useContext(FocusWithinGroupContext);\n const listboxState = useContext(ListboxContext);\n const comboboxState = useContext(ComboboxContext);\n\n useEffect(() => {\n if (focusContext && focusContext.state.delayedAction && focusContext.state.tabStops.length) {\n focusContext.dispatch(focusContext.state.delayedAction);\n }\n });\n\n const canHaveMultipleSelections = comboboxState?.selectionMode === ComboboxSelectionMode.multiple;\n const canHaveFreeText = comboboxState?.variant === ComboboxVariant.suggestions;\n\n const cloneChildAndPush = (child: ReactElement, array: Array<ReactNode>) => {\n if (\n !canHaveMultipleSelections ||\n !canHaveFreeText ||\n (canHaveMultipleSelections && canHaveFreeText && !(comboboxState.value as string[]).includes(child.props.value))\n ) {\n array.push(\n React.cloneElement(child, {\n key: child.props.value,\n hasCheckbox: canHaveMultipleSelections && !canHaveFreeText,\n })\n );\n }\n };\n const renderedChildren: Array<ReactNode> = [];\n if (Array.isArray(children)) {\n for (const child of children) {\n if (isComponent(Item)(child)) {\n if (focusContext.state.maxOptionsLength) {\n if (renderedChildren.length < focusContext.state.maxOptionsLength) {\n if (!focusContext.state.filter) {\n cloneChildAndPush(child, renderedChildren);\n } else {\n const { value: filterValue, type, caseSensitive } = focusContext.state.filter;\n\n if (!filterValue) {\n cloneChildAndPush(child, renderedChildren);\n } else if (\n caseSensitive &&\n ((type === 'startsWith' && child.props.value!.startsWith(filterValue)) ||\n (type === 'contains' && child.props.value!.includes(filterValue)) ||\n (type === 'endsWith' && child.props.value!.endsWith(filterValue)))\n ) {\n cloneChildAndPush(child, renderedChildren);\n } else if (\n !caseSensitive &&\n ((type === 'startsWith' && child.props.value!.toLowerCase().startsWith(filterValue.toLowerCase())) ||\n (type === 'contains' && child.props.value!.toLowerCase().includes(filterValue.toLowerCase())) ||\n (type === 'endsWith' && child.props.value!.toLowerCase().endsWith(filterValue.toLowerCase())))\n ) {\n cloneChildAndPush(child, renderedChildren);\n }\n }\n }\n } else {\n cloneChildAndPush(child, renderedChildren);\n }\n } else {\n renderedChildren.push(child);\n }\n }\n }\n\n const { tabIndex, isFocused, isSelected, isDisabled, handleKeyDown, handleClick } = useListboxItem({\n domElementRef: comboboxState?.freeTextItemRef as RefObject<Element>,\n value: comboboxState?.inputValue || '',\n id: comboboxState?.freeTextItemId,\n });\n const theme = useTheme();\n\n const renderedFreeTextItem = comboboxState?.inputValue\n ? renderFreeTextItem && typeof renderFreeTextItem === 'function'\n ? renderFreeTextItem(comboboxState?.inputValue, comboboxState, listboxState)\n : comboboxState?.inputValue\n : null;\n\n return (\n <Flexbox\n className={classNames(ComboboxContentListbox.className, className)}\n {...forwardedProps}\n ref={ref}\n flexDirection=\"column\"\n gap=\"0px\"\n margin=\"8px 0px\"\n style={{ outline: 'none' }}\n width=\"100%\"\n >\n {canHaveMultipleSelections && canHaveFreeText ? (\n <StyledItem\n role=\"option\"\n id={comboboxState.freeTextItemId}\n $color=\"primary\"\n $isActive={isSelected}\n $isDisabled={isDisabled}\n $isGradient={false}\n $isHovered={isFocused}\n $hasBorder={false}\n $hasCheckbox={false}\n $theme={theme}\n aria-selected={isSelected}\n className={classNames(Item.className, className)}\n onClick={handleClick}\n ref={comboboxState.freeTextItemRef as RefObject<HTMLDivElement>}\n onKeyDown={handleKeyDown}\n tabIndex={tabIndex}\n style={\n !comboboxState.inputValue\n ? {\n height: '0',\n visibility: 'hidden',\n padding: '0',\n }\n : undefined\n }\n >\n {renderedFreeTextItem}\n </StyledItem>\n ) : null}\n {Array.isArray(children) ? renderedChildren : children}\n </Flexbox>\n );\n});\nComboboxContentListbox.className = CLASSNAME;\nComboboxContentListbox.displayName = COMPONENT_NAME;\n"],"names":["COMPONENT_NAME","CLASSNAME","ComboboxContentListbox","forwardRef","props","ref","children","className","renderFreeTextItem","forwardedProps","_objectWithoutProperties","_excluded","focusContext","useContext","FocusWithinGroupContext","listboxState","ListboxContext","comboboxState","ComboboxContext","useEffect","state","delayedAction","tabStops","length","dispatch","canHaveMultipleSelections","selectionMode","ComboboxSelectionMode","multiple","canHaveFreeText","variant","ComboboxVariant","suggestions","cloneChildAndPush","child","array","value","includes","push","React","cloneElement","key","hasCheckbox","renderedChildren","Array","isArray","isComponent","Item","maxOptionsLength","filter","filterValue","type","caseSensitive","startsWith","endsWith","toLowerCase","tabIndex","isFocused","isSelected","isDisabled","handleKeyDown","handleClick","useListboxItem","domElementRef","freeTextItemRef","inputValue","id","freeTextItemId","theme","useTheme","renderedFreeTextItem","createElement","Flexbox","_extends","classNames","flexDirection","gap","margin","style","outline","width","StyledItem","role","$color","$isActive","$isDisabled","$isGradient","$isHovered","$hasBorder","$hasCheckbox","$theme","onClick","onKeyDown","height","visibility","padding","undefined","displayName"],"mappings":";;;;;;;;AAkBA,MAAMA,cAAc,GAAG,wBAAwB,CAAA;AAC/C,MAAMC,SAAS,GAAG,kCAAkC,CAAA;;AAEpD;AACA;AACA;AACO,MAAMC,sBAAyE,gBAAGC,UAAU,CAAC,CAACC,KAAK,EAAEC,GAAG,KAAK;EAClH,MAAM;MAAEC,QAAQ;MAAEC,SAAS;AAAEC,MAAAA,kBAAAA;AAAsC,KAAC,GAAGJ,KAAK;AAAxBK,IAAAA,cAAc,GAAAC,wBAAA,CAAKN,KAAK,EAAAO,SAAA,CAAA,CAAA;AAE5E,EAAA,MAAMC,YAAY,GAAGC,UAAU,CAACC,uBAAuB,CAAC,CAAA;AACxD,EAAA,MAAMC,YAAY,GAAGF,UAAU,CAACG,cAAc,CA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,SAAS,EAAEmE,UAAU,CAAC3B,IAAI,CAACxC,SAAS,EAAEA,SAAS,CAAE;AACjDoF,IAAAA,OAAO,EAAE9B,WAAY;IACrBxD,GAAG,EAAEY,aAAa,CAAC+C,eAA6C;AAChE4B,IAAAA,SAAS,EAAEhC,aAAc;AACzBJ,IAAAA,QAAQ,EAAEA,QAAS;AACnBsB,IAAAA,KAAK,EACH,CAAC7D,aAAa,CAACgD,UAAU,GACrB;AACE4B,MAAAA,MAAM,EAAE,GAAG;AACXC,MAAAA,UAAU,EAAE,QAAQ;AACpBC,MAAAA,OAAO,EAAE,GAAA;AACX,KAAC,GACDC,SAAAA;AACL,GAAA,EAEA1B,oBACS,CAAC,GACX,IAAI,EACP1B,KAAK,CAACC,OAAO,CAACvC,QAAQ,CAAC,GAAGqC,gBAAgB,GAAGrC,QACvC,CAAC,CAAA;AAEd,CAAC,EAAC;AACFJ,sBAAsB,CAACK,SAAS,GAAGN,SAAS,CAAA;AAC5CC,sBAAsB,CAAC+F,WAAW,GAAGjG,cAAc;;;;"}
|
|
@@ -1,38 +1,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { objectSpread2 as _objectSpread2, objectWithoutProperties as _objectWithoutProperties } from '../../../_virtual/_internal/_rollupPluginBabelHelpers.js';
|
|
2
2
|
import React, { forwardRef, useContext, useRef, useEffect } from 'react';
|
|
3
3
|
import { useId, useMessageFormatter, FocusWithinGroupContext, ListboxContext, useTheme, isComponent, FocusWithinGroupActionType, IconButton, ListboxActionType, EventKey } from '@redsift/design-system';
|
|
4
|
+
import intlMessages from '../../combobox/intl/index.js';
|
|
4
5
|
import { usePopoverContext, useMergeRefs } from '@redsift/popovers';
|
|
5
|
-
import {
|
|
6
|
+
import { ComboboxContext } from '../../combobox/_internal/context.js';
|
|
6
7
|
import { mdiClose, mdiChevronDown } from '@redsift/icons';
|
|
8
|
+
import { ComboboxSelectionMode, ComboboxVariant } from '../../combobox/_internal/types.js';
|
|
7
9
|
import classNames from 'classnames';
|
|
8
10
|
|
|
9
|
-
var collapse$1 = "Collapse";
|
|
10
|
-
var expand$1 = "Expand";
|
|
11
|
-
var selected$1 = "{count, plural, =0 {None selected} other {# selected}}";
|
|
12
|
-
var unselect$1 = "Unselect {label}";
|
|
13
|
-
var enUS = {
|
|
14
|
-
collapse: collapse$1,
|
|
15
|
-
expand: expand$1,
|
|
16
|
-
selected: selected$1,
|
|
17
|
-
unselect: unselect$1
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
var collapse = "Réduire";
|
|
21
|
-
var expand = "Développer";
|
|
22
|
-
var selected = "{count, plural, =0 {Aucun sélectionné} =1 {1 sélectionné} other {# sélectionnés}}";
|
|
23
|
-
var unselect = "Déselectionner {label}";
|
|
24
|
-
var frFR = {
|
|
25
|
-
collapse: collapse,
|
|
26
|
-
expand: expand,
|
|
27
|
-
selected: selected,
|
|
28
|
-
unselect: unselect
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
var intlMessages = {
|
|
32
|
-
'en-US': enUS,
|
|
33
|
-
'fr-FR': frFR
|
|
34
|
-
};
|
|
35
|
-
|
|
36
11
|
const _excluded = ["aria-controls", "aria-expanded", "aria-haspopup", "role"];
|
|
37
12
|
const COMPONENT_NAME = 'ComboboxTrigger';
|
|
38
13
|
const CLASSNAME = 'redsift-combobox-trigger';
|
|
@@ -373,5 +348,5 @@ const ComboboxTrigger = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
373
348
|
ComboboxTrigger.className = CLASSNAME;
|
|
374
349
|
ComboboxTrigger.displayName = COMPONENT_NAME;
|
|
375
350
|
|
|
376
|
-
export { ComboboxTrigger
|
|
351
|
+
export { ComboboxTrigger };
|
|
377
352
|
//# sourceMappingURL=ComboboxTrigger.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ComboboxTrigger.js","sources":["../../../../src/components/combobox-trigger/ComboboxTrigger.tsx"],"sourcesContent":["import React, { KeyboardEvent, ReactElement, forwardRef, useContext, useEffect, useRef } from 'react';\n\nimport { useId, useMessageFormatter } from '@redsift/design-system';\nimport intlMessages from '../combobox/intl';\n\nimport {\n Comp,\n EventKey,\n FocusWithinGroupActionType,\n FocusWithinGroupContext,\n IconButton,\n ListboxActionType,\n ListboxContext,\n isComponent,\n useTheme,\n} from '@redsift/design-system';\nimport { ComboboxTriggerProps } from './types';\nimport { useMergeRefs, usePopoverContext } from '@redsift/popovers';\nimport { ComboboxContext } from '../combobox/context';\nimport { mdiChevronDown, mdiClose } from '@redsift/icons';\nimport { ComboboxSelectionMode, ComboboxVariant } from '../combobox/types';\nimport classNames from 'classnames';\n\nconst COMPONENT_NAME = 'ComboboxTrigger';\nconst CLASSNAME = 'redsift-combobox-trigger';\n\n/**\n * The ComboboxTrigger component.\n */\nexport const ComboboxTrigger: Comp<ComboboxTriggerProps, HTMLButtonElement> = forwardRef((props, ref) => {\n const [id] = useId();\n const { children, hideExpandButton, openOnFocus, hideClearButton, pillProps } = props;\n\n const format = useMessageFormatter(intlMessages);\n\n const { getReferenceProps, isOpen, handleOpen: handleOpenPopover, refs } = usePopoverContext();\n const childrenRef = (children as any).ref;\n const triggerRef = useMergeRefs([refs.setReference, ref, childrenRef]);\n\n const focusContext = useContext(FocusWithinGroupContext);\n const comboboxState = useContext(ComboboxContext);\n const listboxState = useContext(ListboxContext);\n const theme = useTheme();\n\n const canHaveMultipleSelections = comboboxState?.selectionMode === ComboboxSelectionMode.multiple;\n const canHaveFreeText = comboboxState?.variant === ComboboxVariant.suggestions;\n\n const renderedChildren =\n typeof children === 'function' ? children({ value: comboboxState?.value, isOpen }) : children;\n\n const isTextArea = isComponent('TextArea')(renderedChildren);\n const isTextField = isComponent('TextField')(renderedChildren);\n const hasMultipleLines = isTextArea && comboboxState?.inputValue.includes('\\n');\n\n const _inputRef = useRef<HTMLInputElement>();\n const inputRef = renderedChildren.props.inputRef ?? _inputRef;\n\n const handleChange = (value?: string) => {\n focusContext.dispatch({\n type: FocusWithinGroupActionType.FILTER_LIST,\n payload: { filter: { value: value || '', ...comboboxState?.filter! } },\n });\n\n comboboxState?.setInputValue(value!);\n };\n\n const handleKeyDown = (event: KeyboardEvent) => {\n const code = event.code;\n\n if (code === 'Escape' || code === 'Tab') {\n if (isOpen) {\n handleOpenPopover(false);\n }\n\n if (canHaveMultipleSelections && canHaveFreeText && comboboxState.inputValue) {\n listboxState.dispatch({\n type: ListboxActionType.TOGGLE,\n payload: {\n value: comboboxState.inputValue,\n activedescendant: [comboboxState.freeTextItemId as string, comboboxState.inputValue],\n },\n });\n }\n }\n\n if ((/^.$/.test(event.key) || code === 'Backspace') && !hasMultipleLines) {\n if (!isOpen) {\n handleOpenPopover(true);\n }\n\n if (canHaveMultipleSelections && canHaveFreeText) {\n focusContext.dispatch({\n type: FocusWithinGroupActionType.DELAY_ACTION,\n payload: {\n type: FocusWithinGroupActionType.KEY_DOWN_ON_LIST,\n payload: {\n key: EventKey.Home,\n ctrlKey: event.ctrlKey,\n },\n },\n });\n }\n }\n\n if (canHaveMultipleSelections && comboboxState.inputValue === '' && code === 'Backspace') {\n listboxState.dispatch({\n type: ListboxActionType.SET,\n payload: {\n values: (comboboxState.value as string[]).slice(0, (comboboxState.value as string[]).length - 1),\n activedescendant: focusContext.state.activedescendant,\n },\n });\n }\n\n if (code === 'ArrowDown' && !hasMultipleLines) {\n if (!isOpen) {\n handleOpenPopover(true);\n }\n focusContext.dispatch({\n type: FocusWithinGroupActionType.DELAY_ACTION,\n payload: {\n type: FocusWithinGroupActionType.KEY_DOWN_ON_LIST,\n payload: {\n key: focusContext.state.selectedId !== null ? EventKey.ArrowDown : EventKey.Home,\n ctrlKey: event.ctrlKey,\n },\n },\n });\n event.preventDefault();\n }\n\n if (code === 'ArrowUp' && !hasMultipleLines) {\n if (!isOpen) {\n handleOpenPopover(true);\n }\n focusContext.dispatch({\n type: FocusWithinGroupActionType.DELAY_ACTION,\n payload: {\n type: FocusWithinGroupActionType.KEY_DOWN_ON_LIST,\n payload: {\n key: focusContext.state.selectedId !== null ? EventKey.ArrowUp : EventKey.End,\n ctrlKey: event.ctrlKey,\n },\n },\n });\n event.preventDefault();\n }\n\n if (code === 'Enter') {\n if (isTextField || (isTextArea && !event.shiftKey)) {\n event.preventDefault();\n }\n\n if (\n canHaveMultipleSelections &&\n canHaveFreeText &&\n focusContext.state.activedescendant?.[0] === comboboxState.freeTextItemId &&\n comboboxState.inputValue\n ) {\n listboxState.dispatch({\n type: ListboxActionType.TOGGLE,\n payload: {\n value: comboboxState.inputValue,\n activedescendant: [comboboxState.freeTextItemId as string, comboboxState.inputValue],\n },\n });\n handleOpenPopover(false);\n } else if (isOpen && focusContext.state.selectedId) {\n if (canHaveMultipleSelections) {\n listboxState.dispatch({\n type: ListboxActionType.TOGGLE,\n payload: {\n value: focusContext.state.activedescendant?.[1] ?? '',\n activedescendant: focusContext.state.activedescendant,\n },\n });\n } else {\n listboxState.dispatch({\n type: ListboxActionType.SET,\n payload: {\n values: [focusContext.state.activedescendant?.[1] ?? ''],\n activedescendant: focusContext.state.activedescendant,\n },\n });\n }\n } else if (!event.shiftKey) {\n comboboxState?.formRef?.current?.submit();\n comboboxState?.submitRef?.current?.click();\n }\n }\n };\n\n const handleOpen = () => {\n if (isOpen) {\n handleOpenPopover(false);\n } else {\n handleOpenPopover(true);\n inputRef.current?.focus();\n focusContext.dispatch({\n type: FocusWithinGroupActionType.DELAY_ACTION,\n payload: {\n type: FocusWithinGroupActionType.FOCUS_ON_LIST,\n payload: {\n id: focusContext.state.activedescendant?.[0]!,\n filter: { value: '', ...comboboxState?.filter! },\n },\n },\n });\n }\n };\n\n const handleFocus = () => {\n if (openOnFocus) {\n handleOpen();\n }\n inputRef.current?.select();\n };\n\n const handleBlur = () => {\n if (canHaveMultipleSelections) {\n if (!canHaveFreeText) {\n comboboxState?.setInputValue('');\n }\n } else {\n if (canHaveFreeText) {\n comboboxState?.setValue(comboboxState.inputValue);\n } else {\n comboboxState?.setInputValue(listboxState.state.selectedValues[0]);\n }\n }\n };\n\n const handleClear = () => {\n listboxState.dispatch({\n type: ListboxActionType.SET,\n payload: {\n values: [],\n activedescendant: ['', ''],\n },\n });\n };\n\n useEffect(() => {\n if (canHaveMultipleSelections) {\n focusContext.dispatch({\n type: FocusWithinGroupActionType.FILTER_LIST,\n payload: { filter: { value: '', ...comboboxState?.filter! } },\n });\n comboboxState?.setValue(listboxState.state.selectedValues);\n comboboxState?.setInputValue('');\n handleOpenPopover(false);\n } else {\n focusContext.dispatch({\n type: FocusWithinGroupActionType.FILTER_LIST,\n payload: { filter: { value: listboxState.state.selectedValues[0] || '', ...comboboxState?.filter! } },\n });\n comboboxState?.setValue(listboxState.state.selectedValues[0]);\n if (listboxState.state.selectedValues.length) {\n comboboxState?.setInputValue(listboxState.state.selectedValues[0]);\n }\n handleOpenPopover(false);\n }\n }, [listboxState.state]);\n\n if (isTextField || isTextArea) {\n const {\n 'aria-controls': ariaControls,\n 'aria-expanded': ariaExpanded,\n 'aria-haspopup': ariaHaspopup,\n role,\n ...forwardedProps\n } = getReferenceProps({\n ref: triggerRef,\n ...props,\n ...(renderedChildren as ReactElement).props,\n children: (renderedChildren as ReactElement).props.children ?? '',\n });\n\n const inputProps = {\n 'aria-activedescendant': isOpen ? focusContext.state.activedescendant?.[0] : undefined,\n 'aria-controls': ariaControls,\n 'aria-expanded': ariaExpanded,\n 'aria-haspopup': ariaHaspopup,\n autoComplete: 'off',\n autoCapitalize: 'off',\n autoCorrect: 'off',\n spellCheck: 'false',\n 'aria-autocomplete': canHaveMultipleSelections ? 'list' : undefined,\n 'aria-description': canHaveMultipleSelections\n ? format('selected', { count: comboboxState?.value.length })\n : undefined,\n onKeyDown: handleKeyDown,\n role,\n };\n\n return React.cloneElement(renderedChildren, {\n ...forwardedProps,\n theme,\n className: classNames((renderedChildren as ReactElement).props.className, comboboxState?.triggerClassName),\n isDisabled: comboboxState?.isDisabled,\n isInvalid: comboboxState?.isInvalid,\n onChange: handleChange,\n onBlur: handleBlur,\n onFocus: handleFocus,\n value: comboboxState?.inputValue,\n ...(isTextField\n ? {\n inputProps,\n inputRef,\n onClear: handleClear,\n hasClearButton: hideClearButton\n ? false\n : {\n isDisabled: comboboxState?.isDisabled || (comboboxState?.value && comboboxState?.value?.length === 0),\n onClick: () => inputRef.current.focus(),\n },\n pills: canHaveMultipleSelections\n ? (comboboxState?.value as string[]).map((v) => ({\n isDisabled: comboboxState?.isDisabled,\n children: [\n v,\n <IconButton\n key={`${id}-pill-${v}-icon-button`}\n icon={mdiClose}\n aria-label={format('unselect', { label: v })}\n onClick={(event) => {\n event.preventDefault();\n listboxState.dispatch({\n type: ListboxActionType.TOGGLE,\n payload: {\n value: v,\n activedescendant: focusContext.state.activedescendant,\n },\n });\n }}\n />,\n ],\n ...pillProps,\n }))\n : undefined,\n internal: (value?: string, isDisabled?: boolean, isInvalid?: boolean, isRequired?: boolean) => {\n return (\n <>\n {typeof (renderedChildren as ReactElement).props.internal === 'function'\n ? (renderedChildren as ReactElement).props.internal(value, isDisabled, isInvalid, isRequired)\n : (renderedChildren as ReactElement).props.internal}\n {hideExpandButton ? null : (\n <IconButton\n theme={theme}\n aria-label={format(!isOpen ? 'expand' : 'collapse')}\n color=\"grey\"\n icon={mdiChevronDown}\n onClick={handleOpen}\n isDisabled={isDisabled}\n tabIndex={-1}\n iconProps={{\n style: {\n transition: 'transform 300ms ease-out',\n transform: `rotate(${isOpen ? '-180deg' : '0'})`,\n },\n }}\n />\n )}\n </>\n );\n },\n }\n : {\n textareaProps: inputProps,\n textareaRef: inputRef,\n }),\n });\n }\n\n return <>{renderedChildren}</>;\n});\nComboboxTrigger.className = CLASSNAME;\nComboboxTrigger.displayName = COMPONENT_NAME;\n"],"names":["COMPONENT_NAME","CLASSNAME","ComboboxTrigger","forwardRef","props","ref","_renderedChildren$pro","id","useId","children","hideExpandButton","openOnFocus","hideClearButton","pillProps","format","useMessageFormatter","intlMessages","getReferenceProps","isOpen","handleOpen","handleOpenPopover","refs","usePopoverContext","childrenRef","triggerRef","useMergeRefs","setReference","focusContext","useContext","FocusWithinGroupContext","comboboxState","ComboboxContext","listboxState","ListboxContext","theme","useTheme","canHaveMultipleSelections","selectionMode","ComboboxSelectionMode","multiple","canHaveFreeText","variant","ComboboxVariant","suggestions","renderedChildren","value","isTextArea","isComponent","isTextField","hasMultipleLines","inputValue","includes","_inputRef","useRef","inputRef","handleChange","dispatch","type","FocusWithinGroupActionType","FILTER_LIST","payload","filter","_objectSpread","setInputValue","handleKeyDown","event","code","ListboxActionType","TOGGLE","activedescendant","freeTextItemId","test","key","DELAY_ACTION","KEY_DOWN_ON_LIST","EventKey","Home","ctrlKey","SET","values","slice","length","state","selectedId","ArrowDown","preventDefault","ArrowUp","End","_focusContext$state$a","shiftKey","_focusContext$state$a2","_focusContext$state$a3","_focusContext$state$a4","_focusContext$state$a5","_comboboxState$formRe","_comboboxState$formRe2","_comboboxState$submit","_comboboxState$submit2","formRef","current","submit","submitRef","click","_inputRef$current","_focusContext$state$a6","focus","FOCUS_ON_LIST","handleFocus","_inputRef$current2","select","handleBlur","setValue","selectedValues","handleClear","useEffect","_props$children","_focusContext$state$a7","_comboboxState$value","_getReferenceProps","ariaControls","ariaExpanded","ariaHaspopup","role","forwardedProps","_objectWithoutProperties","_excluded","inputProps","undefined","autoComplete","autoCapitalize","autoCorrect","spellCheck","count","onKeyDown","React","cloneElement","className","classNames","triggerClassName","isDisabled","isInvalid","onChange","onBlur","onFocus","onClear","hasClearButton","onClick","pills","map","v","createElement","IconButton","icon","mdiClose","label","internal","isRequired","Fragment","color","mdiChevronDown","tabIndex","iconProps","style","transition","transform","textareaProps","textareaRef","displayName"],"mappings":";;;;;;;;;;;AAuBA,MAAMA,cAAc,GAAG,iBAAiB,CAAA;AACxC,MAAMC,SAAS,GAAG,0BAA0B,CAAA;;AAE5C;AACA;AACA;AACO,MAAMC,eAA8D,gBAAGC,UAAU,CAAC,CAACC,KAAK,EAAEC,GAAG,KAAK;AAAA,EAAA,IAAAC,qBAAA,CAAA;AACvG,EAAA,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;AACJ,GAAA;EAEA,oBAAOgF,KAAA,CAAAgB,aAAA,CAAAhB,KAAA,CAAAuB,QAAA,EAAGjH,IAAAA,EAAAA,gBAAmB,CAAC,CAAA;AAChC,CAAC,EAAC;AACF1C,eAAe,CAACsI,SAAS,GAAGvI,SAAS,CAAA;AACrCC,eAAe,CAACqK,WAAW,GAAGvK,cAAc;;;;"}
|
|
@@ -1,71 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import React, {
|
|
1
|
+
import { extends as _extends, objectWithoutProperties as _objectWithoutProperties } from '../../../_virtual/_internal/_rollupPluginBabelHelpers.js';
|
|
2
|
+
import React, { forwardRef, useContext, useRef } from 'react';
|
|
3
3
|
import classNames from 'classnames';
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
function useMenuItem(props) {
|
|
8
|
-
const {
|
|
9
|
-
domElementRef,
|
|
10
|
-
id,
|
|
11
|
-
isDisabled,
|
|
12
|
-
onClick,
|
|
13
|
-
isLinkMenuItem,
|
|
14
|
-
linkRef,
|
|
15
|
-
hasPopup
|
|
16
|
-
} = props;
|
|
17
|
-
const {
|
|
18
|
-
handleOpen,
|
|
19
|
-
hideInsteadOfClose,
|
|
20
|
-
setHideInsteadOfClose
|
|
21
|
-
} = usePopoverContext();
|
|
22
|
-
const {
|
|
23
|
-
tabIndex,
|
|
24
|
-
isFocused,
|
|
25
|
-
handleKeyDown: handleFocusKeyDown,
|
|
26
|
-
handleClick: handleFocusClick
|
|
27
|
-
} = useFocusOnListItem({
|
|
28
|
-
domElementRef,
|
|
29
|
-
isDisabled: isDisabled,
|
|
30
|
-
id
|
|
31
|
-
});
|
|
32
|
-
useEffect(() => {
|
|
33
|
-
if (hasPopup && !hideInsteadOfClose) {
|
|
34
|
-
setHideInsteadOfClose === null || setHideInsteadOfClose === void 0 ? void 0 : setHideInsteadOfClose(true);
|
|
35
|
-
}
|
|
36
|
-
}, [hasPopup, hideInsteadOfClose, setHideInsteadOfClose]);
|
|
37
|
-
const handleKeyDown = useCallback(event => {
|
|
38
|
-
const code = event.code;
|
|
39
|
-
if (code === 'Enter' || code === 'Space') {
|
|
40
|
-
if (isLinkMenuItem) {
|
|
41
|
-
var _linkRef$current;
|
|
42
|
-
linkRef === null || linkRef === void 0 ? void 0 : (_linkRef$current = linkRef.current) === null || _linkRef$current === void 0 ? void 0 : _linkRef$current.click();
|
|
43
|
-
} else {
|
|
44
|
-
onClick === null || onClick === void 0 ? void 0 : onClick();
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
handleFocusKeyDown(event);
|
|
48
|
-
handleOpen(false);
|
|
49
|
-
}, []);
|
|
50
|
-
const handleClick = useCallback(() => {
|
|
51
|
-
handleFocusClick();
|
|
52
|
-
onClick === null || onClick === void 0 ? void 0 : onClick();
|
|
53
|
-
handleOpen(false);
|
|
54
|
-
}, []);
|
|
55
|
-
useEffect(() => {
|
|
56
|
-
if (isFocused && domElementRef.current) {
|
|
57
|
-
var _current;
|
|
58
|
-
(_current = domElementRef.current) === null || _current === void 0 ? void 0 : _current.focus();
|
|
59
|
-
}
|
|
60
|
-
}, [isFocused]);
|
|
61
|
-
return {
|
|
62
|
-
tabIndex,
|
|
63
|
-
isFocused,
|
|
64
|
-
isDisabled,
|
|
65
|
-
handleKeyDown,
|
|
66
|
-
handleClick
|
|
67
|
-
};
|
|
68
|
-
}
|
|
4
|
+
import { useMenuItem } from './useMenuItem.js';
|
|
5
|
+
import { useMergeRefs } from '@redsift/popovers';
|
|
6
|
+
import { FocusWithinGroupContext, RenderedListboxItem, useId, isComponent, useTheme, ButtonsColorPalette, ConditionalWrapper, StyledGradientBorder, StyledItem } from '@redsift/design-system';
|
|
69
7
|
|
|
70
8
|
const _excluded = ["borderRadius", "children", "className", "color", "hasBorder", "id", "isActive", "isDisabled", "isHovered", "theme", "onClick"];
|
|
71
9
|
const COMPONENT_NAME = 'Item';
|
|
@@ -195,5 +133,5 @@ const Item = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
195
133
|
Item.className = CLASSNAME;
|
|
196
134
|
Item.displayName = COMPONENT_NAME;
|
|
197
135
|
|
|
198
|
-
export { Item
|
|
136
|
+
export { Item };
|
|
199
137
|
//# sourceMappingURL=Item2.js.map
|