@bitrise/bitkit-v2 0.3.373 → 0.3.375
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/components/BitkitExpandableCard/BitkitExpandableCard.d.ts +10 -6
- package/dist/components/BitkitExpandableCard/BitkitExpandableCard.js +29 -11
- package/dist/components/BitkitExpandableCard/BitkitExpandableCard.js.map +1 -1
- package/dist/components/BitkitPagination/BitkitPagination.js +1 -1
- package/dist/components/BitkitPagination/BitkitPagination.js.map +1 -1
- package/dist/components/BitkitTable/BitkitBulkActionsRow.d.ts +80 -0
- package/dist/components/BitkitTable/BitkitBulkActionsRow.js +124 -0
- package/dist/components/BitkitTable/BitkitBulkActionsRow.js.map +1 -0
- package/dist/components/BitkitTable/BitkitFilterRow.d.ts +25 -0
- package/dist/components/BitkitTable/BitkitFilterRow.js +41 -0
- package/dist/components/BitkitTable/BitkitFilterRow.js.map +1 -0
- package/dist/components/BitkitTable/BitkitLinkedRow.d.ts +12 -0
- package/dist/components/BitkitTable/BitkitLinkedRow.js +72 -0
- package/dist/components/BitkitTable/BitkitLinkedRow.js.map +1 -0
- package/dist/components/BitkitTable/BitkitRowActionsCell.d.ts +43 -0
- package/dist/components/BitkitTable/BitkitRowActionsCell.js +90 -0
- package/dist/components/BitkitTable/BitkitRowActionsCell.js.map +1 -0
- package/dist/components/index.d.ts +4 -0
- package/dist/main.js +5 -1
- package/dist/theme/slot-recipes/ExpandableCard.recipe.d.ts +1 -1
- package/dist/theme/slot-recipes/ExpandableCard.recipe.js +16 -3
- package/dist/theme/slot-recipes/ExpandableCard.recipe.js.map +1 -1
- package/dist/theme/slot-recipes/Table.recipe.d.ts +1 -1
- package/dist/theme/slot-recipes/Table.recipe.js +67 -1
- package/dist/theme/slot-recipes/Table.recipe.js.map +1 -1
- package/dist/theme/slot-recipes/index.d.ts +2 -2
- package/dist/utilities/formatLabel.d.ts +7 -0
- package/dist/utilities/formatLabel.js +11 -0
- package/dist/utilities/formatLabel.js.map +1 -0
- package/package.json +1 -1
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { BoxProps } from '@chakra-ui/react/box';
|
|
1
2
|
import { CollapsibleRootProps } from '@chakra-ui/react/collapsible';
|
|
2
3
|
import { ReactElement, ReactNode } from 'react';
|
|
3
4
|
import { BitkitIconComponent } from '../../icons';
|
|
@@ -12,19 +13,22 @@ type ControlledProps = {
|
|
|
12
13
|
expanded: boolean;
|
|
13
14
|
onChange: (expanded: boolean) => void;
|
|
14
15
|
};
|
|
15
|
-
|
|
16
|
+
/**
|
|
17
|
+
* Zag/Ark machine props. They drive the inner `Collapsible.Root` and mean nothing on the card
|
|
18
|
+
* element, so they're forwarded by name rather than left in `...rest` — which belongs to the
|
|
19
|
+
* rendered root (`Card.Root`) so consumer style props reach the card itself.
|
|
20
|
+
*/
|
|
21
|
+
type CollapsibleMachineProps = Pick<CollapsibleRootProps, 'collapsedHeight' | 'collapsedWidth' | 'disabled' | 'hideMode' | 'ids' | 'lazyMount' | 'onExitComplete' | 'unmountOnExit'>;
|
|
22
|
+
export type BitkitExpandableCardProps = Omit<BoxProps, 'asChild' | 'children' | 'onChange' | 'title'> & CollapsibleMachineProps & {
|
|
16
23
|
children: ReactNode;
|
|
17
24
|
elevation?: boolean;
|
|
18
25
|
footer?: ReactNode;
|
|
19
26
|
icon?: BitkitIconComponent | ReactElement<BitkitAvatarProps>;
|
|
20
27
|
iconColor?: string;
|
|
21
|
-
size
|
|
28
|
+
size?: 'md' | 'lg';
|
|
22
29
|
subtitle?: ReactNode;
|
|
23
30
|
suffix?: ReactNode;
|
|
24
31
|
title: ReactNode;
|
|
25
32
|
} & (UncontrolledProps | ControlledProps);
|
|
26
|
-
declare const BitkitExpandableCard:
|
|
27
|
-
(props: BitkitExpandableCardProps): import("react").JSX.Element;
|
|
28
|
-
displayName: string;
|
|
29
|
-
};
|
|
33
|
+
declare const BitkitExpandableCard: import('react').ForwardRefExoticComponent<BitkitExpandableCardProps & import('react').RefAttributes<HTMLDivElement>>;
|
|
30
34
|
export default BitkitExpandableCard;
|
|
@@ -1,31 +1,44 @@
|
|
|
1
1
|
import AssetSelectChevron from "../../utilities/AssetSelectChevron.js";
|
|
2
|
+
import BitkitBadge from "../BitkitBadge/BitkitBadge.js";
|
|
2
3
|
import { Box } from "@chakra-ui/react/box";
|
|
3
4
|
import { useSlotRecipe } from "@chakra-ui/react/styled-system";
|
|
4
|
-
import { cloneElement, isValidElement } from "react";
|
|
5
|
+
import { cloneElement, forwardRef, isValidElement } from "react";
|
|
5
6
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
7
|
import { Text } from "@chakra-ui/react/text";
|
|
7
8
|
import { Collapsible } from "@chakra-ui/react/collapsible";
|
|
8
9
|
import { Card } from "@chakra-ui/react/card";
|
|
9
10
|
//#region lib/components/BitkitExpandableCard/BitkitExpandableCard.tsx
|
|
10
|
-
var BitkitExpandableCard = (props) => {
|
|
11
|
-
const { children, defaultExpanded, elevation = true, expanded, footer, icon, iconColor, onChange, size = "lg", subtitle, suffix, title, ...rest } = props;
|
|
11
|
+
var BitkitExpandableCard = forwardRef((props, ref) => {
|
|
12
|
+
const { children, collapsedHeight, collapsedWidth, css, defaultExpanded, disabled, elevation = true, expanded, footer, hideMode, icon, iconColor, ids, lazyMount, onChange, onExitComplete, size = "lg", subtitle, suffix, title, unmountOnExit, ...rest } = props;
|
|
12
13
|
const styles = useSlotRecipe({ key: "expandableCard" })({ size });
|
|
13
14
|
const handleOpenChange = onChange ? (details) => onChange(details.open) : void 0;
|
|
15
|
+
const iconSize = size === "md" ? "16" : "24";
|
|
16
|
+
let renderedSuffix = suffix;
|
|
17
|
+
if (isValidElement(suffix) && suffix.type === BitkitBadge) renderedSuffix = cloneElement(suffix, { size: size === "md" ? "xs" : "sm" });
|
|
14
18
|
let renderedIcon = null;
|
|
15
19
|
if (isValidElement(icon)) renderedIcon = cloneElement(icon, { size: "24" });
|
|
16
20
|
else if (icon) renderedIcon = /* @__PURE__ */ jsx(icon, {
|
|
17
21
|
color: iconColor,
|
|
18
|
-
size:
|
|
22
|
+
size: iconSize
|
|
19
23
|
});
|
|
20
24
|
return /* @__PURE__ */ jsx(Card.Root, {
|
|
25
|
+
ref,
|
|
21
26
|
elevation,
|
|
22
27
|
paddingSize: "sm",
|
|
23
|
-
css: styles.root,
|
|
28
|
+
css: [styles.root, css],
|
|
29
|
+
...rest,
|
|
24
30
|
children: /* @__PURE__ */ jsxs(Collapsible.Root, {
|
|
31
|
+
collapsedHeight,
|
|
32
|
+
collapsedWidth,
|
|
25
33
|
defaultOpen: defaultExpanded,
|
|
26
|
-
|
|
34
|
+
disabled,
|
|
35
|
+
hideMode,
|
|
36
|
+
ids,
|
|
37
|
+
lazyMount,
|
|
38
|
+
onExitComplete,
|
|
27
39
|
onOpenChange: handleOpenChange,
|
|
28
|
-
|
|
40
|
+
open: expanded,
|
|
41
|
+
unmountOnExit,
|
|
29
42
|
children: [/* @__PURE__ */ jsxs(Collapsible.Trigger, {
|
|
30
43
|
css: styles.header,
|
|
31
44
|
children: [/* @__PURE__ */ jsxs(Box, {
|
|
@@ -40,6 +53,7 @@ var BitkitExpandableCard = (props) => {
|
|
|
40
53
|
alignItems: "flex-start",
|
|
41
54
|
flexDirection: "column",
|
|
42
55
|
children: [title, !!subtitle && /* @__PURE__ */ jsx(Text, {
|
|
56
|
+
as: "span",
|
|
43
57
|
css: styles.subtitle,
|
|
44
58
|
children: subtitle
|
|
45
59
|
})]
|
|
@@ -47,9 +61,10 @@ var BitkitExpandableCard = (props) => {
|
|
|
47
61
|
}), /* @__PURE__ */ jsxs(Box, {
|
|
48
62
|
display: "flex",
|
|
49
63
|
alignItems: "center",
|
|
50
|
-
children: [!!
|
|
64
|
+
children: [!!renderedSuffix && /* @__PURE__ */ jsx(Text, {
|
|
65
|
+
as: "span",
|
|
51
66
|
css: styles.suffix,
|
|
52
|
-
children:
|
|
67
|
+
children: renderedSuffix
|
|
53
68
|
}), /* @__PURE__ */ jsx(Collapsible.Indicator, {
|
|
54
69
|
asChild: true,
|
|
55
70
|
children: /* @__PURE__ */ jsx(AssetSelectChevron, {})
|
|
@@ -57,11 +72,14 @@ var BitkitExpandableCard = (props) => {
|
|
|
57
72
|
})]
|
|
58
73
|
}), /* @__PURE__ */ jsxs(Collapsible.Content, {
|
|
59
74
|
css: styles.collapsible,
|
|
60
|
-
children: [/* @__PURE__ */ jsx(Card.Body, { children }), !!footer && /* @__PURE__ */ jsx(Card.Footer, {
|
|
75
|
+
children: [/* @__PURE__ */ jsx(Card.Body, { children }), !!footer && /* @__PURE__ */ jsx(Card.Footer, {
|
|
76
|
+
css: styles.footer,
|
|
77
|
+
children: footer
|
|
78
|
+
})]
|
|
61
79
|
})]
|
|
62
80
|
})
|
|
63
81
|
});
|
|
64
|
-
};
|
|
82
|
+
});
|
|
65
83
|
BitkitExpandableCard.displayName = "BitkitExpandableCard";
|
|
66
84
|
//#endregion
|
|
67
85
|
export { BitkitExpandableCard as default };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BitkitExpandableCard.js","names":[],"sources":["../../../lib/components/BitkitExpandableCard/BitkitExpandableCard.tsx"],"sourcesContent":["import { Box } from '@chakra-ui/react/box';\nimport { Card } from '@chakra-ui/react/card';\nimport { Collapsible, type CollapsibleRootProps } from '@chakra-ui/react/collapsible';\nimport { useSlotRecipe } from '@chakra-ui/react/styled-system';\nimport { Text } from '@chakra-ui/react/text';\nimport { cloneElement, isValidElement, type ReactElement, type ReactNode } from 'react';\n\nimport { type BitkitIconComponent } from '../../icons';\nimport AssetSelectChevron from '../../utilities/AssetSelectChevron';\nimport { type BitkitAvatarProps } from '../BitkitAvatar/BitkitAvatar';\n\ntype UncontrolledProps = {\n defaultExpanded?: boolean;\n expanded?: never;\n onChange?: never;\n};\n\ntype ControlledProps = {\n defaultExpanded?: never;\n expanded: boolean;\n onChange: (expanded: boolean) => void;\n};\n\
|
|
1
|
+
{"version":3,"file":"BitkitExpandableCard.js","names":[],"sources":["../../../lib/components/BitkitExpandableCard/BitkitExpandableCard.tsx"],"sourcesContent":["import { Box, type BoxProps } from '@chakra-ui/react/box';\nimport { Card } from '@chakra-ui/react/card';\nimport { Collapsible, type CollapsibleRootProps } from '@chakra-ui/react/collapsible';\nimport { useSlotRecipe } from '@chakra-ui/react/styled-system';\nimport { Text } from '@chakra-ui/react/text';\nimport { cloneElement, forwardRef, isValidElement, type ReactElement, type ReactNode } from 'react';\n\nimport { type BitkitIconComponent } from '../../icons';\nimport AssetSelectChevron from '../../utilities/AssetSelectChevron';\nimport { type BitkitAvatarProps } from '../BitkitAvatar/BitkitAvatar';\nimport BitkitBadge, { type BitkitBadgeProps } from '../BitkitBadge/BitkitBadge';\n\ntype UncontrolledProps = {\n defaultExpanded?: boolean;\n expanded?: never;\n onChange?: never;\n};\n\ntype ControlledProps = {\n defaultExpanded?: never;\n expanded: boolean;\n onChange: (expanded: boolean) => void;\n};\n\n/**\n * Zag/Ark machine props. They drive the inner `Collapsible.Root` and mean nothing on the card\n * element, so they're forwarded by name rather than left in `...rest` — which belongs to the\n * rendered root (`Card.Root`) so consumer style props reach the card itself.\n */\ntype CollapsibleMachineProps = Pick<\n CollapsibleRootProps,\n | 'collapsedHeight'\n | 'collapsedWidth'\n | 'disabled'\n | 'hideMode'\n | 'ids'\n | 'lazyMount'\n | 'onExitComplete'\n | 'unmountOnExit'\n>;\n\nexport type BitkitExpandableCardProps = Omit<BoxProps, 'asChild' | 'children' | 'onChange' | 'title'> &\n CollapsibleMachineProps & {\n children: ReactNode;\n elevation?: boolean;\n footer?: ReactNode;\n icon?: BitkitIconComponent | ReactElement<BitkitAvatarProps>;\n iconColor?: string;\n size?: 'md' | 'lg';\n subtitle?: ReactNode;\n suffix?: ReactNode;\n title: ReactNode;\n } & (UncontrolledProps | ControlledProps);\n\nconst BitkitExpandableCard = forwardRef<HTMLDivElement, BitkitExpandableCardProps>((props, ref) => {\n const {\n children,\n collapsedHeight,\n collapsedWidth,\n css,\n defaultExpanded,\n disabled,\n elevation = true,\n expanded,\n footer,\n hideMode,\n icon,\n iconColor,\n ids,\n lazyMount,\n onChange,\n onExitComplete,\n size = 'lg',\n subtitle,\n suffix,\n title,\n unmountOnExit,\n ...rest\n } = props;\n\n const recipe = useSlotRecipe({ key: 'expandableCard' });\n const styles = recipe({ size });\n\n const handleOpenChange = onChange ? (details: { open: boolean }) => onChange(details.open) : undefined;\n\n // `md` is the tested branch so the default size ('lg') stays on the fallback.\n const iconSize = size === 'md' ? '16' : '24';\n\n // Figma sizes the header badge with the card: xs on md, sm (the badge default) on lg.\n let renderedSuffix: ReactNode = suffix;\n if (isValidElement<BitkitBadgeProps>(suffix) && suffix.type === BitkitBadge) {\n renderedSuffix = cloneElement(suffix, { size: size === 'md' ? 'xs' : 'sm' });\n }\n\n let renderedIcon: ReactNode = null;\n if (isValidElement<BitkitAvatarProps>(icon)) {\n // BitkitAvatar has no '16' size, so avatars stay at '24' even on the md card.\n renderedIcon = cloneElement(icon, { size: '24' });\n } else if (icon) {\n const Icon = icon;\n renderedIcon = <Icon color={iconColor} size={iconSize} />;\n }\n\n return (\n <Card.Root ref={ref} elevation={elevation} paddingSize=\"sm\" css={[styles.root, css]} {...rest}>\n <Collapsible.Root\n collapsedHeight={collapsedHeight}\n collapsedWidth={collapsedWidth}\n defaultOpen={defaultExpanded}\n disabled={disabled}\n hideMode={hideMode}\n ids={ids}\n lazyMount={lazyMount}\n onExitComplete={onExitComplete}\n onOpenChange={handleOpenChange}\n open={expanded}\n unmountOnExit={unmountOnExit}\n >\n <Collapsible.Trigger css={styles.header}>\n <Box display=\"flex\" alignItems=\"center\" gap=\"8\">\n {!!renderedIcon && <Box css={styles.icon}>{renderedIcon}</Box>}\n <Box display=\"flex\" alignItems=\"flex-start\" flexDirection=\"column\">\n {title}\n {!!subtitle && (\n <Text as=\"span\" css={styles.subtitle}>\n {subtitle}\n </Text>\n )}\n </Box>\n </Box>\n <Box display=\"flex\" alignItems=\"center\">\n {!!renderedSuffix && (\n <Text as=\"span\" css={styles.suffix}>\n {renderedSuffix}\n </Text>\n )}\n <Collapsible.Indicator asChild>\n <AssetSelectChevron />\n </Collapsible.Indicator>\n </Box>\n </Collapsible.Trigger>\n <Collapsible.Content css={styles.collapsible}>\n <Card.Body>{children}</Card.Body>\n {!!footer && <Card.Footer css={styles.footer}>{footer}</Card.Footer>}\n </Collapsible.Content>\n </Collapsible.Root>\n </Card.Root>\n );\n});\n\nBitkitExpandableCard.displayName = 'BitkitExpandableCard';\n\nexport default BitkitExpandableCard;\n"],"mappings":";;;;;;;;;;AAsDA,IAAM,uBAAuB,YAAuD,OAAO,QAAQ;CACjG,MAAM,EACJ,UACA,iBACA,gBACA,KACA,iBACA,UACA,YAAY,MACZ,UACA,QACA,UACA,MACA,WACA,KACA,WACA,UACA,gBACA,OAAO,MACP,UACA,QACA,OACA,eACA,GAAG,SACD;CAGJ,MAAM,SADS,cAAc,EAAE,KAAK,iBAAiB,CACtC,CAAA,CAAO,EAAE,KAAK,CAAC;CAE9B,MAAM,mBAAmB,YAAY,YAA+B,SAAS,QAAQ,IAAI,IAAI,KAAA;CAG7F,MAAM,WAAW,SAAS,OAAO,OAAO;CAGxC,IAAI,iBAA4B;CAChC,IAAI,eAAiC,MAAM,KAAK,OAAO,SAAS,aAC9D,iBAAiB,aAAa,QAAQ,EAAE,MAAM,SAAS,OAAO,OAAO,KAAK,CAAC;CAG7E,IAAI,eAA0B;CAC9B,IAAI,eAAkC,IAAI,GAExC,eAAe,aAAa,MAAM,EAAE,MAAM,KAAK,CAAC;MAC3C,IAAI,MAET,eAAe,oBAAC,MAAD;EAAM,OAAO;EAAW,MAAM;CAAW,CAAA;CAG1D,OACE,oBAAC,KAAK,MAAN;EAAgB;EAAgB;EAAW,aAAY;EAAK,KAAK,CAAC,OAAO,MAAM,GAAG;EAAG,GAAI;EACvF,UAAA,qBAAC,YAAY,MAAb;GACmB;GACD;GAChB,aAAa;GACH;GACA;GACL;GACM;GACK;GAChB,cAAc;GACd,MAAM;GACS;GAXjB,UAAA,CAaE,qBAAC,YAAY,SAAb;IAAqB,KAAK,OAAO;IAAjC,UAAA,CACE,qBAAC,KAAD;KAAK,SAAQ;KAAO,YAAW;KAAS,KAAI;KAA5C,UAAA,CACG,CAAC,CAAC,gBAAgB,oBAAC,KAAD;MAAK,KAAK,OAAO;MAAO,UAAA;KAAkB,CAAA,GAC7D,qBAAC,KAAD;MAAK,SAAQ;MAAO,YAAW;MAAa,eAAc;MAA1D,UAAA,CACG,OACA,CAAC,CAAC,YACD,oBAAC,MAAD;OAAM,IAAG;OAAO,KAAK,OAAO;OACzB,UAAA;MACG,CAAA,CAEL;KACF,CAAA,CAAA;IACL,CAAA,GAAA,qBAAC,KAAD;KAAK,SAAQ;KAAO,YAAW;KAA/B,UAAA,CACG,CAAC,CAAC,kBACD,oBAAC,MAAD;MAAM,IAAG;MAAO,KAAK,OAAO;MACzB,UAAA;KACG,CAAA,GAER,oBAAC,YAAY,WAAb;MAAuB,SAAA;MACrB,UAAA,oBAAC,oBAAD,CAAqB,CAAA;KACA,CAAA,CACpB;IACc,CAAA,CAAA;GACrB,CAAA,GAAA,qBAAC,YAAY,SAAb;IAAqB,KAAK,OAAO;IAAjC,UAAA,CACE,oBAAC,KAAK,MAAN,EAAY,SAAoB,CAAA,GAC/B,CAAC,CAAC,UAAU,oBAAC,KAAK,QAAN;KAAa,KAAK,OAAO;KAAS,UAAA;IAAoB,CAAA,CAChD;GACL,CAAA,CAAA;;CACT,CAAA;AAEf,CAAC;AAED,qBAAqB,cAAc"}
|
|
@@ -2,6 +2,7 @@ import IconChevronLeft from "../../icons/IconChevronLeft.js";
|
|
|
2
2
|
import IconChevronRight from "../../icons/IconChevronRight.js";
|
|
3
3
|
import BitkitIconButton from "../BitkitIconButton/BitkitIconButton.js";
|
|
4
4
|
import BitkitNativeSelect from "../BitkitNativeSelect/BitkitNativeSelect.js";
|
|
5
|
+
import formatLabel from "../../utilities/formatLabel.js";
|
|
5
6
|
import { Box } from "@chakra-ui/react/box";
|
|
6
7
|
import { chakra, useSlotRecipe } from "@chakra-ui/react/styled-system";
|
|
7
8
|
import { forwardRef, useMemo } from "react";
|
|
@@ -16,7 +17,6 @@ var DEFAULT_LABELS = {
|
|
|
16
17
|
pages: "of {totalPages} pages",
|
|
17
18
|
previousPage: "Previous page"
|
|
18
19
|
};
|
|
19
|
-
var formatLabel = (template, values) => Object.entries(values).reduce((str, [key, val]) => str.replaceAll(`{${key}}`, String(val)), template);
|
|
20
20
|
var BitkitPagination = forwardRef((props, ref) => {
|
|
21
21
|
const { labels: labelsProp, onPageChange, onPageSizeChange, page, pageSize, pageSizeOptions = [
|
|
22
22
|
10,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BitkitPagination.js","names":[],"sources":["../../../lib/components/BitkitPagination/BitkitPagination.tsx"],"sourcesContent":["import { Box, type BoxProps } from '@chakra-ui/react/box';\nimport { Separator } from '@chakra-ui/react/separator';\nimport { Skeleton } from '@chakra-ui/react/skeleton';\nimport { chakra, useSlotRecipe } from '@chakra-ui/react/styled-system';\nimport { forwardRef, useMemo } from 'react';\n\nimport { IconChevronLeft, IconChevronRight } from '../../icons';\nimport BitkitIconButton from '../BitkitIconButton/BitkitIconButton';\nimport BitkitNativeSelect from '../BitkitNativeSelect/BitkitNativeSelect';\n\nexport interface BitkitPaginationLabels {\n items?: string;\n itemsPerPage?: string;\n nextPage?: string;\n pages?: string;\n previousPage?: string;\n}\n\nconst DEFAULT_LABELS: Required<BitkitPaginationLabels> = {\n items: '{start}\\u2013{end} of {total} items',\n itemsPerPage: 'Items per page:',\n nextPage: 'Next page',\n pages: 'of {totalPages} pages',\n previousPage: 'Previous page',\n};\n\
|
|
1
|
+
{"version":3,"file":"BitkitPagination.js","names":[],"sources":["../../../lib/components/BitkitPagination/BitkitPagination.tsx"],"sourcesContent":["import { Box, type BoxProps } from '@chakra-ui/react/box';\nimport { Separator } from '@chakra-ui/react/separator';\nimport { Skeleton } from '@chakra-ui/react/skeleton';\nimport { chakra, useSlotRecipe } from '@chakra-ui/react/styled-system';\nimport { forwardRef, useMemo } from 'react';\n\nimport { IconChevronLeft, IconChevronRight } from '../../icons';\nimport formatLabel from '../../utilities/formatLabel';\nimport BitkitIconButton from '../BitkitIconButton/BitkitIconButton';\nimport BitkitNativeSelect from '../BitkitNativeSelect/BitkitNativeSelect';\n\nexport interface BitkitPaginationLabels {\n items?: string;\n itemsPerPage?: string;\n nextPage?: string;\n pages?: string;\n previousPage?: string;\n}\n\nconst DEFAULT_LABELS: Required<BitkitPaginationLabels> = {\n items: '{start}\\u2013{end} of {total} items',\n itemsPerPage: 'Items per page:',\n nextPage: 'Next page',\n pages: 'of {totalPages} pages',\n previousPage: 'Previous page',\n};\n\nexport interface BitkitPaginationProps extends Omit<BoxProps, 'colorPalette' | 'page'> {\n labels?: BitkitPaginationLabels;\n onPageChange?: (page: number) => void;\n onPageSizeChange?: (pageSize: number) => void;\n page: number;\n pageSize: number;\n pageSizeOptions?: number[];\n state?: 'skeleton';\n totalItems: number;\n variant?: 'card' | 'page' | 'table';\n}\n\nconst BitkitPagination = forwardRef<HTMLDivElement, BitkitPaginationProps>((props, ref) => {\n const {\n labels: labelsProp,\n onPageChange,\n onPageSizeChange,\n page,\n pageSize,\n pageSizeOptions = [10, 25, 50],\n state,\n totalItems,\n variant = 'table',\n ...rest\n } = props;\n\n const recipe = useSlotRecipe({ key: 'pagination' });\n const styles = recipe({ variant });\n\n const safePageSize = Math.max(1, pageSize);\n const totalPages = Math.max(1, Math.ceil(totalItems / safePageSize));\n const safePage = Math.min(Math.max(1, page), totalPages);\n const start = totalItems === 0 ? 0 : (safePage - 1) * safePageSize + 1;\n const end = Math.min(safePage * safePageSize, totalItems);\n const isFirstPage = safePage <= 1;\n const isLastPage = safePage >= totalPages;\n const isSkeleton = state === 'skeleton';\n const showItemsPerPage = variant !== 'card';\n\n const values = { end, start, total: totalItems, totalPages };\n const labels = Object.fromEntries(\n Object.entries({ ...DEFAULT_LABELS, ...labelsProp }).map(([k, v]) => [k, formatLabel(v, values)]),\n ) as Required<BitkitPaginationLabels>;\n\n const pageSizeItems = useMemo(\n () => pageSizeOptions.map((opt) => ({ label: String(opt), value: String(opt) })),\n [pageSizeOptions],\n );\n\n const pageItems = useMemo(\n () => Array.from({ length: totalPages }, (_, i) => ({ label: String(i + 1), value: String(i + 1) })),\n [totalPages],\n );\n\n return (\n <Box ref={ref} css={styles.root} {...rest}>\n <chakra.div css={styles.itemsBlock}>\n {showItemsPerPage && (\n <>\n <chakra.span css={styles.text}>{labels.itemsPerPage}</chakra.span>\n <BitkitNativeSelect\n css={styles.itemsSelect}\n onChange={(e) => onPageSizeChange?.(Number(e.target.value))}\n size=\"md\"\n state={isSkeleton ? 'disabled' : undefined}\n value={String(safePageSize)}\n >\n {pageSizeItems.map((opt) => (\n <option key={opt.value} value={opt.value}>\n {opt.label}\n </option>\n ))}\n </BitkitNativeSelect>\n <Separator alignSelf=\"stretch\" borderColor=\"border/minimal\" marginInline=\"8\" orientation=\"vertical\" />\n </>\n )}\n {isSkeleton ? <Skeleton height=\"20\" width=\"96\" /> : <chakra.span css={styles.text}>{labels.items}</chakra.span>}\n </chakra.div>\n\n <chakra.div css={styles.pageBlock}>\n <Separator alignSelf=\"stretch\" borderColor=\"border/minimal\" marginInline=\"8\" orientation=\"vertical\" />\n <BitkitNativeSelect\n css={styles.pageSelect}\n onChange={(e) => onPageChange?.(Number(e.target.value))}\n size=\"md\"\n state={isSkeleton ? 'disabled' : undefined}\n value={String(safePage)}\n >\n {pageItems.map((opt) => (\n <option key={opt.value} value={opt.value}>\n {opt.label}\n </option>\n ))}\n </BitkitNativeSelect>\n {isSkeleton ? <Skeleton height=\"20\" width=\"64\" /> : <chakra.span css={styles.text}>{labels.pages}</chakra.span>}\n <BitkitIconButton\n icon={IconChevronLeft}\n label={labels.previousPage}\n marginInlineStart=\"8\"\n onClick={() => onPageChange?.(safePage - 1)}\n size=\"md\"\n state={isFirstPage || isSkeleton ? 'disabled' : undefined}\n variant=\"secondary\"\n />\n <BitkitIconButton\n icon={IconChevronRight}\n label={labels.nextPage}\n onClick={() => onPageChange?.(safePage + 1)}\n size=\"md\"\n state={isLastPage || isSkeleton ? 'disabled' : undefined}\n variant=\"secondary\"\n />\n </chakra.div>\n </Box>\n );\n});\n\nBitkitPagination.displayName = 'BitkitPagination';\n\nexport default BitkitPagination;\n"],"mappings":"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"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { Table } from '@chakra-ui/react/table';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
/**
|
|
4
|
+
* The noun the bar counts. A single string is used for every count; pass `{ one, other }` to get
|
|
5
|
+
* `1 workflow selected.` instead of `1 workflows selected.`
|
|
6
|
+
*/
|
|
7
|
+
export type BitkitBulkActionsItems = string | {
|
|
8
|
+
one: string;
|
|
9
|
+
other: string;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Overrides for the bar's sentences. Each template can use `{items}` (the `items` prop, already
|
|
13
|
+
* resolved to the form matching that sentence's count), `{selectedCount}` and `{totalItems}`.
|
|
14
|
+
* Override a whole sentence for wording a template can't express, such as another language's
|
|
15
|
+
* grammar.
|
|
16
|
+
*/
|
|
17
|
+
export interface BitkitBulkActionsLabels {
|
|
18
|
+
/** `selectionState="all"`. Default: `All {totalItems} {items} selected.` */
|
|
19
|
+
allSelected?: string;
|
|
20
|
+
/** Default: `Cancel` */
|
|
21
|
+
cancel?: string;
|
|
22
|
+
/** The link offering the rows beyond this page. Default: `Select all {totalItems} {items}` */
|
|
23
|
+
selectAll?: string;
|
|
24
|
+
/** `selectionState="some"`. Default: `{selectedCount} {items} selected.` */
|
|
25
|
+
selected?: string;
|
|
26
|
+
/** `selectionState="allOnPage"`. Default: `{selectedCount} {items} selected on this page.` */
|
|
27
|
+
selectedOnPage?: string;
|
|
28
|
+
}
|
|
29
|
+
export interface BitkitBulkActionsRowProps extends Omit<Table.RowProps, 'children'> {
|
|
30
|
+
/** The bulk action buttons, rendered after `Cancel`. */
|
|
31
|
+
children?: ReactNode;
|
|
32
|
+
/** Must match the table's column count, so the row spans the full width. */
|
|
33
|
+
colSpan: number;
|
|
34
|
+
/** The counted noun. Default: `{ one: 'item', other: 'items' }` */
|
|
35
|
+
items?: BitkitBulkActionsItems;
|
|
36
|
+
labels?: BitkitBulkActionsLabels;
|
|
37
|
+
onCancel: () => void;
|
|
38
|
+
/** Renders the `Select all {totalItems} {items}` link while `selectionState="allOnPage"`. */
|
|
39
|
+
onSelectAll?: () => void;
|
|
40
|
+
selectedCount: number;
|
|
41
|
+
/**
|
|
42
|
+
* `some` — part of the page is selected. `allOnPage` — the whole page is selected, and the rows
|
|
43
|
+
* beyond it are still on offer. `all` — everything across every page is selected.
|
|
44
|
+
*/
|
|
45
|
+
selectionState: 'some' | 'allOnPage' | 'all';
|
|
46
|
+
totalItems: number;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* The bar above the column headers that appears while rows are selected: what is selected, the
|
|
50
|
+
* offer to widen the selection to every page, and the actions to run on it. Belongs in
|
|
51
|
+
* `Table.Header`, before the `Table.Row` that holds the column headers.
|
|
52
|
+
*
|
|
53
|
+
* The count is mirrored into a visually hidden `aria-live` region, which is deliberately filled a
|
|
54
|
+
* render after mount — a live region that enters the DOM with its text already in it is not
|
|
55
|
+
* announced, so the first selection would go unspoken otherwise.
|
|
56
|
+
*
|
|
57
|
+
* @example
|
|
58
|
+
* ```tsx
|
|
59
|
+
* <Table.Header>
|
|
60
|
+
* {selected.length > 0 && (
|
|
61
|
+
* <BitkitBulkActionsRow
|
|
62
|
+
* colSpan={COL_COUNT}
|
|
63
|
+
* items={{ one: 'workflow', other: 'workflows' }}
|
|
64
|
+
* onCancel={clearSelection}
|
|
65
|
+
* onSelectAll={() => setAllAcrossPages(true)}
|
|
66
|
+
* selectedCount={selected.length}
|
|
67
|
+
* selectionState={selectionState}
|
|
68
|
+
* totalItems={TOTAL_ITEMS}
|
|
69
|
+
* >
|
|
70
|
+
* <BitkitButton icon={IconMinusCircle} size="md" variant="danger-secondary">
|
|
71
|
+
* Remove
|
|
72
|
+
* </BitkitButton>
|
|
73
|
+
* </BitkitBulkActionsRow>
|
|
74
|
+
* )}
|
|
75
|
+
* <Table.Row>{columnHeaders}</Table.Row>
|
|
76
|
+
* </Table.Header>
|
|
77
|
+
* ```
|
|
78
|
+
*/
|
|
79
|
+
declare const BitkitBulkActionsRow: import('react').ForwardRefExoticComponent<BitkitBulkActionsRowProps & import('react').RefAttributes<HTMLTableRowElement>>;
|
|
80
|
+
export default BitkitBulkActionsRow;
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import BitkitButton from "../BitkitButton/BitkitButton.js";
|
|
2
|
+
import formatLabel from "../../utilities/formatLabel.js";
|
|
3
|
+
import { Box } from "@chakra-ui/react/box";
|
|
4
|
+
import { forwardRef, useEffect, useState } from "react";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
import { Text } from "@chakra-ui/react/text";
|
|
7
|
+
import { VisuallyHidden } from "@chakra-ui/react/visually-hidden";
|
|
8
|
+
import { Table, useTableStyles } from "@chakra-ui/react/table";
|
|
9
|
+
//#region lib/components/BitkitTable/BitkitBulkActionsRow.tsx
|
|
10
|
+
var DEFAULT_LABELS = {
|
|
11
|
+
allSelected: "All {totalItems} {items} selected.",
|
|
12
|
+
cancel: "Cancel",
|
|
13
|
+
selectAll: "Select all {totalItems} {items}",
|
|
14
|
+
selected: "{selectedCount} {items} selected.",
|
|
15
|
+
selectedOnPage: "{selectedCount} {items} selected on this page."
|
|
16
|
+
};
|
|
17
|
+
var DEFAULT_ITEMS = {
|
|
18
|
+
one: "item",
|
|
19
|
+
other: "items"
|
|
20
|
+
};
|
|
21
|
+
var resolveItems = (items, count) => {
|
|
22
|
+
if (typeof items === "string") return items;
|
|
23
|
+
return count === 1 ? items.one : items.other;
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* The bar above the column headers that appears while rows are selected: what is selected, the
|
|
27
|
+
* offer to widen the selection to every page, and the actions to run on it. Belongs in
|
|
28
|
+
* `Table.Header`, before the `Table.Row` that holds the column headers.
|
|
29
|
+
*
|
|
30
|
+
* The count is mirrored into a visually hidden `aria-live` region, which is deliberately filled a
|
|
31
|
+
* render after mount — a live region that enters the DOM with its text already in it is not
|
|
32
|
+
* announced, so the first selection would go unspoken otherwise.
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* ```tsx
|
|
36
|
+
* <Table.Header>
|
|
37
|
+
* {selected.length > 0 && (
|
|
38
|
+
* <BitkitBulkActionsRow
|
|
39
|
+
* colSpan={COL_COUNT}
|
|
40
|
+
* items={{ one: 'workflow', other: 'workflows' }}
|
|
41
|
+
* onCancel={clearSelection}
|
|
42
|
+
* onSelectAll={() => setAllAcrossPages(true)}
|
|
43
|
+
* selectedCount={selected.length}
|
|
44
|
+
* selectionState={selectionState}
|
|
45
|
+
* totalItems={TOTAL_ITEMS}
|
|
46
|
+
* >
|
|
47
|
+
* <BitkitButton icon={IconMinusCircle} size="md" variant="danger-secondary">
|
|
48
|
+
* Remove
|
|
49
|
+
* </BitkitButton>
|
|
50
|
+
* </BitkitBulkActionsRow>
|
|
51
|
+
* )}
|
|
52
|
+
* <Table.Row>{columnHeaders}</Table.Row>
|
|
53
|
+
* </Table.Header>
|
|
54
|
+
* ```
|
|
55
|
+
*/
|
|
56
|
+
var BitkitBulkActionsRow = forwardRef((props, ref) => {
|
|
57
|
+
const { children, colSpan, items = DEFAULT_ITEMS, labels: labelsProp, onCancel, onSelectAll, selectedCount, selectionState, totalItems, ...rest } = props;
|
|
58
|
+
const styles = useTableStyles();
|
|
59
|
+
const labels = {
|
|
60
|
+
...DEFAULT_LABELS,
|
|
61
|
+
...labelsProp
|
|
62
|
+
};
|
|
63
|
+
const countLabel = {
|
|
64
|
+
all: labels.allSelected,
|
|
65
|
+
allOnPage: labels.selectedOnPage,
|
|
66
|
+
some: labels.selected
|
|
67
|
+
}[selectionState];
|
|
68
|
+
const countText = formatLabel(countLabel, {
|
|
69
|
+
items: resolveItems(items, selectionState === "all" ? totalItems : selectedCount),
|
|
70
|
+
selectedCount,
|
|
71
|
+
totalItems
|
|
72
|
+
});
|
|
73
|
+
const selectAllText = formatLabel(labels.selectAll, {
|
|
74
|
+
items: resolveItems(items, totalItems),
|
|
75
|
+
selectedCount,
|
|
76
|
+
totalItems
|
|
77
|
+
});
|
|
78
|
+
const [announcement, setAnnouncement] = useState("");
|
|
79
|
+
useEffect(() => {
|
|
80
|
+
setAnnouncement(countText);
|
|
81
|
+
}, [countText]);
|
|
82
|
+
return /* @__PURE__ */ jsx(Table.Row, {
|
|
83
|
+
ref,
|
|
84
|
+
...rest,
|
|
85
|
+
children: /* @__PURE__ */ jsx(Table.Cell, {
|
|
86
|
+
colSpan,
|
|
87
|
+
css: styles.utilityCell,
|
|
88
|
+
children: /* @__PURE__ */ jsxs(Box, {
|
|
89
|
+
css: styles.bulkActionsGroup,
|
|
90
|
+
children: [
|
|
91
|
+
/* @__PURE__ */ jsx(Text, {
|
|
92
|
+
color: "text/body",
|
|
93
|
+
textStyle: "body/md/regular",
|
|
94
|
+
children: countText
|
|
95
|
+
}),
|
|
96
|
+
/* @__PURE__ */ jsx(VisuallyHidden, {
|
|
97
|
+
"aria-live": "polite",
|
|
98
|
+
children: announcement
|
|
99
|
+
}),
|
|
100
|
+
selectionState === "allOnPage" && !!onSelectAll && /* @__PURE__ */ jsx(BitkitButton, {
|
|
101
|
+
onClick: onSelectAll,
|
|
102
|
+
size: "sm",
|
|
103
|
+
variant: "tertiary",
|
|
104
|
+
children: selectAllText
|
|
105
|
+
}),
|
|
106
|
+
/* @__PURE__ */ jsxs(Box, {
|
|
107
|
+
css: styles.bulkActionsButtons,
|
|
108
|
+
children: [/* @__PURE__ */ jsx(BitkitButton, {
|
|
109
|
+
onClick: onCancel,
|
|
110
|
+
size: "md",
|
|
111
|
+
variant: "tertiary",
|
|
112
|
+
children: labels.cancel
|
|
113
|
+
}), children]
|
|
114
|
+
})
|
|
115
|
+
]
|
|
116
|
+
})
|
|
117
|
+
})
|
|
118
|
+
});
|
|
119
|
+
});
|
|
120
|
+
BitkitBulkActionsRow.displayName = "BitkitBulkActionsRow";
|
|
121
|
+
//#endregion
|
|
122
|
+
export { BitkitBulkActionsRow as default };
|
|
123
|
+
|
|
124
|
+
//# sourceMappingURL=BitkitBulkActionsRow.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BitkitBulkActionsRow.js","names":[],"sources":["../../../lib/components/BitkitTable/BitkitBulkActionsRow.tsx"],"sourcesContent":["import { Box } from '@chakra-ui/react/box';\nimport { Table, useTableStyles } from '@chakra-ui/react/table';\nimport { Text } from '@chakra-ui/react/text';\nimport { VisuallyHidden } from '@chakra-ui/react/visually-hidden';\nimport { forwardRef, type ReactNode, useEffect, useState } from 'react';\n\nimport formatLabel from '../../utilities/formatLabel';\nimport BitkitButton from '../BitkitButton/BitkitButton';\n\n/**\n * The noun the bar counts. A single string is used for every count; pass `{ one, other }` to get\n * `1 workflow selected.` instead of `1 workflows selected.`\n */\nexport type BitkitBulkActionsItems = string | { one: string; other: string };\n\n/**\n * Overrides for the bar's sentences. Each template can use `{items}` (the `items` prop, already\n * resolved to the form matching that sentence's count), `{selectedCount}` and `{totalItems}`.\n * Override a whole sentence for wording a template can't express, such as another language's\n * grammar.\n */\nexport interface BitkitBulkActionsLabels {\n /** `selectionState=\"all\"`. Default: `All {totalItems} {items} selected.` */\n allSelected?: string;\n /** Default: `Cancel` */\n cancel?: string;\n /** The link offering the rows beyond this page. Default: `Select all {totalItems} {items}` */\n selectAll?: string;\n /** `selectionState=\"some\"`. Default: `{selectedCount} {items} selected.` */\n selected?: string;\n /** `selectionState=\"allOnPage\"`. Default: `{selectedCount} {items} selected on this page.` */\n selectedOnPage?: string;\n}\n\nconst DEFAULT_LABELS: Required<BitkitBulkActionsLabels> = {\n allSelected: 'All {totalItems} {items} selected.',\n cancel: 'Cancel',\n selectAll: 'Select all {totalItems} {items}',\n selected: '{selectedCount} {items} selected.',\n selectedOnPage: '{selectedCount} {items} selected on this page.',\n};\n\nconst DEFAULT_ITEMS: BitkitBulkActionsItems = { one: 'item', other: 'items' };\n\nconst resolveItems = (items: BitkitBulkActionsItems, count: number) => {\n if (typeof items === 'string') return items;\n return count === 1 ? items.one : items.other;\n};\n\nexport interface BitkitBulkActionsRowProps extends Omit<Table.RowProps, 'children'> {\n /** The bulk action buttons, rendered after `Cancel`. */\n children?: ReactNode;\n /** Must match the table's column count, so the row spans the full width. */\n colSpan: number;\n /** The counted noun. Default: `{ one: 'item', other: 'items' }` */\n items?: BitkitBulkActionsItems;\n labels?: BitkitBulkActionsLabels;\n onCancel: () => void;\n /** Renders the `Select all {totalItems} {items}` link while `selectionState=\"allOnPage\"`. */\n onSelectAll?: () => void;\n selectedCount: number;\n /**\n * `some` — part of the page is selected. `allOnPage` — the whole page is selected, and the rows\n * beyond it are still on offer. `all` — everything across every page is selected.\n */\n selectionState: 'some' | 'allOnPage' | 'all';\n totalItems: number;\n}\n\n/**\n * The bar above the column headers that appears while rows are selected: what is selected, the\n * offer to widen the selection to every page, and the actions to run on it. Belongs in\n * `Table.Header`, before the `Table.Row` that holds the column headers.\n *\n * The count is mirrored into a visually hidden `aria-live` region, which is deliberately filled a\n * render after mount — a live region that enters the DOM with its text already in it is not\n * announced, so the first selection would go unspoken otherwise.\n *\n * @example\n * ```tsx\n * <Table.Header>\n * {selected.length > 0 && (\n * <BitkitBulkActionsRow\n * colSpan={COL_COUNT}\n * items={{ one: 'workflow', other: 'workflows' }}\n * onCancel={clearSelection}\n * onSelectAll={() => setAllAcrossPages(true)}\n * selectedCount={selected.length}\n * selectionState={selectionState}\n * totalItems={TOTAL_ITEMS}\n * >\n * <BitkitButton icon={IconMinusCircle} size=\"md\" variant=\"danger-secondary\">\n * Remove\n * </BitkitButton>\n * </BitkitBulkActionsRow>\n * )}\n * <Table.Row>{columnHeaders}</Table.Row>\n * </Table.Header>\n * ```\n */\nconst BitkitBulkActionsRow = forwardRef<HTMLTableRowElement, BitkitBulkActionsRowProps>((props, ref) => {\n const {\n children,\n colSpan,\n items = DEFAULT_ITEMS,\n labels: labelsProp,\n onCancel,\n onSelectAll,\n selectedCount,\n selectionState,\n totalItems,\n ...rest\n } = props;\n\n const styles = useTableStyles();\n const labels = { ...DEFAULT_LABELS, ...labelsProp };\n\n const countLabel = {\n all: labels.allSelected,\n allOnPage: labels.selectedOnPage,\n some: labels.selected,\n }[selectionState];\n const count = selectionState === 'all' ? totalItems : selectedCount;\n\n const countText = formatLabel(countLabel, {\n items: resolveItems(items, count),\n selectedCount,\n totalItems,\n });\n\n const selectAllText = formatLabel(labels.selectAll, {\n items: resolveItems(items, totalItems),\n selectedCount,\n totalItems,\n });\n\n const [announcement, setAnnouncement] = useState('');\n\n useEffect(() => {\n setAnnouncement(countText);\n }, [countText]);\n\n return (\n <Table.Row ref={ref} {...rest}>\n <Table.Cell colSpan={colSpan} css={styles.utilityCell}>\n <Box css={styles.bulkActionsGroup}>\n <Text color=\"text/body\" textStyle=\"body/md/regular\">\n {countText}\n </Text>\n <VisuallyHidden aria-live=\"polite\">{announcement}</VisuallyHidden>\n {selectionState === 'allOnPage' && !!onSelectAll && (\n <BitkitButton onClick={onSelectAll} size=\"sm\" variant=\"tertiary\">\n {selectAllText}\n </BitkitButton>\n )}\n <Box css={styles.bulkActionsButtons}>\n <BitkitButton onClick={onCancel} size=\"md\" variant=\"tertiary\">\n {labels.cancel}\n </BitkitButton>\n {children}\n </Box>\n </Box>\n </Table.Cell>\n </Table.Row>\n );\n});\n\nBitkitBulkActionsRow.displayName = 'BitkitBulkActionsRow';\n\nexport default BitkitBulkActionsRow;\n"],"mappings":";;;;;;;;;AAkCA,IAAM,iBAAoD;CACxD,aAAa;CACb,QAAQ;CACR,WAAW;CACX,UAAU;CACV,gBAAgB;AAClB;AAEA,IAAM,gBAAwC;CAAE,KAAK;CAAQ,OAAO;AAAQ;AAE5E,IAAM,gBAAgB,OAA+B,UAAkB;CACrE,IAAI,OAAO,UAAU,UAAU,OAAO;CACtC,OAAO,UAAU,IAAI,MAAM,MAAM,MAAM;AACzC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqDA,IAAM,uBAAuB,YAA4D,OAAO,QAAQ;CACtG,MAAM,EACJ,UACA,SACA,QAAQ,eACR,QAAQ,YACR,UACA,aACA,eACA,gBACA,YACA,GAAG,SACD;CAEJ,MAAM,SAAS,eAAe;CAC9B,MAAM,SAAS;EAAE,GAAG;EAAgB,GAAG;CAAW;CAElD,MAAM,aAAa;EACjB,KAAK,OAAO;EACZ,WAAW,OAAO;EAClB,MAAM,OAAO;CACf,EAAE;CAGF,MAAM,YAAY,YAAY,YAAY;EACxC,OAAO,aAAa,OAHR,mBAAmB,QAAQ,aAAa,aAGpB;EAChC;EACA;CACF,CAAC;CAED,MAAM,gBAAgB,YAAY,OAAO,WAAW;EAClD,OAAO,aAAa,OAAO,UAAU;EACrC;EACA;CACF,CAAC;CAED,MAAM,CAAC,cAAc,mBAAmB,SAAS,EAAE;CAEnD,gBAAgB;EACd,gBAAgB,SAAS;CAC3B,GAAG,CAAC,SAAS,CAAC;CAEd,OACE,oBAAC,MAAM,KAAP;EAAgB;EAAK,GAAI;EACvB,UAAA,oBAAC,MAAM,MAAP;GAAqB;GAAS,KAAK,OAAO;GACxC,UAAA,qBAAC,KAAD;IAAK,KAAK,OAAO;IAAjB,UAAA;KACE,oBAAC,MAAD;MAAM,OAAM;MAAY,WAAU;MAC/B,UAAA;KACG,CAAA;KACN,oBAAC,gBAAD;MAAgB,aAAU;MAAU,UAAA;KAA6B,CAAA;KAChE,mBAAmB,eAAe,CAAC,CAAC,eACnC,oBAAC,cAAD;MAAc,SAAS;MAAa,MAAK;MAAK,SAAQ;MACnD,UAAA;KACW,CAAA;KAEhB,qBAAC,KAAD;MAAK,KAAK,OAAO;MAAjB,UAAA,CACE,oBAAC,cAAD;OAAc,SAAS;OAAU,MAAK;OAAK,SAAQ;OAChD,UAAA,OAAO;MACI,CAAA,GACb,QACE;;IACF;;EACK,CAAA;CACH,CAAA;AAEf,CAAC;AAED,qBAAqB,cAAc"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Table } from '@chakra-ui/react/table';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
export interface BitkitFilterRowProps extends Omit<Table.RowProps, 'children'> {
|
|
4
|
+
/** The filter controls. Laid out in a wrapping row, so any number of them fits. */
|
|
5
|
+
children: ReactNode;
|
|
6
|
+
/** Must match the table's column count, so the row spans the full width. */
|
|
7
|
+
colSpan: number;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* A full-width row of filter controls above the column headers. Belongs in `Table.Header`, before
|
|
11
|
+
* the `Table.Row` that holds the column headers.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```tsx
|
|
15
|
+
* <Table.Header>
|
|
16
|
+
* <BitkitFilterRow colSpan={COL_COUNT}>
|
|
17
|
+
* <BitkitSearchInput onChange={...} value={search} />
|
|
18
|
+
* <BitkitSelect items={teams} onValueChange={...} value={team} />
|
|
19
|
+
* </BitkitFilterRow>
|
|
20
|
+
* <Table.Row>{columnHeaders}</Table.Row>
|
|
21
|
+
* </Table.Header>
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
declare const BitkitFilterRow: import('react').ForwardRefExoticComponent<BitkitFilterRowProps & import('react').RefAttributes<HTMLTableRowElement>>;
|
|
25
|
+
export default BitkitFilterRow;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { Box } from "@chakra-ui/react/box";
|
|
2
|
+
import { forwardRef } from "react";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
import { Table, useTableStyles } from "@chakra-ui/react/table";
|
|
5
|
+
//#region lib/components/BitkitTable/BitkitFilterRow.tsx
|
|
6
|
+
/**
|
|
7
|
+
* A full-width row of filter controls above the column headers. Belongs in `Table.Header`, before
|
|
8
|
+
* the `Table.Row` that holds the column headers.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```tsx
|
|
12
|
+
* <Table.Header>
|
|
13
|
+
* <BitkitFilterRow colSpan={COL_COUNT}>
|
|
14
|
+
* <BitkitSearchInput onChange={...} value={search} />
|
|
15
|
+
* <BitkitSelect items={teams} onValueChange={...} value={team} />
|
|
16
|
+
* </BitkitFilterRow>
|
|
17
|
+
* <Table.Row>{columnHeaders}</Table.Row>
|
|
18
|
+
* </Table.Header>
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
var BitkitFilterRow = forwardRef((props, ref) => {
|
|
22
|
+
const { children, colSpan, ...rest } = props;
|
|
23
|
+
const styles = useTableStyles();
|
|
24
|
+
return /* @__PURE__ */ jsx(Table.Row, {
|
|
25
|
+
ref,
|
|
26
|
+
...rest,
|
|
27
|
+
children: /* @__PURE__ */ jsx(Table.Cell, {
|
|
28
|
+
colSpan,
|
|
29
|
+
css: styles.utilityCell,
|
|
30
|
+
children: /* @__PURE__ */ jsx(Box, {
|
|
31
|
+
css: styles.filterControls,
|
|
32
|
+
children
|
|
33
|
+
})
|
|
34
|
+
})
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
BitkitFilterRow.displayName = "BitkitFilterRow";
|
|
38
|
+
//#endregion
|
|
39
|
+
export { BitkitFilterRow as default };
|
|
40
|
+
|
|
41
|
+
//# sourceMappingURL=BitkitFilterRow.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BitkitFilterRow.js","names":[],"sources":["../../../lib/components/BitkitTable/BitkitFilterRow.tsx"],"sourcesContent":["import { Box } from '@chakra-ui/react/box';\nimport { Table, useTableStyles } from '@chakra-ui/react/table';\nimport { forwardRef, type ReactNode } from 'react';\n\nexport interface BitkitFilterRowProps extends Omit<Table.RowProps, 'children'> {\n /** The filter controls. Laid out in a wrapping row, so any number of them fits. */\n children: ReactNode;\n /** Must match the table's column count, so the row spans the full width. */\n colSpan: number;\n}\n\n/**\n * A full-width row of filter controls above the column headers. Belongs in `Table.Header`, before\n * the `Table.Row` that holds the column headers.\n *\n * @example\n * ```tsx\n * <Table.Header>\n * <BitkitFilterRow colSpan={COL_COUNT}>\n * <BitkitSearchInput onChange={...} value={search} />\n * <BitkitSelect items={teams} onValueChange={...} value={team} />\n * </BitkitFilterRow>\n * <Table.Row>{columnHeaders}</Table.Row>\n * </Table.Header>\n * ```\n */\nconst BitkitFilterRow = forwardRef<HTMLTableRowElement, BitkitFilterRowProps>((props, ref) => {\n const { children, colSpan, ...rest } = props;\n const styles = useTableStyles();\n\n return (\n <Table.Row ref={ref} {...rest}>\n <Table.Cell colSpan={colSpan} css={styles.utilityCell}>\n <Box css={styles.filterControls}>{children}</Box>\n </Table.Cell>\n </Table.Row>\n );\n});\n\nBitkitFilterRow.displayName = 'BitkitFilterRow';\n\nexport default BitkitFilterRow;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AA0BA,IAAM,kBAAkB,YAAuD,OAAO,QAAQ;CAC5F,MAAM,EAAE,UAAU,SAAS,GAAG,SAAS;CACvC,MAAM,SAAS,eAAe;CAE9B,OACE,oBAAC,MAAM,KAAP;EAAgB;EAAK,GAAI;EACvB,UAAA,oBAAC,MAAM,MAAP;GAAqB;GAAS,KAAK,OAAO;GACxC,UAAA,oBAAC,KAAD;IAAK,KAAK,OAAO;IAAiB;GAAc,CAAA;EACtC,CAAA;CACH,CAAA;AAEf,CAAC;AAED,gBAAgB,cAAc"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Table } from '@chakra-ui/react/table';
|
|
2
|
+
export interface BitkitLinkedRowProps extends Omit<Table.RowProps, 'onClick'> {
|
|
3
|
+
/** Target of the row link. Passed down to the `BitkitLinkedRow.LinkCell` inside the row. */
|
|
4
|
+
href: string;
|
|
5
|
+
/** Renders the link with the external-link affordance and opens it in a new tab. */
|
|
6
|
+
isExternal?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export type BitkitLinkedRowLinkCellProps = Table.CellProps;
|
|
9
|
+
declare const _default: import('react').ForwardRefExoticComponent<BitkitLinkedRowProps & import('react').RefAttributes<HTMLTableRowElement>> & {
|
|
10
|
+
LinkCell: import('react').ForwardRefExoticComponent<Table.CellProps & import('react').RefAttributes<HTMLTableCellElement>>;
|
|
11
|
+
};
|
|
12
|
+
export default _default;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { withSubComponents } from "../../utilities/withSubComponents.js";
|
|
2
|
+
import BitkitLink from "../BitkitLink/BitkitLink.js";
|
|
3
|
+
import { forwardRef } from "react";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
import { createContext as createContext$1 } from "@chakra-ui/react";
|
|
6
|
+
import { Table, useTableStyles } from "@chakra-ui/react/table";
|
|
7
|
+
//#region lib/components/BitkitTable/BitkitLinkedRow.tsx
|
|
8
|
+
var [ContextProvider, useLinkedRowContext] = createContext$1({
|
|
9
|
+
name: "LinkedRowContext",
|
|
10
|
+
hookName: "useLinkedRowContext",
|
|
11
|
+
providerName: "<BitkitLinkedRow />"
|
|
12
|
+
});
|
|
13
|
+
/**
|
|
14
|
+
* A table row that navigates as a whole. Exactly one of its cells must be a
|
|
15
|
+
* `BitkitLinkedRow.LinkCell` — that cell's content becomes the accessible link text, and its
|
|
16
|
+
* stretched pseudo-element makes the entire row the click and focus target.
|
|
17
|
+
*
|
|
18
|
+
* Interactive elements in the other cells (buttons, checkboxes, other links) stay clickable: they
|
|
19
|
+
* are lifted above the stretched link, so a `BitkitRowActionsCell` works inside a linked row.
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```tsx
|
|
23
|
+
* <BitkitLinkedRow href={`/workflows/${row.id}`}>
|
|
24
|
+
* <BitkitLinkedRow.LinkCell>{row.name}</BitkitLinkedRow.LinkCell>
|
|
25
|
+
* <Table.Cell>{row.status}</Table.Cell>
|
|
26
|
+
* <BitkitRowActionsCell actions={actions} />
|
|
27
|
+
* </BitkitLinkedRow>
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
var BitkitLinkedRow = forwardRef((props, ref) => {
|
|
31
|
+
const { children, href, isExternal, ...rest } = props;
|
|
32
|
+
const styles = useTableStyles();
|
|
33
|
+
return /* @__PURE__ */ jsx(ContextProvider, {
|
|
34
|
+
value: {
|
|
35
|
+
href,
|
|
36
|
+
isExternal
|
|
37
|
+
},
|
|
38
|
+
children: /* @__PURE__ */ jsx(Table.Row, {
|
|
39
|
+
ref,
|
|
40
|
+
css: styles.linkedRow,
|
|
41
|
+
...rest,
|
|
42
|
+
children
|
|
43
|
+
})
|
|
44
|
+
});
|
|
45
|
+
});
|
|
46
|
+
BitkitLinkedRow.displayName = "BitkitLinkedRow";
|
|
47
|
+
/**
|
|
48
|
+
* The cell that carries the row's link. Its children are the accessible link text, so give it the
|
|
49
|
+
* cell that names the row. Reads `href` and `isExternal` from the surrounding `BitkitLinkedRow`.
|
|
50
|
+
*/
|
|
51
|
+
var LinkCell = forwardRef((props, ref) => {
|
|
52
|
+
const { children, ...rest } = props;
|
|
53
|
+
const { href, isExternal } = useLinkedRowContext();
|
|
54
|
+
const styles = useTableStyles();
|
|
55
|
+
return /* @__PURE__ */ jsx(Table.Cell, {
|
|
56
|
+
ref,
|
|
57
|
+
...rest,
|
|
58
|
+
children: /* @__PURE__ */ jsx(BitkitLink, {
|
|
59
|
+
css: styles.rowLink,
|
|
60
|
+
"data-row-link": true,
|
|
61
|
+
href,
|
|
62
|
+
isExternal,
|
|
63
|
+
children
|
|
64
|
+
})
|
|
65
|
+
});
|
|
66
|
+
});
|
|
67
|
+
LinkCell.displayName = "BitkitLinkedRow.LinkCell";
|
|
68
|
+
var BitkitLinkedRow_default = withSubComponents(BitkitLinkedRow, { LinkCell });
|
|
69
|
+
//#endregion
|
|
70
|
+
export { BitkitLinkedRow_default as default };
|
|
71
|
+
|
|
72
|
+
//# sourceMappingURL=BitkitLinkedRow.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BitkitLinkedRow.js","names":[],"sources":["../../../lib/components/BitkitTable/BitkitLinkedRow.tsx"],"sourcesContent":["// eslint-disable-next-line no-restricted-imports\nimport { createContext } from '@chakra-ui/react';\nimport { Table, useTableStyles } from '@chakra-ui/react/table';\nimport { forwardRef } from 'react';\n\nimport { withSubComponents } from '../../utilities/withSubComponents';\nimport BitkitLink from '../BitkitLink/BitkitLink';\n\ninterface LinkedRowContext {\n href: string;\n isExternal?: boolean;\n}\n\nconst [ContextProvider, useLinkedRowContext] = createContext<LinkedRowContext>({\n name: 'LinkedRowContext',\n hookName: 'useLinkedRowContext',\n providerName: '<BitkitLinkedRow />',\n});\n\nexport interface BitkitLinkedRowProps extends Omit<Table.RowProps, 'onClick'> {\n /** Target of the row link. Passed down to the `BitkitLinkedRow.LinkCell` inside the row. */\n href: string;\n /** Renders the link with the external-link affordance and opens it in a new tab. */\n isExternal?: boolean;\n}\n\n/**\n * A table row that navigates as a whole. Exactly one of its cells must be a\n * `BitkitLinkedRow.LinkCell` — that cell's content becomes the accessible link text, and its\n * stretched pseudo-element makes the entire row the click and focus target.\n *\n * Interactive elements in the other cells (buttons, checkboxes, other links) stay clickable: they\n * are lifted above the stretched link, so a `BitkitRowActionsCell` works inside a linked row.\n *\n * @example\n * ```tsx\n * <BitkitLinkedRow href={`/workflows/${row.id}`}>\n * <BitkitLinkedRow.LinkCell>{row.name}</BitkitLinkedRow.LinkCell>\n * <Table.Cell>{row.status}</Table.Cell>\n * <BitkitRowActionsCell actions={actions} />\n * </BitkitLinkedRow>\n * ```\n */\nconst BitkitLinkedRow = forwardRef<HTMLTableRowElement, BitkitLinkedRowProps>((props, ref) => {\n const { children, href, isExternal, ...rest } = props;\n const styles = useTableStyles();\n\n return (\n <ContextProvider value={{ href, isExternal }}>\n <Table.Row ref={ref} css={styles.linkedRow} {...rest}>\n {children}\n </Table.Row>\n </ContextProvider>\n );\n});\n\nBitkitLinkedRow.displayName = 'BitkitLinkedRow';\n\nexport type BitkitLinkedRowLinkCellProps = Table.CellProps;\n\n/**\n * The cell that carries the row's link. Its children are the accessible link text, so give it the\n * cell that names the row. Reads `href` and `isExternal` from the surrounding `BitkitLinkedRow`.\n */\nconst LinkCell = forwardRef<HTMLTableCellElement, BitkitLinkedRowLinkCellProps>((props, ref) => {\n const { children, ...rest } = props;\n const { href, isExternal } = useLinkedRowContext();\n const styles = useTableStyles();\n\n return (\n <Table.Cell ref={ref} {...rest}>\n <BitkitLink css={styles.rowLink} data-row-link href={href} isExternal={isExternal}>\n {children}\n </BitkitLink>\n </Table.Cell>\n );\n});\n\nLinkCell.displayName = 'BitkitLinkedRow.LinkCell';\n\nexport default withSubComponents(BitkitLinkedRow, { LinkCell });\n"],"mappings":";;;;;;;AAaA,IAAM,CAAC,iBAAiB,uBAAuB,gBAAgC;CAC7E,MAAM;CACN,UAAU;CACV,cAAc;AAChB,CAAC;;;;;;;;;;;;;;;;;;AA0BD,IAAM,kBAAkB,YAAuD,OAAO,QAAQ;CAC5F,MAAM,EAAE,UAAU,MAAM,YAAY,GAAG,SAAS;CAChD,MAAM,SAAS,eAAe;CAE9B,OACE,oBAAC,iBAAD;EAAiB,OAAO;GAAE;GAAM;EAAW;EACzC,UAAA,oBAAC,MAAM,KAAP;GAAgB;GAAK,KAAK,OAAO;GAAW,GAAI;GAC7C;EACQ,CAAA;CACI,CAAA;AAErB,CAAC;AAED,gBAAgB,cAAc;;;;;AAQ9B,IAAM,WAAW,YAAgE,OAAO,QAAQ;CAC9F,MAAM,EAAE,UAAU,GAAG,SAAS;CAC9B,MAAM,EAAE,MAAM,eAAe,oBAAoB;CACjD,MAAM,SAAS,eAAe;CAE9B,OACE,oBAAC,MAAM,MAAP;EAAiB;EAAK,GAAI;EACxB,UAAA,oBAAC,YAAD;GAAY,KAAK,OAAO;GAAS,iBAAA;GAAoB;GAAkB;GACpE;EACS,CAAA;CACF,CAAA;AAEhB,CAAC;AAED,SAAS,cAAc;AAEvB,IAAA,0BAAe,kBAAkB,iBAAiB,EAAE,SAAS,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { Table } from '@chakra-ui/react/table';
|
|
2
|
+
import { MouseEvent } from 'react';
|
|
3
|
+
import { BitkitIconComponent } from '../../icons';
|
|
4
|
+
/** One row action, rendered either as an inline control button or as an action menu item. */
|
|
5
|
+
export interface BitkitRowAction {
|
|
6
|
+
/** Renders the action in the danger color set. */
|
|
7
|
+
danger?: boolean;
|
|
8
|
+
/** Makes the action a link instead of a button. */
|
|
9
|
+
href?: string;
|
|
10
|
+
icon: BitkitIconComponent;
|
|
11
|
+
/** Only with `href`: opens the link in a new tab and adds the external-link affordance. */
|
|
12
|
+
isExternal?: boolean;
|
|
13
|
+
/** Accessible name of the inline button, and the visible text of the menu item. Must be unique
|
|
14
|
+
* within `actions`, since it keys the list. */
|
|
15
|
+
label: string;
|
|
16
|
+
onClick?: (event: MouseEvent<HTMLElement>) => void;
|
|
17
|
+
state?: 'disabled';
|
|
18
|
+
}
|
|
19
|
+
export interface BitkitRowActionsCellProps extends Omit<Table.CellProps, 'children' | 'onClick'> {
|
|
20
|
+
/** Up to two actions render as inline icon buttons; three or more collapse into an action menu. */
|
|
21
|
+
actions: BitkitRowAction[];
|
|
22
|
+
/** Accessible name of the action menu trigger, used from the third action on. Default: `More actions` */
|
|
23
|
+
menuLabel?: string;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* The trailing cell of a table row, holding its actions. The column shrinks to fit the buttons.
|
|
27
|
+
*
|
|
28
|
+
* Up to two actions render as inline icon buttons; from the third on they collapse into a single
|
|
29
|
+
* action menu, so the column width stays predictable. Clicks are kept inside the cell, so the
|
|
30
|
+
* actions work in a `BitkitLinkedRow` without triggering the row link.
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* ```tsx
|
|
34
|
+
* <BitkitRowActionsCell
|
|
35
|
+
* actions={[
|
|
36
|
+
* { icon: IconPencil, label: 'Edit', onClick: onEdit },
|
|
37
|
+
* { danger: true, icon: IconMinusCircle, label: 'Remove', onClick: onRemove },
|
|
38
|
+
* ]}
|
|
39
|
+
* />
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
42
|
+
declare const BitkitRowActionsCell: import('react').ForwardRefExoticComponent<BitkitRowActionsCellProps & import('react').RefAttributes<HTMLTableCellElement>>;
|
|
43
|
+
export default BitkitRowActionsCell;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import IconMoreVertical from "../../icons/IconMoreVertical.js";
|
|
2
|
+
import BitkitActionMenu_default from "../BitkitActionMenu/BitkitActionMenu.js";
|
|
3
|
+
import BitkitControlButton from "../BitkitControlButton/BitkitControlButton.js";
|
|
4
|
+
import { Box } from "@chakra-ui/react/box";
|
|
5
|
+
import { forwardRef } from "react";
|
|
6
|
+
import { jsx } from "react/jsx-runtime";
|
|
7
|
+
import { Table, useTableStyles } from "@chakra-ui/react/table";
|
|
8
|
+
//#region lib/components/BitkitTable/BitkitRowActionsCell.tsx
|
|
9
|
+
var MAX_INLINE_ACTIONS = 2;
|
|
10
|
+
var InlineAction = ({ action }) => {
|
|
11
|
+
if (action.href !== void 0) return /* @__PURE__ */ jsx(BitkitControlButton, {
|
|
12
|
+
href: action.href,
|
|
13
|
+
icon: action.icon,
|
|
14
|
+
isDanger: action.danger,
|
|
15
|
+
isExternal: action.isExternal,
|
|
16
|
+
label: action.label,
|
|
17
|
+
onClick: action.onClick,
|
|
18
|
+
state: action.state
|
|
19
|
+
});
|
|
20
|
+
return /* @__PURE__ */ jsx(BitkitControlButton, {
|
|
21
|
+
icon: action.icon,
|
|
22
|
+
isDanger: action.danger,
|
|
23
|
+
label: action.label,
|
|
24
|
+
onClick: action.onClick,
|
|
25
|
+
state: action.state
|
|
26
|
+
});
|
|
27
|
+
};
|
|
28
|
+
var MenuAction = ({ action }) => {
|
|
29
|
+
if (action.href !== void 0) return /* @__PURE__ */ jsx(BitkitActionMenu_default.Item, {
|
|
30
|
+
disabled: action.state === "disabled",
|
|
31
|
+
href: action.href,
|
|
32
|
+
icon: action.icon,
|
|
33
|
+
isDanger: action.danger,
|
|
34
|
+
isExternal: action.isExternal,
|
|
35
|
+
onClick: action.onClick,
|
|
36
|
+
value: action.label,
|
|
37
|
+
children: action.label
|
|
38
|
+
});
|
|
39
|
+
return /* @__PURE__ */ jsx(BitkitActionMenu_default.Item, {
|
|
40
|
+
disabled: action.state === "disabled",
|
|
41
|
+
icon: action.icon,
|
|
42
|
+
isDanger: action.danger,
|
|
43
|
+
onClick: action.onClick,
|
|
44
|
+
value: action.label,
|
|
45
|
+
children: action.label
|
|
46
|
+
});
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* The trailing cell of a table row, holding its actions. The column shrinks to fit the buttons.
|
|
50
|
+
*
|
|
51
|
+
* Up to two actions render as inline icon buttons; from the third on they collapse into a single
|
|
52
|
+
* action menu, so the column width stays predictable. Clicks are kept inside the cell, so the
|
|
53
|
+
* actions work in a `BitkitLinkedRow` without triggering the row link.
|
|
54
|
+
*
|
|
55
|
+
* @example
|
|
56
|
+
* ```tsx
|
|
57
|
+
* <BitkitRowActionsCell
|
|
58
|
+
* actions={[
|
|
59
|
+
* { icon: IconPencil, label: 'Edit', onClick: onEdit },
|
|
60
|
+
* { danger: true, icon: IconMinusCircle, label: 'Remove', onClick: onRemove },
|
|
61
|
+
* ]}
|
|
62
|
+
* />
|
|
63
|
+
* ```
|
|
64
|
+
*/
|
|
65
|
+
var BitkitRowActionsCell = forwardRef((props, ref) => {
|
|
66
|
+
const { actions, menuLabel = "More actions", ...rest } = props;
|
|
67
|
+
const styles = useTableStyles();
|
|
68
|
+
return /* @__PURE__ */ jsx(Table.Cell, {
|
|
69
|
+
ref,
|
|
70
|
+
css: styles.actionsCell,
|
|
71
|
+
...rest,
|
|
72
|
+
children: /* @__PURE__ */ jsx(Box, {
|
|
73
|
+
css: styles.actionsGroup,
|
|
74
|
+
onClick: (event) => event.stopPropagation(),
|
|
75
|
+
children: actions.length <= MAX_INLINE_ACTIONS ? actions.map((action) => /* @__PURE__ */ jsx(InlineAction, { action }, action.label)) : /* @__PURE__ */ jsx(BitkitActionMenu_default, {
|
|
76
|
+
size: "md",
|
|
77
|
+
trigger: /* @__PURE__ */ jsx(BitkitControlButton, {
|
|
78
|
+
icon: IconMoreVertical,
|
|
79
|
+
label: menuLabel
|
|
80
|
+
}),
|
|
81
|
+
children: actions.map((action) => /* @__PURE__ */ jsx(MenuAction, { action }, action.label))
|
|
82
|
+
})
|
|
83
|
+
})
|
|
84
|
+
});
|
|
85
|
+
});
|
|
86
|
+
BitkitRowActionsCell.displayName = "BitkitRowActionsCell";
|
|
87
|
+
//#endregion
|
|
88
|
+
export { BitkitRowActionsCell as default };
|
|
89
|
+
|
|
90
|
+
//# sourceMappingURL=BitkitRowActionsCell.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BitkitRowActionsCell.js","names":[],"sources":["../../../lib/components/BitkitTable/BitkitRowActionsCell.tsx"],"sourcesContent":["import { Box } from '@chakra-ui/react/box';\nimport { Table, useTableStyles } from '@chakra-ui/react/table';\nimport { forwardRef, type MouseEvent } from 'react';\n\nimport { type BitkitIconComponent } from '../../icons';\nimport IconMoreVertical from '../../icons/IconMoreVertical';\nimport BitkitActionMenu from '../BitkitActionMenu/BitkitActionMenu';\nimport BitkitControlButton from '../BitkitControlButton/BitkitControlButton';\n\n/** One row action, rendered either as an inline control button or as an action menu item. */\nexport interface BitkitRowAction {\n /** Renders the action in the danger color set. */\n danger?: boolean;\n /** Makes the action a link instead of a button. */\n href?: string;\n icon: BitkitIconComponent;\n /** Only with `href`: opens the link in a new tab and adds the external-link affordance. */\n isExternal?: boolean;\n /** Accessible name of the inline button, and the visible text of the menu item. Must be unique\n * within `actions`, since it keys the list. */\n label: string;\n onClick?: (event: MouseEvent<HTMLElement>) => void;\n state?: 'disabled';\n}\n\nexport interface BitkitRowActionsCellProps extends Omit<Table.CellProps, 'children' | 'onClick'> {\n /** Up to two actions render as inline icon buttons; three or more collapse into an action menu. */\n actions: BitkitRowAction[];\n /** Accessible name of the action menu trigger, used from the third action on. Default: `More actions` */\n menuLabel?: string;\n}\n\nconst MAX_INLINE_ACTIONS = 2;\n\nconst InlineAction = ({ action }: { action: BitkitRowAction }) => {\n if (action.href !== undefined) {\n return (\n <BitkitControlButton\n href={action.href}\n icon={action.icon}\n isDanger={action.danger}\n isExternal={action.isExternal}\n label={action.label}\n onClick={action.onClick}\n state={action.state}\n />\n );\n }\n\n return (\n <BitkitControlButton\n icon={action.icon}\n isDanger={action.danger}\n label={action.label}\n onClick={action.onClick}\n state={action.state}\n />\n );\n};\n\nconst MenuAction = ({ action }: { action: BitkitRowAction }) => {\n if (action.href !== undefined) {\n return (\n <BitkitActionMenu.Item\n disabled={action.state === 'disabled'}\n href={action.href}\n icon={action.icon}\n isDanger={action.danger}\n isExternal={action.isExternal}\n onClick={action.onClick}\n value={action.label}\n >\n {action.label}\n </BitkitActionMenu.Item>\n );\n }\n\n return (\n <BitkitActionMenu.Item\n disabled={action.state === 'disabled'}\n icon={action.icon}\n isDanger={action.danger}\n onClick={action.onClick}\n value={action.label}\n >\n {action.label}\n </BitkitActionMenu.Item>\n );\n};\n\n/**\n * The trailing cell of a table row, holding its actions. The column shrinks to fit the buttons.\n *\n * Up to two actions render as inline icon buttons; from the third on they collapse into a single\n * action menu, so the column width stays predictable. Clicks are kept inside the cell, so the\n * actions work in a `BitkitLinkedRow` without triggering the row link.\n *\n * @example\n * ```tsx\n * <BitkitRowActionsCell\n * actions={[\n * { icon: IconPencil, label: 'Edit', onClick: onEdit },\n * { danger: true, icon: IconMinusCircle, label: 'Remove', onClick: onRemove },\n * ]}\n * />\n * ```\n */\nconst BitkitRowActionsCell = forwardRef<HTMLTableCellElement, BitkitRowActionsCellProps>((props, ref) => {\n const { actions, menuLabel = 'More actions', ...rest } = props;\n const styles = useTableStyles();\n\n return (\n <Table.Cell ref={ref} css={styles.actionsCell} {...rest}>\n <Box css={styles.actionsGroup} onClick={(event) => event.stopPropagation()}>\n {actions.length <= MAX_INLINE_ACTIONS ? (\n actions.map((action) => <InlineAction key={action.label} action={action} />)\n ) : (\n <BitkitActionMenu size=\"md\" trigger={<BitkitControlButton icon={IconMoreVertical} label={menuLabel} />}>\n {actions.map((action) => (\n <MenuAction key={action.label} action={action} />\n ))}\n </BitkitActionMenu>\n )}\n </Box>\n </Table.Cell>\n );\n});\n\nBitkitRowActionsCell.displayName = 'BitkitRowActionsCell';\n\nexport default BitkitRowActionsCell;\n"],"mappings":";;;;;;;;AAgCA,IAAM,qBAAqB;AAE3B,IAAM,gBAAgB,EAAE,aAA0C;CAChE,IAAI,OAAO,SAAS,KAAA,GAClB,OACE,oBAAC,qBAAD;EACE,MAAM,OAAO;EACb,MAAM,OAAO;EACb,UAAU,OAAO;EACjB,YAAY,OAAO;EACnB,OAAO,OAAO;EACd,SAAS,OAAO;EAChB,OAAO,OAAO;CACf,CAAA;CAIL,OACE,oBAAC,qBAAD;EACE,MAAM,OAAO;EACb,UAAU,OAAO;EACjB,OAAO,OAAO;EACd,SAAS,OAAO;EAChB,OAAO,OAAO;CACf,CAAA;AAEL;AAEA,IAAM,cAAc,EAAE,aAA0C;CAC9D,IAAI,OAAO,SAAS,KAAA,GAClB,OACE,oBAAC,yBAAiB,MAAlB;EACE,UAAU,OAAO,UAAU;EAC3B,MAAM,OAAO;EACb,MAAM,OAAO;EACb,UAAU,OAAO;EACjB,YAAY,OAAO;EACnB,SAAS,OAAO;EAChB,OAAO,OAAO;EAEb,UAAA,OAAO;CACa,CAAA;CAI3B,OACE,oBAAC,yBAAiB,MAAlB;EACE,UAAU,OAAO,UAAU;EAC3B,MAAM,OAAO;EACb,UAAU,OAAO;EACjB,SAAS,OAAO;EAChB,OAAO,OAAO;EAEb,UAAA,OAAO;CACa,CAAA;AAE3B;;;;;;;;;;;;;;;;;;AAmBA,IAAM,uBAAuB,YAA6D,OAAO,QAAQ;CACvG,MAAM,EAAE,SAAS,YAAY,gBAAgB,GAAG,SAAS;CACzD,MAAM,SAAS,eAAe;CAE9B,OACE,oBAAC,MAAM,MAAP;EAAiB;EAAK,KAAK,OAAO;EAAa,GAAI;EACjD,UAAA,oBAAC,KAAD;GAAK,KAAK,OAAO;GAAc,UAAU,UAAU,MAAM,gBAAgB;GACtE,UAAA,QAAQ,UAAU,qBACjB,QAAQ,KAAK,WAAW,oBAAC,cAAD,EAAyC,OAAS,GAA/B,OAAO,KAAwB,CAAC,IAE3E,oBAAC,0BAAD;IAAkB,MAAK;IAAK,SAAS,oBAAC,qBAAD;KAAqB,MAAM;KAAkB,OAAO;IAAY,CAAA;IAClG,UAAA,QAAQ,KAAK,WACZ,oBAAC,YAAD,EAAuC,OAAS,GAA/B,OAAO,KAAwB,CACjD;GACe,CAAA;EAEjB,CAAA;CACK,CAAA;AAEhB,CAAC;AAED,qBAAqB,cAAc"}
|
|
@@ -73,7 +73,11 @@ export { default as BitkitStat, type BitkitStatProps, type TrendColor, type Tren
|
|
|
73
73
|
export { default as BitkitSteps, type BitkitStepsItemProps, type BitkitStepsItemState, type BitkitStepsProps, } from './BitkitSteps/BitkitSteps';
|
|
74
74
|
export { default as BitkitStepsCard, type BitkitStepsCardBodyProps, type BitkitStepsCardFooterProps, type BitkitStepsCardHeaderProps, type BitkitStepsCardProps, type BitkitStepsCardStepProps, } from './BitkitStepsCard/BitkitStepsCard';
|
|
75
75
|
export { default as BitkitSwitch, type BitkitSwitchProps } from './BitkitSwitch';
|
|
76
|
+
export { type BitkitBulkActionsItems, type BitkitBulkActionsLabels, default as BitkitBulkActionsRow, type BitkitBulkActionsRowProps, } from './BitkitTable/BitkitBulkActionsRow';
|
|
76
77
|
export { default as BitkitExpandableRow, type BitkitExpandableRowProps } from './BitkitTable/BitkitExpandableRow';
|
|
78
|
+
export { default as BitkitFilterRow, type BitkitFilterRowProps } from './BitkitTable/BitkitFilterRow';
|
|
79
|
+
export { default as BitkitLinkedRow, type BitkitLinkedRowLinkCellProps, type BitkitLinkedRowProps, } from './BitkitTable/BitkitLinkedRow';
|
|
80
|
+
export { type BitkitRowAction, default as BitkitRowActionsCell, type BitkitRowActionsCellProps, } from './BitkitTable/BitkitRowActionsCell';
|
|
77
81
|
export { default as BitkitSortableColumnHeader, type BitkitSortableColumnHeaderProps, } from './BitkitTable/BitkitSortableColumnHeader';
|
|
78
82
|
export { default as BitkitTabs } from './BitkitTabs/BitkitTabs';
|
|
79
83
|
export { default as BitkitTag, type BitkitTagProps } from './BitkitTag/BitkitTag';
|
package/dist/main.js
CHANGED
|
@@ -361,7 +361,11 @@ import BitkitSplitButton_default from "./components/BitkitSplitButton/BitkitSpli
|
|
|
361
361
|
import BitkitStat from "./components/BitkitStat/BitkitStat.js";
|
|
362
362
|
import BitkitStepsCard_default from "./components/BitkitStepsCard/BitkitStepsCard.js";
|
|
363
363
|
import BitkitSwitch from "./components/BitkitSwitch/BitkitSwitch.js";
|
|
364
|
+
import BitkitBulkActionsRow from "./components/BitkitTable/BitkitBulkActionsRow.js";
|
|
364
365
|
import BitkitExpandableRow from "./components/BitkitTable/BitkitExpandableRow.js";
|
|
366
|
+
import BitkitFilterRow from "./components/BitkitTable/BitkitFilterRow.js";
|
|
367
|
+
import BitkitLinkedRow_default from "./components/BitkitTable/BitkitLinkedRow.js";
|
|
368
|
+
import BitkitRowActionsCell from "./components/BitkitTable/BitkitRowActionsCell.js";
|
|
365
369
|
import BitkitSortableColumnHeader from "./components/BitkitTable/BitkitSortableColumnHeader.js";
|
|
366
370
|
import BitkitTabs from "./components/BitkitTabs/BitkitTabs.js";
|
|
367
371
|
import BitkitTagsInput from "./components/BitkitTagsInput/BitkitTagsInput.js";
|
|
@@ -373,4 +377,4 @@ import BitkitTreeView, { createTreeCollection } from "./components/BitkitTreeVie
|
|
|
373
377
|
import useResponsive, { ResponsiveProvider } from "./hooks/useResponsive.js";
|
|
374
378
|
import bitkitTheme from "./theme/index.js";
|
|
375
379
|
import Provider from "./providers/BitkitProvider.js";
|
|
376
|
-
export { BitkitAccordion_default as BitkitAccordion, BitkitActionBar, BitkitActionMenu_default as BitkitActionMenu, BitkitAlert, BitkitAvatar, BitkitBadge, BitkitBreadcrumb, BitkitButton, BitkitCalendar, BitkitCheckbox, BitkitCheckboxGroup, BitkitCloseButton, BitkitCodeSnippet, BitkitCollapsible, BitkitColorButton, BitkitCombobox_default as BitkitCombobox, BitkitControlButton, BitkitDataWidget, BitkitDatePicker, BitkitDefinitionTooltip, BitkitDialog_default as BitkitDialog, BitkitDraggableCard, BitkitDrawer, BitkitEmptyState, BitkitExpandableCard, BitkitExpandableRow, BitkitField, BitkitFileInput, BitkitFormDialog_default as BitkitFormDialog, BitkitGroupHeading, BitkitHeading, BitkitIconButton, BitkitInlineLoading, BitkitLabel, BitkitLabelTooltip, BitkitLabeledData, BitkitLightbox, BitkitLink, BitkitLinkButton, BitkitList_default as BitkitList, BitkitMarkdown, BitkitMarkdownCard, BitkitMultiselect_default as BitkitMultiselect, BitkitMultiselectMenu, BitkitNativeSelect, BitkitNoteCard, BitkitNumberInput, BitkitOverflowContent, BitkitOverflowTooltip, BitkitPageFooter_default as BitkitPageFooter, BitkitPagination, BitkitPaginationLoadMore, BitkitPopover, BitkitProgressBar, BitkitPromoBanner, Provider as BitkitProvider, BitkitRadio, BitkitRadioGroup, BitkitRibbon, BitkitSearchInput, BitkitSectionHeading, BitkitSegmentedControl_default as BitkitSegmentedControl, BitkitSelect_default as BitkitSelect, BitkitSelectMenu, BitkitSelectMenuAction, BitkitSelectableTag_default as BitkitSelectableTag, BitkitSettingsCard_default as BitkitSettingsCard, BitkitSidebar_default as BitkitSidebar, BitkitSkeletonGroup, BitkitSortableColumnHeader, BitkitSpinner, BitkitSplitButton_default as BitkitSplitButton, BitkitStat, BitkitStepperDialog_default as BitkitStepperDialog, BitkitSteps_default as BitkitSteps, BitkitStepsCard_default as BitkitStepsCard, BitkitSwitch, BitkitTabs, BitkitTag, BitkitTagsInput, BitkitTextArea, BitkitTextInput, BitkitToggleButton, BitkitTooltip, BitkitTour, BitkitTreeView, IconAbortCircle, IconAbortCircleFilled, IconAddons, IconAgent, IconAnchor, IconAndroid, IconApp, IconAppSettings, IconAppStore, IconAppStoreColor, IconApple, IconArchive, IconArchiveDelete, IconArchiveRestore, IconArrowBackAndDown, IconArrowBackAndUp, IconArrowDown, IconArrowForwardAndDown, IconArrowForwardAndUp, IconArrowLeft, IconArrowNortheast, IconArrowNorthwest, IconArrowRight, IconArrowUp, IconArrowsHorizontal, IconArrowsVertical, IconAutomation, IconAws, IconAwsColor, IconBadge3RdParty, IconBadgeBitrise, IconBadgeUpgrade, IconBadgeVersionOk, IconBazel, IconBell, IconBitbot, IconBitbotError, IconBitbucket, IconBitbucketColor, IconBitbucketNeutral, IconBitbucketWhite, IconBlockCircle, IconBook, IconBoxArrowDown, IconBoxDot, IconBoxLinesOverflow, IconBoxLinesWrap, IconBranch, IconBrowserstackColor, IconBug, IconBuild, IconBuildCache, IconBuildCacheFilled, IconBuildEnvSetup, IconBuildHub, IconBuildHubFilled, IconCalendar, IconChangePlan, IconChat, IconCheck, IconCheckCircle, IconCheckCircleFilled, IconChevronDown, IconChevronLeft, IconChevronRight, IconChevronUp, IconCi, IconCiFilled, IconCircle, IconCircleDashed, IconCircleHalfFilled, IconClaude, IconClaudeColor, IconClock, IconCode, IconCodePush, IconCodeSigning, IconCoffee, IconCommit, IconConfigure, IconConnectedAccounts, IconContainer, IconCopy, IconCordova, IconCpu, IconCreditcard, IconCredits, IconCross, IconCrossCircle, IconCrossCircleFilled, IconCrown, IconCycle, IconDashboard, IconDashboardFilled, IconDeployment, IconDetails, IconDoc, IconDollar, IconDot, IconDotnet, IconDotnetColor, IconDotnetText, IconDotnetTextColor, IconDoubleCircle, IconDownload, IconDragHandle, IconEc2Ami, IconEnterprise, IconErrorCircle, IconErrorCircleFilled, IconExpand, IconExtraBuildCapacity, IconEye, IconEyeSlash, IconFastlane, IconFileDoc, IconFilePdf, IconFilePlist, IconFileYml, IconFileZip, IconFilter, IconFlag, IconFlutter, IconFolder, IconFullscreen, IconFullscreenExit, IconGauge, IconGit, IconGithub, IconGitlab, IconGitlabColor, IconGitlabWhite, IconGlobe, IconGo, IconGoogleColor, IconGooglePlay, IconGooglePlayColor, IconGradle, IconGroup, IconHashtag, IconHeadset, IconHeart, IconHistory, IconHourglass, IconImage, IconInfoCircle, IconInfoCircleFilled, IconInsights, IconInsightsFilled, IconInstall, IconInteraction, IconInvoice, IconIonic, IconJapanese, IconJava, IconJavaColor, IconJavaDuke, IconJavaDukeColor, IconKey, IconKotlin, IconKotlinColor, IconKotlinWhite, IconLaptop, IconLaunchdarkly, IconLegacyApp, IconLightbulb, IconLink, IconLinux, IconLock, IconLockOpen, IconLogin, IconLogout, IconMacos, IconMagicWand, IconMagnifier, IconMail, IconMedal, IconMemory, IconMenuGrid, IconMenuHamburger, IconMessage, IconMessageAlert, IconMessageQuestion, IconMicrophone, IconMinus, IconMinusCircle, IconMinusCircleFilled, IconMobile, IconMobileLandscape, IconMonitorChart, IconMoreHorizontal, IconMoreVertical, IconNews, IconNextjs, IconNodejs, IconOpenInNew, IconOther, IconOutsideContributor, IconOverview, IconPause, IconPencil, IconPeople, IconPercent, IconPerson, IconPersonWithDesk, IconPlay, IconPlus, IconPlusCircle, IconPlusCircleFilled, IconPower, IconProject, IconProjectSettings, IconPull, IconPush, IconPuzzle, IconPython, IconPythonColor, IconQuestionCircle, IconQuestionCircleFilled, IconReact, IconRefresh, IconRegex, IconRelease, IconReleaseFilled, IconRemoteAccess, IconReplace, IconResponsiveness, IconReviewerApproved, IconReviewerAssigned, IconReviewerRejected, IconRuby, IconRubyColor, IconSave, IconSecurityShield, IconSettings, IconSettingsFilled, IconShuffle, IconSiren, IconSkip, IconSkipCircle, IconSkipCircleFilled, IconSlack, IconSlackColor, IconSparkle, IconSparkleFilled, IconSpinnerOnDisabled, IconSpinnerPurple, IconSpinnerPurpleDouble, IconSpinnerWhite, IconStability, IconStack, IconStar, IconStep, IconStop, IconStopwatch, IconTag, IconTasks, IconTeams, IconTeamsColor, IconTemplateCode, IconTerminal, IconTestQuarantine, IconThemeDarkToggle, IconThumbDown, IconThumbUp, IconTools, IconTrash, IconTrigger, IconUbuntu, IconUbuntuColor, IconUnity3D, IconUpload, IconValidateShield, IconVideo, IconWarning, IconWarningYellow, IconWebUi, IconWebhooks, IconWorkflow, IconWorkflowFlow, IconXTwitter, IconXamarin, IconXcode, ResponsiveProvider, bitkitIcon, bitkitTheme as bitriseTheme, createBitkitToast, createTreeCollection, dismissBitkitToast, rem, useBitkitTour, useResponsive, useStepperDialog };
|
|
380
|
+
export { BitkitAccordion_default as BitkitAccordion, BitkitActionBar, BitkitActionMenu_default as BitkitActionMenu, BitkitAlert, BitkitAvatar, BitkitBadge, BitkitBreadcrumb, BitkitBulkActionsRow, BitkitButton, BitkitCalendar, BitkitCheckbox, BitkitCheckboxGroup, BitkitCloseButton, BitkitCodeSnippet, BitkitCollapsible, BitkitColorButton, BitkitCombobox_default as BitkitCombobox, BitkitControlButton, BitkitDataWidget, BitkitDatePicker, BitkitDefinitionTooltip, BitkitDialog_default as BitkitDialog, BitkitDraggableCard, BitkitDrawer, BitkitEmptyState, BitkitExpandableCard, BitkitExpandableRow, BitkitField, BitkitFileInput, BitkitFilterRow, BitkitFormDialog_default as BitkitFormDialog, BitkitGroupHeading, BitkitHeading, BitkitIconButton, BitkitInlineLoading, BitkitLabel, BitkitLabelTooltip, BitkitLabeledData, BitkitLightbox, BitkitLink, BitkitLinkButton, BitkitLinkedRow_default as BitkitLinkedRow, BitkitList_default as BitkitList, BitkitMarkdown, BitkitMarkdownCard, BitkitMultiselect_default as BitkitMultiselect, BitkitMultiselectMenu, BitkitNativeSelect, BitkitNoteCard, BitkitNumberInput, BitkitOverflowContent, BitkitOverflowTooltip, BitkitPageFooter_default as BitkitPageFooter, BitkitPagination, BitkitPaginationLoadMore, BitkitPopover, BitkitProgressBar, BitkitPromoBanner, Provider as BitkitProvider, BitkitRadio, BitkitRadioGroup, BitkitRibbon, BitkitRowActionsCell, BitkitSearchInput, BitkitSectionHeading, BitkitSegmentedControl_default as BitkitSegmentedControl, BitkitSelect_default as BitkitSelect, BitkitSelectMenu, BitkitSelectMenuAction, BitkitSelectableTag_default as BitkitSelectableTag, BitkitSettingsCard_default as BitkitSettingsCard, BitkitSidebar_default as BitkitSidebar, BitkitSkeletonGroup, BitkitSortableColumnHeader, BitkitSpinner, BitkitSplitButton_default as BitkitSplitButton, BitkitStat, BitkitStepperDialog_default as BitkitStepperDialog, BitkitSteps_default as BitkitSteps, BitkitStepsCard_default as BitkitStepsCard, BitkitSwitch, BitkitTabs, BitkitTag, BitkitTagsInput, BitkitTextArea, BitkitTextInput, BitkitToggleButton, BitkitTooltip, BitkitTour, BitkitTreeView, IconAbortCircle, IconAbortCircleFilled, IconAddons, IconAgent, IconAnchor, IconAndroid, IconApp, IconAppSettings, IconAppStore, IconAppStoreColor, IconApple, IconArchive, IconArchiveDelete, IconArchiveRestore, IconArrowBackAndDown, IconArrowBackAndUp, IconArrowDown, IconArrowForwardAndDown, IconArrowForwardAndUp, IconArrowLeft, IconArrowNortheast, IconArrowNorthwest, IconArrowRight, IconArrowUp, IconArrowsHorizontal, IconArrowsVertical, IconAutomation, IconAws, IconAwsColor, IconBadge3RdParty, IconBadgeBitrise, IconBadgeUpgrade, IconBadgeVersionOk, IconBazel, IconBell, IconBitbot, IconBitbotError, IconBitbucket, IconBitbucketColor, IconBitbucketNeutral, IconBitbucketWhite, IconBlockCircle, IconBook, IconBoxArrowDown, IconBoxDot, IconBoxLinesOverflow, IconBoxLinesWrap, IconBranch, IconBrowserstackColor, IconBug, IconBuild, IconBuildCache, IconBuildCacheFilled, IconBuildEnvSetup, IconBuildHub, IconBuildHubFilled, IconCalendar, IconChangePlan, IconChat, IconCheck, IconCheckCircle, IconCheckCircleFilled, IconChevronDown, IconChevronLeft, IconChevronRight, IconChevronUp, IconCi, IconCiFilled, IconCircle, IconCircleDashed, IconCircleHalfFilled, IconClaude, IconClaudeColor, IconClock, IconCode, IconCodePush, IconCodeSigning, IconCoffee, IconCommit, IconConfigure, IconConnectedAccounts, IconContainer, IconCopy, IconCordova, IconCpu, IconCreditcard, IconCredits, IconCross, IconCrossCircle, IconCrossCircleFilled, IconCrown, IconCycle, IconDashboard, IconDashboardFilled, IconDeployment, IconDetails, IconDoc, IconDollar, IconDot, IconDotnet, IconDotnetColor, IconDotnetText, IconDotnetTextColor, IconDoubleCircle, IconDownload, IconDragHandle, IconEc2Ami, IconEnterprise, IconErrorCircle, IconErrorCircleFilled, IconExpand, IconExtraBuildCapacity, IconEye, IconEyeSlash, IconFastlane, IconFileDoc, IconFilePdf, IconFilePlist, IconFileYml, IconFileZip, IconFilter, IconFlag, IconFlutter, IconFolder, IconFullscreen, IconFullscreenExit, IconGauge, IconGit, IconGithub, IconGitlab, IconGitlabColor, IconGitlabWhite, IconGlobe, IconGo, IconGoogleColor, IconGooglePlay, IconGooglePlayColor, IconGradle, IconGroup, IconHashtag, IconHeadset, IconHeart, IconHistory, IconHourglass, IconImage, IconInfoCircle, IconInfoCircleFilled, IconInsights, IconInsightsFilled, IconInstall, IconInteraction, IconInvoice, IconIonic, IconJapanese, IconJava, IconJavaColor, IconJavaDuke, IconJavaDukeColor, IconKey, IconKotlin, IconKotlinColor, IconKotlinWhite, IconLaptop, IconLaunchdarkly, IconLegacyApp, IconLightbulb, IconLink, IconLinux, IconLock, IconLockOpen, IconLogin, IconLogout, IconMacos, IconMagicWand, IconMagnifier, IconMail, IconMedal, IconMemory, IconMenuGrid, IconMenuHamburger, IconMessage, IconMessageAlert, IconMessageQuestion, IconMicrophone, IconMinus, IconMinusCircle, IconMinusCircleFilled, IconMobile, IconMobileLandscape, IconMonitorChart, IconMoreHorizontal, IconMoreVertical, IconNews, IconNextjs, IconNodejs, IconOpenInNew, IconOther, IconOutsideContributor, IconOverview, IconPause, IconPencil, IconPeople, IconPercent, IconPerson, IconPersonWithDesk, IconPlay, IconPlus, IconPlusCircle, IconPlusCircleFilled, IconPower, IconProject, IconProjectSettings, IconPull, IconPush, IconPuzzle, IconPython, IconPythonColor, IconQuestionCircle, IconQuestionCircleFilled, IconReact, IconRefresh, IconRegex, IconRelease, IconReleaseFilled, IconRemoteAccess, IconReplace, IconResponsiveness, IconReviewerApproved, IconReviewerAssigned, IconReviewerRejected, IconRuby, IconRubyColor, IconSave, IconSecurityShield, IconSettings, IconSettingsFilled, IconShuffle, IconSiren, IconSkip, IconSkipCircle, IconSkipCircleFilled, IconSlack, IconSlackColor, IconSparkle, IconSparkleFilled, IconSpinnerOnDisabled, IconSpinnerPurple, IconSpinnerPurpleDouble, IconSpinnerWhite, IconStability, IconStack, IconStar, IconStep, IconStop, IconStopwatch, IconTag, IconTasks, IconTeams, IconTeamsColor, IconTemplateCode, IconTerminal, IconTestQuarantine, IconThemeDarkToggle, IconThumbDown, IconThumbUp, IconTools, IconTrash, IconTrigger, IconUbuntu, IconUbuntuColor, IconUnity3D, IconUpload, IconValidateShield, IconVideo, IconWarning, IconWarningYellow, IconWebUi, IconWebhooks, IconWorkflow, IconWorkflowFlow, IconXTwitter, IconXamarin, IconXcode, ResponsiveProvider, bitkitIcon, bitkitTheme as bitriseTheme, createBitkitToast, createTreeCollection, dismissBitkitToast, rem, useBitkitTour, useResponsive, useStepperDialog };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
declare const expandableCardSlotRecipe: import('@chakra-ui/react').SlotRecipeDefinition<"header" | "title" | "icon" | "suffix" | "collapsible" | "root" | "description" | "subtitle", {
|
|
1
|
+
declare const expandableCardSlotRecipe: import('@chakra-ui/react').SlotRecipeDefinition<"footer" | "header" | "title" | "icon" | "suffix" | "collapsible" | "root" | "description" | "subtitle", {
|
|
2
2
|
size: {
|
|
3
3
|
md: {
|
|
4
4
|
header: {
|
|
@@ -4,7 +4,7 @@ import { cardAnatomy } from "@chakra-ui/react/anatomy";
|
|
|
4
4
|
var expandableCardSlotRecipe = defineSlotRecipe({
|
|
5
5
|
className: "expandable-card",
|
|
6
6
|
slots: [
|
|
7
|
-
...cardAnatomy.omit("body"
|
|
7
|
+
...cardAnatomy.omit("body").keys(),
|
|
8
8
|
"collapsible",
|
|
9
9
|
"icon",
|
|
10
10
|
"subtitle",
|
|
@@ -25,7 +25,11 @@ var expandableCardSlotRecipe = defineSlotRecipe({
|
|
|
25
25
|
"&:active": { backgroundColor: "background/active" },
|
|
26
26
|
"&:hover:not(:active)": { backgroundColor: "background/hover" },
|
|
27
27
|
_hover: { color: "text/primary" },
|
|
28
|
-
_open: {
|
|
28
|
+
_open: {
|
|
29
|
+
backgroundColor: "background/secondary",
|
|
30
|
+
borderBottom: "1px solid",
|
|
31
|
+
borderBottomColor: "border/minimal"
|
|
32
|
+
}
|
|
29
33
|
},
|
|
30
34
|
collapsible: {
|
|
31
35
|
overflow: "hidden",
|
|
@@ -38,7 +42,16 @@ var expandableCardSlotRecipe = defineSlotRecipe({
|
|
|
38
42
|
animationDuration: "moderate"
|
|
39
43
|
}
|
|
40
44
|
},
|
|
41
|
-
|
|
45
|
+
footer: {
|
|
46
|
+
alignItems: "center",
|
|
47
|
+
display: "flex",
|
|
48
|
+
minHeight: "40"
|
|
49
|
+
},
|
|
50
|
+
icon: {
|
|
51
|
+
alignItems: "center",
|
|
52
|
+
color: "icon/secondary",
|
|
53
|
+
display: "flex"
|
|
54
|
+
},
|
|
42
55
|
subtitle: { color: "text/secondary" },
|
|
43
56
|
suffix: {
|
|
44
57
|
color: "text/secondary",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExpandableCard.recipe.js","names":[],"sources":["../../../lib/theme/slot-recipes/ExpandableCard.recipe.ts"],"sourcesContent":["import { cardAnatomy } from '@chakra-ui/react/anatomy';\nimport { defineSlotRecipe } from '@chakra-ui/react/styled-system';\n\nconst expandableCardSlotRecipe = defineSlotRecipe({\n className: 'expandable-card',\n slots: [...cardAnatomy.omit('body'
|
|
1
|
+
{"version":3,"file":"ExpandableCard.recipe.js","names":[],"sources":["../../../lib/theme/slot-recipes/ExpandableCard.recipe.ts"],"sourcesContent":["import { cardAnatomy } from '@chakra-ui/react/anatomy';\nimport { defineSlotRecipe } from '@chakra-ui/react/styled-system';\n\nconst expandableCardSlotRecipe = defineSlotRecipe({\n className: 'expandable-card',\n slots: [...cardAnatomy.omit('body').keys(), 'collapsible', 'icon', 'subtitle', 'suffix'],\n base: {\n root: {\n backgroundColor: 'background/primary',\n overflow: 'hidden',\n },\n header: {\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'space-between',\n cursor: 'pointer',\n width: '100%',\n color: 'text/primary',\n '&:active': {\n backgroundColor: 'background/active',\n },\n '&:hover:not(:active)': {\n backgroundColor: 'background/hover',\n },\n _hover: {\n color: 'text/primary',\n },\n _open: {\n backgroundColor: 'background/secondary',\n // Figma draws this stroke inside the 48px header, so as a real border the open header\n // is 49px. Swap for `boxShadow: 'inset 0 -1px 0 {colors.border/minimal}'` if exact\n // 48px parity is ever needed.\n borderBottom: '1px solid',\n borderBottomColor: 'border/minimal',\n },\n },\n collapsible: {\n overflow: 'hidden',\n _open: {\n animationName: 'expand-height, fade-in',\n animationDuration: 'moderate',\n },\n _closed: {\n animationName: 'collapse-height, fade-out',\n animationDuration: 'moderate',\n },\n },\n // Figma's footer content slot is 24px tall in both sizes; with Card's `sm` block\n // padding (8/8) that makes the 40px footer shown in the design.\n footer: {\n alignItems: 'center',\n display: 'flex',\n minHeight: '40',\n },\n // Flex, not the default block: an inline-block svg in a block box picks up the line box's\n // extra leading, which made an lg header with an icon 57.5px instead of Figma's 56px.\n icon: {\n alignItems: 'center',\n color: 'icon/secondary',\n display: 'flex',\n },\n subtitle: {\n color: 'text/secondary',\n },\n suffix: {\n color: 'text/secondary',\n mx: '16',\n textStyle: 'body/md/regular',\n },\n },\n variants: {\n size: {\n md: {\n header: { textStyle: 'body/md/regular', paddingX: '16', paddingY: '12' },\n subtitle: { textStyle: 'body/sm/regular' },\n },\n lg: {\n header: { textStyle: 'body/lg/regular', padding: '16' },\n subtitle: { textStyle: 'body/md/regular' },\n },\n },\n },\n defaultVariants: {\n size: 'lg',\n },\n});\n\nexport default expandableCardSlotRecipe;\n"],"mappings":";;;AAGA,IAAM,2BAA2B,iBAAiB;CAChD,WAAW;CACX,OAAO;EAAC,GAAG,YAAY,KAAK,MAAM,CAAC,CAAC,KAAK;EAAG;EAAe;EAAQ;EAAY;CAAQ;CACvF,MAAM;EACJ,MAAM;GACJ,iBAAiB;GACjB,UAAU;EACZ;EACA,QAAQ;GACN,SAAS;GACT,YAAY;GACZ,gBAAgB;GAChB,QAAQ;GACR,OAAO;GACP,OAAO;GACP,YAAY,EACV,iBAAiB,oBACnB;GACA,wBAAwB,EACtB,iBAAiB,mBACnB;GACA,QAAQ,EACN,OAAO,eACT;GACA,OAAO;IACL,iBAAiB;IAIjB,cAAc;IACd,mBAAmB;GACrB;EACF;EACA,aAAa;GACX,UAAU;GACV,OAAO;IACL,eAAe;IACf,mBAAmB;GACrB;GACA,SAAS;IACP,eAAe;IACf,mBAAmB;GACrB;EACF;EAGA,QAAQ;GACN,YAAY;GACZ,SAAS;GACT,WAAW;EACb;EAGA,MAAM;GACJ,YAAY;GACZ,OAAO;GACP,SAAS;EACX;EACA,UAAU,EACR,OAAO,iBACT;EACA,QAAQ;GACN,OAAO;GACP,IAAI;GACJ,WAAW;EACb;CACF;CACA,UAAU,EACR,MAAM;EACJ,IAAI;GACF,QAAQ;IAAE,WAAW;IAAmB,UAAU;IAAM,UAAU;GAAK;GACvE,UAAU,EAAE,WAAW,kBAAkB;EAC3C;EACA,IAAI;GACF,QAAQ;IAAE,WAAW;IAAmB,SAAS;GAAK;GACtD,UAAU,EAAE,WAAW,kBAAkB;EAC3C;CACF,EACF;CACA,iBAAiB,EACf,MAAM,KACR;AACF,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
declare const tableSlotRecipe: import('@chakra-ui/react').SlotRecipeDefinition<"body" | "caption" | "footer" | "header" | "cell" | "row" | "root" | "expandedContent" | "expandableRow" | "expandedRow" | "expandCell" | "expandedCell" | "expandTrigger" | "sortColumnHeader" | "sortTrigger" | "columnHeader", {
|
|
1
|
+
declare const tableSlotRecipe: import('@chakra-ui/react').SlotRecipeDefinition<"body" | "caption" | "footer" | "header" | "cell" | "row" | "root" | "utilityCell" | "bulkActionsGroup" | "bulkActionsButtons" | "expandedContent" | "expandableRow" | "expandedRow" | "expandCell" | "expandedCell" | "expandTrigger" | "filterControls" | "linkedRow" | "rowLink" | "actionsCell" | "actionsGroup" | "sortColumnHeader" | "sortTrigger" | "columnHeader", {
|
|
2
2
|
variant: {
|
|
3
3
|
default: {
|
|
4
4
|
root: {
|
|
@@ -7,14 +7,22 @@ var tableSlotRecipe = defineSlotRecipe({
|
|
|
7
7
|
className: "table",
|
|
8
8
|
slots: [
|
|
9
9
|
...tableAnatomy.keys(),
|
|
10
|
+
"actionsCell",
|
|
11
|
+
"actionsGroup",
|
|
12
|
+
"bulkActionsGroup",
|
|
13
|
+
"bulkActionsButtons",
|
|
10
14
|
"expandCell",
|
|
11
15
|
"expandTrigger",
|
|
12
16
|
"expandableRow",
|
|
13
17
|
"expandedCell",
|
|
14
18
|
"expandedContent",
|
|
15
19
|
"expandedRow",
|
|
20
|
+
"filterControls",
|
|
21
|
+
"linkedRow",
|
|
22
|
+
"rowLink",
|
|
16
23
|
"sortColumnHeader",
|
|
17
|
-
"sortTrigger"
|
|
24
|
+
"sortTrigger",
|
|
25
|
+
"utilityCell"
|
|
18
26
|
],
|
|
19
27
|
base: {
|
|
20
28
|
root: {
|
|
@@ -31,6 +39,28 @@ var tableSlotRecipe = defineSlotRecipe({
|
|
|
31
39
|
color: "text/body",
|
|
32
40
|
textStyle: "body/md/regular"
|
|
33
41
|
},
|
|
42
|
+
actionsCell: {
|
|
43
|
+
textAlign: "end",
|
|
44
|
+
whiteSpace: "nowrap",
|
|
45
|
+
width: "1%"
|
|
46
|
+
},
|
|
47
|
+
actionsGroup: {
|
|
48
|
+
alignItems: "center",
|
|
49
|
+
display: "inline-flex",
|
|
50
|
+
gap: "8",
|
|
51
|
+
position: "relative"
|
|
52
|
+
},
|
|
53
|
+
bulkActionsGroup: {
|
|
54
|
+
alignItems: "center",
|
|
55
|
+
display: "flex",
|
|
56
|
+
gap: "12"
|
|
57
|
+
},
|
|
58
|
+
bulkActionsButtons: {
|
|
59
|
+
alignItems: "center",
|
|
60
|
+
display: "flex",
|
|
61
|
+
gap: "12",
|
|
62
|
+
marginInlineStart: "auto"
|
|
63
|
+
},
|
|
34
64
|
expandCell: {
|
|
35
65
|
paddingBlock: 0,
|
|
36
66
|
paddingInline: 0,
|
|
@@ -67,6 +97,37 @@ var tableSlotRecipe = defineSlotRecipe({
|
|
|
67
97
|
paddingInlineStart: "12"
|
|
68
98
|
},
|
|
69
99
|
expandedRow: { _hover: { background: "none" } },
|
|
100
|
+
filterControls: {
|
|
101
|
+
alignItems: "center",
|
|
102
|
+
display: "flex",
|
|
103
|
+
flexWrap: "wrap",
|
|
104
|
+
gap: "16",
|
|
105
|
+
width: "full"
|
|
106
|
+
},
|
|
107
|
+
linkedRow: {
|
|
108
|
+
position: "relative",
|
|
109
|
+
_hover: { backgroundColor: "background/secondary" },
|
|
110
|
+
"& :where(a:not([data-row-link]), button, input, label, select)": {
|
|
111
|
+
position: "relative",
|
|
112
|
+
zIndex: "1"
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
rowLink: {
|
|
116
|
+
textDecoration: "none",
|
|
117
|
+
_hover: { textDecoration: "none" },
|
|
118
|
+
_after: {
|
|
119
|
+
content: "\"\"",
|
|
120
|
+
inset: 0,
|
|
121
|
+
position: "absolute"
|
|
122
|
+
},
|
|
123
|
+
_focusVisible: {
|
|
124
|
+
outline: "none",
|
|
125
|
+
_after: {
|
|
126
|
+
outline: "var(--focus-ring-width) var(--focus-ring-style) var(--focus-ring-color)",
|
|
127
|
+
outlineOffset: "calc(var(--focus-ring-width) * -1)"
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
},
|
|
70
131
|
sortColumnHeader: {
|
|
71
132
|
paddingBlock: 0,
|
|
72
133
|
paddingInline: 0
|
|
@@ -88,6 +149,11 @@ var tableSlotRecipe = defineSlotRecipe({
|
|
|
88
149
|
width: "full",
|
|
89
150
|
_focusVisible: { outlineOffset: "-3px" },
|
|
90
151
|
_hover: { backgroundColor: "background/active" }
|
|
152
|
+
},
|
|
153
|
+
utilityCell: {
|
|
154
|
+
height: "auto",
|
|
155
|
+
paddingBlock: "12",
|
|
156
|
+
paddingInline: "16"
|
|
91
157
|
}
|
|
92
158
|
},
|
|
93
159
|
variants: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Table.recipe.js","names":[],"sources":["../../../lib/theme/slot-recipes/Table.recipe.ts"],"sourcesContent":["import { tableAnatomy } from '@chakra-ui/react/anatomy';\nimport { defineSlotRecipe } from '@chakra-ui/react/styled-system';\n\nimport { rem } from '../themeUtils';\n\n// A control like a checkbox renders as an inline-flex <label>, which sits on the line box's\n// baseline — so the text strut's descender space leaves it a pixel or two above the row's centre.\n// Making it block-level takes the line box out of the equation and lets vertical-align: middle\n// centre it exactly.\nconst controlOnlyCell = {\n '& > :where(label):only-child': {\n display: 'flex',\n },\n};\n\nconst tableSlotRecipe = defineSlotRecipe({\n className: 'table',\n slots: [\n ...tableAnatomy.keys(),\n 'expandCell',\n 'expandTrigger',\n 'expandableRow',\n 'expandedCell',\n 'expandedContent',\n 'expandedRow',\n 'sortColumnHeader',\n 'sortTrigger',\n ],\n base: {\n root: {\n fontVariantNumeric: 'lining-nums tabular-nums',\n textAlign: 'start',\n width: 'full',\n },\n caption: {\n captionSide: 'top !important',\n textAlign: 'start',\n '& > * + *': {\n marginBlockStart: '4',\n },\n },\n cell: {\n color: 'text/body',\n textStyle: 'body/md/regular',\n },\n expandCell: {\n paddingBlock: 0,\n paddingInline: 0,\n verticalAlign: 'middle',\n width: '48',\n },\n // A fixed 32x32 box (per the design), centred in the cell by the cell's own vertical-align.\n // Deriving the size from padding instead leaves it at the mercy of the Collapsible recipe's\n // asymmetric paddingBlockStart, which is what pushed the chevron 2px above the row's centre.\n expandTrigger: {\n alignItems: 'center',\n background: 'none',\n border: 'none',\n cursor: 'pointer',\n display: 'flex',\n height: '32',\n justifyContent: 'center',\n marginInlineStart: '12',\n padding: 0,\n width: '32',\n },\n expandableRow: {\n '& > td': {\n borderBottomWidth: 0,\n },\n },\n expandedCell: {\n height: 0,\n paddingBlock: 0,\n paddingInline: 0,\n },\n expandedContent: {\n borderBlockStartColor: 'border/minimal',\n borderBlockStartStyle: 'solid',\n borderBlockStartWidth: '1',\n marginInlineEnd: '16',\n marginInlineStart: '48',\n paddingBlockEnd: '24',\n paddingBlockStart: '16',\n paddingInlineEnd: '16',\n paddingInlineStart: '12',\n },\n expandedRow: {\n _hover: {\n background: 'none',\n },\n },\n sortColumnHeader: {\n paddingBlock: 0,\n paddingInline: 0,\n },\n sortTrigger: {\n alignItems: 'center',\n appearance: 'none',\n background: 'none',\n border: 'none',\n color: 'inherit',\n cursor: 'pointer',\n display: 'flex',\n font: 'inherit',\n gap: '8',\n height: 'full',\n paddingBlock: '12',\n paddingInline: '16',\n userSelect: 'none',\n width: 'full',\n _focusVisible: {\n outlineOffset: '-3px',\n },\n _hover: {\n backgroundColor: 'background/active',\n },\n },\n },\n variants: {\n variant: {\n default: {\n root: {\n borderColor: 'border/regular',\n borderRadius: '4',\n borderStyle: 'solid',\n borderWidth: '1',\n overflow: 'hidden',\n },\n header: {\n '& :where(th)': {\n backgroundColor: 'background/tertiary',\n },\n },\n columnHeader: {\n borderBottomColor: 'border/minimal',\n paddingBlock: '12',\n paddingInline: '16',\n },\n cell: {\n borderBottomColor: 'border/minimal',\n borderTopColor: 'border/minimal',\n paddingInline: '16',\n },\n footer: {\n borderTopColor: 'border/minimal',\n },\n },\n borderless: {\n columnHeader: {\n borderBottomColor: 'border/regular',\n padding: '12',\n },\n cell: {\n borderBottomColor: 'border/regular',\n borderTopColor: 'border/regular',\n paddingInline: '12',\n },\n footer: {\n borderTopColor: 'border/regular',\n },\n },\n },\n size: {\n sm: {\n cell: {\n height: '48',\n },\n },\n md: {\n cell: {\n height: rem(56),\n },\n },\n lg: {\n cell: {\n height: '64',\n },\n },\n },\n // Hovering a row tints it. Usually a reading aid on a long or wide table rather than a hint\n // that the row is clickable, so it says nothing about the row being interactive — turn it off\n // for short, static tables where there is no place to lose.\n rowHover: {\n true: {},\n false: {},\n },\n layout: {\n table: {\n root: {\n borderCollapse: 'separate',\n borderSpacing: '0',\n },\n caption: {\n marginBlockEnd: '24',\n },\n columnHeader: {\n borderBottomStyle: 'solid',\n borderBottomWidth: '1',\n color: 'text/primary',\n fontWeight: 'bold',\n textAlign: 'start',\n textStyle: 'heading/h5',\n verticalAlign: 'middle',\n ...controlOnlyCell,\n },\n cell: {\n borderBottomStyle: 'solid',\n borderBottomWidth: '1',\n verticalAlign: 'middle',\n ...controlOnlyCell,\n // border-collapse: separate ignores borders on tfoot itself (CSS 2.1 §17.6.1),\n // so the body/footer divider has to live on the footer's cells.\n 'tfoot &': {\n borderBottomWidth: 0,\n borderTopStyle: 'solid',\n borderTopWidth: '1',\n },\n },\n body: {\n '& :where(tr)': {\n '&:has(input:checked), &[data-selected]': {\n backgroundColor: 'background/selected',\n _hover: {\n backgroundColor: 'background/selected',\n },\n },\n },\n '& :where(tr:last-child) td': {\n borderBottomWidth: 0,\n },\n },\n },\n stacked: {\n root: {\n display: 'block',\n },\n caption: {\n display: 'block',\n padding: '16',\n backgroundColor: 'background/secondary',\n borderBottomColor: 'border/minimal',\n borderBottomStyle: 'solid',\n borderBottomWidth: '1',\n },\n header: {\n borderWidth: 0,\n clip: 'rect(0, 0, 0, 0)',\n height: '1',\n margin: '-1px',\n overflow: 'hidden',\n padding: 0,\n position: 'absolute',\n whiteSpace: 'nowrap',\n width: '1',\n },\n body: {\n display: 'block',\n },\n row: {\n borderBottomColor: 'border/minimal',\n borderBottomStyle: 'solid',\n borderBottomWidth: '1',\n display: 'block',\n paddingBlock: '12',\n '&:last-child': {\n borderBottomWidth: 0,\n },\n },\n cell: {\n alignItems: 'center',\n display: 'flex',\n minHeight: '48',\n paddingInline: '16',\n _before: {\n alignSelf: 'center',\n color: 'text/primary',\n content: 'attr(data-label)',\n flexShrink: 0,\n fontWeight: 'semibold',\n marginInlineEnd: '16',\n width: '96',\n },\n 'tfoot &': {\n display: 'block',\n paddingInline: 0,\n _before: {\n content: 'none',\n },\n },\n },\n // display: block takes tfoot out of the table model, so a border on it does render here\n footer: {\n borderTopStyle: 'solid',\n borderTopWidth: '1',\n display: 'block',\n },\n },\n },\n },\n compoundVariants: [\n {\n css: {\n row: {\n borderBottomColor: 'border/regular',\n },\n },\n layout: 'stacked',\n variant: 'borderless',\n },\n // The `size` variant pins a fixed cell height (48/56/64px), and it is merged after `layout`\n // regardless of declaration order — so only a compound variant can release it. Stacked cells\n // are flex containers whose content (label gutter + a multi-line value) routinely needs more\n // room than the fixed height, and the stacked `cell` keeps `minHeight: 48` as the floor.\n {\n css: {\n cell: {\n height: 'auto',\n },\n },\n layout: 'stacked',\n },\n // Scoped to `layout: table` because that is where the hover lived before: the stacked layout\n // renders rows as blocks and never tinted them.\n {\n css: {\n body: {\n '& :where(tr)': {\n _hover: {\n backgroundColor: 'background/secondary',\n },\n },\n },\n },\n layout: 'table',\n rowHover: true,\n },\n ],\n defaultVariants: {\n layout: 'table',\n rowHover: true,\n size: 'lg',\n variant: 'default',\n },\n});\n\nexport default tableSlotRecipe;\n"],"mappings":"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"}
|
|
1
|
+
{"version":3,"file":"Table.recipe.js","names":[],"sources":["../../../lib/theme/slot-recipes/Table.recipe.ts"],"sourcesContent":["import { tableAnatomy } from '@chakra-ui/react/anatomy';\nimport { defineSlotRecipe } from '@chakra-ui/react/styled-system';\n\nimport { rem } from '../themeUtils';\n\n// A control like a checkbox renders as an inline-flex <label>, which sits on the line box's\n// baseline — so the text strut's descender space leaves it a pixel or two above the row's centre.\n// Making it block-level takes the line box out of the equation and lets vertical-align: middle\n// centre it exactly.\nconst controlOnlyCell = {\n '& > :where(label):only-child': {\n display: 'flex',\n },\n};\n\nconst tableSlotRecipe = defineSlotRecipe({\n className: 'table',\n slots: [\n ...tableAnatomy.keys(),\n 'actionsCell',\n 'actionsGroup',\n 'bulkActionsGroup',\n 'bulkActionsButtons',\n 'expandCell',\n 'expandTrigger',\n 'expandableRow',\n 'expandedCell',\n 'expandedContent',\n 'expandedRow',\n 'filterControls',\n 'linkedRow',\n 'rowLink',\n 'sortColumnHeader',\n 'sortTrigger',\n 'utilityCell',\n ],\n base: {\n root: {\n fontVariantNumeric: 'lining-nums tabular-nums',\n textAlign: 'start',\n width: 'full',\n },\n caption: {\n captionSide: 'top !important',\n textAlign: 'start',\n '& > * + *': {\n marginBlockStart: '4',\n },\n },\n cell: {\n color: 'text/body',\n textStyle: 'body/md/regular',\n },\n actionsCell: {\n textAlign: 'end',\n whiteSpace: 'nowrap',\n // Shrink-to-fit: a table cell can't go below its content width, so any value under the\n // content's own width collapses the column around the buttons and leaves the rest to\n // the data columns.\n width: '1%',\n },\n actionsGroup: {\n alignItems: 'center',\n display: 'inline-flex',\n gap: '8',\n position: 'relative',\n },\n bulkActionsGroup: {\n alignItems: 'center',\n display: 'flex',\n gap: '12',\n },\n bulkActionsButtons: {\n alignItems: 'center',\n display: 'flex',\n gap: '12',\n marginInlineStart: 'auto',\n },\n expandCell: {\n paddingBlock: 0,\n paddingInline: 0,\n verticalAlign: 'middle',\n width: '48',\n },\n // A fixed 32x32 box (per the design), centred in the cell by the cell's own vertical-align.\n // Deriving the size from padding instead leaves it at the mercy of the Collapsible recipe's\n // asymmetric paddingBlockStart, which is what pushed the chevron 2px above the row's centre.\n expandTrigger: {\n alignItems: 'center',\n background: 'none',\n border: 'none',\n cursor: 'pointer',\n display: 'flex',\n height: '32',\n justifyContent: 'center',\n marginInlineStart: '12',\n padding: 0,\n width: '32',\n },\n expandableRow: {\n '& > td': {\n borderBottomWidth: 0,\n },\n },\n expandedCell: {\n height: 0,\n paddingBlock: 0,\n paddingInline: 0,\n },\n expandedContent: {\n borderBlockStartColor: 'border/minimal',\n borderBlockStartStyle: 'solid',\n borderBlockStartWidth: '1',\n marginInlineEnd: '16',\n marginInlineStart: '48',\n paddingBlockEnd: '24',\n paddingBlockStart: '16',\n paddingInlineEnd: '16',\n paddingInlineStart: '12',\n },\n expandedRow: {\n _hover: {\n background: 'none',\n },\n },\n filterControls: {\n alignItems: 'center',\n display: 'flex',\n flexWrap: 'wrap',\n gap: '16',\n width: 'full',\n },\n linkedRow: {\n position: 'relative',\n _hover: {\n backgroundColor: 'background/secondary',\n },\n '& :where(a:not([data-row-link]), button, input, label, select)': {\n position: 'relative',\n zIndex: '1',\n },\n },\n rowLink: {\n textDecoration: 'none',\n // The row's own background change is the hover affordance; the link recipe's hover\n // underline would fire on every row hover, since the stretched pseudo covers the row.\n _hover: {\n textDecoration: 'none',\n },\n _after: {\n content: '\"\"',\n inset: 0,\n position: 'absolute',\n },\n _focusVisible: {\n outline: 'none',\n _after: {\n outline: 'var(--focus-ring-width) var(--focus-ring-style) var(--focus-ring-color)',\n outlineOffset: 'calc(var(--focus-ring-width) * -1)',\n },\n },\n },\n sortColumnHeader: {\n paddingBlock: 0,\n paddingInline: 0,\n },\n sortTrigger: {\n alignItems: 'center',\n appearance: 'none',\n background: 'none',\n border: 'none',\n color: 'inherit',\n cursor: 'pointer',\n display: 'flex',\n font: 'inherit',\n gap: '8',\n height: 'full',\n paddingBlock: '12',\n paddingInline: '16',\n userSelect: 'none',\n width: 'full',\n _focusVisible: {\n outlineOffset: '-3px',\n },\n _hover: {\n backgroundColor: 'background/active',\n },\n },\n utilityCell: {\n height: 'auto',\n paddingBlock: '12',\n paddingInline: '16',\n },\n },\n variants: {\n variant: {\n default: {\n root: {\n borderColor: 'border/regular',\n borderRadius: '4',\n borderStyle: 'solid',\n borderWidth: '1',\n overflow: 'hidden',\n },\n header: {\n '& :where(th)': {\n backgroundColor: 'background/tertiary',\n },\n },\n columnHeader: {\n borderBottomColor: 'border/minimal',\n paddingBlock: '12',\n paddingInline: '16',\n },\n cell: {\n borderBottomColor: 'border/minimal',\n borderTopColor: 'border/minimal',\n paddingInline: '16',\n },\n footer: {\n borderTopColor: 'border/minimal',\n },\n },\n borderless: {\n columnHeader: {\n borderBottomColor: 'border/regular',\n padding: '12',\n },\n cell: {\n borderBottomColor: 'border/regular',\n borderTopColor: 'border/regular',\n paddingInline: '12',\n },\n footer: {\n borderTopColor: 'border/regular',\n },\n },\n },\n size: {\n sm: {\n cell: {\n height: '48',\n },\n },\n md: {\n cell: {\n height: rem(56),\n },\n },\n lg: {\n cell: {\n height: '64',\n },\n },\n },\n // Hovering a row tints it. Usually a reading aid on a long or wide table rather than a hint\n // that the row is clickable, so it says nothing about the row being interactive — turn it off\n // for short, static tables where there is no place to lose.\n rowHover: {\n true: {},\n false: {},\n },\n layout: {\n table: {\n root: {\n borderCollapse: 'separate',\n borderSpacing: '0',\n },\n caption: {\n marginBlockEnd: '24',\n },\n columnHeader: {\n borderBottomStyle: 'solid',\n borderBottomWidth: '1',\n color: 'text/primary',\n fontWeight: 'bold',\n textAlign: 'start',\n textStyle: 'heading/h5',\n verticalAlign: 'middle',\n ...controlOnlyCell,\n },\n cell: {\n borderBottomStyle: 'solid',\n borderBottomWidth: '1',\n verticalAlign: 'middle',\n ...controlOnlyCell,\n // border-collapse: separate ignores borders on tfoot itself (CSS 2.1 §17.6.1),\n // so the body/footer divider has to live on the footer's cells.\n 'tfoot &': {\n borderBottomWidth: 0,\n borderTopStyle: 'solid',\n borderTopWidth: '1',\n },\n },\n body: {\n '& :where(tr)': {\n '&:has(input:checked), &[data-selected]': {\n backgroundColor: 'background/selected',\n _hover: {\n backgroundColor: 'background/selected',\n },\n },\n },\n '& :where(tr:last-child) td': {\n borderBottomWidth: 0,\n },\n },\n },\n stacked: {\n root: {\n display: 'block',\n },\n caption: {\n display: 'block',\n padding: '16',\n backgroundColor: 'background/secondary',\n borderBottomColor: 'border/minimal',\n borderBottomStyle: 'solid',\n borderBottomWidth: '1',\n },\n header: {\n borderWidth: 0,\n clip: 'rect(0, 0, 0, 0)',\n height: '1',\n margin: '-1px',\n overflow: 'hidden',\n padding: 0,\n position: 'absolute',\n whiteSpace: 'nowrap',\n width: '1',\n },\n body: {\n display: 'block',\n },\n row: {\n borderBottomColor: 'border/minimal',\n borderBottomStyle: 'solid',\n borderBottomWidth: '1',\n display: 'block',\n paddingBlock: '12',\n '&:last-child': {\n borderBottomWidth: 0,\n },\n },\n cell: {\n alignItems: 'center',\n display: 'flex',\n minHeight: '48',\n paddingInline: '16',\n _before: {\n alignSelf: 'center',\n color: 'text/primary',\n content: 'attr(data-label)',\n flexShrink: 0,\n fontWeight: 'semibold',\n marginInlineEnd: '16',\n width: '96',\n },\n 'tfoot &': {\n display: 'block',\n paddingInline: 0,\n _before: {\n content: 'none',\n },\n },\n },\n // display: block takes tfoot out of the table model, so a border on it does render here\n footer: {\n borderTopStyle: 'solid',\n borderTopWidth: '1',\n display: 'block',\n },\n },\n },\n },\n compoundVariants: [\n {\n css: {\n row: {\n borderBottomColor: 'border/regular',\n },\n },\n layout: 'stacked',\n variant: 'borderless',\n },\n // The `size` variant pins a fixed cell height (48/56/64px), and it is merged after `layout`\n // regardless of declaration order — so only a compound variant can release it. Stacked cells\n // are flex containers whose content (label gutter + a multi-line value) routinely needs more\n // room than the fixed height, and the stacked `cell` keeps `minHeight: 48` as the floor.\n {\n css: {\n cell: {\n height: 'auto',\n },\n },\n layout: 'stacked',\n },\n // Scoped to `layout: table` because that is where the hover lived before: the stacked layout\n // renders rows as blocks and never tinted them.\n {\n css: {\n body: {\n '& :where(tr)': {\n _hover: {\n backgroundColor: 'background/secondary',\n },\n },\n },\n },\n layout: 'table',\n rowHover: true,\n },\n ],\n defaultVariants: {\n layout: 'table',\n rowHover: true,\n size: 'lg',\n variant: 'default',\n },\n});\n\nexport default tableSlotRecipe;\n"],"mappings":"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"}
|
|
@@ -941,7 +941,7 @@ declare const slotRecipes: {
|
|
|
941
941
|
};
|
|
942
942
|
};
|
|
943
943
|
}>;
|
|
944
|
-
expandableCard: import('@chakra-ui/react').SlotRecipeDefinition<"header" | "title" | "icon" | "suffix" | "collapsible" | "root" | "description" | "subtitle", {
|
|
944
|
+
expandableCard: import('@chakra-ui/react').SlotRecipeDefinition<"footer" | "header" | "title" | "icon" | "suffix" | "collapsible" | "root" | "description" | "subtitle", {
|
|
945
945
|
size: {
|
|
946
946
|
md: {
|
|
947
947
|
header: {
|
|
@@ -2112,7 +2112,7 @@ declare const slotRecipes: {
|
|
|
2112
2112
|
};
|
|
2113
2113
|
};
|
|
2114
2114
|
}>;
|
|
2115
|
-
table: import('@chakra-ui/react').SlotRecipeDefinition<"body" | "caption" | "footer" | "header" | "cell" | "row" | "root" | "expandedContent" | "expandableRow" | "expandedRow" | "expandCell" | "expandedCell" | "expandTrigger" | "sortColumnHeader" | "sortTrigger" | "columnHeader", {
|
|
2115
|
+
table: import('@chakra-ui/react').SlotRecipeDefinition<"body" | "caption" | "footer" | "header" | "cell" | "row" | "root" | "utilityCell" | "bulkActionsGroup" | "bulkActionsButtons" | "expandedContent" | "expandableRow" | "expandedRow" | "expandCell" | "expandedCell" | "expandTrigger" | "filterControls" | "linkedRow" | "rowLink" | "actionsCell" | "actionsGroup" | "sortColumnHeader" | "sortTrigger" | "columnHeader", {
|
|
2116
2116
|
variant: {
|
|
2117
2117
|
default: {
|
|
2118
2118
|
root: {
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Fills `{key}` placeholders in a template from `values`. Substitution is single-pass, so braces
|
|
3
|
+
* that arrive inside a value are left alone instead of being substituted again — which also makes
|
|
4
|
+
* the result independent of the key order. A placeholder with no matching key stays as it is.
|
|
5
|
+
*/
|
|
6
|
+
declare const formatLabel: (template: string, values: Record<string, string | number>) => string;
|
|
7
|
+
export default formatLabel;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
//#region lib/utilities/formatLabel.ts
|
|
2
|
+
/**
|
|
3
|
+
* Fills `{key}` placeholders in a template from `values`. Substitution is single-pass, so braces
|
|
4
|
+
* that arrive inside a value are left alone instead of being substituted again — which also makes
|
|
5
|
+
* the result independent of the key order. A placeholder with no matching key stays as it is.
|
|
6
|
+
*/
|
|
7
|
+
var formatLabel = (template, values) => template.replace(/\{(\w+)\}/g, (placeholder, key) => Object.hasOwn(values, key) ? String(values[key]) : placeholder);
|
|
8
|
+
//#endregion
|
|
9
|
+
export { formatLabel as default };
|
|
10
|
+
|
|
11
|
+
//# sourceMappingURL=formatLabel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formatLabel.js","names":[],"sources":["../../lib/utilities/formatLabel.ts"],"sourcesContent":["/**\n * Fills `{key}` placeholders in a template from `values`. Substitution is single-pass, so braces\n * that arrive inside a value are left alone instead of being substituted again — which also makes\n * the result independent of the key order. A placeholder with no matching key stays as it is.\n */\nconst formatLabel = (template: string, values: Record<string, string | number>) =>\n template.replace(/\\{(\\w+)\\}/g, (placeholder, key: string) =>\n Object.hasOwn(values, key) ? String(values[key]) : placeholder,\n );\n\nexport default formatLabel;\n"],"mappings":";;;;;;AAKA,IAAM,eAAe,UAAkB,WACrC,SAAS,QAAQ,eAAe,aAAa,QAC3C,OAAO,OAAO,QAAQ,GAAG,IAAI,OAAO,OAAO,IAAI,IAAI,WACrD"}
|