@vygruppen/spor-react 12.14.1 → 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/.turbo/turbo-build.log +10 -10
- package/.turbo/turbo-postinstall.log +2 -2
- package/CHANGELOG.md +18 -0
- package/dist/index.cjs +91 -41
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.mjs +93 -43
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
- package/src/alert/AlertIcon.tsx +30 -15
- package/src/button/ResponsiveButton.tsx +27 -0
- package/src/datepicker/CalendarCell.tsx +5 -3
- package/src/dialog/Drawer.tsx +38 -30
- package/src/dialog/types.ts +5 -0
- package/src/input/Switch.tsx +1 -1
- package/src/theme/slot-recipes/drawer.ts +2 -1
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 &
|
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 &
|
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
|
-
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,
|
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,
|
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
|
-
|
950
|
+
asChild: true,
|
952
951
|
ref,
|
953
952
|
"aria-label": t(texts5[variant]),
|
954
|
-
|
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
|
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
|
-
|
1457
|
+
chakra.button,
|
1434
1458
|
{
|
1435
|
-
|
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);
|
@@ -2355,12 +2365,32 @@ var DialogTitle = Dialog.Title;
|
|
2355
2365
|
var DialogDescription = Dialog.Description;
|
2356
2366
|
var DialogTrigger = Dialog.Trigger;
|
2357
2367
|
var DialogActionTrigger = Dialog.ActionTrigger;
|
2368
|
+
var ResponsiveButton = ({ label, icon, ...props }) => {
|
2369
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
2370
|
+
/* @__PURE__ */ jsx(Button, { display: ["none", "flex"], leftIcon: icon, ...props, children: label }),
|
2371
|
+
/* @__PURE__ */ jsx(
|
2372
|
+
IconButton,
|
2373
|
+
{
|
2374
|
+
display: ["flex", "none"],
|
2375
|
+
"aria-label": label,
|
2376
|
+
icon,
|
2377
|
+
...props
|
2378
|
+
}
|
2379
|
+
)
|
2380
|
+
] });
|
2381
|
+
};
|
2358
2382
|
var [RootDrawerProvider, useRootDrawerProps] = createContext$1({
|
2359
2383
|
name: "RootDrawerProvider"
|
2360
2384
|
});
|
2361
2385
|
var DrawerContent = forwardRef(
|
2362
2386
|
(props, ref) => {
|
2363
|
-
const {
|
2387
|
+
const {
|
2388
|
+
children,
|
2389
|
+
portalled = true,
|
2390
|
+
portalRef,
|
2391
|
+
hideHandle = false,
|
2392
|
+
...rest
|
2393
|
+
} = props;
|
2364
2394
|
const { size, placement } = useRootDrawerProps();
|
2365
2395
|
const { setOpen } = useDialogContext();
|
2366
2396
|
const handlers = useSwipeable({
|
@@ -2373,10 +2403,11 @@ var DrawerContent = forwardRef(
|
|
2373
2403
|
swipeDuration: 250
|
2374
2404
|
});
|
2375
2405
|
const sizeNotFull = size !== "full";
|
2406
|
+
const showHandle = !hideHandle;
|
2376
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: [
|
2377
|
-
sizeNotFull && placement === "bottom" && /* @__PURE__ */ jsx(CloseDrawerLine, {}),
|
2408
|
+
showHandle && sizeNotFull && placement === "bottom" && /* @__PURE__ */ jsx(CloseDrawerLine, {}),
|
2378
2409
|
children,
|
2379
|
-
sizeNotFull && placement === "top" && /* @__PURE__ */ jsx(CloseDrawerLine, {})
|
2410
|
+
showHandle && sizeNotFull && placement === "top" && /* @__PURE__ */ jsx(CloseDrawerLine, {})
|
2380
2411
|
] }) }) }) });
|
2381
2412
|
}
|
2382
2413
|
);
|
@@ -2399,22 +2430,40 @@ var CloseDrawerLine = forwardRef((props, ref) => {
|
|
2399
2430
|
});
|
2400
2431
|
CloseDrawerLine.displayName = "CloseDrawerLine";
|
2401
2432
|
var DrawerCloseTrigger = forwardRef(function DrawerCloseTrigger2(props, ref) {
|
2433
|
+
const { showText = false, ...rest } = props;
|
2402
2434
|
const { size } = useRootDrawerProps();
|
2403
2435
|
const { t } = useTranslation();
|
2404
|
-
return /* @__PURE__ */ jsx(Drawer$1.CloseTrigger, { ref, ...
|
2436
|
+
return /* @__PURE__ */ jsx(Drawer$1.CloseTrigger, { ref, ...rest, asChild: true, children: showText || size === "full" ? /* @__PURE__ */ jsx(
|
2437
|
+
ResponsiveButton,
|
2438
|
+
{
|
2439
|
+
variant: "ghost",
|
2440
|
+
icon: /* @__PURE__ */ jsx(CloseFill24Icon, {}),
|
2441
|
+
label: t(texts12.close)
|
2442
|
+
}
|
2443
|
+
) : /* @__PURE__ */ jsx(CloseButton, { size: "md" }) });
|
2405
2444
|
});
|
2406
2445
|
var DrawerBackTrigger = forwardRef((props, ref) => {
|
2407
2446
|
const { t } = useTranslation();
|
2408
|
-
return /* @__PURE__ */ jsx(Drawer$1.CloseTrigger, { asChild: true, ...props, ref,
|
2447
|
+
return /* @__PURE__ */ jsx(Drawer$1.CloseTrigger, { asChild: true, ...props, ref, children: /* @__PURE__ */ jsx(
|
2448
|
+
ResponsiveButton,
|
2449
|
+
{
|
2450
|
+
variant: "ghost",
|
2451
|
+
icon: /* @__PURE__ */ jsx(ArrowLeftFill24Icon, {}),
|
2452
|
+
label: t(texts12.back)
|
2453
|
+
}
|
2454
|
+
) });
|
2409
2455
|
});
|
2410
2456
|
DrawerBackTrigger.displayName = "DrawerBackTrigger";
|
2411
2457
|
var DrawerFullScreenHeader = forwardRef((props, ref) => {
|
2412
2458
|
const { backTrigger = true, closeTrigger = true, children } = props;
|
2413
|
-
return /* @__PURE__ */
|
2414
|
-
/* @__PURE__ */ jsx(
|
2415
|
-
/* @__PURE__ */ jsx(
|
2416
|
-
|
2417
|
-
|
2459
|
+
return /* @__PURE__ */ jsxs(Drawer$1.Header, { ...props, ref, children: [
|
2460
|
+
/* @__PURE__ */ jsx(Box, { children: backTrigger && /* @__PURE__ */ jsx(DrawerBackTrigger, {}) }),
|
2461
|
+
/* @__PURE__ */ jsx(DrawerTitle, { children }),
|
2462
|
+
/* @__PURE__ */ jsxs(Box, { children: [
|
2463
|
+
" ",
|
2464
|
+
closeTrigger && /* @__PURE__ */ jsx(DrawerCloseTrigger, {})
|
2465
|
+
] })
|
2466
|
+
] });
|
2418
2467
|
});
|
2419
2468
|
DrawerFullScreenHeader.displayName = "DrawerFullScreenHeader";
|
2420
2469
|
var Drawer = (props) => {
|
@@ -3671,7 +3720,7 @@ var Switch = forwardRef(
|
|
3671
3720
|
children: [
|
3672
3721
|
/* @__PURE__ */ jsx(Switch$1.HiddenInput, { ref }),
|
3673
3722
|
/* @__PURE__ */ jsx(Switch$1.Control, { css: styles.control, children: /* @__PURE__ */ jsx(Switch$1.Thumb, {}) }),
|
3674
|
-
/* @__PURE__ */ jsx(Switch$1.Label, { children: label })
|
3723
|
+
label && /* @__PURE__ */ jsx(Switch$1.Label, { children: label })
|
3675
3724
|
]
|
3676
3725
|
}
|
3677
3726
|
)
|
@@ -7661,7 +7710,8 @@ var drawerSlotRecipe = defineSlotRecipe({
|
|
7661
7710
|
display: "flex",
|
7662
7711
|
alignItems: "center",
|
7663
7712
|
justifyContent: "space-between",
|
7664
|
-
paddingX: ["
|
7713
|
+
paddingX: ["2", null, null, "5"],
|
7714
|
+
gap: "1",
|
7665
7715
|
paddingBottom: "1"
|
7666
7716
|
},
|
7667
7717
|
body: {
|