@citygross/components_v2 0.0.16 → 0.0.17

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.
Files changed (52) hide show
  1. package/dist/components/AlertBox/AlertBox.js +1 -1
  2. package/dist/components/BoxArrow/BoxArrow.d.ts +10 -0
  3. package/dist/components/BoxArrow/BoxArrow.js +6 -2
  4. package/dist/components/Button/Button.d.ts +19 -0
  5. package/dist/components/CartItemSummary/CartItemSummary.js +1 -1
  6. package/dist/components/FormControl/FormControl.js +1 -1
  7. package/dist/components/Header/Header.css.vanilla.js +1 -2
  8. package/dist/components/Header/Header.d.ts +5 -3
  9. package/dist/components/Header/Header.js +6 -32
  10. package/dist/components/ListItem/ListItem.js +1 -1
  11. package/dist/components/OrderTable/OrderTable.css.d.ts +44 -0
  12. package/dist/components/OrderTable/OrderTable.css.ts.vanilla.css +57 -0
  13. package/dist/components/OrderTable/OrderTable.css.vanilla.js +12 -0
  14. package/dist/components/OrderTableMobile/OrderTableMobile.css.ts.vanilla.css +17 -0
  15. package/dist/components/OrderTableMobile/OrderTableMobile.css.vanilla.js +7 -0
  16. package/dist/components/OrderTableMobile/OrderTableMobile.d.ts +12 -0
  17. package/dist/components/OrderTableMobile/OrderTableMobile.js +40 -0
  18. package/dist/components/Pagination/Pagination.css.ts.vanilla.css +16 -0
  19. package/dist/components/Pagination/Pagination.css.vanilla.js +8 -0
  20. package/dist/components/Pagination/Pagination.d.ts +15 -0
  21. package/dist/components/Pagination/Pagination.js +82 -0
  22. package/dist/components/RippleContainer/RippleContainer.css.ts.vanilla.css +168 -0
  23. package/dist/components/RippleContainer/RippleContainer.css.vanilla.js +6 -0
  24. package/dist/components/RippleContainer/RippleContainer.d.ts +10 -0
  25. package/dist/components/RippleContainer/RippleContainer.js +16 -0
  26. package/dist/components/SideModal/SideModal.css.ts.vanilla.css +104 -0
  27. package/dist/components/SideModal/SideModal.css.vanilla.js +8 -0
  28. package/dist/components/SideModal/SideModal.d.ts +19 -0
  29. package/dist/components/SideModal/SideModal.js +50 -0
  30. package/dist/components/Skeleton/Skeleton.d.ts +3 -1
  31. package/dist/components/Skeleton/Skeleton.js +1 -1
  32. package/dist/cssUtils/border.css.d.ts +2 -2
  33. package/dist/cssUtils/color.css.d.ts +4 -4
  34. package/dist/cssUtils/spacings.css.d.ts +7 -7
  35. package/dist/index.d.ts +15 -4
  36. package/dist/index.js +15 -7
  37. package/dist/typography/BodyText/BodyText.css.ts.vanilla.css +3 -0
  38. package/dist/typography/BodyText/BodyText.css.vanilla.js +3 -3
  39. package/dist/typography/BodyText/BodyText.js +2 -2
  40. package/dist/typography/H1/H1.css.ts.vanilla.css +10 -0
  41. package/dist/typography/H1/H1.css.vanilla.js +8 -0
  42. package/dist/typography/H1/H1.d.ts +13 -0
  43. package/dist/typography/H1/H1.js +24 -0
  44. package/dist/typography/H2/H2.css.ts.vanilla.css +10 -0
  45. package/dist/typography/H2/H2.css.vanilla.js +8 -0
  46. package/dist/typography/H2/H2.d.ts +13 -0
  47. package/dist/typography/H2/H2.js +24 -0
  48. package/dist/typography/H3/H3.d.ts +13 -0
  49. package/dist/typography/Paragraph/Paragraph.css.vanilla.js +8 -0
  50. package/dist/typography/Paragraph/Paragraph.d.ts +16 -0
  51. package/dist/typography/Paragraph/Paragraph.js +28 -0
  52. package/package.json +3 -4
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import BoxArrow from '../BoxArrow/BoxArrow.js';
2
+ import { BoxArrow } from '../BoxArrow/BoxArrow.js';
3
3
  import { alertBox, iconContainer } from './AlertBox.css.vanilla.js';
4
4
 
5
5
  function AlertBox({
@@ -0,0 +1,10 @@
1
+ import { THardSpacingKeys } from '@citygross/design-tokens_v2';
2
+
3
+ declare type TBoxArrow = {
4
+ arrowPlacement?: 'left' | 'right';
5
+ arrowSpacing?: THardSpacingKeys;
6
+ background?: string;
7
+ };
8
+ declare const BoxArrow: ({ arrowPlacement, arrowSpacing, background }: TBoxArrow) => JSX.Element;
9
+
10
+ export { BoxArrow, TBoxArrow };
@@ -2,7 +2,11 @@ import { Icons } from '@citygross/icons_v2';
2
2
  import React from 'react';
3
3
  import { boxArrowContainer } from './BoxArrow.css.vanilla.js';
4
4
 
5
- const BoxArrow = ({ arrowPlacement, arrowSpacing, background }) => {
5
+ const BoxArrow = ({
6
+ arrowPlacement,
7
+ arrowSpacing,
8
+ background
9
+ }) => {
6
10
  return /* @__PURE__ */ React.createElement(
7
11
  "div",
8
12
  {
@@ -16,4 +20,4 @@ const BoxArrow = ({ arrowPlacement, arrowSpacing, background }) => {
16
20
  );
17
21
  };
18
22
 
19
- export { BoxArrow as default };
23
+ export { BoxArrow };
@@ -0,0 +1,19 @@
1
+ import React from 'react';
2
+
3
+ declare type TCgButton = {
4
+ size?: 'small' | 'medium' | 'icon' | 'large';
5
+ variant?: 'primary' | 'secondary' | 'ghost' | 'tertiary' | 'prio';
6
+ icon?: React.ReactNode;
7
+ flexReverse?: boolean;
8
+ loading?: boolean;
9
+ children?: React.ReactNode;
10
+ disabled?: boolean;
11
+ onClick?: () => void;
12
+ fullWidth?: boolean;
13
+ buttonRef?: React.Ref<HTMLButtonElement>;
14
+ round?: boolean;
15
+ className?: string;
16
+ };
17
+ declare const Button: ({ size, variant, icon, flexReverse, disabled, onClick, children, loading, fullWidth, buttonRef, round, className }: TCgButton) => JSX.Element;
18
+
19
+ export { Button, TCgButton };
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import Skeleton from '../Skeleton/Skeleton.js';
2
+ import { Skeleton } from '../Skeleton/Skeleton.js';
3
3
  import { formatPrice } from '@citygross/utils';
4
4
  import { H3 } from '../../typography/H3/H3.js';
5
5
  import { cartitemsummary, cancelledWrapper, amountText, itemInformationContainer } from './CartItemSummary.css.vanilla.js';
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
- import { H3 } from '@citygross/typography';
3
2
  import { formControlWrapper, formControlElementWrapper } from './FormControl.css.vanilla.js';
3
+ import { H3 } from '../../typography/H3/H3.js';
4
4
 
5
5
  var TScreenWidth = /* @__PURE__ */ ((TScreenWidth2) => {
6
6
  TScreenWidth2["1/2"] = "calc(50% - 12px)";
@@ -3,7 +3,6 @@ import './Header.css.ts.vanilla.css';
3
3
  var headerContainer = "Header_headerContainer__11gdejs2";
4
4
  var headerWrapper = "Header_headerWrapper__11gdejs1";
5
5
  var menuIconContainer = "Header_menuIconContainer__11gdejs3";
6
- var sideModalHeader = "Header_sideModalHeader__11gdejs4";
7
6
  var wrapper = "Header_wrapper__11gdejs0";
8
7
 
9
- export { headerContainer, headerWrapper, menuIconContainer, sideModalHeader, wrapper };
8
+ export { headerContainer, headerWrapper, menuIconContainer, wrapper };
@@ -1,11 +1,13 @@
1
- import React, { ReactNode } from 'react';
1
+ import { ReactNode } from 'react';
2
2
 
3
3
  declare type THeader = {
4
4
  btnLabel?: string;
5
5
  btnOnClick?: () => void;
6
+ onMenuClick?: () => void;
6
7
  children?: ReactNode;
7
- headerLink?: React.ReactNode;
8
+ headerLink?: ReactNode;
9
+ sideModal?: ReactNode;
8
10
  };
9
- declare const Header: ({ btnLabel, btnOnClick, children, headerLink }: THeader) => JSX.Element;
11
+ declare const Header: ({ btnLabel, btnOnClick, onMenuClick, sideModal, headerLink }: THeader) => JSX.Element;
10
12
 
11
13
  export { Header, THeader };
@@ -1,44 +1,18 @@
1
- import React, { useState } from 'react';
1
+ import React from 'react';
2
2
  import { Button } from '../Button/Button.js';
3
- import { SideModal } from '@citygross/components';
4
- import { Icons } from '@citygross/icons';
3
+ import { Icons } from '@citygross/icons_v2';
5
4
  import { theme } from '@citygross/design-tokens';
6
- import { wrapper, headerWrapper, headerContainer, menuIconContainer, sideModalHeader } from './Header.css.vanilla.js';
5
+ import { wrapper, headerWrapper, headerContainer, menuIconContainer } from './Header.css.vanilla.js';
7
6
 
8
7
  const Header = ({
9
8
  btnLabel,
10
9
  btnOnClick,
11
- children,
10
+ onMenuClick,
11
+ sideModal,
12
12
  headerLink
13
13
  }) => {
14
- const [showSideModal, setShowSideModal] = useState(false);
15
14
  const isMobile = window.innerWidth < (theme.breakpoints?.lg ?? 960);
16
- return /* @__PURE__ */ React.createElement("div", { className: wrapper }, headerLink && headerLink, /* @__PURE__ */ React.createElement("div", { className: headerWrapper }, /* @__PURE__ */ React.createElement("div", { className: headerContainer }, isMobile ? /* @__PURE__ */ React.createElement(Icons.LogoFlat, null) : /* @__PURE__ */ React.createElement(Icons.Logo, null), isMobile ? /* @__PURE__ */ React.createElement(
17
- "div",
18
- {
19
- className: menuIconContainer,
20
- onClick: () => setShowSideModal(true)
21
- },
22
- /* @__PURE__ */ React.createElement(Icons.Menu, null)
23
- ) : btnLabel && /* @__PURE__ */ React.createElement(Button, { onClick: btnOnClick, variant: "secondary" }, btnLabel))), showSideModal && /* @__PURE__ */ React.createElement(
24
- SideModal,
25
- {
26
- isVisible: true,
27
- onBackdropClick: () => setShowSideModal(false),
28
- slideFrom: "right"
29
- },
30
- /* @__PURE__ */ React.createElement("div", { className: sideModalHeader }, /* @__PURE__ */ React.createElement(Icons.LogoFlat, null), /* @__PURE__ */ React.createElement(
31
- Button,
32
- {
33
- icon: /* @__PURE__ */ React.createElement(Icons.Cross, { height: 16, width: 16 }),
34
- onClick: () => setShowSideModal(false),
35
- round: true,
36
- variant: "secondary",
37
- size: "small"
38
- }
39
- )),
40
- children
41
- ));
15
+ return /* @__PURE__ */ React.createElement("div", { className: wrapper }, headerLink && headerLink, /* @__PURE__ */ React.createElement("div", { className: headerWrapper }, /* @__PURE__ */ React.createElement("div", { className: headerContainer }, isMobile ? /* @__PURE__ */ React.createElement(Icons.LogoFlat, null) : /* @__PURE__ */ React.createElement(Icons.Logo, null), isMobile ? /* @__PURE__ */ React.createElement("div", { className: menuIconContainer, onClick: () => onMenuClick() }, /* @__PURE__ */ React.createElement(Icons.Menu, null)) : btnLabel && /* @__PURE__ */ React.createElement(Button, { onClick: btnOnClick, variant: "secondary" }, btnLabel))), sideModal);
42
16
  };
43
17
 
44
18
  export { Header };
@@ -2,7 +2,7 @@ import React from 'react';
2
2
  import FallbackIcon from './assets/fallback_grocery.js';
3
3
  import { listItemContainer, listLeft, listImageContainer, listImage, itemInformationContainer, listRight } from './ListItem.css.vanilla.js';
4
4
  import { BodyText } from '../../typography/BodyText/BodyText.js';
5
- import Skeleton from '../Skeleton/Skeleton.js';
5
+ import { Skeleton } from '../Skeleton/Skeleton.js';
6
6
 
7
7
  var EListItemAlignment = /* @__PURE__ */ ((EListItemAlignment2) => {
8
8
  EListItemAlignment2["CENTER"] = "center";
@@ -0,0 +1,44 @@
1
+ import * as _vanilla_extract_recipes from '@vanilla-extract/recipes';
2
+
3
+ declare const BorderPosition: {
4
+ Top: string;
5
+ Bottom: string;
6
+ None: string;
7
+ TopAndBottom: string;
8
+ };
9
+ declare const borderStyle: Record<string | number, string>;
10
+ declare const orderTr: _vanilla_extract_recipes.RuntimeFn<{
11
+ borderStyle: Record<string | number, string>;
12
+ disableHover: {
13
+ true: {
14
+ selectors: {
15
+ '&:hover': {
16
+ backgroundColor: "transparent";
17
+ };
18
+ };
19
+ };
20
+ };
21
+ mobile: {
22
+ true: {
23
+ selectors: {
24
+ '&:hover': {
25
+ backgroundColor: "transparent";
26
+ };
27
+ };
28
+ };
29
+ };
30
+ }>;
31
+ declare const orderTd: _vanilla_extract_recipes.RuntimeFn<{
32
+ borderStyle: Record<string | number, string>;
33
+ lineThrough: {
34
+ true: {
35
+ textDecoration: "line-through";
36
+ color: string;
37
+ };
38
+ };
39
+ }>;
40
+ declare const orderTable: string;
41
+ declare const orderThead: string;
42
+ declare const orderTh: string;
43
+
44
+ export { BorderPosition, borderStyle, orderTable, orderTd, orderTh, orderThead, orderTr };
@@ -0,0 +1,57 @@
1
+ .OrderTable_borderStyle_top__1nxgvnk0 {
2
+ border-top: 1px solid #E8E8E8;
3
+ }
4
+ .OrderTable_borderStyle_bottom__1nxgvnk1 {
5
+ border-bottom: 1px solid #E8E8E8;
6
+ }
7
+ .OrderTable_borderStyle_topAndBottom__1nxgvnk2 {
8
+ border-top: 1px solid #E8E8E8;
9
+ border-bottom: 1px solid #E8E8E8;
10
+ }
11
+ .OrderTable_orderTr__1nxgvnk3:hover {
12
+ cursor: pointer;
13
+ background-color: #F7F7F7;
14
+ }
15
+ .OrderTable_orderTr_disableHover_true__1nxgvnk7:hover {
16
+ background-color: transparent;
17
+ }
18
+ .OrderTable_orderTr_mobile_true__1nxgvnk8:hover {
19
+ background-color: transparent;
20
+ }
21
+ .OrderTable_orderTd__1nxgvnk9 {
22
+ padding: 16px 14px;
23
+ font-size: 15px;
24
+ text-align: left;
25
+ color: #333333;
26
+ }
27
+ .OrderTable_orderTd__1nxgvnk9:last-child {
28
+ text-align: right;
29
+ }
30
+ .OrderTable_orderTd__1nxgvnk9:first-child {
31
+ text-align: start;
32
+ }
33
+ .OrderTable_orderTd_lineThrough_true__1nxgvnkd {
34
+ text-decoration: line-through;
35
+ color: #979797;
36
+ }
37
+ .OrderTable_orderTable__1nxgvnke {
38
+ width: 100%;
39
+ border: none;
40
+ border-collapse: collapse;
41
+ border-spacing: 0;
42
+ }
43
+ .OrderTable_orderThead__1nxgvnkf {
44
+ border-bottom: 1px solid #E8E8E8;
45
+ }
46
+ .OrderTable_orderTh__1nxgvnkg {
47
+ position: relative;
48
+ padding: 12px 14px;
49
+ font-size: 15px;
50
+ text-align: left;
51
+ }
52
+ .OrderTable_orderTh__1nxgvnkg:last-child {
53
+ text-align: right;
54
+ }
55
+ .OrderTable_orderTh__1nxgvnkg:first-child {
56
+ text-align: start;
57
+ }
@@ -0,0 +1,12 @@
1
+ import './OrderTable.css.ts.vanilla.css';
2
+ import { createRuntimeFn } from '@vanilla-extract/recipes/createRuntimeFn';
3
+
4
+ var BorderPosition = { Top: "top", Bottom: "bottom", None: "none", TopAndBottom: "topAndBottom" };
5
+ var borderStyle = { top: "OrderTable_borderStyle_top__1nxgvnk0", bottom: "OrderTable_borderStyle_bottom__1nxgvnk1", topAndBottom: "OrderTable_borderStyle_topAndBottom__1nxgvnk2" };
6
+ var orderTable = "OrderTable_orderTable__1nxgvnke";
7
+ var orderTd = createRuntimeFn({ defaultClassName: "OrderTable_orderTd__1nxgvnk9", variantClassNames: { borderStyle: { top: "OrderTable_borderStyle_top__1nxgvnk0", bottom: "OrderTable_borderStyle_bottom__1nxgvnk1", topAndBottom: "OrderTable_borderStyle_topAndBottom__1nxgvnk2" }, lineThrough: { true: "OrderTable_orderTd_lineThrough_true__1nxgvnkd" } }, defaultVariants: {}, compoundVariants: [] });
8
+ var orderTh = "OrderTable_orderTh__1nxgvnkg";
9
+ var orderThead = "OrderTable_orderThead__1nxgvnkf";
10
+ var orderTr = createRuntimeFn({ defaultClassName: "OrderTable_orderTr__1nxgvnk3", variantClassNames: { borderStyle: { top: "OrderTable_borderStyle_top__1nxgvnk0", bottom: "OrderTable_borderStyle_bottom__1nxgvnk1", topAndBottom: "OrderTable_borderStyle_topAndBottom__1nxgvnk2" }, disableHover: { true: "OrderTable_orderTr_disableHover_true__1nxgvnk7" }, mobile: { true: "OrderTable_orderTr_mobile_true__1nxgvnk8" } }, defaultVariants: {}, compoundVariants: [] });
11
+
12
+ export { BorderPosition, borderStyle, orderTable, orderTd, orderTh, orderThead, orderTr };
@@ -0,0 +1,17 @@
1
+ .OrderTableMobile_mobileOrderLine__1n1lr3j0 {
2
+ display: grid;
3
+ grid-template-columns: auto minmax(0, 1fr);
4
+ row-gap: 12px;
5
+ border-top: 1px solid #E8E8E8;
6
+ padding: 12px;
7
+ }
8
+ .OrderTableMobile_mobileOrderLine__1n1lr3j0:hover {
9
+ background-color: #F7F7F7;
10
+ }
11
+ .OrderTableMobile_mobileOrderLineLabel__1n1lr3j1 {
12
+ grid-column: 1;
13
+ padding-right: 35px;
14
+ }
15
+ .OrderTableMobile_mobileOrderLineValue__1n1lr3j2 {
16
+ grid-column: 2;
17
+ }
@@ -0,0 +1,7 @@
1
+ import './OrderTableMobile.css.ts.vanilla.css';
2
+
3
+ var mobileOrderLine = "OrderTableMobile_mobileOrderLine__1n1lr3j0";
4
+ var mobileOrderLineLabel = "OrderTableMobile_mobileOrderLineLabel__1n1lr3j1";
5
+ var mobileOrderLineValue = "OrderTableMobile_mobileOrderLineValue__1n1lr3j2";
6
+
7
+ export { mobileOrderLine, mobileOrderLineLabel, mobileOrderLineValue };
@@ -0,0 +1,12 @@
1
+ import React from 'react';
2
+
3
+ declare type TMobileOrderLine = {
4
+ orderNumber?: string;
5
+ deliveryString?: React.ReactNode;
6
+ orderStatus?: string | null;
7
+ orderAmount?: string | null;
8
+ cancelled?: boolean;
9
+ };
10
+ declare const MobileOrderLine: ({ deliveryString, orderAmount, orderStatus, orderNumber, cancelled }: TMobileOrderLine) => JSX.Element;
11
+
12
+ export { MobileOrderLine };
@@ -0,0 +1,40 @@
1
+ import React from 'react';
2
+ import Skeleton from 'react-loading-skeleton';
3
+ import { mobileOrderLine, mobileOrderLineLabel, mobileOrderLineValue } from './OrderTableMobile.css.vanilla.js';
4
+ import { BodyText } from '../../typography/BodyText/BodyText.js';
5
+
6
+ const MobileOrderLine = ({
7
+ deliveryString,
8
+ orderAmount,
9
+ orderStatus,
10
+ orderNumber,
11
+ cancelled
12
+ }) => {
13
+ return /* @__PURE__ */ React.createElement("div", { className: mobileOrderLine }, /* @__PURE__ */ React.createElement(BodyText, { className: mobileOrderLineLabel, fontWeight: "semiBold" }, "ordernr"), /* @__PURE__ */ React.createElement(
14
+ BodyText,
15
+ {
16
+ className: mobileOrderLineValue,
17
+ textDecoration: cancelled ? "lineThrough" : null,
18
+ color: cancelled ? "darkest" : "black"
19
+ },
20
+ orderNumber || /* @__PURE__ */ React.createElement(Skeleton, null)
21
+ ), /* @__PURE__ */ React.createElement(BodyText, { className: mobileOrderLineLabel }, "leveransdatum"), /* @__PURE__ */ React.createElement("div", { className: mobileOrderLineValue }, deliveryString), /* @__PURE__ */ React.createElement(BodyText, { className: mobileOrderLineLabel }, "Status"), /* @__PURE__ */ React.createElement(
22
+ BodyText,
23
+ {
24
+ className: mobileOrderLineValue,
25
+ textDecoration: cancelled ? "lineThrough" : null,
26
+ color: cancelled ? "darkest" : "black"
27
+ },
28
+ orderStatus || /* @__PURE__ */ React.createElement(Skeleton, null)
29
+ ), /* @__PURE__ */ React.createElement(BodyText, { className: mobileOrderLineLabel }, "Kostnad"), /* @__PURE__ */ React.createElement(
30
+ BodyText,
31
+ {
32
+ className: mobileOrderLineValue,
33
+ textDecoration: cancelled ? "lineThrough" : null,
34
+ color: cancelled ? "darkest" : "black"
35
+ },
36
+ orderAmount || /* @__PURE__ */ React.createElement(Skeleton, null)
37
+ ));
38
+ };
39
+
40
+ export { MobileOrderLine };
@@ -0,0 +1,16 @@
1
+ .Pagination_paginationButtonWrapper__139elee0 {
2
+ padding: 0 4px;
3
+ }
4
+ .Pagination_leftPaginationButtonWrapper__139elee1 {
5
+ padding: 0 4px;
6
+ width: 44px;
7
+ }
8
+ .Pagination_flex__139elee2 {
9
+ display: flex;
10
+ align-items: flex-start;
11
+ justify-content: center;
12
+ }
13
+ .Pagination_paginationButton__139elee3 {
14
+ width: 32px;
15
+ height: 32px;
16
+ }
@@ -0,0 +1,8 @@
1
+ import './Pagination.css.ts.vanilla.css';
2
+
3
+ var flex = "Pagination_flex__139elee2";
4
+ var leftPaginationButtonWrapper = "Pagination_leftPaginationButtonWrapper__139elee1";
5
+ var paginationButton = "Pagination_paginationButton__139elee3";
6
+ var paginationButtonWrapper = "Pagination_paginationButtonWrapper__139elee0";
7
+
8
+ export { flex, leftPaginationButtonWrapper, paginationButton, paginationButtonWrapper };
@@ -0,0 +1,15 @@
1
+ import React from 'react';
2
+
3
+ declare type TPagination = {
4
+ totalItems?: number;
5
+ fetchItems: (page: number) => void;
6
+ currentPage: number;
7
+ itemsPerPage?: number;
8
+ setPage?: (page: number) => void;
9
+ numOfPaginationsToShow?: number;
10
+ rightIcon?: React.ReactNode;
11
+ leftIcon?: React.ReactNode;
12
+ };
13
+ declare function Pagination({ totalItems, currentPage, fetchItems, itemsPerPage, setPage, numOfPaginationsToShow, rightIcon, leftIcon }: TPagination): JSX.Element;
14
+
15
+ export { Pagination, TPagination };
@@ -0,0 +1,82 @@
1
+ import React, { useState } from 'react';
2
+ import { Box } from '../Box/Box.js';
3
+ import { flex, leftPaginationButtonWrapper, paginationButton, paginationButtonWrapper } from './Pagination.css.vanilla.js';
4
+ import { Button } from '../Button/Button.js';
5
+
6
+ function createPagination(totalItems, itemsPerPage, numOfPaginationsToShow) {
7
+ const amountOfPages = Math.ceil((totalItems || 0) / (itemsPerPage ?? 6));
8
+ if (amountOfPages === 0 || itemsPerPage === 0) {
9
+ return [];
10
+ }
11
+ const pagination = [];
12
+ let block = [];
13
+ let counter = 0;
14
+ new Array(amountOfPages).fill(0).map((_, index) => {
15
+ if (counter < (numOfPaginationsToShow ?? 4) - 1) {
16
+ counter++;
17
+ block.push(index);
18
+ if (index === amountOfPages - 1) {
19
+ pagination.push(block);
20
+ }
21
+ } else {
22
+ counter = 0;
23
+ block.push(index);
24
+ pagination.push(block);
25
+ block = [];
26
+ }
27
+ return null;
28
+ });
29
+ return pagination;
30
+ }
31
+ function Pagination({
32
+ totalItems,
33
+ currentPage,
34
+ fetchItems,
35
+ itemsPerPage,
36
+ setPage,
37
+ numOfPaginationsToShow = 4,
38
+ rightIcon,
39
+ leftIcon
40
+ }) {
41
+ const [currentIndex, setIndex] = useState(
42
+ Math.floor((currentPage - 1) / numOfPaginationsToShow)
43
+ );
44
+ const pagination = createPagination(
45
+ totalItems,
46
+ itemsPerPage,
47
+ numOfPaginationsToShow
48
+ );
49
+ return /* @__PURE__ */ React.createElement(Box, null, pagination && pagination.length > 0 && leftIcon && /* @__PURE__ */ React.createElement("div", { className: flex }, /* @__PURE__ */ React.createElement("div", { className: leftPaginationButtonWrapper }, currentIndex > 0 && /* @__PURE__ */ React.createElement(
50
+ Button,
51
+ {
52
+ variant: "secondary",
53
+ size: "icon",
54
+ onClick: () => {
55
+ setPage && setPage(currentPage - 1);
56
+ setIndex(currentIndex - 1);
57
+ },
58
+ className: paginationButton
59
+ },
60
+ leftIcon
61
+ )), pagination?.[currentIndex]?.map((page) => /* @__PURE__ */ React.createElement("div", { className: paginationButtonWrapper, key: page }, /* @__PURE__ */ React.createElement(
62
+ Button,
63
+ {
64
+ size: "icon",
65
+ variant: currentPage === page + 1 ? "tertiary" : "secondary",
66
+ className: paginationButton,
67
+ onClick: () => fetchItems(page + 1)
68
+ },
69
+ page + 1
70
+ ))), pagination.length > 1 && currentIndex < pagination.length - 1 && rightIcon && /* @__PURE__ */ React.createElement("div", { className: paginationButtonWrapper }, /* @__PURE__ */ React.createElement(
71
+ Button,
72
+ {
73
+ size: "icon",
74
+ variant: "secondary",
75
+ onClick: () => setIndex(currentIndex + 1),
76
+ className: paginationButton
77
+ },
78
+ rightIcon
79
+ ))));
80
+ }
81
+
82
+ export { Pagination };
@@ -0,0 +1,168 @@
1
+ @keyframes RippleContainer_slide__r9yswj0 {
2
+ 0% {
3
+ left: -100%;
4
+ }
5
+ 100% {
6
+ left: 120%;
7
+ }
8
+ }
9
+ .RippleContainer_afterBackground_primary__r9yswj1::after {
10
+ background-color: #FFE522;
11
+ }
12
+ .RippleContainer_afterBackground_secondary__r9yswj2::after {
13
+ background-color: #0069AE;
14
+ }
15
+ .RippleContainer_afterBackground_brandYellow__r9yswj3::after {
16
+ background-color: #FFE522;
17
+ }
18
+ .RippleContainer_afterBackground_brandBlue__r9yswj4::after {
19
+ background-color: #0069AE;
20
+ }
21
+ .RippleContainer_afterBackground_brandPurple__r9yswj5::after {
22
+ background-color: #A71680;
23
+ }
24
+ .RippleContainer_afterBackground_brandPrio__r9yswj6::after {
25
+ background-color: #a80073;
26
+ }
27
+ .RippleContainer_afterBackground_yellowLighter__r9yswj7::after {
28
+ background-color: #FFFBE7;
29
+ }
30
+ .RippleContainer_afterBackground_yellowLight__r9yswj8::after {
31
+ background-color: #FFF7D1;
32
+ }
33
+ .RippleContainer_afterBackground_blueLight__r9yswj9::after {
34
+ background-color: #ECF7FE;
35
+ }
36
+ .RippleContainer_afterBackground_blueLighter__r9yswja::after {
37
+ background-color: #D3EDFD;
38
+ }
39
+ .RippleContainer_afterBackground_blueMedium__r9yswjb::after {
40
+ background-color: #92B9D3;
41
+ }
42
+ .RippleContainer_afterBackground_greenLight__r9yswjc::after {
43
+ background-color: #F2FDF2;
44
+ }
45
+ .RippleContainer_afterBackground_greenMedium__r9yswjd::after {
46
+ background-color: #BEE5BE;
47
+ }
48
+ .RippleContainer_afterBackground_redLight__r9yswje::after {
49
+ background-color: #FCE9E9;
50
+ }
51
+ .RippleContainer_afterBackground_recipeVego__r9yswjf::after {
52
+ background-color: #65DB69;
53
+ }
54
+ .RippleContainer_afterBackground_recipeLactose__r9yswjg::after {
55
+ background-color: #8CCDF0;
56
+ }
57
+ .RippleContainer_afterBackground_recipeGluten__r9yswjh::after {
58
+ background-color: #D5642A;
59
+ }
60
+ .RippleContainer_afterBackground_link__r9yswji::after {
61
+ background-color: #0072BB;
62
+ }
63
+ .RippleContainer_afterBackground_white__r9yswjj::after {
64
+ background-color: #FFFFFF;
65
+ }
66
+ .RippleContainer_afterBackground_black__r9yswjk::after {
67
+ background-color: #000000;
68
+ }
69
+ .RippleContainer_afterBackground_lightest__r9yswjl::after {
70
+ background-color: #F7F7F7;
71
+ }
72
+ .RippleContainer_afterBackground_lighter__r9yswjm::after {
73
+ background-color: #F1F1F1;
74
+ }
75
+ .RippleContainer_afterBackground_light__r9yswjn::after {
76
+ background-color: #E8E8E8;
77
+ }
78
+ .RippleContainer_afterBackground_medium__r9yswjo::after {
79
+ background-color: #DBDBDB;
80
+ }
81
+ .RippleContainer_afterBackground_mediumDark__r9yswjp::after {
82
+ background-color: #6C6C6C;
83
+ }
84
+ .RippleContainer_afterBackground_dark__r9yswjq::after {
85
+ background-color: #979797;
86
+ }
87
+ .RippleContainer_afterBackground_darker__r9yswjr::after {
88
+ background-color: #4A4A4A;
89
+ }
90
+ .RippleContainer_afterBackground_darkest__r9yswjs::after {
91
+ background-color: #333333;
92
+ }
93
+ .RippleContainer_afterBackground_buttonGray__r9yswjt::after {
94
+ background-color: #E5E4E5;
95
+ }
96
+ .RippleContainer_afterBackground_disabledGray__r9yswju::after {
97
+ background-color: #B8B8B8;
98
+ }
99
+ .RippleContainer_afterBackground_disabledDarkGray__r9yswjv::after {
100
+ background-color: #5c5c5c;
101
+ }
102
+ .RippleContainer_afterBackground_placeholder__r9yswjw::after {
103
+ background-color: #8f8f8f;
104
+ }
105
+ .RippleContainer_afterBackground_border__r9yswjx::after {
106
+ background-color: #0069AE;
107
+ }
108
+ .RippleContainer_afterBackground_boxShadow__r9yswjy::after {
109
+ background-color: #E1E1E1;
110
+ }
111
+ .RippleContainer_afterBackground_boxShadowActive__r9yswjz::after {
112
+ background-color: rgba(7, 52, 99, 0.15);
113
+ }
114
+ .RippleContainer_afterBackground_alertRed__r9yswj10::after {
115
+ background-color: #E02721;
116
+ }
117
+ .RippleContainer_afterBackground_alertBlue__r9yswj11::after {
118
+ background-color: #0072BB;
119
+ }
120
+ .RippleContainer_afterBackground_alertGreen__r9yswj12::after {
121
+ background-color: #3F9A3C;
122
+ }
123
+ .RippleContainer_afterBackground_darkOverlay__r9yswj13::after {
124
+ background-color: rgba(0, 0, 0, 0.6);
125
+ }
126
+ .RippleContainer_afterBackground_transparent__r9yswj14::after {
127
+ background-color: #ffffff00;
128
+ }
129
+ .RippleContainer_afterBackground_brandBlueHover__r9yswj15::after {
130
+ background-color: #005C99;
131
+ }
132
+ .RippleContainer_afterBackground_brandYellowHover__r9yswj16::after {
133
+ background-color: #F5D800;
134
+ }
135
+ .RippleContainer_afterBackground_brandPrioHover__r9yswj17::after {
136
+ background-color: #90136F;
137
+ }
138
+ .RippleContainer_afterBackground_brandBlueActive__r9yswj18::after {
139
+ background-color: #004D80;
140
+ }
141
+ .RippleContainer_afterBackground_brandYellowActive__r9yswj19::after {
142
+ background-color: #DBC100;
143
+ }
144
+ .RippleContainer_afterBackground_brandPrioActive__r9yswj1a::after {
145
+ background-color: #7A105E;
146
+ }
147
+ .RippleContainer_afterBackground_none__r9yswj1b::after {
148
+ background-color: none;
149
+ }
150
+ .RippleContainer_rippleContainer__r9yswj1c {
151
+ position: relative;
152
+ overflow: hidden;
153
+ cursor: pointer;
154
+ }
155
+ .RippleContainer_rippleContainer__r9yswj1c::after {
156
+ content: "";
157
+ height: 200%;
158
+ left: -100%;
159
+ opacity: 0.2;
160
+ position: absolute;
161
+ top: -30%;
162
+ transform: rotate(35deg);
163
+ width: 50px;
164
+ z-index: 2;
165
+ }
166
+ .RippleContainer_rippleContainer__r9yswj1c:hover::after {
167
+ animation: RippleContainer_slide__r9yswj0 750ms cubic-bezier(0.19, 1, 0.22, 1) forwards;
168
+ }