@vygruppen/spor-react 12.23.0 → 12.24.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 +8 -8
- package/.turbo/turbo-postinstall.log +2 -2
- package/CHANGELOG.md +10 -0
- package/dist/index.cjs +34 -25
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +35 -26
- package/dist/index.mjs.map +1 -1
- package/package.json +5 -5
- package/src/table/Table.tsx +33 -21
- package/src/table/sort-utils.ts +6 -6
package/dist/index.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
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, RadioCard as RadioCard$1, Separator as Separator$1, ClientOnly, Field, defineStyle, PopoverAnchor, useFieldContext, Popover as Popover$1, Portal, Dialog, createContext as createContext$1, useDialogContext, Drawer as Drawer$1, InputElement, Input as Input$1, Combobox, useComboboxContext, usePopoverContext, Checkbox as Checkbox$1, CheckboxCard, Fieldset as Fieldset$1, NativeSelect as NativeSelect$1, useControllableState, createListCollection, RadioGroup as RadioGroup$1, Select as Select$1, useSelectContext, Switch as Switch$1, Textarea as Textarea$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 as VisuallyHidden$1, defineConfig, useFilter, useListCollection, useCombobox, CheckboxGroup as CheckboxGroup$1, ListItem, ChakraProvider, Toaster as Toaster$1, Toast } 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, TableCaption, TableCell, TableColumn, TableColumnGroup, TableFooter, TableHeader, TableRoot, VStack, VisuallyHidden, Wrap, 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 * as spor_icon_react_star from '@vygruppen/spor-icon-react';
|
|
4
|
-
import { DropdownDownFill24Icon, CopyOutline18Icon, CheckmarkFill18Icon, CloseFill18Icon, CloseFill30Icon, CloseFill24Icon, InformationFill24Icon, ServiceFill24Icon, QuestionFill24Icon, ErrorOutline24Icon, ErrorFill24Icon, AltTransportFill24Icon, WarningFill24Icon, SuccessFill24Icon, DropdownDownFill18Icon, DropdownRightFill18Icon, CalendarOutline24Icon, ArrowLeftFill24Icon, ChangeDirectionOutline24Icon, CloseOutline24Icon, SearchOutline24Icon, Forward15MediaControllerFill30Icon, Backward15MediaControllerFill30Icon, PauseMediaControllerFill24Icon, PlayMediaControllerFill24Icon, NextMediaControllerFill30Icon, PreviousMediaControllerFill30Icon, ArrowRightFill18Icon, DropdownLeftOutline18Icon, DropdownRightOutline18Icon,
|
|
4
|
+
import { DropdownDownFill24Icon, CopyOutline18Icon, CheckmarkFill18Icon, CloseFill18Icon, CloseFill30Icon, CloseFill24Icon, InformationFill24Icon, ServiceFill24Icon, QuestionFill24Icon, ErrorOutline24Icon, ErrorFill24Icon, AltTransportFill24Icon, WarningFill24Icon, SuccessFill24Icon, DropdownDownFill18Icon, DropdownRightFill18Icon, CalendarOutline24Icon, ArrowLeftFill24Icon, ChangeDirectionOutline24Icon, CloseOutline24Icon, SearchOutline24Icon, Forward15MediaControllerFill30Icon, Backward15MediaControllerFill30Icon, PauseMediaControllerFill24Icon, PlayMediaControllerFill24Icon, NextMediaControllerFill30Icon, PreviousMediaControllerFill30Icon, ArrowRightFill18Icon, DropdownLeftOutline18Icon, DropdownRightOutline18Icon, ArrowUpFill18Icon, ArrowDownFill18Icon, ChangeDirectionFill18Icon, WalkFill30Icon, WalkFill24Icon, WalkFill18Icon, AltTransportFill30Icon, AltTransportFill18Icon, TramFill30Icon, TramFill24Icon, TramFill18Icon, SubwayFill30Icon, SubwayFill24Icon, SubwayFill18Icon, FerryFill30Icon, FerryFill24Icon, FerryFill18Icon, BusFill30Icon, BusFill24Icon, BusFill18Icon, ExpressBusFill30Icon, ExpressBusFill24Icon, ExpressBusFill18Icon, TrainFill30Icon, TrainFill24Icon, TrainFill18Icon, InformationFill18Icon, WarningFill18Icon, ErrorFill18Icon, LinkOutOutline24Icon, LinkOutOutline18Icon, ArrowLeftOutline24Icon, ArrowRightOutline24Icon, DropdownLeftFill18Icon } from '@vygruppen/spor-icon-react';
|
|
5
5
|
import * as React20 from 'react';
|
|
6
6
|
import React20__default, { forwardRef, createContext, useId, cloneElement, useRef, useImperativeHandle, useMemo, isValidElement, useState, useEffect, useContext, Children, useLayoutEffect } from 'react';
|
|
7
7
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
@@ -6261,11 +6261,13 @@ var TabsList = Tabs$1.List;
|
|
|
6261
6261
|
var TabsTrigger = Tabs$1.Trigger;
|
|
6262
6262
|
var TabsIndicator = Tabs$1.Indicator;
|
|
6263
6263
|
var TabsContent = Tabs$1.Content;
|
|
6264
|
-
var getNextSortState = (current, key, columnIndex) =>
|
|
6265
|
-
key
|
|
6266
|
-
|
|
6267
|
-
|
|
6268
|
-
}
|
|
6264
|
+
var getNextSortState = (current, key, columnIndex) => {
|
|
6265
|
+
if (current.key !== key)
|
|
6266
|
+
return { key, columnIndex, direction: "asc" };
|
|
6267
|
+
if (current.direction === "asc")
|
|
6268
|
+
return { key, columnIndex, direction: "desc" };
|
|
6269
|
+
return { key: null, direction: "asc", columnIndex: null };
|
|
6270
|
+
};
|
|
6269
6271
|
var getSortKey = (children) => typeof children === "string" ? children.trim() : null;
|
|
6270
6272
|
var getColumnIndex = (element) => {
|
|
6271
6273
|
var _a5;
|
|
@@ -6337,28 +6339,35 @@ var Table = forwardRef(
|
|
|
6337
6339
|
}
|
|
6338
6340
|
);
|
|
6339
6341
|
Table.displayName = "Table";
|
|
6340
|
-
var TableColumnHeader = forwardRef(({ children,
|
|
6342
|
+
var TableColumnHeader = forwardRef(({ children, ...rest }, ref) => {
|
|
6341
6343
|
const { enabled, sortState, onSort } = useTableSort();
|
|
6342
6344
|
const key = getSortKey(children);
|
|
6343
|
-
const
|
|
6344
|
-
|
|
6345
|
-
|
|
6346
|
-
|
|
6347
|
-
|
|
6348
|
-
|
|
6349
|
-
|
|
6350
|
-
|
|
6351
|
-
|
|
6352
|
-
onClick
|
|
6353
|
-
|
|
6354
|
-
|
|
6355
|
-
|
|
6356
|
-
|
|
6357
|
-
|
|
6358
|
-
|
|
6359
|
-
|
|
6360
|
-
|
|
6361
|
-
|
|
6345
|
+
const props = rest;
|
|
6346
|
+
const columnSortable = enabled && key != null && !("data-nosort" in props);
|
|
6347
|
+
const isActive = columnSortable && key === sortState.key;
|
|
6348
|
+
return /* @__PURE__ */ jsx(Table$1.ColumnHeader, { ref, ...rest, children: /* @__PURE__ */ jsxs(HStack, { children: [
|
|
6349
|
+
children,
|
|
6350
|
+
columnSortable && /* @__PURE__ */ jsx(
|
|
6351
|
+
Button$1,
|
|
6352
|
+
{
|
|
6353
|
+
variant: "ghost",
|
|
6354
|
+
onClick: (event) => {
|
|
6355
|
+
const th = event.currentTarget.closest("th");
|
|
6356
|
+
if (th)
|
|
6357
|
+
onSort(key, getColumnIndex(th));
|
|
6358
|
+
},
|
|
6359
|
+
p: "0px !important",
|
|
6360
|
+
size: "xs",
|
|
6361
|
+
children: isActive ? sortState.direction === "asc" ? /* @__PURE__ */ jsx(ArrowUpFill18Icon, { color: "outline.focus" }) : /* @__PURE__ */ jsx(ArrowDownFill18Icon, { color: "outline.focus" }) : /* @__PURE__ */ jsx(
|
|
6362
|
+
ChangeDirectionFill18Icon,
|
|
6363
|
+
{
|
|
6364
|
+
transform: "rotate(90deg)",
|
|
6365
|
+
color: "icon.disabled"
|
|
6366
|
+
}
|
|
6367
|
+
)
|
|
6368
|
+
}
|
|
6369
|
+
)
|
|
6370
|
+
] }) });
|
|
6362
6371
|
});
|
|
6363
6372
|
TableColumnHeader.displayName = "ColumnHeader";
|
|
6364
6373
|
var TableRow = forwardRef(
|