@dnanpm/styleguide 3.12.1 → 3.12.3

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 (33) hide show
  1. package/build/cjs/assets/fonts/fonts.css.js +3 -0
  2. package/build/cjs/components/Breadcrumb/Breadcrumb.d.ts +42 -0
  3. package/build/cjs/components/Breadcrumb/Breadcrumb.js +90 -0
  4. package/build/cjs/components/ButtonCard/ButtonCard.js +3 -5
  5. package/build/cjs/components/Carousel/Carousel.d.ts +11 -14
  6. package/build/cjs/components/Carousel/Carousel.js +52 -40
  7. package/build/cjs/components/Hero/Hero.d.ts +0 -6
  8. package/build/cjs/components/Hero/Hero.js +3 -3
  9. package/build/cjs/components/index.d.ts +1 -0
  10. package/build/cjs/index.js +2 -0
  11. package/build/cjs/themes/globalStyles.js +1 -0
  12. package/build/cjs/themes/theme.d.ts +9 -2
  13. package/build/cjs/themes/themeComponents/breakpoints.d.ts +9 -4
  14. package/build/cjs/utils/styledUtils.d.ts +22 -1
  15. package/build/cjs/utils/styledUtils.js +26 -6
  16. package/build/es/assets/fonts/fonts.css.js +1 -0
  17. package/build/es/components/Breadcrumb/Breadcrumb.d.ts +42 -0
  18. package/build/es/components/Breadcrumb/Breadcrumb.js +82 -0
  19. package/build/es/components/ButtonCard/ButtonCard.js +3 -5
  20. package/build/es/components/Carousel/Carousel.d.ts +11 -14
  21. package/build/es/components/Carousel/Carousel.js +52 -40
  22. package/build/es/components/Hero/Hero.d.ts +0 -6
  23. package/build/es/components/Hero/Hero.js +3 -3
  24. package/build/es/components/index.d.ts +1 -0
  25. package/build/es/index.js +1 -0
  26. package/build/es/themes/globalStyles.js +1 -0
  27. package/build/es/themes/theme.d.ts +9 -2
  28. package/build/es/themes/themeComponents/breakpoints.d.ts +9 -4
  29. package/build/es/utils/styledUtils.d.ts +22 -1
  30. package/build/es/utils/styledUtils.js +26 -6
  31. package/package.json +12 -8
  32. package/build/cjs/build/assets/fonts/fonts.css +0 -129
  33. package/build/es/build/assets/fonts/fonts.css +0 -129
@@ -0,0 +1,82 @@
1
+ import React__default from 'react';
2
+ import { ChevronRight } from '@dnanpm/icons';
3
+ import { styled } from 'styled-components';
4
+ import theme from '../../themes/theme.js';
5
+ import { getMultipliedSize } from '../../utils/styledUtils.js';
6
+
7
+ const BreadcrumbNav = styled.nav `
8
+ font-size: ${theme.fontSize.s};
9
+ font-weight: ${theme.fontWeight.medium};
10
+ `;
11
+ const BreadcrumbList = styled.ol `
12
+ display: flex;
13
+ align-items: center;
14
+ flex-wrap: nowrap;
15
+ list-style: none;
16
+ margin: ${getMultipliedSize(theme.base.baseHeight, 2)} 0;
17
+ padding: 0;
18
+ gap: ${getMultipliedSize(theme.base.baseHeight, 0.5)};
19
+ overflow: visible;
20
+ container: breadcrumb / inline-size;
21
+
22
+ /* Responsive behavior: show only last 2 items when container < 600px */
23
+ @container (max-width: 599px) {
24
+ li:not(:nth-last-child(-n + 2)) {
25
+ display: none;
26
+ }
27
+ }
28
+ `;
29
+ const BreadcrumbListItem = styled.li `
30
+ display: flex;
31
+ align-items: center;
32
+ gap: ${getMultipliedSize(theme.base.baseHeight, 0.5)};
33
+
34
+ &:last-child {
35
+ min-width: 0;
36
+ }
37
+
38
+ a {
39
+ &:focus-visible {
40
+ outline: none;
41
+ border-radius: ${theme.radius.s};
42
+ box-shadow:
43
+ 0px 0px 0px 2px ${theme.color.focus.light},
44
+ 0px 0px 0px 4px ${theme.color.focus.dark};
45
+ }
46
+ }
47
+
48
+ span {
49
+ flex: 1 1 0%;
50
+ white-space: nowrap;
51
+ overflow: hidden;
52
+ text-overflow: ellipsis;
53
+ }
54
+ `;
55
+ const Breadcrumb = ({ 'data-testid': dataTestId, ariaLabel, className, items, linkComponent: LinkComponent, linkProps = {}, }) => {
56
+ if (!items || items.length === 0) {
57
+ return null;
58
+ }
59
+ const renderItem = (item, index) => {
60
+ const isLastItem = index === items.length - 1;
61
+ if (isLastItem || !item.href) {
62
+ return React__default.createElement("span", { "aria-current": isLastItem ? 'page' : undefined }, item.label);
63
+ }
64
+ if (LinkComponent) {
65
+ return (React__default.createElement(LinkComponent, Object.assign({ href: item.href, itemProp: "item", itemScope: true, itemType: "https://schema.org/WebPage" }, linkProps),
66
+ React__default.createElement("span", { itemProp: "name" }, item.label)));
67
+ }
68
+ return (React__default.createElement("a", { href: item.href, itemProp: "item", itemScope: true, itemType: "https://schema.org/WebPage" },
69
+ React__default.createElement("span", { itemProp: "name" }, item.label)));
70
+ };
71
+ return (React__default.createElement(BreadcrumbNav, { "aria-label": ariaLabel, className: className, "data-testid": dataTestId },
72
+ React__default.createElement(BreadcrumbList, { itemScope: true, itemType: "https://schema.org/BreadcrumbList" }, items.map((item, index) => {
73
+ var _a;
74
+ const isLastItem = index === items.length - 1;
75
+ return (React__default.createElement(BreadcrumbListItem, { itemProp: "itemListElement", itemScope: true, itemType: "https://schema.org/ListItem", key: `breadcrumb-${item.label}-${(_a = item.href) !== null && _a !== void 0 ? _a : 'nolink'}` },
76
+ renderItem(item, index),
77
+ React__default.createElement("meta", { itemProp: "position", content: (index + 1).toString() }),
78
+ !isLastItem && (React__default.createElement(ChevronRight, { color: theme.color.background.pink.default, size: "0.9rem" }))));
79
+ }))));
80
+ };
81
+
82
+ export { Breadcrumb as default };
@@ -9,7 +9,7 @@ import Icon from '../Icon/Icon.js';
9
9
  const ButtonCardWrapper = styled.button `
10
10
  display: block;
11
11
  padding: 0;
12
- border: 0 none;
12
+ border: 0;
13
13
  width: 100%;
14
14
  background-color: transparent;
15
15
  cursor: pointer;
@@ -17,6 +17,7 @@ const ButtonCardWrapper = styled.button `
17
17
  font-size: ${theme.fontSize.default};
18
18
  line-height: ${theme.lineHeight.default};
19
19
  color: ${theme.color.text.black};
20
+ text-decoration: none;
20
21
 
21
22
  &:focus-visible {
22
23
  border: 1px solid ${theme.color.focus.light};
@@ -25,13 +26,12 @@ const ButtonCardWrapper = styled.button `
25
26
  outline: none;
26
27
 
27
28
  & > div {
28
- border: 0 none;
29
+ border: 0;
29
30
  }
30
31
  }
31
32
 
32
33
  &:hover {
33
34
  color: ${theme.color.text.black};
34
- text-decoration: none;
35
35
  }
36
36
  `;
37
37
  const StyledBox = styled(Box) `
@@ -66,7 +66,6 @@ const Title = styled.div `
66
66
  font-size: ${theme.fontSize.default};
67
67
  line-height: ${theme.lineHeight.default};
68
68
  font-weight: ${theme.fontWeight.bold};
69
-
70
69
  text-overflow: ellipsis;
71
70
  overflow: hidden;
72
71
  white-space: nowrap;
@@ -89,7 +88,6 @@ const Subtitle = styled.div `
89
88
  font-size: ${theme.fontSize.s};
90
89
  line-height: ${theme.lineHeight.s};
91
90
  font-weight: ${theme.fontWeight.medium};
92
-
93
91
  text-overflow: ellipsis;
94
92
  overflow: hidden;
95
93
  white-space: nowrap;
@@ -1,11 +1,5 @@
1
1
  import type { MouseEvent, ReactNode } from 'react';
2
2
  import React from 'react';
3
- interface Responsive {
4
- minItems: number;
5
- maxItems: number;
6
- minWidth: number;
7
- maxWidth: number;
8
- }
9
3
  interface Props {
10
4
  /**
11
5
  * Unique ID for the component
@@ -50,10 +44,12 @@ interface Props {
50
44
  */
51
45
  className?: string;
52
46
  /**
53
- * Allows to define responsive configuration
54
- * If not provided, visibleItems property will be used
47
+ * Allows for responsive behavior in the carousel.
48
+ * Shows as many items as possible; each item requires a defined width.
49
+ * This overrides the `visibleItems` prop.
50
+ * @default false
55
51
  */
56
- responsive?: Partial<Responsive>;
52
+ responsive?: boolean;
57
53
  /**
58
54
  * Allows to pass a screen reader label for the pagination item next to the current slide number
59
55
  */
@@ -73,12 +69,13 @@ interface Props {
73
69
  */
74
70
  swipeStep?: number;
75
71
  }
76
- declare const SlideItem: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, Required<{
77
- $visibleItems?: Props["visibleItems"];
78
- }> & {
79
- $itemWidthCorrection: number;
72
+ declare const SlideItem: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
80
73
  $isSwiping: boolean;
81
- }>> & string;
74
+ $responsive: boolean;
75
+ $gap: number;
76
+ } & Partial<Required<{
77
+ $visibleItems: Props["visibleItems"];
78
+ }>>>> & string;
82
79
  /** @visibleName Carousel */
83
80
  declare const Carousel: ({ "data-testid": dataTestId, ...props }: Props) => React.JSX.Element;
84
81
  /** @component */
@@ -33,7 +33,6 @@ const SlidesWrapper = styled.div `
33
33
  display: flex;
34
34
  width: 100%;
35
35
  height: 100%;
36
- gap: ${({ $gap }) => $gap}rem;
37
36
  transition-property: transform;
38
37
  transform: translate3d(0px, 0, 0);
39
38
  transition-duration: 0ms;
@@ -44,9 +43,14 @@ const SlideItem = styled.div `
44
43
  display: block;
45
44
  position: relative;
46
45
  flex-shrink: 0;
47
- flex-basis: calc(
48
- ${({ $visibleItems, $itemWidthCorrection }) => `(100% / ${$visibleItems}) - ${$itemWidthCorrection}px`}
49
- );
46
+ padding-right: ${({ $gap }) => $gap}rem;
47
+
48
+ ${({ $responsive, $visibleItems }) => !$responsive && $visibleItems
49
+ ? `flex-basis: calc(100% / ${$visibleItems});`
50
+ : `
51
+ flex-basis: auto;
52
+ width: max-content;
53
+ `}
50
54
 
51
55
  a {
52
56
  pointer-events: ${({ $isSwiping }) => ($isSwiping ? 'none' : 'auto')};
@@ -138,53 +142,51 @@ const Counter = styled.span `
138
142
  `;
139
143
  /** @visibleName Carousel */
140
144
  const Carousel = (_a) => {
141
- var _b;
145
+ var _b, _c;
142
146
  var { 'data-testid': dataTestId } = _a, props = __rest(_a, ['data-testid']);
143
147
  const slidesWrapperRef = useRef(null);
144
148
  const scrollbarRef = useRef(null);
145
149
  const knobRef = useRef(null);
146
- const { isMobile, width } = useWindowSize(theme.breakpoints.md);
150
+ const firstItemRef = useRef(null);
151
+ const { isMobile, width: windowWidth } = useWindowSize(theme.breakpoints.md);
147
152
  const [currentIndex, setCurrentIndex] = useState(0);
148
153
  const [isSwiping, setIsSwiping] = useState(false);
149
- const [calculatedItems, setCalculatedItems] = useState(props.visibleItems || (isMobile ? 1.2 : 1));
154
+ const [autoVisibleItems, setAutoVisibleItems] = useState(null);
150
155
  useEffect(() => {
151
- const calculateVisibleItems = () => {
152
- const defaultValue = props.visibleItems || (isMobile ? 1.2 : 1);
153
- const { minItems, maxItems, minWidth, maxWidth } = props.responsive || {};
154
- if (!width || !minItems || !maxItems || !minWidth || !maxWidth) {
155
- return defaultValue;
156
- }
157
- const calculatedMaxItems = Children.count(props.children) === 1 ? 1 : maxItems;
158
- if (width < minWidth) {
159
- return minItems;
156
+ if (props.responsive) {
157
+ const container = slidesWrapperRef.current;
158
+ const firstItem = firstItemRef.current;
159
+ if (container && firstItem) {
160
+ Array.from(container.children).forEach(itemElement => {
161
+ const item = itemElement;
162
+ item.style.flexBasis = '';
163
+ item.style.width = '';
164
+ });
165
+ const containerWidth = container.offsetWidth;
166
+ const itemWidth = firstItem.offsetWidth;
167
+ if (itemWidth > 0) {
168
+ const realVisibleItems = containerWidth / itemWidth;
169
+ setAutoVisibleItems(Math.max(1, realVisibleItems));
170
+ }
160
171
  }
161
- if (width > maxWidth) {
162
- return calculatedMaxItems;
163
- }
164
- return minItems + ((width - minWidth) / (maxWidth - minWidth)) * (maxItems - minItems);
165
- };
166
- const timeoutId = setTimeout(() => {
167
- setCalculatedItems(calculateVisibleItems());
168
- }, 100);
169
- return () => clearTimeout(timeoutId);
170
- }, [width, isMobile, props.responsive, props.visibleItems, props.children]);
172
+ }
173
+ else {
174
+ setAutoVisibleItems(null);
175
+ }
176
+ }, [props.responsive, windowWidth, props.children]);
171
177
  const getStep = (step, visibleItems) => {
172
178
  if (step > visibleItems) {
173
179
  return Math.floor(visibleItems);
174
180
  }
175
181
  return Math.floor(step);
176
182
  };
177
- const visibleItems = props.visibleItems || calculatedItems;
183
+ const visibleItems = (_b = autoVisibleItems !== null && autoVisibleItems !== void 0 ? autoVisibleItems : props.visibleItems) !== null && _b !== void 0 ? _b : (isMobile ? 1.2 : 1);
178
184
  const slidesWrapperGapSizePx = 20;
179
185
  const slidesCount = Children.count(props.children);
180
186
  const slideScreensCount = Math.max(1, slidesCount - Math.floor(visibleItems) + 1);
181
- const step = getStep((_b = props.swipeStep) !== null && _b !== void 0 ? _b : 1, visibleItems);
187
+ const step = getStep((_c = props.swipeStep) !== null && _c !== void 0 ? _c : 1, visibleItems);
182
188
  const currentStepIndex = Math.ceil(currentIndex / step);
183
189
  const totalSwipeSteps = Math.ceil(slideScreensCount / step + ((slideScreensCount - 1) % step !== 0 ? 1 : 0));
184
- const itemWidthCorrectionRatio = (slidesWrapperGapSizePx * visibleItems) % Math.floor(visibleItems) === 0
185
- ? (visibleItems - 1) / visibleItems
186
- : Math.floor(visibleItems) / visibleItems;
187
- const itemWidthCorrection = itemWidthCorrectionRatio * slidesWrapperGapSizePx;
188
190
  const data = useMemo(() => ({
189
191
  startX: 0,
190
192
  startTime: 0,
@@ -320,12 +322,10 @@ const Carousel = (_a) => {
320
322
  useEffect(() => {
321
323
  if (slidesWrapperRef.current && scrollbarRef.current) {
322
324
  const isRest = Children.count(props.children) - (currentIndex + visibleItems) < 0;
323
- data.itemWidth =
324
- slidesWrapperRef.current.offsetWidth / visibleItems - itemWidthCorrection;
325
+ data.itemWidth = slidesWrapperRef.current.offsetWidth / visibleItems;
325
326
  data.scrollWidth = slidesWrapperRef.current.scrollWidth;
326
327
  data.lastItemX =
327
- (data.itemWidth + slidesWrapperGapSizePx) *
328
- (Children.count(props.children) - visibleItems) -
328
+ data.itemWidth * (Children.count(props.children) - visibleItems) -
329
329
  (isRest ? slidesWrapperGapSizePx * (Math.ceil(visibleItems) - visibleItems) : 0);
330
330
  data.scrollbarToSlidesRatio =
331
331
  data.lastItemX /
@@ -334,14 +334,26 @@ const Carousel = (_a) => {
334
334
  let slidesTransform = 0;
335
335
  if (Children.count(props.children) >= visibleItems) {
336
336
  slidesTransform =
337
- data.itemWidth * currentIndex +
338
- slidesWrapperGapSizePx * currentIndex -
337
+ data.itemWidth * currentIndex -
339
338
  (isRest ? data.itemWidth * (visibleItems % 1) + slidesWrapperGapSizePx : 0);
340
339
  }
341
340
  setElementTransform(slidesWrapperRef, -slidesTransform);
342
341
  setElementTransform(knobRef, slidesTransform / data.scrollbarToSlidesRatio);
343
342
  }
344
- }, [currentIndex, data, itemWidthCorrection, props.children, slideScreensCount, visibleItems]);
343
+ }, [currentIndex, data, props.children, slideScreensCount, visibleItems]);
344
+ useEffect(() => {
345
+ var _a;
346
+ if (props.responsive && autoVisibleItems) {
347
+ const items = (_a = slidesWrapperRef.current) === null || _a === void 0 ? void 0 : _a.children;
348
+ if (items) {
349
+ Array.from(items).forEach(itemElement => {
350
+ const item = itemElement;
351
+ item.style.flexBasis = `calc(100% / ${autoVisibleItems})`;
352
+ item.style.width = '';
353
+ });
354
+ }
355
+ }
356
+ }, [autoVisibleItems, props.responsive]);
345
357
  return (React__default.createElement(CarouselWrapper, { id: props.id, className: props.className, "data-testid": dataTestId },
346
358
  React__default.createElement(Header, { "data-testid": dataTestId && `${dataTestId}-header` },
347
359
  props.title && React__default.createElement(Title, null, props.title),
@@ -353,7 +365,7 @@ const Carousel = (_a) => {
353
365
  React__default.createElement(ButtonArrow, { direction: "left", "aria-label": props.previousAriaLabel, onClick: handleNavigationButtonPreviousClick, disabled: currentIndex <= 0, type: "button" }),
354
366
  React__default.createElement(ButtonArrow, { direction: "right", "aria-label": props.nextAriaLabel, onClick: handleNavigationButtonNextClick, disabled: currentIndex + visibleItems >= Children.count(props.children), type: "button" }))),
355
367
  React__default.createElement(Content, { "data-testid": dataTestId && `${dataTestId}-content` },
356
- React__default.createElement(SlidesWrapper, { ref: slidesWrapperRef, onPointerDown: handleSlidesPointerDown, "$gap": slidesWrapperGapSizePx / 16 }, Children.map(props.children, child => (React__default.createElement(SlideItem, { "$visibleItems": visibleItems, "$itemWidthCorrection": itemWidthCorrection, "$isSwiping": isSwiping, onPointerDown: handlePointerDown }, child))))),
368
+ React__default.createElement(SlidesWrapper, { ref: slidesWrapperRef, onPointerDown: handleSlidesPointerDown }, Children.map(props.children, (child, index) => (React__default.createElement(SlideItem, { ref: index === 0 ? firstItemRef : undefined, "$visibleItems": visibleItems, "$isSwiping": isSwiping, onPointerDown: handlePointerDown, "$responsive": Boolean(props.responsive), "$gap": slidesWrapperGapSizePx / 16 }, child))))),
357
369
  React__default.createElement(Footer, { "data-testid": dataTestId && `${dataTestId}-footer` },
358
370
  React__default.createElement(Pagination, null, [...Array(totalSwipeSteps).keys()].map((value, index) => (React__default.createElement(PaginationItem, { key: value, "aria-label": props.paginationAriaLabel &&
359
371
  `${props.paginationAriaLabel} ${index + 1}`, "aria-current": Math.ceil(currentIndex / step) === index, "$isActive": Math.ceil(currentIndex / step) === index, onClick: handlePaginationItemClick, type: "button" })))),
@@ -34,12 +34,6 @@ interface HeroProps {
34
34
  * Background color when no image is provided
35
35
  */
36
36
  backgroundColor?: string;
37
- /**
38
- * Enable gradient overlay on background
39
- *
40
- * @default false
41
- */
42
- hasGradient?: boolean;
43
37
  /**
44
38
  * Logo image component for logo-style heroes
45
39
  */
@@ -27,9 +27,9 @@ const HeroImage = styled.div `
27
27
  height: ${HERO_CONSTANTS.mobileHeight}px;
28
28
  background-color: ${({ $backgroundColor }) => $backgroundColor || 'transparent'};
29
29
 
30
- ${({ $hasGradient }) => $hasGradient &&
30
+ ${({ $backgroundColor }) => $backgroundColor &&
31
31
  `
32
- linear-gradient(180deg, ${theme.color.background.plum.default}${theme.color.transparency.T0} 0%, ${theme.color.background.plum.default}${theme.color.transparency.T30} 100%);
32
+ background-image: linear-gradient(180deg, ${theme.color.background.plum.default}${theme.color.transparency.T0} 0%, ${theme.color.background.plum.default}${theme.color.transparency.T30} 100%);
33
33
  background-size: 100% 33.33%;
34
34
  background-repeat: no-repeat;
35
35
  background-position: bottom;
@@ -176,7 +176,7 @@ const Hero = (_a) => {
176
176
  var { variant = 'default', headingLevel = 'h1', Image = 'img', LogoImage = 'img', 'data-testid': dataTestId } = _a, props = __rest(_a, ["variant", "headingLevel", "Image", "LogoImage", 'data-testid']);
177
177
  const HeadingTag = headingLevel;
178
178
  return (React__default.createElement(HeroContainer, { "$variant": variant, className: props.className, "data-testid": dataTestId },
179
- React__default.createElement(HeroImage, { "$hasGradient": props.hasGradient, "$backgroundColor": props.backgroundColor },
179
+ React__default.createElement(HeroImage, { "$backgroundColor": props.backgroundColor },
180
180
  props.logoImageProps && (React__default.createElement(LogoImageWrap, null,
181
181
  React__default.createElement(LogoImageContainer, null, renderImage(LogoImage, props.logoImageProps)))),
182
182
  !props.logoImageProps && props.imageProps && renderImage(Image, props.imageProps)),
@@ -2,6 +2,7 @@ export { default as Accordion } from './Accordion/Accordion';
2
2
  export { default as AccordionItem } from './AccordionItem/AccordionItem';
3
3
  export { default as AmountSelector } from './AmountSelector/AmountSelector';
4
4
  export { default as Box } from './Box/Box';
5
+ export { default as Breadcrumb } from './Breadcrumb/Breadcrumb';
5
6
  export { default as Button } from './Button/Button';
6
7
  export { default as ButtonArrow } from './ButtonArrow/ButtonArrow';
7
8
  export { default as ButtonCard } from './ButtonCard/ButtonCard';
package/build/es/index.js CHANGED
@@ -2,6 +2,7 @@ export { default as Accordion } from './components/Accordion/Accordion.js';
2
2
  export { default as AccordionItem } from './components/AccordionItem/AccordionItem.js';
3
3
  export { default as AmountSelector } from './components/AmountSelector/AmountSelector.js';
4
4
  export { default as Box } from './components/Box/Box.js';
5
+ export { default as Breadcrumb } from './components/Breadcrumb/Breadcrumb.js';
5
6
  export { default as Button } from './components/Button/Button.js';
6
7
  export { default as ButtonArrow } from './components/ButtonArrow/ButtonArrow.js';
7
8
  export { default as ButtonCard } from './components/ButtonCard/ButtonCard.js';
@@ -1,3 +1,4 @@
1
+ import '../assets/fonts/fonts.css.js';
1
2
  import { media } from '../utils/styledUtils.js';
2
3
  import { css, createGlobalStyle } from 'styled-components';
3
4
  import theme from './theme.js';
@@ -9,7 +9,14 @@ declare const theme: {
9
9
  unit: string;
10
10
  };
11
11
  };
12
- breakpoints: import("./themeComponents/breakpoints").ViewBreakpoints;
12
+ breakpoints: {
13
+ readonly xxl: 1440;
14
+ readonly xl: 1200;
15
+ readonly lg: 992;
16
+ readonly md: 768;
17
+ readonly sm: 576;
18
+ readonly xs: 480;
19
+ };
13
20
  color: {
14
21
  default: {
15
22
  pink: string;
@@ -155,7 +162,7 @@ declare const theme: {
155
162
  h1: string;
156
163
  h2: string;
157
164
  };
158
- media: Record<string | number, (l: TemplateStringsArray, ...p: (string | number)[]) => string>;
165
+ media: Record<"xxl" | "xl" | "lg" | "md" | "sm" | "xs", (l: TemplateStringsArray, ...p: (string | number)[]) => ReturnType<typeof import("styled-components").css>>;
159
166
  radius: {
160
167
  default: string;
161
168
  s: string;
@@ -1,5 +1,10 @@
1
- export interface ViewBreakpoints {
2
- [key: string]: number;
3
- }
4
- declare const breakpoints: ViewBreakpoints;
1
+ declare const breakpoints: {
2
+ readonly xxl: 1440;
3
+ readonly xl: 1200;
4
+ readonly lg: 992;
5
+ readonly md: 768;
6
+ readonly sm: 576;
7
+ readonly xs: 480;
8
+ };
9
+ export type ViewBreakpoints = typeof breakpoints;
5
10
  export default breakpoints;
@@ -1,3 +1,4 @@
1
+ import { css } from '../themes/styled';
1
2
  export declare const getMultipliedSize: (base: {
2
3
  value: number;
3
4
  unit: string;
@@ -6,4 +7,24 @@ export declare const getDividedSize: (base: {
6
7
  value: number;
7
8
  unit: string;
8
9
  }, divide: number) => string;
9
- export declare const media: Record<string | number, (l: TemplateStringsArray, ...p: (string | number)[]) => string>;
10
+ /**
11
+ * Media query helpers for responsive design.
12
+ *
13
+ * @example
14
+ * ```ts
15
+ * const StyledDiv = styled.div`
16
+ * font-size: 1rem;
17
+ * ${media.md`font-size: 1.2rem;`}
18
+ * ${media.lg`font-size: 1.5rem;`}
19
+ * `;
20
+ * ```
21
+ *
22
+ * Available breakpoints:
23
+ * - `xs`: 480px
24
+ * - `sm`: 576px
25
+ * - `md`: 768px
26
+ * - `lg`: 992px
27
+ * - `xl`: 1200px
28
+ * - `xxl`: 1440px
29
+ */
30
+ export declare const media: Record<"xxl" | "xl" | "lg" | "md" | "sm" | "xs", (l: TemplateStringsArray, ...p: (string | number)[]) => ReturnType<typeof css>>;
@@ -3,12 +3,32 @@ import breakpoints from '../themes/themeComponents/breakpoints.js';
3
3
 
4
4
  const getMultipliedSize = (base, multiply) => `${multiply * base.value}${base.unit}`;
5
5
  const getDividedSize = (base, divide) => `${base.value / divide}${base.unit}`;
6
- const media = Object.keys(breakpoints).reduce((acc, label) => {
7
- acc[label] = (literals, ...placeholders) => css `
8
- @media (min-width: ${breakpoints[label]}px) {
9
- ${css(literals, ...placeholders)};
10
- }
11
- `.join('');
6
+ /**
7
+ * Media query helpers for responsive design.
8
+ *
9
+ * @example
10
+ * ```ts
11
+ * const StyledDiv = styled.div`
12
+ * font-size: 1rem;
13
+ * ${media.md`font-size: 1.2rem;`}
14
+ * ${media.lg`font-size: 1.5rem;`}
15
+ * `;
16
+ * ```
17
+ *
18
+ * Available breakpoints:
19
+ * - `xs`: 480px
20
+ * - `sm`: 576px
21
+ * - `md`: 768px
22
+ * - `lg`: 992px
23
+ * - `xl`: 1200px
24
+ * - `xxl`: 1440px
25
+ */
26
+ const media = Object.keys(breakpoints).reduce((acc, key) => {
27
+ acc[key] = (literals, ...placeholders) => css `
28
+ @media (min-width: ${breakpoints[key]}px) {
29
+ ${css(literals, ...placeholders)}
30
+ }
31
+ `;
12
32
  return acc;
13
33
  }, {});
14
34
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@dnanpm/styleguide",
3
3
  "sideEffects": false,
4
- "version": "v3.12.1",
4
+ "version": "v3.12.3",
5
5
  "main": "build/cjs/index.js",
6
6
  "module": "build/es/index.js",
7
7
  "jsnext:main": "build/es/index.js",
@@ -18,7 +18,8 @@
18
18
  ],
19
19
  "repository": {
20
20
  "type": "git",
21
- "url": "git@github.com:DNA-Online-Services/styleguide.git"
21
+ "url": "git@github.com:DNA-Online-Services/styleguide.git",
22
+ "directory": "packages/styleguide"
22
23
  },
23
24
  "scripts": {
24
25
  "build": "rm -rf build && rollup -c",
@@ -46,11 +47,11 @@
46
47
  "@babel/core": "^7.26.10",
47
48
  "@babel/preset-env": "^7.26.0",
48
49
  "@babel/preset-react": "^7.26.3",
49
- "@babel/preset-typescript": "^7.27.1",
50
+ "@babel/preset-typescript": "^7.28.5",
50
51
  "@dnanpm/icons": "^2.0.9",
51
- "@rollup/plugin-commonjs": "^28.0.3",
52
+ "@rollup/plugin-commonjs": "^29.0.0",
52
53
  "@rollup/plugin-node-resolve": "^16.0.3",
53
- "@rollup/plugin-typescript": "^12.1.2",
54
+ "@rollup/plugin-typescript": "^12.3.0",
54
55
  "@testing-library/jest-dom": "^6.6.3",
55
56
  "@testing-library/react": "^16.3.0",
56
57
  "@testing-library/user-event": "^14.5.2",
@@ -71,7 +72,7 @@
71
72
  "eslint-config-airbnb-typescript": "^17.1.0",
72
73
  "eslint-config-prettier": "^10.1.8",
73
74
  "eslint-plugin-import": "2.32.0",
74
- "eslint-plugin-jsdoc": "^61.1.4",
75
+ "eslint-plugin-jsdoc": "^61.1.12",
75
76
  "eslint-plugin-jsx-a11y": "^6.10.2",
76
77
  "eslint-plugin-prefer-arrow": "^1.2.3",
77
78
  "eslint-plugin-react": "^7.37.4",
@@ -88,14 +89,14 @@
88
89
  "react-dom": "^18.3.1",
89
90
  "react-styleguidist": "^13.1.4",
90
91
  "rollup": "^3.29.4",
91
- "rollup-plugin-import-css": "^3.5.8",
92
+ "rollup-plugin-import-css": "^4.1.2",
92
93
  "style-loader": "^3.3.3",
93
94
  "styled-components": "^6.1.19",
94
95
  "ts-jest": "^29.3.2",
95
96
  "ts-node": "^10.9.2",
96
97
  "tslib": "^2.8.1",
97
98
  "typescript": "^5.1.6",
98
- "webpack": "^5.99.8"
99
+ "webpack": "^5.102.1"
99
100
  },
100
101
  "dependencies": {
101
102
  "ramda": "^0.32.0",
@@ -110,5 +111,8 @@
110
111
  "react": ">=17.x <=19.x",
111
112
  "react-dom": ">=17.x <=19.x",
112
113
  "styled-components": "6.x"
114
+ },
115
+ "engines": {
116
+ "node": ">=20"
113
117
  }
114
118
  }