@vygruppen/spor-react 12.8.10 → 12.9.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/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { useSlotRecipe, Accordion as Accordion$1, Stack, Box, HStack, Progress, defineRecipe, chakra, Text, useRecipe, Circle, Skeleton as Skeleton$1, Button as Button$1, Group, Badge as Badge$1, Code as Code$1, Clipboard as Clipboard$1, IconButton as IconButton$1, useDisclosure, Alert as Alert$1, Span, Flex, Breadcrumb as Breadcrumb$1, ClientOnly as ClientOnly$1, Field, defineStyle, PopoverAnchor, useFieldContext, Popover as Popover$1, Portal, Dialog, createContext as createContext$1, Drawer as Drawer$1, Grid, GridItem, usePopoverContext, Checkbox as Checkbox$1, CheckboxCard, Fieldset as Fieldset$1, InputElement, Input as Input$1, NativeSelect as NativeSelect$1, useControllableState, createListCollection, RadioGroup as RadioGroup$1, Select as Select$1, useSelectContext, Switch as Switch$1, Textarea as Textarea$1, RadioCard as RadioCard$1, Separator as Separator$1, Link, List as List$1, Center, PopoverCloseTrigger, Pagination as Pagination$1, usePaginationContext, createToaster, Tabs as Tabs$1, Table as Table$1, defineSemanticTokens, defineSlotRecipe, defineTokens, defineAnimationStyles, defineGlobalStyles, defineTextStyles, createSystem, defaultBaseConfig, Tooltip as Tooltip$1, VisuallyHidden, defineConfig, CheckboxGroup as CheckboxGroup$1, ListItem, ChakraProvider, Toaster as Toaster$1, Toast, Icon } from '@chakra-ui/react';
1
+ import { useSlotRecipe, Accordion as Accordion$1, Stack, Box, HStack, Progress, defineRecipe, chakra, Text, useRecipe, Circle, Skeleton as Skeleton$1, Button as Button$1, Group, Badge as Badge$1, Code as Code$1, Clipboard as Clipboard$1, IconButton as IconButton$1, useDisclosure, Alert as Alert$1, Span, Flex, Breadcrumb as Breadcrumb$1, ClientOnly as ClientOnly$1, Field, defineStyle, PopoverAnchor, useFieldContext, Popover as Popover$1, Portal, Dialog, createContext as createContext$1, useDialogContext, Drawer as Drawer$1, Grid, GridItem, usePopoverContext, Checkbox as Checkbox$1, CheckboxCard, Fieldset as Fieldset$1, InputElement, Input as Input$1, NativeSelect as NativeSelect$1, useControllableState, createListCollection, RadioGroup as RadioGroup$1, Select as Select$1, useSelectContext, Switch as Switch$1, Textarea as Textarea$1, RadioCard as RadioCard$1, Separator as Separator$1, Link, List as List$1, Center, PopoverCloseTrigger, Pagination as Pagination$1, usePaginationContext, createToaster, Tabs as Tabs$1, Table as Table$1, defineSemanticTokens, defineSlotRecipe, defineTokens, defineAnimationStyles, defineGlobalStyles, defineTextStyles, createSystem, defaultBaseConfig, Tooltip as Tooltip$1, VisuallyHidden, defineConfig, CheckboxGroup as CheckboxGroup$1, ListItem, ChakraProvider, Toaster as Toaster$1, Toast, Icon } from '@chakra-ui/react';
2
2
  export { AspectRatio, Box, BreadcrumbCurrentLink, BreadcrumbEllipsis, BreadcrumbLink, Center, ClientOnly, Collapsible, Container, Em, Flex, For, FormatByte, FormatNumber, Grid, GridItem, HStack, Icon, Image, Kbd, LocaleProvider, Portal, Show, SimpleGrid, Spacer, Span, Stack, TableBody, TableCaption, TableCell, TableColumn, TableColumnGroup, TableColumnHeader, TableFooter, TableHeader, TableRoot, TableRow, VStack, VisuallyHidden, createIcon, createListCollection, createSystem, defineConfig, defineRecipe, defineStyle, chakra as spor, useBreakpointValue, useCheckbox, useClipboard, useControllableProp, useDisclosure, useMediaQuery, useRecipe, useSlotRecipe, useToken } from '@chakra-ui/react';
3
3
  import { DropdownDownFill24Icon, CopyOutline18Icon, CheckmarkFill18Icon, CloseFill18Icon, CloseFill30Icon, CloseFill24Icon, ServiceFill24Icon, QuestionFill24Icon, ErrorOutline24Icon, ErrorFill24Icon, AltTransportFill24Icon, WarningFill24Icon, SuccessFill24Icon, InformationFill24Icon, DropdownDownFill18Icon, DropdownRightFill18Icon, CalendarOutline24Icon, ArrowLeftFill24Icon, CloseOutline24Icon, SearchOutline24Icon, InformationFill18Icon, WarningFill18Icon, ErrorFill18Icon, Forward15MediaControllerFill30Icon, Backward15MediaControllerFill30Icon, PauseMediaControllerFill24Icon, PlayMediaControllerFill24Icon, NextMediaControllerFill30Icon, PreviousMediaControllerFill30Icon, ArrowRightFill18Icon, DropdownLeftOutline18Icon, DropdownRightOutline18Icon, WalkFill30Icon, WalkFill24Icon, WalkFill18Icon, AltTransportFill30Icon, AltTransportFill18Icon, TramFill30Icon, TramFill24Icon, TramFill18Icon, SubwayFill30Icon, SubwayFill24Icon, SubwayFill18Icon, FerryFill30Icon, FerryFill24Icon, FerryFill18Icon, BusFill30Icon, BusFill24Icon, BusFill18Icon, ExpressBusFill30Icon, ExpressBusFill24Icon, ExpressBusFill18Icon, TrainFill30Icon, TrainFill24Icon, TrainFill18Icon, LinkOutOutline24Icon, LinkOutOutline18Icon, ArrowLeftOutline24Icon, ArrowRightOutline24Icon, DropdownLeftFill18Icon, SuccessFill18Icon } from '@vygruppen/spor-icon-react';
4
4
  import * as React27 from 'react';
@@ -15,6 +15,7 @@ import { useDateFieldState, useDatePickerState, useCalendarState, useRangeCalend
15
15
  export { Item, Section } from 'react-stately';
16
16
  import { GregorianCalendar, createCalendar, getLocalTimeZone, endOfMonth, getWeeksInMonth, isSameMonth, isToday, parseTime } from '@internationalized/date';
17
17
  export { Time } from '@internationalized/date';
18
+ import { useSwipeable } from 'react-swipeable';
18
19
  import { getSupportedCallingCodes } from 'awesome-phonenumber';
19
20
  import { Global } from '@emotion/react';
20
21
  import tokens23__default from '@vygruppen/spor-design-tokens';
@@ -2356,38 +2357,38 @@ var DrawerContent = forwardRef(
2356
2357
  (props, ref) => {
2357
2358
  const { children, portalled = true, portalRef, ...rest } = props;
2358
2359
  const { size, placement } = useRootDrawerProps();
2360
+ const { setOpen } = useDialogContext();
2361
+ const handlers = useSwipeable({
2362
+ onSwiped: (e) => {
2363
+ const shouldClose = placement === "bottom" && e.dir === "Down" || placement === "top" && e.dir === "Up" || placement === "end" && e.dir === "Right" || placement === "start" && e.dir === "Left";
2364
+ if (shouldClose) {
2365
+ setOpen(false);
2366
+ }
2367
+ },
2368
+ swipeDuration: 250
2369
+ });
2359
2370
  const sizeNotFull = size !== "full";
2360
- return /* @__PURE__ */ jsx(Portal, { disabled: !portalled, container: portalRef, children: /* @__PURE__ */ jsx(Drawer$1.Positioner, { children: /* @__PURE__ */ jsxs(Drawer$1.Content, { ref, ...rest, children: [
2371
+ return /* @__PURE__ */ jsx(Portal, { disabled: !portalled, container: portalRef, children: /* @__PURE__ */ jsx(Drawer$1.Positioner, { children: /* @__PURE__ */ jsx(Box, { ...handlers, width: "100%", children: /* @__PURE__ */ jsxs(Drawer$1.Content, { ref, ...rest, children: [
2361
2372
  sizeNotFull && placement === "bottom" && /* @__PURE__ */ jsx(CloseDrawerLine, {}),
2362
2373
  children,
2363
2374
  sizeNotFull && placement === "top" && /* @__PURE__ */ jsx(CloseDrawerLine, {})
2364
- ] }) }) });
2375
+ ] }) }) }) });
2365
2376
  }
2366
2377
  );
2367
2378
  DrawerContent.displayName = "DrawerContent";
2368
2379
  var CloseDrawerLine = forwardRef((props, ref) => {
2369
- const { t } = useTranslation();
2370
2380
  return /* @__PURE__ */ jsx(
2371
- Drawer$1.CloseTrigger,
2381
+ Box,
2372
2382
  {
2373
- ...props,
2374
- ref,
2375
- position: "relative",
2376
- insetEnd: "unset",
2377
- "aria-label": t(texts12.close),
2378
- cursor: "pointer",
2383
+ width: 7,
2384
+ minHeight: 1,
2379
2385
  top: 0,
2380
- paddingY: 2,
2381
- children: /* @__PURE__ */ jsx(
2382
- Box,
2383
- {
2384
- width: 7,
2385
- height: 1,
2386
- backgroundColor: "silver",
2387
- borderRadius: "xs",
2388
- marginX: "auto"
2389
- }
2390
- )
2386
+ marginY: 2,
2387
+ marginX: "auto",
2388
+ backgroundColor: "silver",
2389
+ borderRadius: "xs",
2390
+ ...props,
2391
+ ref
2391
2392
  }
2392
2393
  );
2393
2394
  });