@redsift/pickers 11.5.0 → 11.6.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/_internal/Combobox2.js +150 -0
- package/_internal/Combobox2.js.map +1 -0
- package/_internal/ComboboxContent.js +70 -0
- package/_internal/ComboboxContent.js.map +1 -0
- package/_internal/ComboboxContentFooter.js +36 -0
- package/_internal/ComboboxContentFooter.js.map +1 -0
- package/_internal/ComboboxContentHeader.js +36 -0
- package/_internal/ComboboxContentHeader.js.map +1 -0
- package/_internal/ComboboxContentListbox.js +123 -0
- package/_internal/ComboboxContentListbox.js.map +1 -0
- package/_internal/ComboboxTrigger.js +377 -0
- package/_internal/ComboboxTrigger.js.map +1 -0
- package/_internal/Item2.js +199 -0
- package/_internal/Item2.js.map +1 -0
- package/_internal/MenuButton.js +75 -0
- package/_internal/MenuButton.js.map +1 -0
- package/_internal/MenuButtonContent.js +68 -0
- package/_internal/MenuButtonContent.js.map +1 -0
- package/_internal/MenuButtonContentFooter.js +36 -0
- package/_internal/MenuButtonContentFooter.js.map +1 -0
- package/_internal/MenuButtonContentHeader.js +36 -0
- package/_internal/MenuButtonContentHeader.js.map +1 -0
- package/_internal/MenuButtonContentMenu.js +41 -0
- package/_internal/MenuButtonContentMenu.js.map +1 -0
- package/_internal/MenuButtonTrigger.js +168 -0
- package/_internal/MenuButtonTrigger.js.map +1 -0
- package/_internal/Select2.js +115 -0
- package/_internal/Select2.js.map +1 -0
- package/_internal/SelectContent.js +62 -0
- package/_internal/SelectContent.js.map +1 -0
- package/_internal/SelectTrigger.js +250 -0
- package/_internal/SelectTrigger.js.map +1 -0
- package/_internal/_rollupPluginBabelHelpers.js +93 -0
- package/_internal/_rollupPluginBabelHelpers.js.map +1 -0
- package/_internal/combobox-content-footer.js +2 -0
- package/_internal/combobox-content-footer.js.map +1 -0
- package/_internal/combobox-content-header.js +2 -0
- package/_internal/combobox-content-header.js.map +1 -0
- package/_internal/combobox-content-listbox.js +2 -0
- package/_internal/combobox-content-listbox.js.map +1 -0
- package/_internal/combobox-content.js +2 -0
- package/_internal/combobox-content.js.map +1 -0
- package/_internal/combobox-trigger.js +2 -0
- package/_internal/combobox-trigger.js.map +1 -0
- package/_internal/combobox.js +3 -0
- package/_internal/combobox.js.map +1 -0
- package/_internal/item.js +2 -0
- package/_internal/item.js.map +1 -0
- package/_internal/menu-button-content-footer.js +2 -0
- package/_internal/menu-button-content-footer.js.map +1 -0
- package/_internal/menu-button-content-header.js +2 -0
- package/_internal/menu-button-content-header.js.map +1 -0
- package/_internal/menu-button-content-menu.js +2 -0
- package/_internal/menu-button-content-menu.js.map +1 -0
- package/_internal/menu-button-content.js +2 -0
- package/_internal/menu-button-content.js.map +1 -0
- package/_internal/menu-button-trigger.js +2 -0
- package/_internal/menu-button-trigger.js.map +1 -0
- package/_internal/menu-button.js +2 -0
- package/_internal/menu-button.js.map +1 -0
- package/_internal/select-content.js +2 -0
- package/_internal/select-content.js.map +1 -0
- package/_internal/select-trigger.js +2 -0
- package/_internal/select-trigger.js.map +1 -0
- package/_internal/select.js +2 -0
- package/_internal/select.js.map +1 -0
- package/_internal/types.js +26 -0
- package/_internal/types.js.map +1 -0
- package/index.js +17 -1822
- package/index.js.map +1 -1
- package/package.json +8 -8
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { a as _extends } from './_rollupPluginBabelHelpers.js';
|
|
2
|
+
import React, { useState, useEffect, useReducer, useMemo } from 'react';
|
|
3
|
+
import { Popover } from '@redsift/popovers';
|
|
4
|
+
import { a as SelectContext, S as SelectTrigger } from './SelectTrigger.js';
|
|
5
|
+
import { useTheme, ListboxReducer, ListboxActionType, ThemeProvider, FocusWithinGroup, ListboxContext, Flexbox, Text, Theme } from '@redsift/design-system';
|
|
6
|
+
import { S as SelectContent } from './SelectContent.js';
|
|
7
|
+
|
|
8
|
+
const COMPONENT_NAME = 'Select';
|
|
9
|
+
const CLASSNAME = 'redsift-select';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* The Select component.
|
|
13
|
+
*/
|
|
14
|
+
const BaseSelect = props => {
|
|
15
|
+
const {
|
|
16
|
+
color,
|
|
17
|
+
defaultValue,
|
|
18
|
+
description,
|
|
19
|
+
descriptionProps,
|
|
20
|
+
isDisabled,
|
|
21
|
+
isInvalid,
|
|
22
|
+
minWidth = 'trigger-width',
|
|
23
|
+
onChange,
|
|
24
|
+
theme: propsTheme,
|
|
25
|
+
triggerClassName,
|
|
26
|
+
value,
|
|
27
|
+
variant,
|
|
28
|
+
wrapperProps
|
|
29
|
+
} = props;
|
|
30
|
+
const theme = useTheme(propsTheme);
|
|
31
|
+
const [selectedValue, setValue] = useState(value || defaultValue || '');
|
|
32
|
+
useEffect(() => {
|
|
33
|
+
if (value) {
|
|
34
|
+
state.setValue(value);
|
|
35
|
+
}
|
|
36
|
+
}, [value]);
|
|
37
|
+
|
|
38
|
+
/** Listbox context */
|
|
39
|
+
const [listboxState, listboxDispatch] = useReducer(ListboxReducer, {
|
|
40
|
+
isDisabled,
|
|
41
|
+
selectedValues: [selectedValue]
|
|
42
|
+
});
|
|
43
|
+
const listboxContext = useMemo(() => ({
|
|
44
|
+
state: listboxState,
|
|
45
|
+
dispatch: listboxDispatch
|
|
46
|
+
}), [listboxState]);
|
|
47
|
+
useEffect(() => {
|
|
48
|
+
listboxDispatch({
|
|
49
|
+
type: ListboxActionType.UPDATE_OPTIONS,
|
|
50
|
+
payload: {
|
|
51
|
+
isDisabled: isDisabled || false
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
}, [isDisabled, theme]);
|
|
55
|
+
|
|
56
|
+
/** Select context. */
|
|
57
|
+
const state = {
|
|
58
|
+
color,
|
|
59
|
+
isDisabled: isDisabled || false,
|
|
60
|
+
isInvalid: isInvalid || false,
|
|
61
|
+
setValue(value) {
|
|
62
|
+
if (isDisabled) {
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
const previousValue = selectedValue;
|
|
66
|
+
setValue(value);
|
|
67
|
+
if (value !== previousValue && onChange) {
|
|
68
|
+
onChange(value);
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
theme,
|
|
72
|
+
triggerClassName,
|
|
73
|
+
value: selectedValue,
|
|
74
|
+
variant
|
|
75
|
+
};
|
|
76
|
+
return /*#__PURE__*/React.createElement(ThemeProvider, {
|
|
77
|
+
value: {
|
|
78
|
+
theme
|
|
79
|
+
}
|
|
80
|
+
}, /*#__PURE__*/React.createElement(FocusWithinGroup, {
|
|
81
|
+
focusType: "virtual-focus",
|
|
82
|
+
focusOnInit: false
|
|
83
|
+
}, /*#__PURE__*/React.createElement(SelectContext.Provider, {
|
|
84
|
+
value: state
|
|
85
|
+
}, /*#__PURE__*/React.createElement(ListboxContext.Provider, {
|
|
86
|
+
value: listboxContext
|
|
87
|
+
}, /*#__PURE__*/React.createElement(Flexbox, _extends({
|
|
88
|
+
flexDirection: "column",
|
|
89
|
+
alignItems: "flex-start",
|
|
90
|
+
gap: "0px"
|
|
91
|
+
}, wrapperProps), /*#__PURE__*/React.createElement(Popover, _extends({
|
|
92
|
+
theme: theme,
|
|
93
|
+
overrideDisplayName: {
|
|
94
|
+
content: 'SelectContent',
|
|
95
|
+
trigger: 'SelectTrigger'
|
|
96
|
+
},
|
|
97
|
+
placement: "bottom-start",
|
|
98
|
+
role: "listbox",
|
|
99
|
+
minWidth: minWidth
|
|
100
|
+
}, props)), description && typeof description === 'string' ? /*#__PURE__*/React.createElement(Text, _extends({
|
|
101
|
+
theme: theme,
|
|
102
|
+
marginTop: "8px",
|
|
103
|
+
variant: "caption",
|
|
104
|
+
color: isInvalid ? 'error' : theme === Theme.light ? 'dark-grey' : 'white'
|
|
105
|
+
}, descriptionProps), description) : description ? description : null)))));
|
|
106
|
+
};
|
|
107
|
+
BaseSelect.className = CLASSNAME;
|
|
108
|
+
BaseSelect.displayName = COMPONENT_NAME;
|
|
109
|
+
const Select = Object.assign(BaseSelect, {
|
|
110
|
+
Trigger: SelectTrigger,
|
|
111
|
+
Content: SelectContent
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
export { BaseSelect as B, Select as S };
|
|
115
|
+
//# sourceMappingURL=Select2.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Select2.js","sources":["../../src/components/select/Select.tsx"],"sourcesContent":["import React, { useEffect, useMemo, useReducer, useState } from 'react';\nimport { SelectContent } from '../select-content';\nimport { SelectTrigger } from '../select-trigger';\n\nimport { SelectProps } from './types';\nimport { Popover } from '@redsift/popovers';\nimport { SelectContext } 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} from '@redsift/design-system';\n\nconst COMPONENT_NAME = 'Select';\nconst CLASSNAME = 'redsift-select';\n\n/**\n * The Select component.\n */\nexport const BaseSelect: React.FC<SelectProps> & {\n displayName?: string;\n className?: string;\n} = (props) => {\n const {\n color,\n defaultValue,\n description,\n descriptionProps,\n isDisabled,\n isInvalid,\n minWidth = 'trigger-width',\n onChange,\n theme: propsTheme,\n triggerClassName,\n value,\n variant,\n wrapperProps,\n } = props;\n\n const theme = useTheme(propsTheme);\n\n const [selectedValue, setValue] = useState<string>(value || defaultValue || '');\n useEffect(() => {\n if (value) {\n state.setValue(value);\n }\n }, [value]);\n\n /** Listbox context */\n const [listboxState, listboxDispatch] = useReducer(ListboxReducer, {\n isDisabled,\n selectedValues: [selectedValue],\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, theme]);\n\n /** Select context. */\n const state = {\n color,\n isDisabled: isDisabled || false,\n isInvalid: isInvalid || false,\n setValue(value: string) {\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 theme,\n triggerClassName,\n value: selectedValue,\n variant,\n };\n\n return (\n <ThemeProvider value={{ theme }}>\n <FocusWithinGroup focusType=\"virtual-focus\" focusOnInit={false}>\n <SelectContext.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: 'SelectContent', trigger: 'SelectTrigger' }}\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 ) : description ? (\n description\n ) : null}\n </Flexbox>\n </ListboxContext.Provider>\n </SelectContext.Provider>\n </FocusWithinGroup>\n </ThemeProvider>\n );\n};\nBaseSelect.className = CLASSNAME;\nBaseSelect.displayName = COMPONENT_NAME;\n\nexport const Select = Object.assign(BaseSelect, {\n Trigger: SelectTrigger,\n Content: SelectContent,\n});\n"],"names":["COMPONENT_NAME","CLASSNAME","BaseSelect","props","color","defaultValue","description","descriptionProps","isDisabled","isInvalid","minWidth","onChange","theme","propsTheme","triggerClassName","value","variant","wrapperProps","useTheme","selectedValue","setValue","useState","useEffect","state","listboxState","listboxDispatch","useReducer","ListboxReducer","selectedValues","listboxContext","useMemo","dispatch","type","ListboxActionType","UPDATE_OPTIONS","payload","previousValue","React","createElement","ThemeProvider","FocusWithinGroup","focusType","focusOnInit","SelectContext","Provider","ListboxContext","Flexbox","_extends","flexDirection","alignItems","gap","Popover","overrideDisplayName","content","trigger","placement","role","Text","marginTop","Theme","light","className","displayName","Select","Object","assign","Trigger","SelectTrigger","Content","SelectContent"],"mappings":";;;;;;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EAAC,KAAA;GAAUjC,EAAAA,YAAY,gBAChFoB,KAAA,CAAAC,aAAA,CAACa,OAAO,EAAAJ,QAAA,CAAA;AACNnC,IAAAA,KAAK,EAAEA,KAAM;AACbwC,IAAAA,mBAAmB,EAAE;AAAEC,MAAAA,OAAO,EAAE,eAAe;AAAEC,MAAAA,OAAO,EAAE,eAAA;KAAkB;AAC5EC,IAAAA,SAAS,EAAC,cAAc;AACxBC,IAAAA,IAAI,EAAC,SAAS;AACd9C,IAAAA,QAAQ,EAAEA,QAAAA;AAAS,GAAA,EACfP,KAAK,CACV,CAAC,EACDG,WAAW,IAAI,OAAOA,WAAW,KAAK,QAAQ,gBAC7C+B,KAAA,CAAAC,aAAA,CAACmB,IAAI,EAAAV,QAAA,CAAA;AACHnC,IAAAA,KAAK,EAAEA,KAAM;AACb8C,IAAAA,SAAS,EAAC,KAAK;AACf1C,IAAAA,OAAO,EAAC,SAAS;AACjBZ,IAAAA,KAAK,EAAEK,SAAS,GAAG,OAAO,GAAGG,KAAK,KAAK+C,KAAK,CAACC,KAAK,GAAG,WAAW,GAAG,OAAA;AAAQ,GAAA,EACvErD,gBAAgB,CAAA,EAEnBD,WACG,CAAC,GACLA,WAAW,GACbA,WAAW,GACT,IACG,CACc,CACH,CACR,CACL,CAAC,CAAA;AAEpB,EAAC;AACDJ,UAAU,CAAC2D,SAAS,GAAG5D,SAAS,CAAA;AAChCC,UAAU,CAAC4D,WAAW,GAAG9D,cAAc,CAAA;AAEhC,MAAM+D,MAAM,GAAGC,MAAM,CAACC,MAAM,CAAC/D,UAAU,EAAE;AAC9CgE,EAAAA,OAAO,EAAEC,aAAa;AACtBC,EAAAA,OAAO,EAAEC,aAAAA;AACX,CAAC;;;;"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { a as _extends, b as _objectSpread2 } from './_rollupPluginBabelHelpers.js';
|
|
2
|
+
import React, { forwardRef, useContext, useEffect } from 'react';
|
|
3
|
+
import { getContainerProps, AppContainerContext, FocusWithinGroupContext, ListboxContext, useTheme, Flexbox } from '@redsift/design-system';
|
|
4
|
+
import { usePopoverContext, useMergeRefs, FloatingPortal, StyledPopoverContent, PopoverContent } from '@redsift/popovers';
|
|
5
|
+
import classNames from 'classnames';
|
|
6
|
+
|
|
7
|
+
const COMPONENT_NAME = 'SelectContent';
|
|
8
|
+
const CLASSNAME = 'redsift-select-content';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* The SelectContent component.
|
|
12
|
+
*/
|
|
13
|
+
const SelectContent = /*#__PURE__*/forwardRef((props, ref) => {
|
|
14
|
+
const {
|
|
15
|
+
children,
|
|
16
|
+
className,
|
|
17
|
+
style
|
|
18
|
+
} = props;
|
|
19
|
+
const containerProps = getContainerProps(props);
|
|
20
|
+
const {
|
|
21
|
+
getFloatingProps,
|
|
22
|
+
isOpen,
|
|
23
|
+
refs,
|
|
24
|
+
strategy,
|
|
25
|
+
x,
|
|
26
|
+
y
|
|
27
|
+
} = usePopoverContext();
|
|
28
|
+
const popoverRef = useMergeRefs([refs.setFloating, ref]);
|
|
29
|
+
const appContainerState = useContext(AppContainerContext);
|
|
30
|
+
const focusContext = useContext(FocusWithinGroupContext);
|
|
31
|
+
const listboxState = useContext(ListboxContext);
|
|
32
|
+
const theme = useTheme();
|
|
33
|
+
useEffect(() => {
|
|
34
|
+
if (focusContext && focusContext.state.delayedAction && focusContext.state.tabStops.length) {
|
|
35
|
+
focusContext.dispatch(focusContext.state.delayedAction);
|
|
36
|
+
}
|
|
37
|
+
}, [focusContext.state.delayedAction, focusContext.state.tabStops.length]);
|
|
38
|
+
return /*#__PURE__*/React.createElement(FloatingPortal, {
|
|
39
|
+
root: appContainerState === null || appContainerState === void 0 ? void 0 : appContainerState.appContainerRef.current
|
|
40
|
+
}, isOpen && /*#__PURE__*/React.createElement(StyledPopoverContent, _extends({
|
|
41
|
+
$theme: theme,
|
|
42
|
+
ref: popoverRef
|
|
43
|
+
}, getFloatingProps(props), {
|
|
44
|
+
style: _objectSpread2({
|
|
45
|
+
position: strategy,
|
|
46
|
+
top: y !== null && y !== void 0 ? y : 0,
|
|
47
|
+
left: x !== null && x !== void 0 ? x : 0
|
|
48
|
+
}, style),
|
|
49
|
+
className: classNames(PopoverContent.className, SelectContent.className, className),
|
|
50
|
+
"aria-disabled": listboxState.state.isDisabled
|
|
51
|
+
}), /*#__PURE__*/React.createElement(Flexbox, _extends({
|
|
52
|
+
flexDirection: "column",
|
|
53
|
+
gap: "0px",
|
|
54
|
+
margin: "8px 0px",
|
|
55
|
+
width: "100%"
|
|
56
|
+
}, containerProps), children)));
|
|
57
|
+
});
|
|
58
|
+
SelectContent.className = CLASSNAME;
|
|
59
|
+
SelectContent.displayName = COMPONENT_NAME;
|
|
60
|
+
|
|
61
|
+
export { SelectContent as S };
|
|
62
|
+
//# sourceMappingURL=SelectContent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SelectContent.js","sources":["../../src/components/select-content/SelectContent.tsx"],"sourcesContent":["import React, { forwardRef, useContext, useEffect } from 'react';\n\nimport {\n AppContainerContext,\n Comp,\n Flexbox,\n FocusWithinGroupContext,\n ListboxContext,\n getContainerProps,\n useTheme,\n} from '@redsift/design-system';\nimport { SelectContentProps } from './types';\nimport {\n FloatingPortal,\n PopoverContent,\n StyledPopoverContent,\n useMergeRefs,\n usePopoverContext,\n} from '@redsift/popovers';\nimport classNames from 'classnames';\n\nconst COMPONENT_NAME = 'SelectContent';\nconst CLASSNAME = 'redsift-select-content';\n\n/**\n * The SelectContent component.\n */\nexport const SelectContent: Comp<SelectContentProps, 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 focusContext = useContext(FocusWithinGroupContext);\n const listboxState = useContext(ListboxContext);\n const theme = useTheme();\n\n useEffect(() => {\n if (focusContext && focusContext.state.delayedAction && focusContext.state.tabStops.length) {\n focusContext.dispatch(focusContext.state.delayedAction);\n }\n }, [focusContext.state.delayedAction, focusContext.state.tabStops.length]);\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 }}\n className={classNames(PopoverContent.className, SelectContent.className, className)}\n aria-disabled={listboxState.state.isDisabled}\n >\n <Flexbox flexDirection=\"column\" gap=\"0px\" margin=\"8px 0px\" width=\"100%\" {...containerProps}>\n {children}\n </Flexbox>\n </StyledPopoverContent>\n )}\n </FloatingPortal>\n );\n});\nSelectContent.className = CLASSNAME;\nSelectContent.displayName = COMPONENT_NAME;\n"],"names":["COMPONENT_NAME","CLASSNAME","SelectContent","forwardRef","props","ref","children","className","style","containerProps","getContainerProps","getFloatingProps","isOpen","refs","strategy","x","y","usePopoverContext","popoverRef","useMergeRefs","setFloating","appContainerState","useContext","AppContainerContext","focusContext","FocusWithinGroupContext","listboxState","ListboxContext","theme","useTheme","useEffect","state","delayedAction","tabStops","length","dispatch","React","createElement","FloatingPortal","root","appContainerRef","current","StyledPopoverContent","_extends","$theme","_objectSpread","position","top","left","classNames","PopoverContent","isDisabled","Flexbox","flexDirection","gap","margin","width","displayName"],"mappings":";;;;;;AAqBA,MAAMA,cAAc,GAAG,eAAe,CAAA;AACtC,MAAMC,SAAS,GAAG,wBAAwB,CAAA;;AAE1C;AACA;AACA;AACO,MAAMC,aAAuD,gBAAGC,UAAU,CAAC,CAACC,KAAK,EAAEC,GAAG,KAAK;EAChG,MAAM;IAAEC,QAAQ;IAAEC,SAAS;AAAEC,IAAAA,KAAAA;AAAM,GAAC,GAAGJ,KAAK,CAAA;AAC5C,EAAA,MAAMK,cAAc,GAAGC,iBAAiB,CAACN,KAAK,CAAC,CAAA;EAE/C,MAAM;IA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HC,MAAAA,QAAQ,EAAEhC,QAAQ;AAClBiC,MAAAA,GAAG,EAAE/B,CAAC,KAAA,IAAA,IAADA,CAAC,KAADA,KAAAA,CAAAA,GAAAA,CAAC,GAAI,CAAC;AACXgC,MAAAA,IAAI,EAAEjC,CAAC,KAAA,IAAA,IAADA,CAAC,KAAA,KAAA,CAAA,GAADA,CAAC,GAAI,CAAA;AAAC,KAAA,EACTP,KAAK,CACR;AACFD,IAAAA,SAAS,EAAE0C,UAAU,CAACC,cAAc,CAAC3C,SAAS,EAAEL,aAAa,CAACK,SAAS,EAAEA,SAAS,CAAE;IACpF,eAAemB,EAAAA,YAAY,CAACK,KAAK,CAACoB,UAAAA;AAAW,GAAA,CAAA,eAE7Cf,KAAA,CAAAC,aAAA,CAACe,OAAO,EAAAT,QAAA,CAAA;AAACU,IAAAA,aAAa,EAAC,QAAQ;AAACC,IAAAA,GAAG,EAAC,KAAK;AAACC,IAAAA,MAAM,EAAC,SAAS;AAACC,IAAAA,KAAK,EAAC,MAAA;AAAM,GAAA,EAAK/C,cAAc,CAAA,EACvFH,QACM,CACW,CAEV,CAAC,CAAA;AAErB,CAAC,EAAC;AACFJ,aAAa,CAACK,SAAS,GAAGN,SAAS,CAAA;AACnCC,aAAa,CAACuD,WAAW,GAAGzD,cAAc;;;;"}
|
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
import { b as _objectSpread2 } from './_rollupPluginBabelHelpers.js';
|
|
2
|
+
import React, { forwardRef, useContext, useRef, useEffect } from 'react';
|
|
3
|
+
import classNames from 'classnames';
|
|
4
|
+
import { FocusWithinGroupContext, ListboxContext, useTheme, isComponent, Icon, FocusWithinGroupActionType, EventKey, ListboxActionType } from '@redsift/design-system';
|
|
5
|
+
import { usePopoverContext, useMergeRefs } from '@redsift/popovers';
|
|
6
|
+
import { mdiChevronDown } from '@redsift/icons';
|
|
7
|
+
|
|
8
|
+
const SelectContext = /*#__PURE__*/React.createContext(null);
|
|
9
|
+
|
|
10
|
+
const COMPONENT_NAME = 'SelectTrigger';
|
|
11
|
+
const CLASSNAME = 'redsift-select-trigger';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* The SelectTrigger component.
|
|
15
|
+
*/
|
|
16
|
+
const SelectTrigger = /*#__PURE__*/forwardRef((props, ref) => {
|
|
17
|
+
var _renderedChildren$pro;
|
|
18
|
+
const {
|
|
19
|
+
children,
|
|
20
|
+
hideExpandButton
|
|
21
|
+
} = props;
|
|
22
|
+
const {
|
|
23
|
+
getReferenceProps,
|
|
24
|
+
isOpen,
|
|
25
|
+
handleOpen,
|
|
26
|
+
refs
|
|
27
|
+
} = usePopoverContext();
|
|
28
|
+
const childrenRef = children.ref;
|
|
29
|
+
const triggerRef = useMergeRefs([refs.setReference, ref, childrenRef]);
|
|
30
|
+
const focusContext = useContext(FocusWithinGroupContext);
|
|
31
|
+
const selectContext = useContext(SelectContext);
|
|
32
|
+
const listboxState = useContext(ListboxContext);
|
|
33
|
+
const theme = useTheme();
|
|
34
|
+
const renderedChildren = typeof children === 'function' ? children({
|
|
35
|
+
value: selectContext === null || selectContext === void 0 ? void 0 : selectContext.value,
|
|
36
|
+
isOpen
|
|
37
|
+
}) : children;
|
|
38
|
+
const _inputRef = useRef();
|
|
39
|
+
const inputRef = (_renderedChildren$pro = renderedChildren.props.inputRef) !== null && _renderedChildren$pro !== void 0 ? _renderedChildren$pro : _inputRef;
|
|
40
|
+
const handleKeyDown = event => {
|
|
41
|
+
const code = event.code;
|
|
42
|
+
if (code === 'Escape') {
|
|
43
|
+
if (isOpen) {
|
|
44
|
+
handleOpen(false);
|
|
45
|
+
}
|
|
46
|
+
} else if (code === 'ArrowDown') {
|
|
47
|
+
var _focusContext$state$a;
|
|
48
|
+
if (!isOpen) {
|
|
49
|
+
handleOpen(true);
|
|
50
|
+
}
|
|
51
|
+
if (focusContext.state.selectedId !== null) {
|
|
52
|
+
focusContext.dispatch({
|
|
53
|
+
type: FocusWithinGroupActionType.DELAY_ACTION,
|
|
54
|
+
payload: {
|
|
55
|
+
type: FocusWithinGroupActionType.KEY_DOWN_ON_LIST,
|
|
56
|
+
payload: {
|
|
57
|
+
key: EventKey.ArrowDown,
|
|
58
|
+
ctrlKey: event.ctrlKey
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
} else if (!((_focusContext$state$a = focusContext.state.activedescendant) !== null && _focusContext$state$a !== void 0 && _focusContext$state$a[0])) {
|
|
63
|
+
focusContext.dispatch({
|
|
64
|
+
type: FocusWithinGroupActionType.DELAY_ACTION,
|
|
65
|
+
payload: {
|
|
66
|
+
type: FocusWithinGroupActionType.KEY_DOWN_ON_LIST,
|
|
67
|
+
payload: {
|
|
68
|
+
key: EventKey.Home,
|
|
69
|
+
ctrlKey: event.ctrlKey
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
} else {
|
|
74
|
+
var _focusContext$state$a2, _focusContext$state$a3;
|
|
75
|
+
focusContext.dispatch({
|
|
76
|
+
type: FocusWithinGroupActionType.DELAY_ACTION,
|
|
77
|
+
payload: {
|
|
78
|
+
type: FocusWithinGroupActionType.FOCUS_ON_LIST,
|
|
79
|
+
payload: {
|
|
80
|
+
id: (_focusContext$state$a2 = (_focusContext$state$a3 = focusContext.state.activedescendant) === null || _focusContext$state$a3 === void 0 ? void 0 : _focusContext$state$a3[0]) !== null && _focusContext$state$a2 !== void 0 ? _focusContext$state$a2 : ''
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
event.preventDefault();
|
|
86
|
+
} else if (code === 'ArrowUp') {
|
|
87
|
+
if (!isOpen) {
|
|
88
|
+
handleOpen(true);
|
|
89
|
+
}
|
|
90
|
+
focusContext.dispatch({
|
|
91
|
+
type: FocusWithinGroupActionType.DELAY_ACTION,
|
|
92
|
+
payload: {
|
|
93
|
+
type: FocusWithinGroupActionType.KEY_DOWN_ON_LIST,
|
|
94
|
+
payload: {
|
|
95
|
+
key: focusContext.state.selectedId !== null ? EventKey.ArrowUp : EventKey.Home,
|
|
96
|
+
ctrlKey: event.ctrlKey
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
event.preventDefault();
|
|
101
|
+
} else if (code === 'Home') {
|
|
102
|
+
if (!isOpen) {
|
|
103
|
+
handleOpen(true);
|
|
104
|
+
}
|
|
105
|
+
focusContext.dispatch({
|
|
106
|
+
type: FocusWithinGroupActionType.DELAY_ACTION,
|
|
107
|
+
payload: {
|
|
108
|
+
type: FocusWithinGroupActionType.KEY_DOWN_ON_LIST,
|
|
109
|
+
payload: {
|
|
110
|
+
key: EventKey.Home,
|
|
111
|
+
ctrlKey: event.ctrlKey
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
event.preventDefault();
|
|
116
|
+
} else if (code === 'End') {
|
|
117
|
+
if (!isOpen) {
|
|
118
|
+
handleOpen(true);
|
|
119
|
+
}
|
|
120
|
+
focusContext.dispatch({
|
|
121
|
+
type: FocusWithinGroupActionType.DELAY_ACTION,
|
|
122
|
+
payload: {
|
|
123
|
+
type: FocusWithinGroupActionType.KEY_DOWN_ON_LIST,
|
|
124
|
+
payload: {
|
|
125
|
+
key: EventKey.End,
|
|
126
|
+
ctrlKey: event.ctrlKey
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
});
|
|
130
|
+
event.preventDefault();
|
|
131
|
+
} else if (code === 'Enter') {
|
|
132
|
+
if (isOpen && focusContext.state.selectedId) {
|
|
133
|
+
var _focusContext$state$a4, _focusContext$state$a5;
|
|
134
|
+
listboxState.dispatch({
|
|
135
|
+
type: ListboxActionType.SET,
|
|
136
|
+
payload: {
|
|
137
|
+
values: [(_focusContext$state$a4 = (_focusContext$state$a5 = focusContext.state.activedescendant) === null || _focusContext$state$a5 === void 0 ? void 0 : _focusContext$state$a5[1]) !== null && _focusContext$state$a4 !== void 0 ? _focusContext$state$a4 : ''],
|
|
138
|
+
activedescendant: focusContext.state.activedescendant
|
|
139
|
+
}
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
};
|
|
144
|
+
const handleClick = event => {
|
|
145
|
+
event.preventDefault();
|
|
146
|
+
if (isOpen) {
|
|
147
|
+
handleOpen(false);
|
|
148
|
+
} else {
|
|
149
|
+
var _focusContext$state$a6, _focusContext$state$a7;
|
|
150
|
+
handleOpen(true);
|
|
151
|
+
focusContext.dispatch({
|
|
152
|
+
type: FocusWithinGroupActionType.DELAY_ACTION,
|
|
153
|
+
payload: {
|
|
154
|
+
type: FocusWithinGroupActionType.FOCUS_ON_LIST,
|
|
155
|
+
payload: {
|
|
156
|
+
id: (_focusContext$state$a6 = (_focusContext$state$a7 = focusContext.state.activedescendant) === null || _focusContext$state$a7 === void 0 ? void 0 : _focusContext$state$a7[0]) !== null && _focusContext$state$a6 !== void 0 ? _focusContext$state$a6 : ''
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
};
|
|
162
|
+
useEffect(() => {
|
|
163
|
+
selectContext === null || selectContext === void 0 ? void 0 : selectContext.setValue(listboxState.state.selectedValues[0]);
|
|
164
|
+
handleOpen(false);
|
|
165
|
+
}, [listboxState.state]);
|
|
166
|
+
if (isComponent('TextField')(renderedChildren)) {
|
|
167
|
+
var _props$children, _focusContext$state$a8, _selectContext$color, _selectContext$varian, _props$inputProps;
|
|
168
|
+
return /*#__PURE__*/React.cloneElement(renderedChildren, _objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2({}, getReferenceProps(_objectSpread2(_objectSpread2(_objectSpread2({
|
|
169
|
+
ref: triggerRef
|
|
170
|
+
}, props), renderedChildren.props), {}, {
|
|
171
|
+
children: (_props$children = renderedChildren.props.children) !== null && _props$children !== void 0 ? _props$children : ''
|
|
172
|
+
}))), {}, {
|
|
173
|
+
'aria-activedescendant': isOpen ? (_focusContext$state$a8 = focusContext.state.activedescendant) === null || _focusContext$state$a8 === void 0 ? void 0 : _focusContext$state$a8[0] : undefined,
|
|
174
|
+
className: classNames(renderedChildren.props.className, selectContext === null || selectContext === void 0 ? void 0 : selectContext.triggerClassName),
|
|
175
|
+
color: (_selectContext$color = selectContext === null || selectContext === void 0 ? void 0 : selectContext.color) !== null && _selectContext$color !== void 0 ? _selectContext$color : renderedChildren.props.color,
|
|
176
|
+
inputRef,
|
|
177
|
+
internal: (value, isDisabled, isInvalid, isRequired) => {
|
|
178
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, typeof renderedChildren.props.internal === 'function' ? renderedChildren.props.internal(value, isDisabled, isInvalid, isRequired) : renderedChildren.props.internal, hideExpandButton ? null : /*#__PURE__*/React.createElement(Icon, {
|
|
179
|
+
color: isDisabled ? 'no-data' : 'question',
|
|
180
|
+
icon: mdiChevronDown,
|
|
181
|
+
style: {
|
|
182
|
+
transition: 'transform 300ms ease-out',
|
|
183
|
+
transform: `rotate(${isOpen ? '-180deg' : '0'})`,
|
|
184
|
+
cursor: 'pointer'
|
|
185
|
+
}
|
|
186
|
+
}));
|
|
187
|
+
},
|
|
188
|
+
isActive: isOpen,
|
|
189
|
+
isDisabled: selectContext === null || selectContext === void 0 ? void 0 : selectContext.isDisabled,
|
|
190
|
+
isReadOnly: true,
|
|
191
|
+
theme,
|
|
192
|
+
role: 'combobox',
|
|
193
|
+
onClick: handleClick,
|
|
194
|
+
onKeyDown: handleKeyDown,
|
|
195
|
+
style: _objectSpread2(_objectSpread2({}, renderedChildren.props.style), {}, {
|
|
196
|
+
caretColor: 'transparent',
|
|
197
|
+
cursor: 'pointer'
|
|
198
|
+
}),
|
|
199
|
+
variant: (_selectContext$varian = selectContext === null || selectContext === void 0 ? void 0 : selectContext.variant) !== null && _selectContext$varian !== void 0 ? _selectContext$varian : renderedChildren.props.variant
|
|
200
|
+
}, (selectContext === null || selectContext === void 0 ? void 0 : selectContext.isInvalid) === true && {
|
|
201
|
+
color: 'error'
|
|
202
|
+
}), typeof children !== 'function' && (selectContext === null || selectContext === void 0 ? void 0 : selectContext.value) && {
|
|
203
|
+
value: selectContext.value
|
|
204
|
+
}), {}, {
|
|
205
|
+
inputProps: _objectSpread2(_objectSpread2({}, renderedChildren.props.inputProps), {}, {
|
|
206
|
+
style: _objectSpread2(_objectSpread2({}, (_props$inputProps = renderedChildren.props.inputProps) === null || _props$inputProps === void 0 ? void 0 : _props$inputProps.style), {}, {
|
|
207
|
+
cursor: 'pointer'
|
|
208
|
+
})
|
|
209
|
+
})
|
|
210
|
+
}));
|
|
211
|
+
} else if (isComponent('Button')(renderedChildren)) {
|
|
212
|
+
var _props$children2, _focusContext$state$a9, _props$ariaLabel, _selectContext$color2, _props$rightIcon, _props$rightIconProps, _selectContext$varian2;
|
|
213
|
+
const children = renderedChildren.props.children;
|
|
214
|
+
const label = typeof children === 'string' ? children : children === null || children === void 0 ? void 0 : children.textContent;
|
|
215
|
+
return /*#__PURE__*/React.cloneElement(renderedChildren, _objectSpread2(_objectSpread2(_objectSpread2({}, getReferenceProps(_objectSpread2(_objectSpread2(_objectSpread2({
|
|
216
|
+
ref: triggerRef
|
|
217
|
+
}, props), renderedChildren.props), {}, {
|
|
218
|
+
children: (_props$children2 = renderedChildren.props.children) !== null && _props$children2 !== void 0 ? _props$children2 : ''
|
|
219
|
+
}))), {}, {
|
|
220
|
+
'aria-activedescendant': isOpen ? (_focusContext$state$a9 = focusContext.state.activedescendant) === null || _focusContext$state$a9 === void 0 ? void 0 : _focusContext$state$a9[0] : undefined,
|
|
221
|
+
'aria-label': (_props$ariaLabel = renderedChildren.props['aria-label']) !== null && _props$ariaLabel !== void 0 ? _props$ariaLabel : label,
|
|
222
|
+
className: classNames(renderedChildren.props.className, selectContext === null || selectContext === void 0 ? void 0 : selectContext.triggerClassName),
|
|
223
|
+
color: (_selectContext$color2 = selectContext === null || selectContext === void 0 ? void 0 : selectContext.color) !== null && _selectContext$color2 !== void 0 ? _selectContext$color2 : renderedChildren.props.color,
|
|
224
|
+
isActive: isOpen,
|
|
225
|
+
isDisabled: selectContext === null || selectContext === void 0 ? void 0 : selectContext.isDisabled,
|
|
226
|
+
onClick: handleClick,
|
|
227
|
+
onKeyDown: handleKeyDown,
|
|
228
|
+
rightIcon: (_props$rightIcon = renderedChildren.props.rightIcon) !== null && _props$rightIcon !== void 0 ? _props$rightIcon : mdiChevronDown,
|
|
229
|
+
rightIconProps: renderedChildren.props.rightIcon ? renderedChildren.props.rightIconProps : (_props$rightIconProps = renderedChildren.props.rightIconProps) !== null && _props$rightIconProps !== void 0 ? _props$rightIconProps : {
|
|
230
|
+
style: {
|
|
231
|
+
transition: 'transform 300ms ease-out',
|
|
232
|
+
transform: `rotate(${isOpen ? '-180deg' : '0'})`
|
|
233
|
+
}
|
|
234
|
+
},
|
|
235
|
+
role: 'combobox',
|
|
236
|
+
theme,
|
|
237
|
+
variant: (_selectContext$varian2 = selectContext === null || selectContext === void 0 ? void 0 : selectContext.variant) !== null && _selectContext$varian2 !== void 0 ? _selectContext$varian2 : renderedChildren.props.variant
|
|
238
|
+
}, (selectContext === null || selectContext === void 0 ? void 0 : selectContext.isInvalid) === true && {
|
|
239
|
+
color: 'error'
|
|
240
|
+
}), typeof children !== 'function' && (selectContext === null || selectContext === void 0 ? void 0 : selectContext.value) && {
|
|
241
|
+
children: selectContext.value
|
|
242
|
+
}));
|
|
243
|
+
}
|
|
244
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, renderedChildren);
|
|
245
|
+
});
|
|
246
|
+
SelectTrigger.className = CLASSNAME;
|
|
247
|
+
SelectTrigger.displayName = COMPONENT_NAME;
|
|
248
|
+
|
|
249
|
+
export { SelectTrigger as S, SelectContext as a };
|
|
250
|
+
//# sourceMappingURL=SelectTrigger.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SelectTrigger.js","sources":["../../src/components/select/context.ts","../../src/components/select-trigger/SelectTrigger.tsx"],"sourcesContent":["import React from 'react';\nimport { SelectState } from './types';\n\nexport const SelectContext = React.createContext<SelectState | null>(null);\n","import React, { MouseEvent, ReactElement, forwardRef, useContext, useEffect, useRef } from 'react';\nimport classNames from 'classnames';\n\nimport {\n Comp,\n EventKey,\n FocusWithinGroupActionType,\n FocusWithinGroupContext,\n Icon,\n ListboxActionType,\n ListboxContext,\n isComponent,\n useTheme,\n} from '@redsift/design-system';\nimport { SelectTriggerProps } from './types';\nimport { useMergeRefs, usePopoverContext } from '@redsift/popovers';\nimport { SelectContext } from '../select/context';\nimport { mdiChevronDown } from '@redsift/icons';\n\nconst COMPONENT_NAME = 'SelectTrigger';\nconst CLASSNAME = 'redsift-select-trigger';\n\n/**\n * The SelectTrigger component.\n */\nexport const SelectTrigger: Comp<SelectTriggerProps, HTMLButtonElement> = forwardRef((props, ref) => {\n const { children, hideExpandButton } = props;\n\n const { getReferenceProps, isOpen, handleOpen, 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 selectContext = useContext(SelectContext);\n const listboxState = useContext(ListboxContext);\n const theme = useTheme();\n\n const renderedChildren =\n typeof children === 'function' ? children({ value: selectContext?.value, isOpen }) : children;\n\n const _inputRef = useRef<HTMLInputElement>();\n const inputRef = renderedChildren.props.inputRef ?? _inputRef;\n\n const handleKeyDown = (event: KeyboardEvent) => {\n const code = event.code;\n\n if (code === 'Escape') {\n if (isOpen) {\n handleOpen(false);\n }\n } else if (code === 'ArrowDown') {\n if (!isOpen) {\n handleOpen(true);\n }\n if (focusContext.state.selectedId !== null) {\n focusContext.dispatch({\n type: FocusWithinGroupActionType.DELAY_ACTION,\n payload: {\n type: FocusWithinGroupActionType.KEY_DOWN_ON_LIST,\n payload: {\n key: EventKey.ArrowDown,\n ctrlKey: event.ctrlKey,\n },\n },\n });\n } else if (!focusContext.state.activedescendant?.[0]) {\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 } else {\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 },\n },\n });\n }\n event.preventDefault();\n } else if (code === 'ArrowUp') {\n if (!isOpen) {\n handleOpen(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.Home,\n ctrlKey: event.ctrlKey,\n },\n },\n });\n event.preventDefault();\n } else if (code === 'Home') {\n if (!isOpen) {\n handleOpen(true);\n }\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 event.preventDefault();\n } else if (code === 'End') {\n if (!isOpen) {\n handleOpen(true);\n }\n focusContext.dispatch({\n type: FocusWithinGroupActionType.DELAY_ACTION,\n payload: {\n type: FocusWithinGroupActionType.KEY_DOWN_ON_LIST,\n payload: {\n key: EventKey.End,\n ctrlKey: event.ctrlKey,\n },\n },\n });\n event.preventDefault();\n } else if (code === 'Enter') {\n if (isOpen && focusContext.state.selectedId) {\n listboxState.dispatch({\n type: ListboxActionType.SET,\n payload: {\n values: [focusContext.state.activedescendant?.[1] ?? ''],\n activedescendant: focusContext.state.activedescendant,\n },\n });\n }\n }\n };\n\n const handleClick = (event: MouseEvent) => {\n event.preventDefault();\n if (isOpen) {\n handleOpen(false);\n } else {\n handleOpen(true);\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 },\n },\n });\n }\n };\n\n useEffect(() => {\n selectContext?.setValue(listboxState.state.selectedValues[0]);\n handleOpen(false);\n }, [listboxState.state]);\n\n if (isComponent('TextField')(renderedChildren)) {\n return React.cloneElement(renderedChildren, {\n ...getReferenceProps({\n ref: triggerRef,\n ...props,\n ...(renderedChildren as ReactElement).props,\n children: (renderedChildren as ReactElement).props.children ?? '',\n }),\n 'aria-activedescendant': isOpen ? focusContext.state.activedescendant?.[0] : undefined,\n className: classNames((renderedChildren as ReactElement).props.className, selectContext?.triggerClassName),\n color: selectContext?.color ?? (renderedChildren as ReactElement).props.color,\n inputRef,\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 <Icon\n color={isDisabled ? 'no-data' : 'question'}\n icon={mdiChevronDown}\n style={{\n transition: 'transform 300ms ease-out',\n transform: `rotate(${isOpen ? '-180deg' : '0'})`,\n cursor: 'pointer',\n }}\n />\n )}\n </>\n );\n },\n isActive: isOpen,\n isDisabled: selectContext?.isDisabled,\n isReadOnly: true,\n theme,\n role: 'combobox',\n onClick: handleClick,\n onKeyDown: handleKeyDown,\n style: { ...(renderedChildren as ReactElement).props.style, caretColor: 'transparent', cursor: 'pointer' },\n variant: selectContext?.variant ?? (renderedChildren as ReactElement).props.variant,\n ...(selectContext?.isInvalid === true && { color: 'error' }),\n ...(typeof children !== 'function' &&\n selectContext?.value && {\n value: selectContext.value,\n }),\n inputProps: {\n ...(renderedChildren as ReactElement).props.inputProps,\n style: { ...(renderedChildren as ReactElement).props.inputProps?.style, cursor: 'pointer' },\n },\n });\n } else if (isComponent('Button')(renderedChildren)) {\n const children = (renderedChildren as ReactElement).props.children;\n const label = typeof children === 'string' ? children : children?.textContent;\n\n return React.cloneElement(renderedChildren, {\n ...getReferenceProps({\n ref: triggerRef,\n ...props,\n ...(renderedChildren as ReactElement).props,\n children: (renderedChildren as ReactElement).props.children ?? '',\n }),\n 'aria-activedescendant': isOpen ? focusContext.state.activedescendant?.[0] : undefined,\n 'aria-label': (renderedChildren as ReactElement).props['aria-label'] ?? label,\n className: classNames((renderedChildren as ReactElement).props.className, selectContext?.triggerClassName),\n color: selectContext?.color ?? (renderedChildren as ReactElement).props.color,\n isActive: isOpen,\n isDisabled: selectContext?.isDisabled,\n onClick: handleClick,\n onKeyDown: handleKeyDown,\n rightIcon: (renderedChildren as ReactElement).props.rightIcon ?? mdiChevronDown,\n rightIconProps: (renderedChildren as ReactElement).props.rightIcon\n ? (renderedChildren as ReactElement).props.rightIconProps\n : (renderedChildren as ReactElement).props.rightIconProps ?? {\n style: {\n transition: 'transform 300ms ease-out',\n transform: `rotate(${isOpen ? '-180deg' : '0'})`,\n },\n },\n role: 'combobox',\n theme,\n variant: selectContext?.variant ?? (renderedChildren as ReactElement).props.variant,\n ...(selectContext?.isInvalid === true && { color: 'error' }),\n ...(typeof children !== 'function' &&\n selectContext?.value && {\n children: selectContext.value,\n }),\n });\n }\n\n return <>{renderedChildren}</>;\n});\nSelectTrigger.className = CLASSNAME;\nSelectTrigger.displayName = COMPONENT_NAME;\n"],"names":["SelectContext","React","createContext","COMPONENT_NAME","CLASSNAME","SelectTrigger","forwardRef","props","ref","_renderedChildren$pro","children","hideExpandButton","getReferenceProps","isOpen","handleOpen","refs","usePopoverContext","childrenRef","triggerRef","useMergeRefs","setReference","focusContext","useContext","FocusWithinGroupContext","selectContext","listboxState","ListboxContext","theme","useTheme","renderedChildren","value","_inputRef","useRef","inputRef","handleKeyDown","event","code","_focusContext$state$a","state","selectedId","dispatch","type","FocusWithinGroupActionType","DELAY_ACTION","payload","KEY_DOWN_ON_LIST","key","EventKey","ArrowDown","ctrlKey","activedescendant","Home","_focusContext$state$a2","_focusContext$state$a3","FOCUS_ON_LIST","id","preventDefault","ArrowUp","End","_focusContext$state$a4","_focusContext$state$a5","ListboxActionType","SET","values","handleClick","_focusContext$state$a6","_focusContext$state$a7","useEffect","setValue","selectedValues","isComponent","_props$children","_focusContext$state$a8","_selectContext$color","_selectContext$varian","_props$inputProps","cloneElement","_objectSpread","undefined","className","classNames","triggerClassName","color","internal","isDisabled","isInvalid","isRequired","createElement","Fragment","Icon","icon","mdiChevronDown","style","transition","transform","cursor","isActive","isReadOnly","role","onClick","onKeyDown","caretColor","variant","inputProps","_props$children2","_focusContext$state$a9","_props$ariaLabel","_selectContext$color2","_props$rightIcon","_props$rightIconProps","_selectContext$varian2","label","textContent","rightIcon","rightIconProps","displayName"],"mappings":";;;;;;;AAGO,MAAMA,aAAa,gBAAGC,KAAK,CAACC,aAAa,CAAqB,IAAI;;ACgBzE,MAAMC,cAAc,GAAG,eAAe,CAAA;AACtC,MAAMC,SAAS,GAAG,wBAAwB,CAAA;;AAE1C;AACA;AACA;AACO,MAAMC,aAA0D,gBAAGC,UAAU,CAAC,CAACC,KAAK,EAAEC,GAAG,KAAK;AAAA,EAAA,IAAAC,qBAAA,CAAA;EACnG,MAAM;IAAEC,QAAQ;AAAEC,IAAAA,gBAAAA;AAAiB,GAAC,GAAGJ,KAAK,CAAA;EAE5C,MAAM;IAAEK,iBAAiB;IAAEC,MAAM;IAAEC,UAAU;AAAEC,IAAAA,IAAAA;GAAM,GAAGC,iBAAiB,EAAE,CAAA;AAC3E,EAAA,MAAMC,WAAW,GAAIP,QAAQ,CAASF,GAAG,CAAA;AACzC,EAAA,MAAMU,UAAU,GAAGC,YAAY,CAAC,CAACJ,IAAI,CAACK,YAAY,EAAEZ,GAAG,EAAES,WAAW,CAAC,CAAC,CAAA;AAEtE,EAAA,MAAMI,YAAY,GAAGC,UAAU,CAACC,uBAAuB,CAAC,CAAA;AACxD,EAAA,MAAMC,aAAa,GAAGF,UAAU,CAACtB,aAAa,CAAC,CAAA;AAC/C,EAAA,MAAMyB,YAAY,GAAG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,IAAbA,aAAa,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAbA,aAAa,CAAEM,KAAK,CAAI,IAAA;MACtBpB,QAAQ,EAAEc,aAAa,CAACM,KAAAA;AAC1B,KAAC,CACJ,CAAC,CAAA;AACJ,GAAA;EAEA,oBAAO7B,KAAA,CAAAsF,aAAA,CAAAtF,KAAA,CAAAuF,QAAA,EAAG3D,IAAAA,EAAAA,gBAAmB,CAAC,CAAA;AAChC,CAAC,EAAC;AACFxB,aAAa,CAAC0E,SAAS,GAAG3E,SAAS,CAAA;AACnCC,aAAa,CAAC8G,WAAW,GAAGhH,cAAc;;;;"}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
function ownKeys(object, enumerableOnly) {
|
|
2
|
+
var keys = Object.keys(object);
|
|
3
|
+
if (Object.getOwnPropertySymbols) {
|
|
4
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
5
|
+
enumerableOnly && (symbols = symbols.filter(function (sym) {
|
|
6
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
7
|
+
})), keys.push.apply(keys, symbols);
|
|
8
|
+
}
|
|
9
|
+
return keys;
|
|
10
|
+
}
|
|
11
|
+
function _objectSpread2(target) {
|
|
12
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
13
|
+
var source = null != arguments[i] ? arguments[i] : {};
|
|
14
|
+
i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
|
|
15
|
+
_defineProperty(target, key, source[key]);
|
|
16
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {
|
|
17
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
return target;
|
|
21
|
+
}
|
|
22
|
+
function _defineProperty(obj, key, value) {
|
|
23
|
+
key = _toPropertyKey(key);
|
|
24
|
+
if (key in obj) {
|
|
25
|
+
Object.defineProperty(obj, key, {
|
|
26
|
+
value: value,
|
|
27
|
+
enumerable: true,
|
|
28
|
+
configurable: true,
|
|
29
|
+
writable: true
|
|
30
|
+
});
|
|
31
|
+
} else {
|
|
32
|
+
obj[key] = value;
|
|
33
|
+
}
|
|
34
|
+
return obj;
|
|
35
|
+
}
|
|
36
|
+
function _extends() {
|
|
37
|
+
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
|
38
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
39
|
+
var source = arguments[i];
|
|
40
|
+
for (var key in source) {
|
|
41
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
42
|
+
target[key] = source[key];
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
return target;
|
|
47
|
+
};
|
|
48
|
+
return _extends.apply(this, arguments);
|
|
49
|
+
}
|
|
50
|
+
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
51
|
+
if (source == null) return {};
|
|
52
|
+
var target = {};
|
|
53
|
+
var sourceKeys = Object.keys(source);
|
|
54
|
+
var key, i;
|
|
55
|
+
for (i = 0; i < sourceKeys.length; i++) {
|
|
56
|
+
key = sourceKeys[i];
|
|
57
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
58
|
+
target[key] = source[key];
|
|
59
|
+
}
|
|
60
|
+
return target;
|
|
61
|
+
}
|
|
62
|
+
function _objectWithoutProperties(source, excluded) {
|
|
63
|
+
if (source == null) return {};
|
|
64
|
+
var target = _objectWithoutPropertiesLoose(source, excluded);
|
|
65
|
+
var key, i;
|
|
66
|
+
if (Object.getOwnPropertySymbols) {
|
|
67
|
+
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
|
68
|
+
for (i = 0; i < sourceSymbolKeys.length; i++) {
|
|
69
|
+
key = sourceSymbolKeys[i];
|
|
70
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
71
|
+
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
72
|
+
target[key] = source[key];
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
return target;
|
|
76
|
+
}
|
|
77
|
+
function _toPrimitive(input, hint) {
|
|
78
|
+
if (typeof input !== "object" || input === null) return input;
|
|
79
|
+
var prim = input[Symbol.toPrimitive];
|
|
80
|
+
if (prim !== undefined) {
|
|
81
|
+
var res = prim.call(input, hint || "default");
|
|
82
|
+
if (typeof res !== "object") return res;
|
|
83
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
84
|
+
}
|
|
85
|
+
return (hint === "string" ? String : Number)(input);
|
|
86
|
+
}
|
|
87
|
+
function _toPropertyKey(arg) {
|
|
88
|
+
var key = _toPrimitive(arg, "string");
|
|
89
|
+
return typeof key === "symbol" ? key : String(key);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export { _objectWithoutProperties as _, _extends as a, _objectSpread2 as b };
|
|
93
|
+
//# sourceMappingURL=_rollupPluginBabelHelpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_rollupPluginBabelHelpers.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"combobox-content-footer.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"combobox-content-header.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"combobox-content-listbox.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"combobox-content.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"combobox-trigger.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|