@vygruppen/spor-react 3.3.2 → 3.3.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
 
2
- > @vygruppen/spor-react@3.3.2 build
2
+ > @vygruppen/spor-react@3.3.4 build
3
3
  > tsup src/index.tsx --dts --treeshake --format cjs,esm
4
4
 
5
5
  CLI Building entry: src/index.tsx
@@ -9,13 +9,13 @@
9
9
  CJS Build start
10
10
  ESM Build start
11
11
  DTS Build start
12
+ "toZoned" and "toTime" are imported from external module "@internationalized/date" but never used in "dist/chunk-QHD5YJ6K.mjs".
12
13
  "toZoned" and "toTime" are imported from external module "@internationalized/date" but never used in "dist/index.js".
13
- "toZoned" and "toTime" are imported from external module "@internationalized/date" but never used in "dist/chunk-U4A5DVNS.mjs".
14
- CJS dist/index.js 902.94 KB
15
- CJS ⚡️ Build success in 4694ms
16
14
  ESM dist/index.mjs 2.01 KB
17
- ESM dist/CountryCodeSelect-R5RS2HYK.mjs 350.82 KB
18
- ESM dist/chunk-U4A5DVNS.mjs 420.18 KB
19
- ESM ⚡️ Build success in 4694ms
20
- DTS ⚡️ Build success in 16906ms
21
- DTS dist/index.d.ts 252.16 KB
15
+ ESM dist/CountryCodeSelect-HKZBFK6T.mjs 350.82 KB
16
+ ESM dist/chunk-QHD5YJ6K.mjs 420.68 KB
17
+ ESM ⚡️ Build success in 6202ms
18
+ CJS dist/index.js 903.47 KB
19
+ CJS ⚡️ Build success in 6203ms
20
+ DTS ⚡️ Build success in 23010ms
21
+ DTS dist/index.d.ts 252.39 KB
package/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # @vygruppen/spor-react
2
2
 
3
+ ## 3.3.4
4
+
5
+ ### Patch Changes
6
+
7
+ - afebaf34: Override minimum left padding in ComboBox and InfoSelect popovers
8
+ - 309d4e18: Change type of calendar trigger button to "button"
9
+ - 2c7f2004: IconButton: Add missing floating variant
10
+ - Updated dependencies [9f84f18f]
11
+ - @vygruppen/spor-icon-react@3.2.0
12
+
13
+ ## 3.3.3
14
+
15
+ ### Patch Changes
16
+
17
+ - 3a95bedd: Accordion: Make the text size responsive
18
+
3
19
  ## 3.3.2
4
20
 
5
21
  ### Patch Changes
@@ -1,4 +1,4 @@
1
- import { createTexts, useTranslation, InfoSelect, Item } from './chunk-U4A5DVNS.mjs';
1
+ import { createTexts, useTranslation, InfoSelect, Item } from './chunk-QHD5YJ6K.mjs';
2
2
  import React from 'react';
3
3
 
4
4
  // ../../node_modules/awesome-phonenumber/index-esm.mjs
@@ -3584,14 +3584,23 @@ var CalendarTriggerButton = forwardRef(
3584
3584
  ({ ...buttonProps }, ref) => {
3585
3585
  const { t: t2 } = useTranslation();
3586
3586
  const styles2 = useMultiStyleConfig("Datepicker", {});
3587
+ const { onPress, ...filteredButtonProps } = buttonProps;
3588
+ const handleOnPress = (event) => {
3589
+ if (onPress) {
3590
+ if (event.key == "Enter" || event.key == " ")
3591
+ onPress(event);
3592
+ }
3593
+ };
3587
3594
  return /* @__PURE__ */ React49__default.createElement(PopoverAnchor, null, /* @__PURE__ */ React49__default.createElement(
3588
3595
  Box,
3589
3596
  {
3590
3597
  ref,
3591
3598
  as: "button",
3599
+ type: "button",
3592
3600
  "aria-label": t2(texts9.openCalendar),
3593
3601
  sx: styles2.calendarTriggerButton,
3594
- ...buttonProps
3602
+ ...filteredButtonProps,
3603
+ onKeyUp: handleOnPress
3595
3604
  },
3596
3605
  /* @__PURE__ */ React49__default.createElement(CalendarOutline24Icon, null)
3597
3606
  ));
@@ -4130,7 +4139,8 @@ var Popover3 = forwardRef$1(
4130
4139
  placement = "bottom",
4131
4140
  shouldFlip = false,
4132
4141
  isNonModal = false,
4133
- hasBackdrop = true
4142
+ hasBackdrop = true,
4143
+ containerPadding = 12
4134
4144
  }, ref) => {
4135
4145
  var _a6;
4136
4146
  const internalRef = useRef(null);
@@ -4143,7 +4153,8 @@ var Popover3 = forwardRef$1(
4143
4153
  crossOffset,
4144
4154
  placement,
4145
4155
  shouldFlip,
4146
- isNonModal
4156
+ isNonModal,
4157
+ containerPadding
4147
4158
  },
4148
4159
  state2
4149
4160
  );
@@ -4152,8 +4163,7 @@ var Popover3 = forwardRef$1(
4152
4163
  {
4153
4164
  ...popoverProps,
4154
4165
  ref: popoverRef,
4155
- minWidth: ((_a6 = triggerRef.current) == null ? void 0 : _a6.clientWidth) ?? "auto",
4156
- marginLeft: -2
4166
+ minWidth: ((_a6 = triggerRef.current) == null ? void 0 : _a6.clientWidth) ?? "auto"
4157
4167
  },
4158
4168
  /* @__PURE__ */ React49__default.createElement(DismissButton, { onDismiss: state2.close }),
4159
4169
  children,
@@ -4393,7 +4403,8 @@ function Combobox({
4393
4403
  isNonModal: true,
4394
4404
  placement: "bottom start",
4395
4405
  shouldFlip: false,
4396
- hasBackdrop: false
4406
+ hasBackdrop: false,
4407
+ containerPadding: 0
4397
4408
  },
4398
4409
  /* @__PURE__ */ React49__default.createElement(
4399
4410
  ListBox,
@@ -4649,16 +4660,24 @@ function InfoSelect({
4649
4660
  },
4650
4661
  /* @__PURE__ */ React49__default.createElement(Box, { ...valueProps }, state2.selectedItem ? state2.selectedItem.textValue ?? state2.selectedItem.rendered : placeholder ?? t2(texts11.selectAnOption)),
4651
4662
  /* @__PURE__ */ React49__default.createElement(Box, { sx: styles2.arrowIcon }, state2.isOpen ? /* @__PURE__ */ React49__default.createElement(DropdownUpFill24Icon, null) : /* @__PURE__ */ React49__default.createElement(DropdownDownFill24Icon, null))
4652
- ), state2.isOpen && /* @__PURE__ */ React49__default.createElement(Popover3, { state: state2, triggerRef }, /* @__PURE__ */ React49__default.createElement(
4653
- ListBox,
4663
+ ), state2.isOpen && /* @__PURE__ */ React49__default.createElement(
4664
+ Popover3,
4654
4665
  {
4655
- ...menuProps,
4656
4666
  state: state2,
4657
- listBoxRef: listboxRef,
4658
- borderBottomRadius: "sm"
4667
+ triggerRef,
4668
+ containerPadding: 0
4659
4669
  },
4660
- props.children
4661
- )));
4670
+ /* @__PURE__ */ React49__default.createElement(
4671
+ ListBox,
4672
+ {
4673
+ ...menuProps,
4674
+ state: state2,
4675
+ listBoxRef: listboxRef,
4676
+ borderBottomRadius: "sm"
4677
+ },
4678
+ props.children
4679
+ )
4680
+ ));
4662
4681
  }
4663
4682
  var texts11 = createTexts({
4664
4683
  selectAnOption: {
@@ -5065,7 +5084,7 @@ var texts14 = createTexts({
5065
5084
  sv: "Telefonnummer"
5066
5085
  }
5067
5086
  });
5068
- var LazyCountryCodeSelect = React49__default.lazy(() => import('./CountryCodeSelect-R5RS2HYK.mjs'));
5087
+ var LazyCountryCodeSelect = React49__default.lazy(() => import('./CountryCodeSelect-HKZBFK6T.mjs'));
5069
5088
  var Radio = forwardRef((props, ref) => {
5070
5089
  return /* @__PURE__ */ React49__default.createElement(Radio$1, { ...props, ref });
5071
5090
  });
@@ -11030,34 +11049,34 @@ var config3 = helpers.defineMultiStyleConfig({
11030
11049
  sizes: {
11031
11050
  sm: {
11032
11051
  button: {
11033
- fontSize: "desktop.xs",
11052
+ fontSize: ["mobile.xs", "desktop.xs"],
11034
11053
  paddingX: 2,
11035
11054
  paddingY: 1
11036
11055
  },
11037
11056
  panel: {
11038
- fontSize: "desktop.xs",
11057
+ fontSize: ["mobile.xs", "desktop.xs"],
11039
11058
  paddingX: 2
11040
11059
  }
11041
11060
  },
11042
11061
  md: {
11043
11062
  button: {
11044
- fontSize: "desktop.sm",
11063
+ fontSize: ["mobile.sm", "desktop.sm"],
11045
11064
  paddingX: 3,
11046
11065
  paddingY: 1
11047
11066
  },
11048
11067
  panel: {
11049
- fontSize: "desktop.sm",
11068
+ fontSize: ["mobile.sm", "desktop.sm"],
11050
11069
  paddingX: 3
11051
11070
  }
11052
11071
  },
11053
11072
  lg: {
11054
11073
  button: {
11055
- fontSize: "desktop.sm",
11074
+ fontSize: ["mobile.sm", "desktop.sm"],
11056
11075
  paddingX: 3,
11057
11076
  paddingY: 2
11058
11077
  },
11059
11078
  panel: {
11060
- fontSize: "desktop.sm",
11079
+ fontSize: ["mobile.sm", "desktop.sm"],
11061
11080
  paddingX: 3
11062
11081
  }
11063
11082
  }
package/dist/index.d.ts CHANGED
@@ -307,7 +307,7 @@ type ButtonGroupProps = ButtonGroupProps$1;
307
307
  declare const ButtonGroup: _chakra_ui_system_dist_system_types.ComponentWithAs<"div", ButtonGroupProps$1>;
308
308
 
309
309
  type IconButtonProps = Omit<IconButtonProps$1, "variant"> & {
310
- variant: "control" | "primary" | "secondary" | "tertiary" | "additional" | "ghost";
310
+ variant: "control" | "primary" | "secondary" | "tertiary" | "additional" | "ghost" | "floating";
311
311
  };
312
312
  /**
313
313
  * An icon-only button.
@@ -322,6 +322,7 @@ type IconButtonProps = Omit<IconButtonProps$1, "variant"> & {
322
322
  * - `tertiary`: Used for non-essential actions, as well as in combination with the primary button.
323
323
  * - `additional`: Used for additional choices, like a less important tertiary action.
324
324
  * - `ghost`: Used inside other interactive elements, like date pickers and input fields.
325
+ * - `floating`: Used for floating actions, like a menu button in a menu.
325
326
  *
326
327
  * ```tsx
327
328
  * <IconButton
@@ -1966,34 +1967,34 @@ declare const theme: {
1966
1967
  sizes?: {
1967
1968
  sm: {
1968
1969
  button: {
1969
- fontSize: string;
1970
+ fontSize: ("mobile.xs" | "desktop.xs")[];
1970
1971
  paddingX: number;
1971
1972
  paddingY: number;
1972
1973
  };
1973
1974
  panel: {
1974
- fontSize: string;
1975
+ fontSize: ("mobile.xs" | "desktop.xs")[];
1975
1976
  paddingX: number;
1976
1977
  };
1977
1978
  };
1978
1979
  md: {
1979
1980
  button: {
1980
- fontSize: string;
1981
+ fontSize: ("mobile.sm" | "desktop.sm")[];
1981
1982
  paddingX: number;
1982
1983
  paddingY: number;
1983
1984
  };
1984
1985
  panel: {
1985
- fontSize: string;
1986
+ fontSize: ("mobile.sm" | "desktop.sm")[];
1986
1987
  paddingX: number;
1987
1988
  };
1988
1989
  };
1989
1990
  lg: {
1990
1991
  button: {
1991
- fontSize: string;
1992
+ fontSize: ("mobile.sm" | "desktop.sm")[];
1992
1993
  paddingX: number;
1993
1994
  paddingY: number;
1994
1995
  };
1995
1996
  panel: {
1996
- fontSize: string;
1997
+ fontSize: ("mobile.sm" | "desktop.sm")[];
1997
1998
  paddingX: number;
1998
1999
  };
1999
2000
  };
package/dist/index.js CHANGED
@@ -3244,14 +3244,23 @@ var init_CalendarTriggerButton = __esm({
3244
3244
  ({ ...buttonProps }, ref) => {
3245
3245
  const { t: t2 } = useTranslation();
3246
3246
  const styles2 = react.useMultiStyleConfig("Datepicker", {});
3247
+ const { onPress, ...filteredButtonProps } = buttonProps;
3248
+ const handleOnPress = (event) => {
3249
+ if (onPress) {
3250
+ if (event.key == "Enter" || event.key == " ")
3251
+ onPress(event);
3252
+ }
3253
+ };
3247
3254
  return /* @__PURE__ */ React49__namespace.default.createElement(react.PopoverAnchor, null, /* @__PURE__ */ React49__namespace.default.createElement(
3248
3255
  react.Box,
3249
3256
  {
3250
3257
  ref,
3251
3258
  as: "button",
3259
+ type: "button",
3252
3260
  "aria-label": t2(texts9.openCalendar),
3253
3261
  sx: styles2.calendarTriggerButton,
3254
- ...buttonProps
3262
+ ...filteredButtonProps,
3263
+ onKeyUp: handleOnPress
3255
3264
  },
3256
3265
  /* @__PURE__ */ React49__namespace.default.createElement(sporIconReact.CalendarOutline24Icon, null)
3257
3266
  ));
@@ -3874,7 +3883,8 @@ var init_Popover = __esm({
3874
3883
  placement = "bottom",
3875
3884
  shouldFlip = false,
3876
3885
  isNonModal = false,
3877
- hasBackdrop = true
3886
+ hasBackdrop = true,
3887
+ containerPadding = 12
3878
3888
  }, ref) => {
3879
3889
  var _a6;
3880
3890
  const internalRef = React49.useRef(null);
@@ -3887,7 +3897,8 @@ var init_Popover = __esm({
3887
3897
  crossOffset,
3888
3898
  placement,
3889
3899
  shouldFlip,
3890
- isNonModal
3900
+ isNonModal,
3901
+ containerPadding
3891
3902
  },
3892
3903
  state2
3893
3904
  );
@@ -3896,8 +3907,7 @@ var init_Popover = __esm({
3896
3907
  {
3897
3908
  ...popoverProps,
3898
3909
  ref: popoverRef,
3899
- minWidth: ((_a6 = triggerRef.current) == null ? void 0 : _a6.clientWidth) ?? "auto",
3900
- marginLeft: -2
3910
+ minWidth: ((_a6 = triggerRef.current) == null ? void 0 : _a6.clientWidth) ?? "auto"
3901
3911
  },
3902
3912
  /* @__PURE__ */ React49__namespace.default.createElement(reactAria.DismissButton, { onDismiss: state2.close }),
3903
3913
  children,
@@ -4908,7 +4918,8 @@ function Combobox({
4908
4918
  isNonModal: true,
4909
4919
  placement: "bottom start",
4910
4920
  shouldFlip: false,
4911
- hasBackdrop: false
4921
+ hasBackdrop: false,
4922
+ containerPadding: 0
4912
4923
  },
4913
4924
  /* @__PURE__ */ React49__namespace.default.createElement(
4914
4925
  ListBox,
@@ -5189,16 +5200,24 @@ function InfoSelect({
5189
5200
  },
5190
5201
  /* @__PURE__ */ React49__namespace.default.createElement(react.Box, { ...valueProps }, state2.selectedItem ? state2.selectedItem.textValue ?? state2.selectedItem.rendered : placeholder ?? t2(texts11.selectAnOption)),
5191
5202
  /* @__PURE__ */ React49__namespace.default.createElement(react.Box, { sx: styles2.arrowIcon }, state2.isOpen ? /* @__PURE__ */ React49__namespace.default.createElement(sporIconReact.DropdownUpFill24Icon, null) : /* @__PURE__ */ React49__namespace.default.createElement(sporIconReact.DropdownDownFill24Icon, null))
5192
- ), state2.isOpen && /* @__PURE__ */ React49__namespace.default.createElement(Popover3, { state: state2, triggerRef }, /* @__PURE__ */ React49__namespace.default.createElement(
5193
- ListBox,
5203
+ ), state2.isOpen && /* @__PURE__ */ React49__namespace.default.createElement(
5204
+ Popover3,
5194
5205
  {
5195
- ...menuProps,
5196
5206
  state: state2,
5197
- listBoxRef: listboxRef,
5198
- borderBottomRadius: "sm"
5207
+ triggerRef,
5208
+ containerPadding: 0
5199
5209
  },
5200
- props.children
5201
- )));
5210
+ /* @__PURE__ */ React49__namespace.default.createElement(
5211
+ ListBox,
5212
+ {
5213
+ ...menuProps,
5214
+ state: state2,
5215
+ listBoxRef: listboxRef,
5216
+ borderBottomRadius: "sm"
5217
+ },
5218
+ props.children
5219
+ )
5220
+ ));
5202
5221
  }
5203
5222
  var texts11;
5204
5223
  var init_InfoSelect = __esm({
@@ -19026,34 +19045,34 @@ var init_accordion2 = __esm({
19026
19045
  sizes: {
19027
19046
  sm: {
19028
19047
  button: {
19029
- fontSize: "desktop.xs",
19048
+ fontSize: ["mobile.xs", "desktop.xs"],
19030
19049
  paddingX: 2,
19031
19050
  paddingY: 1
19032
19051
  },
19033
19052
  panel: {
19034
- fontSize: "desktop.xs",
19053
+ fontSize: ["mobile.xs", "desktop.xs"],
19035
19054
  paddingX: 2
19036
19055
  }
19037
19056
  },
19038
19057
  md: {
19039
19058
  button: {
19040
- fontSize: "desktop.sm",
19059
+ fontSize: ["mobile.sm", "desktop.sm"],
19041
19060
  paddingX: 3,
19042
19061
  paddingY: 1
19043
19062
  },
19044
19063
  panel: {
19045
- fontSize: "desktop.sm",
19064
+ fontSize: ["mobile.sm", "desktop.sm"],
19046
19065
  paddingX: 3
19047
19066
  }
19048
19067
  },
19049
19068
  lg: {
19050
19069
  button: {
19051
- fontSize: "desktop.sm",
19070
+ fontSize: ["mobile.sm", "desktop.sm"],
19052
19071
  paddingX: 3,
19053
19072
  paddingY: 2
19054
19073
  },
19055
19074
  panel: {
19056
- fontSize: "desktop.sm",
19075
+ fontSize: ["mobile.sm", "desktop.sm"],
19057
19076
  paddingX: 3
19058
19077
  }
19059
19078
  }
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- export { Accordion, AccordionButton, AccordionIcon, AccordionItem, AccordionPanel, AttachedInputs, 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, 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-U4A5DVNS.mjs';
1
+ export { Accordion, AccordionButton, AccordionIcon, AccordionItem, AccordionPanel, AttachedInputs, 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, 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-QHD5YJ6K.mjs';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vygruppen/spor-react",
3
- "version": "3.3.2",
3
+ "version": "3.3.4",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.mjs",
6
6
  "types": "./dist/index.d.ts",
@@ -14,7 +14,8 @@ export type IconButtonProps = Omit<ChakraIconButtonProps, "variant"> & {
14
14
  | "secondary"
15
15
  | "tertiary"
16
16
  | "additional"
17
- | "ghost";
17
+ | "ghost"
18
+ | "floating";
18
19
  };
19
20
  /**
20
21
  * An icon-only button.
@@ -29,6 +30,7 @@ export type IconButtonProps = Omit<ChakraIconButtonProps, "variant"> & {
29
30
  * - `tertiary`: Used for non-essential actions, as well as in combination with the primary button.
30
31
  * - `additional`: Used for additional choices, like a less important tertiary action.
31
32
  * - `ghost`: Used inside other interactive elements, like date pickers and input fields.
33
+ * - `floating`: Used for floating actions, like a menu button in a menu.
32
34
  *
33
35
  * ```tsx
34
36
  * <IconButton
@@ -6,7 +6,7 @@ import {
6
6
  As,
7
7
  } from "@chakra-ui/react";
8
8
  import { CalendarOutline24Icon } from "@vygruppen/spor-icon-react";
9
- import React from "react";
9
+ import React, { useEffect } from "react";
10
10
  import { AriaButtonProps } from "react-aria";
11
11
  import { createTexts, useTranslation } from "..";
12
12
 
@@ -16,14 +16,25 @@ export const CalendarTriggerButton = forwardRef<CalendarTriggerButtonProps, As>(
16
16
  const { t } = useTranslation();
17
17
  const styles = useMultiStyleConfig("Datepicker", {});
18
18
 
19
+ const { onPress, ...filteredButtonProps } = buttonProps;
20
+
21
+ const handleOnPress = (event: KeyboardEvent) => {
22
+ if (onPress) {
23
+ if (event.key == "Enter" || event.key == " ")
24
+ onPress(event as any)
25
+ }
26
+ }
27
+
19
28
  return (
20
29
  <PopoverAnchor>
21
30
  <Box
22
31
  ref={ref}
23
32
  as="button"
33
+ type="button"
24
34
  aria-label={t(texts.openCalendar)}
25
35
  sx={styles.calendarTriggerButton}
26
- {...buttonProps}
36
+ {...filteredButtonProps}
37
+ onKeyUp={handleOnPress}
27
38
  >
28
39
  <CalendarOutline24Icon />
29
40
  </Box>
@@ -21,7 +21,6 @@ import { CalendarOutline24Icon } from "@vygruppen/spor-icon-react";
21
21
  import React, { forwardRef, useRef } from "react";
22
22
  import {
23
23
  AriaDatePickerProps,
24
- CalendarProps,
25
24
  I18nProvider,
26
25
  useDatePicker,
27
26
  } from "react-aria";
@@ -164,6 +164,9 @@ export function Combobox<T extends object>({
164
164
  placement="bottom start"
165
165
  shouldFlip={false}
166
166
  hasBackdrop={false}
167
+ // The minimum padding should be 0, because the popover always should be
168
+ // aligned with the input field regardless of the left padding in the container.
169
+ containerPadding={0}
167
170
  >
168
171
  <ListBox
169
172
  {...listBoxProps}
@@ -216,7 +216,13 @@ export function InfoSelect<T extends object>({
216
216
  </chakra.button>
217
217
 
218
218
  {state.isOpen && (
219
- <Popover state={state} triggerRef={triggerRef}>
219
+ <Popover
220
+ state={state}
221
+ triggerRef={triggerRef}
222
+ // The minimum padding should be 0, because the popover always should be
223
+ // aligned with the trigger field regardless of the left padding in the container.
224
+ containerPadding={0}
225
+ >
220
226
  <ListBox
221
227
  {...menuProps}
222
228
  state={state}
@@ -44,6 +44,11 @@ type PopoverProps = {
44
44
  * Defaults to true
45
45
  */
46
46
  hasBackdrop?: boolean;
47
+ /** The minimum padding required between the popover and the surrounding container
48
+ *
49
+ * Defaults to 12 (the same as React Aria's default)
50
+ */
51
+ containerPadding?: number;
47
52
  };
48
53
  /**
49
54
  * Internal popover component.
@@ -62,6 +67,7 @@ export const Popover = forwardRef<HTMLDivElement, PopoverProps>(
62
67
  shouldFlip = false,
63
68
  isNonModal = false,
64
69
  hasBackdrop = true,
70
+ containerPadding = 12,
65
71
  },
66
72
  ref
67
73
  ) => {
@@ -77,6 +83,7 @@ export const Popover = forwardRef<HTMLDivElement, PopoverProps>(
77
83
  placement,
78
84
  shouldFlip,
79
85
  isNonModal,
86
+ containerPadding,
80
87
  },
81
88
  state
82
89
  );
@@ -86,7 +93,6 @@ export const Popover = forwardRef<HTMLDivElement, PopoverProps>(
86
93
  {...popoverProps}
87
94
  ref={popoverRef}
88
95
  minWidth={triggerRef.current?.clientWidth ?? "auto"}
89
- marginLeft={-2}
90
96
  >
91
97
  <DismissButton onDismiss={state.close} />
92
98
  {children}
@@ -107,34 +107,34 @@ const config = helpers.defineMultiStyleConfig({
107
107
  sizes: {
108
108
  sm: {
109
109
  button: {
110
- fontSize: "desktop.xs",
110
+ fontSize: ["mobile.xs", "desktop.xs"],
111
111
  paddingX: 2,
112
112
  paddingY: 1,
113
113
  },
114
114
  panel: {
115
- fontSize: "desktop.xs",
115
+ fontSize: ["mobile.xs", "desktop.xs"],
116
116
  paddingX: 2,
117
117
  },
118
118
  },
119
119
  md: {
120
120
  button: {
121
- fontSize: "desktop.sm",
121
+ fontSize: ["mobile.sm", "desktop.sm"],
122
122
  paddingX: 3,
123
123
  paddingY: 1,
124
124
  },
125
125
  panel: {
126
- fontSize: "desktop.sm",
126
+ fontSize: ["mobile.sm", "desktop.sm"],
127
127
  paddingX: 3,
128
128
  },
129
129
  },
130
130
  lg: {
131
131
  button: {
132
- fontSize: "desktop.sm",
132
+ fontSize: ["mobile.sm", "desktop.sm"],
133
133
  paddingX: 3,
134
134
  paddingY: 2,
135
135
  },
136
136
  panel: {
137
- fontSize: "desktop.sm",
137
+ fontSize: ["mobile.sm", "desktop.sm"],
138
138
  paddingX: 3,
139
139
  },
140
140
  },