@shoplflow/templates 0.1.35 → 0.1.37
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +150 -0
- package/dist/index.d.cts +46 -2
- package/dist/index.d.ts +46 -2
- package/dist/index.js +152 -2
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -1596,6 +1596,156 @@ exports.Table = Object.assign(Table, {
|
|
|
1596
1596
|
Button: exports.TableButton,
|
|
1597
1597
|
Badge: exports.TableBadge
|
|
1598
1598
|
});
|
|
1599
|
+
var AttachmentListContext = React6.createContext({});
|
|
1600
|
+
var AttachmentList = (_a) => {
|
|
1601
|
+
var _b = _a, {
|
|
1602
|
+
onDelete,
|
|
1603
|
+
children
|
|
1604
|
+
} = _b, rest = __objRest(_b, [
|
|
1605
|
+
"onDelete",
|
|
1606
|
+
"children"
|
|
1607
|
+
]);
|
|
1608
|
+
const contextValue = {
|
|
1609
|
+
onDelete
|
|
1610
|
+
};
|
|
1611
|
+
return /* @__PURE__ */ jsxRuntime.jsx(AttachmentListContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsxRuntime.jsx(base.StackContainer.Horizontal, __spreadProps(__spreadValues({ spacing: "spacing08" }, rest), { children })) });
|
|
1612
|
+
};
|
|
1613
|
+
exports.AttachmentList = AttachmentList;
|
|
1614
|
+
var StyledSeparator = styled2__default.default.div`
|
|
1615
|
+
width: 2px;
|
|
1616
|
+
height: 2px;
|
|
1617
|
+
background-color: var(--neutral400);
|
|
1618
|
+
border-radius: 0.5px;
|
|
1619
|
+
flex-shrink: 0;
|
|
1620
|
+
`;
|
|
1621
|
+
var AttachmentItemSingle = ({ item, onDelete }) => {
|
|
1622
|
+
const formatFileSize = (bytes) => {
|
|
1623
|
+
if (bytes === 0) {
|
|
1624
|
+
return "0 Bytes";
|
|
1625
|
+
}
|
|
1626
|
+
const k = 1024;
|
|
1627
|
+
const sizes = ["Bytes", "KB", "MB", "GB"];
|
|
1628
|
+
const i = Math.floor(Math.log(bytes) / Math.log(k));
|
|
1629
|
+
return parseFloat((bytes / Math.pow(k, i)).toFixed(1)) + " " + sizes[i];
|
|
1630
|
+
};
|
|
1631
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(base.StackContainer.Horizontal, { width: "inherit", align: "center", padding: "0", children: [
|
|
1632
|
+
/* @__PURE__ */ jsxRuntime.jsxs(base.StackContainer.Horizontal, { align: "center", spacing: "spacing04", children: [
|
|
1633
|
+
/* @__PURE__ */ jsxRuntime.jsx(base.Text, { typography: "body2_400", color: "neutral700", lineClamp: 1, textOverflow: "ellipsis", whiteSpace: "nowrap", children: item.name }),
|
|
1634
|
+
/* @__PURE__ */ jsxRuntime.jsx(StyledSeparator, {}),
|
|
1635
|
+
/* @__PURE__ */ jsxRuntime.jsx(base.Text, { typography: "body2_400", color: "neutral400", children: item.extension }),
|
|
1636
|
+
/* @__PURE__ */ jsxRuntime.jsx(StyledSeparator, {}),
|
|
1637
|
+
/* @__PURE__ */ jsxRuntime.jsx(base.Text, { typography: "body2_400", color: "neutral400", children: formatFileSize(item.size) })
|
|
1638
|
+
] }),
|
|
1639
|
+
/* @__PURE__ */ jsxRuntime.jsx(base.IconButton, { sizeVar: "S", styleVar: "GHOST", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1640
|
+
base.Icon,
|
|
1641
|
+
{
|
|
1642
|
+
iconSource: shoplAssets.DeleteIcon,
|
|
1643
|
+
sizeVar: "S",
|
|
1644
|
+
color: "neutral350",
|
|
1645
|
+
onClick: (e) => onDelete == null ? void 0 : onDelete(e)
|
|
1646
|
+
}
|
|
1647
|
+
) })
|
|
1648
|
+
] });
|
|
1649
|
+
};
|
|
1650
|
+
exports.AttachmentItemSingle = AttachmentItemSingle;
|
|
1651
|
+
var AttachmentItemMulti = ({ item, children, thumbnail, onDelete }) => {
|
|
1652
|
+
const formatFileSize = (bytes) => {
|
|
1653
|
+
if (bytes === 0) {
|
|
1654
|
+
return "0 Bytes";
|
|
1655
|
+
}
|
|
1656
|
+
const k = 1024;
|
|
1657
|
+
const sizes = ["Bytes", "KB", "MB", "GB"];
|
|
1658
|
+
const i = Math.floor(Math.log(bytes) / Math.log(k));
|
|
1659
|
+
return parseFloat((bytes / Math.pow(k, i)).toFixed(1)) + " " + sizes[i];
|
|
1660
|
+
};
|
|
1661
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1662
|
+
base.StackContainer.Horizontal,
|
|
1663
|
+
{
|
|
1664
|
+
align: "center",
|
|
1665
|
+
width: "inherit",
|
|
1666
|
+
minHeight: "48px",
|
|
1667
|
+
padding: "8px",
|
|
1668
|
+
spacing: "spacing08",
|
|
1669
|
+
radius: "borderRadius08",
|
|
1670
|
+
onMouseEnter: (e) => {
|
|
1671
|
+
e.currentTarget.style.backgroundColor = "rgba(153, 153, 153, 0.05)";
|
|
1672
|
+
},
|
|
1673
|
+
onMouseLeave: (e) => {
|
|
1674
|
+
e.currentTarget.style.backgroundColor = "transparent";
|
|
1675
|
+
},
|
|
1676
|
+
children: [
|
|
1677
|
+
thumbnail,
|
|
1678
|
+
/* @__PURE__ */ jsxRuntime.jsx(base.StackContainer.Vertical, { flex: "1", align: "flex-start", height: "100%", children: item ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
1679
|
+
/* @__PURE__ */ jsxRuntime.jsx(base.Text, { typography: "body1_400", color: "neutral700", lineClamp: 1, textOverflow: "ellipsis", whiteSpace: "nowrap", children: item.name }),
|
|
1680
|
+
/* @__PURE__ */ jsxRuntime.jsx(base.Text, { typography: "caption_400", color: "neutral400", children: formatFileSize(item.size) })
|
|
1681
|
+
] }) : children }),
|
|
1682
|
+
/* @__PURE__ */ jsxRuntime.jsx(base.IconButton, { sizeVar: "S", styleVar: "GHOST", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1683
|
+
base.Icon,
|
|
1684
|
+
{
|
|
1685
|
+
iconSource: shoplAssets.DeleteIcon,
|
|
1686
|
+
sizeVar: "S",
|
|
1687
|
+
color: "neutral350",
|
|
1688
|
+
onClick: (e) => onDelete == null ? void 0 : onDelete(e)
|
|
1689
|
+
}
|
|
1690
|
+
) })
|
|
1691
|
+
]
|
|
1692
|
+
}
|
|
1693
|
+
);
|
|
1694
|
+
};
|
|
1695
|
+
exports.AttachmentItemMulti = AttachmentItemMulti;
|
|
1696
|
+
var AttachmentThumbnail = ({ iconSource, url }) => {
|
|
1697
|
+
if (url) {
|
|
1698
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1699
|
+
base.StackContainer,
|
|
1700
|
+
{
|
|
1701
|
+
width: "32px",
|
|
1702
|
+
height: "32px",
|
|
1703
|
+
radius: "borderRadius04",
|
|
1704
|
+
style: {
|
|
1705
|
+
overflow: "hidden",
|
|
1706
|
+
flexShrink: 0
|
|
1707
|
+
},
|
|
1708
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1709
|
+
"img",
|
|
1710
|
+
{
|
|
1711
|
+
src: url,
|
|
1712
|
+
alt: "thumbnail",
|
|
1713
|
+
style: {
|
|
1714
|
+
width: "100%",
|
|
1715
|
+
height: "100%",
|
|
1716
|
+
objectFit: "cover"
|
|
1717
|
+
}
|
|
1718
|
+
}
|
|
1719
|
+
)
|
|
1720
|
+
}
|
|
1721
|
+
);
|
|
1722
|
+
}
|
|
1723
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1724
|
+
base.StackContainer,
|
|
1725
|
+
{
|
|
1726
|
+
direction: "row",
|
|
1727
|
+
align: "center",
|
|
1728
|
+
justify: "center",
|
|
1729
|
+
width: "32px",
|
|
1730
|
+
height: "32px",
|
|
1731
|
+
background: "neutral0",
|
|
1732
|
+
radius: "borderRadius04",
|
|
1733
|
+
style: {
|
|
1734
|
+
border: "1px solid var(--neutral200)",
|
|
1735
|
+
flexShrink: 0
|
|
1736
|
+
},
|
|
1737
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(base.Icon, { iconSource, sizeVar: "S", color: "neutral700" })
|
|
1738
|
+
}
|
|
1739
|
+
);
|
|
1740
|
+
};
|
|
1741
|
+
exports.AttachmentThumbnail = AttachmentThumbnail;
|
|
1742
|
+
var AttachmentItem = ({ children }) => {
|
|
1743
|
+
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children });
|
|
1744
|
+
};
|
|
1745
|
+
AttachmentItem.Single = exports.AttachmentItemSingle;
|
|
1746
|
+
AttachmentItem.Multi = exports.AttachmentItemMulti;
|
|
1747
|
+
AttachmentItem.Thumbnail = exports.AttachmentThumbnail;
|
|
1748
|
+
exports.AttachmentItem = AttachmentItem;
|
|
1599
1749
|
|
|
1600
1750
|
Object.defineProperty(exports, 'createColumnHelper', {
|
|
1601
1751
|
enumerable: true,
|
package/dist/index.d.cts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { TextProps, TooltipProps, IconButtonProps, IconButton } from '@shoplflow/base';
|
|
2
|
+
import { TextProps, TooltipProps, IconButtonProps, IconButton, StackContainerOptionProps } from '@shoplflow/base';
|
|
3
3
|
import { ChildrenProps } from '@shoplflow/base/src/utils/type/ComponentProps';
|
|
4
4
|
import * as React$1 from 'react';
|
|
5
5
|
import React__default, { ReactNode, ReactElement, RefObject, Dispatch, SetStateAction, CSSProperties, ButtonHTMLAttributes } from 'react';
|
|
6
6
|
import { Table as Table$1, ColumnDef, Header, RowData, ColumnFilter } from '@tanstack/react-table';
|
|
7
7
|
export { createColumnHelper } from '@tanstack/react-table';
|
|
8
|
+
import { IconSource } from '@shoplflow/shopl-assets';
|
|
8
9
|
|
|
9
10
|
declare type ActionsProps = {
|
|
10
11
|
children: ReactNode;
|
|
@@ -292,4 +293,47 @@ declare type TableComponentType = typeof Table & {
|
|
|
292
293
|
};
|
|
293
294
|
declare const TableComponent: TableComponentType;
|
|
294
295
|
|
|
295
|
-
|
|
296
|
+
interface AttachmentItemData {
|
|
297
|
+
name: string;
|
|
298
|
+
extension: string;
|
|
299
|
+
size: number;
|
|
300
|
+
}
|
|
301
|
+
interface AttachmentListProps {
|
|
302
|
+
onDelete?: (e: React.MouseEvent<HTMLButtonElement>) => void;
|
|
303
|
+
disabled?: boolean;
|
|
304
|
+
children: React.ReactNode;
|
|
305
|
+
}
|
|
306
|
+
interface AttachmentItemSingleProps {
|
|
307
|
+
item: AttachmentItemData;
|
|
308
|
+
onDelete?: (e: React.MouseEvent<HTMLButtonElement>) => void;
|
|
309
|
+
}
|
|
310
|
+
interface AttachmentItemMultiProps {
|
|
311
|
+
item?: AttachmentItemData | null;
|
|
312
|
+
thumbnail?: React.ReactNode;
|
|
313
|
+
children?: React.ReactNode;
|
|
314
|
+
onDelete?: (e: React.MouseEvent<HTMLButtonElement>) => void;
|
|
315
|
+
}
|
|
316
|
+
interface AttachmentThumbnailProps {
|
|
317
|
+
iconSource?: IconSource;
|
|
318
|
+
url?: string;
|
|
319
|
+
onDelete?: (e: React.MouseEvent<HTMLButtonElement>) => void;
|
|
320
|
+
}
|
|
321
|
+
interface AttachmentItemProps {
|
|
322
|
+
children: React.ReactNode;
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
declare const AttachmentList: React__default.FC<AttachmentListProps & Pick<StackContainerOptionProps, 'width'>>;
|
|
326
|
+
|
|
327
|
+
declare const AttachmentItemSingle: React__default.FC<AttachmentItemSingleProps>;
|
|
328
|
+
|
|
329
|
+
declare const AttachmentItemMulti: React__default.FC<AttachmentItemMultiProps>;
|
|
330
|
+
|
|
331
|
+
declare const AttachmentThumbnail: React__default.FC<AttachmentThumbnailProps>;
|
|
332
|
+
|
|
333
|
+
declare const AttachmentItem: React__default.FC<AttachmentItemProps> & {
|
|
334
|
+
Single: typeof AttachmentItemSingle;
|
|
335
|
+
Multi: typeof AttachmentItemMulti;
|
|
336
|
+
Thumbnail: typeof AttachmentThumbnail;
|
|
337
|
+
};
|
|
338
|
+
|
|
339
|
+
export { ActionsProps, AttachmentItem, AttachmentItemData, AttachmentItemMulti, AttachmentItemMultiProps, AttachmentItemProps, AttachmentItemSingle, AttachmentItemSingleProps, AttachmentList, AttachmentListProps, AttachmentThumbnail, AttachmentThumbnailProps, DescriptionProps, FixedColumn, PinningPosition, TableComponent as Table, TableBadge, TableButton, TableContextType, TableHeadCellProps, TableMainProps, TablePaginationProps, TableProps, TableToolbarProps, TitleGroup, TitleGroupHeaderProps, TitleGroupHelpIconProps, TitleGroupProps };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { TextProps, TooltipProps, IconButtonProps, IconButton } from '@shoplflow/base';
|
|
2
|
+
import { TextProps, TooltipProps, IconButtonProps, IconButton, StackContainerOptionProps } from '@shoplflow/base';
|
|
3
3
|
import { ChildrenProps } from '@shoplflow/base/src/utils/type/ComponentProps';
|
|
4
4
|
import * as React$1 from 'react';
|
|
5
5
|
import React__default, { ReactNode, ReactElement, RefObject, Dispatch, SetStateAction, CSSProperties, ButtonHTMLAttributes } from 'react';
|
|
6
6
|
import { Table as Table$1, ColumnDef, Header, RowData, ColumnFilter } from '@tanstack/react-table';
|
|
7
7
|
export { createColumnHelper } from '@tanstack/react-table';
|
|
8
|
+
import { IconSource } from '@shoplflow/shopl-assets';
|
|
8
9
|
|
|
9
10
|
declare type ActionsProps = {
|
|
10
11
|
children: ReactNode;
|
|
@@ -292,4 +293,47 @@ declare type TableComponentType = typeof Table & {
|
|
|
292
293
|
};
|
|
293
294
|
declare const TableComponent: TableComponentType;
|
|
294
295
|
|
|
295
|
-
|
|
296
|
+
interface AttachmentItemData {
|
|
297
|
+
name: string;
|
|
298
|
+
extension: string;
|
|
299
|
+
size: number;
|
|
300
|
+
}
|
|
301
|
+
interface AttachmentListProps {
|
|
302
|
+
onDelete?: (e: React.MouseEvent<HTMLButtonElement>) => void;
|
|
303
|
+
disabled?: boolean;
|
|
304
|
+
children: React.ReactNode;
|
|
305
|
+
}
|
|
306
|
+
interface AttachmentItemSingleProps {
|
|
307
|
+
item: AttachmentItemData;
|
|
308
|
+
onDelete?: (e: React.MouseEvent<HTMLButtonElement>) => void;
|
|
309
|
+
}
|
|
310
|
+
interface AttachmentItemMultiProps {
|
|
311
|
+
item?: AttachmentItemData | null;
|
|
312
|
+
thumbnail?: React.ReactNode;
|
|
313
|
+
children?: React.ReactNode;
|
|
314
|
+
onDelete?: (e: React.MouseEvent<HTMLButtonElement>) => void;
|
|
315
|
+
}
|
|
316
|
+
interface AttachmentThumbnailProps {
|
|
317
|
+
iconSource?: IconSource;
|
|
318
|
+
url?: string;
|
|
319
|
+
onDelete?: (e: React.MouseEvent<HTMLButtonElement>) => void;
|
|
320
|
+
}
|
|
321
|
+
interface AttachmentItemProps {
|
|
322
|
+
children: React.ReactNode;
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
declare const AttachmentList: React__default.FC<AttachmentListProps & Pick<StackContainerOptionProps, 'width'>>;
|
|
326
|
+
|
|
327
|
+
declare const AttachmentItemSingle: React__default.FC<AttachmentItemSingleProps>;
|
|
328
|
+
|
|
329
|
+
declare const AttachmentItemMulti: React__default.FC<AttachmentItemMultiProps>;
|
|
330
|
+
|
|
331
|
+
declare const AttachmentThumbnail: React__default.FC<AttachmentThumbnailProps>;
|
|
332
|
+
|
|
333
|
+
declare const AttachmentItem: React__default.FC<AttachmentItemProps> & {
|
|
334
|
+
Single: typeof AttachmentItemSingle;
|
|
335
|
+
Multi: typeof AttachmentItemMulti;
|
|
336
|
+
Thumbnail: typeof AttachmentThumbnail;
|
|
337
|
+
};
|
|
338
|
+
|
|
339
|
+
export { ActionsProps, AttachmentItem, AttachmentItemData, AttachmentItemMulti, AttachmentItemMultiProps, AttachmentItemProps, AttachmentItemSingle, AttachmentItemSingleProps, AttachmentList, AttachmentListProps, AttachmentThumbnail, AttachmentThumbnailProps, DescriptionProps, FixedColumn, PinningPosition, TableComponent as Table, TableBadge, TableButton, TableContextType, TableHeadCellProps, TableMainProps, TablePaginationProps, TableProps, TableToolbarProps, TitleGroup, TitleGroupHeaderProps, TitleGroupHelpIconProps, TitleGroupProps };
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { colorTokens, IconButton, StackContainer, Icon, Tag, Text, Stack, Pagination, Checkbox, Tooltip, ScrollArea, Popper, Menu } from '@shoplflow/base';
|
|
2
2
|
import styled2 from '@emotion/styled';
|
|
3
|
-
import { RefreshIcon, CloseSmallIcon, HelpLineIcon, DescIcon, AscIcon, MoreIcon, UpArrowSolidXsmallIcon, DownArrowSolidXsmallIcon } from '@shoplflow/shopl-assets';
|
|
3
|
+
import { RefreshIcon, CloseSmallIcon, HelpLineIcon, DeleteIcon, DescIcon, AscIcon, MoreIcon, UpArrowSolidXsmallIcon, DownArrowSolidXsmallIcon } from '@shoplflow/shopl-assets';
|
|
4
4
|
import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
|
|
5
5
|
import React6, { createContext, memo, useRef, useEffect, useContext, useState, useCallback, useMemo, Children, isValidElement, Fragment as Fragment$1 } from 'react';
|
|
6
6
|
import { useReactTable, getCoreRowModel, getFilteredRowModel, getPaginationRowModel, getSortedRowModel, flexRender } from '@tanstack/react-table';
|
|
@@ -1590,5 +1590,155 @@ var TableComponent = Object.assign(Table, {
|
|
|
1590
1590
|
Button: TableButton,
|
|
1591
1591
|
Badge: TableBadge
|
|
1592
1592
|
});
|
|
1593
|
+
var AttachmentListContext = createContext({});
|
|
1594
|
+
var AttachmentList = (_a) => {
|
|
1595
|
+
var _b = _a, {
|
|
1596
|
+
onDelete,
|
|
1597
|
+
children
|
|
1598
|
+
} = _b, rest = __objRest(_b, [
|
|
1599
|
+
"onDelete",
|
|
1600
|
+
"children"
|
|
1601
|
+
]);
|
|
1602
|
+
const contextValue = {
|
|
1603
|
+
onDelete
|
|
1604
|
+
};
|
|
1605
|
+
return /* @__PURE__ */ jsx(AttachmentListContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsx(StackContainer.Horizontal, __spreadProps(__spreadValues({ spacing: "spacing08" }, rest), { children })) });
|
|
1606
|
+
};
|
|
1607
|
+
var AttachmentList_default = AttachmentList;
|
|
1608
|
+
var StyledSeparator = styled2.div`
|
|
1609
|
+
width: 2px;
|
|
1610
|
+
height: 2px;
|
|
1611
|
+
background-color: var(--neutral400);
|
|
1612
|
+
border-radius: 0.5px;
|
|
1613
|
+
flex-shrink: 0;
|
|
1614
|
+
`;
|
|
1615
|
+
var AttachmentItemSingle = ({ item, onDelete }) => {
|
|
1616
|
+
const formatFileSize = (bytes) => {
|
|
1617
|
+
if (bytes === 0) {
|
|
1618
|
+
return "0 Bytes";
|
|
1619
|
+
}
|
|
1620
|
+
const k = 1024;
|
|
1621
|
+
const sizes = ["Bytes", "KB", "MB", "GB"];
|
|
1622
|
+
const i = Math.floor(Math.log(bytes) / Math.log(k));
|
|
1623
|
+
return parseFloat((bytes / Math.pow(k, i)).toFixed(1)) + " " + sizes[i];
|
|
1624
|
+
};
|
|
1625
|
+
return /* @__PURE__ */ jsxs(StackContainer.Horizontal, { width: "inherit", align: "center", padding: "0", children: [
|
|
1626
|
+
/* @__PURE__ */ jsxs(StackContainer.Horizontal, { align: "center", spacing: "spacing04", children: [
|
|
1627
|
+
/* @__PURE__ */ jsx(Text, { typography: "body2_400", color: "neutral700", lineClamp: 1, textOverflow: "ellipsis", whiteSpace: "nowrap", children: item.name }),
|
|
1628
|
+
/* @__PURE__ */ jsx(StyledSeparator, {}),
|
|
1629
|
+
/* @__PURE__ */ jsx(Text, { typography: "body2_400", color: "neutral400", children: item.extension }),
|
|
1630
|
+
/* @__PURE__ */ jsx(StyledSeparator, {}),
|
|
1631
|
+
/* @__PURE__ */ jsx(Text, { typography: "body2_400", color: "neutral400", children: formatFileSize(item.size) })
|
|
1632
|
+
] }),
|
|
1633
|
+
/* @__PURE__ */ jsx(IconButton, { sizeVar: "S", styleVar: "GHOST", children: /* @__PURE__ */ jsx(
|
|
1634
|
+
Icon,
|
|
1635
|
+
{
|
|
1636
|
+
iconSource: DeleteIcon,
|
|
1637
|
+
sizeVar: "S",
|
|
1638
|
+
color: "neutral350",
|
|
1639
|
+
onClick: (e) => onDelete == null ? void 0 : onDelete(e)
|
|
1640
|
+
}
|
|
1641
|
+
) })
|
|
1642
|
+
] });
|
|
1643
|
+
};
|
|
1644
|
+
var AttachmentItemSingle_default = AttachmentItemSingle;
|
|
1645
|
+
var AttachmentItemMulti = ({ item, children, thumbnail, onDelete }) => {
|
|
1646
|
+
const formatFileSize = (bytes) => {
|
|
1647
|
+
if (bytes === 0) {
|
|
1648
|
+
return "0 Bytes";
|
|
1649
|
+
}
|
|
1650
|
+
const k = 1024;
|
|
1651
|
+
const sizes = ["Bytes", "KB", "MB", "GB"];
|
|
1652
|
+
const i = Math.floor(Math.log(bytes) / Math.log(k));
|
|
1653
|
+
return parseFloat((bytes / Math.pow(k, i)).toFixed(1)) + " " + sizes[i];
|
|
1654
|
+
};
|
|
1655
|
+
return /* @__PURE__ */ jsxs(
|
|
1656
|
+
StackContainer.Horizontal,
|
|
1657
|
+
{
|
|
1658
|
+
align: "center",
|
|
1659
|
+
width: "inherit",
|
|
1660
|
+
minHeight: "48px",
|
|
1661
|
+
padding: "8px",
|
|
1662
|
+
spacing: "spacing08",
|
|
1663
|
+
radius: "borderRadius08",
|
|
1664
|
+
onMouseEnter: (e) => {
|
|
1665
|
+
e.currentTarget.style.backgroundColor = "rgba(153, 153, 153, 0.05)";
|
|
1666
|
+
},
|
|
1667
|
+
onMouseLeave: (e) => {
|
|
1668
|
+
e.currentTarget.style.backgroundColor = "transparent";
|
|
1669
|
+
},
|
|
1670
|
+
children: [
|
|
1671
|
+
thumbnail,
|
|
1672
|
+
/* @__PURE__ */ jsx(StackContainer.Vertical, { flex: "1", align: "flex-start", height: "100%", children: item ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1673
|
+
/* @__PURE__ */ jsx(Text, { typography: "body1_400", color: "neutral700", lineClamp: 1, textOverflow: "ellipsis", whiteSpace: "nowrap", children: item.name }),
|
|
1674
|
+
/* @__PURE__ */ jsx(Text, { typography: "caption_400", color: "neutral400", children: formatFileSize(item.size) })
|
|
1675
|
+
] }) : children }),
|
|
1676
|
+
/* @__PURE__ */ jsx(IconButton, { sizeVar: "S", styleVar: "GHOST", children: /* @__PURE__ */ jsx(
|
|
1677
|
+
Icon,
|
|
1678
|
+
{
|
|
1679
|
+
iconSource: DeleteIcon,
|
|
1680
|
+
sizeVar: "S",
|
|
1681
|
+
color: "neutral350",
|
|
1682
|
+
onClick: (e) => onDelete == null ? void 0 : onDelete(e)
|
|
1683
|
+
}
|
|
1684
|
+
) })
|
|
1685
|
+
]
|
|
1686
|
+
}
|
|
1687
|
+
);
|
|
1688
|
+
};
|
|
1689
|
+
var AttachmentItemMulti_default = AttachmentItemMulti;
|
|
1690
|
+
var AttachmentThumbnail = ({ iconSource, url }) => {
|
|
1691
|
+
if (url) {
|
|
1692
|
+
return /* @__PURE__ */ jsx(
|
|
1693
|
+
StackContainer,
|
|
1694
|
+
{
|
|
1695
|
+
width: "32px",
|
|
1696
|
+
height: "32px",
|
|
1697
|
+
radius: "borderRadius04",
|
|
1698
|
+
style: {
|
|
1699
|
+
overflow: "hidden",
|
|
1700
|
+
flexShrink: 0
|
|
1701
|
+
},
|
|
1702
|
+
children: /* @__PURE__ */ jsx(
|
|
1703
|
+
"img",
|
|
1704
|
+
{
|
|
1705
|
+
src: url,
|
|
1706
|
+
alt: "thumbnail",
|
|
1707
|
+
style: {
|
|
1708
|
+
width: "100%",
|
|
1709
|
+
height: "100%",
|
|
1710
|
+
objectFit: "cover"
|
|
1711
|
+
}
|
|
1712
|
+
}
|
|
1713
|
+
)
|
|
1714
|
+
}
|
|
1715
|
+
);
|
|
1716
|
+
}
|
|
1717
|
+
return /* @__PURE__ */ jsx(
|
|
1718
|
+
StackContainer,
|
|
1719
|
+
{
|
|
1720
|
+
direction: "row",
|
|
1721
|
+
align: "center",
|
|
1722
|
+
justify: "center",
|
|
1723
|
+
width: "32px",
|
|
1724
|
+
height: "32px",
|
|
1725
|
+
background: "neutral0",
|
|
1726
|
+
radius: "borderRadius04",
|
|
1727
|
+
style: {
|
|
1728
|
+
border: "1px solid var(--neutral200)",
|
|
1729
|
+
flexShrink: 0
|
|
1730
|
+
},
|
|
1731
|
+
children: /* @__PURE__ */ jsx(Icon, { iconSource, sizeVar: "S", color: "neutral700" })
|
|
1732
|
+
}
|
|
1733
|
+
);
|
|
1734
|
+
};
|
|
1735
|
+
var AttachmentThumbnail_default = AttachmentThumbnail;
|
|
1736
|
+
var AttachmentItem = ({ children }) => {
|
|
1737
|
+
return /* @__PURE__ */ jsx(Fragment, { children });
|
|
1738
|
+
};
|
|
1739
|
+
AttachmentItem.Single = AttachmentItemSingle_default;
|
|
1740
|
+
AttachmentItem.Multi = AttachmentItemMulti_default;
|
|
1741
|
+
AttachmentItem.Thumbnail = AttachmentThumbnail_default;
|
|
1742
|
+
var AttachmentItem_default = AttachmentItem;
|
|
1593
1743
|
|
|
1594
|
-
export { TableComponent as Table, TableBadge, TableButton, TitleGroup_default as TitleGroup };
|
|
1744
|
+
export { AttachmentItem_default as AttachmentItem, AttachmentItemMulti_default as AttachmentItemMulti, AttachmentItemSingle_default as AttachmentItemSingle, AttachmentList_default as AttachmentList, AttachmentThumbnail_default as AttachmentThumbnail, TableComponent as Table, TableBadge, TableButton, TitleGroup_default as TitleGroup };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shoplflow/templates",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.37",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -91,7 +91,7 @@
|
|
|
91
91
|
"react-datepicker": "^7.3.0",
|
|
92
92
|
"react-dom": "^18.2.0",
|
|
93
93
|
"simplebar-react": "^3.2.6",
|
|
94
|
-
"@shoplflow/base": "^0.42.
|
|
94
|
+
"@shoplflow/base": "^0.42.17",
|
|
95
95
|
"@shoplflow/hada-assets": "^0.1.8",
|
|
96
96
|
"@shoplflow/shopl-assets": "^0.12.23",
|
|
97
97
|
"@shoplflow/utils": "^0.7.0"
|