@speakapbv/dough-component-library 9.19.0 → 9.20.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,13 +1,20 @@
1
1
  import { ReactNode } from "react";
2
2
  import "./bread-crumb.scss";
3
3
  import { DoughDataAttributes, Sizes } from "../../utils/constants";
4
+ interface BreadCrumbTextProps {
5
+ children: string | number;
6
+ className?: string;
7
+ }
8
+ export declare const BreadCrumbText: ({ children, className, }: BreadCrumbTextProps) => JSX.Element;
4
9
  export interface BreadCrumbProps {
5
10
  className?: string;
6
11
  children?: ReactNode;
7
12
  size?: Sizes.SMALL | Sizes.NORMAL;
8
13
  dataAttributes?: DoughDataAttributes;
14
+ noElementWrapper?: boolean;
9
15
  }
10
16
  export declare const BreadCrumb: {
11
17
  (props: BreadCrumbProps): JSX.Element;
12
18
  displayName: string;
13
19
  };
20
+ export {};
@@ -16,5 +16,7 @@ export interface LinkProps {
16
16
  target?: string;
17
17
  rel?: string;
18
18
  download?: string;
19
+ width?: string;
20
+ flex?: string;
19
21
  }
20
- export declare const Link: React.ForwardRefExoticComponent<Pick<LinkProps, "className" | "dataAttributes" | "color" | "children" | "onClick" | "underline" | "fullWidth" | "disabled" | "colorOnlyOnHover" | "href" | "target" | "rel" | "download"> & React.RefAttributes<HTMLAnchorElement>>;
22
+ export declare const Link: React.ForwardRefExoticComponent<Pick<LinkProps, "className" | "dataAttributes" | "color" | "children" | "onClick" | "underline" | "fullWidth" | "disabled" | "colorOnlyOnHover" | "href" | "target" | "rel" | "download" | "width" | "flex"> & React.RefAttributes<HTMLAnchorElement>>;
package/dist/index.d.ts CHANGED
@@ -25,7 +25,7 @@ export { Switch } from "./components/form-elements/switch/switch";
25
25
  export { RadioGroup, DoughRadioGroupData, } from "./components/form-elements/selection-inputs/radio-group";
26
26
  export { RadioOption } from "./components/form-elements/selection-inputs/radio-option";
27
27
  export { Tag } from "./components/tag-comp/tag";
28
- export { BreadCrumb } from "./components/bread-crumb/bread-crumb";
28
+ export { BreadCrumb, BreadCrumbText, } from "./components/bread-crumb/bread-crumb";
29
29
  export { Badge } from "./components/badge/badge";
30
30
  export { Spacer } from "./components/spacer/spacer";
31
31
  export { Divider } from "./components/divider/divider";
package/dist/index.es.js CHANGED
@@ -1,4 +1,4 @@
1
- import React, { forwardRef, useState, useRef, useEffect, useImperativeHandle, Children } from 'react';
1
+ import React, { forwardRef, useState, useRef, useEffect, useImperativeHandle, Children, Fragment } from 'react';
2
2
  import { createPortal } from 'react-dom';
3
3
  import lottie from 'lottie-web/build/player/lottie_light';
4
4
 
@@ -605,7 +605,7 @@ var Link = forwardRef(function (props, ref) {
605
605
  cancelEvent(e);
606
606
  }
607
607
  }
608
- : undefined, download: props.download, target: props.target, rel: rel, ref: ref }, props.dataAttributes), props.children));
608
+ : undefined, download: props.download, target: props.target, rel: rel, ref: ref, style: { width: props.width, flex: props.flex } }, props.dataAttributes), props.children));
609
609
  });
610
610
  Link.displayName = "Link";
611
611
 
@@ -4041,22 +4041,42 @@ var RadioGroup = function (props) {
4041
4041
  };
4042
4042
  RadioGroup.displayName = "RadioGroup";
4043
4043
 
4044
- var css_248z$p = "/* COLORS */\n/* Typography*/\n/*Dennis should provide medium font size*/\n.dough-bread-crumb-wrapper {\n display: flex;\n flex-flow: row nowrap;\n align-items: center;\n justify-content: flex-start;\n width: 100%;\n font-size: 1.125rem;\n line-height: 1.125rem;\n font-weight: 700;\n font-family: \"Roboto\", sans-serif;\n}\n.dough-bread-crumb-wrapper > *:not(.dough-bread-crumb-right-arrow) {\n white-space: nowrap;\n text-overflow: ellipsis;\n overflow: hidden;\n font-size: inherit;\n line-height: inherit;\n}\n.dough-bread-crumb-wrapper > *:not(.dough-bread-crumb-right-arrow) > * {\n text-decoration: none !important;\n color: inherit !important;\n font-size: inherit;\n line-height: inherit;\n}\n.dough-bread-crumb-wrapper > *:not(.dough-bread-crumb-right-arrow):last-child {\n pointer-events: none !important;\n}\n.dough-bread-crumb-wrapper > .dough-bread-crumb-right-arrow {\n display: inline-flex;\n flex-flow: row nowrap;\n align-items: center;\n justify-content: center;\n box-sizing: border-box;\n width: 24px;\n height: 24px;\n padding: 3px 4px 5px 4px;\n}\n.dough-bread-crumb-wrapper > .dough-bread-crumb-right-arrow > svg {\n width: 100%;\n height: 100%;\n}\n.dough-bread-crumb-wrapper > .dough-bread-crumb-right-arrow > svg path {\n fill: #999999;\n fill: var(--dough-color-icon-default);\n}\n.dough-bread-crumb-wrapper.size-small {\n font-size: 0.875rem;\n line-height: 0.875rem;\n}\n.dough-bread-crumb-wrapper.size-small > .dough-bread-crumb-right-arrow {\n width: 20px;\n height: 20px;\n}";
4044
+ var css_248z$p = "/* COLORS */\n/* Typography*/\n/*Dennis should provide medium font size*/\n.dough-bread-crumb-ellipsis {\n white-space: nowrap;\n text-overflow: ellipsis;\n overflow: hidden;\n font-size: inherit;\n line-height: inherit;\n}\n\n.dough-bread-crumb-wrapper {\n display: flex;\n flex-flow: row nowrap;\n align-items: center;\n justify-content: flex-start;\n width: 100%;\n font-size: 1.125rem;\n line-height: 1.125rem;\n font-weight: 700;\n font-family: \"Roboto\", sans-serif;\n}\n.dough-bread-crumb-wrapper > *:not(.dough-bread-crumb-right-arrow) {\n white-space: nowrap;\n text-overflow: ellipsis;\n overflow: hidden;\n font-size: inherit;\n line-height: inherit;\n}\n.dough-bread-crumb-wrapper > *:not(.dough-bread-crumb-right-arrow) > * {\n text-decoration: none !important;\n color: inherit !important;\n font-size: inherit;\n line-height: inherit;\n}\n.dough-bread-crumb-wrapper > *:not(.dough-bread-crumb-right-arrow):last-child {\n pointer-events: none !important;\n}\n.dough-bread-crumb-wrapper > .dough-bread-crumb-right-arrow {\n display: inline-flex;\n flex-flow: row nowrap;\n align-items: center;\n justify-content: center;\n flex-shrink: 0;\n box-sizing: border-box;\n width: 24px;\n height: 24px;\n padding: 3px 4px 5px 4px;\n}\n.dough-bread-crumb-wrapper > .dough-bread-crumb-right-arrow > svg {\n width: 100%;\n height: 100%;\n}\n.dough-bread-crumb-wrapper > .dough-bread-crumb-right-arrow > svg path {\n fill: #999999;\n fill: var(--dough-color-icon-default);\n}\n.dough-bread-crumb-wrapper.size-small {\n font-size: 0.875rem;\n line-height: 0.875rem;\n}\n.dough-bread-crumb-wrapper.size-small > .dough-bread-crumb-right-arrow {\n width: 20px;\n height: 20px;\n}";
4045
4045
  styleInject(css_248z$p);
4046
4046
 
4047
+ /* Unpacks children wrapped in Fragments */
4048
+ function flattenChildren(children) {
4049
+ var childrenArray = Children.toArray(children);
4050
+ return childrenArray.reduce(function (flatChildren, child) {
4051
+ if (child.type === Fragment) {
4052
+ return flatChildren.concat(flattenChildren(child.props.children));
4053
+ }
4054
+ flatChildren.push(child);
4055
+ return flatChildren;
4056
+ }, []);
4057
+ }
4058
+
4059
+ var BreadCrumbText = function (_a) {
4060
+ var children = _a.children, className = _a.className;
4061
+ return (React.createElement("span", { className: cn("dough-bread-crumb-ellipsis", className) }, children));
4062
+ };
4047
4063
  var BreadCrumb = function (props) {
4048
- var _a = props.size, size = _a === void 0 ? Sizes.NORMAL : _a;
4064
+ var _a = props.size, size = _a === void 0 ? Sizes.NORMAL : _a, noElementWrapper = props.noElementWrapper;
4049
4065
  var getBreadCrumbs = function (children) {
4050
- var linkItems = Children.toArray(children);
4066
+ var linkItems = flattenChildren(children);
4051
4067
  if (linkItems && linkItems.length > 0) {
4052
4068
  return (React.createElement(React.Fragment, null, linkItems.map(function (link, index) {
4053
4069
  if (index === 0 ||
4054
4070
  linkItems.length < 4 ||
4055
4071
  index >= linkItems.length - 2) {
4056
4072
  return (React.createElement(React.Fragment, { key: "bc-link-" + index },
4057
- React.createElement("span", { className: index < linkItems.length - 1
4073
+ noElementWrapper ? (link) : typeof link === "string" ||
4074
+ typeof link === "number" ? (React.createElement(BreadCrumbText, { className: cn(index < linkItems.length - 1
4075
+ ? ColorsText.LIGHT
4076
+ : ColorsText.DARK) }, link)) : (
4077
+ /* To not include any breaking change, that part will stay*/ React.createElement("span", { className: index < linkItems.length - 1
4058
4078
  ? ColorsText.LIGHT
4059
- : ColorsText.DARK }, link),
4079
+ : ColorsText.DARK }, link)),
4060
4080
  index < linkItems.length - 1 && (React.createElement("span", { className: cn("dough-bread-crumb-right-arrow", "dough-color-icon-default") },
4061
4081
  React.createElement(RightIcon, null)))));
4062
4082
  }
@@ -5522,4 +5542,4 @@ GridItem.displayName = "GridItem";
5522
5542
 
5523
5543
  injectRobotoFont();
5524
5544
 
5525
- export { AlertStatus, AlertText, AppBackground, AppWrapper, Avatar, BR, Badge, BorderStyles, Box, BoxAlign, BoxAlignContent, BoxAlignment, BoxDirection, BoxDisplay, BoxJustifyContent, BoxOverflow, BoxWrap, BreadCrumb, BreakpointViewer, BreakpointViewportSizes, Button, ButtonInputType, Card, Carousel, CheckBox, Collapser, ColorTile, Colors, ColorsIcon, ColorsText, Container, ContentSlider, DatePicker, DateTime, DesignTokens, Dialog, Direction, Divider, DoughDateInput, DropMenu, Fader, FixedColors, Footer, Grid, GridContentAlignment, GridFlow, GridItem, GridItemsAlignment, H1, H2, H3, H4, H5, H6, H7, Header, HorizontalAlignment, HorizontalListSlider, Image, ImageCarousel, ImageContentShowOnHoverClassName, InputWrapper, LayoutContainer, LayoutFlexBox, Link, Notification, NumericInput, Overlay, PanelOverlay, Paragraph, RadioGroup, RadioOption, SelectBox, Sizes, Skeleton, SkeletonShape, Spacer, Spacings, Spinner, StepsIndicator, StrengthIndicator, Subtitle, Switch, Table, TableCell, TableRow, TableRowStyle, TabsContainer, Tag, Text, TextAlignment, TextArea, TextInput, TimePicker, Toggle, ToggleWithText, Tooltip, TooltipDirection, VerticalAlignment, cancelEvent, checkComponentType, cn, findParentBySelector, generateUID, hideLastDoughTooltip, setBreakpointSizeManually };
5545
+ export { AlertStatus, AlertText, AppBackground, AppWrapper, Avatar, BR, Badge, BorderStyles, Box, BoxAlign, BoxAlignContent, BoxAlignment, BoxDirection, BoxDisplay, BoxJustifyContent, BoxOverflow, BoxWrap, BreadCrumb, BreadCrumbText, BreakpointViewer, BreakpointViewportSizes, Button, ButtonInputType, Card, Carousel, CheckBox, Collapser, ColorTile, Colors, ColorsIcon, ColorsText, Container, ContentSlider, DatePicker, DateTime, DesignTokens, Dialog, Direction, Divider, DoughDateInput, DropMenu, Fader, FixedColors, Footer, Grid, GridContentAlignment, GridFlow, GridItem, GridItemsAlignment, H1, H2, H3, H4, H5, H6, H7, Header, HorizontalAlignment, HorizontalListSlider, Image, ImageCarousel, ImageContentShowOnHoverClassName, InputWrapper, LayoutContainer, LayoutFlexBox, Link, Notification, NumericInput, Overlay, PanelOverlay, Paragraph, RadioGroup, RadioOption, SelectBox, Sizes, Skeleton, SkeletonShape, Spacer, Spacings, Spinner, StepsIndicator, StrengthIndicator, Subtitle, Switch, Table, TableCell, TableRow, TableRowStyle, TabsContainer, Tag, Text, TextAlignment, TextArea, TextInput, TimePicker, Toggle, ToggleWithText, Tooltip, TooltipDirection, VerticalAlignment, cancelEvent, checkComponentType, cn, findParentBySelector, generateUID, hideLastDoughTooltip, setBreakpointSizeManually };
package/dist/index.js CHANGED
@@ -600,7 +600,7 @@ var Link = React.forwardRef(function (props, ref) {
600
600
  cancelEvent(e);
601
601
  }
602
602
  }
603
- : undefined, download: props.download, target: props.target, rel: rel, ref: ref }, props.dataAttributes), props.children));
603
+ : undefined, download: props.download, target: props.target, rel: rel, ref: ref, style: { width: props.width, flex: props.flex } }, props.dataAttributes), props.children));
604
604
  });
605
605
  Link.displayName = "Link";
606
606
 
@@ -4025,22 +4025,42 @@ var RadioGroup = function (props) {
4025
4025
  };
4026
4026
  RadioGroup.displayName = "RadioGroup";
4027
4027
 
4028
- var css_248z$p = "/* COLORS */\n/* Typography*/\n/*Dennis should provide medium font size*/\n.dough-bread-crumb-wrapper {\n display: flex;\n flex-flow: row nowrap;\n align-items: center;\n justify-content: flex-start;\n width: 100%;\n font-size: 1.125rem;\n line-height: 1.125rem;\n font-weight: 700;\n font-family: \"Roboto\", sans-serif;\n}\n.dough-bread-crumb-wrapper > *:not(.dough-bread-crumb-right-arrow) {\n white-space: nowrap;\n text-overflow: ellipsis;\n overflow: hidden;\n font-size: inherit;\n line-height: inherit;\n}\n.dough-bread-crumb-wrapper > *:not(.dough-bread-crumb-right-arrow) > * {\n text-decoration: none !important;\n color: inherit !important;\n font-size: inherit;\n line-height: inherit;\n}\n.dough-bread-crumb-wrapper > *:not(.dough-bread-crumb-right-arrow):last-child {\n pointer-events: none !important;\n}\n.dough-bread-crumb-wrapper > .dough-bread-crumb-right-arrow {\n display: inline-flex;\n flex-flow: row nowrap;\n align-items: center;\n justify-content: center;\n box-sizing: border-box;\n width: 24px;\n height: 24px;\n padding: 3px 4px 5px 4px;\n}\n.dough-bread-crumb-wrapper > .dough-bread-crumb-right-arrow > svg {\n width: 100%;\n height: 100%;\n}\n.dough-bread-crumb-wrapper > .dough-bread-crumb-right-arrow > svg path {\n fill: #999999;\n fill: var(--dough-color-icon-default);\n}\n.dough-bread-crumb-wrapper.size-small {\n font-size: 0.875rem;\n line-height: 0.875rem;\n}\n.dough-bread-crumb-wrapper.size-small > .dough-bread-crumb-right-arrow {\n width: 20px;\n height: 20px;\n}";
4028
+ var css_248z$p = "/* COLORS */\n/* Typography*/\n/*Dennis should provide medium font size*/\n.dough-bread-crumb-ellipsis {\n white-space: nowrap;\n text-overflow: ellipsis;\n overflow: hidden;\n font-size: inherit;\n line-height: inherit;\n}\n\n.dough-bread-crumb-wrapper {\n display: flex;\n flex-flow: row nowrap;\n align-items: center;\n justify-content: flex-start;\n width: 100%;\n font-size: 1.125rem;\n line-height: 1.125rem;\n font-weight: 700;\n font-family: \"Roboto\", sans-serif;\n}\n.dough-bread-crumb-wrapper > *:not(.dough-bread-crumb-right-arrow) {\n white-space: nowrap;\n text-overflow: ellipsis;\n overflow: hidden;\n font-size: inherit;\n line-height: inherit;\n}\n.dough-bread-crumb-wrapper > *:not(.dough-bread-crumb-right-arrow) > * {\n text-decoration: none !important;\n color: inherit !important;\n font-size: inherit;\n line-height: inherit;\n}\n.dough-bread-crumb-wrapper > *:not(.dough-bread-crumb-right-arrow):last-child {\n pointer-events: none !important;\n}\n.dough-bread-crumb-wrapper > .dough-bread-crumb-right-arrow {\n display: inline-flex;\n flex-flow: row nowrap;\n align-items: center;\n justify-content: center;\n flex-shrink: 0;\n box-sizing: border-box;\n width: 24px;\n height: 24px;\n padding: 3px 4px 5px 4px;\n}\n.dough-bread-crumb-wrapper > .dough-bread-crumb-right-arrow > svg {\n width: 100%;\n height: 100%;\n}\n.dough-bread-crumb-wrapper > .dough-bread-crumb-right-arrow > svg path {\n fill: #999999;\n fill: var(--dough-color-icon-default);\n}\n.dough-bread-crumb-wrapper.size-small {\n font-size: 0.875rem;\n line-height: 0.875rem;\n}\n.dough-bread-crumb-wrapper.size-small > .dough-bread-crumb-right-arrow {\n width: 20px;\n height: 20px;\n}";
4029
4029
  styleInject(css_248z$p);
4030
4030
 
4031
+ /* Unpacks children wrapped in Fragments */
4032
+ function flattenChildren(children) {
4033
+ var childrenArray = React.Children.toArray(children);
4034
+ return childrenArray.reduce(function (flatChildren, child) {
4035
+ if (child.type === React.Fragment) {
4036
+ return flatChildren.concat(flattenChildren(child.props.children));
4037
+ }
4038
+ flatChildren.push(child);
4039
+ return flatChildren;
4040
+ }, []);
4041
+ }
4042
+
4043
+ var BreadCrumbText = function (_a) {
4044
+ var children = _a.children, className = _a.className;
4045
+ return (React__default.createElement("span", { className: cn("dough-bread-crumb-ellipsis", className) }, children));
4046
+ };
4031
4047
  var BreadCrumb = function (props) {
4032
- var _a = props.size, size = _a === void 0 ? exports.Sizes.NORMAL : _a;
4048
+ var _a = props.size, size = _a === void 0 ? exports.Sizes.NORMAL : _a, noElementWrapper = props.noElementWrapper;
4033
4049
  var getBreadCrumbs = function (children) {
4034
- var linkItems = React.Children.toArray(children);
4050
+ var linkItems = flattenChildren(children);
4035
4051
  if (linkItems && linkItems.length > 0) {
4036
4052
  return (React__default.createElement(React__default.Fragment, null, linkItems.map(function (link, index) {
4037
4053
  if (index === 0 ||
4038
4054
  linkItems.length < 4 ||
4039
4055
  index >= linkItems.length - 2) {
4040
4056
  return (React__default.createElement(React__default.Fragment, { key: "bc-link-" + index },
4041
- React__default.createElement("span", { className: index < linkItems.length - 1
4057
+ noElementWrapper ? (link) : typeof link === "string" ||
4058
+ typeof link === "number" ? (React__default.createElement(BreadCrumbText, { className: cn(index < linkItems.length - 1
4059
+ ? exports.ColorsText.LIGHT
4060
+ : exports.ColorsText.DARK) }, link)) : (
4061
+ /* To not include any breaking change, that part will stay*/ React__default.createElement("span", { className: index < linkItems.length - 1
4042
4062
  ? exports.ColorsText.LIGHT
4043
- : exports.ColorsText.DARK }, link),
4063
+ : exports.ColorsText.DARK }, link)),
4044
4064
  index < linkItems.length - 1 && (React__default.createElement("span", { className: cn("dough-bread-crumb-right-arrow", "dough-color-icon-default") },
4045
4065
  React__default.createElement(RightIcon, null)))));
4046
4066
  }
@@ -5508,6 +5528,7 @@ exports.BR = BR;
5508
5528
  exports.Badge = Badge;
5509
5529
  exports.Box = Box;
5510
5530
  exports.BreadCrumb = BreadCrumb;
5531
+ exports.BreadCrumbText = BreadCrumbText;
5511
5532
  exports.BreakpointViewer = BreakpointViewer;
5512
5533
  exports.Button = Button;
5513
5534
  exports.Card = Card;
@@ -0,0 +1,24 @@
1
+ import { BreadCrumbProps } from "./bread-crumb";
2
+ declare const _default: import("@storybook/csf").ComponentAnnotations<import("@storybook/react").ReactFramework, BreadCrumbProps>;
3
+ export default _default;
4
+ export declare const Simple: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactFramework, BreadCrumbProps & {
5
+ width: string;
6
+ }>;
7
+ export declare const OneChild: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactFramework, BreadCrumbProps & {
8
+ width: string;
9
+ }>;
10
+ export declare const LimitedWidth: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactFramework, BreadCrumbProps & {
11
+ width: string;
12
+ }>;
13
+ export declare const MultipleChildren: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactFramework, BreadCrumbProps & {
14
+ width: string;
15
+ }>;
16
+ export declare const CustomChildren: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactFramework, BreadCrumbProps & {
17
+ width: string;
18
+ }>;
19
+ export declare const CustomChildrenLimitedWidth: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactFramework, BreadCrumbProps & {
20
+ width: string;
21
+ }>;
22
+ export declare const WithoutUsingFragments: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactFramework, BreadCrumbProps & {
23
+ width: string;
24
+ }>;
@@ -0,0 +1,4 @@
1
+ import { Children, ReactNode } from "react";
2
+ declare type ReactChildArray = ReturnType<typeof Children.toArray>;
3
+ export declare function flattenChildren(children: ReactNode): ReactChildArray;
4
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@speakapbv/dough-component-library",
3
- "version": "9.19.0",
3
+ "version": "9.20.0",
4
4
  "description": "DOUGH: Speakap React Component Library",
5
5
  "author": "Speakap",
6
6
  "license": "MIT",