@vygruppen/spor-react 12.14.2 → 12.15.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.d.cts CHANGED
@@ -916,9 +916,12 @@ declare const DrawerContent: React$1.ForwardRefExoticComponent<Drawer$1.ContentP
916
916
  children: React.ReactNode;
917
917
  portalled?: boolean;
918
918
  portalRef?: React.RefObject<HTMLElement>;
919
+ hideHandle?: boolean;
919
920
  } & React$1.RefAttributes<HTMLDivElement>>;
920
921
  declare const CloseDrawerLine: React$1.ForwardRefExoticComponent<React$1.RefAttributes<HTMLButtonElement>>;
921
- declare const DrawerCloseTrigger: React$1.ForwardRefExoticComponent<Drawer$1.CloseTriggerProps & React$1.RefAttributes<HTMLButtonElement>>;
922
+ declare const DrawerCloseTrigger: React$1.ForwardRefExoticComponent<Drawer$1.CloseTriggerProps & {
923
+ showText?: boolean;
924
+ } & React$1.RefAttributes<HTMLButtonElement>>;
922
925
  declare const DrawerBackTrigger: React$1.ForwardRefExoticComponent<Drawer$1.CloseTriggerProps & React$1.RefAttributes<HTMLButtonElement>>;
923
926
  declare const DrawerFullScreenHeader: React$1.ForwardRefExoticComponent<Omit<Drawer$1.HeaderProps, "title"> & {
924
927
  backTrigger?: boolean;
package/dist/index.d.ts CHANGED
@@ -916,9 +916,12 @@ declare const DrawerContent: React$1.ForwardRefExoticComponent<Drawer$1.ContentP
916
916
  children: React.ReactNode;
917
917
  portalled?: boolean;
918
918
  portalRef?: React.RefObject<HTMLElement>;
919
+ hideHandle?: boolean;
919
920
  } & React$1.RefAttributes<HTMLDivElement>>;
920
921
  declare const CloseDrawerLine: React$1.ForwardRefExoticComponent<React$1.RefAttributes<HTMLButtonElement>>;
921
- declare const DrawerCloseTrigger: React$1.ForwardRefExoticComponent<Drawer$1.CloseTriggerProps & React$1.RefAttributes<HTMLButtonElement>>;
922
+ declare const DrawerCloseTrigger: React$1.ForwardRefExoticComponent<Drawer$1.CloseTriggerProps & {
923
+ showText?: boolean;
924
+ } & React$1.RefAttributes<HTMLButtonElement>>;
922
925
  declare const DrawerBackTrigger: React$1.ForwardRefExoticComponent<Drawer$1.CloseTriggerProps & React$1.RefAttributes<HTMLButtonElement>>;
923
926
  declare const DrawerFullScreenHeader: React$1.ForwardRefExoticComponent<Omit<Drawer$1.HeaderProps, "title"> & {
924
927
  backTrigger?: boolean;
package/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
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, 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
- 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';
3
+ import { DropdownDownFill24Icon, CopyOutline18Icon, CheckmarkFill18Icon, CloseFill18Icon, CloseFill30Icon, CloseFill24Icon, InformationFill24Icon, ServiceFill24Icon, QuestionFill24Icon, ErrorOutline24Icon, ErrorFill24Icon, AltTransportFill24Icon, WarningFill24Icon, SuccessFill24Icon, 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';
5
5
  import React27__default, { forwardRef, createContext, useId, cloneElement, useEffect, useRef, useState, isValidElement, useMemo, useLayoutEffect, useContext } from 'react';
6
6
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
@@ -942,46 +942,56 @@ var useScrollDirection = () => {
942
942
  return scrollDirection;
943
943
  };
944
944
  var AlertIcon = forwardRef(
945
- ({ variant, customIcon }, ref) => {
945
+ ({ variant, customIcon: CustomAlertIcon }, ref) => {
946
946
  const { t } = useTranslation();
947
- const Icon3 = customIcon ?? getIcon(variant);
948
947
  return /* @__PURE__ */ jsx(
949
948
  Box,
950
949
  {
951
- as: Icon3,
950
+ asChild: true,
952
951
  ref,
953
952
  "aria-label": t(texts5[variant]),
954
- color: customIcon ? `alert.${variant}.icon` : void 0
953
+ children: CustomAlertIcon ? /* @__PURE__ */ jsx(CustomAlertIcon, { color: `alert.${variant}.icon` }) : /* @__PURE__ */ jsx(BaseAlertIcon, { variant })
955
954
  }
956
955
  );
957
956
  }
958
957
  );
959
958
  AlertIcon.displayName = "AlertIcon";
960
- var getIcon = (variant) => {
959
+ var BaseAlertIcon = ({ variant }) => {
960
+ const css = {
961
+ "& path:first-of-type": {
962
+ fill: `alert.${variant}.icon`
963
+ },
964
+ "& path:not(:first-of-type)": {
965
+ fill: `alert.${variant}.surface`
966
+ }
967
+ };
961
968
  switch (variant) {
962
969
  case "info": {
963
- return InformationFill24Icon;
970
+ return /* @__PURE__ */ jsx(InformationFill24Icon, { css });
964
971
  }
965
972
  case "success": {
966
- return SuccessFill24Icon;
973
+ return /* @__PURE__ */ jsx(SuccessFill24Icon, { css });
967
974
  }
968
975
  case "important": {
969
- return WarningFill24Icon;
976
+ return /* @__PURE__ */ jsx(WarningFill24Icon, {});
970
977
  }
971
978
  case "alt": {
972
- return AltTransportFill24Icon;
979
+ return /* @__PURE__ */ jsx(AltTransportFill24Icon, { css });
973
980
  }
974
981
  case "error": {
975
- return ErrorFill24Icon;
982
+ return /* @__PURE__ */ jsx(ErrorFill24Icon, { css });
976
983
  }
977
984
  case "error-secondary": {
978
- return ErrorOutline24Icon;
985
+ return /* @__PURE__ */ jsx(ErrorOutline24Icon, { css });
979
986
  }
980
987
  case "neutral": {
981
- return QuestionFill24Icon;
988
+ return /* @__PURE__ */ jsx(QuestionFill24Icon, { css });
982
989
  }
983
990
  case "service": {
984
- return ServiceFill24Icon;
991
+ return /* @__PURE__ */ jsx(ServiceFill24Icon, {});
992
+ }
993
+ default: {
994
+ return /* @__PURE__ */ jsx(InformationFill24Icon, { css });
985
995
  }
986
996
  }
987
997
  };
@@ -1386,6 +1396,20 @@ var FieldErrorText = React27.forwardRef((props, ref) => {
1386
1396
  });
1387
1397
  FieldErrorText.displayName = "FieldErrorText";
1388
1398
  var FieldLabel = Field.Label;
1399
+
1400
+ // src/util/slugify.tsx
1401
+ function slugify(text, maxLength = 50) {
1402
+ if (!text) {
1403
+ return text;
1404
+ }
1405
+ if (Array.isArray(text)) {
1406
+ text = text.join(" ");
1407
+ }
1408
+ if (maxLength < 1) {
1409
+ throw new Error("The maxLength parameter must be a positive number");
1410
+ }
1411
+ return text.normalize("NFD").replaceAll(/[\u0300-\u036F]/g, "").replaceAll(/[\u00C6\u00E6]/g, "ae").replaceAll(/[\u00D8\u00F8]/g, "oe").replaceAll(/[\u00C5\u00E5]/g, "aa").toLowerCase().replaceAll(/\s+/g, "-").replaceAll(/[^\w-]+/g, "").replaceAll(/--+/g, "-").replace(/^-+/, "").replace(/-+$/, "").slice(0, Math.max(0, maxLength));
1412
+ }
1389
1413
  function CalendarCell({
1390
1414
  state,
1391
1415
  date,
@@ -1430,9 +1454,9 @@ function CalendarCell({
1430
1454
  );
1431
1455
  }, []);
1432
1456
  return /* @__PURE__ */ jsx(Box, { as: "td", ...cellProps, textAlign: "center", css: styles.cell, children: /* @__PURE__ */ jsx(
1433
- Box,
1457
+ chakra.button,
1434
1458
  {
1435
- as: "button",
1459
+ type: "button",
1436
1460
  ...buttonProps,
1437
1461
  ...stateProps,
1438
1462
  ref,
@@ -2139,20 +2163,6 @@ function DateRangePicker({
2139
2163
  ] })
2140
2164
  ] }) });
2141
2165
  }
2142
-
2143
- // src/util/slugify.tsx
2144
- function slugify(text, maxLength = 50) {
2145
- if (!text) {
2146
- return text;
2147
- }
2148
- if (Array.isArray(text)) {
2149
- text = text.join(" ");
2150
- }
2151
- if (maxLength < 1) {
2152
- throw new Error("The maxLength parameter must be a positive number");
2153
- }
2154
- return text.normalize("NFD").replaceAll(/[\u0300-\u036F]/g, "").replaceAll(/[\u00C6\u00E6]/g, "ae").replaceAll(/[\u00D8\u00F8]/g, "oe").replaceAll(/[\u00C5\u00E5]/g, "aa").toLowerCase().replaceAll(/\s+/g, "-").replaceAll(/[^\w-]+/g, "").replaceAll(/--+/g, "-").replace(/^-+/, "").replace(/-+$/, "").slice(0, Math.max(0, maxLength));
2155
- }
2156
2166
  var TimeField = ({ state, ...props }) => {
2157
2167
  const ref = useRef(null);
2158
2168
  const { labelProps, fieldProps } = useTimeField(props, state, ref);
@@ -2374,7 +2384,13 @@ var [RootDrawerProvider, useRootDrawerProps] = createContext$1({
2374
2384
  });
2375
2385
  var DrawerContent = forwardRef(
2376
2386
  (props, ref) => {
2377
- const { children, portalled = true, portalRef, ...rest } = props;
2387
+ const {
2388
+ children,
2389
+ portalled = true,
2390
+ portalRef,
2391
+ hideHandle = false,
2392
+ ...rest
2393
+ } = props;
2378
2394
  const { size, placement } = useRootDrawerProps();
2379
2395
  const { setOpen } = useDialogContext();
2380
2396
  const handlers = useSwipeable({
@@ -2387,10 +2403,11 @@ var DrawerContent = forwardRef(
2387
2403
  swipeDuration: 250
2388
2404
  });
2389
2405
  const sizeNotFull = size !== "full";
2406
+ const showHandle = !hideHandle;
2390
2407
  return /* @__PURE__ */ jsx(Portal, { disabled: !portalled, container: portalRef, children: /* @__PURE__ */ jsx(Drawer$1.Positioner, { asChild: true, children: /* @__PURE__ */ jsx(Box, { ...handlers, width: "100%", children: /* @__PURE__ */ jsxs(Drawer$1.Content, { ref, ...rest, children: [
2391
- sizeNotFull && placement === "bottom" && /* @__PURE__ */ jsx(CloseDrawerLine, {}),
2408
+ showHandle && sizeNotFull && placement === "bottom" && /* @__PURE__ */ jsx(CloseDrawerLine, {}),
2392
2409
  children,
2393
- sizeNotFull && placement === "top" && /* @__PURE__ */ jsx(CloseDrawerLine, {})
2410
+ showHandle && sizeNotFull && placement === "top" && /* @__PURE__ */ jsx(CloseDrawerLine, {})
2394
2411
  ] }) }) }) });
2395
2412
  }
2396
2413
  );
@@ -2413,9 +2430,10 @@ var CloseDrawerLine = forwardRef((props, ref) => {
2413
2430
  });
2414
2431
  CloseDrawerLine.displayName = "CloseDrawerLine";
2415
2432
  var DrawerCloseTrigger = forwardRef(function DrawerCloseTrigger2(props, ref) {
2433
+ const { showText = false, ...rest } = props;
2416
2434
  const { size } = useRootDrawerProps();
2417
2435
  const { t } = useTranslation();
2418
- return /* @__PURE__ */ jsx(Drawer$1.CloseTrigger, { ref, ...props, asChild: true, children: size === "full" ? /* @__PURE__ */ jsx(
2436
+ return /* @__PURE__ */ jsx(Drawer$1.CloseTrigger, { ref, ...rest, asChild: true, children: showText || size === "full" ? /* @__PURE__ */ jsx(
2419
2437
  ResponsiveButton,
2420
2438
  {
2421
2439
  variant: "ghost",