@vygruppen/spor-react 2.4.0 → 2.4.1
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/.turbo/turbo-build.log +9 -9
- package/CHANGELOG.md +6 -0
- package/dist/{CountryCodeSelect-5DBHKSF3.mjs → CountryCodeSelect-MNHFBDDO.mjs} +1 -1
- package/dist/{chunk-D5OFVN6X.mjs → chunk-FLORQZEA.mjs} +43 -7
- package/dist/index.d.ts +4 -4
- package/dist/index.js +42 -6
- package/dist/index.mjs +1 -1
- package/package.json +1 -1
- package/src/input/Autosuggest.tsx +23 -2
- package/src/input/Combobox.tsx +57 -4
- package/src/input/ListBox.tsx +6 -4
package/.turbo/turbo-build.log
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
|
2
|
-
> @vygruppen/spor-react@2.4.
|
2
|
+
> @vygruppen/spor-react@2.4.1 build
|
3
3
|
> tsup src/index.tsx --dts --treeshake --format cjs,esm
|
4
4
|
|
5
5
|
[34mCLI[39m Building entry: src/index.tsx
|
@@ -9,13 +9,13 @@
|
|
9
9
|
[34mCJS[39m Build start
|
10
10
|
[34mESM[39m Build start
|
11
11
|
[34mDTS[39m Build start
|
12
|
-
"toTime" is imported from external module "@internationalized/date" but never used in "dist/chunk-D5OFVN6X.mjs".
|
13
12
|
"toTime" is imported from external module "@internationalized/date" but never used in "dist/index.js".
|
13
|
+
"toTime" is imported from external module "@internationalized/date" but never used in "dist/chunk-FLORQZEA.mjs".
|
14
|
+
[32mCJS[39m [1mdist/index.js [22m[32m895.79 KB[39m
|
15
|
+
[32mCJS[39m ⚡️ Build success in 5871ms
|
14
16
|
[32mESM[39m [1mdist/index.mjs [22m[32m2.08 KB[39m
|
15
|
-
[32mESM[39m [1mdist/CountryCodeSelect-
|
16
|
-
[32mESM[39m [1mdist/chunk-
|
17
|
-
[32mESM[39m ⚡️ Build success in
|
18
|
-
[
|
19
|
-
[
|
20
|
-
[32mDTS[39m ⚡️ Build success in 21721ms
|
21
|
-
[32mDTS[39m [1mdist/index.d.ts [22m[32m260.75 KB[39m
|
17
|
+
[32mESM[39m [1mdist/CountryCodeSelect-MNHFBDDO.mjs [22m[32m351.67 KB[39m
|
18
|
+
[32mESM[39m [1mdist/chunk-FLORQZEA.mjs [22m[32m415.99 KB[39m
|
19
|
+
[32mESM[39m ⚡️ Build success in 5874ms
|
20
|
+
[32mDTS[39m ⚡️ Build success in 22290ms
|
21
|
+
[32mDTS[39m [1mdist/index.d.ts [22m[32m261.60 KB[39m
|
package/CHANGELOG.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import { createTexts, useTranslation, InfoSelect, SelectItem } from './chunk-
|
1
|
+
import { createTexts, useTranslation, InfoSelect, SelectItem } from './chunk-FLORQZEA.mjs';
|
2
2
|
import React from 'react';
|
3
3
|
|
4
4
|
// ../../node_modules/awesome-phonenumber/index-esm.mjs
|
@@ -4023,7 +4023,8 @@ function Autosuggest({
|
|
4023
4023
|
label,
|
4024
4024
|
fetcher,
|
4025
4025
|
children,
|
4026
|
-
onSelectionChange
|
4026
|
+
onSelectionChange,
|
4027
|
+
...boxProps
|
4027
4028
|
}) {
|
4028
4029
|
const list2 = useAsyncList({
|
4029
4030
|
async load({ filterText }) {
|
@@ -4040,7 +4041,8 @@ function Autosuggest({
|
|
4040
4041
|
inputValue: list2.filterText,
|
4041
4042
|
onInputChange: list2.setFilterText,
|
4042
4043
|
isLoading: list2.isLoading,
|
4043
|
-
onSelectionChange
|
4044
|
+
onSelectionChange,
|
4045
|
+
...boxProps
|
4044
4046
|
},
|
4045
4047
|
children
|
4046
4048
|
);
|
@@ -4220,6 +4222,23 @@ var ChoiceChip = forwardRef((props, ref) => {
|
|
4220
4222
|
function Combobox({
|
4221
4223
|
label,
|
4222
4224
|
isLoading,
|
4225
|
+
leftIcon,
|
4226
|
+
rightIcon,
|
4227
|
+
borderBottomLeftRadius = "sm",
|
4228
|
+
borderBottomRightRadius = "sm",
|
4229
|
+
borderTopLeftRadius = "sm",
|
4230
|
+
borderTopRightRadius = "sm",
|
4231
|
+
marginBottom,
|
4232
|
+
marginTop,
|
4233
|
+
marginX,
|
4234
|
+
marginY,
|
4235
|
+
paddingBottom,
|
4236
|
+
paddingRight,
|
4237
|
+
paddingTop,
|
4238
|
+
paddingLeft,
|
4239
|
+
paddingX,
|
4240
|
+
paddingY,
|
4241
|
+
onFocus,
|
4223
4242
|
...rest
|
4224
4243
|
}) {
|
4225
4244
|
const { contains: contains2 } = useFilter({ sensitivity: "base" });
|
@@ -4248,7 +4267,22 @@ function Combobox({
|
|
4248
4267
|
...inputProps,
|
4249
4268
|
ref: inputRef,
|
4250
4269
|
label,
|
4251
|
-
|
4270
|
+
onFocus,
|
4271
|
+
borderBottomLeftRadius: state2.isOpen ? 0 : borderBottomLeftRadius,
|
4272
|
+
borderBottomRightRadius: state2.isOpen ? 0 : borderBottomRightRadius,
|
4273
|
+
borderTopLeftRadius,
|
4274
|
+
borderTopRightRadius,
|
4275
|
+
marginBottom,
|
4276
|
+
marginTop,
|
4277
|
+
marginX,
|
4278
|
+
marginY,
|
4279
|
+
paddingBottom,
|
4280
|
+
paddingRight,
|
4281
|
+
paddingTop,
|
4282
|
+
paddingLeft,
|
4283
|
+
paddingX,
|
4284
|
+
paddingY,
|
4285
|
+
leftIcon,
|
4252
4286
|
rightIcon: isLoading ? /* @__PURE__ */ React49__default.createElement(
|
4253
4287
|
ColorSpinner,
|
4254
4288
|
{
|
@@ -4261,7 +4295,7 @@ function Combobox({
|
|
4261
4295
|
}
|
4262
4296
|
}
|
4263
4297
|
}
|
4264
|
-
) :
|
4298
|
+
) : rightIcon
|
4265
4299
|
}
|
4266
4300
|
), state2.isOpen && /* @__PURE__ */ React49__default.createElement(
|
4267
4301
|
Popover3,
|
@@ -4364,7 +4398,7 @@ function ListBox({
|
|
4364
4398
|
sx: styles2.container,
|
4365
4399
|
"aria-busy": isLoading
|
4366
4400
|
},
|
4367
|
-
|
4401
|
+
Array.from(state2.collection).map(
|
4368
4402
|
(item) => item.type === "section" ? /* @__PURE__ */ React49__default.createElement(ListBoxSection, { key: item.key, section: item, state: state2 }) : /* @__PURE__ */ React49__default.createElement(Option, { key: item.key, item, state: state2 })
|
4369
4403
|
)
|
4370
4404
|
);
|
@@ -4431,7 +4465,9 @@ function ListBoxSection({ section, state: state2 }) {
|
|
4431
4465
|
...headingProps
|
4432
4466
|
},
|
4433
4467
|
section.rendered
|
4434
|
-
), /* @__PURE__ */ React49__default.createElement(List, { ...groupProps, padding: 0, listStyleType: "none" },
|
4468
|
+
), /* @__PURE__ */ React49__default.createElement(List, { ...groupProps, padding: 0, listStyleType: "none" }, Array.from(state2.collection.getChildren(section.key)).map(
|
4469
|
+
(item) => /* @__PURE__ */ React49__default.createElement(Option, { key: item.key, item, state: state2 })
|
4470
|
+
)));
|
4435
4471
|
}
|
4436
4472
|
|
4437
4473
|
// src/input/InfoSelect.tsx
|
@@ -4887,7 +4923,7 @@ var texts13 = createTexts({
|
|
4887
4923
|
sv: "Telefonnummer"
|
4888
4924
|
}
|
4889
4925
|
});
|
4890
|
-
var LazyCountryCodeSelect = React49__default.lazy(() => import('./CountryCodeSelect-
|
4926
|
+
var LazyCountryCodeSelect = React49__default.lazy(() => import('./CountryCodeSelect-MNHFBDDO.mjs'));
|
4891
4927
|
var Radio = forwardRef((props, ref) => {
|
4892
4928
|
return /* @__PURE__ */ React49__default.createElement(Radio$1, { ...props, ref });
|
4893
4929
|
});
|
package/dist/index.d.ts
CHANGED
@@ -647,7 +647,7 @@ type AutosuggestProps<T> = {
|
|
647
647
|
* Callback for when the selection changes.
|
648
648
|
*/
|
649
649
|
onSelectionChange?: ComboboxProps<T>["onSelectionChange"];
|
650
|
-
}
|
650
|
+
} & Pick<InputProps, "marginTop" | "marginBottom" | "marginY" | "marginX" | "paddingTop" | "paddingBottom" | "paddingLeft" | "paddingRight" | "paddingY" | "paddingX" | "leftIcon" | "rightIcon" | "borderTopRightRadius" | "borderTopLeftRadius" | "borderBottomRightRadius" | "borderBottomLeftRadius" | "onFocus">;
|
651
651
|
/**
|
652
652
|
* A component that provides an autocomplete search field with suggestions.
|
653
653
|
*
|
@@ -679,7 +679,7 @@ type AutosuggestProps<T> = {
|
|
679
679
|
* };
|
680
680
|
* ```
|
681
681
|
*/
|
682
|
-
declare function Autosuggest<T extends object>({ label, fetcher, children, onSelectionChange, }: AutosuggestProps<T>): React__default.JSX.Element;
|
682
|
+
declare function Autosuggest<T extends object>({ label, fetcher, children, onSelectionChange, ...boxProps }: AutosuggestProps<T>): React__default.JSX.Element;
|
683
683
|
|
684
684
|
type CardSelectProps = BoxProps & {
|
685
685
|
/** The design of the trigger button.
|
@@ -816,7 +816,7 @@ type ComboboxProps<T> = AriaComboBoxProps<T> & {
|
|
816
816
|
label: string;
|
817
817
|
/** Whether or not the combobox is waiting for new suggestions */
|
818
818
|
isLoading?: boolean;
|
819
|
-
}
|
819
|
+
} & Pick<InputProps, "marginTop" | "marginBottom" | "marginY" | "marginX" | "paddingTop" | "paddingBottom" | "paddingLeft" | "paddingRight" | "paddingY" | "paddingX" | "leftIcon" | "rightIcon" | "borderTopRightRadius" | "borderTopLeftRadius" | "borderBottomRightRadius" | "borderBottomLeftRadius" | "onFocus">;
|
820
820
|
/**
|
821
821
|
* A combobox is a combination of an input and a list of suggestions.
|
822
822
|
*
|
@@ -840,7 +840,7 @@ type ComboboxProps<T> = AriaComboBoxProps<T> & {
|
|
840
840
|
* </Combobox>
|
841
841
|
* ```
|
842
842
|
*/
|
843
|
-
declare function Combobox<T extends object>({ label, isLoading, ...rest }: ComboboxProps<T>): React__default.JSX.Element;
|
843
|
+
declare function Combobox<T extends object>({ label, isLoading, leftIcon, rightIcon, borderBottomLeftRadius, borderBottomRightRadius, borderTopLeftRadius, borderTopRightRadius, marginBottom, marginTop, marginX, marginY, paddingBottom, paddingRight, paddingTop, paddingLeft, paddingX, paddingY, onFocus, ...rest }: ComboboxProps<T>): React__default.JSX.Element;
|
844
844
|
|
845
845
|
type FormControlProps = FormControlProps$1;
|
846
846
|
declare const FormControl: _chakra_ui_system_dist_system_types.ComponentWithAs<"div", FormControlProps$1>;
|
package/dist/index.js
CHANGED
@@ -3754,7 +3754,8 @@ function Autosuggest({
|
|
3754
3754
|
label,
|
3755
3755
|
fetcher,
|
3756
3756
|
children,
|
3757
|
-
onSelectionChange
|
3757
|
+
onSelectionChange,
|
3758
|
+
...boxProps
|
3758
3759
|
}) {
|
3759
3760
|
const list2 = reactStately.useAsyncList({
|
3760
3761
|
async load({ filterText }) {
|
@@ -3771,7 +3772,8 @@ function Autosuggest({
|
|
3771
3772
|
inputValue: list2.filterText,
|
3772
3773
|
onInputChange: list2.setFilterText,
|
3773
3774
|
isLoading: list2.isLoading,
|
3774
|
-
onSelectionChange
|
3775
|
+
onSelectionChange,
|
3776
|
+
...boxProps
|
3775
3777
|
},
|
3776
3778
|
children
|
3777
3779
|
);
|
@@ -4735,6 +4737,23 @@ var init_ChoiceChip = __esm({
|
|
4735
4737
|
function Combobox({
|
4736
4738
|
label,
|
4737
4739
|
isLoading,
|
4740
|
+
leftIcon,
|
4741
|
+
rightIcon,
|
4742
|
+
borderBottomLeftRadius = "sm",
|
4743
|
+
borderBottomRightRadius = "sm",
|
4744
|
+
borderTopLeftRadius = "sm",
|
4745
|
+
borderTopRightRadius = "sm",
|
4746
|
+
marginBottom,
|
4747
|
+
marginTop,
|
4748
|
+
marginX,
|
4749
|
+
marginY,
|
4750
|
+
paddingBottom,
|
4751
|
+
paddingRight,
|
4752
|
+
paddingTop,
|
4753
|
+
paddingLeft,
|
4754
|
+
paddingX,
|
4755
|
+
paddingY,
|
4756
|
+
onFocus,
|
4738
4757
|
...rest
|
4739
4758
|
}) {
|
4740
4759
|
const { contains: contains2 } = reactAria.useFilter({ sensitivity: "base" });
|
@@ -4763,7 +4782,22 @@ function Combobox({
|
|
4763
4782
|
...inputProps,
|
4764
4783
|
ref: inputRef,
|
4765
4784
|
label,
|
4766
|
-
|
4785
|
+
onFocus,
|
4786
|
+
borderBottomLeftRadius: state2.isOpen ? 0 : borderBottomLeftRadius,
|
4787
|
+
borderBottomRightRadius: state2.isOpen ? 0 : borderBottomRightRadius,
|
4788
|
+
borderTopLeftRadius,
|
4789
|
+
borderTopRightRadius,
|
4790
|
+
marginBottom,
|
4791
|
+
marginTop,
|
4792
|
+
marginX,
|
4793
|
+
marginY,
|
4794
|
+
paddingBottom,
|
4795
|
+
paddingRight,
|
4796
|
+
paddingTop,
|
4797
|
+
paddingLeft,
|
4798
|
+
paddingX,
|
4799
|
+
paddingY,
|
4800
|
+
leftIcon,
|
4767
4801
|
rightIcon: isLoading ? /* @__PURE__ */ React49__namespace.default.createElement(
|
4768
4802
|
exports.ColorSpinner,
|
4769
4803
|
{
|
@@ -4776,7 +4810,7 @@ function Combobox({
|
|
4776
4810
|
}
|
4777
4811
|
}
|
4778
4812
|
}
|
4779
|
-
) :
|
4813
|
+
) : rightIcon
|
4780
4814
|
}
|
4781
4815
|
), state2.isOpen && /* @__PURE__ */ React49__namespace.default.createElement(
|
4782
4816
|
Popover3,
|
@@ -4899,7 +4933,7 @@ function ListBox({
|
|
4899
4933
|
sx: styles2.container,
|
4900
4934
|
"aria-busy": isLoading
|
4901
4935
|
},
|
4902
|
-
|
4936
|
+
Array.from(state2.collection).map(
|
4903
4937
|
(item) => item.type === "section" ? /* @__PURE__ */ React49__namespace.default.createElement(ListBoxSection, { key: item.key, section: item, state: state2 }) : /* @__PURE__ */ React49__namespace.default.createElement(Option, { key: item.key, item, state: state2 })
|
4904
4938
|
)
|
4905
4939
|
);
|
@@ -4957,7 +4991,9 @@ function ListBoxSection({ section, state: state2 }) {
|
|
4957
4991
|
...headingProps
|
4958
4992
|
},
|
4959
4993
|
section.rendered
|
4960
|
-
), /* @__PURE__ */ React49__namespace.default.createElement(react.List, { ...groupProps, padding: 0, listStyleType: "none" },
|
4994
|
+
), /* @__PURE__ */ React49__namespace.default.createElement(react.List, { ...groupProps, padding: 0, listStyleType: "none" }, Array.from(state2.collection.getChildren(section.key)).map(
|
4995
|
+
(item) => /* @__PURE__ */ React49__namespace.default.createElement(Option, { key: item.key, item, state: state2 })
|
4996
|
+
)));
|
4961
4997
|
}
|
4962
4998
|
exports.SelectItem = void 0; exports.SelectItemLabel = void 0; exports.SelectItemDescription = void 0; var OptionContext, useOptionContext;
|
4963
4999
|
var init_ListBox = __esm({
|
package/dist/index.mjs
CHANGED
@@ -1 +1 @@
|
|
1
|
-
export { Accordion, AccordionButton, AccordionIcon, AccordionItem, AccordionPanel, AttachedInputs, Autosuggest, Badge, Box, Button, ButtonGroup, Card, CardSelect, Center, Checkbox, CheckboxGroup, ChoiceChip, ClosableAlert, CloseButton, Code, Collapse, ColorInlineLoader, ColorSpinner, Combobox, Container, ContentLoader, DarkFullScreenLoader, DarkInlineLoader, DarkMode, DarkSpinner, DatePicker, DateRangePicker, Divider, Drawer, DrawerBody, DrawerCloseButton, DrawerContent, DrawerFooter, ModalHeader as DrawerHeader, DrawerOverlay, Expandable, ExpandableAlert, ExpandableItem, Fade, Flex, FloatingActionButton, FormControl, FormErrorMessage, FormHelperText, FormLabel, Grid, GridItem, HStack, Heading, IconButton, Image, Img, InfoSelect, InfoTag, Input, InputGroup, InputLeftElement, InputRightElement, Item, ItemDescription, ItemLabel, JumpButton, Language, LanguageProvider, LightFullScreenLoader, LightInlineLoader, LightMode, LightSpinner, LineIcon, ListBox, Modal, ModalBody, ModalCloseButton, ModalContent, ModalFooter, ModalHeader, ModalOverlay, NativeSelect, NumericStepper, PasswordInput, PhoneNumberInput, PlayPauseButton, Popover, PopoverAnchor, PopoverArrow, PopoverBody, PopoverCloseButton, PopoverContent, PopoverFooter, PopoverHeader, PopoverTrigger, PopoverWizardBody, ProgressBar, ProgressLoader, Radio, RadioGroup, ScaleFade, SearchInput, Section, SelectItem, SelectItemDescription, SelectItemLabel, SimpleDrawer, SimpleGrid, SimplePopover, Skeleton, SkeletonCircle, SkeletonText, SkipButton, Slide, SlideFade, Spacer, SporProvider, Stack, StaticAlert, Stepper, StepperStep, Switch, Tab, TabList, TabPanel, TabPanels, Table, TableCaption, Tabs, Tbody, Td, Text, TextLink, Textarea, Tfoot, Th, Thead, Time, TimePicker, Tr, TravelTag, VStack, VyLogo, WizardPopover, Wrap, WrapItem, createTexts, extendTheme, fontFaces, theme, tokens, useBreakpointValue, useClipboard, useColorMode, useColorModePreference, useColorModeValue, useControllableProp, useDisclosure, useMediaQuery, useMergeRefs, useOutsideClick, usePrefersReducedMotion, useTheme, useToast, useToken, useTranslation } from './chunk-
|
1
|
+
export { Accordion, AccordionButton, AccordionIcon, AccordionItem, AccordionPanel, AttachedInputs, Autosuggest, Badge, Box, Button, ButtonGroup, Card, CardSelect, Center, Checkbox, CheckboxGroup, ChoiceChip, ClosableAlert, CloseButton, Code, Collapse, ColorInlineLoader, ColorSpinner, Combobox, Container, ContentLoader, DarkFullScreenLoader, DarkInlineLoader, DarkMode, DarkSpinner, DatePicker, DateRangePicker, Divider, Drawer, DrawerBody, DrawerCloseButton, DrawerContent, DrawerFooter, ModalHeader as DrawerHeader, DrawerOverlay, Expandable, ExpandableAlert, ExpandableItem, Fade, Flex, FloatingActionButton, FormControl, FormErrorMessage, FormHelperText, FormLabel, Grid, GridItem, HStack, Heading, IconButton, Image, Img, InfoSelect, InfoTag, Input, InputGroup, InputLeftElement, InputRightElement, Item, ItemDescription, ItemLabel, JumpButton, Language, LanguageProvider, LightFullScreenLoader, LightInlineLoader, LightMode, LightSpinner, LineIcon, ListBox, Modal, ModalBody, ModalCloseButton, ModalContent, ModalFooter, ModalHeader, ModalOverlay, NativeSelect, NumericStepper, PasswordInput, PhoneNumberInput, PlayPauseButton, Popover, PopoverAnchor, PopoverArrow, PopoverBody, PopoverCloseButton, PopoverContent, PopoverFooter, PopoverHeader, PopoverTrigger, PopoverWizardBody, ProgressBar, ProgressLoader, Radio, RadioGroup, ScaleFade, SearchInput, Section, SelectItem, SelectItemDescription, SelectItemLabel, SimpleDrawer, SimpleGrid, SimplePopover, Skeleton, SkeletonCircle, SkeletonText, SkipButton, Slide, SlideFade, Spacer, SporProvider, Stack, StaticAlert, Stepper, StepperStep, Switch, Tab, TabList, TabPanel, TabPanels, Table, TableCaption, Tabs, Tbody, Td, Text, TextLink, Textarea, Tfoot, Th, Thead, Time, TimePicker, Tr, TravelTag, VStack, VyLogo, WizardPopover, Wrap, WrapItem, createTexts, extendTheme, fontFaces, theme, tokens, useBreakpointValue, useClipboard, useColorMode, useColorModePreference, useColorModeValue, useControllableProp, useDisclosure, useMediaQuery, useMergeRefs, useOutsideClick, usePrefersReducedMotion, useTheme, useToast, useToken, useTranslation } from './chunk-FLORQZEA.mjs';
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
import React from "react";
|
2
2
|
import { useAsyncList } from "react-stately";
|
3
|
-
import { Combobox, ComboboxProps } from "../";
|
3
|
+
import { Combobox, ComboboxProps, InputProps } from "../";
|
4
4
|
|
5
5
|
type AutosuggestProps<T> = {
|
6
6
|
/** The label of the search field */
|
@@ -42,7 +42,26 @@ type AutosuggestProps<T> = {
|
|
42
42
|
* Callback for when the selection changes.
|
43
43
|
*/
|
44
44
|
onSelectionChange?: ComboboxProps<T>["onSelectionChange"];
|
45
|
-
}
|
45
|
+
} & Pick<
|
46
|
+
InputProps,
|
47
|
+
| "marginTop"
|
48
|
+
| "marginBottom"
|
49
|
+
| "marginY"
|
50
|
+
| "marginX"
|
51
|
+
| "paddingTop"
|
52
|
+
| "paddingBottom"
|
53
|
+
| "paddingLeft"
|
54
|
+
| "paddingRight"
|
55
|
+
| "paddingY"
|
56
|
+
| "paddingX"
|
57
|
+
| "leftIcon"
|
58
|
+
| "rightIcon"
|
59
|
+
| "borderTopRightRadius"
|
60
|
+
| "borderTopLeftRadius"
|
61
|
+
| "borderBottomRightRadius"
|
62
|
+
| "borderBottomLeftRadius"
|
63
|
+
| "onFocus"
|
64
|
+
>;
|
46
65
|
/**
|
47
66
|
* A component that provides an autocomplete search field with suggestions.
|
48
67
|
*
|
@@ -79,6 +98,7 @@ export function Autosuggest<T extends object>({
|
|
79
98
|
fetcher,
|
80
99
|
children,
|
81
100
|
onSelectionChange,
|
101
|
+
...boxProps
|
82
102
|
}: AutosuggestProps<T>) {
|
83
103
|
const list = useAsyncList<T>({
|
84
104
|
async load({ filterText }) {
|
@@ -95,6 +115,7 @@ export function Autosuggest<T extends object>({
|
|
95
115
|
onInputChange={list.setFilterText}
|
96
116
|
isLoading={list.isLoading}
|
97
117
|
onSelectionChange={onSelectionChange}
|
118
|
+
{...boxProps}
|
98
119
|
>
|
99
120
|
{children}
|
100
121
|
</Combobox>
|
package/src/input/Combobox.tsx
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
import React, { useRef } from "react";
|
2
2
|
import { AriaComboBoxProps, useComboBox, useFilter } from "react-aria";
|
3
3
|
import { useComboBoxState } from "react-stately";
|
4
|
-
import { ColorSpinner, FormControl, Input, ListBox } from "..";
|
4
|
+
import { ColorSpinner, FormControl, Input, InputProps, ListBox } from "..";
|
5
5
|
import { Popover } from "./Popover";
|
6
6
|
|
7
7
|
export type ComboboxProps<T> = AriaComboBoxProps<T> & {
|
@@ -9,7 +9,26 @@ export type ComboboxProps<T> = AriaComboBoxProps<T> & {
|
|
9
9
|
label: string;
|
10
10
|
/** Whether or not the combobox is waiting for new suggestions */
|
11
11
|
isLoading?: boolean;
|
12
|
-
}
|
12
|
+
} & Pick<
|
13
|
+
InputProps,
|
14
|
+
| "marginTop"
|
15
|
+
| "marginBottom"
|
16
|
+
| "marginY"
|
17
|
+
| "marginX"
|
18
|
+
| "paddingTop"
|
19
|
+
| "paddingBottom"
|
20
|
+
| "paddingLeft"
|
21
|
+
| "paddingRight"
|
22
|
+
| "paddingY"
|
23
|
+
| "paddingX"
|
24
|
+
| "leftIcon"
|
25
|
+
| "rightIcon"
|
26
|
+
| "borderTopRightRadius"
|
27
|
+
| "borderTopLeftRadius"
|
28
|
+
| "borderBottomRightRadius"
|
29
|
+
| "borderBottomLeftRadius"
|
30
|
+
| "onFocus"
|
31
|
+
>;
|
13
32
|
/**
|
14
33
|
* A combobox is a combination of an input and a list of suggestions.
|
15
34
|
*
|
@@ -36,6 +55,23 @@ export type ComboboxProps<T> = AriaComboBoxProps<T> & {
|
|
36
55
|
export function Combobox<T extends object>({
|
37
56
|
label,
|
38
57
|
isLoading,
|
58
|
+
leftIcon,
|
59
|
+
rightIcon,
|
60
|
+
borderBottomLeftRadius = "sm",
|
61
|
+
borderBottomRightRadius = "sm",
|
62
|
+
borderTopLeftRadius = "sm",
|
63
|
+
borderTopRightRadius = "sm",
|
64
|
+
marginBottom,
|
65
|
+
marginTop,
|
66
|
+
marginX,
|
67
|
+
marginY,
|
68
|
+
paddingBottom,
|
69
|
+
paddingRight,
|
70
|
+
paddingTop,
|
71
|
+
paddingLeft,
|
72
|
+
paddingX,
|
73
|
+
paddingY,
|
74
|
+
onFocus,
|
39
75
|
...rest
|
40
76
|
}: ComboboxProps<T>) {
|
41
77
|
const { contains } = useFilter({ sensitivity: "base" });
|
@@ -67,7 +103,22 @@ export function Combobox<T extends object>({
|
|
67
103
|
{...inputProps}
|
68
104
|
ref={inputRef}
|
69
105
|
label={label}
|
70
|
-
|
106
|
+
onFocus={onFocus}
|
107
|
+
borderBottomLeftRadius={state.isOpen ? 0 : borderBottomLeftRadius}
|
108
|
+
borderBottomRightRadius={state.isOpen ? 0 : borderBottomRightRadius}
|
109
|
+
borderTopLeftRadius={borderTopLeftRadius}
|
110
|
+
borderTopRightRadius={borderTopRightRadius}
|
111
|
+
marginBottom={marginBottom}
|
112
|
+
marginTop={marginTop}
|
113
|
+
marginX={marginX}
|
114
|
+
marginY={marginY}
|
115
|
+
paddingBottom={paddingBottom}
|
116
|
+
paddingRight={paddingRight}
|
117
|
+
paddingTop={paddingTop}
|
118
|
+
paddingLeft={paddingLeft}
|
119
|
+
paddingX={paddingX}
|
120
|
+
paddingY={paddingY}
|
121
|
+
leftIcon={leftIcon}
|
71
122
|
rightIcon={
|
72
123
|
isLoading ? (
|
73
124
|
<ColorSpinner
|
@@ -80,7 +131,9 @@ export function Combobox<T extends object>({
|
|
80
131
|
},
|
81
132
|
}}
|
82
133
|
/>
|
83
|
-
) :
|
134
|
+
) : (
|
135
|
+
rightIcon
|
136
|
+
)
|
84
137
|
}
|
85
138
|
/>
|
86
139
|
{state.isOpen && (
|
package/src/input/ListBox.tsx
CHANGED
@@ -80,7 +80,7 @@ export function ListBox<T extends object>({
|
|
80
80
|
sx={styles.container}
|
81
81
|
aria-busy={isLoading}
|
82
82
|
>
|
83
|
-
{
|
83
|
+
{Array.from(state.collection).map((item) =>
|
84
84
|
item.type === "section" ? (
|
85
85
|
<ListBoxSection key={item.key} section={item} state={state} />
|
86
86
|
) : (
|
@@ -203,9 +203,11 @@ function ListBoxSection({ section, state }: ListBoxSectionProps) {
|
|
203
203
|
</Box>
|
204
204
|
)}
|
205
205
|
<List {...groupProps} padding={0} listStyleType="none">
|
206
|
-
{
|
207
|
-
|
208
|
-
|
206
|
+
{Array.from(state.collection.getChildren(section.key)).map(
|
207
|
+
(item: any) => (
|
208
|
+
<Option key={item.key} item={item} state={state} />
|
209
|
+
)
|
210
|
+
)}
|
209
211
|
</List>
|
210
212
|
</ListItem>
|
211
213
|
);
|